Repository navigation
[pull] main from CopilotKit:main - #125
Merged
Merged
Conversation
The batches `chaosHit` now mirrors the fine-tuning gate: it rolls through `applyChaosAsync` so `latencyMs` actually delays, sets CORS headers before the roll so a faulted 429/500 carries `Access-Control-Allow-Origin`, and tags the journal context with `service: "batches"` so faulted requests show up under `/__aimock/journal?service=batches`. The four call sites await the gate. Tests cover latency, CORS on fault, and journal tagging.
`POST /v1/batches/{id}/cancel` never read its request body, so node
discarded whatever the client sent and a 12 MB upload answered 200 while
the create route beside it rejects the same bytes. The route now reads
(and discards) the body through `readBody` before the handler runs,
mirroring the fine-tuning cancel route down to the error arm, so the
10 MB ceiling applies to both routes.
`POST /v1/batches` echoes a validated `metadata` object, starts
`request_counts` at `{total: 0, completed: 0, failed: 0}`, and accepts
`/v1/responses`, the fourth member of the SDK's `BatchCreateParams.endpoint`
union (`openai` 4.104.0 `resources/batches.d.ts`). `GET /v1/batches` pages
with `after`/`limit` through the fine-tuning mock's `paginate()` (400 on a
bad `limit` or unknown cursor) and reports `has_more`, `first_id` and
`last_id`. The list is newest-first, the order `paginate()` documents and
the fine-tuning list feeds, so `first_id`/`last_id` name the right ends
and an `after` walk moves away from the newest item.
`paginate()` and `readMetadata()` are exported from `src/fine-tuning.ts`
so the batches mock shares them instead of copying.
Refs #446
`GET /v1/files/{output_file_id}/content` 404'd because `advance()` minted an
id without registering a file. On `completed` the mock stores a real JSONL
file (purpose `batch_output`, `<batch-id>_output.jsonl`) with one line per
input request, driving `custom_id`s and `request_counts` from the uploaded
input file. `/v1/responses` batches get `Response` envelopes via the exported
`buildTextResponse`; chat batches keep the chat.completion shape.
`X-AIMock-Batch-Outcome: completed|failed|expired|cancelled` on create selects
where the batch lands; `failed` populates a single file-level `errors` entry
plus a real `error_file_id`, `expired` stamps `expired_at`, unknown values 400.
Cancel answers `cancelling` and the next retrieve shows `cancelled`;
cancelling a terminal batch is 400. `request_counts.total` is stamped when
the batch enters `in_progress`, so the cancel route and the outcome header
report the same total.
Minted files are serialised incrementally and capped at FILES_MAX_BYTES (a
600 KB input of `{}` lines had minted an 86 MB output file); an over-cap
batch fails instead of storing the file, and `storeFile()` in `files.ts`
becomes the single insert path both `POST /v1/files` and the batches mock use.
The Purposes section said nothing in the mock ever mints a file with a
response-only purpose and that `?purpose=batch_output` always matches
nothing. `src/batches.ts` stores `<batch-id>_output.jsonl` on `completed`
and `<batch-id>_error.jsonl` on `failed`, both with purpose `batch_output`,
so the purpose filter returns them and `GET /v1/files/{id}/content` serves
their JSONL. The paragraph now states that behaviour and limits the "never
minted" claim to the other two response-only purposes.
Red: `grep -n "always matches nothing" docs/files/index.html` matched line 176.
Green: no match; the paragraph names `batch_output` and both filenames.
…routes All statements verified against origin/main 8566501. - [4] Config example and Config Fields table rewritten to the AimockConfig type (src/config-loader.ts:91-111): `services` is `{search,rerank,moderate}` booleans (:106, :317-330), MCP tools / A2A agents / AG-UI fixtures / vector collections are inline arrays under `mcp`/`a2a`/`agui`/`vector` (:36-89), `metrics`/`strict` are top-level (:107-108, :144-145). - [24] `llm.validateOnLoad` removed: not in AimockConfig; it is the llmock bin's `--validate-on-load` flag (src/cli.ts:121). - [25] `streamingProfile` removed from the config table; it is a per-fixture field (src/fixture-loader.ts:101, :893). - [6] `record.providers` documented as upstream base URLs (src/types.ts:1063); new `providerKeys` row (src/types.ts:1064-1076). `aimock --config` passes `config.llm.record` through verbatim (src/config-loader.ts:143) and reads no env; `AIMOCK_PROVIDER_*_KEY` is read only by the llmock bin (src/cli.ts:299, src/provider-auth.ts:253). - [7] `/ready` row: GET returns 200 `{"status":"ready"}` unconditionally (src/server.ts:301, :2714-2719); `/health` per-service body (:2694-2712); `/metrics` 404 when off (:2724-2727); probes bypass API-key auth (:2238-2240). - [26] `/agui/*` and `/vector/*` rows (src/config-loader.ts:287, :311) plus the root service endpoints `/search`, `/v2/rerank`, `/v1/moderations` (src/server.ts:209-211). - (V15) `auth`, `port`, `host`, `agui`, `vector` rows added: `auth.apiKeys` (src/types.ts:1272-1274); `AIMOCK_API_KEYS` env replaces the file's auth when present (src/api-key-auth.ts:93-96, called at config-loader.ts:133); port/host fallbacks (config-loader.ts:136-137). Docker tabs show the image invocation: ENTRYPOINT is `node dist/cli.js` (Dockerfile:36) and `dist/aimock-cli.js` ships in the same image (tsdown.config.ts entry, Dockerfile:32 copies dist/), so `--entrypoint node ... dist/aimock-cli.js --config` runs config-driven mode; verified live against ghcr.io/copilotkit/aimock:latest. Compose: the Dockerfile declares no HEALTHCHECK, so the snippet adds a `wget -qO- /ready` healthcheck (busybox wget present in the image) and `depends_on: aimock: condition: service_healthy`; the health command was run live and reported healthy.
…nd journal filter Docs-only. Every statement below is verified against the code at 8566501. chaos-testing/index.html - Failure Modes gains rateLimit (429, code chaos_ratelimit, Retry-After: 1 plus the static x-ratelimit-* set) and a note that latencyMs is deterministic and awaited before the rates roll: src/chaos.ts:1020-1036, src/sse-writer.ts:165-169, src/server.ts:1348-1371. - New "Chaos Fields" table: the five CHAOS_FIELDS with type and bounds (src/chaos.ts:99-105), the reject-never-clamp rule and per-source rejection behaviour (src/chaos.ts:155-170, src/types.ts:566-578), the once-per-value per-server warning latch and its reset (src/chaos.ts:258-330, src/server.ts:420). - Precedence paragraph names the field-wise merge explicitly (src/chaos.ts:409-452); scope replacement text already present is kept. - CLI Flags now states the --chaos-* flags belong to the llmock bin (package.json bin, src/cli.ts:55-59,97-101,218-257) and the Docker image (Dockerfile:36 ENTRYPOINT dist/cli.js); the aimock bin takes only --config/--port/--host (src/aimock-cli.ts:9-16,86-91), so aimock --config users set llm.chaos in the config file (src/config-loader.ts:99,142) or use POST /__aimock/chaos. npx example switched from `aimock` to `llmock`. - Proxy Mode table gains rateLimit (pre-upstream: src/server.ts:1381-1393). - Journal Tracking lists "rateLimit" with status 429 (src/chaos.ts:1022). control-api/index.html - New "Request Headers" section listing every header the server reads: X-Test-Id (src/helpers.ts:1441-1458, src/server.ts:515-525), X-AIMock-Strict (src/helpers.ts:41-56, strictOverride journal field src/types.ts:913), X-AIMock-Context (src/helpers.ts:1463-1471, src/router.ts:376-381), the five X-AIMock-Chaos-* headers (src/chaos.ts:99-105), X-Request-Id (src/helpers.ts:288-301, src/server.ts:2176-2179); egress stripping per src/recorder.ts:125-160. X-AIMock-Batch-Outcome deliberately excluded (unmerged). - WebSocket caveat: handlers get a spread copy of defaults plus upgradeHeaders at upgrade time (src/server.ts:4421-4447) and no ws handler evaluates chaos (no evaluateChaos/applyChaos call in src/ws-*.ts), so POST /__aimock/chaos affects HTTP only; strict/context are read from upgradeHeaders (src/ws-responses.ts:191,211; src/ws-realtime.ts:921,944; src/ws-gemini-live.ts:371,402). - POST /__aimock/chaos documents all five fields, JSON-number-only values, and each 400 (bad JSON, non-object, unknown field, out-of-range/non-number, blank X-Test-Id); nothing is installed on rejection: src/server.ts:746-808. - Reset routes state that POST /__aimock/reset drops every chaos override and re-arms the chaos warning latch, and that /reset/journal, DELETE /fixtures and DELETE /chaos do not touch the latch: src/server.ts:405-436,710-726,900-916. - Journal params gain ?requestId= (exact match on the recorded x-request-id): src/server.ts:361-371,615,634-636.
…pe and edge behaviour
Every sentence below describes current behaviour, verified against the code
and by a live probe against an LLMock instance on this SHA.
- Drain limit: the over-cap 400 holds only up to FILES_BODY_DRAIN_MAX_BYTES
(src/files.ts:308, = FILES_BODY_MAX_BYTES * 2 = 125,960,192). Past it
readBodyBufferBounded calls req.destroy() and rejects (src/helpers.ts,
readBodyBufferBounded: `if (totalBytes > drainMaxBytes) { req.destroy() ...`),
so the client gets no status and no CORS headers. The "never a dropped
socket" bullet is now bounded by that figure.
- 400 message quoted in full from oversizedBody() (src/files.ts:321):
"Request body exceeds the 62980096 byte upload limit for this route (the
10485760 byte content cap plus worst-case wire encoding overhead)".
- filename*: emitted only when /^[\x20-\x7e]*$/ fails (src/files.ts:244-245);
ASCII fallback is a per-UTF-16-code-unit replace of [^\x20-\x7e] with "_"
plus backslash-escaping of `"` and `\` (src/files.ts:240). The docs said
"every other byte"; the unit is a code unit, not a byte.
- Access-Control-Expose-Headers is "X-Total-Count, X-Request-Id" only
(src/server.ts:330); Content-Disposition and X-Content-Type-Options are
not exposed cross-origin. Probe: content response carried that exact
expose list.
- Method table: PATCH/HEAD/PUT on files paths fall through to the shared
404 { error: { message: "Not found", type: "not_found" } }
(src/server.ts:2759-2768 comment, handleNotFound src/server.ts:345-348).
Probe: PATCH /v1/files 404, HEAD /v1/files 404, PATCH /v1/files/{id} 404.
- Purposes: "exactly as the real API does" softened to the SDK's
FilePurpose type (node_modules/openai/resources/files.d.ts:120,
[email protected]); the live API's runtime answer is unverified
(src/files.ts:222-224 says the same for the content route).
- Tab-only filename: CONTROL_CHARS = /[\x00-\x1f\x7f]/ (src/files.ts:627)
is checked by filenameError() before the trim()==="" blank check on both
paths (src/files.ts:557-559 JSON, 1080-1088 multipart). Probe: "\t" -> 400
"must not contain control characters"; "" and " " -> 200 synthesized
upload-<24 hex>.bin. Test: files-api.test.ts:1399 ("whitespace-only")
uses spaces.
- Journal descriptor regenerated from filesUploadBody()/journalFiles()
(src/files.ts:369-380, 395-412) and JournalEntry (src/types.ts:882-890):
eight body keys (model, messages, _endpointType, purpose, filename,
bytes, content_type, sha256; test files-api.test.ts:1672-1681) inside
id/timestamp/method/path/headers/service/response. 400 entries carry
body: null (src/files.ts:1151,1165,1369,1411; test :1721-1724); the
sample now shows one.
…sing and gate-order claims Every sentence changed states current behaviour, verified against the source at 8566501 and by a live probe (LLMock + fetch + raw socket) on this tree. - reset sample: `LLMock.reset()` is synchronous and returns `this` (src/llmock.ts:492-498); the paging sample no longer awaits it and says so. - Pagination prose: the parser is `/^\d+$/` + `Number.isSafeInteger` (src/fine-tuning.ts:558-562, called from `paginate` :591-607). The old text said the rejected spellings would all be read by `Number()` "at some other value"; `20.0`, `%2B5` and padded `%2020%20` land on the same integer. Now says so, keeps the true 0x10/1e2 cases, and notes leading zeros are accepted digits (`007` pages at 7, probed live). - Create rejections: enumerated every 400 the create handler emits (src/fine-tuning.ts:1179-1298 plus readers: readSuffix :893, readSeed :914, readMetadata :930-965, readIntegration :974-1033, readIntegrations :1035-1050, readMethod :1089-1167, readHyperObject :805-823). Mock-only vs spec-declared is marked per the module header (:79-95): unknown members of hyperparameters / method / a variant / an integrations entry / its wandb object, the 5-entry integrations cap, a stray variant configuration, and the empty-string file ids are ours; required type/grader/project and the numeric ranges are the spec's. The previously missing integrations rejections (type != "wandb", wandb not an object, name/entity, tags, unknown members) are now listed. - Cancel journal: `handleFineTuningCancel` (src/fine-tuning.ts:1368-1398) journals `response.status` 200/404/400 with `body: null` via `journalFt` (:308-323) and no reason field; "Job cancelled by user" is the appended event (:1395), read from /events. Probed live. - Chaos gate order: src/server.ts reads the body first (create :2875, cancel :2843), then the handler rolls `chaosHit` as its first act (:1179, :1378), and only then parses. The gate journals a fixed `body: null` (src/fine-tuning.ts:380) and the entry carries `chaosAction`; the old "rolls before the body is read" reason is replaced. - HTML entities: REFUTED. The raw file has 39 entity references, all valid named/numeric (`—`, `’`, `<`, `☰` ...); no `&lt;` or other double-encoding exists. No change made for this item.
…chors at real ids
Homepage aimock.json sample (docs/docs/index.html "Mock your entire stack"):
the shipped sample used shapes the loader does not accept. startFromConfig
spreads each mcp.tools entry into an MCPToolDefinition (src/config-loader.ts:165-171)
and each a2a.agents entry into an A2AAgentDefinition (src/config-loader.ts:203-206),
so the string entries "search"/"fetch"/"planner" became char-indexed objects with no
name; vector.provider is not a field of VectorConfig (src/config-loader.ts:86-89)
and was silently ignored. Observed with the shipped sample, ./fixtures/llm present:
POST /mcp tools/list -> {"tools":[{"0":"f","1":"e","2":"t","3":"c","4":"h"}]}
GET /a2a/.well-known/agent-card.json -> {"name":"a2a-mock", ...} (no planner)
and with ./fixtures/llm absent the CLI exits 1 (fs.statSync at
src/config-loader.ts:152): "ENOENT: no such file or directory, stat '.../fixtures/llm'".
The sample now uses the loader's real shapes: mcp.tools = [{name, result}]
(MCPConfigTool, src/config-loader.ts:17-19), a2a.agents = [{name}]
(A2AAgentDefinition, src/a2a-types.ts:6-12), vector.collections = [{name, dimension}]
(VectorConfigCollection, src/config-loader.ts:75-84). Observed with the new sample:
node dist/aimock-cli.js --config sample.json --port 4715
[aimock] MCPMock mounted at /mcp / A2AMock mounted at /a2a / VectorMock mounted at /vector
GET /ready -> 200
GET /a2a/.well-known/agent-card.json -> {"name":"planner", ...}
POST /mcp tools/list -> {"tools":[{"name":"search"}]}
Suite table: the Files row already existed (docs/docs/index.html:349-352), so that
part of the report is refuted. Fine-tuning ships on main (routes at
src/server.ts:310-313, dispatched at src/server.ts:2840-2880: create/list/retrieve/
cancel/events; docs/fine-tuning/index.html exists) and had no row; one added.
No batches surface exists in src/ (grep -rln batches src/*.ts -> nothing), none added.
Sidebar anchors: refuted. No entry in the docs/sidebar.js `sections` literal
carries a #fragment (checker: 69 links, 0 with fragment, 0 mismatches, before and
after). The only in-page TOC anchors are generated from the page's own heading ids
(docs/sidebar.js:208), so they cannot diverge. docs/sidebar.js is unchanged.
The one fragment link on the homepage (/fixtures#context) resolves to
id="context" in docs/fixtures/index.html.
Gates: pnpm run format:check exit 0; node --check docs/sidebar.js exit 0.
…s and feature list Every statement below is verified against origin/main 8566501. [8] convert examples: `aimock convert` writes its output with writeFileSync (src/convert.ts:109, and the mockllm path at src/convert.ts:150), so an output argument must be a file path; a directory throws EISDIR. Input differs per format: vidaimock accepts a file or a directory (statSync/isDirectory at src/convert.ts:84-89), mockllm reads one YAML file (readFileSync at src/convert.ts:135). The examples now name a JSON file and the comment states both rules. (src/convert.ts:22-23 CONVERT_HELP carries the same directory example; not touched here, outside README scope.) [9] AIMOCK_PROVIDER_*_KEY: readProviderKeysFromEnv() (src/provider-auth.ts :253-270) is called only from the llmock CLI when it builds `record` (src/cli.ts:299). src/config-loader.ts:143 passes `config.llm?.record` through verbatim and never calls it; src/aimock-cli.ts has no reference. The programmatic option is `record.providerKeys` (RecordConfig, src/types.ts:1076; LLMockOptions.record at src/types.ts:1193). Added a caveat block naming the binary and the JSON/programmatic alternative. [10] provider/surface count: method = count the bullet's own list. Providers (vendors) named in the bullet: OpenAI, Anthropic, Google Gemini, Azure, Bedrock, Vertex AI, Ollama, Cohere, OpenRouter, BytePlus Ark, ElevenLabs = 11. Surfaces named: OpenAI Chat, Responses, Realtime, Claude, Gemini REST, embedContent, Live, Interactions, Azure, Bedrock, Vertex AI, Ollama chat, Ollama embeddings, Cohere chat, Cohere embed, OpenRouter chat, OpenRouter router, BytePlus chat, BytePlus images, ElevenLabs TTS, Voice Design = 21. The Realtime Beta shim no longer counts as a surface (see below). Cross-check: RecordProviderKey (src/types.ts:1045-1060) has 15 keys = 14 vendors plus the gemini-interactions mode; the three not in this bullet (grok, veo, fal) are listed under Multimedia APIs and are now also in the suite table. The drift registry (src/__tests__/drift/surface-registry.ts) has 28 entries but spans images/video/moderation/rerank/transcription, which this bullet does not claim. [28] suite table: LLMock row now lists BytePlus Ark (chat/images via the /api/v3 compat-prefix erasure, src/server.ts:238-270 COMPAT_SUFFIXES and :2197-2198; video src/byteplus-video.ts), Grok (video only, src/grok-video.ts — no chat handler exists), Veo (src/veo-video.ts), fal.ai (src/fal.ts), OpenRouter video (src/openrouter-video.ts), and ElevenLabs TTS/Voice Design (src/elevenlabs-audio.ts, src/elevenlabs-voice.ts). Services row drops ElevenLabs TTS: the `services` config is `{ search, rerank, moderate }` only (src/config-loader.ts:106, 316-328). (b) Realtime Beta: `OpenAI-Beta: realtime=v1` is rejected with the upstream sunset error and close 4000, no session.created (src/ws-realtime.ts:449-531, CHANGELOG #461); wording changed in the suite table and the providers bullet. DALL-E: DEFAULT_IMAGE_MODEL is gpt-image-1 and dall-e-2/3 are gone (src/images.ts:30-36, #459); /v1/images/variations replays the removal 404 (src/images.ts:564-609, #462). Chaos: rateLimitRate/--chaos-ratelimit and latencyMs/ --chaos-latency (src/cli.ts:55-59, src/chaos.ts:100-104, src/types.ts:586-598, 652; #449). Request IDs: X-Request-Id resolved or minted per request (src/server.ts:2176-2178), exposed via CORS (src/server.ts:330), journal filter `requestId` (src/server.ts:362-370, 615, 634-635); minted ids are not forwarded upstream (CHANGELOG #450). Verification: grep-based red/green in scratch s5b/red.txt and green.txt; `pnpm run format:check` exit 0; markdown-link-check reports one dead link, npmjs.com 403, on a pre-existing badge URL not changed here.
Every statement below was checked against src/ and, for CLI output, against a live run of the built CLI (dist/aimock-cli.js, origin/main 8566501). docs/aimock-cli/index.html (validate section only) and README validate lines: - stderr shape. A usage error prints `Error: <reason>`, a blank line and the full subcommand help, in both output modes (src/validate-cli.ts:824-825). Observed: `validate --bogus ./fixtures/` -> exit 1, stderr "Error: Unknown option '--bogus'. ..." + "Usage: aimock validate ...". A failed run under --json prints one stderr line built by src/validate-cli.ts:788: "Error: fixture validation failed — <first finding> [1 unreadable/invalid file(s)]." Replaces "the one-line failure reason goes to stderr" at the two places it appeared. - Run-level message quoted in full (src/validate-cli.ts:1081). Observed on a dir holding only {"fixtures": []}: stderr "[error] No fixtures loaded from any input — the server aborts startup on this under --validate-on-load/--strict", exit 1. Also README:217. - Examples pointed at files that ship. fixtures/openai.json and fixtures/anthropic.json do not exist (ls fixtures/). Observed: `validate --strict ./fixtures/` exits 1 with four cross-file duplicate userMessage warnings (adk/gemini-agent.json vs example-greeting.json; mastra/agent-workflow.json vs langchain/agent-loop.json), and `validate ./fixtures/` exits 0. The strict examples now use fixtures/example-greeting.json + fixtures/examples/llm/ (observed exit 0, six OK lines) and, in README, examples/llm/blocks-tool-first.json (observed exit 0), with a comment saying why the whole tree fails strict. - Which binary accepts a URL. `--fixtures <url>` belongs to the `llmock` bin (package.json bin: llmock -> dist/cli.js; src/cli.ts:22-24, src/fixtures-remote.ts). The `aimock` bin has no --fixtures option at all (src/aimock-cli.ts:9-23 option table) and its --config `llm.fixtures` is resolved with path.resolve (src/config-loader.ts:150-151). Stated next to the quoted "the server's --fixtures accepts a URL" message on both surfaces. - `--json --help` shape documented: `{ "help": "<help text>" }` pretty-printed, exit 0, nothing on stderr (src/validate-cli.ts:869-874; observed). - New "Validation State and Reset" note: validate holds no state and constructs no LLMock/server (its imports are src/validate-cli.ts:99-106), so LLMock.reset() / POST /__aimock/reset neither clear nor affect it. The server runs the same per-fixture rules on the batch it is handed (src/cli.ts:441 startup, src/cli.ts:513 + src/watcher.ts:40 watch reload, src/server.ts:862 POST /__aimock/fixtures -> 400, src/llmock.ts:108 addFixturesFromJSON -> throw), never against fixtures already loaded; a full reset empties fixtures and re-validates nothing (src/server.ts:405-434). docs/control-api/index.html (the page that documents the full reset, of which LLMock.reset() is the in-process equivalent per src/llmock.ts:469-470): - Lists everything performFullReset clears (src/server.ts:405-434): fixtures, fal jobs/queues, ElevenLabs voices, the Files store (clearFileStore), the fine-tuning store, Gemini interaction/event-id counters, journal, the per-server static-chaos warning latch (src/chaos.ts:301-303), the runtime chaos override, video job maps, and the aimock_fixtures_loaded gauge. - LLMock.reset() additionally clears search/rerank/moderation fixtures registered via onSearch/onRerank/onModerate (src/llmock.ts:298-309, 492-497), and the module-global stores are shared across instances.
The CHANGELOG marks breaking changes with a `> **BREAKING** —` blockquote directly under the version heading plus a bold inline marker on the bullet (see 1.14.2). The `aimock -h` flip (#453) sat under Changed with neither. Added the blockquote under [Unreleased] and marked the bullet. Observed on dist/aimock-cli.js @ 8566501: `aimock -h` -> help, exit 0; `aimock -h 0.0.0.0` -> exit 1, stderr "Error: Unexpected argument '0.0.0.0'. This command does not take positional arguments" followed by the help. `llmock --help` still lists `-h, --host <string>` (src/cli.ts:21).
Trim per page (scope-audit OVERREACH hunks): - CHANGELOG: BREAKING `-h` note cut to one terse line - README: Services parenthetical and the two convert comment lines dropped - docs/docs: unrequested Fine-tuning suite-table row dropped - aimock-cli: chaos line out of the sample; config explainer paragraph, /search row, mount-prefix/auth-exempt note, static-key provider list, `--json --help` prose duplicate, reset/validation-points discussion and the four-line --strict comment removed; /health and /metrics cells restored to base; llm row back to base minus the wrong keys - chaos-testing: "Chaos Fields" section, flag table, config sample blocks, field-wise-merge and proxy-latency insertions removed; the base "same rule governs" sentence and the Docker tab header restored - control-api: "Request Headers" section removed (WebSocket paragraph relocated under Chaos, five header names spelled inline), reset/LLMock.reset() prose and the rejection bullet list removed, "Unknown fields and out-of-range values are rejected with 400" restored - files: ext-value parenthetical, quote-escaping clause and stored-name sentence dropped - fine-tuning: leading-zeros aside dropped, metadata folded back into the seed bullet, integrations bullet reduced to the listed rejections, `method` catalogue removed Corrections (verify.md FALSE 1-3): - README Multimedia: only `/v1/images/variations` replays the removal 404 (src/images.ts:562-623); the `dall-e-2`/`dall-e-3` claim is removed - control-api: the "all headers are stripped upstream" intro went with its section; the surviving X-Request-Id text says a caller-supplied id is forwarded as sent (src/recorder.ts:138-142) - chaos-testing: the `aimock` option list includes `-h, --help` (src/aimock-cli.ts:86-91; `node dist/aimock-cli.js --help`) Wording: README "retired ... shape" restated as current behaviour.
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [docker/setup-buildx-action](https://redirect.github.com/docker/setup-buildx-action) | action | patch | `v4.4.0` → `v4.4.1` | --- ### Release Notes <details> <summary>docker/setup-buildx-action (docker/setup-buildx-action)</summary> ### [`v4.4.1`](https://redirect.github.com/docker/setup-buildx-action/compare/v4.4.0...v4.4.1) [Compare Source](https://redirect.github.com/docker/setup-buildx-action/compare/v4.4.0...v4.4.1) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/Los_Angeles) - Branch creation - "before 9am every weekday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/CopilotKit/aimock). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC45My43IiwidXBkYXRlZEluVmVyIjoiNDQuOTQuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Corrects documentation that no longer matched the shipped behaviour, found during the review pass over the contributor PRs (#445, #447, #449, #450, #453, #454). Docs, README and CHANGELOG only, plus one help string in `src/convert.ts`. No behaviour change, no version bump. ## What changed, per page **docs/aimock-cli** - Config example and table match the real `AimockConfig` schema: `services` is `{search, rerank, moderate}` booleans, `mcp`/`a2a` take inline arrays, `metrics`/`strict`/`auth`/`port`/`host`/`agui`/`vector` are top-level. - `record.providers` takes upstream URLs; API keys go in `record.providerKeys`. The `AIMOCK_PROVIDER_*_KEY` environment variables are read only by the `llmock` binary. - `/ready`, `/agui/*` and `/vector/*` added to the routing table. - `llm.validateOnLoad` removed (not a config key); `streamingProfile` moved to a per-fixture note. - Docker tab shows the image invocation; compose example uses a `/ready` healthcheck with `condition: service_healthy`. **README** - `convert` examples write to a file path (a directory fails with EISDIR). - Environment-variable caveat: only `llmock` reads `AIMOCK_PROVIDER_*_KEY`. - Provider and surface counts match the list that follows them. - LLMock suite row names BytePlus Ark, Grok, Veo and fal.ai; Services row names the real `search/rerank/moderate` toggles. - Request-Id propagation and journal filter, and the chaos `rateLimit`/`latency` modes, are listed. Realtime Beta and image-model wording states what the mock does today. **docs/chaos-testing and docs/control-api** - The `rateLimit`, `latency` and `chaosAction` fields are documented with bounds and the reject-never-clamp rule. - Chaos CLI flags are attributed to the `llmock` binary; `aimock --config` users set `llm.chaos`. - `POST /__aimock/chaos` documents all five fields and every 400. - Control header list completed; the journal `requestId` filter added; reset scope for chaos overrides and the warning latch stated. - Chaos applies to HTTP routes; WebSocket handlers do not evaluate it. **docs/files** - Real drain limit and socket behaviour past it; the 400 message quoted in full; which headers `Access-Control-Expose-Headers` exposes; `PATCH`/`HEAD`/`PUT` → 404; ASCII fallback truncation unit; tab-only filename is a 400; journal sample regenerated from the code. **docs/fine-tuning** - `reset()` is synchronous; limit and cursor parsing described as implemented; full create-rejection list with mock-only rejections marked; cancel journal shape; chaos gate order relative to body read. **docs/docs (homepage)** - The `aimock.json` sample loads: string tool entries had been spread into nameless objects and `vector.provider` is not a field. The new sample was booted and answers `/ready`. **CHANGELOG** - The `-h` meaning change (host → help) is marked as breaking. **src/convert.ts** - Help text shows a file path as the `convert` output, matching the README. ## Backlog items checked and left alone - `--config` default and `--port` default rows were already correct. - Relative Docker bind path is accepted by Docker. - Sidebar has no fragment anchors, so there was nothing to mismatch. - The Files row already existed in the homepage suite table. - Fine-tuning page entities were valid. - The WebSocket note was rewritten: handlers never evaluate chaos, so the control API is HTTP-only rather than "new sockets only". ## Verification Every changed sentence, table row and sample was checked against the source or a live run of the built CLI and server: 135 claims verified (61 from code, 74 live), three found false and corrected before this PR. Both config samples boot and serve; the compose healthcheck was run against the published image. A scope audit trimmed the diff to the listed items only.
…ssion (#446) Implements missing POST/GET /v1/batches, GET /v1/batches/{id}, POST /v1/batches/{id}/cancel with validating->in_progress->completed progression, endpoint/window validation, cancel semantics, journal service=batches, chaos gate, metrics normalization, reset clearing. Verified: 4 new tests pass, typecheck/lint clean. **Follow-up hardening on top of the original submission (merged origin/main `cd48255d`):** - Chaos gate runs through `applyChaosAsync` with CORS headers and `service: "batches"` journal tagging. - Cancel body is bounded like create. - Create/list match the real wire shape: shared `paginate()` list pagination (newest-first, `has_more`/`first_id`/`last_id`), validated `metadata`, `request_counts` on every path, `/v1/responses` accepted with Response-object output lines. - Completed batches mint a real `output_file_id` (`<batch-id>_output.jsonl`, purpose `batch_output`) into the Files store so upload → create → poll → download completes; `failed`/`expired`/`cancelled` are reachable via the create-time `X-AIMock-Batch-Outcome` header; failed batches mint an `error_file_id` and one file-level `errors` entry; cancel returns `cancelling` then `cancelled`; over-cap output fails the batch instead of storing a file. - Files docs describe the minted `batch_output` files; CHANGELOG entry added. - Verified: full suite 208 files / 6689 tests green; typecheck, lint, format, build clean.
…and new-provider steps [19] Env vars: the list named 4 keys while the drift legs read 12. Every process.env.* read under src/__tests__/drift/ is now listed with the legs it gates. Sources: openai-chat.drift.ts:34,125; openai-responses.drift.ts:45,129; openai-embeddings.drift.ts:19,33; transcription.drift.ts:58,217; ws-responses.drift.ts:25,61; ws-realtime.drift.ts:40-45,59,116,194 (OPENAI_REALTIME_KEY ?? OPENAI_API_KEY); models.drift.ts:457,471,488; anthropic.drift.ts:35,117,772; gemini.drift.ts:28,42,645; gemini-interactions.drift.ts:31,45; ws-gemini-live.drift.ts:102,232; cohere.drift.ts:31,284; rerank.drift.ts:21,104; openrouter-chat.drift.ts:41,484; openrouter-video.drift.ts:35,253; fal-queue.drift.ts:25,226; elevenlabs.drift.ts:38,205; byteplus-video.drift.ts:64,287 (keyless canary at :181 has no gate); providers.ts:912-916 (ARK_BASE_URL default); ollama.drift.ts:23,32,123 (OLLAMA_MODEL default llama3.2). Every gate is describe.skipIf/it.skipIf, so a missing key skips, never fails. "requires all three API keys" removed as false. [39a] STRICT_DRIFT: grep over src/ and .github/ finds no reader (only DRIFT.md itself). Warnings never fail: legs filter severity === "critical" (openai-chat.drift.ts:165 et al.). The strict-mode example and the "(unless STRICT_DRIFT=1)" clause are removed; no other variable drives strictness. [39b] Builder map listed 13 entries against 28 SURFACE_REGISTRY keys (surface-registry.ts:92-395). Replaced with one sentence pointing at the registry's builderFile/builderFunctions; the `Surface:` marker line is emitted by formatDriftReport (schema.ts:484). [20] Adding a New Provider gained the registry step: formatDriftReport throws on an unregistered slug (schema.ts:470-474); liveCoverage has no default and "none" requires coverageNote (surface-registry.ts:75-80); drift-collector.test.ts:3306-3320 fails on an emitted slug missing from the registry. The schema.ts allowlist step is kept — ALLOWLISTED_PATHS still exists (schema.ts:196).
…t cases Every statement below is checked against the code in this tree (f5b9b9d). - :125 heading "WebSocket Drift Coverage" -> "Additional Drift Coverage"; the HTTP table and footnotes 2-5 sit under it. A "### WebSocket Protocols" heading is inserted above the WS table so it no longer sits under the Gemini Interactions heading. No content moved. - :127 "23 core / 20 HTTP / 3 model" replaced with the registry counts: 28 surfaces, 18 live, 10 none (src/__tests__/drift/surface-registry.ts, `liveCoverage:` occurrences excluding the type union). - Rows /v1/images/edits, /v1/audio/translations, /api/embed(+/embeddings), /v2/embed, stream_options.include_usage, x-ratelimit/Retry-After: "Covered" -> "None(6)" with a new footnote. grep -rn over src/__tests__/drift/ finds no request for any of those paths or headers; include_usage appears only in openrouter-chat.drift.ts:350 (mock-only OpenRouter case). images.drift.ts drives /v1/images/generations only; registry `images` is liveCoverage none. - embedContent row -> "Covered (live canary)": gemini.drift.ts:645-668 fetches the real endpoint but only logs keys and asserts expect(true). - Added ElevenLabs rows: /v1/sound-generation Covered (elevenlabs.drift.ts: 205-216 fetches api.elevenlabs.io when ELEVENLABS_API_KEY is set); /v1/music, /v1/music/stream, /v1/music/plan Offline (mock only) (elevenlabs.drift.ts:225-300 drive only instance.url). - Footnote 4 "No ElevenLabs key is reachable from this repo" -> the workflows do inject ELEVENLABS_API_KEY (.github/workflows/test-drift.yml:290,:503; fix-drift.yml:209,:447) but elevenlabs-voice.drift.ts never reads it. - :180 "6 verified + 2 canary = 8 WS tests" -> 11 it() blocks: ws-responses.drift.ts (:64,:137), ws-realtime.drift.ts (:66 canary, :116, :194), ws-gemini-live.drift.ts (:244,:339 live; :476,:487,:515,:549 offline unit) = 6 live comparisons + 1 canary + 4 unit. - :184 "4 drift tests" -> 5; gemini-interactions.drift.ts:48,:92,:136,:182,:242. Added the missing "(Step[] input)" bullet. - Gemini Live row "Unverified" -> "Verified", Tool Call check, Text "— (AUDIO check)": registry gemini-live liveCoverage "live"; ws-gemini-live.drift.ts :232-339 drives the real endpoint. - Models line: Realtime GA probe uses gpt-realtime-mini (ws-providers.ts:704, :721), not gpt-realtime-2; dropped the "(was ...)" clause. - Canary family list now matches `gaRealtimeModels` (voice-models.ts:23-30): adds gpt-realtime-2.1 and gpt-realtime-2.1-mini. - Gemini Live section: "every model exposing bidiGenerateContent is a native-audio model" is false — gemini-3.5-transcribe-live declares it and emits TEXT only (ws-gemini-live.drift.ts:22-31); model selection now states the driveGeminiLiveAudio walk with 1007 advancing (:53-57). Graded modality stays AUDIO (ws-providers.ts:808 GEMINI_LIVE_RESPONSE_MODALITIES=["AUDIO"]). Not touched (outside lines 125-231): DRIFT.md:275 still says "(one GA, one Beta)" and "gpt-realtime-2" — the cost paragraph is a sibling's range.
…y cost DRIFT.md "CI Schedule" claimed the drift suite runs "NOT on PR or push". False: test-drift.yml has a `pull_request` trigger with a `paths:` filter (.github/workflows/test-drift.yml:5-27) and a `drift-live-pr` job gated `github.event_name == 'pull_request'` (:492-493) that runs the live collector on head and, unless a same-UTC-day main report is reusable, on base too (:632-660, :745-762), spending real credits per PR push. The credit-free `agui-schema-drift` job (:34-66, no `if:`, clones ag-ui) was never mentioned; `drift` (:67-68) and `notify` (:340-342) are the non-PR jobs. fix-drift.yml's 6:10 UTC cron (:14-15) and its `sync` job gate (:37-40) were absent; its re-collect gate runs the full live collector (:56, :156-157, :203). "Cost" replaced a stale per-run call count (23 core / 20 HTTP / ~31 calls) with the registry-derived live surface count: 18 of 28 entries in src/__tests__/drift/surface-registry.ts carry `liveCoverage: "live"`, 10 `"none"`. Realtime is one GA connection, not "(one GA, one Beta)": src/__tests__/drift/ws-providers.ts:692-704 (Beta retired, model `gpt-realtime-mini`, not `gpt-realtime-2`). Dropped the unverifiable "$0.25/week" figure.
…pe, relabel house errors The `/v1/music/plan` case graded aimock against a shape copied from its own fixture input, so it could only fail on a passthrough bug while the surface is registered `liveCoverage: "live"`. It now asserts the vendor shape the official client parses for that route, read from the published `@elevenlabs/[email protected]` tarball (not a repo dependency): - api/resources/music/resources/compositionPlan/client/Client.js joins "v1/music/plan" and parses with serializers.music.CompositionPlanCreateResponse.parseOrThrow; - serialization/.../CompositionPlanCreateResponse.d.ts: type Raw = MusicPrompt.Raw | CompositionPlan.Raw; - serialization/types/MusicPrompt.d.ts Raw: { positive_global_styles: string[]; negative_global_styles: string[]; sections: SongSection.Raw[] }; - serialization/types/SongSection.d.ts Raw: { section_name; positive_local_styles; negative_local_styles; duration_ms; lines; source_from? }. The plan handler writes fixture `content` verbatim, so the fixture is now a MusicPrompt.Raw too. This is a secondary source, stated as such in the comment; no live /v1/music/plan request has been made and the surface's "live" still comes from /v1/sound-generation alone. RED: with the SDK shape and the old fixture the case failed with 3 critical diffs (positive_global_styles/negative_global_styles absent, sections[] string vs object). GREEN: 7 passed, 1 skipped offline. Hygiene from the R2-R5 reviews, same file: - `elevenLabsErrorShape` -> `aimockErrorEnvelopeShape`; the two 400 cases are named and documented as pinning aimock's house envelope (the vendor answers 422 `{ detail: [...] }`), not ElevenLabs'. - the live /v1/sound-generation leg keeps the vendor error body and prints it in the status assertion instead of discarding it. - `afterAll` returns when `beforeAll` never set `instance`. Patch dance with a forced `beforeAll` throw: before, the report showed the real error plus "TypeError: Cannot read properties of undefined (reading 'server')"; after, only "forced beforeAll failure". - "/v1/music song-id header absent on plan endpoint" renamed to the route it hits; the plan content-type check uses toContain like its siblings. Live run: SKIPPED. `internal-skills secret-cache resolve "elevenlabs api key"` exited 4 (no match in 1Password), so the key was not hunted for.
…its lifecycle
The `elevenlabs-voice.drift.ts` header and the `elevenlabs-voice` registry note
said no ElevenLabs key is reachable from this repo. `.github/workflows/test-drift.yml`
(:290, :503) and `fix-drift.yml` (:209, :447) pass `secrets.ELEVENLABS_API_KEY`
into the drift run. The comments now say the key is wired into CI and that the
only reason the surface is offline is that no case in the file fetches the
vendor — `drift-collector.test.ts` re-derives live-capability from the emitting
source, so flipping `liveCoverage` without a vendor leg would fail there.
`liveCoverage` stays "none".
Locally, `internal-skills secret-cache resolve "elevenlabs api key"` exited 4
(no match), so the live run was skipped and that fact is recorded in the header.
Also from the R2-R5 voice reviews:
- the KNOWN DIVERGENCE comment typed the vendor's `detail` as an object; the
422 validation envelope is an array (`detail: [{ type, loc, msg }]`), the
401 auth envelope is the object.
- `bare.start()` moved inside the `try`; `stop()` is guarded by a `started`
flag because LLMock.stop() throws when unstarted.
- `mock` is assigned only after `start()` resolves and `afterAll` skips
`stop()` when it is unset, so a `beforeAll` failure is reported as itself.
Offline: elevenlabs*.drift.ts 12 passed, 1 skipped; drift-collector.test.ts
278 passed.
…realtime note truthful 1. elevenlabs.drift.ts music/plan docblock and file header: the case grades the mock body against the SDK's MusicPrompt.Raw, but the handler writes the test-authored PLAN_FIXTURE verbatim, so the docblock now says plainly that this is passthrough conformance against a test-authored fixture with no vendor observation, and drops the "before this ..." history. 1b. surface-registry.ts `elevenlabs`: the live /v1/sound-generation case now emits a surface-keyed drift block graded against the vendor response envelope (status, Content-Type, body presence); the entry gains a coverageNote stating that this block alone earns "live" and that music, music/stream, the 400 cases and music/plan are offline conformance. 2. elevenlabs.drift.ts 400-case titles: "(vendor: 422 detail[])" replaced with "(vendor shape not observed on this route)" — the 422 array envelope was observed on Voice Design only. 3. elevenlabs-voice.drift.ts header and the elevenlabs-voice coverageNote: 1Password / secret-cache maintainer notes removed; state only that the key is provided in CI via secrets.ELEVENLABS_API_KEY and that these routes have no vendor leg and are offline-only. 4. DRIFT.md Cost: the Realtime probe opens two GA WS connections per run (text turn and tool call) and no Beta connection, not "a single GA WS connection". 5. DRIFT.md Gemini Live: the model-name rule is stated as current behaviour without the "previously mis-classified ... came to request" history. 6. elevenlabs-voice.drift.ts try/finally comment reworded to what the code does: construction above the try, start() and the request inside it.
…uns (#465) Makes `DRIFT.md` describe the drift suite that actually runs, and makes the two ElevenLabs drift files honest about what they grade. Found during the review pass over the contributor PRs. Docs plus drift test files only; no behaviour change to the mock, no version bump. Because this touches `src/__tests__/drift/**`, the `drift-live-pr` job runs on this PR and spends real API credits, as the corrected CI section now states. ## DRIFT.md **Running the tests** - The environment-variable list names all twelve variables the drift legs read and which legs each one gates; a missing key skips that leg. - `STRICT_DRIFT=1` is read by nothing in the repo and is no longer documented; legs filter on `severity === "critical"`. - The partial provider/builder map is replaced by a pointer to `SURFACE_REGISTRY`, which has 28 entries. - "Adding a New Provider" includes the required registry entry with `liveCoverage`; the allowlist step stays because `ALLOWLISTED_PATHS` still exists. **Coverage tables** - Counts come from the registry: 28 surfaces, 18 live, 10 offline. - Six rows that said "Covered" for routes no drift case requests (images/edits, audio/translations, ollama embed, cohere embed, `stream_options.include_usage`, rate-limit headers) are marked honestly with a footnote. - Rows added for `/v1/music`, `/v1/music/stream`, `/v1/music/plan` and `/v1/sound-generation`. - WebSocket test count is 11 and Interactions is 5, counted from the files. - Gemini Live row matches the registry (live); Realtime rows name the probed model `gpt-realtime-mini`, one GA family, no Beta; the realtime probe opens two GA connections per run. - The ElevenLabs "no key reachable" sentence states what the workflows do: CI injects `ELEVENLABS_API_KEY`. - HTTP tables sit under an HTTP heading rather than the WebSocket one. **CI schedule and cost** - Each workflow and job is listed with its trigger and whether it spends credits, including the `pull_request` path filter, the `drift-live-pr` job, and the fix-drift 6:10 UTC cron. - The AG-UI schema drift lane is described. - Cost numbers are derived from the registry; an unverifiable weekly dollar figure is removed. ## Drift test files - `elevenlabs.drift.ts`: the `/v1/music/plan` case is declared for what it is, passthrough conformance against a test-authored fixture with no vendor observation; the two 400-envelope cases no longer claim a vendor envelope in their titles; the house error envelope is named as ours. - `elevenlabs.drift.ts`: the live `/v1/sound-generation` case emits an `elevenlabs` drift block graded against the vendor response, which is what earns the surface its `live` status in the registry. - `elevenlabs-voice.drift.ts`: comments state that the key is provided in CI and that these routes have no vendor leg; the live leg keeps the vendor error body; server construction sits inside the `try`; `afterAll` no longer masks a `beforeAll` failure. - `surface-registry.ts`: ElevenLabs comments and `coverageNote` corrected to the same facts. ## Checked and left alone - Gemini Live grading on the AUDIO modality is correct as written. - The voice legs were not marked live: no ElevenLabs key was available locally to run them, and the routes have no vendor leg. ## Verification Every changed DRIFT.md claim was recounted from the registry, the drift files and the two workflows (44 claims, one found false and corrected). The test changes had a three-reviewer panel; its findings were fixed or, where pre-existing, recorded as follow-ups. Formatter, lint, both typecheck configs, full test suite, build and commitlint are clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )