@copilotkit/aimock 1.46.0 → 1.47.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 +12 -1
- package/README.md +4 -1
- package/dist/aws-event-stream.cjs +20 -23
- package/dist/aws-event-stream.cjs.map +1 -1
- package/dist/aws-event-stream.d.cts +0 -1
- package/dist/aws-event-stream.d.ts +0 -1
- package/dist/aws-event-stream.js +20 -24
- package/dist/aws-event-stream.js.map +1 -1
- package/dist/bedrock-converse.cjs +79 -82
- 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 +80 -83
- package/dist/bedrock-converse.js.map +1 -1
- package/dist/bedrock.cjs +112 -121
- 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 +113 -122
- package/dist/bedrock.js.map +1 -1
- package/dist/cohere.cjs +58 -106
- 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 +60 -108
- package/dist/cohere.js.map +1 -1
- package/dist/config-loader.d.cts.map +1 -1
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/fixture-loader.cjs +103 -2
- package/dist/fixture-loader.cjs.map +1 -1
- package/dist/fixture-loader.d.cts.map +1 -1
- package/dist/fixture-loader.d.ts.map +1 -1
- package/dist/fixture-loader.js +104 -4
- package/dist/fixture-loader.js.map +1 -1
- package/dist/gemini-interactions.cjs +63 -121
- 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 +65 -123
- package/dist/gemini-interactions.js.map +1 -1
- package/dist/gemini.cjs +242 -155
- 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 +244 -157
- package/dist/gemini.js.map +1 -1
- package/dist/helpers.cjs +400 -7
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +51 -1
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.ts +51 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +391 -8
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/mcp-fakes.d.cts.map +1 -1
- package/dist/messages.cjs +159 -141
- 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 +161 -143
- package/dist/messages.js.map +1 -1
- package/dist/misbehavior.cjs +62 -3
- package/dist/misbehavior.cjs.map +1 -1
- package/dist/misbehavior.d.cts.map +1 -1
- package/dist/misbehavior.d.ts.map +1 -1
- package/dist/misbehavior.js +63 -4
- package/dist/misbehavior.js.map +1 -1
- package/dist/ndjson-writer.cjs +21 -23
- package/dist/ndjson-writer.cjs.map +1 -1
- package/dist/ndjson-writer.d.cts +0 -1
- package/dist/ndjson-writer.d.cts.map +1 -1
- package/dist/ndjson-writer.d.ts +0 -1
- package/dist/ndjson-writer.d.ts.map +1 -1
- package/dist/ndjson-writer.js +21 -24
- package/dist/ndjson-writer.js.map +1 -1
- package/dist/ollama.cjs +153 -147
- 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 +155 -149
- package/dist/ollama.js.map +1 -1
- package/dist/openrouter-chat.cjs +1 -1
- package/dist/openrouter-chat.js +1 -1
- package/dist/raw-validation.cjs +177 -0
- package/dist/raw-validation.cjs.map +1 -0
- package/dist/raw-validation.js +176 -0
- package/dist/raw-validation.js.map +1 -0
- package/dist/response/deliver.cjs +144 -0
- package/dist/response/deliver.cjs.map +1 -0
- package/dist/response/deliver.js +143 -0
- package/dist/response/deliver.js.map +1 -0
- package/dist/response/frame-loop.cjs +102 -0
- package/dist/response/frame-loop.cjs.map +1 -0
- package/dist/response/frame-loop.js +100 -0
- package/dist/response/frame-loop.js.map +1 -0
- package/dist/response/lifecycle.cjs +223 -0
- package/dist/response/lifecycle.cjs.map +1 -0
- package/dist/response/lifecycle.js +211 -0
- package/dist/response/lifecycle.js.map +1 -0
- package/dist/response/proxy.cjs +71 -0
- package/dist/response/proxy.cjs.map +1 -0
- package/dist/response/proxy.js +70 -0
- package/dist/response/proxy.js.map +1 -0
- package/dist/response/raw.cjs +228 -0
- package/dist/response/raw.cjs.map +1 -0
- package/dist/response/raw.js +227 -0
- package/dist/response/raw.js.map +1 -0
- package/dist/response/timing.cjs +157 -0
- package/dist/response/timing.cjs.map +1 -0
- package/dist/response/timing.js +150 -0
- package/dist/response/timing.js.map +1 -0
- package/dist/responses.cjs +269 -148
- package/dist/responses.cjs.map +1 -1
- package/dist/responses.d.cts.map +1 -1
- package/dist/responses.d.ts.map +1 -1
- package/dist/responses.js +270 -149
- package/dist/responses.js.map +1 -1
- package/dist/router.cjs +20 -4
- package/dist/router.cjs.map +1 -1
- package/dist/router.d.cts +7 -1
- package/dist/router.d.cts.map +1 -1
- package/dist/router.d.ts +7 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +21 -5
- package/dist/router.js.map +1 -1
- package/dist/server.cjs +89 -120
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +91 -122
- package/dist/server.js.map +1 -1
- package/dist/sse-writer.cjs +49 -30
- package/dist/sse-writer.cjs.map +1 -1
- package/dist/sse-writer.d.cts +0 -1
- package/dist/sse-writer.d.cts.map +1 -1
- package/dist/sse-writer.d.ts +0 -1
- package/dist/sse-writer.d.ts.map +1 -1
- package/dist/sse-writer.js +49 -31
- package/dist/sse-writer.js.map +1 -1
- package/dist/transcription.cjs +19 -33
- 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 +20 -34
- package/dist/transcription.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +173 -10
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.ts +173 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ws-framing.cjs +12 -6
- package/dist/ws-framing.cjs.map +1 -1
- package/dist/ws-framing.d.cts +2 -0
- package/dist/ws-framing.d.cts.map +1 -1
- package/dist/ws-framing.d.ts +2 -0
- package/dist/ws-framing.d.ts.map +1 -1
- package/dist/ws-framing.js +12 -6
- package/dist/ws-framing.js.map +1 -1
- package/dist/ws-gemini-live.cjs +120 -93
- package/dist/ws-gemini-live.cjs.map +1 -1
- package/dist/ws-gemini-live.js +120 -93
- package/dist/ws-gemini-live.js.map +1 -1
- package/dist/ws-realtime.cjs +80 -70
- package/dist/ws-realtime.cjs.map +1 -1
- package/dist/ws-realtime.d.cts.map +1 -1
- package/dist/ws-realtime.d.ts.map +1 -1
- package/dist/ws-realtime.js +80 -70
- package/dist/ws-realtime.js.map +1 -1
- package/dist/ws-responses.cjs +72 -53
- package/dist/ws-responses.cjs.map +1 -1
- package/dist/ws-responses.d.cts.map +1 -1
- package/dist/ws-responses.d.ts.map +1 -1
- package/dist/ws-responses.js +73 -54
- package/dist/ws-responses.js.map +1 -1
- package/package.json +1 -1
- package/skills/write-fixtures/SKILL.md +34 -2
package/dist/helpers.js
CHANGED
|
@@ -215,12 +215,331 @@ function requireEmittedFunctionToolCalls(response, wire) {
|
|
|
215
215
|
if (Array.isArray(response.blocks) && response.blocks.length > 0) return [];
|
|
216
216
|
return requireFunctionToolCalls(response.toolCalls ?? []);
|
|
217
217
|
}
|
|
218
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* A fixture's model-generated `files` reached a wire that has no faithful
|
|
220
|
+
* projection for them. Gemini (`inlineData` parts) and the OpenAI Responses
|
|
221
|
+
* API (`image_generation_call` items, `image/*` only) serve generated files.
|
|
222
|
+
* Chat Completions (OpenAI, Azure OpenAI, OpenRouter and BytePlus ModelArk)
|
|
223
|
+
* and Anthropic Messages raise this through {@link rejectGeneratedFiles}, and
|
|
224
|
+
* the Responses API raises a subclass for a non-`image/*` file, before any
|
|
225
|
+
* content is written. The handler surfaces it as a coded 500
|
|
226
|
+
* (`aimock_unsupported_generated_file`) like {@link UnsupportedToolCallError}.
|
|
227
|
+
*/
|
|
228
|
+
var UnsupportedGeneratedFileError = class extends Error {
|
|
229
|
+
wire;
|
|
230
|
+
constructor(wire) {
|
|
231
|
+
super(`aimock: fixture "files" (model-generated files) are only supported on Gemini and the OpenAI Responses API; this request arrived on ${wire}`);
|
|
232
|
+
this.name = "UnsupportedGeneratedFileError";
|
|
233
|
+
this.wire = wire;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Reject a fixture that sets a non-empty `files` on a wire that cannot carry
|
|
238
|
+
* model-generated files. Throws {@link UnsupportedGeneratedFileError} naming
|
|
239
|
+
* `wire`. A malformed `files` value (see {@link fixtureFiles}) throws
|
|
240
|
+
* {@link InvalidFixtureOutputError} (`aimock_invalid_fixture_file`) first.
|
|
241
|
+
* Chat Completions and Anthropic Messages call this. Gemini and OpenAI
|
|
242
|
+
* Responses serve `files`; other wires ignore the field.
|
|
243
|
+
*/
|
|
244
|
+
function rejectGeneratedFiles(response, wire) {
|
|
245
|
+
if (fixtureFiles(response.files).length > 0) throw new UnsupportedGeneratedFileError(wire);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A fixture's `citations` or `files` is malformed: not an array, an entry
|
|
249
|
+
* missing a required field, a non-integer offset, citation offsets outside
|
|
250
|
+
* `0 <= startIndex <= endIndex <= text.length`, a file citation `index`
|
|
251
|
+
* outside `0 <= index <= text.length`, an offset or `index` that splits a
|
|
252
|
+
* UTF-16 surrogate pair, a citation that mixes URL and file citation fields,
|
|
253
|
+
* or any `citations` but an empty array on a turn with no text (tool calls
|
|
254
|
+
* only, `blocks` with no text block, or empty content). The wires that read
|
|
255
|
+
* these keys (Chat Completions, Anthropic Messages, Gemini and OpenAI
|
|
256
|
+
* Responses) read them
|
|
257
|
+
* through {@link fixtureFiles} and {@link fixtureCitations}, which throw this
|
|
258
|
+
* at serve time, before any byte is written; the handler surfaces it as a
|
|
259
|
+
* coded 500 like {@link UnsupportedGeneratedFileError}. Other wires ignore
|
|
260
|
+
* `citations` and `files`, so they never throw this. The message names the
|
|
261
|
+
* offending entry and how to fix the fixture.
|
|
262
|
+
*/
|
|
263
|
+
var InvalidFixtureOutputError = class extends Error {
|
|
264
|
+
code;
|
|
265
|
+
constructor(code, problem) {
|
|
266
|
+
super(`aimock: invalid fixture "${code === "aimock_invalid_fixture_file" ? "files" : "citations"}": ${problem}`);
|
|
267
|
+
this.name = "InvalidFixtureOutputError";
|
|
268
|
+
this.code = code;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* A short description of a fixture value for an error message. Never throws:
|
|
273
|
+
* a programmatic fixture can hold values JSON cannot carry (BigInt, Symbol,
|
|
274
|
+
* function, NaN, Infinity), and each gets a readable name.
|
|
275
|
+
*/
|
|
276
|
+
function describeFixtureValue(value) {
|
|
277
|
+
if (value === void 0) return "undefined";
|
|
278
|
+
if (Array.isArray(value)) return "an array";
|
|
279
|
+
if (value !== null && typeof value === "object") return "an object";
|
|
280
|
+
if (typeof value === "function") return "a function";
|
|
281
|
+
if (typeof value === "symbol") return value.toString();
|
|
282
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
283
|
+
if (typeof value === "number" && !Number.isFinite(value)) return String(value);
|
|
284
|
+
const json = JSON.stringify(value);
|
|
285
|
+
return json.length > 40 ? `${json.slice(0, 37)}...` : json;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The UTF-16 index `at` falls between the two halves of a surrogate pair, so
|
|
289
|
+
* a span that starts or ends there cuts a character in half.
|
|
290
|
+
*/
|
|
291
|
+
function splitsSurrogatePair(text, at) {
|
|
292
|
+
if (at <= 0 || at >= text.length) return false;
|
|
293
|
+
const before = text.charCodeAt(at - 1);
|
|
294
|
+
const after = text.charCodeAt(at);
|
|
295
|
+
return before >= 55296 && before <= 56319 && after >= 56320 && after <= 57343;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* `text` cut into slices of at most `chunkSize` UTF-16 units, never between
|
|
299
|
+
* the two halves of a surrogate pair: a cut that would land inside a pair
|
|
300
|
+
* moves back before it, or, when that would leave the slice empty
|
|
301
|
+
* (`chunkSize` 1), forward past it. The slices rejoin to `text` exactly.
|
|
302
|
+
*/
|
|
303
|
+
function surrogateSafeChunks(text, chunkSize) {
|
|
304
|
+
const chunks = [];
|
|
305
|
+
for (let i = 0; i < text.length;) {
|
|
306
|
+
let end = Math.min(i + chunkSize, text.length);
|
|
307
|
+
const high = text.charCodeAt(end - 1);
|
|
308
|
+
const low = text.charCodeAt(end);
|
|
309
|
+
if (high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343) end = end - 1 > i ? end - 1 : end + 1;
|
|
310
|
+
chunks.push(text.slice(i, end));
|
|
311
|
+
i = end;
|
|
312
|
+
}
|
|
313
|
+
return chunks;
|
|
314
|
+
}
|
|
315
|
+
/** The message for a citation offset that splits a surrogate pair. */
|
|
316
|
+
function surrogateSplitProblem(where, at) {
|
|
317
|
+
return `${where} ${at} splits a UTF-16 surrogate pair (one character, e.g. an emoji); fix the offset to fall before or after the whole character`;
|
|
318
|
+
}
|
|
319
|
+
/** Fields only a URL citation has. */
|
|
320
|
+
const URL_CITATION_FIELDS = [
|
|
321
|
+
"url",
|
|
322
|
+
"title",
|
|
323
|
+
"startIndex",
|
|
324
|
+
"endIndex"
|
|
325
|
+
];
|
|
326
|
+
/** Fields only a file citation has. */
|
|
327
|
+
const FILE_CITATION_FIELDS = [
|
|
328
|
+
"fileId",
|
|
329
|
+
"filename",
|
|
330
|
+
"index"
|
|
331
|
+
];
|
|
332
|
+
/**
|
|
333
|
+
* A citation that mixes URL and file citation fields, or a file-shaped one
|
|
334
|
+
* (`fileId` / `filename` / `index`) with no `type`, which would otherwise be
|
|
335
|
+
* read as a URL citation and lose its file data. Undefined when the fields
|
|
336
|
+
* agree.
|
|
337
|
+
*/
|
|
338
|
+
function mixedCitationProblem(citation, i) {
|
|
339
|
+
const present = (names) => names.filter((n) => citation[n] != null);
|
|
340
|
+
const fileFields = present(FILE_CITATION_FIELDS);
|
|
341
|
+
if (fileFields.length === 0) return void 0;
|
|
342
|
+
const urlFields = present(URL_CITATION_FIELDS);
|
|
343
|
+
const fix = citation.type === "file" ? `remove the URL citation fields (${urlFields.join(", ")}) from this file citation` : citation.type === "url" ? `remove the file citation fields (${fileFields.join(", ")}) from this URL citation, or set type: "file" for a file citation` : `set type: "file" for a file citation, or remove the stray fields`;
|
|
344
|
+
if (urlFields.length > 0) return `citations[${i}] mixes URL citation fields (${urlFields.join(", ")}) with file citation fields (${fileFields.join(", ")}); ${fix}`;
|
|
345
|
+
if (citation.type == null) return `citations[${i}] has file citation fields (${fileFields.join(", ")}) but no type; ${fix}`;
|
|
346
|
+
if (citation.type === "url") return `citations[${i}] has type "url" but file citation fields (${fileFields.join(", ")}); ${fix}`;
|
|
347
|
+
}
|
|
348
|
+
/** "an object", "a string", ... for a value that should have been an array. */
|
|
349
|
+
function describeFixtureKind(value) {
|
|
350
|
+
if (value === null) return "null";
|
|
351
|
+
if (value !== null && typeof value === "object") return "an object";
|
|
352
|
+
return typeof value === "string" ? "a string" : `a ${typeof value}`;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* What is wrong with a fixture `files` value, or undefined when it is absent
|
|
356
|
+
* or an array of `{ mimeType, data }` string pairs. Shared by the serve-time
|
|
357
|
+
* check ({@link fixtureFiles}) and fixture load validation.
|
|
358
|
+
*/
|
|
359
|
+
function fixtureFilesProblem(files) {
|
|
360
|
+
if (files === void 0 || files === null) return void 0;
|
|
361
|
+
if (!Array.isArray(files)) return `"files" must be an array of { mimeType, data } objects, got ${describeFixtureKind(files)}; wrap a single file in [ ]`;
|
|
362
|
+
for (let i = 0; i < files.length; i++) {
|
|
363
|
+
const file = files[i];
|
|
364
|
+
if (file === null || typeof file !== "object" || Array.isArray(file)) return `files[${i}] must be a { mimeType, data } object, got ${describeFixtureValue(file)}`;
|
|
365
|
+
const { mimeType, data } = file;
|
|
366
|
+
if (typeof mimeType !== "string" || mimeType.length === 0) return `files[${i}].mimeType must be a non-empty string, got ${describeFixtureValue(mimeType)}; set the file's MIME type, e.g. "image/png"`;
|
|
367
|
+
if (typeof data !== "string") return `files[${i}].data must be a string, got ${describeFixtureValue(data)}; set the base64-encoded file bytes`;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* What is wrong with a fixture `citations` value, or undefined when it is
|
|
372
|
+
* absent or valid: an array of citation objects. A URL citation (no `type`,
|
|
373
|
+
* or `type: "url"`) has a non-empty string `url`, an optional string `title`
|
|
374
|
+
* and optional integer offsets. A file citation (`type: "file"`) has a
|
|
375
|
+
* non-empty string `fileId` and `filename` and an optional integer `index`;
|
|
376
|
+
* it has no `url`. When `text` is given, the resolved offsets must also
|
|
377
|
+
* satisfy `0 <= startIndex <= endIndex <= text.length`, and a file citation's
|
|
378
|
+
* `index` must satisfy `0 <= index <= text.length`, and no offset may split a
|
|
379
|
+
* UTF-16 surrogate pair. A citation must not mix URL and file citation
|
|
380
|
+
* fields, and one with file fields needs `type: "file"`. A `null` value, or a
|
|
381
|
+
* `null` optional field, is treated as absent. An empty `text` is a turn with
|
|
382
|
+
* no text (tool calls only, `blocks` with no text block, or empty content): a
|
|
383
|
+
* well-formed non-empty array is then a problem, since there is nothing to
|
|
384
|
+
* cite; a malformed value is reported by its shape first. Shared by the
|
|
385
|
+
* serve-time check ({@link fixtureCitations}) and fixture load validation.
|
|
386
|
+
*/
|
|
387
|
+
function fixtureCitationsProblem(citations, text) {
|
|
388
|
+
if (citations === void 0 || citations === null) return void 0;
|
|
389
|
+
if (!Array.isArray(citations)) return `"citations" must be an array of { url, title?, startIndex?, endIndex? } or { type: "file", fileId, filename, index? } objects, got ${describeFixtureKind(citations)}; wrap a single citation in [ ]`;
|
|
390
|
+
const shape = citationEntriesProblem(citations, void 0);
|
|
391
|
+
if (shape !== void 0 || text === void 0) return shape;
|
|
392
|
+
if (text === "" && citations.length > 0) return "\"citations\" has nothing to cite: this turn has no text (only tool calls, or empty content); add text to the response or remove the citations";
|
|
393
|
+
return citationEntriesProblem(citations, text);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* What is wrong with the entries of a `citations` array, or undefined when
|
|
397
|
+
* all are valid. Offsets are checked against `text` only when it is given. A
|
|
398
|
+
* `null` optional field (`type`, `title`, `startIndex`, `endIndex`, `index`)
|
|
399
|
+
* is treated as absent, as a `null` top-level key is.
|
|
400
|
+
*/
|
|
401
|
+
function citationEntriesProblem(citations, text) {
|
|
402
|
+
for (let i = 0; i < citations.length; i++) {
|
|
403
|
+
const citation = citations[i];
|
|
404
|
+
if (citation === null || typeof citation !== "object" || Array.isArray(citation)) return `citations[${i}] must be a { url, title?, startIndex?, endIndex? } or { type: "file", fileId, filename, index? } object, got ${describeFixtureValue(citation)}`;
|
|
405
|
+
const fields = citation;
|
|
406
|
+
const url = fields.url;
|
|
407
|
+
const type = fields.type ?? void 0;
|
|
408
|
+
const title = fields.title ?? void 0;
|
|
409
|
+
const startIndex = fields.startIndex ?? void 0;
|
|
410
|
+
const endIndex = fields.endIndex ?? void 0;
|
|
411
|
+
if (type === void 0 || type === "url" || type === "file") {
|
|
412
|
+
const mixed = mixedCitationProblem(citation, i);
|
|
413
|
+
if (mixed !== void 0) return mixed;
|
|
414
|
+
}
|
|
415
|
+
if (type === "file") {
|
|
416
|
+
const problem = fixtureFileCitationProblem(citation, i, text);
|
|
417
|
+
if (problem !== void 0) return problem;
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (type !== void 0 && type !== "url") return `citations[${i}].type must be "url" or "file" when set, got ${describeFixtureValue(type)}; omit it for a URL citation`;
|
|
421
|
+
if (typeof url !== "string" || url.length === 0) return `citations[${i}].url must be a non-empty string, got ${describeFixtureValue(url)}; set the cited source URL`;
|
|
422
|
+
if (title !== void 0 && typeof title !== "string") return `citations[${i}].title must be a string when set, got ${describeFixtureValue(title)}`;
|
|
423
|
+
for (const [name, value] of [["startIndex", startIndex], ["endIndex", endIndex]]) if (value !== void 0 && !Number.isInteger(value)) return `citations[${i}].${name} must be an integer when set, got ${describeFixtureValue(value)}; give a character offset into the text, or omit it`;
|
|
424
|
+
if (text === void 0) continue;
|
|
425
|
+
const start = startIndex ?? 0;
|
|
426
|
+
const end = endIndex ?? text.length;
|
|
427
|
+
if (start < 0 || start > end || end > text.length) return `citations[${i}] offsets must satisfy 0 <= startIndex <= endIndex <= text length (${text.length}), got startIndex ${start}, endIndex ${end}; fix the offsets, or omit them to cite the whole text`;
|
|
428
|
+
if (splitsSurrogatePair(text, start)) return surrogateSplitProblem(`citations[${i}].startIndex`, start);
|
|
429
|
+
if (splitsSurrogatePair(text, end)) return surrogateSplitProblem(`citations[${i}].endIndex`, end);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/** What is wrong with the file citation `citations[i]`, or undefined when valid. */
|
|
433
|
+
function fixtureFileCitationProblem(citation, i, text) {
|
|
434
|
+
const { fileId, filename } = citation;
|
|
435
|
+
const index = citation.index ?? void 0;
|
|
436
|
+
if (typeof fileId !== "string" || fileId.length === 0) return `citations[${i}].fileId must be a non-empty string, got ${describeFixtureValue(fileId)}; set the cited file's ID, e.g. "file-abc123"`;
|
|
437
|
+
if (typeof filename !== "string" || filename.length === 0) return `citations[${i}].filename must be a non-empty string, got ${describeFixtureValue(filename)}; set the cited file's name`;
|
|
438
|
+
if (index !== void 0 && !Number.isInteger(index)) return `citations[${i}].index must be an integer when set, got ${describeFixtureValue(index)}; give a character position in the text, or omit it`;
|
|
439
|
+
if (text === void 0) return void 0;
|
|
440
|
+
const at = index ?? text.length;
|
|
441
|
+
if (at < 0 || at > text.length) return `citations[${i}].index must satisfy 0 <= index <= text length (${text.length}), got ${at}; fix the index, or omit it to cite the end of the text`;
|
|
442
|
+
if (splitsSurrogatePair(text, at)) return surrogateSplitProblem(`citations[${i}].index`, at);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Fixture `citations`, checked against the text they cite: the array itself,
|
|
446
|
+
* or empty when absent. Throws {@link InvalidFixtureOutputError}
|
|
447
|
+
* (`aimock_invalid_fixture_citation`) for every problem
|
|
448
|
+
* {@link fixtureCitationsProblem} reports: a malformed value, an offset
|
|
449
|
+
* outside the text or one that splits a surrogate pair, mixed URL and file
|
|
450
|
+
* citation fields, or citations on a turn with no text (`content` is empty:
|
|
451
|
+
* tool calls only, `blocks` with no text block, or empty content). Every
|
|
452
|
+
* provider that reads `citations` goes through this.
|
|
453
|
+
*/
|
|
454
|
+
function fixtureCitations(content, citations) {
|
|
455
|
+
const problem = fixtureCitationsProblem(citations, content);
|
|
456
|
+
if (problem !== void 0) throw new InvalidFixtureOutputError("aimock_invalid_fixture_citation", problem);
|
|
457
|
+
return citations ?? [];
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Fixture `files`, checked: the array itself, or empty when absent. Throws
|
|
461
|
+
* {@link InvalidFixtureOutputError} (`aimock_invalid_fixture_file`) for a
|
|
462
|
+
* malformed value. Every provider that reads `files` goes through this.
|
|
463
|
+
*/
|
|
464
|
+
function fixtureFiles(files) {
|
|
465
|
+
const problem = fixtureFilesProblem(files);
|
|
466
|
+
if (problem !== void 0) throw new InvalidFixtureOutputError("aimock_invalid_fixture_file", problem);
|
|
467
|
+
return files ?? [];
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Fixture URL `citations` against the text they cite, with defaults applied:
|
|
471
|
+
* the title falls back to the URL and the offsets to the whole text. Empty
|
|
472
|
+
* when the fixture sets none. File citations (`type: "file"`) are skipped:
|
|
473
|
+
* only OpenAI Responses has a wire shape for them (`file_citation`), and it
|
|
474
|
+
* builds those itself. Chat Completions, Anthropic Messages and Gemini, which
|
|
475
|
+
* resolve through here, serve URL citations only. This reads `citations`
|
|
476
|
+
* through {@link fixtureCitations}, so it is the serve-time check for those
|
|
477
|
+
* three wires: every problem {@link fixtureCitationsProblem} reports against
|
|
478
|
+
* `content`, including one in a file citation it then skips, throws
|
|
479
|
+
* {@link InvalidFixtureOutputError} (`aimock_invalid_fixture_citation`).
|
|
480
|
+
* OpenAI Responses calls {@link fixtureCitations} directly. Other wires
|
|
481
|
+
* ignore `citations`.
|
|
482
|
+
*/
|
|
483
|
+
function resolveCitations(content, citations) {
|
|
484
|
+
return fixtureCitations(content, citations).flatMap((c) => c.type === "file" ? [] : [c]).map((c) => ({
|
|
485
|
+
url: c.url,
|
|
486
|
+
title: c.title ?? c.url,
|
|
487
|
+
startIndex: c.startIndex ?? 0,
|
|
488
|
+
endIndex: c.endIndex ?? content.length
|
|
489
|
+
}));
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Fixture `citations` as Chat Completions `url_citation` annotations. File
|
|
493
|
+
* citations are skipped (see {@link resolveCitations}): Chat Completions has no
|
|
494
|
+
* `file_citation` annotation.
|
|
495
|
+
*/
|
|
496
|
+
function chatCompletionAnnotations(content, citations) {
|
|
497
|
+
return resolveCitations(content, citations).map((c) => ({
|
|
498
|
+
type: "url_citation",
|
|
499
|
+
url_citation: {
|
|
500
|
+
url: c.url,
|
|
501
|
+
title: c.title,
|
|
502
|
+
start_index: c.startIndex,
|
|
503
|
+
end_index: c.endIndex
|
|
504
|
+
}
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
/** `{ annotations }` for a Chat Completions message, or nothing when the fixture has no citations. */
|
|
508
|
+
function annotationsField(content, overrides) {
|
|
509
|
+
const annotations = chatCompletionAnnotations(content, overrides?.citations);
|
|
510
|
+
return annotations.length > 0 ? { annotations } : {};
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* The streamed form of {@link chatCompletionAnnotations}: one chunk whose
|
|
514
|
+
* `delta.annotations` holds every annotation, sent after the content and
|
|
515
|
+
* before the finish chunk. Nothing when the fixture has no citations.
|
|
516
|
+
*/
|
|
517
|
+
function chatAnnotationChunks(content, overrides, envelope) {
|
|
518
|
+
const annotations = chatCompletionAnnotations(content, overrides?.citations);
|
|
519
|
+
if (annotations.length === 0) return [];
|
|
520
|
+
const fingerprint = overrides?.systemFingerprint;
|
|
521
|
+
return [{
|
|
522
|
+
id: envelope.id,
|
|
523
|
+
object: "chat.completion.chunk",
|
|
524
|
+
created: envelope.created,
|
|
525
|
+
model: envelope.model,
|
|
526
|
+
choices: [{
|
|
527
|
+
index: 0,
|
|
528
|
+
delta: { annotations },
|
|
529
|
+
logprobs: null,
|
|
530
|
+
finish_reason: null
|
|
531
|
+
}],
|
|
532
|
+
...fingerprint !== void 0 && { system_fingerprint: fingerprint }
|
|
533
|
+
}];
|
|
534
|
+
}
|
|
535
|
+
/** True for the fixture errors a handler surfaces as a coded 500. */
|
|
219
536
|
function isFixtureToolCallError(error) {
|
|
220
|
-
return error instanceof InvalidToolArgumentsError || error instanceof UnsupportedToolCallError || error instanceof InvalidFixtureToolCallError;
|
|
537
|
+
return error instanceof InvalidToolArgumentsError || error instanceof UnsupportedToolCallError || error instanceof InvalidFixtureToolCallError || error instanceof UnsupportedGeneratedFileError || error instanceof InvalidFixtureOutputError;
|
|
221
538
|
}
|
|
222
539
|
/** The aimock error code carried in every provider envelope for a fixture tool-call error. */
|
|
223
540
|
function fixtureToolCallErrorCode(error) {
|
|
541
|
+
if (error instanceof UnsupportedGeneratedFileError) return "aimock_unsupported_generated_file";
|
|
542
|
+
if (error instanceof InvalidFixtureOutputError) return error.code;
|
|
224
543
|
if (error instanceof UnsupportedToolCallError) return "aimock_unsupported_tool_call";
|
|
225
544
|
if (error instanceof InvalidFixtureToolCallError) return error.code;
|
|
226
545
|
return "aimock_invalid_tool_arguments";
|
|
@@ -239,9 +558,10 @@ function googleFixtureToolCallErrorDetails(code) {
|
|
|
239
558
|
}];
|
|
240
559
|
}
|
|
241
560
|
/**
|
|
242
|
-
* Run a WebSocket preflight `check` that may raise a fixture
|
|
243
|
-
* ({@link InvalidToolArgumentsError}, {@link UnsupportedToolCallError}
|
|
244
|
-
* {@link InvalidFixtureToolCallError}
|
|
561
|
+
* Run a WebSocket preflight `check` that may raise a fixture error
|
|
562
|
+
* ({@link InvalidToolArgumentsError}, {@link UnsupportedToolCallError},
|
|
563
|
+
* {@link InvalidFixtureToolCallError}, {@link UnsupportedGeneratedFileError}
|
|
564
|
+
* or {@link InvalidFixtureOutputError}).
|
|
245
565
|
* Such an error marks the already-journaled entry as a 500 carrying the
|
|
246
566
|
* message, then propagates to the transport's error handler.
|
|
247
567
|
*/
|
|
@@ -1066,9 +1386,47 @@ function isVideoResponse(r) {
|
|
|
1066
1386
|
function isJSONResponse(r) {
|
|
1067
1387
|
return "json" in r && r.json !== void 0;
|
|
1068
1388
|
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Every key some other response guard reads. A response carrying any of them
|
|
1391
|
+
* is that type (with a stray `raw` key the loader has always ignored), never
|
|
1392
|
+
* a raw response — so adding raw support changes nothing for such fixtures.
|
|
1393
|
+
*/
|
|
1394
|
+
const NON_RAW_RESPONSE_MARKERS = [
|
|
1395
|
+
"content",
|
|
1396
|
+
"toolCalls",
|
|
1397
|
+
"blocks",
|
|
1398
|
+
"responsesBlocks",
|
|
1399
|
+
"customToolCalls",
|
|
1400
|
+
"error",
|
|
1401
|
+
"embedding",
|
|
1402
|
+
"image",
|
|
1403
|
+
"images",
|
|
1404
|
+
"audio",
|
|
1405
|
+
"transcription",
|
|
1406
|
+
"video",
|
|
1407
|
+
"json",
|
|
1408
|
+
"live"
|
|
1409
|
+
];
|
|
1410
|
+
/**
|
|
1411
|
+
* @internal Whether `r` is a raw passthrough response: `raw` is a non-null,
|
|
1412
|
+
* non-array object and no other response type's marker key is present. The
|
|
1413
|
+
* shape of `raw` itself is checked by the loader and again at serve time.
|
|
1414
|
+
* Exported for in-repo use only; not part of the public API.
|
|
1415
|
+
*
|
|
1416
|
+
* A fixture added in code can hold a response that is not an object (null, a
|
|
1417
|
+
* string). `in` throws on such a value, so it is simply not raw.
|
|
1418
|
+
*/
|
|
1419
|
+
function isRawResponse(r) {
|
|
1420
|
+
if (typeof r !== "object" || r === null || !("raw" in r)) return false;
|
|
1421
|
+
const raw = r.raw;
|
|
1422
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return false;
|
|
1423
|
+
return !NON_RAW_RESPONSE_MARKERS.some((marker) => marker in r);
|
|
1424
|
+
}
|
|
1069
1425
|
function extractOverrides(response) {
|
|
1070
1426
|
const r = response;
|
|
1071
1427
|
return {
|
|
1428
|
+
...r.citations !== void 0 && { citations: r.citations },
|
|
1429
|
+
...r.files !== void 0 && { files: r.files },
|
|
1072
1430
|
...r.id !== void 0 && { id: r.id },
|
|
1073
1431
|
...r.created !== void 0 && { created: r.created },
|
|
1074
1432
|
...r.model !== void 0 && { model: r.model },
|
|
@@ -1178,6 +1536,11 @@ function buildTextChunks(content, model, chunkSize, reasoning, overrides) {
|
|
|
1178
1536
|
...fingerprint !== void 0 && { system_fingerprint: fingerprint }
|
|
1179
1537
|
});
|
|
1180
1538
|
}
|
|
1539
|
+
chunks.push(...chatAnnotationChunks(content, overrides, {
|
|
1540
|
+
id,
|
|
1541
|
+
created,
|
|
1542
|
+
model: effectiveModel
|
|
1543
|
+
}));
|
|
1181
1544
|
chunks.push({
|
|
1182
1545
|
id,
|
|
1183
1546
|
object: "chat.completion.chunk",
|
|
@@ -1197,6 +1560,7 @@ function buildTextChunks(content, model, chunkSize, reasoning, overrides) {
|
|
|
1197
1560
|
function buildOpenAIReasoningChunks(reasoning, model, chunkSize, exposeReasoning, overrides) {
|
|
1198
1561
|
return buildTextChunks(exposeReasoning ? reasoning : "", model, chunkSize, void 0, {
|
|
1199
1562
|
...overrides,
|
|
1563
|
+
citations: void 0,
|
|
1200
1564
|
role: "assistant",
|
|
1201
1565
|
finishReason: "length"
|
|
1202
1566
|
}).map((chunk) => ({
|
|
@@ -1225,6 +1589,7 @@ function buildOpenAIReasoningCompletion(reasoning, model, exposeReasoning, overr
|
|
|
1225
1589
|
const visible = exposeReasoning ? reasoning : "";
|
|
1226
1590
|
const completion = buildTextCompletion(visible, model, void 0, {
|
|
1227
1591
|
...overrides,
|
|
1592
|
+
citations: void 0,
|
|
1228
1593
|
role: "assistant",
|
|
1229
1594
|
finishReason: "length",
|
|
1230
1595
|
usage: void 0
|
|
@@ -1254,6 +1619,7 @@ function buildOpenAIReasoningCompletion(reasoning, model, exposeReasoning, overr
|
|
|
1254
1619
|
function buildOpenAIContentFilterChunks(model, overrides) {
|
|
1255
1620
|
return buildTextChunks("", model, 1, void 0, {
|
|
1256
1621
|
...overrides,
|
|
1622
|
+
citations: void 0,
|
|
1257
1623
|
role: "assistant",
|
|
1258
1624
|
finishReason: "content_filter"
|
|
1259
1625
|
}).map((chunk) => ({
|
|
@@ -1271,6 +1637,7 @@ function buildOpenAIContentFilterChunks(model, overrides) {
|
|
|
1271
1637
|
function buildOpenAIContentFilterCompletion(model, overrides, requestMessages) {
|
|
1272
1638
|
const completion = buildTextCompletion("", model, void 0, {
|
|
1273
1639
|
...overrides,
|
|
1640
|
+
citations: void 0,
|
|
1274
1641
|
role: "assistant",
|
|
1275
1642
|
finishReason: "content_filter",
|
|
1276
1643
|
usage: void 0
|
|
@@ -1291,6 +1658,7 @@ function buildOpenAIContentFilterCompletion(model, overrides, requestMessages) {
|
|
|
1291
1658
|
function buildOpenAIRefusalChunks(refusal, model, chunkSize, overrides) {
|
|
1292
1659
|
return buildTextChunks(refusal, model, chunkSize, void 0, {
|
|
1293
1660
|
...overrides,
|
|
1661
|
+
citations: void 0,
|
|
1294
1662
|
role: "assistant",
|
|
1295
1663
|
finishReason: "stop"
|
|
1296
1664
|
}).map((chunk) => ({
|
|
@@ -1311,6 +1679,7 @@ function buildOpenAIRefusalChunks(refusal, model, chunkSize, overrides) {
|
|
|
1311
1679
|
function buildOpenAIRefusalCompletion(refusal, model, overrides, requestMessages) {
|
|
1312
1680
|
const completion = buildTextCompletion(refusal, model, void 0, {
|
|
1313
1681
|
...overrides,
|
|
1682
|
+
citations: void 0,
|
|
1314
1683
|
role: "assistant",
|
|
1315
1684
|
finishReason: "stop",
|
|
1316
1685
|
usage: void 0
|
|
@@ -1328,6 +1697,7 @@ function buildOpenAIRefusalCompletion(refusal, model, overrides, requestMessages
|
|
|
1328
1697
|
};
|
|
1329
1698
|
}
|
|
1330
1699
|
function buildToolCallChunks(toolCalls, model, chunkSize, reasoning, overrides) {
|
|
1700
|
+
fixtureCitations("", overrides?.citations);
|
|
1331
1701
|
const id = overrides?.id ?? generateId();
|
|
1332
1702
|
const created = overrides?.created ?? Math.floor(Date.now() / 1e3);
|
|
1333
1703
|
const effectiveModel = overrides?.model ?? model;
|
|
@@ -1438,7 +1808,8 @@ function buildTextCompletion(content, model, reasoning, overrides, requestMessag
|
|
|
1438
1808
|
role: overrides?.role ?? "assistant",
|
|
1439
1809
|
content,
|
|
1440
1810
|
refusal: null,
|
|
1441
|
-
...reasoning ? { reasoning_content: reasoning } : {}
|
|
1811
|
+
...reasoning ? { reasoning_content: reasoning } : {},
|
|
1812
|
+
...annotationsField(content, overrides)
|
|
1442
1813
|
},
|
|
1443
1814
|
logprobs: null,
|
|
1444
1815
|
finish_reason: overrides?.finishReason ?? "stop"
|
|
@@ -1448,6 +1819,7 @@ function buildTextCompletion(content, model, reasoning, overrides, requestMessag
|
|
|
1448
1819
|
};
|
|
1449
1820
|
}
|
|
1450
1821
|
function buildToolCallCompletion(toolCalls, model, reasoning, overrides, requestMessages) {
|
|
1822
|
+
fixtureCitations("", overrides?.citations);
|
|
1451
1823
|
const promptText = requestMessages ? requestMessages.map((m) => typeof m.content === "string" ? m.content : Array.isArray(m.content) ? m.content.map((p) => p.text ?? "").join("") : "").join("") : "";
|
|
1452
1824
|
const completionText = toolCalls.map((tc) => tc.name + tc.arguments).join("");
|
|
1453
1825
|
return {
|
|
@@ -1584,6 +1956,11 @@ function buildContentWithToolCallsChunks(content, toolCalls, model, chunkSize, r
|
|
|
1584
1956
|
}
|
|
1585
1957
|
tcIdx++;
|
|
1586
1958
|
}
|
|
1959
|
+
chunks.push(...chatAnnotationChunks(outcome.content, overrides, {
|
|
1960
|
+
id,
|
|
1961
|
+
created,
|
|
1962
|
+
model: effectiveModel
|
|
1963
|
+
}));
|
|
1587
1964
|
chunks.push({
|
|
1588
1965
|
id,
|
|
1589
1966
|
object: "chat.completion.chunk",
|
|
@@ -1695,6 +2072,11 @@ function buildContentWithToolCallsChunks(content, toolCalls, model, chunkSize, r
|
|
|
1695
2072
|
});
|
|
1696
2073
|
}
|
|
1697
2074
|
}
|
|
2075
|
+
chunks.push(...chatAnnotationChunks(content, overrides, {
|
|
2076
|
+
id,
|
|
2077
|
+
created,
|
|
2078
|
+
model: effectiveModel
|
|
2079
|
+
}));
|
|
1698
2080
|
chunks.push({
|
|
1699
2081
|
id,
|
|
1700
2082
|
object: "chat.completion.chunk",
|
|
@@ -1732,7 +2114,8 @@ function buildContentWithToolCallsCompletion(content, toolCalls, model, reasonin
|
|
|
1732
2114
|
name: tc.name,
|
|
1733
2115
|
arguments: tc.arguments
|
|
1734
2116
|
}
|
|
1735
|
-
}))
|
|
2117
|
+
})),
|
|
2118
|
+
...annotationsField(content, overrides)
|
|
1736
2119
|
},
|
|
1737
2120
|
logprobs: null,
|
|
1738
2121
|
finish_reason: overrides?.finishReason ?? "tool_calls"
|
|
@@ -2374,5 +2757,5 @@ function parseMcpUndeclared(raw) {
|
|
|
2374
2757
|
}
|
|
2375
2758
|
|
|
2376
2759
|
//#endregion
|
|
2377
|
-
export { FORMAT_TO_CONTENT_TYPE, InvalidFixtureToolCallError, InvalidToolArgumentsError, MAX_EMBEDDING_DIMENSIONS, RequestBodyTooLargeError, UnsupportedToolCallError, assertCustomToolCalls, assertResponsesToolCalls, buildContentWithToolCallsChunks, buildContentWithToolCallsCompletion, buildEmbeddingResponse, buildOpenAIContentFilterChunks, buildOpenAIContentFilterCompletion, buildOpenAIReasoningChunks, buildOpenAIReasoningCompletion, buildOpenAIRefusalChunks, buildOpenAIRefusalCompletion, buildTextChunks, buildTextCompletion, buildToolCallChunks, buildToolCallCompletion, buildUsageChunk, createServerFixtureList, decodeMcpHeaderValue, describeMatch, estimatePromptTokens, estimateTokens, extractOverrides, fixtureListTarget, fixtureToolCallErrorCode, flattenHeaders, formatToMime, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getContext, getTestId, googleFixtureToolCallErrorDetails, hasMintedRequestId, isAudioResponse, isCombinedFixtureResponse, isContentWithToolCallsResponse, isEmbeddingResponse, isErrorResponse, isExtendedResponsesToolsList, isFixtureToolCallError, isImageResponse, isJSONResponse, isJsonObject, isLiveResponse, isResponseFactory, isServerOwnedFixtures, isTextResponse, isToolCallResponse, isTranscriptionResponse, isVideoResponse, journalFixtureToolCallError, keepAuthoredToolArguments, markExtendedResponsesToolsRequest, markMintedRequestId, markServerOwnedFixtures, matchesPattern, normalizeEmbeddingInput, normalizeTextInput, parseStrictIntegerText, prepareOpenAIChatMisbehavior, readBody, readBodyBufferBounded, rebuildOrderedBlocks, rejectResponsesOnlyToolCalls, requireEmittedFunctionToolCalls, requireFunctionToolCalls, requireServedFunctionToolCalls, resolveFixtureBlockOutcome, resolveFixtureBlocks, resolveMcpIdentity, resolveOpenAIChatMisbehaviorUsage, resolveReasoningArtifactsForModel, resolveReasoningForModel, resolveRequestId, resolveResponse, resolveResponsesBlocks, resolveServedBlockOutcome, resolveTestId, resolveUsage, runWithToolArgumentsScope, serializeErrorResponse, servedToolArgs, servedToolCalls, slugifyContext, slugifyTestId, strictNoMatchLogLine, strictNoMatchMessage, strictToolArgumentsEnabled, toolArgsForWire, toolCallFixtureBlock, validateChatMessages, validateEmbeddingDimensions, validateToolsField, withServedToolCalls, withoutLegacyNamespaces, withoutResponsesToolKeys, wouldProxyMiss };
|
|
2760
|
+
export { FORMAT_TO_CONTENT_TYPE, InvalidFixtureOutputError, InvalidFixtureToolCallError, InvalidToolArgumentsError, MAX_EMBEDDING_DIMENSIONS, RequestBodyTooLargeError, UnsupportedGeneratedFileError, UnsupportedToolCallError, assertCustomToolCalls, assertResponsesToolCalls, buildContentWithToolCallsChunks, buildContentWithToolCallsCompletion, buildEmbeddingResponse, buildOpenAIContentFilterChunks, buildOpenAIContentFilterCompletion, buildOpenAIReasoningChunks, buildOpenAIReasoningCompletion, buildOpenAIRefusalChunks, buildOpenAIRefusalCompletion, buildTextChunks, buildTextCompletion, buildToolCallChunks, buildToolCallCompletion, buildUsageChunk, createServerFixtureList, decodeMcpHeaderValue, describeMatch, estimatePromptTokens, estimateTokens, extractOverrides, fixtureCitations, fixtureCitationsProblem, fixtureFiles, fixtureFilesProblem, fixtureListTarget, fixtureToolCallErrorCode, flattenHeaders, formatToMime, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, getContext, getTestId, googleFixtureToolCallErrorDetails, hasMintedRequestId, isAudioResponse, isCombinedFixtureResponse, isContentWithToolCallsResponse, isEmbeddingResponse, isErrorResponse, isExtendedResponsesToolsList, isFixtureToolCallError, isImageResponse, isJSONResponse, isJsonObject, isLiveResponse, isRawResponse, isResponseFactory, isServerOwnedFixtures, isTextResponse, isToolCallResponse, isTranscriptionResponse, isVideoResponse, journalFixtureToolCallError, keepAuthoredToolArguments, markExtendedResponsesToolsRequest, markMintedRequestId, markServerOwnedFixtures, matchesPattern, normalizeEmbeddingInput, normalizeTextInput, parseStrictIntegerText, prepareOpenAIChatMisbehavior, readBody, readBodyBufferBounded, rebuildOrderedBlocks, rejectGeneratedFiles, rejectResponsesOnlyToolCalls, requireEmittedFunctionToolCalls, requireFunctionToolCalls, requireServedFunctionToolCalls, resolveCitations, resolveFixtureBlockOutcome, resolveFixtureBlocks, resolveMcpIdentity, resolveOpenAIChatMisbehaviorUsage, resolveReasoningArtifactsForModel, resolveReasoningForModel, resolveRequestId, resolveResponse, resolveResponsesBlocks, resolveServedBlockOutcome, resolveTestId, resolveUsage, runWithToolArgumentsScope, serializeErrorResponse, servedToolArgs, servedToolCalls, slugifyContext, slugifyTestId, strictNoMatchLogLine, strictNoMatchMessage, strictToolArgumentsEnabled, surrogateSafeChunks, toolArgsForWire, toolCallFixtureBlock, validateChatMessages, validateEmbeddingDimensions, validateToolsField, withServedToolCalls, withoutLegacyNamespaces, withoutResponsesToolKeys, wouldProxyMiss };
|
|
2378
2761
|
//# sourceMappingURL=helpers.js.map
|