@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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_TEST_ID, Journal } from "./journal.js";
2
2
  import { LogLevel, Logger } from "./logger.js";
3
3
  import { MetricsRegistry, createMetricsRegistry, normalizePathLabel } from "./metrics.js";
4
- import { ChaosAction, ChaosConfig, ChatCompletion, ChatCompletionChoice, ChatCompletionMessage, ChatCompletionRequest, ChatMessage, ContentPart, EmbeddingFixtureOpts, EmbeddingResponse, ErrorResponse, Fixture, FixtureFile, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig, RecordProviderKey, SSEChoice, SSEChunk, SSEDelta, SSEToolCallDelta, StreamingProfile, TextResponse, ToolCall, ToolCallMessage, ToolCallResponse, ToolDefinition } from "./types.js";
4
+ import { AudioResponse, ChaosAction, ChaosConfig, ChatCompletion, ChatCompletionChoice, ChatCompletionMessage, ChatCompletionRequest, ChatMessage, ContentPart, EmbeddingFixtureOpts, EmbeddingResponse, ErrorResponse, Fixture, FixtureFile, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, ImageItem, ImageResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig, RecordProviderKey, SSEChoice, SSEChunk, SSEDelta, SSEToolCallDelta, StreamingProfile, TextResponse, ToolCall, ToolCallMessage, ToolCallResponse, ToolDefinition, TranscriptionResponse, VideoResponse } from "./types.js";
5
5
  import { A2AAgentDefinition, A2AArtifact, A2AMessage, A2AMockOptions, A2APart, A2ARole, A2AStreamEvent, A2ATask, A2ATaskResponse, A2ATaskState } from "./a2a-types.js";
6
6
  import { A2AMock } from "./a2a-mock.js";
7
7
  import { SearchFixture, SearchResult, handleSearch } from "./search.js";
