@evalguard/vercel-ai 1.0.0 → 1.0.2

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/dist/index.js CHANGED
@@ -8,10 +8,17 @@
8
8
  * EvalGuard project. Guardrail semantics are fail-CLOSED when
9
9
  * blockOnViolation is on (the default): if the firewall is unreachable the
10
10
  * call is BLOCKED with an EvalguardBlockedError, matching the langchain /
11
- * llamaindex wrappers. In monitor-only mode (blockOnViolation:false) a
12
- * guardrail outage is swallowed and the call proceeds. Trace logging always
11
+ * llamaindex wrappers. In monitor-only mode (blockOnViolation:false) the call
12
+ * proceeds and the outage is RECORDED on the trace as a `guardrail_unavailable`
13
+ * violation — it used to be silently swallowed, which made an unguarded call
14
+ * indistinguishable from a guarded one (audit 2026-08-07). Trace logging always
13
15
  * fails open — a logging error never breaks or delays the user's call.
14
16
  *
17
+ * SCOPE: this wrapper runs the INPUT rail only. Model output is streamed and
18
+ * returned verbatim and is never scanned — there is no `evalOnResponse` here,
19
+ * unlike @evalguard/openai, @evalguard/anthropic and @evalguard/gemini. Passing
20
+ * `evalOnResponse` to `withEvalguard` logs a warning and has no effect.
21
+ *
15
22
  * Usage:
16
23
  *
17
24
  * import { openai } from "@ai-sdk/openai";
@@ -51,9 +58,26 @@
51
58
  *
52
59
  * Instead of importing `wrapLanguageModel` we re-implement the same "delegate
53
60
  * to the model, override doGenerate/doStream" shape directly, as a PROXY over
54
- * the original model. Everything except the two call methods is forwarded to the
55
- * real instance, so capability fields — most importantly `supportedUrls` —
56
- * pass through untouched. Two earlier versions got this wrong:
61
+ * the original model.
62
+ *
63
+ * That proxy is DEFAULT-DENY as of 2026-08-08. Until then it forwarded
64
+ * everything except `doGenerate` / `doStream` straight to `Reflect.get` — a
65
+ * denylist of two guarded names — on the recorded argument that the AI SDK model
66
+ * interface is "a fixed, tiny surface". `@ai-sdk/provider@3.0.10` in fact
67
+ * declares FOUR call methods across SEVEN model specifications, and `doEmbed`
68
+ * (embedding models) and `doRerank` (reranking models) were measured delivering
69
+ * attack text to the provider on ZERO firewall calls, as were speech and
70
+ * transcription calls whose payload lives in `options.text` / `options.audio`
71
+ * rather than `options.prompt`. Every property is now guarded unless
72
+ * `./surface.ts` names it, using the same wrapper-core machinery as
73
+ * `@evalguard/anthropic` and `@evalguard/gemini`, so a method the AI SDK ships
74
+ * tomorrow is gated on the day it lands.
75
+ *
76
+ * Capability fields — most importantly `supportedUrls` — still pass through
77
+ * untouched; they are on the policy's justified passthrough set for exactly that
78
+ * reason, and `src/__tests__/model-spec-surface-matrix.test.ts` asserts a
79
+ * wrapped model's `supportedUrls` RegExps still work and cost zero firewall
80
+ * requests. Two earlier versions got this wrong:
57
81
  * 1. hand-copying a fixed list of V1 props (`supportsUrl`,
58
82
  * `supportsImageUrls`, …) that no longer exist on a V2 model, which
59
83
  * silently STRIPPED `supportedUrls` (audit MEDIUM 2026-07-14);
@@ -69,8 +93,122 @@
69
93
  *
70
94
  * Spec reference: https://sdk.vercel.ai/docs/ai-sdk-core/middleware
71
95
  */
72
- import { GuardrailClient, collapsePromptText } from "@evalguard/wrapper-core";
96
+ import { GuardrailClient, collapsePromptText, collectRequestStrings, isNonModelTextKey, ScanBoundExceededError, guardSurfaceProp, assertSurfacePolicy, } from "@evalguard/wrapper-core";
73
97
  import { estimateCostDetailed } from "./cost.js";
