@copilotkit/aimock 1.11.0 → 1.13.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 (289) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +24 -4
  4. package/dist/_virtual/_rolldown/runtime.cjs +2 -0
  5. package/dist/_virtual/_rolldown/runtime.js +29 -0
  6. package/dist/agui-types.d.cts.map +1 -1
  7. package/dist/aimock-cli.cjs +16 -0
  8. package/dist/aimock-cli.cjs.map +1 -1
  9. package/dist/aimock-cli.d.cts +2 -0
  10. package/dist/aimock-cli.d.cts.map +1 -1
  11. package/dist/aimock-cli.d.ts +2 -0
  12. package/dist/aimock-cli.d.ts.map +1 -1
  13. package/dist/aimock-cli.js +16 -0
  14. package/dist/aimock-cli.js.map +1 -1
  15. package/dist/bedrock-converse.cjs +2 -0
  16. package/dist/bedrock-converse.cjs.map +1 -1
  17. package/dist/bedrock-converse.d.cts.map +1 -1
  18. package/dist/bedrock-converse.d.ts.map +1 -1
  19. package/dist/bedrock-converse.js +2 -0
  20. package/dist/bedrock-converse.js.map +1 -1
  21. package/dist/bedrock.cjs +2 -0
  22. package/dist/bedrock.cjs.map +1 -1
  23. package/dist/bedrock.d.cts.map +1 -1
  24. package/dist/bedrock.d.ts.map +1 -1
  25. package/dist/bedrock.js +2 -0
  26. package/dist/bedrock.js.map +1 -1
  27. package/dist/cohere.cjs +1 -0
  28. package/dist/cohere.cjs.map +1 -1
  29. package/dist/cohere.js +1 -0
  30. package/dist/cohere.js.map +1 -1
  31. package/dist/config-loader.d.cts.map +1 -1
  32. package/dist/convert-mockllm.cjs +232 -0
  33. package/dist/convert-mockllm.cjs.map +1 -0
  34. package/dist/convert-mockllm.js +230 -0
  35. package/dist/convert-mockllm.js.map +1 -0
  36. package/dist/convert-vidaimock.cjs +110 -0
  37. package/dist/convert-vidaimock.cjs.map +1 -0
  38. package/dist/convert-vidaimock.js +108 -0
  39. package/dist/convert-vidaimock.js.map +1 -0
  40. package/dist/convert.cjs +158 -0
  41. package/dist/convert.cjs.map +1 -0
  42. package/dist/convert.d.cts +16 -0
  43. package/dist/convert.d.cts.map +1 -0
  44. package/dist/convert.d.ts +16 -0
  45. package/dist/convert.d.ts.map +1 -0
  46. package/dist/convert.js +157 -0
  47. package/dist/convert.js.map +1 -0
  48. package/dist/embeddings.cjs +2 -1
  49. package/dist/embeddings.cjs.map +1 -1
  50. package/dist/embeddings.js +2 -1
  51. package/dist/embeddings.js.map +1 -1
  52. package/dist/gemini.cjs +1 -0
  53. package/dist/gemini.cjs.map +1 -1
  54. package/dist/gemini.js +1 -0
  55. package/dist/gemini.js.map +1 -1
  56. package/dist/helpers.cjs +16 -0
  57. package/dist/helpers.cjs.map +1 -1
  58. package/dist/helpers.d.cts +6 -2
  59. package/dist/helpers.d.cts.map +1 -1
  60. package/dist/helpers.d.ts +6 -2
  61. package/dist/helpers.d.ts.map +1 -1
  62. package/dist/helpers.js +13 -1
  63. package/dist/helpers.js.map +1 -1
  64. package/dist/images.cjs +166 -0
  65. package/dist/images.cjs.map +1 -0
  66. package/dist/images.d.cts +11 -0
  67. package/dist/images.d.cts.map +1 -0
  68. package/dist/images.d.ts +11 -0
  69. package/dist/images.d.ts.map +1 -0
  70. package/dist/images.js +166 -0
  71. package/dist/images.js.map +1 -0
  72. package/dist/index.cjs +13 -0
  73. package/dist/index.d.cts +7 -3
  74. package/dist/index.d.ts +7 -3
  75. package/dist/index.js +6 -2
  76. package/dist/jest.cjs +70 -0
  77. package/dist/jest.cjs.map +1 -0
  78. package/dist/jest.d.cts +33 -0
  79. package/dist/jest.d.cts.map +1 -0
  80. package/dist/jest.d.ts +33 -0
  81. package/dist/jest.d.ts.map +1 -0
  82. package/dist/jest.js +67 -0
  83. package/dist/jest.js.map +1 -0
  84. package/dist/llmock.cjs +37 -1
  85. package/dist/llmock.cjs.map +1 -1
  86. package/dist/llmock.d.cts +5 -1
  87. package/dist/llmock.d.cts.map +1 -1
  88. package/dist/llmock.d.ts +5 -1
  89. package/dist/llmock.d.ts.map +1 -1
  90. package/dist/llmock.js +37 -1
  91. package/dist/llmock.js.map +1 -1
  92. package/dist/messages.cjs +1 -0
  93. package/dist/messages.cjs.map +1 -1
  94. package/dist/messages.js +1 -0
  95. package/dist/messages.js.map +1 -1
  96. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs +934 -0
  97. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs.map +1 -0
  98. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +934 -0
  99. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  100. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs +1051 -0
  101. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs.map +1 -0
  102. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +1042 -0
  103. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js.map +1 -0
  104. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.cjs +1 -0
  105. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.js +3 -0
  106. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +96 -0
  107. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs.map +1 -0
  108. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +93 -0
  109. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  110. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs +49 -0
  111. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs.map +1 -0
  112. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js +43 -0
  113. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  114. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs +456 -0
  115. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs.map +1 -0
  116. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +456 -0
  117. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js.map +1 -0
  118. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs +170 -0
  119. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs.map +1 -0
  120. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js +169 -0
  121. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  122. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs +388 -0
  123. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs.map +1 -0
  124. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +385 -0
  125. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js.map +1 -0
  126. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs +12 -0
  127. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs.map +1 -0
  128. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +12 -0
  129. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  130. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs +17 -0
  131. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs.map +1 -0
  132. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +17 -0
  133. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  134. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs +12 -0
  135. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs.map +1 -0
  136. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +12 -0
  137. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  138. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs +16 -0
  139. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs.map +1 -0
  140. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +16 -0
  141. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  142. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs +14 -0
  143. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs.map +1 -0
  144. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +14 -0
  145. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  146. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs +35 -0
  147. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs.map +1 -0
  148. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +35 -0
  149. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  150. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs +13 -0
  151. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs.map +1 -0
  152. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +13 -0
  153. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  154. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs +128 -0
  155. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs.map +1 -0
  156. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +123 -0
  157. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  158. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs +41 -0
  159. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs.map +1 -0
  160. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +40 -0
  161. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  162. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs +100 -0
  163. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs.map +1 -0
  164. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +100 -0
  165. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  166. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs +26 -0
  167. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs.map +1 -0
  168. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +26 -0
  169. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  170. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs +15 -0
  171. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs.map +1 -0
  172. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +15 -0
  173. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  174. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs +22 -0
  175. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs.map +1 -0
  176. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +22 -0
  177. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  178. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs +7 -0
  179. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs.map +1 -0
  180. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  181. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  182. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs +13 -0
  183. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs.map +1 -0
  184. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +13 -0
  185. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  186. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs +19 -0
  187. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs.map +1 -0
  188. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +19 -0
  189. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  190. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs +26 -0
  191. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs.map +1 -0
  192. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +26 -0
  193. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  194. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs +10 -0
  195. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs.map +1 -0
  196. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  197. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  198. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs +31 -0
  199. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs.map +1 -0
  200. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +31 -0
  201. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  202. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs +52 -0
  203. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs.map +1 -0
  204. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js +52 -0
  205. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js.map +1 -0
  206. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs +83 -0
  207. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs.map +1 -0
  208. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  209. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  210. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs +10 -0
  211. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs.map +1 -0
  212. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +10 -0
  213. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  214. package/dist/ollama.cjs +2 -0
  215. package/dist/ollama.cjs.map +1 -1
  216. package/dist/ollama.d.cts.map +1 -1
  217. package/dist/ollama.d.ts.map +1 -1
  218. package/dist/ollama.js +2 -0
  219. package/dist/ollama.js.map +1 -1
  220. package/dist/recorder.cjs +50 -7
  221. package/dist/recorder.cjs.map +1 -1
  222. package/dist/recorder.js +50 -7
  223. package/dist/recorder.js.map +1 -1
  224. package/dist/responses.cjs +1 -0
  225. package/dist/responses.cjs.map +1 -1
  226. package/dist/responses.js +1 -0
  227. package/dist/responses.js.map +1 -1
  228. package/dist/router.cjs +8 -0
  229. package/dist/router.cjs.map +1 -1
  230. package/dist/router.d.cts.map +1 -1
  231. package/dist/router.d.ts.map +1 -1
  232. package/dist/router.js +9 -0
  233. package/dist/router.js.map +1 -1
  234. package/dist/server.cjs +80 -3
  235. package/dist/server.cjs.map +1 -1
  236. package/dist/server.d.cts +2 -0
  237. package/dist/server.d.cts.map +1 -1
  238. package/dist/server.d.ts +2 -0
  239. package/dist/server.d.ts.map +1 -1
  240. package/dist/server.js +80 -3
  241. package/dist/server.js.map +1 -1
  242. package/dist/speech.cjs +144 -0
  243. package/dist/speech.cjs.map +1 -0
  244. package/dist/speech.d.cts +11 -0
  245. package/dist/speech.d.cts.map +1 -0
  246. package/dist/speech.d.ts +11 -0
  247. package/dist/speech.d.ts.map +1 -0
  248. package/dist/speech.js +144 -0
  249. package/dist/speech.js.map +1 -0
  250. package/dist/transcription.cjs +134 -0
  251. package/dist/transcription.cjs.map +1 -0
  252. package/dist/transcription.d.cts +11 -0
  253. package/dist/transcription.d.cts.map +1 -0
  254. package/dist/transcription.d.ts +11 -0
  255. package/dist/transcription.d.ts.map +1 -0
  256. package/dist/transcription.js +134 -0
  257. package/dist/transcription.js.map +1 -0
  258. package/dist/types.d.cts +44 -2
  259. package/dist/types.d.cts.map +1 -1
  260. package/dist/types.d.ts +44 -2
  261. package/dist/types.d.ts.map +1 -1
  262. package/dist/video.cjs +196 -0
  263. package/dist/video.cjs.map +1 -0
  264. package/dist/video.d.cts +14 -0
  265. package/dist/video.d.cts.map +1 -0
  266. package/dist/video.d.ts +14 -0
  267. package/dist/video.d.ts.map +1 -0
  268. package/dist/video.js +195 -0
  269. package/dist/video.js.map +1 -0
  270. package/dist/vitest.cjs +80 -0
  271. package/dist/vitest.cjs.map +1 -0
  272. package/dist/vitest.d.cts +30 -0
  273. package/dist/vitest.d.cts.map +1 -0
  274. package/dist/vitest.d.ts +30 -0
  275. package/dist/vitest.d.ts.map +1 -0
  276. package/dist/vitest.js +77 -0
  277. package/dist/vitest.js.map +1 -0
  278. package/fixtures/examples/a2a/a2a-config.json +42 -0
  279. package/fixtures/examples/agui/agui-text-response.json +35 -0
  280. package/fixtures/examples/chaos/chaos-config.json +10 -0
  281. package/fixtures/examples/full-suite.json +116 -0
  282. package/fixtures/examples/llm/embeddings.json +10 -0
  283. package/fixtures/examples/llm/error-injection.json +15 -0
  284. package/fixtures/examples/llm/sequential-responses.json +20 -0
  285. package/fixtures/examples/llm/streaming-physics.json +15 -0
  286. package/fixtures/examples/mcp/mcp-config.json +26 -0
  287. package/fixtures/examples/record-replay/record-config.json +11 -0
  288. package/fixtures/examples/vector/vector-config.json +34 -0
  289. package/package.json +60 -2
