@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/validate-cli.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { build, msg, plainText } from "./message-text.js";
|
|
2
|
+
import { MisbehaviorConfigError, enableHeldFixtureMisbehavior, entryToFixture, hasMcpFakesKey, markFixtureResponsesToolsExtended, renderValidationRef, validateFixtures } from "./fixture-loader.js";
|
|
2
3
|
import { Logger } from "./logger.js";
|
|
4
|
+
import { McpFakeStore, McpFakesAddError, validateMcpFakes } from "./mcp-fakes.js";
|
|
3
5
|
import { readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
6
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
5
7
|
import { format, parseArgs } from "node:util";
|
|
6
8
|
|
|
7
9
|
//#region src/validate-cli.ts
|
|
@@ -45,14 +47,9 @@ import { format, parseArgs } from "node:util";
|
|
|
45
47
|
* directory symlink that points back at a directory already being walked
|
|
46
48
|
* is reported once as a cycle, where the server recurses through it until
|
|
47
49
|
* the kernel returns ELOOP (~32 levels deep) and loads those levels'
|
|
48
|
-
* fixtures over and over.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* every request — and the server loads it without a word. That is a server
|
|
52
|
-
* bug, not a rule this lint may quietly invent an error for, so it is a
|
|
53
|
-
* `[warning]` (which `--strict` promotes to a failure) rather than an
|
|
54
|
-
* error, and the fixture still goes on to the rules exactly as the server
|
|
55
|
-
* would build it.
|
|
50
|
+
* fixtures over and over. Malformed scalar or array matches are rejected
|
|
51
|
+
* before conversion, as they are by the server's fixture loader. The lint
|
|
52
|
+
* reports an entry error and continues validating valid siblings.
|
|
56
53
|
* - Equal: the `validateFixtures` rules themselves, because of the union
|
|
57
54
|
* pass above, and the zero-fixture rule — a run whose inputs yield no
|
|
58
55
|
* fixtures at all is an error here, matching the server's "No fixtures
|
|
@@ -132,6 +129,13 @@ pointing anywhere else is followed, as the server follows it.
|
|
|
132
129
|
Options:
|
|
133
130
|
--strict Treat warnings as errors (exit 1 on warnings)
|
|
134
131
|
--json Emit a JSON report instead of human lines
|
|
132
|
+
--misbehavior Check fixture misbehavior keys, as the server does with
|
|
133
|
+
--misbehavior (without it they are not read)
|
|
134
|
+
--responses-tools <legacy|extended>
|
|
135
|
+
With "extended", check match.toolNamespace,
|
|
136
|
+
customToolCalls and responsesBlocks, as a server with
|
|
137
|
+
--responses-tools extended reads them (default
|
|
138
|
+
"legacy": they are not read)
|
|
135
139
|
-h, --help Show this help message
|
|
136
140
|
-- Stop option parsing; every later argument is a path
|
|
137
141
|
(use this for a path that begins with "-")
|
|
@@ -271,6 +275,7 @@ function nonFixtureSkipReason(file) {
|
|
|
271
275
|
} catch {
|
|
272
276
|
return;
|
|
273
277
|
}
|
|
278
|
+
if (hasMcpFakesKey(parsed)) return void 0;
|
|
274
279
|
const asConfig = aimockConfigDescription(parsed);
|
|
275
280
|
if (asConfig !== void 0) return `not a fixture file — ${asConfig}`;
|
|
276
281
|
if (typeof parsed === "object" && parsed !== null && "fixtures" in parsed) return void 0;
|
|
@@ -428,9 +433,9 @@ function classifyEntry(entry) {
|
|
|
428
433
|
}).map((k) => `"${k}"`).join(" and ")} — ${ENTRY_SHAPE}`
|
|
429
434
|
};
|
|
430
435
|
if (typeof match !== "object" || Array.isArray(match)) return {
|
|
431
|
-
severity: "
|
|
432
|
-
convertible:
|
|
433
|
-
why: `"match" is ${gotText(match)},
|
|
436
|
+
severity: "error",
|
|
437
|
+
convertible: false,
|
|
438
|
+
why: `"match" is ${gotText(match)}, expected an object — ${ENTRY_SHAPE}`
|
|
434
439
|
};
|
|
435
440
|
}
|
|
436
441
|
/**
|
|
@@ -459,7 +464,7 @@ function unexpectedEntryFailure(index, err) {
|
|
|
459
464
|
* cross-file union pass can append them and map its findings back to a file
|
|
460
465
|
* and an entry index.
|
|
461
466
|
*/
|
|
462
|
-
function validateOneFile(file, mention) {
|
|
467
|
+
function validateOneFile(file, mention, source, misbehavior = false, extendedResponsesTools = false) {
|
|
463
468
|
const report = {
|
|
464
469
|
file,
|
|
465
470
|
mention,
|
|
@@ -471,6 +476,7 @@ function validateOneFile(file, mention) {
|
|
|
471
476
|
const sourceIndex = [];
|
|
472
477
|
const runErrors = [];
|
|
473
478
|
const identities = [];
|
|
479
|
+
const mcpFakes = [];
|
|
474
480
|
let raw;
|
|
475
481
|
try {
|
|
476
482
|
raw = readFileSync(file, "utf-8");
|
|
@@ -481,7 +487,8 @@ function validateOneFile(file, mention) {
|
|
|
481
487
|
fixtures,
|
|
482
488
|
indices: sourceIndex,
|
|
483
489
|
identities,
|
|
484
|
-
runErrors
|
|
490
|
+
runErrors,
|
|
491
|
+
mcpFakes
|
|
485
492
|
};
|
|
486
493
|
}
|
|
487
494
|
let parsed;
|
|
@@ -494,20 +501,48 @@ function validateOneFile(file, mention) {
|
|
|
494
501
|
fixtures,
|
|
495
502
|
indices: sourceIndex,
|
|
496
503
|
identities,
|
|
497
|
-
runErrors
|
|
504
|
+
runErrors,
|
|
505
|
+
mcpFakes
|
|
498
506
|
};
|
|
499
507
|
}
|
|
500
|
-
|
|
508
|
+
const fakesDoc = hasMcpFakesKey(parsed) ? parsed : void 0;
|
|
509
|
+
const fixturesLeftOut = fakesDoc !== void 0 && !Object.prototype.hasOwnProperty.call(fakesDoc, "fixtures");
|
|
510
|
+
const badShape = !fixturesLeftOut && (typeof parsed !== "object" || parsed === null || !Array.isArray(parsed.fixtures));
|
|
511
|
+
if (badShape) {
|
|
501
512
|
const asConfig = aimockConfigDescription(parsed);
|
|
502
513
|
setFatal(report, asConfig === void 0 ? "Missing or invalid \"fixtures\" array (expected { \"fixtures\": [...] })" : `Missing or invalid "fixtures" array (expected { "fixtures": [...] }) — this is ${asConfig}`);
|
|
503
|
-
return {
|
|
504
|
-
report,
|
|
505
|
-
fixtures,
|
|
506
|
-
indices: sourceIndex,
|
|
507
|
-
identities,
|
|
508
|
-
runErrors
|
|
509
|
-
};
|
|
510
514
|
}
|
|
515
|
+
if (fakesDoc !== void 0) {
|
|
516
|
+
const fakes = fakesDoc.mcpFakes;
|
|
517
|
+
const validation = validateMcpFakes(fakes, source);
|
|
518
|
+
report.errors.push(...validation.errors.map(loadErrorFinding));
|
|
519
|
+
report.mcpFakeBlocks = 0;
|
|
520
|
+
const recorded = fakesDoc._warnings;
|
|
521
|
+
if (Array.isArray(recorded)) {
|
|
522
|
+
for (const w of recorded) if (typeof w === "string") report.warnings.push({ message: w });
|
|
523
|
+
}
|
|
524
|
+
if (validation.errors.length > 0) report.warnings.push(...validation.warnings.map(issueFinding));
|
|
525
|
+
else if (Array.isArray(fakes)) fakes.forEach((block, blockIndex) => {
|
|
526
|
+
mcpFakes.push({
|
|
527
|
+
source,
|
|
528
|
+
blockIndex,
|
|
529
|
+
raw: block
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
else mcpFakes.push({
|
|
533
|
+
source,
|
|
534
|
+
blockIndex: null,
|
|
535
|
+
raw: fakes
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
if (fixturesLeftOut || badShape) return {
|
|
539
|
+
report,
|
|
540
|
+
fixtures,
|
|
541
|
+
indices: sourceIndex,
|
|
542
|
+
identities,
|
|
543
|
+
runErrors,
|
|
544
|
+
mcpFakes
|
|
545
|
+
};
|
|
511
546
|
let entryIndex = 0;
|
|
512
547
|
const entryLogger = new CollectingLogger((message) => report.warnings.push({
|
|
513
548
|
index: entryIndex,
|
|
@@ -533,10 +568,19 @@ function validateOneFile(file, mention) {
|
|
|
533
568
|
report.warnings.push(finding);
|
|
534
569
|
}
|
|
535
570
|
try {
|
|
536
|
-
|
|
571
|
+
const fixture = entryToFixture(entries[index], entryLogger, void 0, {
|
|
572
|
+
file: source,
|
|
573
|
+
index
|
|
574
|
+
});
|
|
575
|
+
if (misbehavior) enableHeldFixtureMisbehavior(fixture);
|
|
576
|
+
if (extendedResponsesTools) markFixtureResponsesToolsExtended(fixture);
|
|
577
|
+
fixtures.push(fixture);
|
|
537
578
|
sourceIndex.push(index);
|
|
538
579
|
} catch (err) {
|
|
539
|
-
report.errors.push(
|
|
580
|
+
report.errors.push(err instanceof MisbehaviorConfigError ? {
|
|
581
|
+
index,
|
|
582
|
+
message: err.message
|
|
583
|
+
} : unexpectedEntryFailure(index, err));
|
|
540
584
|
}
|
|
541
585
|
}
|
|
542
586
|
report.fixtures = fixtures.length;
|
|
@@ -576,10 +620,22 @@ function validateOneFile(file, mention) {
|
|
|
576
620
|
fixtures,
|
|
577
621
|
indices: sourceIndex,
|
|
578
622
|
identities,
|
|
579
|
-
runErrors
|
|
623
|
+
runErrors,
|
|
624
|
+
mcpFakes
|
|
580
625
|
};
|
|
581
626
|
}
|
|
582
627
|
/**
|
|
628
|
+
* A `FixtureLoadError` from an `mcpFakes` block as a file-level finding (no
|
|
629
|
+
* fixture entry index): its message names the rule, file, block and entry.
|
|
630
|
+
*/
|
|
631
|
+
function loadErrorFinding(err) {
|
|
632
|
+
return { message: err.message };
|
|
633
|
+
}
|
|
634
|
+
/** An L8 shadowed-entry warning as a file-level finding. */
|
|
635
|
+
function issueFinding(issue) {
|
|
636
|
+
return { message: issue.message };
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
583
639
|
* `#<index> ` for a finding that belongs to one entry; empty for a file-level
|
|
584
640
|
* finding, which names no entry (see Finding.index). Shared by the human lines
|
|
585
641
|
* and the failure summary so a reader of either can locate the same entry.
|
|
@@ -654,6 +710,7 @@ function runValidateCli(deps = {}) {
|
|
|
654
710
|
files: [],
|
|
655
711
|
run: {
|
|
656
712
|
fixtures: 0,
|
|
713
|
+
mcpFakeBlocks: 0,
|
|
657
714
|
errors: [message]
|
|
658
715
|
}
|
|
659
716
|
}, null, 2));
|
|
@@ -673,6 +730,11 @@ function runValidateCli(deps = {}) {
|
|
|
673
730
|
type: "boolean",
|
|
674
731
|
default: false
|
|
675
732
|
},
|
|
733
|
+
misbehavior: {
|
|
734
|
+
type: "boolean",
|
|
735
|
+
default: false
|
|
736
|
+
},
|
|
737
|
+
"responses-tools": { type: "string" },
|
|
676
738
|
help: {
|
|
677
739
|
type: "boolean",
|
|
678
740
|
short: "h",
|
|
@@ -695,6 +757,13 @@ function runValidateCli(deps = {}) {
|
|
|
695
757
|
}
|
|
696
758
|
const strict = values.strict === true;
|
|
697
759
|
const json = values.json === true;
|
|
760
|
+
const misbehavior = values.misbehavior === true;
|
|
761
|
+
const responsesTools = values["responses-tools"];
|
|
762
|
+
if (responsesTools !== void 0 && responsesTools !== "legacy" && responsesTools !== "extended") {
|
|
763
|
+
usageError(`invalid --responses-tools "${responsesTools}" (expected "legacy" or "extended").`);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
const extendedResponsesTools = responsesTools === "extended";
|
|
698
767
|
if (paths.length === 0) {
|
|
699
768
|
usageError("no fixture paths given.");
|
|
700
769
|
return;
|
|
@@ -735,7 +804,10 @@ function runValidateCli(deps = {}) {
|
|
|
735
804
|
});
|
|
736
805
|
continue;
|
|
737
806
|
}
|
|
738
|
-
targets.push(
|
|
807
|
+
for (const entry of entries) targets.push({
|
|
808
|
+
...entry,
|
|
809
|
+
source: relative(path, entry.file).split(sep).join("/")
|
|
810
|
+
});
|
|
739
811
|
}
|
|
740
812
|
const mentionKey = (file) => resolve(file);
|
|
741
813
|
const mentionCount = /* @__PURE__ */ new Map();
|
|
@@ -761,6 +833,8 @@ function runValidateCli(deps = {}) {
|
|
|
761
833
|
const reportedBySite = /* @__PURE__ */ new Map();
|
|
762
834
|
const fileIds = /* @__PURE__ */ new Map();
|
|
763
835
|
const runErrors = [];
|
|
836
|
+
const fakeStore = new McpFakeStore();
|
|
837
|
+
let mcpFakeBlocks = 0;
|
|
764
838
|
const siteKey = (fileId, index, severity, kind) => [
|
|
765
839
|
fileId,
|
|
766
840
|
index,
|
|
@@ -788,12 +862,24 @@ function runValidateCli(deps = {}) {
|
|
|
788
862
|
let indices = [];
|
|
789
863
|
let identities = [];
|
|
790
864
|
let fileRunErrors = [];
|
|
865
|
+
let mcpFakes = [];
|
|
791
866
|
const mention = nextMention(target.file);
|
|
792
867
|
try {
|
|
793
|
-
({report, fixtures, indices, identities, runErrors: fileRunErrors} = validateOneFile(target.file, mention));
|
|
868
|
+
({report, fixtures, indices, identities, runErrors: fileRunErrors, mcpFakes} = validateOneFile(target.file, mention, target.source ?? target.file, misbehavior, extendedResponsesTools));
|
|
794
869
|
} catch (err) {
|
|
795
870
|
report = fatalReport(target.file, mention, `Validation failed: ${errText(err)}`);
|
|
796
871
|
}
|
|
872
|
+
if (mcpFakes.length > 0) try {
|
|
873
|
+
const added = fakeStore.add(mcpFakes, { kind: "file" });
|
|
874
|
+
report.mcpFakeBlocks = mcpFakes.length;
|
|
875
|
+
mcpFakeBlocks += mcpFakes.length;
|
|
876
|
+
report.warnings.push(...added.warnings.map(issueFinding));
|
|
877
|
+
} catch (err) {
|
|
878
|
+
if (err instanceof McpFakesAddError) {
|
|
879
|
+
report.errors.push(...err.errors.map(loadErrorFinding));
|
|
880
|
+
report.warnings.push(...err.warnings.map(issueFinding));
|
|
881
|
+
} else report.errors.push({ message: build(msg`mcpFakes check failed: ${plainText(errText(err), Infinity)}`) });
|
|
882
|
+
}
|
|
797
883
|
reports.push(report);
|
|
798
884
|
runErrors.push(...fileRunErrors.map((e) => `${displayName(report)}: ${e}`));
|
|
799
885
|
const fileId = fileIds.size;
|
|
@@ -820,7 +906,7 @@ function runValidateCli(deps = {}) {
|
|
|
820
906
|
let noFixturesLoaded = false;
|
|
821
907
|
const causeAlreadyReported = reports.some((r) => r.fatal !== void 0 || r.errors.length > 0);
|
|
822
908
|
if (union.length === 0) {
|
|
823
|
-
if (!causeAlreadyReported) {
|
|
909
|
+
if (!causeAlreadyReported && mcpFakeBlocks === 0) {
|
|
824
910
|
runErrors.push("No fixtures loaded from any input — the server aborts startup on this under --validate-on-load/--strict");
|
|
825
911
|
noFixturesLoaded = true;
|
|
826
912
|
}
|
|
@@ -885,6 +971,7 @@ function runValidateCli(deps = {}) {
|
|
|
885
971
|
files: reports,
|
|
886
972
|
run: {
|
|
887
973
|
fixtures: union.length,
|
|
974
|
+
mcpFakeBlocks,
|
|
888
975
|
errors: runErrors
|
|
889
976
|
}
|
|
890
977
|
}, null, 2));
|
|
@@ -908,11 +995,14 @@ function runValidateCli(deps = {}) {
|
|
|
908
995
|
logWarning(`${name}: [warning] ${at(w)}${w.message}`);
|
|
909
996
|
emitDetail(w, logWarning);
|
|
910
997
|
}
|
|
911
|
-
if (r.errors.length === 0 && r.warnings.length === 0)
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
998
|
+
if (r.errors.length === 0 && r.warnings.length === 0) {
|
|
999
|
+
const blocks = r.mcpFakeBlocks ?? 0;
|
|
1000
|
+
if (r.fixtures === 0 && blocks === 0 && failed) {
|
|
1001
|
+
const why = noFixturesLoaded ? "see the run-level error" : "the run failed elsewhere";
|
|
1002
|
+
log(`${name}: ${r.fixtures} fixture(s), loaded nothing — ${why}`);
|
|
1003
|
+
} else if (blocks > 0) log(build(msg`${plainText(name, Infinity)}: OK (${r.fixtures} fixture(s), ${blocks} mcpFakes block(s))`));
|
|
1004
|
+
else log(`${name}: OK (${r.fixtures} fixture(s))`);
|
|
1005
|
+
} else log(`${name}: ${r.fixtures} fixture(s), ${r.errors.length} error(s), ${r.warnings.length} warning(s)`);
|
|
916
1006
|
}
|
|
917
1007
|
for (const e of runErrors) logError(`[error] ${e}`);
|
|
918
1008
|
}
|