@copilotkit/aimock 1.43.0 → 1.45.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 (396) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +46 -0
  4. package/README.md +14 -2
  5. package/dist/agui-handler.d.ts.map +1 -1
  6. package/dist/aimock-cli.cjs +31 -5
  7. package/dist/aimock-cli.cjs.map +1 -1
  8. package/dist/aimock-cli.d.cts.map +1 -1
  9. package/dist/aimock-cli.d.ts.map +1 -1
  10. package/dist/aimock-cli.js +31 -5
  11. package/dist/aimock-cli.js.map +1 -1
  12. package/dist/bedrock-converse.cjs +344 -43
  13. package/dist/bedrock-converse.cjs.map +1 -1
  14. package/dist/bedrock-converse.d.cts.map +1 -1
  15. package/dist/bedrock-converse.d.ts.map +1 -1
  16. package/dist/bedrock-converse.js +345 -44
  17. package/dist/bedrock-converse.js.map +1 -1
  18. package/dist/bedrock.cjs +195 -42
  19. package/dist/bedrock.cjs.map +1 -1
  20. package/dist/bedrock.d.cts.map +1 -1
  21. package/dist/bedrock.d.ts.map +1 -1
  22. package/dist/bedrock.js +196 -43
  23. package/dist/bedrock.js.map +1 -1
  24. package/dist/chaos.cjs +9 -5
  25. package/dist/chaos.cjs.map +1 -1
  26. package/dist/chaos.d.cts.map +1 -1
  27. package/dist/chaos.d.ts.map +1 -1
  28. package/dist/chaos.js +10 -7
  29. package/dist/chaos.js.map +1 -1
  30. package/dist/cli.cjs +238 -9
  31. package/dist/cli.cjs.map +1 -1
  32. package/dist/cli.js +242 -13
  33. package/dist/cli.js.map +1 -1
  34. package/dist/cohere.cjs +159 -72
  35. package/dist/cohere.cjs.map +1 -1
  36. package/dist/cohere.d.cts.map +1 -1
  37. package/dist/cohere.d.ts.map +1 -1
  38. package/dist/cohere.js +160 -73
  39. package/dist/cohere.js.map +1 -1
  40. package/dist/config-loader.cjs +63 -5
  41. package/dist/config-loader.cjs.map +1 -1
  42. package/dist/config-loader.d.cts +37 -4
  43. package/dist/config-loader.d.cts.map +1 -1
  44. package/dist/config-loader.d.ts +37 -4
  45. package/dist/config-loader.d.ts.map +1 -1
  46. package/dist/config-loader.js +63 -5
  47. package/dist/config-loader.js.map +1 -1
  48. package/dist/constants.cjs +8 -0
  49. package/dist/constants.cjs.map +1 -1
  50. package/dist/constants.d.cts +6 -2
  51. package/dist/constants.d.ts +6 -2
  52. package/dist/constants.js +8 -1
  53. package/dist/constants.js.map +1 -1
  54. package/dist/echo-text.cjs +65 -0
  55. package/dist/echo-text.cjs.map +1 -0
  56. package/dist/echo-text.d.cts +22 -0
  57. package/dist/echo-text.d.cts.map +1 -0
  58. package/dist/echo-text.d.ts +22 -0
  59. package/dist/echo-text.d.ts.map +1 -0
  60. package/dist/echo-text.js +65 -0
  61. package/dist/echo-text.js.map +1 -0
  62. package/dist/embeddings.cjs +18 -1
  63. package/dist/embeddings.cjs.map +1 -1
  64. package/dist/embeddings.d.cts +1 -1
  65. package/dist/embeddings.d.cts.map +1 -1
  66. package/dist/embeddings.d.ts +1 -1
  67. package/dist/embeddings.d.ts.map +1 -1
  68. package/dist/embeddings.js +18 -1
  69. package/dist/embeddings.js.map +1 -1
  70. package/dist/fakes-plugin.cjs +131 -0
  71. package/dist/fakes-plugin.cjs.map +1 -0
  72. package/dist/fakes-plugin.d.cts +23 -0
  73. package/dist/fakes-plugin.d.cts.map +1 -0
  74. package/dist/fakes-plugin.d.ts +23 -0
  75. package/dist/fakes-plugin.d.ts.map +1 -0
  76. package/dist/fakes-plugin.js +127 -0
  77. package/dist/fakes-plugin.js.map +1 -0
  78. package/dist/files.cjs +9 -11
  79. package/dist/files.cjs.map +1 -1
  80. package/dist/files.d.cts.map +1 -1
  81. package/dist/files.d.ts.map +1 -1
  82. package/dist/files.js +10 -13
  83. package/dist/files.js.map +1 -1
  84. package/dist/fine-tuning.cjs +1 -19
  85. package/dist/fine-tuning.cjs.map +1 -1
  86. package/dist/fine-tuning.d.cts.map +1 -1
  87. package/dist/fine-tuning.d.ts.map +1 -1
  88. package/dist/fine-tuning.js +2 -20
  89. package/dist/fine-tuning.js.map +1 -1
  90. package/dist/fixture-loader-services.cjs +116 -0
  91. package/dist/fixture-loader-services.cjs.map +1 -0
  92. package/dist/fixture-loader-services.d.cts +48 -0
  93. package/dist/fixture-loader-services.d.cts.map +1 -0
  94. package/dist/fixture-loader-services.d.ts +48 -0
  95. package/dist/fixture-loader-services.d.ts.map +1 -0
  96. package/dist/fixture-loader-services.js +114 -0
  97. package/dist/fixture-loader-services.js.map +1 -0
  98. package/dist/fixture-loader.cjs +552 -29
  99. package/dist/fixture-loader.cjs.map +1 -1
  100. package/dist/fixture-loader.d.cts +140 -2
  101. package/dist/fixture-loader.d.cts.map +1 -1
  102. package/dist/fixture-loader.d.ts +140 -2
  103. package/dist/fixture-loader.d.ts.map +1 -1
  104. package/dist/fixture-loader.js +542 -31
  105. package/dist/fixture-loader.js.map +1 -1
  106. package/dist/gemini-embeddings.cjs +42 -2
  107. package/dist/gemini-embeddings.cjs.map +1 -1
  108. package/dist/gemini-embeddings.js +43 -3
  109. package/dist/gemini-embeddings.js.map +1 -1
  110. package/dist/gemini-interactions.cjs +288 -52
  111. package/dist/gemini-interactions.cjs.map +1 -1
  112. package/dist/gemini-interactions.d.cts.map +1 -1
  113. package/dist/gemini-interactions.d.ts.map +1 -1
  114. package/dist/gemini-interactions.js +289 -53
  115. package/dist/gemini-interactions.js.map +1 -1
  116. package/dist/gemini.cjs +234 -38
  117. package/dist/gemini.cjs.map +1 -1
  118. package/dist/gemini.d.cts.map +1 -1
  119. package/dist/gemini.d.ts.map +1 -1
  120. package/dist/gemini.js +235 -39
  121. package/dist/gemini.js.map +1 -1
  122. package/dist/helpers.cjs +1157 -12
  123. package/dist/helpers.cjs.map +1 -1
  124. package/dist/helpers.d.cts +85 -4
  125. package/dist/helpers.d.cts.map +1 -1
  126. package/dist/helpers.d.ts +85 -4
  127. package/dist/helpers.d.ts.map +1 -1
  128. package/dist/helpers.js +1113 -14
  129. package/dist/helpers.js.map +1 -1
  130. package/dist/images.cjs +3 -2
  131. package/dist/images.cjs.map +1 -1
  132. package/dist/images.js +3 -2
  133. package/dist/images.js.map +1 -1
  134. package/dist/index.cjs +39 -1
  135. package/dist/index.d.cts +11 -4
  136. package/dist/index.d.ts +11 -4
  137. package/dist/index.js +11 -4
  138. package/dist/jest.cjs +43 -14
  139. package/dist/jest.cjs.map +1 -1
  140. package/dist/jest.d.cts +47 -5
  141. package/dist/jest.d.cts.map +1 -1
  142. package/dist/jest.d.ts +47 -5
  143. package/dist/jest.d.ts.map +1 -1
  144. package/dist/jest.js +45 -16
  145. package/dist/jest.js.map +1 -1
  146. package/dist/journal.cjs +155 -13
  147. package/dist/journal.cjs.map +1 -1
  148. package/dist/journal.d.cts +54 -4
  149. package/dist/journal.d.cts.map +1 -1
  150. package/dist/journal.d.ts +54 -4
  151. package/dist/journal.d.ts.map +1 -1
  152. package/dist/journal.js +155 -13
  153. package/dist/journal.js.map +1 -1
  154. package/dist/live-sanitize.cjs +4 -32
  155. package/dist/live-sanitize.cjs.map +1 -1
  156. package/dist/live-sanitize.js +4 -32
  157. package/dist/live-sanitize.js.map +1 -1
  158. package/dist/llmock.cjs +204 -39
  159. package/dist/llmock.cjs.map +1 -1
  160. package/dist/llmock.d.cts +51 -1
  161. package/dist/llmock.d.cts.map +1 -1
  162. package/dist/llmock.d.ts +51 -1
  163. package/dist/llmock.d.ts.map +1 -1
  164. package/dist/llmock.js +206 -41
  165. package/dist/llmock.js.map +1 -1
  166. package/dist/mcp-fakes-mount.cjs +217 -0
  167. package/dist/mcp-fakes-mount.cjs.map +1 -0
  168. package/dist/mcp-fakes-mount.js +211 -0
  169. package/dist/mcp-fakes-mount.js.map +1 -0
  170. package/dist/mcp-fakes-report.cjs +111 -0
  171. package/dist/mcp-fakes-report.cjs.map +1 -0
  172. package/dist/mcp-fakes-report.d.cts +40 -0
  173. package/dist/mcp-fakes-report.d.cts.map +1 -0
  174. package/dist/mcp-fakes-report.d.ts +40 -0
  175. package/dist/mcp-fakes-report.d.ts.map +1 -0
  176. package/dist/mcp-fakes-report.js +107 -0
  177. package/dist/mcp-fakes-report.js.map +1 -0
  178. package/dist/mcp-fakes.cjs +1942 -0
  179. package/dist/mcp-fakes.cjs.map +1 -0
  180. package/dist/mcp-fakes.d.cts +504 -0
  181. package/dist/mcp-fakes.d.cts.map +1 -0
  182. package/dist/mcp-fakes.d.ts +504 -0
  183. package/dist/mcp-fakes.d.ts.map +1 -0
  184. package/dist/mcp-fakes.js +1937 -0
  185. package/dist/mcp-fakes.js.map +1 -0
  186. package/dist/mcp-handler.cjs +534 -27
  187. package/dist/mcp-handler.cjs.map +1 -1
  188. package/dist/mcp-handler.d.cts +49 -0
  189. package/dist/mcp-handler.d.cts.map +1 -0
  190. package/dist/mcp-handler.d.ts +49 -0
  191. package/dist/mcp-handler.d.ts.map +1 -0
  192. package/dist/mcp-handler.js +530 -28
  193. package/dist/mcp-handler.js.map +1 -1
  194. package/dist/mcp-mock.cjs +326 -47
  195. package/dist/mcp-mock.cjs.map +1 -1
  196. package/dist/mcp-mock.d.cts +97 -1
  197. package/dist/mcp-mock.d.cts.map +1 -1
  198. package/dist/mcp-mock.d.ts +97 -1
  199. package/dist/mcp-mock.d.ts.map +1 -1
  200. package/dist/mcp-mock.js +327 -48
  201. package/dist/mcp-mock.js.map +1 -1
  202. package/dist/mcp-recorder.cjs +1224 -0
  203. package/dist/mcp-recorder.cjs.map +1 -0
  204. package/dist/mcp-recorder.d.cts +108 -0
  205. package/dist/mcp-recorder.d.cts.map +1 -0
  206. package/dist/mcp-recorder.d.ts +108 -0
  207. package/dist/mcp-recorder.d.ts.map +1 -0
  208. package/dist/mcp-recorder.js +1215 -0
  209. package/dist/mcp-recorder.js.map +1 -0
  210. package/dist/mcp-stub.cjs +5 -1
  211. package/dist/mcp-stub.d.cts +3 -1
  212. package/dist/mcp-stub.d.ts +3 -1
  213. package/dist/mcp-stub.js +3 -1
  214. package/dist/mcp-types.d.cts +6 -0
  215. package/dist/mcp-types.d.ts +6 -0
  216. package/dist/message-text.cjs +192 -0
  217. package/dist/message-text.cjs.map +1 -0
  218. package/dist/message-text.d.cts +31 -0
  219. package/dist/message-text.d.cts.map +1 -0
  220. package/dist/message-text.d.ts +31 -0
  221. package/dist/message-text.d.ts.map +1 -0
  222. package/dist/message-text.js +184 -0
  223. package/dist/message-text.js.map +1 -0
  224. package/dist/messages.cjs +400 -56
  225. package/dist/messages.cjs.map +1 -1
  226. package/dist/messages.d.cts.map +1 -1
  227. package/dist/messages.d.ts.map +1 -1
  228. package/dist/messages.js +401 -58
  229. package/dist/messages.js.map +1 -1
  230. package/dist/metrics.cjs +46 -66
  231. package/dist/metrics.cjs.map +1 -1
  232. package/dist/metrics.d.cts +14 -6
  233. package/dist/metrics.d.cts.map +1 -1
  234. package/dist/metrics.d.ts +14 -6
  235. package/dist/metrics.d.ts.map +1 -1
  236. package/dist/metrics.js +32 -40
  237. package/dist/metrics.js.map +1 -1
  238. package/dist/misbehavior.cjs +1523 -0
  239. package/dist/misbehavior.cjs.map +1 -0
  240. package/dist/misbehavior.d.cts +43 -0
  241. package/dist/misbehavior.d.cts.map +1 -0
  242. package/dist/misbehavior.d.ts +43 -0
  243. package/dist/misbehavior.d.ts.map +1 -0
  244. package/dist/misbehavior.js +1511 -0
  245. package/dist/misbehavior.js.map +1 -0
  246. package/dist/ollama.cjs +315 -113
  247. package/dist/ollama.cjs.map +1 -1
  248. package/dist/ollama.d.cts.map +1 -1
  249. package/dist/ollama.d.ts.map +1 -1
  250. package/dist/ollama.js +316 -114
  251. package/dist/ollama.js.map +1 -1
  252. package/dist/openapi.cjs +3405 -0
  253. package/dist/openapi.cjs.map +1 -0
  254. package/dist/openapi.d.cts +30 -0
  255. package/dist/openapi.d.cts.map +1 -0
  256. package/dist/openapi.d.ts +30 -0
  257. package/dist/openapi.d.ts.map +1 -0
  258. package/dist/openapi.js +3404 -0
  259. package/dist/openapi.js.map +1 -0
  260. package/dist/openrouter-video.cjs +4 -4
  261. package/dist/openrouter-video.cjs.map +1 -1
  262. package/dist/openrouter-video.d.cts.map +1 -1
  263. package/dist/openrouter-video.d.ts.map +1 -1
  264. package/dist/openrouter-video.js +4 -4
  265. package/dist/openrouter-video.js.map +1 -1
  266. package/dist/record-sanitize.cjs +231 -0
  267. package/dist/record-sanitize.cjs.map +1 -0
  268. package/dist/record-sanitize.js +224 -0
  269. package/dist/record-sanitize.js.map +1 -0
  270. package/dist/recorder.cjs +115 -6
  271. package/dist/recorder.cjs.map +1 -1
  272. package/dist/recorder.d.cts +2 -1
  273. package/dist/recorder.d.cts.map +1 -1
  274. package/dist/recorder.d.ts +2 -1
  275. package/dist/recorder.d.ts.map +1 -1
  276. package/dist/recorder.js +116 -8
  277. package/dist/recorder.js.map +1 -1
  278. package/dist/responses.cjs +701 -166
  279. package/dist/responses.cjs.map +1 -1
  280. package/dist/responses.d.cts +5 -13
  281. package/dist/responses.d.cts.map +1 -1
  282. package/dist/responses.d.ts +5 -13
  283. package/dist/responses.d.ts.map +1 -1
  284. package/dist/responses.js +699 -169
  285. package/dist/responses.js.map +1 -1
  286. package/dist/route-registry.cjs +951 -0
  287. package/dist/route-registry.cjs.map +1 -0
  288. package/dist/route-registry.d.cts +33 -0
  289. package/dist/route-registry.d.cts.map +1 -0
  290. package/dist/route-registry.d.ts +33 -0
  291. package/dist/route-registry.d.ts.map +1 -0
  292. package/dist/route-registry.js +866 -0
  293. package/dist/route-registry.js.map +1 -0
  294. package/dist/router.cjs +24 -2
  295. package/dist/router.cjs.map +1 -1
  296. package/dist/router.d.cts.map +1 -1
  297. package/dist/router.d.ts.map +1 -1
  298. package/dist/router.js +25 -4
  299. package/dist/router.js.map +1 -1
  300. package/dist/server.cjs +1159 -264
  301. package/dist/server.cjs.map +1 -1
  302. package/dist/server.d.cts +4 -1
  303. package/dist/server.d.cts.map +1 -1
  304. package/dist/server.d.ts +4 -1
  305. package/dist/server.d.ts.map +1 -1
  306. package/dist/server.js +1067 -172
  307. package/dist/server.js.map +1 -1
  308. package/dist/speech.cjs +4 -2
  309. package/dist/speech.cjs.map +1 -1
  310. package/dist/speech.js +4 -2
  311. package/dist/speech.js.map +1 -1
  312. package/dist/stream-collapse.cjs +236 -34
  313. package/dist/stream-collapse.cjs.map +1 -1
  314. package/dist/stream-collapse.d.cts +39 -4
  315. package/dist/stream-collapse.d.cts.map +1 -1
  316. package/dist/stream-collapse.d.ts +39 -4
  317. package/dist/stream-collapse.d.ts.map +1 -1
  318. package/dist/stream-collapse.js +235 -35
  319. package/dist/stream-collapse.js.map +1 -1
  320. package/dist/suite.cjs +1 -1
  321. package/dist/suite.js +1 -1
  322. package/dist/transcription.cjs +2 -2
  323. package/dist/transcription.cjs.map +1 -1
  324. package/dist/transcription.d.cts.map +1 -1
  325. package/dist/transcription.d.ts.map +1 -1
  326. package/dist/transcription.js +2 -2
  327. package/dist/transcription.js.map +1 -1
  328. package/dist/types.cjs +18 -0
  329. package/dist/types.cjs.map +1 -0
  330. package/dist/types.d.cts +516 -5
  331. package/dist/types.d.cts.map +1 -1
  332. package/dist/types.d.ts +516 -5
  333. package/dist/types.d.ts.map +1 -1
  334. package/dist/types.js +17 -0
  335. package/dist/types.js.map +1 -0
  336. package/dist/validate-cli.cjs +123 -33
  337. package/dist/validate-cli.cjs.map +1 -1
  338. package/dist/validate-cli.js +125 -35
  339. package/dist/validate-cli.js.map +1 -1
  340. package/dist/vector-stores.cjs +1180 -0
  341. package/dist/vector-stores.cjs.map +1 -0
  342. package/dist/vector-stores.d.cts +106 -0
  343. package/dist/vector-stores.d.cts.map +1 -0
  344. package/dist/vector-stores.d.ts +106 -0
  345. package/dist/vector-stores.d.ts.map +1 -0
  346. package/dist/vector-stores.js +1164 -0
  347. package/dist/vector-stores.js.map +1 -0
  348. package/dist/vector-types.d.cts.map +1 -1
  349. package/dist/version.cjs +45 -0
  350. package/dist/version.cjs.map +1 -0
  351. package/dist/version.js +44 -0
  352. package/dist/version.js.map +1 -0
  353. package/dist/video.cjs +19 -0
  354. package/dist/video.cjs.map +1 -1
  355. package/dist/video.d.cts.map +1 -1
  356. package/dist/video.d.ts.map +1 -1
  357. package/dist/video.js +19 -0
  358. package/dist/video.js.map +1 -1
  359. package/dist/vitest.cjs +77 -16
  360. package/dist/vitest.cjs.map +1 -1
  361. package/dist/vitest.d.cts +38 -5
  362. package/dist/vitest.d.cts.map +1 -1
  363. package/dist/vitest.d.ts +38 -5
  364. package/dist/vitest.d.ts.map +1 -1
  365. package/dist/vitest.js +78 -17
  366. package/dist/vitest.js.map +1 -1
  367. package/dist/watcher.cjs +6 -2
  368. package/dist/watcher.cjs.map +1 -1
  369. package/dist/watcher.js +6 -2
  370. package/dist/watcher.js.map +1 -1
  371. package/dist/ws-gemini-live.cjs +210 -101
  372. package/dist/ws-gemini-live.cjs.map +1 -1
  373. package/dist/ws-gemini-live.d.cts +9 -3
  374. package/dist/ws-gemini-live.d.cts.map +1 -1
  375. package/dist/ws-gemini-live.d.ts +9 -3
  376. package/dist/ws-gemini-live.d.ts.map +1 -1
  377. package/dist/ws-gemini-live.js +211 -102
  378. package/dist/ws-gemini-live.js.map +1 -1
  379. package/dist/ws-realtime.cjs +175 -62
  380. package/dist/ws-realtime.cjs.map +1 -1
  381. package/dist/ws-realtime.d.cts +8 -3
  382. package/dist/ws-realtime.d.cts.map +1 -1
  383. package/dist/ws-realtime.d.ts +8 -3
  384. package/dist/ws-realtime.d.ts.map +1 -1
  385. package/dist/ws-realtime.js +176 -63
  386. package/dist/ws-realtime.js.map +1 -1
  387. package/dist/ws-responses.cjs +121 -16
  388. package/dist/ws-responses.cjs.map +1 -1
  389. package/dist/ws-responses.d.cts +8 -12
  390. package/dist/ws-responses.d.cts.map +1 -1
  391. package/dist/ws-responses.d.ts +8 -12
  392. package/dist/ws-responses.d.ts.map +1 -1
  393. package/dist/ws-responses.js +123 -18
  394. package/dist/ws-responses.js.map +1 -1
  395. package/package.json +13 -2
  396. package/skills/write-fixtures/SKILL.md +179 -21
