@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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +46 -0
- package/README.md +14 -2
- package/dist/agui-handler.d.ts.map +1 -1
- package/dist/aimock-cli.cjs +31 -5
- package/dist/aimock-cli.cjs.map +1 -1
- package/dist/aimock-cli.d.cts.map +1 -1
- package/dist/aimock-cli.d.ts.map +1 -1
- package/dist/aimock-cli.js +31 -5
- package/dist/aimock-cli.js.map +1 -1
- package/dist/bedrock-converse.cjs +344 -43
- package/dist/bedrock-converse.cjs.map +1 -1
- package/dist/bedrock-converse.d.cts.map +1 -1
- package/dist/bedrock-converse.d.ts.map +1 -1
- package/dist/bedrock-converse.js +345 -44
- package/dist/bedrock-converse.js.map +1 -1
- package/dist/bedrock.cjs +195 -42
- package/dist/bedrock.cjs.map +1 -1
- package/dist/bedrock.d.cts.map +1 -1
- package/dist/bedrock.d.ts.map +1 -1
- package/dist/bedrock.js +196 -43
- package/dist/bedrock.js.map +1 -1
- package/dist/chaos.cjs +9 -5
- package/dist/chaos.cjs.map +1 -1
- package/dist/chaos.d.cts.map +1 -1
- package/dist/chaos.d.ts.map +1 -1
- package/dist/chaos.js +10 -7
- package/dist/chaos.js.map +1 -1
- package/dist/cli.cjs +238 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +242 -13
- package/dist/cli.js.map +1 -1
- package/dist/cohere.cjs +159 -72
- package/dist/cohere.cjs.map +1 -1
- package/dist/cohere.d.cts.map +1 -1
- package/dist/cohere.d.ts.map +1 -1
- package/dist/cohere.js +160 -73
- package/dist/cohere.js.map +1 -1
- package/dist/config-loader.cjs +63 -5
- package/dist/config-loader.cjs.map +1 -1
- package/dist/config-loader.d.cts +37 -4
- package/dist/config-loader.d.cts.map +1 -1
- package/dist/config-loader.d.ts +37 -4
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +63 -5
- package/dist/config-loader.js.map +1 -1
- package/dist/constants.cjs +8 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +6 -2
- package/dist/constants.d.ts +6 -2
- package/dist/constants.js +8 -1
- package/dist/constants.js.map +1 -1
- package/dist/echo-text.cjs +65 -0
- package/dist/echo-text.cjs.map +1 -0
- package/dist/echo-text.d.cts +22 -0
- package/dist/echo-text.d.cts.map +1 -0
- package/dist/echo-text.d.ts +22 -0
- package/dist/echo-text.d.ts.map +1 -0
- package/dist/echo-text.js +65 -0
- package/dist/echo-text.js.map +1 -0
- package/dist/embeddings.cjs +18 -1
- package/dist/embeddings.cjs.map +1 -1
- package/dist/embeddings.d.cts +1 -1
- package/dist/embeddings.d.cts.map +1 -1
- package/dist/embeddings.d.ts +1 -1
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/embeddings.js +18 -1
- package/dist/embeddings.js.map +1 -1
- package/dist/fakes-plugin.cjs +131 -0
- package/dist/fakes-plugin.cjs.map +1 -0
- package/dist/fakes-plugin.d.cts +23 -0
- package/dist/fakes-plugin.d.cts.map +1 -0
- package/dist/fakes-plugin.d.ts +23 -0
- package/dist/fakes-plugin.d.ts.map +1 -0
- package/dist/fakes-plugin.js +127 -0
- package/dist/fakes-plugin.js.map +1 -0
- package/dist/files.cjs +9 -11
- package/dist/files.cjs.map +1 -1
- package/dist/files.d.cts.map +1 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +10 -13
- package/dist/files.js.map +1 -1
- package/dist/fine-tuning.cjs +1 -19
- package/dist/fine-tuning.cjs.map +1 -1
- package/dist/fine-tuning.d.cts.map +1 -1
- package/dist/fine-tuning.d.ts.map +1 -1
- package/dist/fine-tuning.js +2 -20
- package/dist/fine-tuning.js.map +1 -1
- package/dist/fixture-loader-services.cjs +116 -0
- package/dist/fixture-loader-services.cjs.map +1 -0
- package/dist/fixture-loader-services.d.cts +48 -0
- package/dist/fixture-loader-services.d.cts.map +1 -0
- package/dist/fixture-loader-services.d.ts +48 -0
- package/dist/fixture-loader-services.d.ts.map +1 -0
- package/dist/fixture-loader-services.js +114 -0
- package/dist/fixture-loader-services.js.map +1 -0
- package/dist/fixture-loader.cjs +552 -29
- package/dist/fixture-loader.cjs.map +1 -1
- package/dist/fixture-loader.d.cts +140 -2
- package/dist/fixture-loader.d.cts.map +1 -1
- package/dist/fixture-loader.d.ts +140 -2
- package/dist/fixture-loader.d.ts.map +1 -1
- package/dist/fixture-loader.js +542 -31
- package/dist/fixture-loader.js.map +1 -1
- package/dist/gemini-embeddings.cjs +42 -2
- package/dist/gemini-embeddings.cjs.map +1 -1
- package/dist/gemini-embeddings.js +43 -3
- package/dist/gemini-embeddings.js.map +1 -1
- package/dist/gemini-interactions.cjs +288 -52
- package/dist/gemini-interactions.cjs.map +1 -1
- package/dist/gemini-interactions.d.cts.map +1 -1
- package/dist/gemini-interactions.d.ts.map +1 -1
- package/dist/gemini-interactions.js +289 -53
- package/dist/gemini-interactions.js.map +1 -1
- package/dist/gemini.cjs +234 -38
- package/dist/gemini.cjs.map +1 -1
- package/dist/gemini.d.cts.map +1 -1
- package/dist/gemini.d.ts.map +1 -1
- package/dist/gemini.js +235 -39
- package/dist/gemini.js.map +1 -1
- package/dist/helpers.cjs +1157 -12
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +85 -4
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.ts +85 -4
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +1113 -14
- package/dist/helpers.js.map +1 -1
- package/dist/images.cjs +3 -2
- package/dist/images.cjs.map +1 -1
- package/dist/images.js +3 -2
- package/dist/images.js.map +1 -1
- package/dist/index.cjs +39 -1
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +11 -4
- package/dist/jest.cjs +43 -14
- package/dist/jest.cjs.map +1 -1
- package/dist/jest.d.cts +47 -5
- package/dist/jest.d.cts.map +1 -1
- package/dist/jest.d.ts +47 -5
- package/dist/jest.d.ts.map +1 -1
- package/dist/jest.js +45 -16
- package/dist/jest.js.map +1 -1
- package/dist/journal.cjs +155 -13
- package/dist/journal.cjs.map +1 -1
- package/dist/journal.d.cts +54 -4
- package/dist/journal.d.cts.map +1 -1
- package/dist/journal.d.ts +54 -4
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +155 -13
- package/dist/journal.js.map +1 -1
- package/dist/live-sanitize.cjs +4 -32
- package/dist/live-sanitize.cjs.map +1 -1
- package/dist/live-sanitize.js +4 -32
- package/dist/live-sanitize.js.map +1 -1
- package/dist/llmock.cjs +204 -39
- package/dist/llmock.cjs.map +1 -1
- package/dist/llmock.d.cts +51 -1
- package/dist/llmock.d.cts.map +1 -1
- package/dist/llmock.d.ts +51 -1
- package/dist/llmock.d.ts.map +1 -1
- package/dist/llmock.js +206 -41
- package/dist/llmock.js.map +1 -1
- package/dist/mcp-fakes-mount.cjs +217 -0
- package/dist/mcp-fakes-mount.cjs.map +1 -0
- package/dist/mcp-fakes-mount.js +211 -0
- package/dist/mcp-fakes-mount.js.map +1 -0
- package/dist/mcp-fakes-report.cjs +111 -0
- package/dist/mcp-fakes-report.cjs.map +1 -0
- package/dist/mcp-fakes-report.d.cts +40 -0
- package/dist/mcp-fakes-report.d.cts.map +1 -0
- package/dist/mcp-fakes-report.d.ts +40 -0
- package/dist/mcp-fakes-report.d.ts.map +1 -0
- package/dist/mcp-fakes-report.js +107 -0
- package/dist/mcp-fakes-report.js.map +1 -0
- package/dist/mcp-fakes.cjs +1942 -0
- package/dist/mcp-fakes.cjs.map +1 -0
- package/dist/mcp-fakes.d.cts +504 -0
- package/dist/mcp-fakes.d.cts.map +1 -0
- package/dist/mcp-fakes.d.ts +504 -0
- package/dist/mcp-fakes.d.ts.map +1 -0
- package/dist/mcp-fakes.js +1937 -0
- package/dist/mcp-fakes.js.map +1 -0
- package/dist/mcp-handler.cjs +534 -27
- package/dist/mcp-handler.cjs.map +1 -1
- package/dist/mcp-handler.d.cts +49 -0
- package/dist/mcp-handler.d.cts.map +1 -0
- package/dist/mcp-handler.d.ts +49 -0
- package/dist/mcp-handler.d.ts.map +1 -0
- package/dist/mcp-handler.js +530 -28
- package/dist/mcp-handler.js.map +1 -1
- package/dist/mcp-mock.cjs +326 -47
- package/dist/mcp-mock.cjs.map +1 -1
- package/dist/mcp-mock.d.cts +97 -1
- package/dist/mcp-mock.d.cts.map +1 -1
- package/dist/mcp-mock.d.ts +97 -1
- package/dist/mcp-mock.d.ts.map +1 -1
- package/dist/mcp-mock.js +327 -48
- package/dist/mcp-mock.js.map +1 -1
- package/dist/mcp-recorder.cjs +1224 -0
- package/dist/mcp-recorder.cjs.map +1 -0
- package/dist/mcp-recorder.d.cts +108 -0
- package/dist/mcp-recorder.d.cts.map +1 -0
- package/dist/mcp-recorder.d.ts +108 -0
- package/dist/mcp-recorder.d.ts.map +1 -0
- package/dist/mcp-recorder.js +1215 -0
- package/dist/mcp-recorder.js.map +1 -0
- package/dist/mcp-stub.cjs +5 -1
- package/dist/mcp-stub.d.cts +3 -1
- package/dist/mcp-stub.d.ts +3 -1
- package/dist/mcp-stub.js +3 -1
- package/dist/mcp-types.d.cts +6 -0
- package/dist/mcp-types.d.ts +6 -0
- package/dist/message-text.cjs +192 -0
- package/dist/message-text.cjs.map +1 -0
- package/dist/message-text.d.cts +31 -0
- package/dist/message-text.d.cts.map +1 -0
- package/dist/message-text.d.ts +31 -0
- package/dist/message-text.d.ts.map +1 -0
- package/dist/message-text.js +184 -0
- package/dist/message-text.js.map +1 -0
- package/dist/messages.cjs +400 -56
- package/dist/messages.cjs.map +1 -1
- package/dist/messages.d.cts.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +401 -58
- package/dist/messages.js.map +1 -1
- package/dist/metrics.cjs +46 -66
- package/dist/metrics.cjs.map +1 -1
- package/dist/metrics.d.cts +14 -6
- package/dist/metrics.d.cts.map +1 -1
- package/dist/metrics.d.ts +14 -6
- package/dist/metrics.d.ts.map +1 -1
- package/dist/metrics.js +32 -40
- package/dist/metrics.js.map +1 -1
- package/dist/misbehavior.cjs +1523 -0
- package/dist/misbehavior.cjs.map +1 -0
- package/dist/misbehavior.d.cts +43 -0
- package/dist/misbehavior.d.cts.map +1 -0
- package/dist/misbehavior.d.ts +43 -0
- package/dist/misbehavior.d.ts.map +1 -0
- package/dist/misbehavior.js +1511 -0
- package/dist/misbehavior.js.map +1 -0
- package/dist/ollama.cjs +315 -113
- package/dist/ollama.cjs.map +1 -1
- package/dist/ollama.d.cts.map +1 -1
- package/dist/ollama.d.ts.map +1 -1
- package/dist/ollama.js +316 -114
- package/dist/ollama.js.map +1 -1
- package/dist/openapi.cjs +3405 -0
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +30 -0
- package/dist/openapi.d.cts.map +1 -0
- package/dist/openapi.d.ts +30 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +3404 -0
- package/dist/openapi.js.map +1 -0
- package/dist/openrouter-video.cjs +4 -4
- package/dist/openrouter-video.cjs.map +1 -1
- package/dist/openrouter-video.d.cts.map +1 -1
- package/dist/openrouter-video.d.ts.map +1 -1
- package/dist/openrouter-video.js +4 -4
- package/dist/openrouter-video.js.map +1 -1
- package/dist/record-sanitize.cjs +231 -0
- package/dist/record-sanitize.cjs.map +1 -0
- package/dist/record-sanitize.js +224 -0
- package/dist/record-sanitize.js.map +1 -0
- package/dist/recorder.cjs +115 -6
- package/dist/recorder.cjs.map +1 -1
- package/dist/recorder.d.cts +2 -1
- package/dist/recorder.d.cts.map +1 -1
- package/dist/recorder.d.ts +2 -1
- package/dist/recorder.d.ts.map +1 -1
- package/dist/recorder.js +116 -8
- package/dist/recorder.js.map +1 -1
- package/dist/responses.cjs +701 -166
- package/dist/responses.cjs.map +1 -1
- package/dist/responses.d.cts +5 -13
- package/dist/responses.d.cts.map +1 -1
- package/dist/responses.d.ts +5 -13
- package/dist/responses.d.ts.map +1 -1
- package/dist/responses.js +699 -169
- package/dist/responses.js.map +1 -1
- package/dist/route-registry.cjs +951 -0
- package/dist/route-registry.cjs.map +1 -0
- package/dist/route-registry.d.cts +33 -0
- package/dist/route-registry.d.cts.map +1 -0
- package/dist/route-registry.d.ts +33 -0
- package/dist/route-registry.d.ts.map +1 -0
- package/dist/route-registry.js +866 -0
- package/dist/route-registry.js.map +1 -0
- package/dist/router.cjs +24 -2
- package/dist/router.cjs.map +1 -1
- package/dist/router.d.cts.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +25 -4
- package/dist/router.js.map +1 -1
- package/dist/server.cjs +1159 -264
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -1
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1067 -172
- package/dist/server.js.map +1 -1
- package/dist/speech.cjs +4 -2
- package/dist/speech.cjs.map +1 -1
- package/dist/speech.js +4 -2
- package/dist/speech.js.map +1 -1
- package/dist/stream-collapse.cjs +236 -34
- package/dist/stream-collapse.cjs.map +1 -1
- package/dist/stream-collapse.d.cts +39 -4
- package/dist/stream-collapse.d.cts.map +1 -1
- package/dist/stream-collapse.d.ts +39 -4
- package/dist/stream-collapse.d.ts.map +1 -1
- package/dist/stream-collapse.js +235 -35
- package/dist/stream-collapse.js.map +1 -1
- package/dist/suite.cjs +1 -1
- package/dist/suite.js +1 -1
- package/dist/transcription.cjs +2 -2
- package/dist/transcription.cjs.map +1 -1
- package/dist/transcription.d.cts.map +1 -1
- package/dist/transcription.d.ts.map +1 -1
- package/dist/transcription.js +2 -2
- package/dist/transcription.js.map +1 -1
- package/dist/types.cjs +18 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +516 -5
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +516 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/dist/validate-cli.cjs +123 -33
- package/dist/validate-cli.cjs.map +1 -1
- package/dist/validate-cli.js +125 -35
- package/dist/validate-cli.js.map +1 -1
- package/dist/vector-stores.cjs +1180 -0
- package/dist/vector-stores.cjs.map +1 -0
- package/dist/vector-stores.d.cts +106 -0
- package/dist/vector-stores.d.cts.map +1 -0
- package/dist/vector-stores.d.ts +106 -0
- package/dist/vector-stores.d.ts.map +1 -0
- package/dist/vector-stores.js +1164 -0
- package/dist/vector-stores.js.map +1 -0
- package/dist/vector-types.d.cts.map +1 -1
- package/dist/version.cjs +45 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.js +44 -0
- package/dist/version.js.map +1 -0
- package/dist/video.cjs +19 -0
- package/dist/video.cjs.map +1 -1
- package/dist/video.d.cts.map +1 -1
- package/dist/video.d.ts.map +1 -1
- package/dist/video.js +19 -0
- package/dist/video.js.map +1 -1
- package/dist/vitest.cjs +77 -16
- package/dist/vitest.cjs.map +1 -1
- package/dist/vitest.d.cts +38 -5
- package/dist/vitest.d.cts.map +1 -1
- package/dist/vitest.d.ts +38 -5
- package/dist/vitest.d.ts.map +1 -1
- package/dist/vitest.js +78 -17
- package/dist/vitest.js.map +1 -1
- package/dist/watcher.cjs +6 -2
- package/dist/watcher.cjs.map +1 -1
- package/dist/watcher.js +6 -2
- package/dist/watcher.js.map +1 -1
- package/dist/ws-gemini-live.cjs +210 -101
- package/dist/ws-gemini-live.cjs.map +1 -1
- package/dist/ws-gemini-live.d.cts +9 -3
- package/dist/ws-gemini-live.d.cts.map +1 -1
- package/dist/ws-gemini-live.d.ts +9 -3
- package/dist/ws-gemini-live.d.ts.map +1 -1
- package/dist/ws-gemini-live.js +211 -102
- package/dist/ws-gemini-live.js.map +1 -1
- package/dist/ws-realtime.cjs +175 -62
- package/dist/ws-realtime.cjs.map +1 -1
- package/dist/ws-realtime.d.cts +8 -3
- package/dist/ws-realtime.d.cts.map +1 -1
- package/dist/ws-realtime.d.ts +8 -3
- package/dist/ws-realtime.d.ts.map +1 -1
- package/dist/ws-realtime.js +176 -63
- package/dist/ws-realtime.js.map +1 -1
- package/dist/ws-responses.cjs +121 -16
- package/dist/ws-responses.cjs.map +1 -1
- package/dist/ws-responses.d.cts +8 -12
- package/dist/ws-responses.d.cts.map +1 -1
- package/dist/ws-responses.d.ts +8 -12
- package/dist/ws-responses.d.ts.map +1 -1
- package/dist/ws-responses.js +123 -18
- package/dist/ws-responses.js.map +1 -1
- package/package.json +13 -2
- package/skills/write-fixtures/SKILL.md +179 -21
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { MisbehaviorSummary } from "./misbehavior.js";
|
|
1
2
|
import { Journal } from "./journal.js";
|
|
2
3
|
import { LiveFixtureResponse, LiveOptions } from "./live-types.js";
|
|
3
4
|
import { Logger } from "./logger.js";
|
|
4
5
|
import { MetricsRegistry } from "./metrics.js";
|
|
6
|
+
import { McpFakeAddOrigin, McpFakeAddResult } from "./mcp-fakes.js";
|
|
5
7
|
import * as http$1 from "node:http";
|
|
6
8
|
import * as net from "node:net";
|
|
7
9
|
|
|
@@ -16,6 +18,23 @@ interface Mountable {
|
|
|
16
18
|
setJournal?(journal: Journal): void;
|
|
17
19
|
setBaseUrl?(url: string): void;
|
|
18
20
|
setRegistry?(registry: MetricsRegistry): void;
|
|
21
|
+
/**
|
|
22
|
+
* MCP fakes. A mount "is an MCPMock" for fakes if and only if it
|
|
23
|
+
* implements `addMcpFakes`. Always appends. `origin` picks the entry-id
|
|
24
|
+
* source and its counter: `file` keeps each block's `source` (`@<k>` load
|
|
25
|
+
* counter); `code` / `control-api` is one run-time addition (`code#<n>` /
|
|
26
|
+
* `control-api#<n>`). Returns the shadowed-entry warnings with the real
|
|
27
|
+
* entry ids. When any block is bad, or the input holds no blocks, throws one
|
|
28
|
+
* `FixtureLoadError` (an `McpFakesAddError` carrying every error found and
|
|
29
|
+
* the warnings) and adds nothing.
|
|
30
|
+
*/
|
|
31
|
+
addMcpFakes?(blocks: McpFakeSource[], origin: McpFakeAddOrigin): McpFakeAddResult;
|
|
32
|
+
/** Unload every fake on this mount. The entry-id counters are kept. */
|
|
33
|
+
clearMcpFakes?(): void;
|
|
34
|
+
/** Reset fake consumption state for one test id, or for all when omitted. */
|
|
35
|
+
resetScenarioState?(testId?: string): void;
|
|
36
|
+
/** Hands an MCP mount a `Logger`. Nothing in the server calls it. */
|
|
37
|
+
setLogger?(logger: Logger): void;
|
|
19
38
|
}
|
|
20
39
|
interface ContentPart {
|
|
21
40
|
type: string;
|
|
@@ -27,16 +46,39 @@ interface ChatMessage {
|
|
|
27
46
|
content: string | ContentPart[] | null;
|
|
28
47
|
name?: string;
|
|
29
48
|
tool_calls?: ToolCallMessage[];
|
|
49
|
+
/**
|
|
50
|
+
* OpenAI Responses `custom_tool_call` history items. Set only when the
|
|
51
|
+
* server runs with `responsesTools: "extended"`; the default ignores
|
|
52
|
+
* custom tool call history, as earlier releases did.
|
|
53
|
+
*/
|
|
54
|
+
custom_tool_calls?: CustomToolCallMessage[];
|
|
30
55
|
tool_call_id?: string;
|
|
31
56
|
}
|
|
32
57
|
interface ToolCallMessage {
|
|
33
58
|
id: string;
|
|
34
59
|
type: "function";
|
|
60
|
+
/**
|
|
61
|
+
* OpenAI Responses namespace of the called tool. Set only with
|
|
62
|
+
* `responsesTools: "extended"`, when the history item had one.
|
|
63
|
+
*/
|
|
64
|
+
namespace?: string;
|
|
35
65
|
function: {
|
|
36
66
|
name: string;
|
|
37
67
|
arguments: string;
|
|
38
68
|
};
|
|
39
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* An OpenAI Responses `custom_tool_call` history item, normalized for fixture
|
|
72
|
+
* matching. Produced only with `responsesTools: "extended"`.
|
|
73
|
+
*/
|
|
74
|
+
interface CustomToolCallMessage {
|
|
75
|
+
id: string;
|
|
76
|
+
type: "custom";
|
|
77
|
+
name: string;
|
|
78
|
+
/** Free-text input of the call ("" when the history item had none). */
|
|
79
|
+
input: string;
|
|
80
|
+
namespace?: string;
|
|
81
|
+
}
|
|
40
82
|
interface ChatCompletionRequest {
|
|
41
83
|
model: string;
|
|
42
84
|
messages: ChatMessage[];
|
|
@@ -81,6 +123,13 @@ interface ChatCompletionRequest {
|
|
|
81
123
|
temperature?: number;
|
|
82
124
|
max_tokens?: number;
|
|
83
125
|
tools?: ToolDefinition[];
|
|
126
|
+
/**
|
|
127
|
+
* OpenAI Responses `custom` tools offered by the request (top level, inside
|
|
128
|
+
* a `namespace` tool, or in an `additional_tools` / `tool_search_output`
|
|
129
|
+
* input item). Set only with `responsesTools: "extended"`; `toolName`
|
|
130
|
+
* matches these as well as `tools`.
|
|
131
|
+
*/
|
|
132
|
+
customTools?: CustomToolDefinition[];
|
|
84
133
|
tool_choice?: string | object;
|
|
85
134
|
response_format?: {
|
|
86
135
|
type: string;
|
|
@@ -102,6 +151,13 @@ interface ChatCompletionRequest {
|
|
|
102
151
|
_videoProvider?: "openrouter" | "veo" | "grok" | "byteplus";
|
|
103
152
|
[key: string]: unknown;
|
|
104
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* aimock's normalized request function tool. The OpenAI Responses adapter
|
|
156
|
+
* keeps only top-level `function` tools here by default. With
|
|
157
|
+
* `responsesTools: "extended"` it also adds the function tools inside a
|
|
158
|
+
* `namespace` tool (with `namespace` set) and those from `additional_tools` /
|
|
159
|
+
* `tool_search_output` input items.
|
|
160
|
+
*/
|
|
105
161
|
interface ToolDefinition {
|
|
106
162
|
type: "function";
|
|
107
163
|
function: {
|
|
@@ -109,6 +165,21 @@ interface ToolDefinition {
|
|
|
109
165
|
description?: string;
|
|
110
166
|
parameters?: object;
|
|
111
167
|
};
|
|
168
|
+
/** OpenAI Responses namespace the tool was offered in (extended mode only). */
|
|
169
|
+
namespace?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* An OpenAI Responses `custom` (freeform) tool offered by a request. See
|
|
173
|
+
* {@link ChatCompletionRequest.customTools}.
|
|
174
|
+
*/
|
|
175
|
+
interface CustomToolDefinition {
|
|
176
|
+
type: "custom";
|
|
177
|
+
name: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
/** OpenAI Responses namespace the tool was offered in, when inside a `namespace` tool. */
|
|
180
|
+
namespace?: string;
|
|
181
|
+
/** Custom-tool input format (grammar or text), carried verbatim. */
|
|
182
|
+
format?: unknown;
|
|
112
183
|
}
|
|
113
184
|
interface FixtureMatch {
|
|
114
185
|
userMessage?: string | RegExp;
|
|
@@ -138,6 +209,13 @@ interface FixtureMatch {
|
|
|
138
209
|
*/
|
|
139
210
|
toolResultContains?: string;
|
|
140
211
|
toolName?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Exact OpenAI Responses tool namespace. Alone, it matches when any offered
|
|
214
|
+
* tool sits in this namespace; with `toolName`, a single offered tool must
|
|
215
|
+
* carry both the name and the namespace. Applies only when the server runs
|
|
216
|
+
* with `responsesTools: "extended"`; otherwise it is ignored, as in 1.44.0.
|
|
217
|
+
*/
|
|
218
|
+
toolNamespace?: string;
|
|
141
219
|
model?: string | RegExp;
|
|
142
220
|
responseFormat?: string;
|
|
143
221
|
predicate?: (req: ChatCompletionRequest) => boolean;
|
|
@@ -284,7 +362,36 @@ interface ToolCall {
|
|
|
284
362
|
name: string;
|
|
285
363
|
arguments: string;
|
|
286
364
|
id?: string;
|
|
365
|
+
/**
|
|
366
|
+
* OpenAI Responses API only: emitted as `function_call.namespace` when the
|
|
367
|
+
* server runs with `responsesTools: "extended"`. Ignored otherwise, and by
|
|
368
|
+
* every other wire.
|
|
369
|
+
*/
|
|
370
|
+
namespace?: string;
|
|
287
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* An OpenAI Responses custom (freeform) tool call, emitted as a
|
|
374
|
+
* `custom_tool_call` item. Fixtures carry it in `customToolCalls` (or as a
|
|
375
|
+
* `customToolCall` block in `responsesBlocks`). Only the Responses API (HTTP
|
|
376
|
+
* and WebSocket) can serve it; every other wire rejects it with
|
|
377
|
+
* `UnsupportedToolCallError`.
|
|
378
|
+
*/
|
|
379
|
+
interface CustomToolCall {
|
|
380
|
+
type: "custom";
|
|
381
|
+
name: string;
|
|
382
|
+
/** Free-text input. Never parsed, never stringified. */
|
|
383
|
+
input: string;
|
|
384
|
+
id?: string;
|
|
385
|
+
/** OpenAI Responses API only: emitted as `custom_tool_call.namespace`. */
|
|
386
|
+
namespace?: string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* A tool call the OpenAI Responses API serves: a function call (from
|
|
390
|
+
* `toolCalls`) or a custom tool call (from `customToolCalls`).
|
|
391
|
+
*/
|
|
392
|
+
type FixtureToolCall = (ToolCall & {
|
|
393
|
+
type?: undefined;
|
|
394
|
+
}) | CustomToolCall;
|
|
288
395
|
/**
|
|
289
396
|
* A single ordered streaming block for a {@link ContentWithToolCallsResponse}.
|
|
290
397
|
*
|
|
@@ -303,9 +410,30 @@ type FixtureBlock = {
|
|
|
303
410
|
name: string;
|
|
304
411
|
arguments: string;
|
|
305
412
|
id?: string;
|
|
413
|
+
namespace?: string;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* An ordered block for {@link ContentWithToolCallsResponse.responsesBlocks}:
|
|
417
|
+
* a {@link FixtureBlock}, or a `customToolCall` block that mirrors
|
|
418
|
+
* {@link CustomToolCall} (`name` + free-text `input`, optional `id` and
|
|
419
|
+
* `namespace`). Only the OpenAI Responses API serves `responsesBlocks`.
|
|
420
|
+
*/
|
|
421
|
+
type ResponsesFixtureBlock = FixtureBlock | {
|
|
422
|
+
type: "customToolCall";
|
|
423
|
+
name: string;
|
|
424
|
+
input: string;
|
|
425
|
+
id?: string;
|
|
426
|
+
namespace?: string;
|
|
306
427
|
};
|
|
307
428
|
interface ToolCallResponse extends ResponseOverrides {
|
|
308
429
|
toolCalls: ToolCall[];
|
|
430
|
+
/**
|
|
431
|
+
* OpenAI Responses custom tool calls, emitted after `toolCalls`. A turn with
|
|
432
|
+
* only custom calls sets `toolCalls: []`. Every other wire rejects a fixture
|
|
433
|
+
* with a non-empty `customToolCalls` (`UnsupportedToolCallError`). Applies
|
|
434
|
+
* only with `responsesTools: "extended"`; otherwise it is ignored.
|
|
435
|
+
*/
|
|
436
|
+
customToolCalls?: CustomToolCall[];
|
|
309
437
|
reasoning?: string;
|
|
310
438
|
/** Real Anthropic thinking-block signature; see {@link TextResponse.reasoningSignature}. */
|
|
311
439
|
reasoningSignature?: string;
|
|
@@ -327,6 +455,8 @@ interface ContentWithToolCallsResponse extends ResponseOverrides {
|
|
|
327
455
|
content?: string;
|
|
328
456
|
/** See {@link ContentWithToolCallsResponse.content} — optional only for the blocks-only shape. */
|
|
329
457
|
toolCalls?: ToolCall[];
|
|
458
|
+
/** OpenAI Responses custom tool calls; see {@link ToolCallResponse.customToolCalls}. */
|
|
459
|
+
customToolCalls?: CustomToolCall[];
|
|
330
460
|
/**
|
|
331
461
|
* Optional ordered streaming blocks. When present, builders stream these in
|
|
332
462
|
* array order (tool-first / interleaved); when absent, the legacy
|
|
@@ -335,6 +465,14 @@ interface ContentWithToolCallsResponse extends ResponseOverrides {
|
|
|
335
465
|
* response even without `content`/`toolCalls` (see those fields above).
|
|
336
466
|
*/
|
|
337
467
|
blocks?: FixtureBlock[];
|
|
468
|
+
/**
|
|
469
|
+
* OpenAI Responses only: ordered blocks that may include `customToolCall`
|
|
470
|
+
* blocks. On the Responses API they replace `blocks`; a fixture may not set
|
|
471
|
+
* both. Every other wire rejects a `customToolCall` block here
|
|
472
|
+
* (`UnsupportedToolCallError`) and otherwise ignores this field. Applies
|
|
473
|
+
* only with `responsesTools: "extended"`; otherwise it is ignored.
|
|
474
|
+
*/
|
|
475
|
+
responsesBlocks?: ResponsesFixtureBlock[];
|
|
338
476
|
reasoning?: string;
|
|
339
477
|
/** Real Anthropic thinking-block signature; see {@link TextResponse.reasoningSignature}. */
|
|
340
478
|
reasoningSignature?: string;
|
|
@@ -592,6 +730,61 @@ interface ChaosScope {
|
|
|
592
730
|
type ChaosDefaults = ChaosConfig | ChaosScope;
|
|
593
731
|
type ChaosAction = "drop" | "malformed" | "rateLimit" | "disconnect";
|
|
594
732
|
type ResponseFactory = (req: ChatCompletionRequest) => FixtureResponse | Promise<FixtureResponse>;
|
|
733
|
+
/** Provider wire identifiers, independent of endpoint response families. */
|
|
734
|
+
type WireId = "openai-chat" | "openai-responses" | "openai-realtime" | "anthropic" | "bedrock-invoke" | "bedrock-converse" | "gemini" | "gemini-live" | "gemini-interactions" | "cohere" | "ollama";
|
|
735
|
+
interface MisbehaviorCommon {
|
|
736
|
+
rate?: number;
|
|
737
|
+
times?: number;
|
|
738
|
+
tool?: string;
|
|
739
|
+
providers?: WireId[];
|
|
740
|
+
}
|
|
741
|
+
type MisbehaviorFault = MisbehaviorCommon & ({
|
|
742
|
+
fault: "tool-args-invalid-json";
|
|
743
|
+
style?: "truncated" | "trailing-comma" | "single-quotes";
|
|
744
|
+
} | {
|
|
745
|
+
fault: "tool-args-schema-violation";
|
|
746
|
+
violation?: "missing-required" | "wrong-type" | "extra-property" | "enum-mismatch" | "not-object";
|
|
747
|
+
property?: string;
|
|
748
|
+
} | {
|
|
749
|
+
fault: "tool-unknown-name";
|
|
750
|
+
name?: string;
|
|
751
|
+
} | {
|
|
752
|
+
fault: "tool-call-id-duplicate";
|
|
753
|
+
} | {
|
|
754
|
+
fault: "stop-length-mid-tool";
|
|
755
|
+
at?: number;
|
|
756
|
+
} | {
|
|
757
|
+
fault: "empty-response";
|
|
758
|
+
} | {
|
|
759
|
+
fault: "refusal";
|
|
760
|
+
message?: string;
|
|
761
|
+
category?: string | null;
|
|
762
|
+
} | {
|
|
763
|
+
fault: "content-filter";
|
|
764
|
+
} | {
|
|
765
|
+
fault: "reasoning-only";
|
|
766
|
+
reasoning?: string;
|
|
767
|
+
});
|
|
768
|
+
type MisbehaviorFaultId = MisbehaviorFault["fault"];
|
|
769
|
+
interface MisbehaviorConfig {
|
|
770
|
+
seed?: number | "random";
|
|
771
|
+
faults: MisbehaviorFault[];
|
|
772
|
+
}
|
|
773
|
+
interface MisbehaviorCounterKey {
|
|
774
|
+
testId: string;
|
|
775
|
+
sourceKey: string;
|
|
776
|
+
entryIndex: number;
|
|
777
|
+
}
|
|
778
|
+
interface MisbehaviorCounters {
|
|
779
|
+
getFiringCount(key: MisbehaviorCounterKey): number;
|
|
780
|
+
nextOrdinal(key: MisbehaviorCounterKey): number;
|
|
781
|
+
recordFiring(key: MisbehaviorCounterKey): void;
|
|
782
|
+
clearMisbehaviorCounters(testId?: string): void;
|
|
783
|
+
}
|
|
784
|
+
interface MisbehaviorScope {
|
|
785
|
+
baseline?: MisbehaviorConfig;
|
|
786
|
+
byTestId: Map<string, MisbehaviorConfig>;
|
|
787
|
+
}
|
|
595
788
|
interface Fixture {
|
|
596
789
|
match: FixtureMatch;
|
|
597
790
|
response: FixtureResponse | ResponseFactory;
|
|
@@ -602,6 +795,7 @@ interface Fixture {
|
|
|
602
795
|
streamingProfile?: StreamingProfile;
|
|
603
796
|
recordedTimings?: RecordedTimings;
|
|
604
797
|
replaySpeed?: number;
|
|
798
|
+
misbehavior?: MisbehaviorConfig | MisbehaviorFaultId;
|
|
605
799
|
chaos?: ChaosConfig;
|
|
606
800
|
/**
|
|
607
801
|
* Opt into OpenRouter's `: OPENROUTER PROCESSING` SSE keepalive comment
|
|
@@ -630,6 +824,18 @@ interface FixtureFileToolCall {
|
|
|
630
824
|
/** Accepts a JSON object or array for convenience — the loader will JSON.stringify it. */
|
|
631
825
|
arguments: string | Record<string, unknown> | unknown[];
|
|
632
826
|
id?: string;
|
|
827
|
+
/** OpenAI Responses namespace; see {@link ToolCall.namespace}. */
|
|
828
|
+
namespace?: string;
|
|
829
|
+
}
|
|
830
|
+
/** On-disk counterpart of {@link CustomToolCall} (`customToolCalls` entries). */
|
|
831
|
+
interface FixtureFileCustomToolCall {
|
|
832
|
+
/** Optional in a file: every `customToolCalls` entry is a custom call. */
|
|
833
|
+
type?: "custom";
|
|
834
|
+
name: string;
|
|
835
|
+
/** Free-text input, never parsed or stringified. */
|
|
836
|
+
input: string;
|
|
837
|
+
id?: string;
|
|
838
|
+
namespace?: string;
|
|
633
839
|
}
|
|
634
840
|
/**
|
|
635
841
|
* On-disk counterpart of {@link FixtureBlock}. A `toolCall` block's
|
|
@@ -646,9 +852,20 @@ type FixtureFileBlock = {
|
|
|
646
852
|
/** Accepts a JSON object or array for convenience — the loader will JSON.stringify it. */
|
|
647
853
|
arguments: string | Record<string, unknown> | unknown[];
|
|
648
854
|
id?: string;
|
|
855
|
+
namespace?: string;
|
|
856
|
+
};
|
|
857
|
+
/** On-disk counterpart of {@link ResponsesFixtureBlock} (`responsesBlocks` entries). */
|
|
858
|
+
type FixtureFileResponsesBlock = FixtureFileBlock | {
|
|
859
|
+
type: "customToolCall";
|
|
860
|
+
name: string;
|
|
861
|
+
input: string;
|
|
862
|
+
id?: string;
|
|
863
|
+
namespace?: string;
|
|
649
864
|
};
|
|
650
865
|
interface FixtureFileToolCallResponse extends ResponseOverrides {
|
|
651
866
|
toolCalls: FixtureFileToolCall[];
|
|
867
|
+
/** See {@link ToolCallResponse.customToolCalls}. */
|
|
868
|
+
customToolCalls?: FixtureFileCustomToolCall[];
|
|
652
869
|
reasoning?: string;
|
|
653
870
|
/** Real Anthropic thinking-block signature; see {@link TextResponse.reasoningSignature}. */
|
|
654
871
|
reasoningSignature?: string;
|
|
@@ -676,6 +893,8 @@ interface FixtureFileContentWithToolCallsResponse extends ResponseOverrides {
|
|
|
676
893
|
content?: string | Record<string, unknown> | unknown[];
|
|
677
894
|
/** See {@link FixtureFileContentWithToolCallsResponse.content} — optional only for the blocks-only shape. */
|
|
678
895
|
toolCalls?: FixtureFileToolCall[];
|
|
896
|
+
/** See {@link ToolCallResponse.customToolCalls}. */
|
|
897
|
+
customToolCalls?: FixtureFileCustomToolCall[];
|
|
679
898
|
/**
|
|
680
899
|
* Optional ordered streaming blocks (mirrors the in-memory
|
|
681
900
|
* {@link ContentWithToolCallsResponse.blocks}). When present, builders stream
|
|
@@ -686,6 +905,8 @@ interface FixtureFileContentWithToolCallsResponse extends ResponseOverrides {
|
|
|
686
905
|
* `blocks` array alone makes this a first-class blocks-only fixture.
|
|
687
906
|
*/
|
|
688
907
|
blocks?: FixtureFileBlock[];
|
|
908
|
+
/** See {@link ContentWithToolCallsResponse.responsesBlocks}. */
|
|
909
|
+
responsesBlocks?: FixtureFileResponsesBlock[];
|
|
689
910
|
reasoning?: string;
|
|
690
911
|
/** Real Anthropic thinking-block signature; see {@link TextResponse.reasoningSignature}. */
|
|
691
912
|
reasoningSignature?: string;
|
|
@@ -714,6 +935,8 @@ interface FixtureFileEntry {
|
|
|
714
935
|
*/
|
|
715
936
|
toolResultContains?: string;
|
|
716
937
|
toolName?: string;
|
|
938
|
+
/** Mirrors the runtime FixtureMatch.toolNamespace. */
|
|
939
|
+
toolNamespace?: string;
|
|
717
940
|
model?: string;
|
|
718
941
|
responseFormat?: string;
|
|
719
942
|
sequenceIndex?: number;
|
|
@@ -737,6 +960,7 @@ interface FixtureFileEntry {
|
|
|
737
960
|
streamingProfile?: StreamingProfile;
|
|
738
961
|
recordedTimings?: RecordedTimings;
|
|
739
962
|
replaySpeed?: number;
|
|
963
|
+
misbehavior?: MisbehaviorConfig | MisbehaviorFaultId;
|
|
740
964
|
chaos?: ChaosConfig;
|
|
741
965
|
/** See {@link Fixture.openRouterProcessing}. */
|
|
742
966
|
openRouterProcessing?: boolean;
|
|
@@ -774,9 +998,22 @@ interface JournalEntry {
|
|
|
774
998
|
headers: Record<string, string>;
|
|
775
999
|
body: JournalBody | null;
|
|
776
1000
|
service?: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* Resolved test id of an MCP request (`"__default__"` when none), for an
|
|
1003
|
+
* MCP mount to set. Journal test-id filtering does not read it: it
|
|
1004
|
+
* re-derives the id from the headers and path (`journalEntryTestId`).
|
|
1005
|
+
*/
|
|
1006
|
+
testId?: string;
|
|
1007
|
+
/** Resolved context of an MCP request, `null` when none; for an MCP mount to set. */
|
|
1008
|
+
context?: string | null;
|
|
777
1009
|
response: {
|
|
778
1010
|
status: number;
|
|
779
1011
|
fixture: Fixture | null;
|
|
1012
|
+
/** For an MCP mount to set on `tools/call` entries a fake answered or failed. */
|
|
1013
|
+
mcpFake?: {
|
|
1014
|
+
id: string | null;
|
|
1015
|
+
outcome: McpFakeOutcome;
|
|
1016
|
+
};
|
|
780
1017
|
/**
|
|
781
1018
|
* What was going to serve this request. "fixture" = a fixture matched (or
|
|
782
1019
|
* would have, before chaos intervened). "proxy" = no fixture matched and
|
|
@@ -796,14 +1033,21 @@ interface JournalEntry {
|
|
|
796
1033
|
interrupted?: boolean;
|
|
797
1034
|
interruptReason?: string;
|
|
798
1035
|
/**
|
|
799
|
-
* The
|
|
800
|
-
*
|
|
801
|
-
*
|
|
1036
|
+
* The error message of a failed request, set in two cases:
|
|
1037
|
+
* - The request failed before any content was sent, and `status` is 500:
|
|
1038
|
+
* a fixture tool-call error (HTTP or WebSocket), or any builder error on
|
|
1039
|
+
* the WebSocket Responses transport.
|
|
1040
|
+
* - The handler crashed AFTER the response completed. The client received
|
|
1041
|
+
* `status` in full, so this is not an interruption.
|
|
802
1042
|
*/
|
|
803
1043
|
error?: string;
|
|
804
1044
|
chaosAction?: ChaosAction;
|
|
1045
|
+
/** Full prepared fault output; interrupted delivery is recorded separately above. */
|
|
1046
|
+
misbehavior?: MisbehaviorSummary;
|
|
805
1047
|
/** When the X-AIMock-Strict header overrode the server default. */
|
|
806
1048
|
strictOverride?: boolean;
|
|
1049
|
+
/** MR8 / MR11 / MR14: why a forwarded MCP record-mode message was not recorded. */
|
|
1050
|
+
recordSkipped?: string;
|
|
807
1051
|
};
|
|
808
1052
|
}
|
|
809
1053
|
/**
|
|
@@ -868,9 +1112,18 @@ interface SSEChoice {
|
|
|
868
1112
|
/** OpenRouter raw upstream finish reason, alongside the normalized one. */
|
|
869
1113
|
native_finish_reason?: string | null;
|
|
870
1114
|
}
|
|
1115
|
+
/** OpenRouter text reasoning detail, paired with the same logical reasoning text. */
|
|
1116
|
+
interface ReasoningTextDetail {
|
|
1117
|
+
type: "reasoning.text";
|
|
1118
|
+
text: string;
|
|
1119
|
+
format: "unknown";
|
|
1120
|
+
index: number;
|
|
1121
|
+
}
|
|
871
1122
|
interface SSEDelta {
|
|
872
1123
|
role?: string;
|
|
873
1124
|
content?: string | null;
|
|
1125
|
+
reasoning?: string;
|
|
1126
|
+
reasoning_details?: ReasoningTextDetail[];
|
|
874
1127
|
reasoning_content?: string;
|
|
875
1128
|
tool_calls?: SSEToolCallDelta[];
|
|
876
1129
|
}
|
|
@@ -917,6 +1170,7 @@ interface ChatCompletionMessage {
|
|
|
917
1170
|
role: string;
|
|
918
1171
|
content: string | null;
|
|
919
1172
|
refusal: string | null;
|
|
1173
|
+
reasoning_details?: ReasoningTextDetail[];
|
|
920
1174
|
reasoning_content?: string;
|
|
921
1175
|
/**
|
|
922
1176
|
* OpenRouter emits `reasoning` (null when absent) on the response message.
|
|
@@ -1039,6 +1293,8 @@ interface FalRecordConfig {
|
|
|
1039
1293
|
/** Total budget for an upstream queue walk before aborting. Default: 900000ms (15 min) to accommodate video generation. */
|
|
1040
1294
|
timeoutMs?: number;
|
|
1041
1295
|
}
|
|
1296
|
+
/** See {@link MockServerOptions.responsesTools}. */
|
|
1297
|
+
type ResponsesToolsMode = "legacy" | "extended";
|
|
1042
1298
|
interface MockServerOptions {
|
|
1043
1299
|
live?: LiveOptions;
|
|
1044
1300
|
/** Optional inbound test-client access keys. Omit to preserve permissive behavior. */
|
|
@@ -1050,11 +1306,51 @@ interface MockServerOptions {
|
|
|
1050
1306
|
replaySpeed?: number;
|
|
1051
1307
|
/** Log verbosity. CLI default is "info"; programmatic default (when omitted) is "silent". */
|
|
1052
1308
|
logLevel?: "silent" | "warn" | "info" | "debug";
|
|
1309
|
+
/**
|
|
1310
|
+
* Opt in to model misbehavior. Without it, the `misbehavior` option, a
|
|
1311
|
+
* fixture's `misbehavior` key and the `X-AIMock-Misbehavior` header are
|
|
1312
|
+
* ignored, as in 1.44.0. CLI: `--misbehavior`.
|
|
1313
|
+
*
|
|
1314
|
+
* When on, addFixture, addFixtures and prependFixture store a per-addition
|
|
1315
|
+
* copy, so getFixtures()[i] is the copy. findByFixture, the match-count APIs
|
|
1316
|
+
* and journal entry.response.fixture still name the caller's object. A field
|
|
1317
|
+
* assigned on that object later (for example `fixture.response = ...`) has no
|
|
1318
|
+
* effect; add the fixture again. When off, the caller's object is stored.
|
|
1319
|
+
*/
|
|
1320
|
+
enableMisbehavior?: boolean;
|
|
1321
|
+
/** Server-wide misbehavior baseline; read only with `enableMisbehavior: true`. */
|
|
1322
|
+
misbehavior?: MisbehaviorConfig | MisbehaviorFaultId;
|
|
1053
1323
|
chaos?: ChaosConfig;
|
|
1054
1324
|
/** Enable Prometheus-compatible /metrics endpoint. */
|
|
1055
1325
|
metrics?: boolean;
|
|
1056
1326
|
/** Strict mode: return 503 instead of 404 when no fixture matches. */
|
|
1057
1327
|
strict?: boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* Reject fixture tool calls whose `arguments` are not valid JSON instead of
|
|
1330
|
+
* serving them as `{}`. Off by default (the 1.44.0 behavior). When on, wires
|
|
1331
|
+
* that carry arguments as an object (Anthropic and Bedrock non-streaming,
|
|
1332
|
+
* Converse non-streaming, Gemini, Vertex AI, Gemini Interactions
|
|
1333
|
+
* non-streaming, Gemini Live, Ollama) answer 500 `aimock_invalid_tool_arguments`
|
|
1334
|
+
* (Gemini Live: an error frame), and wires that carry them as a string
|
|
1335
|
+
* (Cohere and the streaming Anthropic, Bedrock, Converse and Gemini
|
|
1336
|
+
* Interactions paths) serve the authored text unchanged.
|
|
1337
|
+
*/
|
|
1338
|
+
strictToolArguments?: boolean;
|
|
1339
|
+
/**
|
|
1340
|
+
* OpenAI Responses tool handling. `"legacy"` (the default) matches,
|
|
1341
|
+
* counts and journals Responses requests exactly as earlier releases did:
|
|
1342
|
+
* only top-level function tools are visible, custom tool call history is not
|
|
1343
|
+
* counted, and a `namespace` on a `toolCalls` entry or `toolCall` block is
|
|
1344
|
+
* not emitted. `"extended"` makes namespaced, custom and `additional_tools`
|
|
1345
|
+
* / `tool_search_output` tools visible to `toolName` and predicates, counts
|
|
1346
|
+
* custom tool call rounds for `turnIndex` / `hasToolResult` / `toolCallId`,
|
|
1347
|
+
* emits fixture namespaces, applies `match.toolNamespace`,
|
|
1348
|
+
* `customToolCalls` and `responsesBlocks` (which `"legacy"` ignores), and
|
|
1349
|
+
* makes the recorder keep namespaces and custom tool calls. The mode is
|
|
1350
|
+
* fixed when the server starts; changing `responsesTools` on the options
|
|
1351
|
+
* object after `createServer` or `LLMock.start()` is unsupported.
|
|
1352
|
+
*/
|
|
1353
|
+
responsesTools?: ResponsesToolsMode;
|
|
1058
1354
|
/** Record-and-replay: proxy unmatched requests to upstream and save fixtures. */
|
|
1059
1355
|
record?: RecordConfig;
|
|
1060
1356
|
/**
|
|
@@ -1169,6 +1465,9 @@ interface FalQueueConfig {
|
|
|
1169
1465
|
pollsBeforeCompleted?: number;
|
|
1170
1466
|
}
|
|
1171
1467
|
interface HandlerDefaults {
|
|
1468
|
+
/** Present only when misbehavior is enabled; without it no fault is planned. */
|
|
1469
|
+
misbehavior?: MisbehaviorScope;
|
|
1470
|
+
misbehaviorCounters?: MisbehaviorCounters;
|
|
1172
1471
|
latency: number;
|
|
1173
1472
|
chunkSize: number;
|
|
1174
1473
|
replaySpeed: number;
|
|
@@ -1186,6 +1485,10 @@ interface HandlerDefaults {
|
|
|
1186
1485
|
registry?: MetricsRegistry;
|
|
1187
1486
|
record?: RecordConfig;
|
|
1188
1487
|
strict?: boolean;
|
|
1488
|
+
/** See {@link MockServerOptions.strictToolArguments}. */
|
|
1489
|
+
strictToolArguments?: boolean;
|
|
1490
|
+
/** See {@link MockServerOptions.responsesTools}. Absent means `"legacy"`. */
|
|
1491
|
+
responsesTools?: ResponsesToolsMode;
|
|
1189
1492
|
requestTransform?: (req: ChatCompletionRequest) => ChatCompletionRequest;
|
|
1190
1493
|
falQueue?: FalQueueConfig;
|
|
1191
1494
|
openRouterVideo?: FalQueueConfig;
|
|
@@ -1200,7 +1503,215 @@ interface HandlerDefaults {
|
|
|
1200
1503
|
*/
|
|
1201
1504
|
bytePlusVideo?: FalQueueConfig;
|
|
1202
1505
|
}
|
|
1203
|
-
|
|
1506
|
+
/**
|
|
1507
|
+
* Block scope: `"shared"`, or exact test id and/or context (at least one;
|
|
1508
|
+
* `{}` is not a scope). Readonly: validated scopes are frozen.
|
|
1509
|
+
*/
|
|
1510
|
+
type McpFakeScope = "shared" | Readonly<{
|
|
1511
|
+
testId: string;
|
|
1512
|
+
context?: string;
|
|
1513
|
+
}> | Readonly<{
|
|
1514
|
+
testId?: string;
|
|
1515
|
+
context: string;
|
|
1516
|
+
}>;
|
|
1517
|
+
/**
|
|
1518
|
+
* `T` with every nested property and array read-only: the type of a value the
|
|
1519
|
+
* MCP fakes store deep-freezes before it hands it out.
|
|
1520
|
+
*/
|
|
1521
|
+
type McpFakeDeepReadonly<T> = T extends ((...args: never[]) => unknown) ? T : T extends object ? { readonly [K in keyof T]: McpFakeDeepReadonly<T[K]> } : T;
|
|
1522
|
+
/** MCP `Annotations` on a content block. */
|
|
1523
|
+
interface McpFakeAnnotations {
|
|
1524
|
+
audience?: Array<"user" | "assistant">;
|
|
1525
|
+
/** From 0 (least) to 1 (most important). */
|
|
1526
|
+
priority?: number;
|
|
1527
|
+
/** RFC 3339 date-time with seconds and a `Z` or `±hh:mm` offset. */
|
|
1528
|
+
lastModified?: string;
|
|
1529
|
+
}
|
|
1530
|
+
/** MCP `Icon` on a `resource_link` content block. */
|
|
1531
|
+
interface McpFakeIcon {
|
|
1532
|
+
src: string;
|
|
1533
|
+
mimeType?: string;
|
|
1534
|
+
sizes?: string[];
|
|
1535
|
+
theme?: "light" | "dark";
|
|
1536
|
+
}
|
|
1537
|
+
/** MCP `TextResourceContents` / `BlobResourceContents`: exactly one of `text` / `blob`. */
|
|
1538
|
+
type McpFakeResourceContents = {
|
|
1539
|
+
uri: string;
|
|
1540
|
+
mimeType?: string;
|
|
1541
|
+
_meta?: Record<string, unknown>;
|
|
1542
|
+
} & ({
|
|
1543
|
+
text: string;
|
|
1544
|
+
blob?: never;
|
|
1545
|
+
} | {
|
|
1546
|
+
blob: string;
|
|
1547
|
+
text?: never;
|
|
1548
|
+
});
|
|
1549
|
+
type McpFakeContentCommon = {
|
|
1550
|
+
annotations?: McpFakeAnnotations;
|
|
1551
|
+
_meta?: Record<string, unknown>;
|
|
1552
|
+
};
|
|
1553
|
+
/** One MCP content block of a tool result (`ContentBlock`); `data` and `blob` are base64. */
|
|
1554
|
+
type McpFakeContentBlock = McpFakeContentCommon & ({
|
|
1555
|
+
type: "text";
|
|
1556
|
+
text: string;
|
|
1557
|
+
} | {
|
|
1558
|
+
type: "image";
|
|
1559
|
+
data: string;
|
|
1560
|
+
mimeType: string;
|
|
1561
|
+
} | {
|
|
1562
|
+
type: "audio";
|
|
1563
|
+
data: string;
|
|
1564
|
+
mimeType: string;
|
|
1565
|
+
} | {
|
|
1566
|
+
type: "resource_link";
|
|
1567
|
+
uri: string;
|
|
1568
|
+
name: string;
|
|
1569
|
+
title?: string;
|
|
1570
|
+
description?: string;
|
|
1571
|
+
mimeType?: string;
|
|
1572
|
+
size?: number;
|
|
1573
|
+
icons?: McpFakeIcon[];
|
|
1574
|
+
} | {
|
|
1575
|
+
type: "resource";
|
|
1576
|
+
resource: McpFakeResourceContents;
|
|
1577
|
+
});
|
|
1578
|
+
/** A full MCP `CallToolResult`, served unchanged. No other keys. */
|
|
1579
|
+
interface McpFakeFullResult {
|
|
1580
|
+
content: McpFakeContentBlock[];
|
|
1581
|
+
isError?: boolean;
|
|
1582
|
+
structuredContent?: Record<string, unknown>;
|
|
1583
|
+
_meta?: Record<string, unknown>;
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Structured data: any JSON object without the `CallToolResult`
|
|
1587
|
+
* keys, served as text plus `structuredContent`.
|
|
1588
|
+
*/
|
|
1589
|
+
type McpFakeStructuredResult = Record<string, unknown> & {
|
|
1590
|
+
content?: never;
|
|
1591
|
+
isError?: never;
|
|
1592
|
+
structuredContent?: never;
|
|
1593
|
+
_meta?: never;
|
|
1594
|
+
};
|
|
1595
|
+
/**
|
|
1596
|
+
* A call entry's `result` value. Validation also checks what the type cannot
|
|
1597
|
+
* say: base64 `data` / `blob`, `priority` from 0 to 1, the `lastModified`
|
|
1598
|
+
* format, and plain JSON throughout. Unknown keys inside a content item are
|
|
1599
|
+
* allowed and served as given.
|
|
1600
|
+
*/
|
|
1601
|
+
type McpFakeResult = string | McpFakeContentBlock[] | McpFakeFullResult | McpFakeStructuredResult;
|
|
1602
|
+
/** How a call entry matches: exactly one of `args` / `anyArgs`. */
|
|
1603
|
+
type McpFakeCallMatch = {
|
|
1604
|
+
args: Record<string, unknown>;
|
|
1605
|
+
anyArgs?: never;
|
|
1606
|
+
} | {
|
|
1607
|
+
anyArgs: true;
|
|
1608
|
+
args?: never;
|
|
1609
|
+
};
|
|
1610
|
+
/** What a call entry answers: exactly one of `result` / `error`. */
|
|
1611
|
+
type McpFakeCallAnswer = {
|
|
1612
|
+
result: McpFakeResult;
|
|
1613
|
+
error?: never;
|
|
1614
|
+
} | {
|
|
1615
|
+
error: string;
|
|
1616
|
+
result?: never;
|
|
1617
|
+
};
|
|
1618
|
+
/** One ordered answer for a tool. */
|
|
1619
|
+
type McpFakeCall = McpFakeCallMatch & McpFakeCallAnswer & {
|
|
1620
|
+
id?: string;
|
|
1621
|
+
/** FA3: the notifications the upstream sent on the call's stream before the response. */
|
|
1622
|
+
notifications?: McpFakeNotification[];
|
|
1623
|
+
/** FA4: the recorded response time in ms (a number >= 0). */
|
|
1624
|
+
durationMs?: number;
|
|
1625
|
+
};
|
|
1626
|
+
/** One faked tool in a block. */
|
|
1627
|
+
interface McpFakeTool {
|
|
1628
|
+
name: string;
|
|
1629
|
+
description?: string;
|
|
1630
|
+
inputSchema?: Record<string, unknown>;
|
|
1631
|
+
calls: McpFakeCall[];
|
|
1632
|
+
}
|
|
1633
|
+
/** One `mcpFakes` block. */
|
|
1634
|
+
interface McpFakeBlock {
|
|
1635
|
+
scope: McpFakeScope;
|
|
1636
|
+
mount?: string;
|
|
1637
|
+
undeclaredTools?: McpFakeUndeclaredPolicy;
|
|
1638
|
+
tools: McpFakeTool[];
|
|
1639
|
+
/** FA1: the recorded `tools/list` (MCP `Tool` objects, kept verbatim). */
|
|
1640
|
+
list?: Record<string, unknown>[];
|
|
1641
|
+
/** FA2: provenance of a recording. Never used for matching. */
|
|
1642
|
+
recorded?: McpFakeRecorded;
|
|
1643
|
+
/** FA5: `"recorded"` (default) plays FA3/FA4 timing; `"immediate"` ignores it. */
|
|
1644
|
+
timing?: "recorded" | "immediate";
|
|
1645
|
+
}
|
|
1646
|
+
/** FA2 `recorded`: where and when a block was recorded. */
|
|
1647
|
+
interface McpFakeRecorded {
|
|
1648
|
+
/** The upstream origin only. */
|
|
1649
|
+
upstream: string;
|
|
1650
|
+
protocolVersion: string;
|
|
1651
|
+
serverInfo?: Record<string, unknown>;
|
|
1652
|
+
aimockVersion: string;
|
|
1653
|
+
/** ISO 8601 date-time with seconds and an offset. */
|
|
1654
|
+
at: string;
|
|
1655
|
+
}
|
|
1656
|
+
/** MR1 `MCPMock.enableRecording` options. */
|
|
1657
|
+
interface McpRecordConfig {
|
|
1658
|
+
upstream: string;
|
|
1659
|
+
fixturePath?: string;
|
|
1660
|
+
proxyOnly?: boolean;
|
|
1661
|
+
maxRecordBufferBytes?: number;
|
|
1662
|
+
/** MR14 `"Name: value"`; env AIMOCK_MCP_UPSTREAM_AUTH (AM6). */
|
|
1663
|
+
upstreamAuth?: string;
|
|
1664
|
+
/** S2 (d); env AIMOCK_RECORD_SECRET_VALUES (newline-separated). */
|
|
1665
|
+
secretValues?: string[];
|
|
1666
|
+
/** MR5 (b): the server's strict default; X-AIMock-Strict still overrides per request. */
|
|
1667
|
+
strict?: boolean;
|
|
1668
|
+
}
|
|
1669
|
+
/** FA3: one recorded notification of a call entry. */
|
|
1670
|
+
interface McpFakeNotification {
|
|
1671
|
+
atMs: number;
|
|
1672
|
+
method: string;
|
|
1673
|
+
params: Record<string, unknown>;
|
|
1674
|
+
}
|
|
1675
|
+
type McpFakeUndeclaredPolicy = "allow" | "deny";
|
|
1676
|
+
/**
|
|
1677
|
+
* The resolved identity of one MCP request: test id, context and undeclared
|
|
1678
|
+
* override, each from the request or else from the session.
|
|
1679
|
+
* `null` means "not supplied". The identity shape the fake store's matching
|
|
1680
|
+
* methods take (`applicable`, `selectTier`, `claim`, `policy`, `declaredTools`,
|
|
1681
|
+
* `listTools`).
|
|
1682
|
+
*/
|
|
1683
|
+
interface McpFakeIdentity {
|
|
1684
|
+
testId: string | null;
|
|
1685
|
+
context: string | null;
|
|
1686
|
+
undeclared: McpFakeUndeclaredPolicy | null;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* One raw block as a loader hands it off, before validation. `source` is the
|
|
1690
|
+
* entry-id source string; `blockIndex` is `null` when `mcpFakes` is a single object.
|
|
1691
|
+
*/
|
|
1692
|
+
interface McpFakeSource {
|
|
1693
|
+
source: string;
|
|
1694
|
+
blockIndex: number | null;
|
|
1695
|
+
raw: unknown;
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* `response.mcpFake.outcome` on a `tools/call` journal entry. `evicted`:
|
|
1699
|
+
* the request's test id lost its consumption state to the FIFO test-id cap.
|
|
1700
|
+
*/
|
|
1701
|
+
type McpFakeOutcome = "answered" | "mismatch" | "exhausted" | "not_declared" | "evicted";
|
|
1702
|
+
/**
|
|
1703
|
+
* JSON-RPC error codes of the four fake failures, keyed by
|
|
1704
|
+
* `error.data.aimock.code`. `-31010` and `-31011` sit outside the JSON-RPC
|
|
1705
|
+
* reserved range. `MCP_FAKE_EVICTED` is for a lookup of a declared tool by a
|
|
1706
|
+
* test id whose state the FIFO test-id cap evicted, until it is reset.
|
|
1707
|
+
*/
|
|
1708
|
+
declare const MCP_FAKE_ERROR_CODES: {
|
|
1709
|
+
readonly MCP_FAKE_NOT_DECLARED: -32602;
|
|
1710
|
+
readonly MCP_FAKE_MISMATCH: -32602;
|
|
1711
|
+
readonly MCP_FAKE_EXHAUSTED: -31010;
|
|
1712
|
+
readonly MCP_FAKE_EVICTED: -31011;
|
|
1713
|
+
};
|
|
1714
|
+
type McpFakeErrorCode = keyof typeof MCP_FAKE_ERROR_CODES;
|
|
1204
1715
|
//#endregion
|
|
1205
|
-
export { ApiKeyAuthConfig, AudioResponse, ChaosAction, ChaosConfig, ChaosDefaults, ChatCompletion, ChatCompletionChoice, ChatCompletionMessage, ChatCompletionRequest, ChatMessage, ContentPart, ContentWithToolCallsResponse, EmbeddingFixtureOpts, EmbeddingResponse, ErrorResponse, FalQueueOpts, Fixture, FixtureBlock, FixtureFile, FixtureFileBlock, FixtureFileContentWithToolCallsResponse, FixtureFileEntry, FixtureFileResponse, FixtureFileTextResponse, FixtureFileToolCall, FixtureFileToolCallResponse, FixtureMatch, FixtureOpts, FixtureResponse, HandlerDefaults, ImageItem, ImageResponse, JournalBody, JournalEntry, MockServerOptions, Mountable, RawJSONResponse, RecordConfig, RecordProviderKey, RecordedTimings, ResponseFactory, ResponseOverrides, SSEChoice, SSEChunk, SSEDelta, SSEToolCallDelta, StreamingProfile, TextResponse, ToolCall, ToolCallMessage, ToolCallResponse, ToolDefinition, TranscriptionResponse, VideoResponse, VoiceDesignPreview, VoiceDesignResponse };
|
|
1716
|
+
export { ApiKeyAuthConfig, AudioResponse, ChaosAction, ChaosConfig, ChaosDefaults, ChatCompletion, ChatCompletionChoice, ChatCompletionMessage, ChatCompletionRequest, ChatMessage, ContentPart, ContentWithToolCallsResponse, CustomToolCall, CustomToolCallMessage, CustomToolDefinition, EmbeddingFixtureOpts, EmbeddingResponse, ErrorResponse, FalQueueOpts, Fixture, FixtureBlock, FixtureFile, FixtureFileBlock, FixtureFileContentWithToolCallsResponse, FixtureFileCustomToolCall, FixtureFileEntry, FixtureFileResponse, FixtureFileResponsesBlock, FixtureFileTextResponse, FixtureFileToolCall, FixtureFileToolCallResponse, FixtureMatch, FixtureOpts, FixtureResponse, FixtureToolCall, HandlerDefaults, ImageItem, ImageResponse, JournalBody, JournalEntry, MCP_FAKE_ERROR_CODES, McpFakeAnnotations, McpFakeBlock, McpFakeCall, McpFakeCallAnswer, McpFakeCallMatch, McpFakeContentBlock, McpFakeDeepReadonly, McpFakeErrorCode, McpFakeFullResult, McpFakeIcon, McpFakeIdentity, McpFakeNotification, McpFakeOutcome, McpFakeRecorded, McpFakeResourceContents, McpFakeResult, McpFakeScope, McpFakeSource, McpFakeStructuredResult, McpFakeTool, McpFakeUndeclaredPolicy, McpRecordConfig, MisbehaviorConfig, MisbehaviorCounterKey, MisbehaviorCounters, MisbehaviorFault, MisbehaviorFaultId, MockServerOptions, Mountable, RawJSONResponse, RecordConfig, RecordProviderKey, RecordedTimings, ResponseFactory, ResponseOverrides, ResponsesFixtureBlock, ResponsesToolsMode, SSEChoice, SSEChunk, SSEDelta, SSEToolCallDelta, StreamingProfile, TextResponse, ToolCall, ToolCallMessage, ToolCallResponse, ToolDefinition, TranscriptionResponse, VideoResponse, VoiceDesignPreview, VoiceDesignResponse, WireId };
|
|
1206
1717
|
//# sourceMappingURL=types.d.ts.map
|