@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
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { FixtureLoadError, FixtureLoadErrorJSON } from "./fixture-loader.cjs";
|
|
2
|
+
import { McpFakeCallAnswer, McpFakeCallMatch, McpFakeDeepReadonly, McpFakeIdentity, McpFakeNotification, McpFakeRecorded, McpFakeScope, McpFakeSource, McpFakeUndeclaredPolicy } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/mcp-fakes.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The finer rules of the recorded `mcpFakes` keys FA1-FA5. A malformed FA key
|
|
8
|
+
* throws `FixtureLoadError` with the rule `mcp-fakes/bad-block:h` (the rule
|
|
9
|
+
* 1.44.0 gave these keys, then unknown), and its message names one of these
|
|
10
|
+
* in brackets after the rule. A recorded file that breaks a `fakes:` rule
|
|
11
|
+
* throws its `mcp-fakes/` value and names none of these.
|
|
12
|
+
*/
|
|
13
|
+
declare const RECORD_REPLAY_LOAD_RULES: readonly ["record-replay/fa-list", "record-replay/fa-recorded", "record-replay/fa-notifications", "record-replay/fa-duration", "record-replay/fa-timing"];
|
|
14
|
+
type RecordReplayLoadRule = (typeof RECORD_REPLAY_LOAD_RULES)[number];
|
|
15
|
+
/** Default `mount` path of a block. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One validated call entry, with its entry id. Deeply frozen: its `args` /
|
|
19
|
+
* `result` are frozen copies of the caller's values (never the caller's objects).
|
|
20
|
+
*/
|
|
21
|
+
type ValidatedCall = Readonly<{
|
|
22
|
+
/**
|
|
23
|
+
* Full entry id: `<source><load>[<block>]:<local>`, where `local` is the
|
|
24
|
+
* user `id` or `<tool>#<index>`.
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/** Position in its tool's `calls`. */
|
|
28
|
+
index: number;
|
|
29
|
+
/** FA3: recorded notifications, in stream order. */
|
|
30
|
+
notifications?: McpFakeDeepReadonly<McpFakeNotification[]>;
|
|
31
|
+
/** FA4: recorded response time in ms. */
|
|
32
|
+
durationMs?: number;
|
|
33
|
+
}> & McpFakeDeepReadonly<McpFakeCallMatch> & McpFakeDeepReadonly<McpFakeCallAnswer>;
|
|
34
|
+
/** One validated tool. Deeply frozen; `inputSchema` is a frozen copy. */
|
|
35
|
+
interface ValidatedTool {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly description?: string;
|
|
38
|
+
readonly inputSchema?: McpFakeDeepReadonly<Record<string, unknown>>;
|
|
39
|
+
readonly calls: readonly ValidatedCall[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Scope tiers, most specific first. A tool's candidate entries come from the
|
|
43
|
+
* first tier with an applicable block that declares it.
|
|
44
|
+
*/
|
|
45
|
+
type McpFakeTier = "testId+context" | "testId" | "context" | "shared";
|
|
46
|
+
/** One validated block. Deeply frozen: the store hands it out as is. */
|
|
47
|
+
interface ValidatedBlock {
|
|
48
|
+
/** Entry-id `source`: the file's source string, or `code#<n>` / `control-api#<n>`. */
|
|
49
|
+
readonly source: string;
|
|
50
|
+
/** Entry-id load suffix: `""` for the first load of a source, `@<k>` for the k-th. */
|
|
51
|
+
readonly load: string;
|
|
52
|
+
/** `null` when `mcpFakes` was a single object. */
|
|
53
|
+
readonly blockIndex: number | null;
|
|
54
|
+
/** `<source><load>[<block>]`. */
|
|
55
|
+
readonly blockId: string;
|
|
56
|
+
readonly scope: McpFakeScope;
|
|
57
|
+
readonly tier: McpFakeTier;
|
|
58
|
+
readonly mount: string;
|
|
59
|
+
readonly undeclaredTools?: McpFakeUndeclaredPolicy;
|
|
60
|
+
readonly tools: readonly ValidatedTool[];
|
|
61
|
+
/** FA1: the recorded `tools/list`, verbatim. */
|
|
62
|
+
readonly list?: McpFakeDeepReadonly<Record<string, unknown>[]>;
|
|
63
|
+
/** FA2: provenance; never used for matching. */
|
|
64
|
+
readonly recorded?: McpFakeDeepReadonly<McpFakeRecorded>;
|
|
65
|
+
/** FA5: `"recorded"` unless the block says `"immediate"`. */
|
|
66
|
+
readonly timing: "recorded" | "immediate";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A validation warning: an `args` entry shadowed by an earlier `anyArgs` entry
|
|
70
|
+
* of the same tool. Errors are `FixtureLoadError` instances.
|
|
71
|
+
*/
|
|
72
|
+
interface McpFakeIssue {
|
|
73
|
+
file: string | null;
|
|
74
|
+
blockId: string | null;
|
|
75
|
+
entryId: string | null;
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
/** A `tools/call` result. */
|
|
79
|
+
type McpFakeCallToolResult = {
|
|
80
|
+
content: unknown[];
|
|
81
|
+
} & Record<string, unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* One declared entry as named in a mismatch claim or a snapshot. Deeply
|
|
84
|
+
* frozen; `args` is a frozen copy.
|
|
85
|
+
*/
|
|
86
|
+
type McpFakeDeclaredEntry = Readonly<{
|
|
87
|
+
id: string;
|
|
88
|
+
consumed: boolean;
|
|
89
|
+
}> & McpFakeDeepReadonly<McpFakeCallMatch>;
|
|
90
|
+
/**
|
|
91
|
+
* What `McpFakeStore.claim` returns. Frozen, as is everything in it that the
|
|
92
|
+
* store owns (`entry`, `block`, `declared`, `matchingIds`); `result` is a
|
|
93
|
+
* fresh mutable copy for the mount to send, and `received` is the caller's
|
|
94
|
+
* `args` value as given (not copied or frozen), or a new `{}` when it was
|
|
95
|
+
* `undefined`.
|
|
96
|
+
*/
|
|
97
|
+
type McpFakeClaim = Readonly<{
|
|
98
|
+
kind: "answer";
|
|
99
|
+
tool: string;
|
|
100
|
+
entry: ValidatedCall;
|
|
101
|
+
block: ValidatedBlock;
|
|
102
|
+
tier: McpFakeTier;
|
|
103
|
+
result: McpFakeCallToolResult;
|
|
104
|
+
}> | Readonly<{
|
|
105
|
+
kind: "mismatch";
|
|
106
|
+
tool: string;
|
|
107
|
+
received: unknown;
|
|
108
|
+
declared: readonly McpFakeDeclaredEntry[];
|
|
109
|
+
firstDifference: string;
|
|
110
|
+
}> | Readonly<{
|
|
111
|
+
kind: "exhausted";
|
|
112
|
+
tool: string;
|
|
113
|
+
received: unknown;
|
|
114
|
+
matchingDeclared: number;
|
|
115
|
+
matchingConsumed: number;
|
|
116
|
+
matchingIds: readonly string[];
|
|
117
|
+
}> | Readonly<{
|
|
118
|
+
/**
|
|
119
|
+
* The test id's consumption state was dropped by the FIFO cap, so
|
|
120
|
+
* which entries it already used is unknown. Fail loud rather than replay
|
|
121
|
+
* an entry; only `resetState(testId)` (or a full reset) clears this. The
|
|
122
|
+
* mark never ages out.
|
|
123
|
+
*/
|
|
124
|
+
kind: "evicted";
|
|
125
|
+
tool: string;
|
|
126
|
+
testId: string;
|
|
127
|
+
maxTestIds: number;
|
|
128
|
+
}> | Readonly<{
|
|
129
|
+
kind: "none";
|
|
130
|
+
}>;
|
|
131
|
+
interface McpFakeToolListing {
|
|
132
|
+
name: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
inputSchema: Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
/** One block of `McpFakeStore.snapshot()`. Deeply frozen. */
|
|
137
|
+
interface McpFakeBlockSnapshot {
|
|
138
|
+
readonly blockId: string;
|
|
139
|
+
readonly source: string;
|
|
140
|
+
readonly mount: string;
|
|
141
|
+
readonly scope: McpFakeScope;
|
|
142
|
+
readonly undeclaredTools: McpFakeUndeclaredPolicy;
|
|
143
|
+
/**
|
|
144
|
+
* The requested test id's consumption state was evicted by the FIFO cap. Its
|
|
145
|
+
* entries then show `consumed: false` because which ones it used is unknown,
|
|
146
|
+
* and a claim from it of a tool an applicable block declares fails as
|
|
147
|
+
* `evicted` until it is reset.
|
|
148
|
+
*/
|
|
149
|
+
readonly evicted: boolean;
|
|
150
|
+
readonly tools: ReadonlyArray<Readonly<{
|
|
151
|
+
name: string;
|
|
152
|
+
entries: readonly McpFakeDeclaredEntry[];
|
|
153
|
+
}>>;
|
|
154
|
+
}
|
|
155
|
+
/** `Omit` over each member of a union. */
|
|
156
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
157
|
+
/**
|
|
158
|
+
* RP2: one `tools/call` on a mount, as its fake event log keeps it. Every
|
|
159
|
+
* `tools/call` is logged, fakes or not.
|
|
160
|
+
*/
|
|
161
|
+
type McpFakeReportEvent = {
|
|
162
|
+
/** Process-wide increasing counter (module-level in mcp-fakes.ts), set by logEvent; orders events across mounts (S4). */
|
|
163
|
+
seq: number;
|
|
164
|
+
tool: string;
|
|
165
|
+
args: unknown;
|
|
166
|
+
context: string | null;
|
|
167
|
+
mount: string;
|
|
168
|
+
} & ({
|
|
169
|
+
outcome: "answered";
|
|
170
|
+
entryId: string;
|
|
171
|
+
} | {
|
|
172
|
+
outcome: "mismatch" | "exhausted" | "not_declared" | "evicted" | "internal_error";
|
|
173
|
+
code: string;
|
|
174
|
+
} | {
|
|
175
|
+
outcome: "unfaked";
|
|
176
|
+
answeredBy: "handler" | "config" | "empty" | "unknown-tool" | "upstream";
|
|
177
|
+
});
|
|
178
|
+
/** What callers pass to logEvent: the event without `seq` (the store assigns it). */
|
|
179
|
+
type McpFakeReportEventInput = DistributiveOmit<McpFakeReportEvent, "seq">;
|
|
180
|
+
/**
|
|
181
|
+
* RP3: this mount's part of a fake report, for one test id and context.
|
|
182
|
+
* `served` and `failures` rows carry `seq`, which the report module sorts on
|
|
183
|
+
* across mounts and strips from the JSON it serves.
|
|
184
|
+
*/
|
|
185
|
+
interface McpFakeReportPart {
|
|
186
|
+
evicted: boolean;
|
|
187
|
+
served: {
|
|
188
|
+
entryId: string;
|
|
189
|
+
mount: string;
|
|
190
|
+
tool: string;
|
|
191
|
+
args: unknown;
|
|
192
|
+
seq: number;
|
|
193
|
+
}[];
|
|
194
|
+
unconsumed: {
|
|
195
|
+
entryId: string;
|
|
196
|
+
mount: string;
|
|
197
|
+
tool: string;
|
|
198
|
+
args?: unknown;
|
|
199
|
+
anyArgs?: true;
|
|
200
|
+
}[];
|
|
201
|
+
unfaked: {
|
|
202
|
+
mount: string;
|
|
203
|
+
tool: string;
|
|
204
|
+
args: unknown;
|
|
205
|
+
answeredBy: string;
|
|
206
|
+
}[];
|
|
207
|
+
failures: {
|
|
208
|
+
code: string;
|
|
209
|
+
mount: string;
|
|
210
|
+
tool: string;
|
|
211
|
+
args: unknown;
|
|
212
|
+
seq: number;
|
|
213
|
+
}[];
|
|
214
|
+
sharedUnconsumed: {
|
|
215
|
+
entryId: string;
|
|
216
|
+
mount: string;
|
|
217
|
+
tool: string;
|
|
218
|
+
}[];
|
|
219
|
+
}
|
|
220
|
+
interface McpFakeAddOrigin {
|
|
221
|
+
/**
|
|
222
|
+
* `file`: blocks keep their `source` and `blockIndex`, and the per-source
|
|
223
|
+
* load counter (`@<k>`) applies.
|
|
224
|
+
* `code` / `control-api`: one run-time addition; every block gets the source
|
|
225
|
+
* `code#<n>` / `control-api#<n>`, whatever `source` it carried. The
|
|
226
|
+
* input is one `mcpFakes` value of that addition: a single item with a null
|
|
227
|
+
* `blockIndex` is the single-object form (no `[<i>]`); otherwise each block
|
|
228
|
+
* is numbered by its position in the input (`[0]`, `[1]`, ...).
|
|
229
|
+
*/
|
|
230
|
+
kind: "file" | "code" | "control-api";
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The origin of an add inside aimock: a public `McpFakeAddOrigin`, or
|
|
234
|
+
* `record`, a run-time addition written by the MCP recorder (MR12), numbered
|
|
235
|
+
* as `code` / `control-api` are, with the source `record#<n>`. Kept off the
|
|
236
|
+
* public `McpFakeAddOrigin`, so that a user `Mountable.addMcpFakes` that
|
|
237
|
+
* switches over its `kind` stays exhaustive.
|
|
238
|
+
*
|
|
239
|
+
* @internal
|
|
240
|
+
*/
|
|
241
|
+
interface McpFakeAddOriginInternal {
|
|
242
|
+
kind: McpFakeAddOrigin["kind"] | "record";
|
|
243
|
+
}
|
|
244
|
+
/** What a successful `McpFakeStore.add` / `Mountable.addMcpFakes` returns. */
|
|
245
|
+
interface McpFakeAddResult {
|
|
246
|
+
/** Shadowed-entry warnings of the added blocks, with their real entry ids. */
|
|
247
|
+
warnings: McpFakeIssue[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* `McpFakesAddError.toJSON()`: the first error's `rule`, `file`, `blockId` and
|
|
251
|
+
* `entryId`, the combined `message`, and every error and warning.
|
|
252
|
+
*/
|
|
253
|
+
interface McpFakesAddErrorJSON extends FixtureLoadErrorJSON {
|
|
254
|
+
name: "McpFakesAddError";
|
|
255
|
+
errors: FixtureLoadErrorJSON[];
|
|
256
|
+
warnings: McpFakeIssue[];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The error a failed add throws. It is a `FixtureLoadError` whose `rule`,
|
|
260
|
+
* `file`, `blockId` and `entryId` are those of the first error, and whose
|
|
261
|
+
* `message` is the first error's message plus the count of the others.
|
|
262
|
+
* `errors` holds every error found in the input, in order (the first
|
|
263
|
+
* included; see `validateBlock` for the checks that stop early), and
|
|
264
|
+
* `warnings` the shadowed-entry warnings of the blocks that passed every
|
|
265
|
+
* check. Both are frozen, non-writable arrays; `toJSON()` returns copies.
|
|
266
|
+
*/
|
|
267
|
+
declare class McpFakesAddError extends FixtureLoadError {
|
|
268
|
+
readonly name = "McpFakesAddError";
|
|
269
|
+
readonly errors: readonly FixtureLoadError[];
|
|
270
|
+
readonly warnings: readonly Readonly<McpFakeIssue>[];
|
|
271
|
+
constructor(errors: readonly FixtureLoadError[], warnings: readonly McpFakeIssue[]);
|
|
272
|
+
toJSON(): McpFakesAddErrorJSON;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The one own-key listing for input data: own, enumerable, string keys.
|
|
276
|
+
* Inherited names (`constructor`, `toString`, `__proto__`) are never listed.
|
|
277
|
+
*
|
|
278
|
+
* @internal
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
|
+
interface McpFakeStoreOptions {
|
|
282
|
+
/**
|
|
283
|
+
* FIFO cap on distinct test ids that keep consumption state; `0` is
|
|
284
|
+
* unbounded. Default 500. A value that is not a non-negative safe integer
|
|
285
|
+
* throws a `RangeError`.
|
|
286
|
+
*/
|
|
287
|
+
maxTestIds?: number;
|
|
288
|
+
}
|
|
289
|
+
interface McpFakeSelection {
|
|
290
|
+
tier: McpFakeTier;
|
|
291
|
+
entries: Array<{
|
|
292
|
+
block: ValidatedBlock;
|
|
293
|
+
entry: ValidatedCall;
|
|
294
|
+
}>;
|
|
295
|
+
}
|
|
296
|
+
declare class McpFakeStore {
|
|
297
|
+
private blocks;
|
|
298
|
+
/** Entry id → the block id that owns it, for every loaded entry. */
|
|
299
|
+
private ids;
|
|
300
|
+
/** Block id → its `source`, for every loaded block. */
|
|
301
|
+
private blockIds;
|
|
302
|
+
/**
|
|
303
|
+
* Consumption state: supplied test id → consumed entry ids. Map insertion
|
|
304
|
+
* order is the FIFO order of the cap.
|
|
305
|
+
*/
|
|
306
|
+
private consumed;
|
|
307
|
+
/** Consumed entry ids for requests with no test id. Never evicted. */
|
|
308
|
+
private untagged;
|
|
309
|
+
/**
|
|
310
|
+
* Test ids whose state the cap evicted. A claim from one of them, of a tool
|
|
311
|
+
* an applicable block declares, is `evicted` until the test id is reset; a
|
|
312
|
+
* mark never ages out, because a forgotten mark would silently replay
|
|
313
|
+
* entries the test id already consumed. Memory stays bounded per evicted
|
|
314
|
+
* test id: one id string, against the entry-id set the cap dropped. The set only grows with distinct test ids, and every
|
|
315
|
+
* reset door clears it (`resetState`, `clear`). A cap of `0` evicts
|
|
316
|
+
* nothing, so marks made under an earlier cap stay until reset.
|
|
317
|
+
*/
|
|
318
|
+
private evicted;
|
|
319
|
+
/**
|
|
320
|
+
* The last `<n>` of `code#<n>` / `control-api#<n>` used by a run-time
|
|
321
|
+
* addition (see `nextRuntimeNumber`). Never rewound.
|
|
322
|
+
*/
|
|
323
|
+
private runtimeAdds;
|
|
324
|
+
/**
|
|
325
|
+
* The `<k>` of `@<k>`: loads per source string, skipping a `@<k>` that a
|
|
326
|
+
* loaded block id already starts (see `add`). Never rewound.
|
|
327
|
+
*/
|
|
328
|
+
private loadCounts;
|
|
329
|
+
private maxTestIds;
|
|
330
|
+
/**
|
|
331
|
+
* RP2 fake event logs: supplied test id → its events, oldest first. Map
|
|
332
|
+
* insertion order is the FIFO order of the test-id cap.
|
|
333
|
+
*/
|
|
334
|
+
private events;
|
|
335
|
+
/** The event log of requests with no test id: a ring of the newest events. */
|
|
336
|
+
private untaggedEvents;
|
|
337
|
+
/** The untagged event log dropped an event (C9). */
|
|
338
|
+
private untaggedOverflow;
|
|
339
|
+
/**
|
|
340
|
+
* C9: test ids whose event log overflowed or was evicted, so their report
|
|
341
|
+
* is incomplete (`evicted: true`). Report-only: `claim`, `snapshot` and
|
|
342
|
+
* `policy` never read it, so tool calls are unchanged.
|
|
343
|
+
*/
|
|
344
|
+
private reportOverflow;
|
|
345
|
+
constructor(options?: McpFakeStoreOptions);
|
|
346
|
+
/**
|
|
347
|
+
* Set the FIFO cap on distinct test ids; an MCP mount can pass the
|
|
348
|
+
* journal's `fixtureCountsMaxTestIdsCap`. A lower cap evicts the oldest test
|
|
349
|
+
* ids at once. `0` is unbounded: nothing is evicted, and test ids already
|
|
350
|
+
* marked evicted stay marked until reset. An invalid cap throws a
|
|
351
|
+
* `RangeError` and leaves the cap unchanged.
|
|
352
|
+
*/
|
|
353
|
+
setMaxTestIds(cap: number): void;
|
|
354
|
+
/**
|
|
355
|
+
* Take one plain-data snapshot of `sources` and `origin` (getters are not
|
|
356
|
+
* run, inherited fields not read, holes, symbol keys, proxies that throw and
|
|
357
|
+
* non-plain objects are errors), validate the whole snapshot, derive entry
|
|
358
|
+
* ids and their counters, check that every block id and every entry id is
|
|
359
|
+
* unique against the mount and inside the input (bad block (f), naming the
|
|
360
|
+
* block that already owns the id and, for a block id, that block's source),
|
|
361
|
+
* then append. Every block is checked,
|
|
362
|
+
* valid or not (no first-stop; `validateBlock` says which checks stop
|
|
363
|
+
* early). On any error, throws one `McpFakesAddError` carrying every error
|
|
364
|
+
* found, and the warnings of the blocks that passed every check, and adds
|
|
365
|
+
* nothing (no counter is consumed); it never throws anything else for a bad
|
|
366
|
+
* input (a throw from a defect in aimock itself is not caught). An empty
|
|
367
|
+
* input, an invalid `origin` or an invalid source item (not an object, an
|
|
368
|
+
* empty `source`, a `blockIndex` that is not `null` or a non-negative
|
|
369
|
+
* integer) is a bad block (i).
|
|
370
|
+
*
|
|
371
|
+
* With `kind: "file"`, consecutive sources with the same `source` string
|
|
372
|
+
* and increasing `blockIndex` form one load (one `@<k>`). A load whose
|
|
373
|
+
* derived block ids a loaded block already has (a file named `"a@2"`
|
|
374
|
+
* starts the ids of `@2`; a file named `"a[0]"` has the id of block 0 of
|
|
375
|
+
* the first load) takes the next free `@<k>`, so a file name never blocks
|
|
376
|
+
* later loads of another source. A file loaded after the block whose id
|
|
377
|
+
* its name spells is still the bad block (f). With a run-time origin,
|
|
378
|
+
* blocks are numbered per `McpFakeAddOrigin`; a block given with a null
|
|
379
|
+
* `blockIndex` keeps the single-object depth limit.
|
|
380
|
+
*/
|
|
381
|
+
add(sources: readonly McpFakeSource[], origin: McpFakeAddOriginInternal): McpFakeAddResult;
|
|
382
|
+
/**
|
|
383
|
+
* The `<n>` for the next run-time add of `kind`: one more than the last one
|
|
384
|
+
* used, skipping any number whose `<kind>#<n>` already starts a loaded block
|
|
385
|
+
* id (and so every entry id of that block). A file source may be spelled
|
|
386
|
+
* `code#1`; without the skip, every later run-time add would collide with it
|
|
387
|
+
* and fail, and a failed add does not advance `<n>`. Blocks loaded after a
|
|
388
|
+
* run-time add still collide with it as usual (the later block fails).
|
|
389
|
+
*/
|
|
390
|
+
private nextRuntimeNumber;
|
|
391
|
+
/**
|
|
392
|
+
* A loaded block id (or one in `pending`, the blocks earlier in the same
|
|
393
|
+
* input) starts with `prefix` and does not go on with a digit, so `prefix`
|
|
394
|
+
* would start a colliding block or entry id (`a@2` is taken by `a@2` and
|
|
395
|
+
* `a@2[0]`, not by `a@23`).
|
|
396
|
+
*/
|
|
397
|
+
private blockIdPrefixTaken;
|
|
398
|
+
/** Unload every fake and its state. The id counters (`<n>`, `<k>`) are kept. */
|
|
399
|
+
clear(): void;
|
|
400
|
+
/**
|
|
401
|
+
* Reset consumption state for one test id, or all. Also clears an
|
|
402
|
+
* `evicted` mark. `MCP_FAKES_DEFAULT_TEST_ID` resets the untagged state as
|
|
403
|
+
* well as an explicit test id of that name. That matches
|
|
404
|
+
* `Journal.clearMatchCounts` (which `LLMock.resetMatchCounts` calls), where
|
|
405
|
+
* untagged requests and an explicit `__default__` share one key.
|
|
406
|
+
*/
|
|
407
|
+
resetState(testId?: string): void;
|
|
408
|
+
/**
|
|
409
|
+
* MR12: mark entries consumed for `testId` (null = untagged), as a claim
|
|
410
|
+
* would. Ids not loaded on this mount are ignored, and so is a test id the
|
|
411
|
+
* cap evicted (its claims fail as `evicted` until it is reset).
|
|
412
|
+
*/
|
|
413
|
+
markConsumed(testId: string | null, entryIds: readonly string[]): void;
|
|
414
|
+
/**
|
|
415
|
+
* AM7/FA1: the `list` of the most specific applicable tier that has one,
|
|
416
|
+
* else null. Inside a tier, the first block in load order with a `list`.
|
|
417
|
+
*/
|
|
418
|
+
recordedList(identity: McpFakeIdentity): readonly Record<string, unknown>[] | null;
|
|
419
|
+
/** FA5 timing and the FA3/FA4 values of an answered entry (for MR15 framing). */
|
|
420
|
+
replayOf(entryId: string): {
|
|
421
|
+
timing: "recorded" | "immediate";
|
|
422
|
+
notifications: readonly McpFakeNotification[];
|
|
423
|
+
durationMs: number | undefined;
|
|
424
|
+
} | null;
|
|
425
|
+
/** C7: true when any loaded call entry has a `notifications/message` (gates logging). */
|
|
426
|
+
hasRecordedLogs(): boolean;
|
|
427
|
+
/**
|
|
428
|
+
* RP2: append one event to the identity's log, with the next process-wide
|
|
429
|
+
* `seq` and its `args` bounded (`MCP_FAKES_MAX_EVENT_ARGS_BYTES`). A log
|
|
430
|
+
* past `MCP_FAKES_MAX_EVENTS_PER_LOG` drops its oldest event and its report
|
|
431
|
+
* says `evicted: true`; a new test id past the test-id cap evicts the
|
|
432
|
+
* oldest test id's log the same way (C9). Never touches consumption state.
|
|
433
|
+
*/
|
|
434
|
+
logEvent(identity: McpFakeIdentity, event: McpFakeReportEventInput): void;
|
|
435
|
+
/**
|
|
436
|
+
* RP3 parts for this mount (report assembly is src/mcp-fakes-report.ts).
|
|
437
|
+
* `served`, `failures` and `unfaked` come from the events whose context is
|
|
438
|
+
* exactly `context`, in `seq` order; `unconsumed` (tiers `testId+context`
|
|
439
|
+
* and `testId`) and `sharedUnconsumed` (tiers `context` and `shared`) are
|
|
440
|
+
* the applicable entries of this store that `testId` has not consumed,
|
|
441
|
+
* labelled with `mount`, the path the store's mock is served at. Every
|
|
442
|
+
* block in the store answers there (`claim` does not read `block.mount`),
|
|
443
|
+
* so none is left out by its own `mount` value: a mock that loaded its own
|
|
444
|
+
* fakes (default mount "/mcp") and is mounted at another path still reports
|
|
445
|
+
* them. Reads only: building a report changes no state.
|
|
446
|
+
*/
|
|
447
|
+
reportPart(testId: string | null, context: string | null, mount: string): McpFakeReportPart;
|
|
448
|
+
/** Every entry id on this mount, in load order. */
|
|
449
|
+
allEntryIds(): string[];
|
|
450
|
+
/** The blocks whose scope matches `identity`, in load order. A frozen list of frozen blocks. */
|
|
451
|
+
applicable(identity: McpFakeIdentity): readonly ValidatedBlock[];
|
|
452
|
+
/** The candidate entries for `tool` from the most specific tier declaring it. */
|
|
453
|
+
selectTier(tool: string, identity: McpFakeIdentity): McpFakeSelection | null;
|
|
454
|
+
/**
|
|
455
|
+
* Find the first unconsumed matching entry of the selected tier (load order,
|
|
456
|
+
* then `calls` order) and mark it consumed, synchronously (no `await`
|
|
457
|
+
* between find and mark), so concurrent calls never share an entry. The
|
|
458
|
+
* result is built and checked to serialize as JSON before the entry is
|
|
459
|
+
* marked, so a result that cannot be sent throws and leaves the entry
|
|
460
|
+
* unconsumed. An `anyArgs` entry answers any `arguments`, a non-object
|
|
461
|
+
* value included; only an `args` entry needs an object.
|
|
462
|
+
*/
|
|
463
|
+
claim(tool: string, args: unknown, identity: McpFakeIdentity): McpFakeClaim;
|
|
464
|
+
/**
|
|
465
|
+
* The undeclared-tool policy, first of: `override` (`null` or omitted falls
|
|
466
|
+
* back to `identity.undeclared`, the request's or session's
|
|
467
|
+
* `X-AIMock-MCP-Undeclared` / `?undeclared=` value) → `deny` when any
|
|
468
|
+
* applicable scoped block says `deny` → `allow`.
|
|
469
|
+
*/
|
|
470
|
+
policy(identity: McpFakeIdentity, override?: McpFakeUndeclaredPolicy | null): McpFakeUndeclaredPolicy;
|
|
471
|
+
/** Tool names any applicable block (any tier) declares, in load order. */
|
|
472
|
+
declaredTools(identity: McpFakeIdentity): string[];
|
|
473
|
+
/**
|
|
474
|
+
* Fake tools for `tools/list`, metadata from the most specific
|
|
475
|
+
* tier declaring each tool; inside that tier, the first block in load order
|
|
476
|
+
* that declares it. A tool with no `inputSchema` lists `{ type: "object" }`.
|
|
477
|
+
* Merging with registered tools is the mount's job.
|
|
478
|
+
*/
|
|
479
|
+
listTools(identity: McpFakeIdentity): McpFakeToolListing[];
|
|
480
|
+
/**
|
|
481
|
+
* For `GET /__aimock/mcp/fakes`: applicable blocks with consumed state for
|
|
482
|
+
* `testId`. For a test id the cap evicted, every block says `evicted: true`.
|
|
483
|
+
* Deeply frozen.
|
|
484
|
+
*/
|
|
485
|
+
snapshot(testId: string | null, context: string | null): readonly McpFakeBlockSnapshot[];
|
|
486
|
+
/** The consumed ids for `testId` (`null`: untagged), without creating state. */
|
|
487
|
+
private stateOf;
|
|
488
|
+
private stateFor;
|
|
489
|
+
/**
|
|
490
|
+
* FIFO cap: evict the oldest test ids until the cap holds, marking each
|
|
491
|
+
* evicted. A cap of `0` evicts nothing. The marks are not capped (see
|
|
492
|
+
* `evicted`).
|
|
493
|
+
*/
|
|
494
|
+
private enforceCap;
|
|
495
|
+
/**
|
|
496
|
+
* The test-id FIFO cap on event logs: evict the oldest logs until the cap
|
|
497
|
+
* holds, marking each in the report-only `reportOverflow` (never `evicted`).
|
|
498
|
+
*/
|
|
499
|
+
private enforceEventCap;
|
|
500
|
+
}
|
|
501
|
+
//# sourceMappingURL=mcp-fakes.d.ts.map
|
|
502
|
+
//#endregion
|
|
503
|
+
export { McpFakeAddOrigin, McpFakeAddOriginInternal, McpFakeAddResult, McpFakeBlockSnapshot, McpFakeDeclaredEntry, McpFakeIssue, McpFakeReportEvent, McpFakeReportPart, McpFakeStore, McpFakesAddError, McpFakesAddErrorJSON, RecordReplayLoadRule };
|
|
504
|
+
//# sourceMappingURL=mcp-fakes.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-fakes.d.cts","names":[],"sources":["../src/mcp-fakes.ts"],"sourcesContent":[],"mappings":"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"}
|