@@ -1,7 +1,9 @@
1
- import { entryToFixture, renderValidationRef, validateFixtures } from "./fixture-loader.js";
1
+ import { build, msg, plainText } from "./message-text.js";
2
+ import { MisbehaviorConfigError, enableHeldFixtureMisbehavior, entryToFixture, hasMcpFakesKey, markFixtureResponsesToolsExtended, renderValidationRef, validateFixtures } from "./fixture-loader.js";
2
3
  import { Logger } from "./logger.js";
4
+ import { McpFakeStore, McpFakesAddError, validateMcpFakes } from "./mcp-fakes.js";
3
5
  import { readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
4
- import { join, resolve } from "node:path";
6
+ import { join, relative, resolve, sep } from "node:path";
5
7
  import { format, parseArgs } from "node:util";
6
8
 
7
9
  //#region src/validate-cli.ts
@@ -45,14 +47,9 @@ import { format, parseArgs } from "node:util";
45
47
  * directory symlink that points back at a directory already being walked
46
48
  * is reported once as a cycle, where the server recurses through it until
47
49
  * the kernel returns ELOOP (~32 levels deep) and loads those levels'
48
- * fixtures over and over. One diagnostic here has no counterpart there at
49
- * all: an entry whose `match` is a string, a number, a boolean or an array
50
- * converts, on both sides, into an EMPTY match — a catch-all answering
51
- * every request — and the server loads it without a word. That is a server
52
- * bug, not a rule this lint may quietly invent an error for, so it is a
53
- * `[warning]` (which `--strict` promotes to a failure) rather than an
54
- * error, and the fixture still goes on to the rules exactly as the server
55
- * would build it.
50
+ * fixtures over and over. Malformed scalar or array matches are rejected
51
+ * before conversion, as they are by the server's fixture loader. The lint
52
+ * reports an entry error and continues validating valid siblings.
56
53
  * - Equal: the `validateFixtures` rules themselves, because of the union
57
54
  * pass above, and the zero-fixture rule — a run whose inputs yield no
58
55
  * fixtures at all is an error here, matching the server's "No fixtures
@@ -132,6 +129,13 @@ pointing anywhere else is followed, as the server follows it.
132
129
  Options:
133
130
  --strict Treat warnings as errors (exit 1 on warnings)
134
131
  --json Emit a JSON report instead of human lines
132
+ --misbehavior Check fixture misbehavior keys, as the server does with
133
+ --misbehavior (without it they are not read)
134
+ --responses-tools <legacy|extended>
135
+ With "extended", check match.toolNamespace,
136
+ customToolCalls and responsesBlocks, as a server with
137
+ --responses-tools extended reads them (default
138
+ "legacy": they are not read)
135
139
  -h, --help Show this help message
136
140
  -- Stop option parsing; every later argument is a path
137
141
  (use this for a path that begins with "-")
@@ -271,6 +275,7 @@ function nonFixtureSkipReason(file) {
271
275
  } catch {
272
276
  return;
273
277
  }
278
+ if (hasMcpFakesKey(parsed)) return void 0;
274
279
  const asConfig = aimockConfigDescription(parsed);
275
280
  if (asConfig !== void 0) return `not a fixture file — ${asConfig}`;
276
281
  if (typeof parsed === "object" && parsed !== null && "fixtures" in parsed) return void 0;
@@ -428,9 +433,9 @@ function classifyEntry(entry) {
428
433
  }).map((k) => `"${k}"`).join(" and ")} — ${ENTRY_SHAPE}`
429
434
  };
430
435
  if (typeof match !== "object" || Array.isArray(match)) return {
431
- severity: "warning",
432
- convertible: true,
433
- why: `"match" is ${gotText(match)}, not an object — every match field reads as undefined, so this entry is an empty match: a CATCH-ALL answering every request. The server loads it the same way, so this warns rather than errors; --strict fails on it. ${ENTRY_SHAPE}`
436
+ severity: "error",
437
+ convertible: false,
438
+ why: `"match" is ${gotText(match)}, expected an object — ${ENTRY_SHAPE}`
434
439
  };
435
440
  }
436
441
  /**
@@ -459,7 +464,7 @@ function unexpectedEntryFailure(index, err) {
459
464
  * cross-file union pass can append them and map its findings back to a file
460
465
  * and an entry index.
461
466
  */
462
- function validateOneFile(file, mention) {
467
+ function validateOneFile(file, mention, source, misbehavior = false, extendedResponsesTools = false) {
463
468
  const report = {
464
469
  file,
465
470
  mention,
@@ -471,6 +476,7 @@ function validateOneFile(file, mention) {
471
476
  const sourceIndex = [];
472
477
  const runErrors = [];
473
478
  const identities = [];
479
+ const mcpFakes = [];
474
480
  let raw;
475
481
  try {
476
482
  raw = readFileSync(file, "utf-8");
@@ -481,7 +487,8 @@ function validateOneFile(file, mention) {
481
487
  fixtures,
482
488
  indices: sourceIndex,
483
489
  identities,
484
- runErrors
490
+ runErrors,
491
+ mcpFakes
485
492
  };
486
493
  }
487
494
  let parsed;
@@ -494,20 +501,48 @@ function validateOneFile(file, mention) {
494
501
  fixtures,
495
502
  indices: sourceIndex,
496
503
  identities,
497
- runErrors
504
+ runErrors,
505
+ mcpFakes
498
506
  };
499
507
  }
500
- if (typeof parsed !== "object" || parsed === null || !Array.isArray(parsed.fixtures)) {
508
+ const fakesDoc = hasMcpFakesKey(parsed) ? parsed : void 0;
509
+ const fixturesLeftOut = fakesDoc !== void 0 && !Object.prototype.hasOwnProperty.call(fakesDoc, "fixtures");
510
+ const badShape = !fixturesLeftOut && (typeof parsed !== "object" || parsed === null || !Array.isArray(parsed.fixtures));
511
+ if (badShape) {
501
512
  const asConfig = aimockConfigDescription(parsed);
502
513
  setFatal(report, asConfig === void 0 ? "Missing or invalid \"fixtures\" array (expected { \"fixtures\": [...] })" : `Missing or invalid "fixtures" array (expected { "fixtures": [...] }) — this is ${asConfig}`);
503
- return {
504
- report,
505
- fixtures,
506
- indices: sourceIndex,
507
- identities,
508
- runErrors
509
- };
510
514
  }
515
+ if (fakesDoc !== void 0) {
516
+ const fakes = fakesDoc.mcpFakes;
517
+ const validation = validateMcpFakes(fakes, source);
518
+ report.errors.push(...validation.errors.map(loadErrorFinding));
519
+ report.mcpFakeBlocks = 0;
520
+ const recorded = fakesDoc._warnings;
521
+ if (Array.isArray(recorded)) {
522
+ for (const w of recorded) if (typeof w === "string") report.warnings.push({ message: w });
523
+ }
524
+ if (validation.errors.length > 0) report.warnings.push(...validation.warnings.map(issueFinding));
525
+ else if (Array.isArray(fakes)) fakes.forEach((block, blockIndex) => {
526
+ mcpFakes.push({
527
+ source,
528
+ blockIndex,
529
+ raw: block
530
+ });
531
+ });
532
+ else mcpFakes.push({
533
+ source,
534
+ blockIndex: null,
535
+ raw: fakes
536
+ });
537
+ }
538
+ if (fixturesLeftOut || badShape) return {
539
+ report,
540
+ fixtures,
541
+ indices: sourceIndex,
542
+ identities,
543
+ runErrors,
544
+ mcpFakes
545
+ };
511
546
  let entryIndex = 0;
512
547
  const entryLogger = new CollectingLogger((message) => report.warnings.push({
513
548
  index: entryIndex,
@@ -533,10 +568,19 @@ function validateOneFile(file, mention) {
533
568
  report.warnings.push(finding);
534
569
  }
535
570
  try {
536
- fixtures.push(entryToFixture(entries[index], entryLogger));
571
+ const fixture = entryToFixture(entries[index], entryLogger, void 0, {
572
+ file: source,
573
+ index
574
+ });
575
+ if (misbehavior) enableHeldFixtureMisbehavior(fixture);
576
+ if (extendedResponsesTools) markFixtureResponsesToolsExtended(fixture);
577
+ fixtures.push(fixture);
537
578
  sourceIndex.push(index);
538
579
  } catch (err) {
539
- report.errors.push(unexpectedEntryFailure(index, err));
580
+ report.errors.push(err instanceof MisbehaviorConfigError ? {
581
+ index,
582
+ message: err.message
583
+ } : unexpectedEntryFailure(index, err));
540
584
  }
541
585
  }
542
586
  report.fixtures = fixtures.length;
@@ -576,10 +620,22 @@ function validateOneFile(file, mention) {
576
620
  fixtures,
577
621
  indices: sourceIndex,
578
622
  identities,
579
- runErrors
623
+ runErrors,
624
+ mcpFakes
580
625
  };
581
626
  }
582
627
  /**
628
+ * A `FixtureLoadError` from an `mcpFakes` block as a file-level finding (no
629
+ * fixture entry index): its message names the rule, file, block and entry.
630
+ */
631
+ function loadErrorFinding(err) {
632
+ return { message: err.message };
633
+ }
634
+ /** An L8 shadowed-entry warning as a file-level finding. */
635
+ function issueFinding(issue) {
636
+ return { message: issue.message };
637
+ }
638
+ /**
583
639
  * `#<index> ` for a finding that belongs to one entry; empty for a file-level