98
+ import { vercelAiSurfacePolicy } from "./surface.js";
99
+ /**
100
+ * Every key {@link WithEvalguardConfig} recognises. Used only to WARN about
101
+ * unrecognised keys — see {@link assertValidConfig}.
102
+ */
103
+ const KNOWN_CONFIG_KEYS = new Set([
104
+ "apiKey",
105
+ "projectId",
106
+ "baseUrl",
107
+ "blockOnViolation",
108
+ "disableLogging",
109
+ "disableGuardrails",
110
+ "metadata",
111
+ ]);
112
+ const warnedUnknownOptions = new Set();
113
+ /** Describe a rejected value for an error message WITHOUT echoing a secret. */
114
+ function describeConfigValue(v) {
115
+ if (v === undefined)
116
+ return "undefined";
117
+ if (v === null)
118
+ return "null";
119
+ if (typeof v === "string")
120
+ return v.trim() === "" ? `an empty/whitespace-only string` : "a string";
121
+ return `a ${typeof v}`;
122
+ }
123
+ /**
124
+ * Validate `config` at wrap time, so a misconfiguration is a loud error HERE
125
+ * rather than a silent per-request failure later.
126
+ *
127
+ * AUDIT 2026-08-07 (vercel-ai surface E2E). `withEvalguard` performed no
128
+ * validation at all beyond what `GuardrailClient` happened to do for `baseUrl`.
129
+ * Measured against the shipped `dist/`:
130
+ *
131
+ * - `apiKey: undefined` and `apiKey: 12345` were ACCEPTED at wrap time. At
132
+ * call time `resolveApiKey` does `resolver()` on a non-string, which throws
133
+ * `TypeError: resolver is not a function` INSIDE withRetry — so the
134
+ * firewall request was never even attempted (measured: 0 HTTP requests) and
135
+ * every call surfaced the generic "guardrail unavailable". Under the
136
+ * default `blockOnViolation: true` that is fail-closed but undiagnosable;
137
+ * under `blockOnViolation: false` it means the customer runs COMPLETELY
138
+ * UNGUARDED with no signal at all.
139
+ * - `apiKey: ""` and `apiKey: " "` were ACCEPTED and put a credential-less
140
+ * `Authorization: Bearer` on the wire (measured on a loopback stub).
141
+ * - `baseUrl: "ftp://…"`, `"javascript:alert(1)"`, `"file:///c:/tmp"` and a
142
+ * `data:` URL were all ACCEPTED: `assertSecureBaseUrl` only rejects `http:`
143
+ * for a non-loopback host, so every OTHER scheme sailed through and failed
144
+ * at fetch time instead — again as a per-request "guardrail unavailable".
145
+ *
146
+ * The `apiKey` type here is `string`, but a function is accepted at runtime
147
+ * because wrapper-core's `resolveApiKey` supports a BYOK resolver and rejecting
148
+ * one would break a caller relying on that.
149
+ */
150
+ function assertValidConfig(config) {
151
+ if (config === null || typeof config !== "object") {
152
+ throw new Error("withEvalguard: a config object is required, e.g. " +
153
+ '`withEvalguard(model, { apiKey: process.env.EVALGUARD_API_KEY! })`.');
154
+ }
155
+ const apiKey = config.apiKey;
156
+ // A BYOK resolver (() => string | Promise<string>) is resolved per call by
157
+ // wrapper-core — we cannot validate its result here, only that it exists.
158
+ if (typeof apiKey !== "function" && (typeof apiKey !== "string" || apiKey.trim() === "")) {
159
+ throw new Error(`withEvalguard: \`apiKey\` must be a non-empty EvalGuard API key (got ${describeConfigValue(apiKey)}). ` +
160
+ "This is usually an unset or empty EVALGUARD_API_KEY — get a key at " +
161
+ "https://evalguard.ai/dashboard/api-keys. Failing here is deliberate: without a usable key " +
162
+ "every guardrail check fails, which blocks every request under the default " +
163
+ "blockOnViolation:true and silently runs UNGUARDED under blockOnViolation:false.");
164
+ }
165
+ if (config.baseUrl !== undefined) {
166
+ if (typeof config.baseUrl !== "string" || config.baseUrl.trim() === "") {
167
+ throw new Error(`withEvalguard: \`baseUrl\` must be a non-empty https:// URL (got ${describeConfigValue(config.baseUrl)}).`);
168
+ }
169
+ let parsed;
170
+ try {
171
+ parsed = new URL(config.baseUrl.trim());
172
+ }
173
+ catch {
174
+ throw new Error(`withEvalguard: \`baseUrl\` is not a valid URL: "${config.baseUrl}"`);
175
+ }
176
+ // Scheme ALLOW-list. wrapper-core's assertSecureBaseUrl rejects `http:` on a
177
+ // non-loopback host (it still runs, right after this, and still owns that
178
+ // rule) — but it deny-lists exactly one scheme, so `ftp:` / `file:` /
179
+ // `data:` / `javascript:` passed. None of them can carry an EvalGuard API
180
+ // call; accepting them only defers the error to every request.
181
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
182
+ throw new Error(`withEvalguard: \`baseUrl\` must use https:// (got "${config.baseUrl}"). ` +
183
+ `"${parsed.protocol}" is not an HTTP(S) scheme, so no guardrail request can ever succeed against it. ` +
184
+ "Use https://, or http://localhost for local testing.");
185
+ }
186
+ }
187
+ // Unknown keys WARN rather than throw: every documented boolean option fails
188
+ // SAFE when misspelled (`blockOnViolation`/`disableGuardrails`/`disableLogging`
189
+ // all fall back to the guarded default), so a hard throw would be a breaking
190
+ // change for no security gain. It is still worth saying out loud — a
191
+ // misspelled option is silently inert, and the sibling wrappers' options
192
+ // (`evalOnResponse`, `onViolation`, `retry`, `circuit`, `idempotency`) are
193
+ // NOT implemented here, so passing one silently gets you less than you asked
194
+ // for.
195
+ const unknown = Object.keys(config).filter((k) => !KNOWN_CONFIG_KEYS.has(k));
196
+ if (unknown.length > 0) {
197
+ const signature = unknown.slice().sort().join(",");
198
+ if (!warnedUnknownOptions.has(signature)) {
199
+ warnedUnknownOptions.add(signature);
200
+ console.warn(`[evalguard] withEvalguard: ignoring unknown option(s): ${unknown.join(", ")}. ` +
201
+ `Supported options are: ${[...KNOWN_CONFIG_KEYS].join(", ")}. ` +
202
+ "An unknown option has NO effect — check for a typo, and note that " +
203
+ "evalOnResponse / onViolation / retry / circuit / idempotency are supported by " +
204
+ "@evalguard/openai, @evalguard/anthropic and @evalguard/gemini but NOT by this wrapper.");
205
+ }
206
+ }
207
+ }
208
+ /** Internal — lets the test suite re-arm the once-per-process unknown-option warning. */
209
+ export function _resetConfigWarningsForTests() {
210
+ warnedUnknownOptions.clear();
211
+ }
74
212
  /**
75
213
  * Error thrown when blockOnViolation=true and the input is rejected by
76
214
  * EvalGuard's firewall. Customers can catch this distinctly from provider
@@ -140,55 +278,109 @@ function extractOutputText(result) {
140
278
  * ai@6 + @ai-sdk/openai@3 and ai@7 + @ai-sdk/openai@4 from packed tarballs on
141
279
  * 2026-08-02, and pinned by `src/__tests__/ai-sdk-assignability.test.ts`.
142
280
  *
143
- * Only `doGenerate` / `doStream` are intercepted; every other property read
144
- * (including prototype getters such as `supportedUrls` on a class-based
145
- * provider model) is forwarded to the real instance, so capability fields
146
- * compose with other middleware (caching, logging) the customer may already
147
- * have.
281
+ * `doGenerate` / `doStream` get the rich interception (stream teeing, token
282
+ * accounting, cost, trace logging). Every OTHER property is default-deny: a
283
+ * capability or identity field named on `./surface.ts`'s justified passthrough
284
+ * set is forwarded to the real instance verbatim including prototype getters
285
+ * such as `supportedUrls` on a class-based provider model, so capability fields
286
+ * still compose with other middleware (caching, logging) the customer may
287
+ * already have — and anything else that is callable is put behind the firewall.
288
+ * See `./surface.ts` for why: `Reflect.get` for everything unlisted was measured
289
+ * shipping attack text to the provider on zero firewall calls.
148
290
  */
149
291
  export function withEvalguard(model, config) {
292
+ assertValidConfig(config);
150
293
  const guardrail = new GuardrailClient({ apiKey: config.apiKey, baseUrl: config.baseUrl });
151
294
  const blockOnViolation = config.blockOnViolation ?? true;
152
295
  const enableLogging = !config.disableLogging;
153
296
  const enableGuardrails = !config.disableGuardrails;
297
+ /**
298
+ * Run the pre-call input rail. Returns the verdict to attach to the trace, or
299
+ * `undefined` when there was genuinely no input to scan. Throws
300
+ * `EvalguardBlockedError` when the call must not proceed.
301
+ *
302
+ * ONE implementation shared by doGenerate and doStream. It was duplicated
303
+ * verbatim in both until 2026-08-07, which is how a guardrail fix lands on one
304
+ * path and not the other.
305
+ */
306
+ const runInputRail = async (params) => {
307
+ if (!enableGuardrails)
308
+ return undefined;
309
+ try {
310
+ // NOTE: collapsePrompt is INSIDE the try. It can throw (an unserialisable
311
+ // prompt — see collapsePrompt), and "the wrapper could not read the input"
312
+ // must route through the same fail-CLOSED path as "the firewall could not
313
+ // answer", never past the rail.
314
+ const promptText = collapsePrompt(params);
315
+ if (!promptText)
316
+ return undefined;
317
+ const result = await guardrail.checkInput(promptText, {
318
+ provider: model.provider,
319
+ model: model.modelId,
320
+ ...config.metadata,
321
+ });
322
+ if (!result.allowed && blockOnViolation) {
323
+ throw new EvalguardBlockedError(`Request blocked by EvalGuard guardrails: ${result.violations.map((v) => v.type).join(", ")}`, result.violations);
324
+ }
325
+ return result;
326
+ }
327
+ catch (err) {
328
+ if (err instanceof EvalguardBlockedError)
329
+ throw err;
330
+ // A payload the scanner could not read IN FULL is REFUSED, in both modes.
331
+ //
332
+ // Deliberately NOT routed through `blockOnViolation` below, matching
333
+ // wrapper-core's `gateSurfaceMethod`: a monitor-only caller still must not
334
+ // forward bytes we never examined. This is a NEW throw source as of the
335
+ // 2026-08-08 whole-body walk, and letting it fall into the monitor-only
336
+ // branch would have introduced a fresh fail-open right beside the one that
337
+ // branch exists to close.
338
+ if (err instanceof ScanBoundExceededError) {
339
+ throw new EvalguardBlockedError(`Request blocked: EvalGuard could not scan the whole request body (${err.message}). ` +
340
+ "A partially-scanned payload reports clean on the bytes it never examined, so it is refused.", [{ type: "scan_bound_exceeded", severity: "high", message: err.message }]);
341
+ }
342
+ // wrapper-core.checkInput fails CLOSED on a guardrail outage
343
+ // (throws once retries/circuit give up). Honor blockOnViolation:
344
+ // an unreachable guardrail BLOCKS the call when it's on, and is
345
+ // recorded (the call proceeds, monitor-only) when it's off.
346
+ // Mirrors the langchain / llamaindex wrappers.
347
+ if (blockOnViolation) {
348
+ throw new EvalguardBlockedError(`Request blocked: guardrail unavailable (${err instanceof Error ? err.message : "unknown"})`, [{
349
+ type: "guardrail_unavailable",
350
+ severity: "high",
351
+ message: err instanceof Error ? err.message : "guardrail check failed",
352
+ }]);
353
+ }
354
+ // AUDIT 2026-08-07 (vercel-ai surface E2E). Monitor-only mode used to
355
+ // SWALLOW the outage and leave `guardrailResult` undefined, so the trace
356
+ // POSTed `guardrailResult: undefined` and its metadata carried only
357
+ // provider/model/cost/costPricingSource/timestamp — nothing said the rail
358
+ // had not run. README.md promised the opposite in so many words:
359
+ // "`blockOnViolation: false` — the call proceeds and the outage is
360
+ // recorded." Measured on both doGenerate and doStream against a stub that
361
+ // 500s /firewall/check: no mention of the outage anywhere in the trace.
362
+ // An unguarded call that looks identical to a guarded one is the whole
363
+ // reason monitor-only mode is dangerous, so record it.
364
+ //
365
+ // `allowed: true` states what happened to the CALL (it proceeded, as
366
+ // monitor-only mode requires); the violation states WHY it was unguarded.
367
+ return {
368
+ allowed: true,
369
+ violations: [{
370
+ type: "guardrail_unavailable",
371
+ severity: "high",
372
+ message: err instanceof Error ? err.message : "guardrail check failed",
373
+ }],
374
+ };
375
+ }
376
+ };
154
377
  const overrides = {
155
378
  async doGenerate(params) {
156
379
  const t0 = performance.now();
157
- let guardrailResult;
158
380
  // Pre-call: extract a single text representation of the prompt for
159
381
  // the firewall. Vercel's prompt shape is varied (chat / completion),
160
382
  // so we collapse to a string the firewall can scan.
161
- if (enableGuardrails) {
162
- const promptText = collapsePrompt(params);
163
- if (promptText) {
164
- try {
165
- guardrailResult = await guardrail.checkInput(promptText, {
166
- provider: model.provider,
167
- model: model.modelId,
168
- ...config.metadata,
169
- });
170
- if (!guardrailResult.allowed && blockOnViolation) {
171
- throw new EvalguardBlockedError(`Request blocked by EvalGuard guardrails: ${guardrailResult.violations.map((v) => v.type).join(", ")}`, guardrailResult.violations);
172
- }
173
- }
174
- catch (err) {
175
- if (err instanceof EvalguardBlockedError)
176
- throw err;
177
- // wrapper-core.checkInput fails CLOSED on a guardrail outage
178
- // (throws once retries/circuit give up). Honor blockOnViolation:
179
- // an unreachable guardrail BLOCKS the call when it's on, and is
180
- // swallowed (the call proceeds, monitor-only) when it's off.
181
- // Mirrors the langchain / llamaindex wrappers.
182
- if (blockOnViolation) {
183
- throw new EvalguardBlockedError(`Request blocked: guardrail unavailable (${err instanceof Error ? err.message : "unknown"})`, [{
184
- type: "guardrail_unavailable",
185
- severity: "high",
186
- message: err instanceof Error ? err.message : "guardrail check failed",
187
- }]);
188
- }
189
- }
190
- }
191
- }
383
+ const guardrailResult = await runInputRail(params);
192
384
  const result = await model.doGenerate(params);
193
385
  const latencyMs = Math.round(performance.now() - t0);
194
386
  // Post-call: log trace fire-and-forget so we never delay the user's
@@ -215,38 +407,7 @@ export function withEvalguard(model, config) {
215
407
  },
216
408
  async doStream(params) {
217
409
  const t0 = performance.now();
218
- let guardrailResult;
219
- if (enableGuardrails) {
220
- const promptText = collapsePrompt(params);
221
- if (promptText) {
222
- try {
223
- guardrailResult = await guardrail.checkInput(promptText, {
224
- provider: model.provider,
225
- model: model.modelId,
226
- ...config.metadata,
227
- });
228
- if (!guardrailResult.allowed && blockOnViolation) {
229
- throw new EvalguardBlockedError(`Request blocked by EvalGuard guardrails: ${guardrailResult.violations.map((v) => v.type).join(", ")}`, guardrailResult.violations);
230
- }
231
- }
232
- catch (err) {
233
- if (err instanceof EvalguardBlockedError)
234
- throw err;
235
- // wrapper-core.checkInput fails CLOSED on a guardrail outage
236
- // (throws once retries/circuit give up). Honor blockOnViolation:
237
- // an unreachable guardrail BLOCKS the call when it's on, and is
238
- // swallowed (the call proceeds, monitor-only) when it's off.
239
- // Mirrors the langchain / llamaindex wrappers.
240
- if (blockOnViolation) {
241
- throw new EvalguardBlockedError(`Request blocked: guardrail unavailable (${err instanceof Error ? err.message : "unknown"})`, [{
242
- type: "guardrail_unavailable",
243
- severity: "high",
244
- message: err instanceof Error ? err.message : "guardrail check failed",
245
- }]);
246
- }
247
- }
248
- }
249
- }
410
+ const guardrailResult = await runInputRail(params);
250
411
  const result = await model.doStream(params);
251
412
  // Tee the stream — assemble the final text + token totals as parts
252
413
  // arrive, then log a trace once `finish` lands. Pass-through preserves
@@ -339,25 +500,91 @@ export function withEvalguard(model, config) {
339
500
  return { ...result, stream: wrappedStream };
340
501
  },
341
502
  };
342
- return new Proxy(model, {
343
- get(target, prop) {
344
- if (prop === "doGenerate")
503
+ // ── The default-deny surface ──────────────────────────────────────────────
504
+ //
505
+ // AUDIT 2026-08-08. This trap used to read, in full:
506
+ //
507
+ // if (prop === "doGenerate") return overrides.doGenerate;
508
+ // if (prop === "doStream") return overrides.doStream;
509
+ // …
510
+ // const value = Reflect.get(target, prop, target);
511
+ // return typeof value === "function" ? value.bind(target) : value;
512
+ //
513
+ // — a DENYLIST of two guarded names with `Reflect.get` for everything else,
514
+ // the identical shape that made `@evalguard/anthropic@1.2.1` and
515
+ // `@evalguard/gemini@1.0.1` bypassable. It survived a wrapper sweep on the
516
+ // argument that the AI SDK model interface is "fixed and tiny". It is neither:
517
+ // `@ai-sdk/provider@3.0.10` declares `doGenerate`, `doStream`, `doEmbed` and
518
+ // `doRerank` across seven model specifications, and `doEmbed` / `doRerank`
519
+ // delivered attack text to the provider on ZERO firewall calls. See
520
+ // `./surface.ts` for the file:line inventory and the measured matrix.
521
+ //
522
+ // Now: every property is guarded unless `VERCEL_AI_SURFACE_POLICY` names it,
523
+ // and `guardSurfaceProp` is wrapper-core's — shared with anthropic and gemini
524
+ // — so a method the AI SDK ships TOMORROW is gated on the day it lands with no
525
+ // change here.
526
+ const ctx = {
527
+ guardrail,
528
+ blockOnViolation,
529
+ enableLogging,
530
+ config: {
531
+ apiKey: config.apiKey,
532
+ baseUrl: config.baseUrl,
533
+ blockOnViolation,
534
+ enableLogging,
535
+ projectId: config.projectId,
536
+ metadata: config.metadata,
537
+ },
538
+ policy: vercelAiSurfacePolicy(model.modelId),
539
+ dedicatedProxy: (name, value) => {
540
+ if (name === "doGenerate")
345
541
  return overrides.doGenerate;
346
- if (prop === "doStream")
542
+ if (name === "doStream")
347
543
  return overrides.doStream;
544
+ return value;
545
+ },
546
+ logTrace: (entry) => {
547
+ // A generically-gated method is by definition one this wrapper has no
548
+ // result shape for, so token counts and output text are not available.
549
+ // Recording 0/null is honest; omitting the trace entirely would make an
550
+ // ungated-looking call invisible, which is the failure this file's
551
+ // monitor-only fix exists to prevent.
552
+ const { costUsd: cost, pricingSource: costPricingSource } = estimateCostDetailed(entry.model, 0, 0);
553
+ void guardrail.logTrace({
554
+ model: entry.model,
555
+ provider: model.provider,
556
+ input: entry.promptText,
557
+ output: null,
558
+ latencyMs: entry.latencyMs,
559
+ tokenUsage: { input: 0, output: 0 },
560
+ cost,
561
+ costPricingSource,
562
+ projectId: config.projectId,
563
+ metadata: { ...config.metadata, api: entry.label },
564
+ guardrailResult: entry.guardrailResult,
565
+ traceId: entry.traceId,
566
+ });
567
+ },
568
+ };
569
+ // Fails HERE, on the customer's first `withEvalguard(...)`, if the policy and
570
+ // this file ever disagree about which names are dedicated vs passthrough —
571
+ // rather than on the one call site nobody tested.
572
+ assertSurfacePolicy(ctx.policy);
573
+ return new Proxy(model, {
574
+ get(target, prop) {
575
+ if (typeof prop !== "string")
576
+ return Reflect.get(target, prop, target);
348
577
  // Proxy invariant: a non-configurable, non-writable own data property
349
- // MUST be reported verbatim (returning a bound copy would throw).
578
+ // MUST be reported verbatim (returning a bound copy, or a guarded proxy
579
+ // over it, makes the engine throw). This check runs BEFORE the guard
580
+ // because the invariant is not negotiable — but it can only ever apply to
581
+ // a frozen own DATA property, never to a method resolved off a prototype,
582
+ // which is where every `@ai-sdk/provider` call method lives.
350
583
  const own = Object.getOwnPropertyDescriptor(target, prop);
351
584
  if (own && own.configurable === false && own.writable === false) {
352
585
  return own.value;
353
586
  }
354
- // Read with the TARGET as receiver, not the proxy, so a prototype getter
355
- // that touches private state resolves against the real instance.
356
- const value = Reflect.get(target, prop, target);
357
- // Bind provider methods to the real model for the same reason — an
358
- // unbound prototype method invoked as `wrapped.foo()` would get the
359
- // Proxy as `this`.
360
- return typeof value === "function" ? value.bind(target) : value;
587
+ return guardSurfaceProp(target, prop, ctx);
361
588
  },
362
589
  });
363
590
  }
@@ -380,9 +607,114 @@ export function withEvalguard(model, config) {
380
607
  * Now delegates to wrapper-core's `collapsePromptText`: every role, no
381
608
  * truncation, and shared with the langchain / llamaindex wrappers so the
382
609
  * three copies cannot drift apart again.
610
+ *
611
+ * AUDIT 2026-08-07 (vercel-ai surface E2E) — the RESIDUE fallback below.
612
+ * `collapsePromptText` reads a message's text out of `content` (and, only when
613
+ * `content == null`, `output` / `input`). Any OTHER key on the message object
614
+ * is never read, and the caller's rule was `if (promptText) { …check… }` — so
615
+ * "the collapser surfaced nothing" meant SKIP THE RAIL ENTIRELY and call the
616
+ * model anyway. Measured against the shipped `dist/`, with a healthy reachable
617
+ * firewall:
618
+ *
619
+ * collapsePromptText([{ role: "user", text: "INJECTION" }]) -> ""
620
+ * collapsePromptText([{ role: "user", parts: [{type:"text",text:"…"}] }]) -> ""
621
+ *
622
+ * and for both, `checkInput` was never called while the model WAS called. The
623
+ * second shape is the AI SDK's own UIMessage `parts` layout — `generateText` /
624
+ * `streamText` normalise it to `content` before the model boundary, so this is
625
+ * not reachable through the documented quickstart, but `withEvalguard` returns
626
+ * a model that any middleware chain or hand-built provider can drive directly.
627
+ *
628
+ * The failure MODE is the point: "no scannable text extracted" was treated as
629
+ * "nothing to scan" when what it actually means is "the scanner could not read
630
+ * this input" — the same conflation `firewall-response.ts` exists to reject on
631
+ * the response side, and the same one `message-text.ts` calls out ("a
632
+ * recognised set that produced only blanks proves nothing was read"). So when
633
+ * the prompt still carries payload, hand the raw bytes to the firewall rather
634
+ * than waving the call through.
383
635
  */
384
636
  function collapsePrompt(params) {
385
- return collapsePromptText(params.prompt);
637
+ const prompt = params.prompt;
638
+ const parts = [];
639
+ const seen = new Set();
640
+ const push = (chunk) => {
641
+ if (!chunk || seen.has(chunk))
642
+ return;
643
+ seen.add(chunk);
644
+ parts.push(chunk);
645
+ };
646
+ // (1) The prompt-shaped render. Kept as the FLOOR, not as the gate: it knows
647
+ // how to collapse the AI SDK's message/part shapes into readable prose, which
648
+ // a generic walk would only ever produce as JSON.
649
+ push(collapsePromptText(prompt));
650
+ // (2) AUDIT 2026-08-08 — the whole-body walk, unioned on top.
651
+ //
652
+ // `params.prompt` is where a LANGUAGE model's text lives, and reading only
653
+ // that field is why speech and transcription calls were measured reaching the
654
+ // provider on ZERO firewall checks: `SpeechModelV3CallOptions` carries its
655
+ // payload in `text` / `instructions` and `TranscriptionModelV3CallOptions` in
656
+ // `audio` / `mediaType`, so `collapsePromptText(undefined)` returned "" and
657
+ // the caller's `if (promptText)` rule skipped the rail entirely. That is the
658
+ // same "an unrecognised field means there was nothing to scan" conflation
659
+ // wrapper-core's `request-scan.ts` exists to reject.
660
+ //
661
+ // This walks EVERY value at EVERY depth of the call options, excluding only
662
+ // wrapper-core's small reasoned `NON_MODEL_TEXT_KEYS` denylist (`headers`,
663
+ // `apiKey`, `authorization`, binary blobs by shape, …). It also picks up the
664
+ // parts of a LANGUAGE call that `collapsePromptText` never looked at — tool
665
+ // descriptions and JSON-schema parameters, which are model-visible and are a
666
+ // documented injection channel in agent apps.
667
+ for (const chunk of collectRequestStrings(params, { isExcludedKey: isNonModelTextKey })) {
668
+ push(chunk);
669
+ }
670
+ if (parts.length > 0)
671
+ return parts.join("\n");
672
+ // Collapse produced nothing. If the prompt is genuinely empty there is
673
+ // nothing to scan and skipping is correct (no bytes reach the model either).
674
+ if (!carriesPayload(prompt))
675
+ return "";
676
+ // Payload present but unsurfaced — scan the serialised prompt itself.
677
+ try {
678
+ const json = JSON.stringify(prompt);
679
+ if (json)
680
+ return json;
681
+ }
682
+ catch {
683
+ /* circular / BigInt — fall through to the throw below */
684
+ }
685
+ // Cannot render the prompt at all, so the firewall cannot see the input.
686
+ // Throwing routes this into runInputRail's catch, i.e. the same fail-CLOSED
687
+ // path as an outage. Never return "" here: that is the skip we just closed.
688
+ throw new Error("EvalGuard could not render the prompt for scanning (unserialisable value), " +
689
+ "so the input guardrail could not be evaluated");
690
+ }
691
+ /**
692
+ * Does `value` carry anything a scanner would want to see, ignoring the
693
+ * `role` / `type` discriminators that every message has by construction?
694
+ *
695
+ * Used only to tell "the prompt is genuinely empty" (skip the rail — correct,
696
+ * nothing reaches the model) from "the collapser did not surface what is
697
+ * there" (scan the raw bytes). See {@link collapsePrompt}.
698
+ */
699
+ const PROMPT_DISCRIMINATOR_KEYS = new Set(["role", "type"]);
700
+ function carriesPayload(value, depth = 0) {
701
+ if (value == null)
702
+ return false;
703
+ if (typeof value === "string")
704
+ return value.trim() !== "";
705
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
706
+ return true;
707
+ }
708
+ // Deeper than we will walk — assume payload rather than assume empty.
709
+ if (depth > 8)
710
+ return true;
711
+ if (Array.isArray(value))
712
+ return value.some((v) => carriesPayload(v, depth + 1));
713
+ if (typeof value === "object") {
714
+ return Object.entries(value).some(([k, v]) => !PROMPT_DISCRIMINATOR_KEYS.has(k) && carriesPayload(v, depth + 1));
715
+ }
716
+ // symbol / function — opaque, so treat as payload (fail toward scanning).
717
+ return true;
386
718
  }
387
719
  // ── Cost estimation (public surface) ────────────────────────────────────────
388
720
  // The README's "Cost estimates" section tells the customer to
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA6B,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AA2MjD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,UAAU,CAAqC;IACxD,YAAY,OAAe,EAAE,UAA8C;QACzE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,KAA8B;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACjF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC1E,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,oEAAoE;AACpE,SAAS,UAAU,CAAC,KAAuC;IACzD,OAAO;QACL,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,KAAK,EAAE,YAAY,IAAI,CAAC;QACrE,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,IA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