@copilotkit/aimock 1.14.5 → 1.14.6

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 (128) hide show
  1. package/CHANGELOG.md +376 -0
  2. package/README.md +24 -14
  3. package/dist/_virtual/_rolldown/runtime.cjs +0 -2
  4. package/dist/config-loader.d.cts.map +1 -1
  5. package/dist/config-loader.d.ts.map +1 -1
  6. package/dist/vitest.cjs +4 -4
  7. package/dist/vitest.cjs.map +1 -1
  8. package/dist/vitest.js +1 -1
  9. package/package.json +31 -12
  10. package/dist/_virtual/_rolldown/runtime.js +0 -29
  11. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs +0 -934
  12. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.cjs.map +0 -1
  13. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +0 -934
  14. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js.map +0 -1
  15. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs +0 -1051
  16. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs.map +0 -1
  17. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +0 -1042
  18. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js.map +0 -1
  19. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.cjs +0 -1
  20. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.js +0 -3
  21. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +0 -96
  22. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs.map +0 -1
  23. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +0 -93
  24. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +0 -1
  25. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs +0 -49
  26. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.cjs.map +0 -1
  27. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js +0 -43
  28. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js.map +0 -1
  29. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs +0 -456
  30. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.cjs.map +0 -1
  31. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +0 -456
  32. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js.map +0 -1
  33. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs +0 -170
  34. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.cjs.map +0 -1
  35. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js +0 -169
  36. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js.map +0 -1
  37. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs +0 -388
  38. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.cjs.map +0 -1
  39. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +0 -385
  40. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js.map +0 -1
  41. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs +0 -12
  42. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.cjs.map +0 -1
  43. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +0 -12
  44. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +0 -1
  45. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs +0 -17
  46. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.cjs.map +0 -1
  47. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +0 -17
  48. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +0 -1
  49. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs +0 -12
  50. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.cjs.map +0 -1
  51. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +0 -12
  52. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +0 -1
  53. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs +0 -16
  54. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.cjs.map +0 -1
  55. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +0 -16
  56. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +0 -1
  57. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs +0 -14
  58. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.cjs.map +0 -1
  59. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +0 -14
  60. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +0 -1
  61. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs +0 -35
  62. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.cjs.map +0 -1
  63. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +0 -35
  64. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +0 -1
  65. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs +0 -13
  66. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.cjs.map +0 -1
  67. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +0 -13
  68. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +0 -1
  69. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs +0 -128
  70. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.cjs.map +0 -1
  71. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +0 -123
  72. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +0 -1
  73. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs +0 -41
  74. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.cjs.map +0 -1
  75. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +0 -40
  76. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +0 -1
  77. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs +0 -100
  78. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.cjs.map +0 -1
  79. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +0 -100
  80. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +0 -1
  81. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs +0 -26
  82. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.cjs.map +0 -1
  83. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +0 -26
  84. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +0 -1
  85. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs +0 -15
  86. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.cjs.map +0 -1
  87. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +0 -15
  88. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +0 -1
  89. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs +0 -22
  90. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.cjs.map +0 -1
  91. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +0 -22
  92. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +0 -1
  93. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs +0 -7
  94. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.cjs.map +0 -1
  95. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +0 -6
  96. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +0 -1
  97. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs +0 -13
  98. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.cjs.map +0 -1
  99. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +0 -13
  100. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +0 -1
  101. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs +0 -19
  102. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.cjs.map +0 -1
  103. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +0 -19
  104. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +0 -1
  105. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs +0 -26
  106. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.cjs.map +0 -1
  107. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +0 -26
  108. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +0 -1
  109. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs +0 -10
  110. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.cjs.map +0 -1
  111. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +0 -9
  112. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +0 -1
  113. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs +0 -31
  114. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.cjs.map +0 -1
  115. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +0 -31
  116. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +0 -1
  117. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs +0 -52
  118. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.cjs.map +0 -1
  119. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js +0 -52
  120. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js.map +0 -1
  121. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs +0 -83
  122. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.cjs.map +0 -1
  123. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +0 -82
  124. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +0 -1
  125. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs +0 -10
  126. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.cjs.map +0 -1
  127. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +0 -10
  128. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,376 @@