584
640
  * finding, which names no entry (see Finding.index). Shared by the human lines
585
641
  * and the failure summary so a reader of either can locate the same entry.
@@ -654,6 +710,7 @@ function runValidateCli(deps = {}) {
654
710
  files: [],
655
711
  run: {
656
712
  fixtures: 0,
713
+ mcpFakeBlocks: 0,
657
714
  errors: [message]
658
715
  }
659
716
  }, null, 2));
@@ -673,6 +730,11 @@ function runValidateCli(deps = {}) {
673
730
  type: "boolean",
674
731
  default: false
675
732
  },
733
+ misbehavior: {
734
+ type: "boolean",
735
+ default: false
736
+ },
737
+ "responses-tools": { type: "string" },
676
738
  help: {
677
739
  type: "boolean",
678
740
  short: "h",
@@ -695,6 +757,13 @@ function runValidateCli(deps = {}) {
695
757
  }
696
758
  const strict = values.strict === true;
697
759
  const json = values.json === true;
760
+ const misbehavior = values.misbehavior === true;
761
+ const responsesTools = values["responses-tools"];
762
+ if (responsesTools !== void 0 && responsesTools !== "legacy" && responsesTools !== "extended") {
763
+ usageError(`invalid --responses-tools "${responsesTools}" (expected "legacy" or "extended").`);
764
+ return;
765
+ }
766
+ const extendedResponsesTools = responsesTools === "extended";
698
767
  if (paths.length === 0) {
699
768
  usageError("no fixture paths given.");
700
769
  return;
@@ -735,7 +804,10 @@ function runValidateCli(deps = {}) {
735
804
  });
736
805
  continue;
737
806
  }