package/dist/video.js ADDED
@@ -0,0 +1,195 @@
1
+ import { flattenHeaders, getTestId, isErrorResponse, isVideoResponse } from "./helpers.js";
2
+ import { matchFixture } from "./router.js";
3
+ import { writeErrorResponse } from "./sse-writer.js";
4
+ import { applyChaos } from "./chaos.js";
5
+ import { proxyAndRecord } from "./recorder.js";
6
+
7
+ //#region src/video.ts
8
+ async function handleVideoCreate(req, res, raw, fixtures, journal, defaults, setCorsHeaders, videoStates) {
9
+ setCorsHeaders(res);
10
+ const path = req.url ?? "/v1/videos";
11
+ const method = req.method ?? "POST";
12
+ let videoReq;
13
+ try {
14
+ videoReq = JSON.parse(raw);
15
+ } catch {
16
+ journal.add({
17
+ method,
18
+ path,
19
+ headers: flattenHeaders(req.headers),
20
+ body: null,
21
+ response: {
22
+ status: 400,
23
+ fixture: null
24
+ }
25
+ });
26
+ writeErrorResponse(res, 400, JSON.stringify({ error: {
27
+ message: "Malformed JSON",
28
+ type: "invalid_request_error",
29
+ code: "invalid_json"
30
+ } }));
31
+ return;
32
+ }
33
+ const syntheticReq = {
34
+ model: videoReq.model ?? "sora-2",
35
+ messages: [{
36
+ role: "user",
37
+ content: videoReq.prompt
38
+ }],
39
+ _endpointType: "video"
40
+ };
41
+ const testId = getTestId(req);
42
+ const fixture = matchFixture(fixtures, syntheticReq, journal.getFixtureMatchCountsForTest(testId), defaults.requestTransform);
43
+ if (fixture) journal.incrementFixtureMatchCount(fixture, fixtures, testId);
44
+ if (applyChaos(res, fixture, defaults.chaos, req.headers, journal, {
45
+ method,
46
+ path,
47
+ headers: flattenHeaders(req.headers),
48
+ body: syntheticReq
49
+ }, defaults.registry, defaults.logger)) return;
50
+ if (!fixture) {
51
+ if (defaults.record) {
52
+ if (await proxyAndRecord(req, res, syntheticReq, "openai", req.url ?? "/v1/videos", fixtures, defaults, raw)) {
53
+ journal.add({
54
+ method,
55
+ path,
56
+ headers: flattenHeaders(req.headers),
57
+ body: syntheticReq,
58
+ response: {
59
+ status: res.statusCode ?? 200,
60
+ fixture: null
61
+ }
62
+ });
63
+ return;
64
+ }
65
+ }
66
+ const strictStatus = defaults.strict ? 503 : 404;
67
+ const strictMessage = defaults.strict ? "Strict mode: no fixture matched" : "No fixture matched";
68
+ journal.add({
69
+ method,
70
+ path,
71
+ headers: flattenHeaders(req.headers),
72
+ body: syntheticReq,
73
+ response: {
74
+ status: strictStatus,
75
+ fixture: null
76
+ }
77
+ });
78
+ writeErrorResponse(res, strictStatus, JSON.stringify({ error: {
79
+ message: strictMessage,
80
+ type: "invalid_request_error",
81
+ code: "no_fixture_match"
82
+ } }));
83
+ return;
84
+ }
85
+ const response = fixture.response;
86
+ if (isErrorResponse(response)) {
87
+ const status = response.status ?? 500;
88
+ journal.add({
89
+ method,
90
+ path,
91
+ headers: flattenHeaders(req.headers),
92
+ body: syntheticReq,
93
+ response: {
94
+ status,
95
+ fixture
96
+ }
97
+ });
98
+ writeErrorResponse(res, status, JSON.stringify(response));
99
+ return;
100
+ }
101
+ if (!isVideoResponse(response)) {
102
+ journal.add({
103
+ method,
104
+ path,
105
+ headers: flattenHeaders(req.headers),
106
+ body: syntheticReq,
107
+ response: {
108
+ status: 500,
109
+ fixture
110
+ }
111
+ });
112
+ writeErrorResponse(res, 500, JSON.stringify({ error: {
113
+ message: "Fixture response is not a video type",
114
+ type: "server_error"
115
+ } }));
116
+ return;
117
+ }
118
+ journal.add({
119
+ method,
120
+ path,
121
+ headers: flattenHeaders(req.headers),
122
+ body: syntheticReq,
123
+ response: {
124
+ status: 200,
125
+ fixture
126
+ }
127
+ });
128
+ const video = response.video;
129
+ const created_at = Math.floor(Date.now() / 1e3);
130
+ const stateKey = `${testId}:${video.id}`;
131
+ videoStates.set(stateKey, video);
132
+ if (video.status === "completed") {
133
+ res.writeHead(200, { "Content-Type": "application/json" });
134
+ res.end(JSON.stringify({
135
+ id: video.id,
136
+ status: video.status,
137
+ url: video.url,
138
+ created_at
139
+ }));
140
+ } else {
141
+ res.writeHead(200, { "Content-Type": "application/json" });
142
+ res.end(JSON.stringify({
143
+ id: video.id,
144
+ status: video.status,
145
+ created_at
146
+ }));
147
+ }
148
+ }
149
+ function handleVideoStatus(req, res, videoId, journal, setCorsHeaders, videoStates) {
150
+ setCorsHeaders(res);
151
+ const path = req.url ?? `/v1/videos/${videoId}`;
152
+ const method = req.method ?? "GET";
153
+ const stateKey = `${getTestId(req)}:${videoId}`;
154
+ const video = videoStates.get(stateKey);
155
+ if (!video) {
156
+ journal.add({
157
+ method,
158
+ path,
159
+ headers: flattenHeaders(req.headers),
160
+ body: null,
161
+ response: {
162
+ status: 404,
163
+ fixture: null
164
+ }
165
+ });
166
+ writeErrorResponse(res, 404, JSON.stringify({ error: {
167
+ message: `Video ${videoId} not found`,
168
+ type: "not_found"
169
+ } }));
170
+ return;
171
+ }
172
+ journal.add({
173
+ method,
174
+ path,
175
+ headers: flattenHeaders(req.headers),
176
+ body: null,
177
+ response: {
178
+ status: 200,
179
+ fixture: null
180
+ }
181
+ });
182
+ const created_at = Math.floor(Date.now() / 1e3);
183
+ const body = {
184
+ id: video.id,
185
+ status: video.status,
186
+ created_at
187
+ };
188
+ if (video.url) body.url = video.url;
189
+ res.writeHead(200, { "Content-Type": "application/json" });
190
+ res.end(JSON.stringify(body));
191
+ }
192
+
193
+ //#endregion
194
+ export { handleVideoCreate, handleVideoStatus };
195
+ //# sourceMappingURL=video.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.js","names":[],"sources":["../src/video.ts"],"sourcesContent":["import type * as http from \"node:http\";\nimport type { ChatCompletionRequest, Fixture, HandlerDefaults, VideoResponse } from \"./types.js\";\nimport { isVideoResponse, isErrorResponse, flattenHeaders, getTestId } from \"./helpers.js\";\nimport { matchFixture } from \"./router.js\";\nimport { writeErrorResponse } from \"./sse-writer.js\";\nimport type { Journal } from \"./journal.js\";\nimport { applyChaos } from \"./chaos.js\";\nimport { proxyAndRecord } from \"./recorder.js\";\n\ninterface VideoRequest {\n model?: string;\n prompt: string;\n [key: string]: unknown;\n}\n\n/** Stored video state for GET status checks. Key: `${testId}:${videoId}` */\nexport type VideoStateMap = Map<string, VideoResponse[\"video\"]>;\n\nexport async function handleVideoCreate(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n raw: string,\n fixtures: Fixture[],\n journal: Journal,\n defaults: HandlerDefaults,\n setCorsHeaders: (res: http.ServerResponse) => void,\n videoStates: VideoStateMap,\n): Promise<void> {\n setCorsHeaders(res);\n const path = req.url ?? \"/v1/videos\";\n const method = req.method ?? \"POST\";\n\n let videoReq: VideoRequest;\n try {\n videoReq = JSON.parse(raw) as VideoRequest;\n } catch {\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: null,\n response: { status: 400, fixture: null },\n });\n writeErrorResponse(\n res,\n 400,\n JSON.stringify({\n error: { message: \"Malformed JSON\", type: \"invalid_request_error\", code: \"invalid_json\" },\n }),\n );\n return;\n }\n\n const syntheticReq: ChatCompletionRequest = {\n model: videoReq.model ?? \"sora-2\",\n messages: [{ role: \"user\", content: videoReq.prompt }],\n _endpointType: \"video\",\n };\n\n const testId = getTestId(req);\n const fixture = matchFixture(\n fixtures,\n syntheticReq,\n journal.getFixtureMatchCountsForTest(testId),\n defaults.requestTransform,\n );\n\n if (fixture) {\n journal.incrementFixtureMatchCount(fixture, fixtures, testId);\n }\n\n if (\n applyChaos(\n res,\n fixture,\n defaults.chaos,\n req.headers,\n journal,\n { method, path, headers: flattenHeaders(req.headers), body: syntheticReq },\n defaults.registry,\n defaults.logger,\n )\n )\n return;\n\n if (!fixture) {\n if (defaults.record) {\n const proxied = await proxyAndRecord(\n req,\n res,\n syntheticReq,\n \"openai\",\n req.url ?? \"/v1/videos\",\n fixtures,\n defaults,\n raw,\n );\n if (proxied) {\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: syntheticReq,\n response: { status: res.statusCode ?? 200, fixture: null },\n });\n return;\n }\n }\n\n const strictStatus = defaults.strict ? 503 : 404;\n const strictMessage = defaults.strict\n ? \"Strict mode: no fixture matched\"\n : \"No fixture matched\";\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: syntheticReq,\n response: { status: strictStatus, fixture: null },\n });\n writeErrorResponse(\n res,\n strictStatus,\n JSON.stringify({\n error: { message: strictMessage, type: \"invalid_request_error\", code: \"no_fixture_match\" },\n }),\n );\n return;\n }\n\n const response = fixture.response;\n\n if (isErrorResponse(response)) {\n const status = response.status ?? 500;\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: syntheticReq,\n response: { status, fixture },\n });\n writeErrorResponse(res, status, JSON.stringify(response));\n return;\n }\n\n if (!isVideoResponse(response)) {\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: syntheticReq,\n response: { status: 500, fixture },\n });\n writeErrorResponse(\n res,\n 500,\n JSON.stringify({\n error: { message: \"Fixture response is not a video type\", type: \"server_error\" },\n }),\n );\n return;\n }\n\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: syntheticReq,\n response: { status: 200, fixture },\n });\n\n const video = response.video;\n const created_at = Math.floor(Date.now() / 1000);\n\n // Store for GET status checks\n const stateKey = `${testId}:${video.id}`;\n videoStates.set(stateKey, video);\n\n if (video.status === \"completed\") {\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ id: video.id, status: video.status, url: video.url, created_at }));\n } else {\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ id: video.id, status: video.status, created_at }));\n }\n}\n\nexport function handleVideoStatus(\n req: http.IncomingMessage,\n res: http.ServerResponse,\n videoId: string,\n journal: Journal,\n setCorsHeaders: (res: http.ServerResponse) => void,\n videoStates: VideoStateMap,\n): void {\n setCorsHeaders(res);\n const path = req.url ?? `/v1/videos/${videoId}`;\n const method = req.method ?? \"GET\";\n\n const testId = getTestId(req);\n const stateKey = `${testId}:${videoId}`;\n const video = videoStates.get(stateKey);\n\n if (!video) {\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: null,\n response: { status: 404, fixture: null },\n });\n writeErrorResponse(\n res,\n 404,\n JSON.stringify({ error: { message: `Video ${videoId} not found`, type: \"not_found\" } }),\n );\n return;\n }\n\n journal.add({\n method,\n path,\n headers: flattenHeaders(req.headers),\n body: null,\n response: { status: 200, fixture: null },\n });\n\n const created_at = Math.floor(Date.now() / 1000);\n const body: Record<string, unknown> = {\n id: video.id,\n status: video.status,\n created_at,\n };\n if (video.url) body.url = video.url;\n\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify(body));\n}\n"],"mappings":"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"}
@@ -0,0 +1,80 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_fixture_loader = require('./fixture-loader.cjs');
4
+ const require_llmock = require('./llmock.cjs');
5
+ const require_chunk_hooks = require('./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs');
6
+ let node_path = require("node:path");
7
+ let node_fs = require("node:fs");
8
+
9
+ //#region src/vitest.ts
10
+ /**
11
+ * Vitest integration for aimock.
12
+ *
13
+ * Usage:
14
+ * import { useAimock } from "@copilotkit/aimock/vitest";
15
+ *
16
+ * const mock = useAimock({ fixtures: "./fixtures" });
17
+ *
18
+ * it("responds", async () => {
19
+ * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });
20
+ * });
21
+ */
22
+ /**
23
+ * Start an aimock server for the duration of the test suite.
24
+ *
25
+ * - `beforeAll`: starts the server and optionally loads fixtures
26
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
27
+ * - `afterAll`: stops the server
28
+ *
29
+ * Returns a getter function — call it inside tests to access the handle.
30
+ */
31
+ function useAimock(options = {}) {
32
+ let handle = null;
33
+ require_chunk_hooks.beforeAll(async () => {
34
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
35
+ const llm = new require_llmock.LLMock(serverOpts);
36
+ if (fixturePath) {
37
+ const loadedFixtures = loadFixtures((0, node_path.resolve)(fixturePath));
38
+ for (const f of loadedFixtures) llm.addFixture(f);
39
+ }
40
+ const url = await llm.start();
41
+ if (patchEnv !== false) {
42
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
43
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
44
+ }
45
+ handle = {
46
+ llm,
47
+ url
48
+ };
49
+ });
50
+ require_chunk_hooks.beforeEach(() => {
51
+ if (handle) handle.llm.resetMatchCounts();
52
+ });
53
+ require_chunk_hooks.afterAll(async () => {
54
+ if (handle) {
55
+ if (options.patchEnv !== false) {
56
+ delete process.env.OPENAI_BASE_URL;
57
+ delete process.env.ANTHROPIC_BASE_URL;
58
+ }
59
+ await handle.llm.stop();
60
+ handle = null;
61
+ }
62
+ });
63
+ return () => {
64
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
65
+ return handle;
66
+ };
67
+ }
68
+ function loadFixtures(fixturePath) {
69
+ try {
70
+ if ((0, node_fs.statSync)(fixturePath).isDirectory()) return require_fixture_loader.loadFixturesFromDir(fixturePath);
71
+ return require_fixture_loader.loadFixtureFile(fixturePath);
72
+ } catch {
73
+ return [];
74
+ }
75
+ }
76
+
77
+ //#endregion
78
+ exports.LLMock = require_llmock.LLMock;
79
+ exports.useAimock = useAimock;
80
+ //# sourceMappingURL=vitest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.cjs","names":["LLMock","loadFixturesFromDir","loadFixtureFile"],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,+BAAU,YAAY;EACpB,MAAM,EAAE,UAAU,aAAa,UAAU,GAAG,eAAe;EAC3D,MAAM,MAAM,IAAIA,sBAAO,WAAW;AAElC,MAAI,aAAa;GAEf,MAAM,iBAAiB,oCADE,YAAY,CACQ;AAC7C,QAAK,MAAM,KAAK,eACd,KAAI,WAAW,EAAE;;EAIrB,MAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,MAAI,aAAa,OAAO;AACtB,WAAQ,IAAI,kBAAkB,GAAG,IAAI;AACrC,WAAQ,IAAI,qBAAqB,GAAG,IAAI;;AAG1C,WAAS;GAAE;GAAK;GAAK;GACrB;AAEF,sCAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,8BAAS,YAAY;AACnB,MAAI,QAAQ;AACV,OAAI,QAAQ,aAAa,OAAO;AAC9B,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;;AAErB,SAAM,OAAO,IAAI,MAAM;AACvB,YAAS;;GAEX;AAEF,cAAa;AACX,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,wEAAwE;AAE1F,SAAO;;;AAIX,SAAS,aAAa,aAAgC;AACpD,KAAI;AAEF,4BADsB,YAAY,CACzB,aAAa,CACpB,QAAOC,2CAAoB,YAAY;AAEzC,SAAOC,uCAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
@@ -0,0 +1,30 @@
1
+ import { Fixture, MockServerOptions } from "./types.cjs";
2
+ import { LLMock } from "./llmock.cjs";
3
+
4
+ //#region src/vitest.d.ts
5
+
6
+ interface UseAimockOptions extends MockServerOptions {
7
+ /** Path to fixture file or directory. Loaded automatically on start. */
8
+ fixtures?: string;
9
+ /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */
10
+ patchEnv?: boolean;
11
+ }
12
+ interface AimockHandle {
13
+ /** The LLMock instance. */
14
+ readonly llm: LLMock;
15
+ /** The server URL (e.g., http://127.0.0.1:4010). */
16
+ readonly url: string;
17
+ }
18
+ /**
19
+ * Start an aimock server for the duration of the test suite.
20
+ *
21
+ * - `beforeAll`: starts the server and optionally loads fixtures
22
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
23
+ * - `afterAll`: stops the server
24
+ *
25
+ * Returns a getter function — call it inside tests to access the handle.
26
+ */
27
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
28
+ //#endregion
29
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
30
+ //# sourceMappingURL=vitest.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.cts","names":[],"sources":["../src/vitest.ts"],"sourcesContent":[],"mappings":";;;;;UAoBiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;iBAcA,SAAA,WAAmB,yBAA8B"}
@@ -0,0 +1,30 @@
1
+ import { Fixture, MockServerOptions } from "./types.js";
2
+ import { LLMock } from "./llmock.js";
3
+
4
+ //#region src/vitest.d.ts
5
+
6
+ interface UseAimockOptions extends MockServerOptions {
7
+ /** Path to fixture file or directory. Loaded automatically on start. */
8
+ fixtures?: string;
9
+ /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */
10
+ patchEnv?: boolean;
11
+ }
12
+ interface AimockHandle {
13
+ /** The LLMock instance. */
14
+ readonly llm: LLMock;
15
+ /** The server URL (e.g., http://127.0.0.1:4010). */
16
+ readonly url: string;
17
+ }
18
+ /**
19
+ * Start an aimock server for the duration of the test suite.
20
+ *
21
+ * - `beforeAll`: starts the server and optionally loads fixtures
22
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
23
+ * - `afterAll`: stops the server
24
+ *
25
+ * Returns a getter function — call it inside tests to access the handle.
26
+ */
27
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
28
+ //#endregion
29
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
30
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","names":[],"sources":["../src/vitest.ts"],"sourcesContent":[],"mappings":";;;;;UAoBiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;iBAcA,SAAA,WAAmB,yBAA8B"}
package/dist/vitest.js ADDED
@@ -0,0 +1,77 @@
1
+ import { loadFixtureFile, loadFixturesFromDir } from "./fixture-loader.js";
2
+ import { LLMock } from "./llmock.js";
3
+ import { afterAll, beforeAll, beforeEach } from "./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js";
4
+ import { resolve } from "node:path";
5
+ import { statSync } from "node:fs";
6
+
7
+ //#region src/vitest.ts
8
+ /**
9
+ * Vitest integration for aimock.
10
+ *
11
+ * Usage:
12
+ * import { useAimock } from "@copilotkit/aimock/vitest";
13
+ *
14
+ * const mock = useAimock({ fixtures: "./fixtures" });
15
+ *
16
+ * it("responds", async () => {
17
+ * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });
18
+ * });
19
+ */
20
+ /**
21
+ * Start an aimock server for the duration of the test suite.
22
+ *
23
+ * - `beforeAll`: starts the server and optionally loads fixtures
24
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
25
+ * - `afterAll`: stops the server
26
+ *
27
+ * Returns a getter function — call it inside tests to access the handle.
28
+ */
29
+ function useAimock(options = {}) {
30
+ let handle = null;
31
+ beforeAll(async () => {
32
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
33
+ const llm = new LLMock(serverOpts);
34
+ if (fixturePath) {
35
+ const loadedFixtures = loadFixtures(resolve(fixturePath));
36
+ for (const f of loadedFixtures) llm.addFixture(f);
37
+ }
38
+ const url = await llm.start();
39
+ if (patchEnv !== false) {
40
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
41
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
42
+ }
43
+ handle = {
44
+ llm,
45
+ url
46
+ };
47
+ });
48
+ beforeEach(() => {
49
+ if (handle) handle.llm.resetMatchCounts();
50
+ });
51
+ afterAll(async () => {
52
+ if (handle) {
53
+ if (options.patchEnv !== false) {
54
+ delete process.env.OPENAI_BASE_URL;
55
+ delete process.env.ANTHROPIC_BASE_URL;
56
+ }
57
+ await handle.llm.stop();
58
+ handle = null;
59
+ }
60
+ });
61
+ return () => {
62
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
63
+ return handle;
64
+ };
65
+ }
66
+ function loadFixtures(fixturePath) {
67
+ try {
68
+ if (statSync(fixturePath).isDirectory()) return loadFixturesFromDir(fixturePath);
69
+ return loadFixtureFile(fixturePath);
70
+ } catch {
71
+ return [];
72
+ }
73
+ }
74
+
75
+ //#endregion
76
+ export { LLMock, useAimock };
77
+ //# sourceMappingURL=vitest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.js","names":[],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,WAAU,YAAY;EACpB,MAAM,EAAE,UAAU,aAAa,UAAU,GAAG,eAAe;EAC3D,MAAM,MAAM,IAAI,OAAO,WAAW;AAElC,MAAI,aAAa;GAEf,MAAM,iBAAiB,aADN,QAAQ,YAAY,CACQ;AAC7C,QAAK,MAAM,KAAK,eACd,KAAI,WAAW,EAAE;;EAIrB,MAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,MAAI,aAAa,OAAO;AACtB,WAAQ,IAAI,kBAAkB,GAAG,IAAI;AACrC,WAAQ,IAAI,qBAAqB,GAAG,IAAI;;AAG1C,WAAS;GAAE;GAAK;GAAK;GACrB;AAEF,kBAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,UAAS,YAAY;AACnB,MAAI,QAAQ;AACV,OAAI,QAAQ,aAAa,OAAO;AAC9B,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;;AAErB,SAAM,OAAO,IAAI,MAAM;AACvB,YAAS;;GAEX;AAEF,cAAa;AACX,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,wEAAwE;AAE1F,SAAO;;;AAIX,SAAS,aAAa,aAAgC;AACpD,KAAI;AAEF,MADa,SAAS,YAAY,CACzB,aAAa,CACpB,QAAO,oBAAoB,YAAY;AAEzC,SAAO,gBAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
@@ -0,0 +1,42 @@
1
+ {
2
+ "a2a": {
3
+ "agents": [
4
+ {
5
+ "name": "research-agent",
6
+ "description": "An agent that researches topics and returns summaries",
7
+ "version": "1.0.0",
8
+ "skills": [
9
+ {
10
+ "id": "web-research",
11
+ "name": "Web Research",
12
+ "description": "Search the web and summarize findings",
13
+ "tags": ["research", "search"]
14
+ }
15
+ ],
16
+ "capabilities": { "streaming": true },
17
+ "messages": [
18
+ {
19
+ "pattern": "research",
20
+ "parts": [{ "text": "Here is a summary of my research findings on the topic." }]
21
+ }
22
+ ],
23
+ "streamingTasks": [
24
+ {
25
+ "pattern": "deep-research",
26
+ "events": [
27
+ { "type": "status", "state": "TASK_STATE_WORKING" },
28
+ {
29
+ "type": "artifact",
30
+ "name": "research-report",
31
+ "parts": [{ "text": "## Research Report\n\nFindings from deep research..." }],
32
+ "lastChunk": true
33
+ },
34
+ { "type": "status", "state": "TASK_STATE_COMPLETED" }
35
+ ],
36
+ "delayMs": 100
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "agui": {
3
+ "fixtures": [
4
+ {
5
+ "match": { "message": "hello" },
6
+ "text": "Hi! How can I help you today?"
7
+ },
8
+ {
9
+ "match": { "message": "search" },
10
+ "events": [
11
+ { "type": "RUN_STARTED", "threadId": "t1", "runId": "r1" },
12
+ { "type": "TOOL_CALL_START", "toolCallId": "tc1", "toolCallName": "web_search" },
13
+ {
14
+ "type": "TOOL_CALL_ARGS",
15
+ "toolCallId": "tc1",
16
+ "delta": "{\"query\": \"latest news\"}"
17
+ },
18
+ { "type": "TOOL_CALL_END", "toolCallId": "tc1" },
19
+ {
20
+ "type": "TEXT_MESSAGE_START",
21
+ "messageId": "m1",
22
+ "role": "assistant"
23
+ },
24
+ {
25
+ "type": "TEXT_MESSAGE_CONTENT",
26
+ "messageId": "m1",
27
+ "delta": "Here are the latest results..."
28
+ },
29
+ { "type": "TEXT_MESSAGE_END", "messageId": "m1" },
30
+ { "type": "RUN_FINISHED", "threadId": "t1", "runId": "r1" }
31
+ ]
32
+ }
33
+ ]
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "llm": {
3
+ "fixtures": "fixtures/example-greeting.json",
4
+ "chaos": {
5
+ "dropRate": 0.1,
6
+ "malformedRate": 0.05,
7
+ "disconnectRate": 0.02
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "port": 4000,
3
+ "host": "127.0.0.1",
4
+ "metrics": true,
5
+ "strict": true,
6
+
7
+ "llm": {
8
+ "fixtures": "fixtures/example-greeting.json",
9
+ "chaos": {
10
+ "dropRate": 0.01,
11
+ "malformedRate": 0.005,
12
+ "disconnectRate": 0.002
13
+ }
14
+ },
15
+
16
+ "mcp": {
17
+ "serverInfo": { "name": "full-suite-mcp", "version": "1.0.0" },
18
+ "tools": [
19
+ {
20
+ "name": "search",
21
+ "description": "Search the knowledge base",
22
+ "inputSchema": {
23
+ "type": "object",
24
+ "properties": {
25
+ "query": { "type": "string" },
26
+ "limit": { "type": "number" }
27
+ },
28
+ "required": ["query"]
29
+ },
30
+ "result": "Found 3 results for your query."
31
+ }
32
+ ],
33
+ "resources": [
34
+ {
35
+ "uri": "file:///config",
36
+ "name": "Configuration",
37
+ "mimeType": "application/json",
38
+ "text": "{\"version\": \"1.0\", \"environment\": \"test\"}"
39
+ }
40
+ ],
41
+ "prompts": [
42
+ {
43
+ "name": "summarize",
44
+ "description": "Summarize a document",
45
+ "arguments": [{ "name": "text", "description": "The text to summarize", "required": true }],
46
+ "result": {
47
+ "messages": [
48
+ {
49
+ "role": "assistant",
50
+ "content": { "type": "text", "text": "Here is a summary of the provided text." }
51
+ }
52
+ ]
53
+ }
54
+ }
55
+ ]
56
+ },
57
+
58
+ "a2a": {
59
+ "agents": [
60
+ {
61
+ "name": "assistant",
62
+ "description": "A general-purpose assistant agent",
63
+ "version": "1.0.0",
64
+ "skills": [{ "id": "qa", "name": "Q&A", "description": "Answer questions" }],
65
+ "capabilities": { "streaming": true },
66
+ "messages": [
67
+ {
68
+ "pattern": ".*",
69
+ "parts": [{ "text": "I can help you with that." }]
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ },
75
+
76
+ "agui": {
77
+ "fixtures": [
78
+ {
79
+ "match": { "message": "hello" },
80
+ "text": "Hello from the full-suite mock!"
81
+ },
82
+ {
83
+ "match": { "toolName": "get_data" },
84
+ "events": [
85
+ { "type": "RUN_STARTED", "threadId": "t1", "runId": "r1" },
86
+ { "type": "TOOL_CALL_START", "toolCallId": "tc1", "toolCallName": "get_data" },
87
+ { "type": "TOOL_CALL_ARGS", "toolCallId": "tc1", "delta": "{}" },
88
+ { "type": "TOOL_CALL_END", "toolCallId": "tc1" },
89
+ { "type": "RUN_FINISHED", "threadId": "t1", "runId": "r1" }
90
+ ]
91
+ }
92
+ ]
93
+ },
94
+
95
+ "vector": {
96
+ "collections": [
97
+ {
98
+ "name": "knowledge-base",
99
+ "dimension": 384,
100
+ "queryResults": [
101
+ {
102
+ "id": "kb-001",
103
+ "score": 0.97,
104
+ "metadata": { "source": "docs", "title": "Quick Start Guide" }
105
+ }
106
+ ]
107
+ }
108
+ ]
109
+ },
110
+
111
+ "services": {
112
+ "search": true,
113
+ "rerank": true,
114
+ "moderate": true
115
+ }
116
+ }