1
+ # @copilotkit/aimock
2
+
3
+ ## 1.14.6
4
+
5
+ ### Changed
6
+
7
+ - README DevX: Quick Start sets `OPENAI_BASE_URL` + `OPENAI_API_KEY` before SDK construction with an inline ordering warning; Docker one-liner uses absolute `$(pwd)/fixtures:/fixtures` path; `LLMock` class name asymmetry after the v1.7.0 package rename is explained inline; Multimedia and Protocol-Mock feature bullets now link to each individual feature page.
8
+ - Fixtures page: Vertex AI added to Provider Support Matrix; Ollama Reasoning marked as supported (was incorrectly "—" since v1.8.0); `finishReason` Responses-API mapping fully documented; `toolName` scope clarified; shadowing-warning format matches actual validator output; Azure-inherits-OpenAI override support footnoted.
9
+ - Record & Replay page: Docker examples use absolute `$(pwd)` paths; Rust `async-openai` example corrected to `Client::with_config(OpenAIConfig::new().with_api_base(...))` form; `enableRecording({ proxyOnly: true })` disambiguated; pseudocode annotated as simplified; `enableRecording` example includes `mock.stop()` cleanup; stale 2025 timestamp replaced with generic placeholder.
10
+ - Sidebar: TOC id-assignment now runs unconditionally (previously skipped on pages with fewer than 4 headings, silently breaking cross-page anchor links to short pages).
11
+ - Historical CHANGELOG: v1.14.1 Railway-specific language scrubbed; v1.14.2 `--journal-max=-1` rejection and `createServer()` default flip annotated with BREAKING / BEHAVIOR CHANGE markers; all 15 historical version entries standardized on Keep-a-Changelog categories (Added/Changed/Fixed/Removed) instead of mixed Changesets-style.
12
+ - package.json: `engines.node` raised to `>=24.0.0` to match OIDC publish requirement; `preinstall: only-allow pnpm` guard added; deprecated `@google/generative-ai` swapped for `@google/genai`; `files` includes `CHANGELOG.md`; `repository.url` canonicalized; `typesVersions` gains `.d.cts` entries; optional `peerDependencies` for `vitest`/`jest` added; `prepare: husky || true` tightened to `husky`; `release` script gains `pnpm test && pnpm lint` pre-check.
13
+
14
+ ### Removed
15
+
16
+ - Stray `package-lock.json` — repo is pnpm-only, now enforced via `preinstall`.
17
+
18
+ ## 1.14.5
19
+
20
+ ### Fixed
21
+
22
+ - Recorder no longer buffers SSE (`text/event-stream`) upstream responses before relaying to the client. `proxyAndRecord` accumulated all upstream chunks and replayed them via a single `res.end()`, collapsing multi-frame streams into one client-visible write and breaking progressive rendering for downstream consumers (notably showcase `--proxy-only` deployments). SSE responses now stream chunk-by-chunk to the client while still being tee'd into the recording buffer; non-SSE behavior is unchanged.
23
+
24
+ ## 1.14.4
25
+
26
+ ### Added
27
+
28
+ - Multi-turn conversations documentation page covering the tool-round idiom, matching semantics across turns, and how to author/record multi-turn fixtures.
29
+ - Matching Semantics section on the Fixtures page documenting last-message-only matching, first-wins file order, substring-vs-exact matching, and shadowing warnings.
30
+ - Recording guidance for multi-turn conversations on the Record & Replay page.
31
+ - CLI Flags table on the Record & Replay page expanded to cover `-f/--fixtures`, `--journal-max`, `--fixture-counts-max`, `--agui-*`, `--chaos-*`, `--watch`, `-p`, `-h`, `--log-level`, `--validate-on-load`.
32
+ - README note clarifying that the `llmock` CLI bin is a legacy alias pointing at a narrower flag-driven CLI without `--config` or `convert` support.
33
+
34
+ ### Fixed
35
+
36
+ - Docker examples in the Record & Replay guide no longer prefix `npx @copilotkit/aimock` before the image ENTRYPOINT (the four snippets would have failed with strict parseArgs rejecting positional args).
37
+ - Auth Header Forwarding documentation now reflects the strip-list behavior that has been in place since v1.6.1 (all headers forwarded except hop-by-hop and client-set).
38
+ - `requestTransform` example fixture key no longer carries an undocumented load-bearing trailing space.
39
+ - Completed the Claude model-id migration (v1.14.3) for the remaining test fixtures that still referenced `claude-sonnet-4-20250514`.
40
+ - README LLM Providers count and migration-page comparisons restored to the "11+" form with accurate enumeration (OpenAI Chat / Responses / Realtime, Claude, Gemini REST / Live WS, Azure, Bedrock, Vertex AI, Ollama, Cohere). The earlier "8" collapse was incorrect: competitors count endpoint/protocol variants separately, and "8" undersold aimock's actual coverage. Provider Support Matrix on the Fixtures page gains a dedicated Vertex AI column.
41
+ - Corrected `toolCallId` matching semantics on the Fixtures page to describe the "last `role: "tool"` message" rule from `router.ts` (not "last message being a tool").
42
+ - Added `-h 0.0.0.0` to every Docker example in the README and Record & Replay page so the default `127.0.0.1` host bind doesn't silently break `-p` port mapping when user args override the image CMD.
43
+ - Extended the Docker host-bind fix across all migration guides, tutorials, and the Docker/aimock-cli/metrics/chaos-testing pages — every Docker example that passes user args now includes `-h 0.0.0.0` so `docker -p` port mapping works.
44
+ - Updated `--journal-max` default wording on the Record & Replay page to reflect post-v1.14.2 behavior (finite `1000` cap for both `serve` and `createServer()`; only direct `new Journal()` instantiation remains unbounded).
45
+ - Stripped redundant `npx @copilotkit/aimock` / `aimock` prefixes from Docker examples in migration pages (mokksy, vidaimock, mock-llm, piyook, openai-responses); all were silently broken under strict parseArgs because the prefix became a positional arg to the image's `node dist/cli.js` entrypoint.
46
+ - Replaced `--config` Docker examples across `docs/aimock-cli`, `docs/metrics`, `docs/chaos-testing`, and migration guides with flag-driven Docker equivalents or explicit npx/local-install notes (the published image's ENTRYPOINT runs the `llmock` CLI which does not support `--config`).
47
+ - Synchronized LLM provider counts across all migration pages to the "11+" form with accurate variant-level enumeration, restoring competitor-equivalent counting (e.g. VidaiMock "11+", Mokksy "11 vs 5").
48
+ - Corrected the `sequenceIndex` gotcha on `/multi-turn` — `validateFixtures` does not factor `sequenceIndex`, `toolCallId`, `model`, or `predicate` into the duplicate-`userMessage` warning; the warning is advisory when a runtime differentiator is present.
49
+ - Fixed the Programmatic Recording example on `/record-replay` to stop contradicting itself by pairing `proxyOnly: true` with `fixturePath`; now shows record mode and proxy-only mode as two distinct examples.
50
+ - Reconciled provider-count phrasing across migration pages — mock-llm lead paragraph no longer says "9 more providers", enumerated lists no longer trail the count with "and OpenAI-compatible providers" / "and more". Aligned the `validateFixtures` shadowing wording between the Fixtures and Multi-Turn pages (both now correctly describe the warning as advisory when a runtime differentiator is present).
51
+ - Replaced broken `class="cmt"` CSS class with correct `class="cm"` across `docs/cohere`, `docs/test-plugins`, `docs/vertex-ai`, `docs/ollama`, `docs/record-replay`, and `docs/chaos-testing` code blocks (21 occurrences) — `.cmt` is not defined in `docs/style.css`, so these code-block comments were rendering as default text instead of the dimmed comment color.
52
+
53
+ ## 1.14.3
54
+
55
+ ### Added
56
+
57
+ - Microsoft Agent Framework (MAF) integration guide with Python and .NET examples.
58
+ - Generic `.code-tabs` language switcher with cross-section sync and localStorage persistence.
59
+
60
+ ### Changed
61
+
62
+ - Updated Claude model references from `claude-sonnet-4-20250514` (retiring 2026-06-15) to `claude-sonnet-4-6`.
63
+
64
+ ## 1.14.2
65
+
66
+ > **BREAKING** — CLI flag parsing: `--journal-max=-1` (and `--fixture-counts-max=-1`) no longer silently maps to "unbounded"; it is now rejected with a clear error. Migration: drop the flag entirely, or pass `--journal-max=0` / `--fixture-counts-max=0` if you intended unbounded retention.
67
+ >
68
+ > **⚠ BEHAVIOR CHANGE (should have been MINOR per SemVer)** — `createServer()` programmatic defaults for `journalMaxEntries` and `fixtureCountsMaxTestIds` flipped from unbounded to finite caps (1000 / 500). Auto-update consumers on long-running embedders: review your retention assumptions and opt in to unbounded explicitly by passing `0` if that was the prior relied-upon behavior. Released as a PATCH; in retrospect this warranted a MINOR bump.
69
+
70
+ ### Fixed
71
+
72
+ - `Journal.getFixtureMatchCount()` is now read-only: calling it with an unknown testId no longer inserts an empty map or triggers FIFO eviction of a live testId. Reads never mutate cache state.
73
+ - CLI rejects negative values for `--journal-max` and `--fixture-counts-max` with a clear error (previously silently treated as unbounded). **Breaking for anyone passing `-1` expecting unbounded** — see note above.
74
+
75
+ ### Changed
76
+
77
+ - `createServer()` programmatic default: `journalMaxEntries` and `fixtureCountsMaxTestIds` now default to finite caps (1000 / 500) instead of unbounded. Long-running embedders that relied on unbounded retention must now opt in explicitly by passing `0`. Back-compat with test harnesses using `new Journal()` directly is preserved (they still default to unbounded). **Note:** this is a behavior change that in retrospect warranted a MINOR bump rather than PATCH.
78
+
79
+ ### Added
80
+
81
+ - New `--fixture-counts-max <n>` CLI flag (default 500) to cap the fixture-match-counts map by testId.
82
+
83
+ ## 1.14.1
84
+
85
+ ### Fixed
86
+
87
+ - Cap in-memory journal (and fixture-match-counts map) to prevent heap OOM under sustained load. `Journal.entries` was unbounded, causing heap growth ~3.8MB/sec to 4GB → OOM in ~18 minutes on long-running production deployments. Default cap for CLI (`serve`) is now 1000 entries; programmatic `createServer()` remains unbounded by default (back-compat). See `--journal-max` flag.
88
+
89
+ ## 1.14.0
90
+
91
+ ### Added
92
+
93
+ - Response template merging — override `id`, `created`, `model`, `usage`, `finishReason`, `role`, `systemFingerprint` on fixture responses across all 4 provider formats (OpenAI, Claude, Gemini, Responses API) (#111)
94
+ - JSON auto-stringify — fixture `arguments` and `content` fields accept objects that are auto-stringified by the loader, eliminating escaped JSON pain (#111)
95
+ - Migration guide from openai-responses-python (#111)
96
+ - All fixture examples and docs converted to object syntax (#111)
97
+ - `ResponseOverrides` field validation in `validateFixtures` — catches invalid types for `id`, `created`, `model`, `usage`, `finishReason`, `role`, `systemFingerprint`
98
+
99
+ ### Fixed
100
+
101
+ - `onTranscription` docs now show correct 1-argument signature
102
+ - `validateFixtures` now recognizes ContentWithToolCalls and multimedia response types
103
+
104
+ ## 1.13.0
105
+
106
+ ### Added
107
+
108
+ - GitHub Action for one-line CI setup — `uses: CopilotKit/aimock@v1` with fixtures, config, port, args, and health check (#102)
109
+ - Fixture converters wired into the CLI — `npx @copilotkit/aimock convert vidaimock` and `npx @copilotkit/aimock convert mockllm` as first-class subcommands (#102)
110
+ - 30 npm keywords for search discoverability (#102)
111
+ - Fixture gallery with 11 examples covering all mock types, plus browsable docs page at /examples (#102)
112
+ - Vitest and jest plugins for zero-config testing — `import { useAimock } from "@copilotkit/aimock/vitest"` (#102)
113
+
114
+ ### Changed
115
+
116
+ - Strip video URLs from README for npm publishing (#102)
117
+
118
+ ## 1.12.0
119
+
120
+ ### Added
121
+
122
+ - Multimedia endpoint support: image generation (OpenAI DALL-E + Gemini Imagen), text-to-speech, audio transcription, and video generation with async polling (#101)
123
+ - `match.endpoint` field for fixture isolation — prevents cross-matching between chat, image, speech, transcription, video, and embedding fixtures (#101)
124
+ - Bidirectional endpoint filtering — generic fixtures only match compatible endpoint types (#101)
125
+ - Convenience methods: `onImage`, `onSpeech`, `onTranscription`, `onVideo` (#101)
126
+ - Record & replay for all multimedia endpoints — proxy to real APIs, save fixtures with correct format/type detection (#101)
127
+ - `_endpointType` explicit field on `ChatCompletionRequest` for type safety (#101)
128
+ - Comparison matrix and drift detection rules updated for multimedia (#101)
129
+ - 54 new tests (32 integration, 11 record/replay, 12 type/routing)
130
+
131
+ ## 1.11.0
132
+
133
+ ### Added
134
+
135
+ - `AGUIMock` — mock the AG-UI (Agent-to-UI) protocol for CopilotKit frontend testing. All 33 event types, 11 convenience builders, fluent registration API, SSE streaming with disconnect handling (#100)
136
+ - AG-UI record & replay with tee streaming — proxy to real AG-UI agents, record event streams as fixtures, replay on subsequent requests. Includes `--proxy-only` mode for demos (#100)
137
+ - AG-UI schema drift detection — compares aimock event types against canonical `@ag-ui/core` Zod schemas to catch protocol changes (#100)
138
+ - `--agui-record`, `--agui-upstream`, `--agui-proxy-only` CLI flags (#100)
139
+
140
+ ### Removed
141
+
142
+ - Section bar from docs pages (cleanup)
143
+
144
+ ## 1.10.0
145
+
146
+ ### Added
147
+
148
+ - `--proxy-only` flag — proxy unmatched requests to upstream providers without saving fixtures to disk or caching in memory. Every unmatched request always hits the real provider, preventing stale recorded responses in demo/live environments (#99)
149
+
150
+ ## 1.9.0
151
+
152
+ ### Added
153
+
154
+ - Per-test sequence isolation via `X-Test-Id` header — each test gets its own fixture match counters, wired through all 12 HTTP handlers and 3 WebSocket handlers. No more test pollution from shared sequential state (#93)
155
+ - Combined `content + toolCalls` in fixture responses — new `ContentWithToolCallsResponse` type and type guard, supported across OpenAI Chat, OpenAI Responses, Anthropic Messages, and Gemini, with stream collapse support (#92)
156
+ - OpenRouter `reasoning_content` support in chat completions (#88)
157
+ - Demo video in README (#91)
158
+ - CI: Slack notifications for drift tests, competitive matrix updates, and new PRs (#86)
159
+ - Docs: reasoning and webSearches rows in Response Types table
160
+
161
+ ### Fixed
162
+
163
+ - `web_search_call` items now use `action.query` matching real OpenAI API format (#89)
164
+ - Homepage URL cleaned up (remove `/index.html` suffix) (#90)
165
+ - Record & Replay section title now centered and terminal panel top-aligned (#87)
166
+ - CI: use `pull_request_target` for fork PR Slack alerts
167
+
168
+ ## 1.8.0
169
+
170
+ ### Added
171
+
172
+ - `requestTransform` option for deterministic matching and recording — normalizes requests before matching (strips timestamps, UUIDs, session IDs) and switches to exact equality when set. Applied across all 15 provider handlers and the recorder. (#79, based on design by @iskhakovt in #63)
173
+ - Reasoning/thinking support for OpenAI Chat Completions — `reasoning` field in fixtures generates `reasoning_content` in responses and streaming `reasoning` deltas (#62 by @erezcor)
174
+ - Reasoning support for Gemini (`thoughtParts`), AWS Bedrock InvokeModel + Converse (`thinking` blocks), and Ollama (`think` tags) (#81)
175
+ - Web search result events for OpenAI Responses API (#62)
176
+ - Open Graph image and meta tags for social sharing
177
+ - CI: `npm` environment to release workflow for deployment tracking; `workflow_dispatch` added to Python test workflow
178
+
179
+ ### Changed
180
+
181
+ - Updated all GitHub repo URLs from CopilotKit/llmock to CopilotKit/aimock
182
+ - Reframed drift detection docs for users ("your mocks never go stale") with restored drift report output
183
+
184
+ ### Fixed
185
+
186
+ - Migration page examples: replaced fragile `time.sleep` with health check loops against `/__aimock/health`; fixed Python npx example `stderr=subprocess.PIPE` deadlock (#80)
187
+ - Stream collapse now handles reasoning events correctly
188
+
189
+ ## 1.7.0
190
+
191
+ ### Added
192
+
193
+ - MCPMock — Model Context Protocol mock with tools, resources, prompts, session management
194
+ - A2AMock — Agent-to-Agent protocol mock with SSE streaming
195
+ - VectorMock — Pinecone, Qdrant, ChromaDB compatible vector DB mock
196
+ - Search (Tavily), rerank (Cohere), and moderation (OpenAI) service mocks
197
+ - `/__aimock/*` control API for external fixture management
198
+ - `aimock` CLI with JSON config file support
199
+ - Mount composition for running multiple protocol handlers on one server
200
+ - JSON-RPC 2.0 transport with batch and notifications
201
+ - `aimock-pytest` pip package for native Python testing
202
+ - Converter scripts: `convert-vidaimock` (Tera → JSON) and `convert-mockllm` (YAML → JSON)
203
+ - Drift automation skill updates — `fix-drift.ts` now updates `skills/write-fixtures/SKILL.md` alongside source fixes
204
+ - Docker: dual-push `ghcr.io/copilotkit/aimock` + `ghcr.io/copilotkit/llmock` (compat)
205
+ - 6 migration guides: MSW, VidaiMock, mock-llm, piyook, Python mocks, Mokksy
206
+ - Docs: sidebar.js, cli-tabs.js, section bar, competitive matrix with 25 rows
207
+
208
+ ### Changed
209
+
210
+ - Renamed package from `@copilotkit/llmock` to `@copilotkit/aimock`
211
+ - Renamed Prometheus metrics to `aimock_*` with new MCP/A2A/Vector counters
212
+ - Rebranded logger `[aimock]`, chaos headers `x-aimock-chaos-*`, CLI startup message
213
+ - Helm chart renamed to `charts/aimock/`
214
+ - Homepage redesigned (Treatment 3: Progressive Disclosure)
215
+
216
+ ## 1.6.1
217
+
218
+ ### Fixed
219
+
220
+ - Record proxy now preserves upstream URL path prefixes — base URLs like `https://gateway.company.com/llm` now correctly resolve to `gateway.company.com/llm/v1/chat/completions` instead of losing the `/llm` prefix (PR #57)
221
+ - Record proxy now forwards all request headers to upstream, not just `Content-Type` and auth headers. Hop-by-hop headers (`connection`, `keep-alive`, `transfer-encoding`, etc.) and client-set headers (`host`, `content-length`, `cookie`, `accept-encoding`) are still stripped (PR #58)
222
+ - Recorder now decodes base64-encoded embeddings when `encoding_format: "base64"` is set in the request. Python's openai SDK uses this by default. Previously these were saved as `proxy_error` fixtures (PR #64)
223
+ - Guarded base64 embedding decode against corrupted data (non-float32-aligned buffers fall through gracefully instead of crashing)
224
+
225
+ ### Added
226
+
227
+ - `--summary` flag on the competitive matrix update script for markdown-formatted change summaries
228
+
229
+ ## 1.6.0
230
+
231
+ ### Added
232
+
233
+ - Provider-specific endpoints: dedicated routes for Bedrock (`/model/{modelId}/invoke`), Ollama (`/api/chat`, `/api/generate`), Cohere (`/v2/chat`), and Azure OpenAI deployment-based routing (`/openai/deployments/{id}/chat/completions`)
234
+ - Chaos injection: `ChaosConfig` type with `drop`, `malformed`, and `disconnect` actions; supports per-fixture chaos via `chaos` config on each fixture and server-wide chaos via `--chaos-drop`, `--chaos-malformed`, and `--chaos-disconnect` CLI flags
235
+ - Metrics: `GET /metrics` endpoint exposing Prometheus text format with request counters and latency histograms per provider and route
236
+ - Record-and-replay: `--record` flag and `proxyAndRecord` helper that proxies requests to real LLM APIs, collapses streaming responses, and writes fixture JSON to disk for future playback
237
+
238
+ ## 1.5.1
239
+
240
+ ### Fixed
241
+
242
+ - Documentation URLs now use the correct domain (llmock.copilotkit.dev)
243
+
244
+ ## 1.5.0
245
+
246
+ ### Added
247
+
248
+ - Embeddings API: `POST /v1/embeddings` endpoint, `onEmbedding()` convenience method, `inputText` match field, `EmbeddingResponse` type, deterministic fallback embeddings from input hash, Azure embedding routing
249
+ - Structured output / JSON mode: `responseFormat` match field, `onJsonOutput()` convenience method
250
+ - Sequential responses: `sequenceIndex` match field for stateful multi-turn fixtures, per-fixture-group match counting, `resetMatchCounts()` method
251
+ - Streaming physics: `StreamingProfile` type with `ttft`, `tps`, `jitter` fields for realistic timing simulation
252
+ - AWS Bedrock: `POST /model/{modelId}/invoke` endpoint, Anthropic Messages format translation
253
+ - Azure OpenAI: provider routing for `/openai/deployments/{id}/chat/completions` and `/openai/deployments/{id}/embeddings`
254
+ - Health & models endpoints: `GET /health`, `GET /ready`, `GET /v1/models` (auto-populated from fixtures)
255
+ - Docker & Helm: Dockerfile, Helm chart for Kubernetes deployment
256
+ - Documentation website: full docs site at llmock.copilotkit.dev with feature pages and competitive comparison matrix
257
+ - Automated drift remediation: `scripts/drift-report-collector.ts` and `scripts/fix-drift.ts` for CI-driven drift fixes
258
+ - CI automation: competitive matrix update workflow, drift fix workflow
259
+ - `FixtureOpts` and `EmbeddingFixtureOpts` type aliases exported for external consumers
260
+ - `.worktrees/` to eslint ignores
261
+
262
+ ### Changed
263
+
264
+ - Default to non-streaming for Claude Messages API and Responses API (matching real API defaults)
265
+ - README rewritten as concise overview with links to docs site
266
+ - Write-fixtures skill updated for all v1.5.0 features
267
+ - Docs site: Get Started links to docs, comparison above reliability, npm version badge
268
+
269
+ ### Fixed
270
+
271
+ - Gemini Live handler no longer crashes on malformed `clientContent.turns` and `toolResponse.functionResponses`
272
+ - Added `isClosed` guard before WebSocket finalization events (prevents writes to closed connections)
273
+ - `streamingProfile` now present on convenience method opts types (`on`, `onMessage`, etc.)
274
+ - skills/ symlink direction corrected so `npm pack` includes the write-fixtures skill
275
+ - `.claude` removed from package.json files (was dead weight — symlink doesn't ship)
276
+ - Watcher cleanup on error (clear debounce timer, null guard)
277
+ - Empty-reload guard (keep previous fixtures when reload produces 0)
278
+
279
+ ### Removed
280
+
281
+ - Dead `@keyframes sseLine` CSS from docs site
282
+
283
+ ## 1.4.0
284
+
285
+ ### Added
286
+
287
+ - `--watch` (`-w`): File-watching with 500ms debounced reload. Keeps previous fixtures on validation failure.
288
+ - `--log-level`: Configurable log verbosity (`silent`, `info`, `debug`). Default `info` for CLI, `silent` for programmatic API.
289
+ - `--validate-on-load`: Fixture schema validation at startup — checks response types, tool call JSON, numeric ranges, shadowing, and catch-all positioning.
290
+ - `validateFixtures()` exported for programmatic use
291
+ - `Logger` class exported for programmatic use
292
+
293
+ ## 1.3.3
294
+
295
+ ### Added
296
+
297
+ - WebSocket drift detection tests: TLS client for real provider WS endpoints, 4 verified drift tests (Responses WS + Realtime), Gemini Live canary for text-capable model availability
298
+ - Realtime model canary: detects when `gpt-4o-mini-realtime-preview` is deprecated and suggests GA replacement
299
+ - Gemini Live documented as unverified (no text-capable `bidiGenerateContent` model exists yet)
300
+
301
+ ### Fixed
302
+
303
+ - Responses WS handler now accepts flat `response.create` format matching the real OpenAI API (previously required a non-standard nested `response: { ... }` envelope)
304
+ - README Gemini Live response shape example corrected (`modelTurn.parts`, not `modelTurnComplete`)
305
+
306
+ ## 1.3.2
307
+
308
+ ### Added
309
+
310
+ - Live API drift detection test suite: three-layer triangulation between SDK types, real API responses, and llmock output across OpenAI (Chat + Responses), Anthropic Claude, and Google Gemini
311
+ - Weekly CI workflow for automated drift checks
312
+ - `DRIFT.md` documentation for the drift detection system
313
+
314
+ ### Fixed
315
+
316
+ - Missing `refusal` field on OpenAI Chat Completions responses — both the SDK and real API return `refusal: null` on non-refusal messages, but llmock was omitting it
317
+
318
+ ## 1.3.1
319
+
320
+ ### Added
321
+
322
+ - Claude Code fixture authoring skill (`/write-fixtures`) — comprehensive guide for match fields, response types, agent loop patterns, gotchas, and debugging
323
+ - Claude Code plugin structure for downstream consumers (`--plugin-dir`, `--add-dir`, or manual copy)
324
+
325
+ ### Changed
326
+
327
+ - README and docs site updated with Claude Code integration instructions
328
+
329
+ ## 1.3.0
330
+
331
+ ### Added
332
+
333
+ - Mid-stream interruption: `truncateAfterChunks` and `disconnectAfterMs` fixture fields to simulate abrupt server disconnects
334
+ - AbortSignal-based cancellation primitives (`createInterruptionSignal`, signal-aware `delay()`)
335
+ - Backward-compatible `writeSSEStream` overload with `StreamOptions` returning completion status
336
+ - Interruption support across all HTTP SSE and WebSocket streaming paths
337
+ - `destroy()` method on `WebSocketConnection` for abrupt disconnect simulation
338
+ - Journal records `interrupted` and `interruptReason` on interrupted streams
339
+ - LLMock convenience API extended with interruption options (`truncateAfterChunks`, `disconnectAfterMs`)
340
+
341
+ ## 1.2.0
342
+
343
+ ### Added
344
+
345
+ - Zero-dependency RFC 6455 WebSocket framing layer
346
+ - OpenAI Responses API over WebSocket (`/v1/responses`)
347
+ - OpenAI Realtime API over WebSocket (`/v1/realtime`) — text + tool calls
348
+ - Gemini Live BidiGenerateContent over WebSocket — text + tool calls
349
+ - Future Direction section in README
350
+
351
+ ### Fixed
352
+
353
+ - WebSocket close-frame lifecycle
354
+ - Improved error visibility across WebSocket handlers
355
+
356
+ ## 1.1.1
357
+
358
+ ### Added
359
+
360
+ - Function call IDs on Gemini tool call responses
361
+
362
+ ### Removed
363
+
364
+ - Changesets (simplified release workflow)
365
+
366
+ ## 1.1.0
367
+
368
+ ### Added
369
+
370
+ - 9948a8b: `prependFixture()` and `getFixtures()` public API methods
371
+
372
+ ## 1.0.1
373
+
374
+ ### Added
375
+
376
+ - `getTextContent` for array-format message content handling
package/README.md CHANGED
@@ -10,13 +10,20 @@ npm install @copilotkit/aimock
10
10
  ```
11
11
 
12
12
  ```typescript
13
+ // The class is still named `LLMock` for back-compat after the v1.7.0 package
14
+ // rename from `@copilotkit/llmock` to `@copilotkit/aimock`.
13
15
  import { LLMock } from "@copilotkit/aimock";
14
16
 
15
17
  const mock = new LLMock({ port: 0 });
16
18
  mock.onMessage("hello", { content: "Hi there!" });
17
19
  await mock.start();
18
20
 
21
+ // Set env BEFORE importing/constructing the OpenAI (or other provider) client.
22
+ // Many SDKs cache the base URL at construction time — if the client is built
23
+ // before these are set, it will talk to the real API (surprise bills) instead
24
+ // of aimock.
19
25
  process.env.OPENAI_BASE_URL = `${mock.url}/v1`;
26
+ process.env.OPENAI_API_KEY = "mock"; // SDK requires a value, even when base URL is mocked
20
27
 
21
28
  // ... run your tests ...
22
29
 
@@ -27,23 +34,24 @@ await mock.stop();
27
34
 
28
35
  aimock mocks everything your AI app talks to:
29
36
 
30
- | Tool | What it mocks | Docs |
31
- | -------------- | ----------------------------------------------------------------- | --------------------------------------------------- |
32
- | **LLMock** | OpenAI, Claude, Gemini, Bedrock, Azure, Vertex AI, Ollama, Cohere | [Providers](https://aimock.copilotkit.dev/docs) |
33
- | **MCPMock** | MCP tools, resources, prompts with session management | [MCP](https://aimock.copilotkit.dev/mcp-mock) |
34
- | **A2AMock** | Agent-to-agent protocol with SSE streaming | [A2A](https://aimock.copilotkit.dev/a2a-mock) |
35
- | **AGUIMock** | AG-UI agent-to-UI event streams for frontend testing | [AG-UI](https://aimock.copilotkit.dev/agui-mock) |
36
- | **VectorMock** | Pinecone, Qdrant, ChromaDB compatible endpoints | [Vector](https://aimock.copilotkit.dev/vector-mock) |
37
- | **Services** | Tavily search, Cohere rerank, OpenAI moderation | [Services](https://aimock.copilotkit.dev/services) |
37
+ | Tool | What it mocks | Docs |
38
+ | -------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
39
+ | **LLMock** | OpenAI (Chat/Responses/Realtime), Claude, Gemini (REST/Live), Bedrock, Azure, Vertex AI, Ollama, Cohere | [Providers](https://aimock.copilotkit.dev/docs) |
40
+ | **MCPMock** | MCP tools, resources, prompts with session management | [MCP](https://aimock.copilotkit.dev/mcp-mock) |
41
+ | **A2AMock** | Agent-to-agent protocol with SSE streaming | [A2A](https://aimock.copilotkit.dev/a2a-mock) |
42
+ | **AGUIMock** | AG-UI agent-to-UI event streams for frontend testing | [AG-UI](https://aimock.copilotkit.dev/agui-mock) |
43
+ | **VectorMock** | Pinecone, Qdrant, ChromaDB compatible endpoints | [Vector](https://aimock.copilotkit.dev/vector-mock) |
44
+ | **Services** | Tavily search, Cohere rerank, OpenAI moderation | [Services](https://aimock.copilotkit.dev/services) |
38
45
 
39
46
  Run them all on one port with `npx @copilotkit/aimock --config aimock.json`, or use the programmatic API to compose exactly what you need.
40
47
 
41
48
  ## Features
42
49
 
43
50
  - **[Record & Replay](https://aimock.copilotkit.dev/record-replay)** — Proxy real APIs, save as fixtures, replay deterministically forever
44
- - **[11 LLM Providers](https://aimock.copilotkit.dev/docs)** — OpenAI, Claude, Gemini, Bedrock, Azure, Vertex AI, Ollama, Cohere full streaming support
45
- - **[Multimedia APIs](https://aimock.copilotkit.dev/images)** — Image generation (DALL-E, Imagen), text-to-speech, audio transcription, video generation
46
- - **[MCP / A2A / AG-UI / Vector](https://aimock.copilotkit.dev/mcp-mock)** Mock every protocol your AI agents use
51
+ - **[Multi-turn Conversations](https://aimock.copilotkit.dev/multi-turn)** — Record and replay multi-turn traces with tool rounds; match distinct turns via `toolCallId`, `sequenceIndex`, or custom predicates
52
+ - **[11 LLM Providers](https://aimock.copilotkit.dev/docs)** — OpenAI Chat, OpenAI Responses, OpenAI Realtime, Claude, Gemini, Gemini Live, Azure, Bedrock, Vertex AI, Ollama, Cohere — full streaming support
53
+ - **Multimedia APIs** [image generation](https://aimock.copilotkit.dev/images) (DALL-E, Imagen), [text-to-speech](https://aimock.copilotkit.dev/speech), [audio transcription](https://aimock.copilotkit.dev/transcription), [video generation](https://aimock.copilotkit.dev/video)
54
+ - **[MCP](https://aimock.copilotkit.dev/mcp-mock) / [A2A](https://aimock.copilotkit.dev/a2a-mock) / [AG-UI](https://aimock.copilotkit.dev/agui-mock) / [Vector](https://aimock.copilotkit.dev/vector-mock)** — Mock every protocol your AI agents use
47
55
  - **[Chaos Testing](https://aimock.copilotkit.dev/chaos-testing)** — 500 errors, malformed JSON, mid-stream disconnects at any probability
48
56
  - **[Drift Detection](https://aimock.copilotkit.dev/drift-detection)** — Daily CI validation against real APIs
49
57
  - **[Streaming Physics](https://aimock.copilotkit.dev/streaming-physics)** — Configurable `ttft`, `tps`, and `jitter`
@@ -72,22 +80,24 @@ See the [GitHub Action docs](https://aimock.copilotkit.dev/github-action) for al
72
80
 
73
81
  ```bash
74
82
  # LLM mocking only
75
- npx @copilotkit/aimock -p 4010 -f ./fixtures
83
+ npx -p @copilotkit/aimock llmock -p 4010 -f ./fixtures
76
84
 
77
85
  # Full suite from config
78
86
  npx @copilotkit/aimock --config aimock.json
79
87
 
80
88
  # Record mode: proxy to real APIs, save fixtures
81
- npx @copilotkit/aimock --record --provider-openai https://api.openai.com
89
+ npx -p @copilotkit/aimock llmock --record --provider-openai https://api.openai.com
82
90
 
83
91
  # Convert fixtures from other tools
84
92
  npx @copilotkit/aimock convert vidaimock ./templates/ ./fixtures/
85
93
  npx @copilotkit/aimock convert mockllm ./config.yaml ./fixtures/
86
94
 
87
95
  # Docker
88
- docker run -d -p 4010:4010 -v ./fixtures:/fixtures ghcr.io/copilotkit/aimock -f /fixtures
96
+ docker run -d -p 4010:4010 -v "$(pwd)/fixtures:/fixtures" ghcr.io/copilotkit/aimock -f /fixtures -h 0.0.0.0
89
97
  ```
90
98
 
99
+ > **Note on `llmock` vs `aimock` CLIs.** The `llmock` bin is retained as a compat alias for users of the pre-1.7.0 `@copilotkit/llmock` package. It runs a narrower flag-driven CLI without `--config` or the `convert` subcommand. New projects should use `aimock` (or `npx @copilotkit/aimock`) for full feature support.
100
+
91
101
  ## Framework Guides
92
102
 
93
103
  Test your AI agents with aimock — no API keys, no network calls: [LangChain](https://aimock.copilotkit.dev/integrate-langchain) · [CrewAI](https://aimock.copilotkit.dev/integrate-crewai) · [PydanticAI](https://aimock.copilotkit.dev/integrate-pydanticai) · [LlamaIndex](https://aimock.copilotkit.dev/integrate-llamaindex) · [Mastra](https://aimock.copilotkit.dev/integrate-mastra) · [Google ADK](https://aimock.copilotkit.dev/integrate-adk) · [Microsoft Agent Framework](https://aimock.copilotkit.dev/integrate-maf)
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
8
  var __copyProps = (to, from, except, desc) => {
10
9
  if (from && typeof from === "object" || typeof from === "function") {
11
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -27,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
26
 
28
27
  //#endregion
29
28
 
30
- exports.__commonJSMin = __commonJSMin;
31
29
  exports.__toESM = __toESM;
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.cts","names":[],"sources":["../src/config-loader.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAciB,aAAA,SAAsB;;AAAvC;AAIiB,UAAA,iBAAA,CAAiB;EASjB,GAAA,EAAA,MAAA;EAAgB,IAAA,EAAA,MAAA;UAEnB,CAAA,EAAA,MAAA;aAF2B,CAAA,EAAA,MAAA;EAAmB,IAAA,CAAA,EAAA,MAAA;EAM3C,IAAA,CAAA,EAAA,MAAS;;AAGhB,UATO,eAAA,SAAwB,mBAS/B,CAAA;QACI,CAAA,EAAA;IACF,QAAA,EATE,KASF,CAAA;MAAe,IAAA,EAAA,MAAA;MAGV,OAAA,EA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;IACS,IAAA,EAAA,MAAA;IAHqB,OAAA,EAAA,MAAA;EAAkB,CAAA;EAMzC,KAAA,CAAA,EAnBP,aAmBgB,EAEf;EAGM,SAAA,CAAA,EAvBH,iBAuBoB,EAGvB;EAIM,OAAA,CAAA,EA7BL,eA+BC,EAAA;AAGb;AAAuC,UA/BtB,gBAAA,CA+BsB;SAMxB,EAAA,MAAA;OAHH,CAAA,EAhCF,OAgCE,EAAA;WAKK,CAAA,EApCH,WAoCG,EAAA;EAAW,MAAA,CAAA,EAnCjB,cAmCiB,EAAA;EAGX,OAAA,CAAA,EAAA,MAAY;AAK7B;AAA6B,UAvCZ,cAAA,SAAuB,kBAuCX,CAAA;UAGjB,CAAA,EAzCC,gBAyCD,EAAA;OACC,CAAA,EAzCH,gBAyCG,EAAA;gBAEL,CAAA,EA1CW,gBA0CX,EAAA;;AAEC,UAzCQ,SAAA,CAyCR;MACE,CAAA,EAAA,MAAA;EAAY,MAAA,CAAA,EAxCZ,cAwCY,EAAA;AAQvB;AAKsB,UAlDL,iBAAA,CAkDoB;EAAA,KAAA,EAAA;IAC3B,OAAA,CAAA,EAAA,MAAA;IAEW,QAAA,CAAA,EAAA,MAAA;IAAlB,QAAA,CAAA,EAAA,MAAA;EAAO,CAAA;;WAlDC;;;UAIM,UAAA;;aAEJ;;UAGI,sBAAA;;;YAGL;;;eAGG;;iBAEE;;UAGA,YAAA;;gBAED;;UAGC,YAAA;;;YAGL;aACC;;QAEL;QACA;SACC;WACE;;;;;;;;;;;iBAQK,UAAA,sBAAgC;iBAK1B,eAAA,SACZ;;;IAEP;UAAkB"}
package/dist/vitest.cjs CHANGED
@@ -2,9 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_fixture_loader = require('./fixture-loader.cjs');
4
4
  const require_llmock = require('./llmock.cjs');
5
- const require_chunk_hooks = require('./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.cjs');
6
5
  let node_path = require("node:path");
7
6
  let node_fs = require("node:fs");
7
+ let vitest = require("vitest");
8
8
 
9
9
  //#region src/vitest.ts
10
10
  /**
@@ -30,7 +30,7 @@ let node_fs = require("node:fs");
30
30
  */
31
31
  function useAimock(options = {}) {
32
32
  let handle = null;
33
- require_chunk_hooks.beforeAll(async () => {
33
+ (0, vitest.beforeAll)(async () => {
34
34
  const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;
35
35
  const llm = new require_llmock.LLMock(serverOpts);
36
36
  if (fixturePath) {
@@ -47,10 +47,10 @@ function useAimock(options = {}) {
47
47
  url
48
48
  };
49
49
  });
50
- require_chunk_hooks.beforeEach(() => {
50
+ (0, vitest.beforeEach)(() => {
51
51
  if (handle) handle.llm.resetMatchCounts();
52
52
  });
53
- require_chunk_hooks.afterAll(async () => {
53
+ (0, vitest.afterAll)(async () => {
54
54
  if (handle) {
55
55
  if (options.patchEnv !== false) {
56
56
  delete process.env.OPENAI_BASE_URL;
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.cjs","names":["LLMock","loadFixturesFromDir","loadFixtureFile"],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,+BAAU,YAAY;EACpB,MAAM,EAAE,UAAU,aAAa,UAAU,GAAG,eAAe;EAC3D,MAAM,MAAM,IAAIA,sBAAO,WAAW;AAElC,MAAI,aAAa;GAEf,MAAM,iBAAiB,oCADE,YAAY,CACQ;AAC7C,QAAK,MAAM,KAAK,eACd,KAAI,WAAW,EAAE;;EAIrB,MAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,MAAI,aAAa,OAAO;AACtB,WAAQ,IAAI,kBAAkB,GAAG,IAAI;AACrC,WAAQ,IAAI,qBAAqB,GAAG,IAAI;;AAG1C,WAAS;GAAE;GAAK;GAAK;GACrB;AAEF,sCAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,8BAAS,YAAY;AACnB,MAAI,QAAQ;AACV,OAAI,QAAQ,aAAa,OAAO;AAC9B,WAAO,QAAQ,IAAI;AACnB,WAAO,QAAQ,IAAI;;AAErB,SAAM,OAAO,IAAI,MAAM;AACvB,YAAS;;GAEX;AAEF,cAAa;AACX,MAAI,CAAC,OACH,OAAM,IAAI,MAAM,wEAAwE;AAE1F,SAAO;;;AAIX,SAAS,aAAa,aAAgC;AACpD,KAAI;AAEF,4BADsB,YAAY,CACzB,aAAa,CACpB,QAAOC,2CAAoB,YAAY;AAEzC,SAAOC,uCAAgB,YAAY;SAC7B;AACN,SAAO,EAAE"}
1
+ {"version":3,"file":"vitest.cjs","names":["LLMock","loadFixturesFromDir","loadFixtureFile"],"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest integration for aimock.\n *\n * Usage:\n * import { useAimock } from \"@copilotkit/aimock/vitest\";\n *\n * const mock = useAimock({ fixtures: \"./fixtures\" });\n *\n * it(\"responds\", async () => {\n * const res = await fetch(`${mock().url}/v1/chat/completions`, { ... });\n * });\n */\n\nimport { beforeAll, afterAll, beforeEach } from \"vitest\";\nimport { LLMock } from \"./llmock.js\";\nimport { loadFixtureFile, loadFixturesFromDir } from \"./fixture-loader.js\";\nimport type { Fixture, MockServerOptions } from \"./types.js\";\nimport { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport interface UseAimockOptions extends MockServerOptions {\n /** Path to fixture file or directory. Loaded automatically on start. */\n fixtures?: string;\n /** If true, sets process.env.OPENAI_BASE_URL to the mock URL + /v1. */\n patchEnv?: boolean;\n}\n\nexport interface AimockHandle {\n /** The LLMock instance. */\n readonly llm: LLMock;\n /** The server URL (e.g., http://127.0.0.1:4010). */\n readonly url: string;\n}\n\n/**\n * Start an aimock server for the duration of the test suite.\n *\n * - `beforeAll`: starts the server and optionally loads fixtures\n * - `beforeEach`: resets fixture match counts (not fixtures themselves)\n * - `afterAll`: stops the server\n *\n * Returns a getter function — call it inside tests to access the handle.\n */\nexport function useAimock(options: UseAimockOptions = {}): () => AimockHandle {\n let handle: AimockHandle | null = null;\n\n beforeAll(async () => {\n const { fixtures: fixturePath, patchEnv, ...serverOpts } = options;\n const llm = new LLMock(serverOpts);\n\n if (fixturePath) {\n const resolved = resolve(fixturePath);\n const loadedFixtures = loadFixtures(resolved);\n for (const f of loadedFixtures) {\n llm.addFixture(f);\n }\n }\n\n const url = await llm.start();\n\n if (patchEnv !== false) {\n process.env.OPENAI_BASE_URL = `${url}/v1`;\n process.env.ANTHROPIC_BASE_URL = `${url}/v1`;\n }\n\n handle = { llm, url };\n });\n\n beforeEach(() => {\n if (handle) {\n handle.llm.resetMatchCounts();\n }\n });\n\n afterAll(async () => {\n if (handle) {\n if (options.patchEnv !== false) {\n delete process.env.OPENAI_BASE_URL;\n delete process.env.ANTHROPIC_BASE_URL;\n }\n await handle.llm.stop();\n handle = null;\n }\n });\n\n return () => {\n if (!handle) {\n throw new Error(\"useAimock(): server not started — are you calling this inside a test?\");\n }\n return handle;\n };\n}\n\nfunction loadFixtures(fixturePath: string): Fixture[] {\n try {\n const stat = statSync(fixturePath);\n if (stat.isDirectory()) {\n return loadFixturesFromDir(fixturePath);\n }\n return loadFixtureFile(fixturePath);\n } catch {\n return [];\n }\n}\n\nexport { LLMock } from \"./llmock.js\";\nexport type { MockServerOptions, Fixture } from \"./types.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,UAAU,UAA4B,EAAE,EAAsB;CAC5E,IAAI,SAA8B;AAElC,uBAAU,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,8BAAiB;AACf,MAAI,OACF,QAAO,IAAI,kBAAkB;GAE/B;AAEF,sBAAS,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"}
package/dist/vitest.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { loadFixtureFile, loadFixturesFromDir } from "./fixture-loader.js";
2
2
  import { LLMock } from "./llmock.js";
3
- import { afterAll, beforeAll, beforeEach } from "./node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js";
4
3
  import { resolve } from "node:path";
5
4
  import { statSync } from "node:fs";
5
+ import { afterAll, beforeAll, beforeEach } from "vitest";
6
6
 
7
7
  //#region src/vitest.ts
8
8
  /**