738
- targets.push(...entries);
807
+ for (const entry of entries) targets.push({
808
+ ...entry,
809
+ source: relative(path, entry.file).split(sep).join("/")
810
+ });
739
811
  }
740
812
  const mentionKey = (file) => resolve(file);
741
813
  const mentionCount = /* @__PURE__ */ new Map();
@@ -761,6 +833,8 @@ function runValidateCli(deps = {}) {
761
833
  const reportedBySite = /* @__PURE__ */ new Map();
762
834
  const fileIds = /* @__PURE__ */ new Map();
763
835
  const runErrors = [];
836
+ const fakeStore = new McpFakeStore();
837
+ let mcpFakeBlocks = 0;
764
838
  const siteKey = (fileId, index, severity, kind) => [
765
839
  fileId,
766
840
  index,
@@ -788,12 +862,24 @@ function runValidateCli(deps = {}) {
788
862
  let indices = [];
789
863
  let identities = [];
790
864
  let fileRunErrors = [];
865
+ let mcpFakes = [];
791
866
  const mention = nextMention(target.file);
792
867
  try {
793
- ({report, fixtures, indices, identities, runErrors: fileRunErrors} = validateOneFile(target.file, mention));
868
+ ({report, fixtures, indices, identities, runErrors: fileRunErrors, mcpFakes} = validateOneFile(target.file, mention, target.source ?? target.file, misbehavior, extendedResponsesTools));
794
869
  } catch (err) {
795
870
  report = fatalReport(target.file, mention, `Validation failed: ${errText(err)}`);
796
871
  }
872
+ if (mcpFakes.length > 0) try {
873
+ const added = fakeStore.add(mcpFakes, { kind: "file" });
874
+ report.mcpFakeBlocks = mcpFakes.length;
875
+ mcpFakeBlocks += mcpFakes.length;
876
+ report.warnings.push(...added.warnings.map(issueFinding));
877
+ } catch (err) {
878
+ if (err instanceof McpFakesAddError) {
879
+ report.errors.push(...err.errors.map(loadErrorFinding));
880
+ report.warnings.push(...err.warnings.map(issueFinding));
881
+ } else report.errors.push({ message: build(msg`mcpFakes check failed: ${plainText(errText(err), Infinity)}`) });
882
+ }
797
883
  reports.push(report);
798
884
  runErrors.push(...fileRunErrors.map((e) => `${displayName(report)}: ${e}`));
799
885
  const fileId = fileIds.size;
@@ -820,7 +906,7 @@ function runValidateCli(deps = {}) {
820
906
  let noFixturesLoaded = false;
821
907
  const causeAlreadyReported = reports.some((r) => r.fatal !== void 0 || r.errors.length > 0);
822
908
  if (union.length === 0) {
823
- if (!causeAlreadyReported) {
909
+ if (!causeAlreadyReported && mcpFakeBlocks === 0) {
824
910
  runErrors.push("No fixtures loaded from any input — the server aborts startup on this under --validate-on-load/--strict");
825
911
  noFixturesLoaded = true;
826
912
  }
@@ -885,6 +971,7 @@ function runValidateCli(deps = {}) {
885
971
  files: reports,
886
972
  run: {
887
973
  fixtures: union.length,
974
+ mcpFakeBlocks,
888
975
  errors: runErrors
889
976
  }
890
977
  }, null, 2));
@@ -908,11 +995,14 @@ function runValidateCli(deps = {}) {
908
995
  logWarning(`${name}: [warning] ${at(w)}${w.message}`);
909
996
  emitDetail(w, logWarning);
910
997
  }
911
- if (r.errors.length === 0 && r.warnings.length === 0) if (r.fixtures === 0 && failed) {
912
- const why = noFixturesLoaded ? "see the run-level error" : "the run failed elsewhere";
913
- log(`${name}: ${r.fixtures} fixture(s), loaded nothing — ${why}`);
914
- } else log(`${name}: OK (${r.fixtures} fixture(s))`);
915
- else log(`${name}: ${r.fixtures} fixture(s), ${r.errors.length} error(s), ${r.warnings.length} warning(s)`);
998
+ if (r.errors.length === 0 && r.warnings.length === 0) {
999
+ const blocks = r.mcpFakeBlocks ?? 0;
1000
+ if (r.fixtures === 0 && blocks === 0 && failed) {
1001
+ const why = noFixturesLoaded ? "see the run-level error" : "the run failed elsewhere";
1002
+ log(`${name}: ${r.fixtures} fixture(s), loaded nothing — ${why}`);
1003
+ } else if (blocks > 0) log(build(msg`${plainText(name, Infinity)}: OK (${r.fixtures} fixture(s), ${blocks} mcpFakes block(s))`));
1004
+ else log(`${name}: OK (${r.fixtures} fixture(s))`);
1005
+ } else log(`${name}: ${r.fixtures} fixture(s), ${r.errors.length} error(s), ${r.warnings.length} warning(s)`);
916
1006
  }
917
1007
  for (const e of runErrors) logError(`[error] ${e}`);
918
1008
  }