@@ -12,6 +12,7 @@ import { MCPContent, MCPMockOptions, MCPPromptDefinition, MCPPromptResult, MCPRe
12
12
  import { AGUIActivityDeltaEvent, AGUIActivitySnapshotEvent, AGUIEvent, AGUIEventType, AGUIFixture, AGUIFixtureMatch, AGUIMessage, AGUIMessagesSnapshotEvent, AGUIMockOptions, AGUIRecordConfig, AGUIRunAgentInput, AGUIRunErrorEvent, AGUIRunFinishedEvent, AGUIRunStartedEvent, AGUIStateDeltaEvent, AGUIStateSnapshotEvent, AGUITextMessageChunkEvent, AGUITextMessageContentEvent, AGUITextMessageEndEvent, AGUITextMessageStartEvent, AGUIToolCall, AGUIToolCallArgsEvent, AGUIToolCallEndEvent, AGUIToolCallResultEvent, AGUIToolCallStartEvent, AGUIToolDefinition } from "./agui-types.js";
13
13
  import { QueryHandler, QueryResult, VectorCollection, VectorEntry, VectorMockOptions, VectorQuery } from "./vector-types.js";
14
14
  import { AimockConfig, loadConfig, startFromConfig } from "./config-loader.js";
15
+ import { VideoStateMap, handleVideoCreate, handleVideoStatus } from "./video.js";
15
16
  import { ServerInstance, ServiceFixtures, createServer } from "./server.js";
16
17
  import { ValidationResult, loadFixtureFile, loadFixturesFromDir, validateFixtures } from "./fixture-loader.js";
17
18
  import { getTextContent, matchFixture } from "./router.js";
@@ -29,7 +30,10 @@ import { WebSocketConnection, computeAcceptKey, upgradeToWebSocket } from "./ws-
29
30
  import { handleWebSocketResponses } from "./ws-responses.js";
30
31
  import { handleWebSocketRealtime } from "./ws-realtime.js";
31
32
  import { handleWebSocketGeminiLive } from "./ws-gemini-live.js";
32
- import { EmbeddingAPIResponse, buildEmbeddingResponse, buildTextChunks, buildToolCallChunks, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, isEmbeddingResponse } from "./helpers.js";
33
+ import { handleImages } from "./images.js";
34
+ import { handleSpeech } from "./speech.js";
35
+ import { handleTranscription } from "./transcription.js";
36
+ import { EmbeddingAPIResponse, buildEmbeddingResponse, buildTextChunks, buildToolCallChunks, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, isAudioResponse, isEmbeddingResponse, isImageResponse, isTranscriptionResponse, isVideoResponse } from "./helpers.js";
33
37
  import { InterruptionControl, createInterruptionSignal } from "./interruption.js";
34
38
  import { StreamOptions, calculateDelay, delay, writeErrorResponse, writeSSEStream } from "./sse-writer.js";
35
39
  import { applyChaos, evaluateChaos } from "./chaos.js";
@@ -43,4 +47,4 @@ import { proxyAndRecordAGUI } from "./agui-recorder.js";
43
47
  import { buildActivityResponse, buildCompositeResponse, buildErrorResponse, buildMessagesSnapshot, buildReasoningResponse, buildStateDelta, buildStateUpdate, buildStepWithText, buildTextChunkResponse, buildTextResponse, buildToolCallResponse, extractLastUserMessage, findFixture, writeAGUIEventStream } from "./agui-handler.js";
44
48
  import { JsonRpcDispatcherOptions, JsonRpcResponse, MethodHandler, createJsonRpcDispatcher } from "./jsonrpc.js";
45
49
  import { MockSuite, MockSuiteOptions, createMockSuite } from "./suite.js";
46
- export { type A2AAgentDefinition, type A2AArtifact, type A2AMessage, A2AMock, type A2AMockOptions, type A2APart, type A2ARole, type A2AStreamEvent, type A2ATask, type A2ATaskResponse, type A2ATaskState, type AGUIActivityDeltaEvent, type AGUIActivitySnapshotEvent, type AGUIEvent, type AGUIEventType, type AGUIFixture, type AGUIFixtureMatch, type AGUIMessage, type AGUIMessagesSnapshotEvent, AGUIMock, type AGUIMockOptions, type AGUIRecordConfig, type AGUIRunAgentInput, type AGUIRunErrorEvent, type AGUIRunFinishedEvent, type AGUIRunStartedEvent, type AGUIStateDeltaEvent, type AGUIStateSnapshotEvent, type AGUITextMessageChunkEvent, type AGUITextMessageContentEvent, type AGUITextMessageEndEvent, type AGUITextMessageStartEvent, type AGUIToolCall, type AGUIToolCallArgsEvent, type AGUIToolCallEndEvent, type AGUIToolCallResultEvent, type AGUIToolCallStartEvent, type AGUIToolDefinition, type AimockConfig, type ChaosAction, type ChaosConfig, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatMessage, type CollapseResult, type ContentPart, DEFAULT_TEST_ID, type EmbeddingAPIResponse, type EmbeddingFixtureOpts, type EmbeddingResponse, type ErrorResponse, type Fixture, type FixtureFile, type FixtureFileEntry, type FixtureMatch, type FixtureOpts, type FixtureResponse, type InterruptionControl, Journal, type JournalEntry, type JsonRpcDispatcherOptions, type JsonRpcResponse, LLMock, type LogLevel, Logger, type MCPContent, MCPMock, type MCPMockOptions, type MCPPromptDefinition, type MCPPromptResult, type MCPResourceContent, type MCPResourceDefinition, type MCPSession, type MCPToolDefinition, type MethodHandler, type MetricsRegistry, type MockServerOptions, type MockSuite, type MockSuiteOptions, type ModerationFixture, type ModerationResult, type Mountable, type NDJSONStreamOptions, type QueryHandler, type QueryResult, type RecordConfig, type RecordProviderKey, type RerankFixture, type RerankResult, type ResponsesSSEEvent, type SSEChoice, type SSEChunk, type SSEDelta, type SSEToolCallDelta, type SearchFixture, type SearchResult, type ServerInstance, type ServiceFixtures, type StreamOptions, type StreamingProfile, type TextResponse, type ToolCall, type ToolCallMessage, type ToolCallResponse, type ToolDefinition, type ValidationResult, type VectorCollection, type VectorEntry, VectorMock, type VectorMockOptions, type VectorQuery, WebSocketConnection, applyChaos, bedrockToCompletionRequest, buildActivityResponse as buildAGUIActivityResponse, buildCompositeResponse as buildAGUICompositeResponse, buildErrorResponse as buildAGUIErrorResponse, buildMessagesSnapshot as buildAGUIMessagesSnapshot, buildReasoningResponse as buildAGUIReasoningResponse, buildStateDelta as buildAGUIStateDelta, buildStateUpdate as buildAGUIStateUpdate, buildStepWithText as buildAGUIStepWithText, buildTextChunkResponse as buildAGUITextChunkResponse, buildTextResponse as buildAGUITextResponse, buildToolCallResponse as buildAGUIToolCallResponse, buildEmbeddingResponse, buildTextChunks, buildTextStreamEvents, buildToolCallChunks, buildToolCallStreamEvents, calculateDelay, cohereToCompletionRequest, collapseAnthropicSSE, collapseBedrockEventStream, collapseCohereSSE, collapseGeminiSSE, collapseOllamaNDJSON, collapseOpenAISSE, collapseStreamingResponse, computeAcceptKey, converseToCompletionRequest, createInterruptionSignal, createJsonRpcDispatcher, createMetricsRegistry, createMockSuite, createServer, delay, encodeEventStreamFrame, encodeEventStreamMessage, evaluateChaos, extractLastUserMessage as extractAGUILastUserMessage, findFixture as findAGUIFixture, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getTextContent, handleBedrock, handleBedrockStream, handleCohere, handleConverse, handleConverseStream, handleEmbeddings, handleGemini, handleMessages, handleModeration, handleOllama, handleOllamaGenerate, handleRerank, handleResponses, handleSearch, handleWebSocketGeminiLive, handleWebSocketRealtime, handleWebSocketResponses, isEmbeddingResponse, loadConfig, loadFixtureFile, loadFixturesFromDir, matchFixture, normalizePathLabel, ollamaToCompletionRequest, proxyAndRecord, proxyAndRecordAGUI, resolveUpstreamUrl, startFromConfig, upgradeToWebSocket, validateFixtures, writeAGUIEventStream, writeErrorResponse, writeEventStream, writeNDJSONStream, writeSSEStream };
50
+ export { type A2AAgentDefinition, type A2AArtifact, type A2AMessage, A2AMock, type A2AMockOptions, type A2APart, type A2ARole, type A2AStreamEvent, type A2ATask, type A2ATaskResponse, type A2ATaskState, type AGUIActivityDeltaEvent, type AGUIActivitySnapshotEvent, type AGUIEvent, type AGUIEventType, type AGUIFixture, type AGUIFixtureMatch, type AGUIMessage, type AGUIMessagesSnapshotEvent, AGUIMock, type AGUIMockOptions, type AGUIRecordConfig, type AGUIRunAgentInput, type AGUIRunErrorEvent, type AGUIRunFinishedEvent, type AGUIRunStartedEvent, type AGUIStateDeltaEvent, type AGUIStateSnapshotEvent, type AGUITextMessageChunkEvent, type AGUITextMessageContentEvent, type AGUITextMessageEndEvent, type AGUITextMessageStartEvent, type AGUIToolCall, type AGUIToolCallArgsEvent, type AGUIToolCallEndEvent, type AGUIToolCallResultEvent, type AGUIToolCallStartEvent, type AGUIToolDefinition, type AimockConfig, type AudioResponse, type ChaosAction, type ChaosConfig, type ChatCompletion, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatMessage, type CollapseResult, type ContentPart, DEFAULT_TEST_ID, type EmbeddingAPIResponse, type EmbeddingFixtureOpts, type EmbeddingResponse, type ErrorResponse, type Fixture, type FixtureFile, type FixtureFileEntry, type FixtureMatch, type FixtureOpts, type FixtureResponse, type ImageItem, type ImageResponse, type InterruptionControl, Journal, type JournalEntry, type JsonRpcDispatcherOptions, type JsonRpcResponse, LLMock, type LogLevel, Logger, type MCPContent, MCPMock, type MCPMockOptions, type MCPPromptDefinition, type MCPPromptResult, type MCPResourceContent, type MCPResourceDefinition, type MCPSession, type MCPToolDefinition, type MethodHandler, type MetricsRegistry, type MockServerOptions, type MockSuite, type MockSuiteOptions, type ModerationFixture, type ModerationResult, type Mountable, type NDJSONStreamOptions, type QueryHandler, type QueryResult, type RecordConfig, type RecordProviderKey, type RerankFixture, type RerankResult, type ResponsesSSEEvent, type SSEChoice, type SSEChunk, type SSEDelta, type SSEToolCallDelta, type SearchFixture, type SearchResult, type ServerInstance, type ServiceFixtures, type StreamOptions, type StreamingProfile, type TextResponse, type ToolCall, type ToolCallMessage, type ToolCallResponse, type ToolDefinition, type TranscriptionResponse, type ValidationResult, type VectorCollection, type VectorEntry, VectorMock, type VectorMockOptions, type VectorQuery, type VideoResponse, type VideoStateMap, WebSocketConnection, applyChaos, bedrockToCompletionRequest, buildActivityResponse as buildAGUIActivityResponse, buildCompositeResponse as buildAGUICompositeResponse, buildErrorResponse as buildAGUIErrorResponse, buildMessagesSnapshot as buildAGUIMessagesSnapshot, buildReasoningResponse as buildAGUIReasoningResponse, buildStateDelta as buildAGUIStateDelta, buildStateUpdate as buildAGUIStateUpdate, buildStepWithText as buildAGUIStepWithText, buildTextChunkResponse as buildAGUITextChunkResponse, buildTextResponse as buildAGUITextResponse, buildToolCallResponse as buildAGUIToolCallResponse, buildEmbeddingResponse, buildTextChunks, buildTextStreamEvents, buildToolCallChunks, buildToolCallStreamEvents, calculateDelay, cohereToCompletionRequest, collapseAnthropicSSE, collapseBedrockEventStream, collapseCohereSSE, collapseGeminiSSE, collapseOllamaNDJSON, collapseOpenAISSE, collapseStreamingResponse, computeAcceptKey, converseToCompletionRequest, createInterruptionSignal, createJsonRpcDispatcher, createMetricsRegistry, createMockSuite, createServer, delay, encodeEventStreamFrame, encodeEventStreamMessage, evaluateChaos, extractLastUserMessage as extractAGUILastUserMessage, findFixture as findAGUIFixture, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getTextContent, handleBedrock, handleBedrockStream, handleCohere, handleConverse, handleConverseStream, handleEmbeddings, handleGemini, handleImages, handleMessages, handleModeration, handleOllama, handleOllamaGenerate, handleRerank, handleResponses, handleSearch, handleSpeech, handleTranscription, handleVideoCreate, handleVideoStatus, handleWebSocketGeminiLive, handleWebSocketRealtime, handleWebSocketResponses, isAudioResponse, isEmbeddingResponse, isImageResponse, isTranscriptionResponse, isVideoResponse, loadConfig, loadFixtureFile, loadFixturesFromDir, matchFixture, normalizePathLabel, ollamaToCompletionRequest, proxyAndRecord, proxyAndRecordAGUI, resolveUpstreamUrl, startFromConfig, upgradeToWebSocket, validateFixtures, writeAGUIEventStream, writeErrorResponse, writeEventStream, writeNDJSONStream, writeSSEStream };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildEmbeddingResponse, buildTextChunks, buildToolCallChunks, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, isEmbeddingResponse } from "./helpers.js";
1
+ import { buildEmbeddingResponse, buildTextChunks, buildToolCallChunks, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, isAudioResponse, isEmbeddingResponse, isImageResponse, isTranscriptionResponse, isVideoResponse } from "./helpers.js";
2
2
  import { createJsonRpcDispatcher } from "./jsonrpc.js";
3
3
  import { A2AMock } from "./a2a-mock.js";
4
4
  import { DEFAULT_TEST_ID, Journal } from "./journal.js";
@@ -17,6 +17,10 @@ import { encodeEventStreamFrame, encodeEventStreamMessage, writeEventStream } fr
17
17
  import { bedrockToCompletionRequest, handleBedrock, handleBedrockStream } from "./bedrock.js";
18
18
  import { converseToCompletionRequest, handleConverse, handleConverseStream } from "./bedrock-converse.js";
19
19
  import { handleEmbeddings } from "./embeddings.js";
20
+ import { handleImages } from "./images.js";
21
+ import { handleSpeech } from "./speech.js";
22
+ import { handleTranscription } from "./transcription.js";
23
+ import { handleVideoCreate, handleVideoStatus } from "./video.js";
20
24
  import { writeNDJSONStream } from "./ndjson-writer.js";
21
25
  import { handleOllama, handleOllamaGenerate, ollamaToCompletionRequest } from "./ollama.js";
22
26
  import { cohereToCompletionRequest, handleCohere } from "./cohere.js";
@@ -39,4 +43,4 @@ import { VectorMock } from "./vector-mock.js";
39
43
  import { loadConfig, startFromConfig } from "./config-loader.js";
40
44
  import { createMockSuite } from "./suite.js";
41
45
 
42
- export { A2AMock, AGUIMock, DEFAULT_TEST_ID, Journal, LLMock, Logger, MCPMock, VectorMock, WebSocketConnection, applyChaos, bedrockToCompletionRequest, buildActivityResponse as buildAGUIActivityResponse, buildCompositeResponse as buildAGUICompositeResponse, buildErrorResponse as buildAGUIErrorResponse, buildMessagesSnapshot as buildAGUIMessagesSnapshot, buildReasoningResponse as buildAGUIReasoningResponse, buildStateDelta as buildAGUIStateDelta, buildStateUpdate as buildAGUIStateUpdate, buildStepWithText as buildAGUIStepWithText, buildTextChunkResponse as buildAGUITextChunkResponse, buildTextResponse as buildAGUITextResponse, buildToolCallResponse as buildAGUIToolCallResponse, buildEmbeddingResponse, buildTextChunks, buildTextStreamEvents, buildToolCallChunks, buildToolCallStreamEvents, calculateDelay, cohereToCompletionRequest, collapseAnthropicSSE, collapseBedrockEventStream, collapseCohereSSE, collapseGeminiSSE, collapseOllamaNDJSON, collapseOpenAISSE, collapseStreamingResponse, computeAcceptKey, converseToCompletionRequest, createInterruptionSignal, createJsonRpcDispatcher, createMetricsRegistry, createMockSuite, createServer, delay, encodeEventStreamFrame, encodeEventStreamMessage, evaluateChaos, extractLastUserMessage as extractAGUILastUserMessage, findFixture as findAGUIFixture, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getTextContent, handleBedrock, handleBedrockStream, handleCohere, handleConverse, handleConverseStream, handleEmbeddings, handleGemini, handleMessages, handleModeration, handleOllama, handleOllamaGenerate, handleRerank, handleResponses, handleSearch, handleWebSocketGeminiLive, handleWebSocketRealtime, handleWebSocketResponses, isEmbeddingResponse, loadConfig, loadFixtureFile, loadFixturesFromDir, matchFixture, normalizePathLabel, ollamaToCompletionRequest, proxyAndRecord, proxyAndRecordAGUI, resolveUpstreamUrl, startFromConfig, upgradeToWebSocket, validateFixtures, writeAGUIEventStream, writeErrorResponse, writeEventStream, writeNDJSONStream, writeSSEStream };
46
+ export { A2AMock, AGUIMock, DEFAULT_TEST_ID, Journal, LLMock, Logger, MCPMock, VectorMock, WebSocketConnection, applyChaos, bedrockToCompletionRequest, buildActivityResponse as buildAGUIActivityResponse, buildCompositeResponse as buildAGUICompositeResponse, buildErrorResponse as buildAGUIErrorResponse, buildMessagesSnapshot as buildAGUIMessagesSnapshot, buildReasoningResponse as buildAGUIReasoningResponse, buildStateDelta as buildAGUIStateDelta, buildStateUpdate as buildAGUIStateUpdate, buildStepWithText as buildAGUIStepWithText, buildTextChunkResponse as buildAGUITextChunkResponse, buildTextResponse as buildAGUITextResponse, buildToolCallResponse as buildAGUIToolCallResponse, buildEmbeddingResponse, buildTextChunks, buildTextStreamEvents, buildToolCallChunks, buildToolCallStreamEvents, calculateDelay, cohereToCompletionRequest, collapseAnthropicSSE, collapseBedrockEventStream, collapseCohereSSE, collapseGeminiSSE, collapseOllamaNDJSON, collapseOpenAISSE, collapseStreamingResponse, computeAcceptKey, converseToCompletionRequest, createInterruptionSignal, createJsonRpcDispatcher, createMetricsRegistry, createMockSuite, createServer, delay, encodeEventStreamFrame, encodeEventStreamMessage, evaluateChaos, extractLastUserMessage as extractAGUILastUserMessage, findFixture as findAGUIFixture, flattenHeaders, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getTextContent, handleBedrock, handleBedrockStream, handleCohere, handleConverse, handleConverseStream, handleEmbeddings, handleGemini, handleImages, handleMessages, handleModeration, handleOllama, handleOllamaGenerate, handleRerank, handleResponses, handleSearch, handleSpeech, handleTranscription, handleVideoCreate, handleVideoStatus, handleWebSocketGeminiLive, handleWebSocketRealtime, handleWebSocketResponses, isAudioResponse, isEmbeddingResponse, isImageResponse, isTranscriptionResponse, isVideoResponse, loadConfig, loadFixtureFile, loadFixturesFromDir, matchFixture, normalizePathLabel, ollamaToCompletionRequest, proxyAndRecord, proxyAndRecordAGUI, resolveUpstreamUrl, startFromConfig, upgradeToWebSocket, validateFixtures, writeAGUIEventStream, writeErrorResponse, writeEventStream, writeNDJSONStream, writeSSEStream };
package/dist/jest.cjs ADDED
@@ -0,0 +1,70 @@
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
+ let node_path = require("node:path");
6
+ let node_fs = require("node:fs");
7
+
8
+ //#region src/jest.ts
9
+ /**
10
+ * Start an aimock server for the duration of the test suite.
11
+ *
12
+ * - `beforeAll`: starts the server and optionally loads fixtures
13
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
14
+ * - `afterAll`: stops the server
15
+ *
16
+ * Returns a getter function — call it inside tests to access the handle.
17
+ *
18
+ * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available
19
+ * in the test environment. This works with the default jest configuration.
20
+ */
21
+ function useAimock(options = {}) {
22
+ let handle = null;
23
+ beforeAll(async () => {
24
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
25
+ const llm = new require_llmock.LLMock(serverOpts);
26
+ if (fixturePath) {
27
+ const loadedFixtures = loadFixtures((0, node_path.resolve)(fixturePath));
28
+ for (const f of loadedFixtures) llm.addFixture(f);
29
+ }
30
+ const url = await llm.start();
31
+ if (patchEnv !== false) {
32
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
33
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
34
+ }
35
+ handle = {
36
+ llm,
37
+ url
38
+ };
39
+ });
40
+ beforeEach(() => {
41
+ if (handle) handle.llm.resetMatchCounts();
42
+ });
43
+ afterAll(async () => {
44
+ if (handle) {
45
+ if (options.patchEnv !== false) {
46
+ delete process.env.OPENAI_BASE_URL;
47
+ delete process.env.ANTHROPIC_BASE_URL;
48
+ }
49
+ await handle.llm.stop();
50
+ handle = null;
51
+ }
52
+ });
53
+ return () => {
54
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
55
+ return handle;
56
+ };
57
+ }
58
+ function loadFixtures(fixturePath) {
59
+ try {
60
+ if ((0, node_fs.statSync)(fixturePath).isDirectory()) return require_fixture_loader.loadFixturesFromDir(fixturePath);
61
+ return require_fixture_loader.loadFixtureFile(fixturePath);
62
+ } catch {
63
+ return [];
64
+ }
65
+ }
66
+
67
+ //#endregion
68
+ exports.LLMock = require_llmock.LLMock;
69
+ exports.useAimock = useAimock;
70
+ //# sourceMappingURL=jest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.cjs","names":["LLMock","loadFixturesFromDir","loadFixtureFile"],"sources":["../src/jest.ts"],"sourcesContent":["/**\n * Jest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/jest\";\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\n/* eslint-disable no-var */\n// Jest globals — available at runtime in jest test files\ndeclare var beforeAll: (fn: () => Promise<void> | void, timeout?: number) => void;\ndeclare var afterAll: (fn: () => Promise<void> | void, timeout?: number) => void;\ndeclare var beforeEach: (fn: () => Promise<void> | void, timeout?: number) => void;\n/* eslint-enable no-var */\n\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 *\n * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available\n * in the test environment. This works with the default jest configuration.\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":";;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,WAAU,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,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,4BADsB,YAAY,CACzB,aAAa,CACpB,QAAOC,2CAAoB,YAAY;AAEzC,SAAOC,uCAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
@@ -0,0 +1,33 @@
1
+ import { Fixture, MockServerOptions } from "./types.cjs";
2
+ import { LLMock } from "./llmock.cjs";
3
+
4
+ //#region src/jest.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
+ * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available
28
+ * in the test environment. This works with the default jest configuration.
29
+ */
30
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
31
+ //#endregion
32
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
33
+ //# sourceMappingURL=jest.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.d.cts","names":[],"sources":["../src/jest.ts"],"sourcesContent":[],"mappings":";;;;;UA0BiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;;;;iBAiBA,SAAA,WAAmB,yBAA8B"}
package/dist/jest.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { Fixture, MockServerOptions } from "./types.js";
2
+ import { LLMock } from "./llmock.js";
3
+
4
+ //#region src/jest.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
+ * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available
28
+ * in the test environment. This works with the default jest configuration.
29
+ */
30
+ declare function useAimock(options?: UseAimockOptions): () => AimockHandle;
31
+ //#endregion
32
+ export { AimockHandle, type Fixture, LLMock, type MockServerOptions, UseAimockOptions, useAimock };
33
+ //# sourceMappingURL=jest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.d.ts","names":[],"sources":["../src/jest.ts"],"sourcesContent":[],"mappings":";;;;;UA0BiB,gBAAA,SAAyB;;;;;;UAOzB,YAAA;;gBAED;;;;;;;;;;;;;;;;iBAiBA,SAAA,WAAmB,yBAA8B"}
package/dist/jest.js ADDED
@@ -0,0 +1,67 @@
1
+ import { loadFixtureFile, loadFixturesFromDir } from "./fixture-loader.js";
2
+ import { LLMock } from "./llmock.js";
3
+ import { resolve } from "node:path";
4
+ import { statSync } from "node:fs";
5
+
6
+ //#region src/jest.ts
7
+ /**
8
+ * Start an aimock server for the duration of the test suite.
9
+ *
10
+ * - `beforeAll`: starts the server and optionally loads fixtures
11
+ * - `beforeEach`: resets fixture match counts (not fixtures themselves)
12
+ * - `afterAll`: stops the server
13
+ *
14
+ * Returns a getter function — call it inside tests to access the handle.
15
+ *
16
+ * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available
17
+ * in the test environment. This works with the default jest configuration.
18
+ */
19
+ function useAimock(options = {}) {
20
+ let handle = null;
21
+ beforeAll(async () => {
22
+ const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
23
+ const llm = new LLMock(serverOpts);
24
+ if (fixturePath) {
25
+ const loadedFixtures = loadFixtures(resolve(fixturePath));
26
+ for (const f of loadedFixtures) llm.addFixture(f);
27
+ }
28
+ const url = await llm.start();
29
+ if (patchEnv !== false) {
30
+ process.env.OPENAI_BASE_URL = `${url}/v1`;
31
+ process.env.ANTHROPIC_BASE_URL = `${url}/v1`;
32
+ }
33
+ handle = {
34
+ llm,
35
+ url
36
+ };
37
+ });
38
+ beforeEach(() => {
39
+ if (handle) handle.llm.resetMatchCounts();
40
+ });
41
+ afterAll(async () => {
42
+ if (handle) {
43
+ if (options.patchEnv !== false) {
44
+ delete process.env.OPENAI_BASE_URL;
45
+ delete process.env.ANTHROPIC_BASE_URL;
46
+ }
47
+ await handle.llm.stop();
48
+ handle = null;
49
+ }
50
+ });
51
+ return () => {
52
+ if (!handle) throw new Error("useAimock(): server not started — are you calling this inside a test?");
53
+ return handle;
54
+ };
55
+ }
56
+ function loadFixtures(fixturePath) {
57
+ try {
58
+ if (statSync(fixturePath).isDirectory()) return loadFixturesFromDir(fixturePath);
59
+ return loadFixtureFile(fixturePath);
60
+ } catch {
61
+ return [];
62
+ }
63
+ }
64
+
65
+ //#endregion
66
+ export { LLMock, useAimock };
67
+ //# sourceMappingURL=jest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.js","names":[],"sources":["../src/jest.ts"],"sourcesContent":["/**\n * Jest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/jest\";\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\n/* eslint-disable no-var */\n// Jest globals — available at runtime in jest test files\ndeclare var beforeAll: (fn: () => Promise<void> | void, timeout?: number) => void;\ndeclare var afterAll: (fn: () => Promise<void> | void, timeout?: number) => void;\ndeclare var beforeEach: (fn: () => Promise<void> | void, timeout?: number) => void;\n/* eslint-enable no-var */\n\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 *\n * NOTE: Jest globals (beforeAll, afterAll, beforeEach) must be available\n * in the test environment. This works with the default jest configuration.\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":";;;;;;;;;;;;;;;;;;AAoDA,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"}
package/dist/llmock.cjs CHANGED
@@ -77,6 +77,39 @@ var LLMock = class LLMock {
77
77
  onToolResult(id, response, opts) {
78
78
  return this.on({ toolCallId: id }, response, opts);
79
79
  }
80
+ onImage(prompt, response) {
81
+ return this.addFixture({
82
+ match: {
83
+ userMessage: prompt,
84
+ endpoint: "image"
85
+ },
86
+ response
87
+ });
88
+ }
89
+ onSpeech(input, response) {
90
+ return this.addFixture({
91
+ match: {
92
+ userMessage: input,
93
+ endpoint: "speech"
94
+ },
95
+ response
96
+ });
97
+ }
98
+ onTranscription(response) {
99
+ return this.addFixture({
100
+ match: { endpoint: "transcription" },
101
+ response
102
+ });
103
+ }
104
+ onVideo(prompt, response) {
105
+ return this.addFixture({
106
+ match: {
107
+ userMessage: prompt,
108
+ endpoint: "video"
109
+ },
110
+ response
111
+ });
112
+ }
80
113
  onSearch(pattern, results) {
81
114
  this.searchFixtures.push({
82
115
  match: pattern,
@@ -175,7 +208,10 @@ var LLMock = class LLMock {
175
208
  this.searchFixtures.length = 0;
176
209
  this.rerankFixtures.length = 0;
177
210
  this.moderationFixtures.length = 0;
178
- if (this.serverInstance) this.serverInstance.journal.clear();
211
+ if (this.serverInstance) {
212
+ this.serverInstance.journal.clear();
213
+ this.serverInstance.videoStates.clear();
214
+ }
179
215
  return this;
180
216
  }
181
217
  async start() {
@@ -1 +1 @@
1
- {"version":3,"file":"llmock.cjs","names":["loadFixtureFile","loadFixturesFromDir","entryToFixture","validateFixtures","createServer"],"sources":["../src/llmock.ts"],"sourcesContent":["import type {\n ChaosConfig,\n EmbeddingFixtureOpts,\n Fixture,\n FixtureFileEntry,\n FixtureMatch,\n FixtureOpts,\n FixtureResponse,\n MockServerOptions,\n Mountable,\n RecordConfig,\n} from \"./types.js\";\nimport { createServer, type ServerInstance } from \"./server.js\";\nimport {\n loadFixtureFile,\n loadFixturesFromDir,\n entryToFixture,\n validateFixtures,\n} from \"./fixture-loader.js\";\nimport { Journal } from \"./journal.js\";\nimport type { SearchFixture, SearchResult } from \"./search.js\";\nimport type { RerankFixture, RerankResult } from \"./rerank.js\";\nimport type { ModerationFixture, ModerationResult } from \"./moderation.js\";\n\nexport class LLMock {\n private fixtures: Fixture[] = [];\n private searchFixtures: SearchFixture[] = [];\n private rerankFixtures: RerankFixture[] = [];\n private moderationFixtures: ModerationFixture[] = [];\n private mounts: Array<{ path: string; handler: Mountable }> = [];\n private serverInstance: ServerInstance | null = null;\n private options: MockServerOptions;\n\n constructor(options?: MockServerOptions) {\n this.options = options ?? {};\n }\n\n // ---- Fixture management ----\n\n addFixture(fixture: Fixture): this {\n this.fixtures.push(fixture);\n return this;\n }\n\n addFixtures(fixtures: Fixture[]): this {\n this.fixtures.push(...fixtures);\n return this;\n }\n\n prependFixture(fixture: Fixture): this {\n this.fixtures.unshift(fixture);\n return this;\n }\n\n getFixtures(): readonly Fixture[] {\n return this.fixtures;\n }\n\n loadFixtureFile(filePath: string): this {\n this.fixtures.push(...loadFixtureFile(filePath));\n return this;\n }\n\n loadFixtureDir(dirPath: string): this {\n this.fixtures.push(...loadFixturesFromDir(dirPath));\n return this;\n }\n\n /**\n * Add fixtures from a JSON string or pre-parsed array of fixture entries.\n * Validates all fixtures and throws if any have severity \"error\".\n */\n addFixturesFromJSON(input: string | FixtureFileEntry[]): this {\n const entries: FixtureFileEntry[] = typeof input === \"string\" ? JSON.parse(input) : input;\n const converted = entries.map(entryToFixture);\n const issues = validateFixtures(converted);\n const errors = issues.filter((i) => i.severity === \"error\");\n if (errors.length > 0) {\n throw new Error(`Fixture validation failed: ${JSON.stringify(errors)}`);\n }\n this.fixtures.push(...converted);\n return this;\n }\n\n // Uses length = 0 to preserve array reference identity — the running\n // server reads this same array on every request.\n clearFixtures(): this {\n this.fixtures.length = 0;\n return this;\n }\n\n // ---- Convenience ----\n\n on(match: FixtureMatch, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.addFixture({\n match,\n response,\n ...opts,\n });\n }\n\n onMessage(pattern: string | RegExp, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ userMessage: pattern }, response, opts);\n }\n\n onEmbedding(\n pattern: string | RegExp,\n response: FixtureResponse,\n opts?: EmbeddingFixtureOpts,\n ): this {\n return this.on({ inputText: pattern }, response, opts);\n }\n\n onJsonOutput(pattern: string | RegExp, jsonContent: object | string, opts?: FixtureOpts): this {\n const content = typeof jsonContent === \"string\" ? jsonContent : JSON.stringify(jsonContent);\n return this.on({ userMessage: pattern, responseFormat: \"json_object\" }, { content }, opts);\n }\n\n onToolCall(name: string, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ toolName: name }, response, opts);\n }\n\n onToolResult(id: string, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ toolCallId: id }, response, opts);\n }\n\n // ---- Service mock convenience methods ----\n\n onSearch(pattern: string | RegExp, results: SearchResult[]): this {\n this.searchFixtures.push({ match: pattern, results });\n return this;\n }\n\n onRerank(pattern: string | RegExp, results: RerankResult[]): this {\n this.rerankFixtures.push({ match: pattern, results });\n return this;\n }\n\n onModerate(pattern: string | RegExp, result: ModerationResult): this {\n this.moderationFixtures.push({ match: pattern, result });\n return this;\n }\n\n /**\n * Queue a one-shot error that will be returned for the next matching\n * request, then automatically removed. Implemented as an internal fixture\n * with a `predicate` that always matches (so it fires first) and spliced\n * at the front of the fixture list.\n */\n nextRequestError(\n status: number,\n errorBody?: { message?: string; type?: string; code?: string },\n ): this {\n const errorResponse: FixtureResponse = {\n error: {\n message: errorBody?.message ?? \"Injected error\",\n type: errorBody?.type ?? \"server_error\",\n code: errorBody?.code,\n },\n status,\n };\n const fixture: Fixture = {\n match: { predicate: () => true },\n response: errorResponse,\n };\n // Insert at front so it matches before everything else\n this.fixtures.unshift(fixture);\n // Remove after first match — the journal records it so tests can assert\n const original = fixture.match.predicate!;\n fixture.match.predicate = (req) => {\n const result = original(req);\n if (result) {\n // Defer splice so it doesn't mutate the array while matchFixture iterates it\n queueMicrotask(() => {\n const idx = this.fixtures.indexOf(fixture);\n if (idx !== -1) this.fixtures.splice(idx, 1);\n });\n }\n return result;\n };\n return this;\n }\n\n // ---- Mounts ----\n\n mount(path: string, handler: Mountable): this {\n this.mounts.push({ path, handler });\n\n // If server is already running, wire up journal, registry, and baseUrl immediately\n // so late mounts behave identically to pre-start mounts.\n if (this.serverInstance) {\n if (handler.setJournal) handler.setJournal(this.serverInstance.journal);\n if (handler.setBaseUrl) handler.setBaseUrl(this.serverInstance.url + path);\n const registry = this.serverInstance.defaults.registry;\n if (registry && handler.setRegistry) handler.setRegistry(registry);\n }\n\n return this;\n }\n\n // ---- Journal proxies ----\n\n getRequests(): import(\"./types.js\").JournalEntry[] {\n return this.journal.getAll();\n }\n\n getLastRequest(): import(\"./types.js\").JournalEntry | null {\n return this.journal.getLast();\n }\n\n clearRequests(): void {\n this.journal.clear();\n }\n\n resetMatchCounts(testId?: string): this {\n if (this.serverInstance) {\n this.serverInstance.journal.clearMatchCounts(testId);\n }\n return this;\n }\n\n // ---- Chaos ----\n\n setChaos(config: ChaosConfig): this {\n this.options.chaos = config;\n return this;\n }\n\n clearChaos(): this {\n delete this.options.chaos;\n return this;\n }\n\n // ---- Recording ----\n\n enableRecording(config: RecordConfig): this {\n this.options.record = config;\n return this;\n }\n\n disableRecording(): this {\n delete this.options.record;\n return this;\n }\n\n // ---- Reset ----\n\n reset(): this {\n this.clearFixtures();\n this.searchFixtures.length = 0;\n this.rerankFixtures.length = 0;\n this.moderationFixtures.length = 0;\n if (this.serverInstance) {\n this.serverInstance.journal.clear();\n }\n return this;\n }\n\n // ---- Server lifecycle ----\n\n async start(): Promise<string> {\n if (this.serverInstance) {\n throw new Error(\"Server already started\");\n }\n this.serverInstance = await createServer(this.fixtures, this.options, this.mounts, {\n search: this.searchFixtures,\n rerank: this.rerankFixtures,\n moderation: this.moderationFixtures,\n });\n return this.serverInstance.url;\n }\n\n async stop(): Promise<void> {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n const { server } = this.serverInstance;\n await new Promise<void>((resolve, reject) => {\n server.close((err: Error | undefined) => (err ? reject(err) : resolve()));\n });\n this.serverInstance = null;\n }\n\n // ---- Accessors ----\n\n get journal(): Journal {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n return this.serverInstance.journal;\n }\n\n get url(): string {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n return this.serverInstance.url;\n }\n\n get baseUrl(): string {\n return this.url;\n }\n\n get port(): number {\n const parsed = new URL(this.url); // this.url throws if not started\n if (!parsed.port) {\n throw new Error(`Server URL has no explicit port: ${this.url}`);\n }\n return parseInt(parsed.port, 10);\n }\n\n // ---- Static factory ----\n\n static async create(options?: MockServerOptions): Promise<LLMock> {\n const instance = new LLMock(options);\n await instance.start();\n return instance;\n }\n}\n"],"mappings":";;;;AAwBA,IAAa,SAAb,MAAa,OAAO;CAClB,AAAQ,WAAsB,EAAE;CAChC,AAAQ,iBAAkC,EAAE;CAC5C,AAAQ,iBAAkC,EAAE;CAC5C,AAAQ,qBAA0C,EAAE;CACpD,AAAQ,SAAsD,EAAE;CAChE,AAAQ,iBAAwC;CAChD,AAAQ;CAER,YAAY,SAA6B;AACvC,OAAK,UAAU,WAAW,EAAE;;CAK9B,WAAW,SAAwB;AACjC,OAAK,SAAS,KAAK,QAAQ;AAC3B,SAAO;;CAGT,YAAY,UAA2B;AACrC,OAAK,SAAS,KAAK,GAAG,SAAS;AAC/B,SAAO;;CAGT,eAAe,SAAwB;AACrC,OAAK,SAAS,QAAQ,QAAQ;AAC9B,SAAO;;CAGT,cAAkC;AAChC,SAAO,KAAK;;CAGd,gBAAgB,UAAwB;AACtC,OAAK,SAAS,KAAK,GAAGA,uCAAgB,SAAS,CAAC;AAChD,S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,MAAM,GAAG;;CAKlC,aAAa,OAAO,SAA8C;EAChE,MAAM,WAAW,IAAI,OAAO,QAAQ;AACpC,QAAM,SAAS,OAAO;AACtB,SAAO"}
1
+ {"version":3,"file":"llmock.cjs","names":["loadFixtureFile","loadFixturesFromDir","entryToFixture","validateFixtures","createServer"],"sources":["../src/llmock.ts"],"sourcesContent":["import type {\n AudioResponse,\n ChaosConfig,\n EmbeddingFixtureOpts,\n Fixture,\n FixtureFileEntry,\n FixtureMatch,\n FixtureOpts,\n FixtureResponse,\n ImageResponse,\n MockServerOptions,\n Mountable,\n RecordConfig,\n TranscriptionResponse,\n VideoResponse,\n} from \"./types.js\";\nimport { createServer, type ServerInstance } from \"./server.js\";\nimport {\n loadFixtureFile,\n loadFixturesFromDir,\n entryToFixture,\n validateFixtures,\n} from \"./fixture-loader.js\";\nimport { Journal } from \"./journal.js\";\nimport type { SearchFixture, SearchResult } from \"./search.js\";\nimport type { RerankFixture, RerankResult } from \"./rerank.js\";\nimport type { ModerationFixture, ModerationResult } from \"./moderation.js\";\n\nexport class LLMock {\n private fixtures: Fixture[] = [];\n private searchFixtures: SearchFixture[] = [];\n private rerankFixtures: RerankFixture[] = [];\n private moderationFixtures: ModerationFixture[] = [];\n private mounts: Array<{ path: string; handler: Mountable }> = [];\n private serverInstance: ServerInstance | null = null;\n private options: MockServerOptions;\n\n constructor(options?: MockServerOptions) {\n this.options = options ?? {};\n }\n\n // ---- Fixture management ----\n\n addFixture(fixture: Fixture): this {\n this.fixtures.push(fixture);\n return this;\n }\n\n addFixtures(fixtures: Fixture[]): this {\n this.fixtures.push(...fixtures);\n return this;\n }\n\n prependFixture(fixture: Fixture): this {\n this.fixtures.unshift(fixture);\n return this;\n }\n\n getFixtures(): readonly Fixture[] {\n return this.fixtures;\n }\n\n loadFixtureFile(filePath: string): this {\n this.fixtures.push(...loadFixtureFile(filePath));\n return this;\n }\n\n loadFixtureDir(dirPath: string): this {\n this.fixtures.push(...loadFixturesFromDir(dirPath));\n return this;\n }\n\n /**\n * Add fixtures from a JSON string or pre-parsed array of fixture entries.\n * Validates all fixtures and throws if any have severity \"error\".\n */\n addFixturesFromJSON(input: string | FixtureFileEntry[]): this {\n const entries: FixtureFileEntry[] = typeof input === \"string\" ? JSON.parse(input) : input;\n const converted = entries.map(entryToFixture);\n const issues = validateFixtures(converted);\n const errors = issues.filter((i) => i.severity === \"error\");\n if (errors.length > 0) {\n throw new Error(`Fixture validation failed: ${JSON.stringify(errors)}`);\n }\n this.fixtures.push(...converted);\n return this;\n }\n\n // Uses length = 0 to preserve array reference identity — the running\n // server reads this same array on every request.\n clearFixtures(): this {\n this.fixtures.length = 0;\n return this;\n }\n\n // ---- Convenience ----\n\n on(match: FixtureMatch, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.addFixture({\n match,\n response,\n ...opts,\n });\n }\n\n onMessage(pattern: string | RegExp, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ userMessage: pattern }, response, opts);\n }\n\n onEmbedding(\n pattern: string | RegExp,\n response: FixtureResponse,\n opts?: EmbeddingFixtureOpts,\n ): this {\n return this.on({ inputText: pattern }, response, opts);\n }\n\n onJsonOutput(pattern: string | RegExp, jsonContent: object | string, opts?: FixtureOpts): this {\n const content = typeof jsonContent === \"string\" ? jsonContent : JSON.stringify(jsonContent);\n return this.on({ userMessage: pattern, responseFormat: \"json_object\" }, { content }, opts);\n }\n\n onToolCall(name: string, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ toolName: name }, response, opts);\n }\n\n onToolResult(id: string, response: FixtureResponse, opts?: FixtureOpts): this {\n return this.on({ toolCallId: id }, response, opts);\n }\n\n onImage(prompt: string | RegExp, response: ImageResponse): this {\n return this.addFixture({\n match: { userMessage: prompt, endpoint: \"image\" },\n response,\n });\n }\n\n onSpeech(input: string | RegExp, response: AudioResponse): this {\n return this.addFixture({\n match: { userMessage: input, endpoint: \"speech\" },\n response,\n });\n }\n\n onTranscription(response: TranscriptionResponse): this {\n return this.addFixture({\n match: { endpoint: \"transcription\" },\n response,\n });\n }\n\n onVideo(prompt: string | RegExp, response: VideoResponse): this {\n return this.addFixture({\n match: { userMessage: prompt, endpoint: \"video\" },\n response,\n });\n }\n\n // ---- Service mock convenience methods ----\n\n onSearch(pattern: string | RegExp, results: SearchResult[]): this {\n this.searchFixtures.push({ match: pattern, results });\n return this;\n }\n\n onRerank(pattern: string | RegExp, results: RerankResult[]): this {\n this.rerankFixtures.push({ match: pattern, results });\n return this;\n }\n\n onModerate(pattern: string | RegExp, result: ModerationResult): this {\n this.moderationFixtures.push({ match: pattern, result });\n return this;\n }\n\n /**\n * Queue a one-shot error that will be returned for the next matching\n * request, then automatically removed. Implemented as an internal fixture\n * with a `predicate` that always matches (so it fires first) and spliced\n * at the front of the fixture list.\n */\n nextRequestError(\n status: number,\n errorBody?: { message?: string; type?: string; code?: string },\n ): this {\n const errorResponse: FixtureResponse = {\n error: {\n message: errorBody?.message ?? \"Injected error\",\n type: errorBody?.type ?? \"server_error\",\n code: errorBody?.code,\n },\n status,\n };\n const fixture: Fixture = {\n match: { predicate: () => true },\n response: errorResponse,\n };\n // Insert at front so it matches before everything else\n this.fixtures.unshift(fixture);\n // Remove after first match — the journal records it so tests can assert\n const original = fixture.match.predicate!;\n fixture.match.predicate = (req) => {\n const result = original(req);\n if (result) {\n // Defer splice so it doesn't mutate the array while matchFixture iterates it\n queueMicrotask(() => {\n const idx = this.fixtures.indexOf(fixture);\n if (idx !== -1) this.fixtures.splice(idx, 1);\n });\n }\n return result;\n };\n return this;\n }\n\n // ---- Mounts ----\n\n mount(path: string, handler: Mountable): this {\n this.mounts.push({ path, handler });\n\n // If server is already running, wire up journal, registry, and baseUrl immediately\n // so late mounts behave identically to pre-start mounts.\n if (this.serverInstance) {\n if (handler.setJournal) handler.setJournal(this.serverInstance.journal);\n if (handler.setBaseUrl) handler.setBaseUrl(this.serverInstance.url + path);\n const registry = this.serverInstance.defaults.registry;\n if (registry && handler.setRegistry) handler.setRegistry(registry);\n }\n\n return this;\n }\n\n // ---- Journal proxies ----\n\n getRequests(): import(\"./types.js\").JournalEntry[] {\n return this.journal.getAll();\n }\n\n getLastRequest(): import(\"./types.js\").JournalEntry | null {\n return this.journal.getLast();\n }\n\n clearRequests(): void {\n this.journal.clear();\n }\n\n resetMatchCounts(testId?: string): this {\n if (this.serverInstance) {\n this.serverInstance.journal.clearMatchCounts(testId);\n }\n return this;\n }\n\n // ---- Chaos ----\n\n setChaos(config: ChaosConfig): this {\n this.options.chaos = config;\n return this;\n }\n\n clearChaos(): this {\n delete this.options.chaos;\n return this;\n }\n\n // ---- Recording ----\n\n enableRecording(config: RecordConfig): this {\n this.options.record = config;\n return this;\n }\n\n disableRecording(): this {\n delete this.options.record;\n return this;\n }\n\n // ---- Reset ----\n\n reset(): this {\n this.clearFixtures();\n this.searchFixtures.length = 0;\n this.rerankFixtures.length = 0;\n this.moderationFixtures.length = 0;\n if (this.serverInstance) {\n this.serverInstance.journal.clear();\n this.serverInstance.videoStates.clear();\n }\n return this;\n }\n\n // ---- Server lifecycle ----\n\n async start(): Promise<string> {\n if (this.serverInstance) {\n throw new Error(\"Server already started\");\n }\n this.serverInstance = await createServer(this.fixtures, this.options, this.mounts, {\n search: this.searchFixtures,\n rerank: this.rerankFixtures,\n moderation: this.moderationFixtures,\n });\n return this.serverInstance.url;\n }\n\n async stop(): Promise<void> {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n const { server } = this.serverInstance;\n await new Promise<void>((resolve, reject) => {\n server.close((err: Error | undefined) => (err ? reject(err) : resolve()));\n });\n this.serverInstance = null;\n }\n\n // ---- Accessors ----\n\n get journal(): Journal {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n return this.serverInstance.journal;\n }\n\n get url(): string {\n if (!this.serverInstance) {\n throw new Error(\"Server not started\");\n }\n return this.serverInstance.url;\n }\n\n get baseUrl(): string {\n return this.url;\n }\n\n get port(): number {\n const parsed = new URL(this.url); // this.url throws if not started\n if (!parsed.port) {\n throw new Error(`Server URL has no explicit port: ${this.url}`);\n }\n return parseInt(parsed.port, 10);\n }\n\n // ---- Static factory ----\n\n static async create(options?: MockServerOptions): Promise<LLMock> {\n const instance = new LLMock(options);\n await instance.start();\n return instance;\n }\n}\n"],"mappings":";;;;AA4BA,IAAa,SAAb,MAAa,OAAO;CAClB,AAAQ,WAAsB,EAAE;CAChC,AAAQ,iBAAkC,EAAE;CAC5C,AAAQ,iBAAkC,EAAE;CAC5C,AAAQ,qBAA0C,EAAE;CACpD,AAAQ,SAAsD,EAAE;CAChE,AAAQ,iBAAwC;CAChD,AAAQ;CAER,YAAY,SAA6B;AACvC,OAAK,UAAU,WAAW,EAAE;;CAK9B,WAAW,SAAwB;AACjC,OAAK,SAAS,KAAK,QAAQ;AAC3B,SAAO;;CAGT,YAAY,UAA2B;AACrC,OAAK,SAAS,KAAK,GAAG,SAAS;AAC/B,SAAO;;CAGT,eAAe,SAAwB;AACrC,OAAK,SAAS,QAAQ,QAAQ;AAC9B,SAAO;;CAGT,cAAkC;AAChC,SAAO,KAAK;;CAGd,gBAAgB,UAAwB;AACtC,OAAK,SAAS,KAAK,GAAGA,uCAAgB,SAAS,CAAC;AAChD,SAAO;;CAGT,eAAe,SAAuB;AACpC,OAAK,SAAS,KAAK,GAAGC,2CAAoB,QAAQ,CAAC;AACnD,SAAO;;;;;;CAOT,oBAAoB,OAA0C;EAE5D,MAAM,aAD8B,OAAO,UAAU,WAAW,KAAK,MAAM,MAAM,GAAG,OAC1D,IAAIC,sCAAe;EAE7C,MAAM,SADSC,wCAAiB,UAAU,CACpB,QAAQ,MAAM,EAAE,aAAa,QAAQ;AAC3D,MAAI,OAAO,SAAS,EAClB,OAAM,IAAI,MAAM,8BAA8B,KAAK,UAAU,OAAO,GAAG;AAEzE,OAAK,SAAS,KAAK,GAAG,UAAU;AAChC,SAAO;;CAKT,gBAAsB;AACpB,OAAK,SAAS,SAAS;AACvB,SAAO;;CAKT,GAAG,OAAqB,UAA2B,MAA0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,GAAG;;CAKlC,aAAa,OAAO,SAA8C;EAChE,MAAM,WAAW,IAAI,OAAO,QAAQ;AACpC,QAAM,SAAS,OAAO;AACtB,SAAO"}
package/dist/llmock.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Journal } from "./journal.cjs";
2
- import { ChaosConfig, EmbeddingFixtureOpts, Fixture, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig } from "./types.cjs";
2
+ import { AudioResponse, ChaosConfig, EmbeddingFixtureOpts, Fixture, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, ImageResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig, TranscriptionResponse, VideoResponse } from "./types.cjs";
3
3
  import { SearchResult } from "./search.cjs";
4
4
  import { RerankResult } from "./rerank.cjs";
5
5
  import { ModerationResult } from "./moderation.cjs";
@@ -32,6 +32,10 @@ declare class LLMock {
32
32
  onJsonOutput(pattern: string | RegExp, jsonContent: object | string, opts?: FixtureOpts): this;
33
33
  onToolCall(name: string, response: FixtureResponse, opts?: FixtureOpts): this;
34
34
  onToolResult(id: string, response: FixtureResponse, opts?: FixtureOpts): this;
35
+ onImage(prompt: string | RegExp, response: ImageResponse): this;
36
+ onSpeech(input: string | RegExp, response: AudioResponse): this;
37
+ onTranscription(response: TranscriptionResponse): this;
38
+ onVideo(prompt: string | RegExp, response: VideoResponse): this;
35
39
  onSearch(pattern: string | RegExp, results: SearchResult[]): this;
36
40
  onRerank(pattern: string | RegExp, results: RerankResult[]): this;
37
41
  onModerate(pattern: string | RegExp, result: ModerationResult): this;
@@ -1 +1 @@
1
- {"version":3,"file":"llmock.d.cts","names":[],"sources":["../src/llmock.ts"],"sourcesContent":[],"mappings":";;;;;;;cAwBa,MAAA;;EAAA,QAAA,cAAM;EAAA,QAAA,cAAA;UASK,kBAAA;UAMF,MAAA;UAKE,cAAA;UAKE,OAAA;aAKA,CAAA,OAAA,CAAA,EArBF,iBAqBE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,CAAA,MAAA,EAAA,MAAA,EAAA,UAAA,EAAA;IAqB/B,OAAA,CAAA,EAAA,MAAA;IAYO,IAAA,CAAA,EAAA,MAAA;IA0BT,IAAA,CAAA,EAAA,MAAA;MAYD,IAAA;OAaC,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EArGc,SAqGd,CAAA,EAAA,IAAA;aA4Be,CAAA,CAAA,EAjIQ,YAAA,EAiIR;gBAA4B,CAAA,CAAA,EAhHV,YAAA,GAgHU,IAAA;eAAR,CAAA,CAAA,EAAA,IAAA;EAAO,gBAAA,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;mBA3FxC;;0BAYO;;;WA0BT;UAYD;iBAaC;;;;0BA4Be,oBAAoB,QAAQ"}
package/dist/llmock.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Journal } from "./journal.js";
2
- import { ChaosConfig, EmbeddingFixtureOpts, Fixture, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig } from "./types.js";
2
+ import { AudioResponse, ChaosConfig, EmbeddingFixtureOpts, Fixture, FixtureFileEntry, FixtureMatch, FixtureOpts, FixtureResponse, ImageResponse, JournalEntry, MockServerOptions, Mountable, RecordConfig, TranscriptionResponse, VideoResponse } from "./types.js";
3
3
  import { SearchResult } from "./search.js";
4
4
  import { RerankResult } from "./rerank.js";
5
5
  import { ModerationResult } from "./moderation.js";
@@ -32,6 +32,10 @@ declare class LLMock {
32
32
  onJsonOutput(pattern: string | RegExp, jsonContent: object | string, opts?: FixtureOpts): this;
33
33
  onToolCall(name: string, response: FixtureResponse, opts?: FixtureOpts): this;
34
34
  onToolResult(id: string, response: FixtureResponse, opts?: FixtureOpts): this;
35
+ onImage(prompt: string | RegExp, response: ImageResponse): this;
36
+ onSpeech(input: string | RegExp, response: AudioResponse): this;
37
+ onTranscription(response: TranscriptionResponse): this;
38
+ onVideo(prompt: string | RegExp, response: VideoResponse): this;
35
39
  onSearch(pattern: string | RegExp, results: SearchResult[]): this;
36
40
  onRerank(pattern: string | RegExp, results: RerankResult[]): this;
37
41
  onModerate(pattern: string | RegExp, result: ModerationResult): this;
@@ -1 +1 @@
1
- {"version":3,"file":"llmock.d.ts","names":[],"sources":["../src/llmock.ts"],"sourcesContent":[],"mappings":";;;;;;;cAwBa,MAAA;;EAAA,QAAA,cAAM;EAAA,QAAA,cAAA;UASK,kBAAA;UAMF,MAAA;UAKE,cAAA;UAKE,OAAA;aAKA,CAAA,OAAA,CAAA,EArBF,iBAqBE;YAkBY,CAAA,OAAA,EAjChB,OAiCgB,CAAA,EAAA,IAAA;aAqB1B,CAAA,QAAA,EAjDY,OAiDZ,EAAA,CAAA,EAAA,IAAA;gBAAwB,CAAA,OAAA,EA5CV,OA4CU,CAAA,EAAA,IAAA;aAAwB,CAAA,CAAA,EAAA,SAvClC,OAuCkC,EAAA;iBAQ9B,CAAA,QAAA,EAAA,MAAA,CAAA,EAAA,IAAA;gBAAkB,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;;qBAYf,CAAA,KAAA,EAAA,MAAA,GAzCK,gBAyCL,EAAA,CAAA,EAAA,IAAA;eAA6C,CAAA,CAAA,EAAA,IAAA;KAKzC,KAAA,EAzBzB,YAyByB,EAAA,QAAA,EAzBD,eAyBC,EAAA,IAAA,CAAA,EAzBuB,WAyBvB,CAAA,EAAA,IAAA;WAAwB,CAAA,OAAA,EAAA,MAAA,GAjB/B,MAiB+B,EAAA,QAAA,EAjBb,eAiBa,EAAA,IAAA,CAAA,EAjBW,WAiBX,CAAA,EAAA,IAAA;aAIxB,CAAA,OAAA,EAAA,MAAA,GAhBf,MAgBe,EAAA,QAAA,EAfvB,eAeuB,EAAA,IAAA,CAAA,EAd1B,oBAc0B,CAAA,EAAA,IAAA;cAAwB,CAAA,OAAA,EAAA,MAAA,GAT5B,MAS4B,EAAA,WAAA,EAAA,MAAA,GAAA,MAAA,EAAA,IAAA,CAAA,EATi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AAA,MAAA,GAAA,MAAA,EAAA,QAAA,EAAkB,aAAlB,CAAA,EAAA,IAAA;UAAkB,CAAA,OAAA,EAAA,MAAA,GAShB,MATgB,EAAA,OAAA,EASC,YATD,EAAA,CAAA,EAAA,IAAA;UAShB,CAAA,OAAA,EAAA,MAAA,GAKA,MALA,EAAA,OAAA,EAKiB,YALjB,EAAA,CAAA,EAAA,IAAA;YAAiB,CAAA,OAAA,EAAA,MAAA,GAUf,MAVe,EAAA,MAAA,EAUC,gBAVD,CAAA,EAAA,IAAA;;;;;;;kBA0EI,CAAA,MAAA,EAAA,MAAA,EAAA,UAAA,EAAA;IAqB/B,OAAA,CAAA,EAAA,MAAA;IAYO,IAAA,CAAA,EAAA,MAAA;IA0BT,IAAA,CAAA,EAAA,MAAA;MAYD,IAAA;OAaC,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EArGc,SAqGd,CAAA,EAAA,IAAA;aA4Be,CAAA,CAAA,EAjIQ,YAAA,EAiIR;gBAA4B,CAAA,CAAA,EAhHV,YAAA,GAgHU,IAAA;eAAR,CAAA,CAAA,EAAA,IAAA;EAAO,gBAAA,CAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;mBA3FxC;;0BAYO;;;WA0BT;UAYD;iBAaC;;;;0BA4Be,oBAAoB,QAAQ"}
package/dist/llmock.js CHANGED
@@ -77,6 +77,39 @@ var LLMock = class LLMock {
77
77
  onToolResult(id, response, opts) {
78
78
  return this.on({ toolCallId: id }, response, opts);
79
79
  }
80
+ onImage(prompt, response) {
81
+ return this.addFixture({
82
+ match: {
83
+ userMessage: prompt,
84
+ endpoint: "image"
85
+ },
86
+ response
87
+ });
88
+ }
89
+ onSpeech(input, response) {
90
+ return this.addFixture({
91
+ match: {
92
+ userMessage: input,
93
+ endpoint: "speech"
94
+ },
95
+ response
96
+ });
97
+ }
98
+ onTranscription(response) {
99
+ return this.addFixture({
100
+ match: { endpoint: "transcription" },
101
+ response
102
+ });
103
+ }
104
+ onVideo(prompt, response) {
105
+ return this.addFixture({
106
+ match: {
107
+ userMessage: prompt,
108
+ endpoint: "video"
109
+ },
110
+ response
111
+ });
112
+ }
80
113
  onSearch(pattern, results) {
81
114
  this.searchFixtures.push({
82
115
  match: pattern,
@@ -175,7 +208,10 @@ var LLMock = class LLMock {
175
208
  this.searchFixtures.length = 0;
176
209
  this.rerankFixtures.length = 0;
177
210
  this.moderationFixtures.length = 0;
178
- if (this.serverInstance) this.serverInstance.journal.clear();
211
+ if (this.serverInstance) {
212
+ this.serverInstance.journal.clear();
213
+ this.serverInstance.videoStates.clear();
214
+ }
179
215
  return this;
180
216
  }
181
217
  async start() {