@vellumai/assistant 0.11.10-dev.202609091224.201657f → 0.11.10-dev.202609091315.2a4dd13
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/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prompt caching on the OpenAI Responses transport: request-wide
|
|
3
|
-
* `prompt_cache_key` emission for every
|
|
4
|
-
* implicit-mode models,
|
|
5
|
-
* explicit
|
|
6
|
-
*
|
|
3
|
+
* `prompt_cache_key` emission for every Responses model (routing affinity for
|
|
4
|
+
* implicit-mode models, including the Codex subscription endpoint; opt-in
|
|
5
|
+
* explicit mode for breakpoint-capable direct-API models), explicit
|
|
6
|
+
* `prompt_cache_options` and block-level `prompt_cache_breakpoint` anchor
|
|
7
|
+
* placement for GPT-5.6+ (turn-start / previous-turn / advancing tail,
|
|
7
8
|
* mirroring the Anthropic client), the `disableCache`
|
|
8
9
|
* explicit-mode-with-zero-markers opt-out, and the unflagged-model and Codex
|
|
9
10
|
* regression guards.
|
|
@@ -389,19 +390,52 @@ describe("OpenAIResponsesProvider explicit prompt caching (GPT-5.6+)", () => {
|
|
|
389
390
|
expect(breakpointedItemIndexes()).toEqual([0]);
|
|
390
391
|
});
|
|
391
392
|
|
|
392
|
-
test("codex subscription endpoint
|
|
393
|
+
test("codex subscription endpoint sends prompt_cache_key but no explicit-mode params", async () => {
|
|
393
394
|
const provider = makeProvider("gpt-5.6-sol", true);
|
|
394
395
|
await provider.sendMessage([userMsg("hi")], {
|
|
395
396
|
config: { promptCacheKey: "conv-1" },
|
|
396
397
|
});
|
|
397
398
|
|
|
399
|
+
// Codex uses implicit prefix caching. The key is a supported routing
|
|
400
|
+
// field (same as the official Codex client); prompt_cache_options,
|
|
401
|
+
// breakpoints, and prompt_cache_retention are not.
|
|
402
|
+
expect(lastStreamParams?.prompt_cache_key).toBe("conv-1");
|
|
398
403
|
expect(lastStreamParams?.prompt_cache_options).toBeUndefined();
|
|
399
|
-
expect(lastStreamParams?.
|
|
404
|
+
expect(lastStreamParams?.prompt_cache_retention).toBeUndefined();
|
|
405
|
+
expect(JSON.stringify(lastStreamParams?.input)).not.toContain(
|
|
406
|
+
"prompt_cache_breakpoint",
|
|
407
|
+
);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test("codex subscription endpoint keeps prompt_cache_key stable across append-only turns", async () => {
|
|
411
|
+
const provider = makeProvider("gpt-5.6-sol", true);
|
|
412
|
+
await provider.sendMessage([userMsg("hi")], {
|
|
413
|
+
config: { promptCacheKey: "conv-1" },
|
|
414
|
+
});
|
|
415
|
+
expect(lastStreamParams?.prompt_cache_key).toBe("conv-1");
|
|
416
|
+
|
|
417
|
+
await provider.sendMessage(
|
|
418
|
+
[userMsg("hi"), assistantMsg("ok"), userMsg("again")],
|
|
419
|
+
{ config: { promptCacheKey: "conv-1" } },
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
expect(lastStreamParams?.prompt_cache_key).toBe("conv-1");
|
|
423
|
+
expect(lastStreamParams?.prompt_cache_options).toBeUndefined();
|
|
424
|
+
expect(lastStreamParams?.prompt_cache_retention).toBeUndefined();
|
|
400
425
|
expect(JSON.stringify(lastStreamParams?.input)).not.toContain(
|
|
401
426
|
"prompt_cache_breakpoint",
|
|
402
427
|
);
|
|
403
428
|
});
|
|
404
429
|
|
|
430
|
+
test("codex subscription endpoint omits prompt_cache_key when absent", async () => {
|
|
431
|
+
const provider = makeProvider("gpt-5.6-sol", true);
|
|
432
|
+
await provider.sendMessage([userMsg("hi")]);
|
|
433
|
+
|
|
434
|
+
expect(lastStreamParams?.prompt_cache_key).toBeUndefined();
|
|
435
|
+
expect(lastStreamParams?.prompt_cache_options).toBeUndefined();
|
|
436
|
+
expect(lastStreamParams?.prompt_cache_retention).toBeUndefined();
|
|
437
|
+
});
|
|
438
|
+
|
|
405
439
|
test("never mutates the caller's messages", async () => {
|
|
406
440
|
const provider = makeProvider("gpt-5.6-sol");
|
|
407
441
|
const messages = [userMsg("t1"), assistantMsg("r1"), userMsg("t2")];
|
|
@@ -47,7 +47,7 @@ export interface OpenAIResponsesProviderOptions {
|
|
|
47
47
|
streamTimeoutMs?: number;
|
|
48
48
|
useNativeWebSearch?: boolean;
|
|
49
49
|
/** When true, target the Codex subscription endpoint and strip fields it
|
|
50
|
-
* rejects (`max_output_tokens`). */
|
|
50
|
+
* rejects (`max_output_tokens`, `prompt_cache_options`, breakpoints). */
|
|
51
51
|
codexSubscription?: boolean;
|
|
52
52
|
/** Static HTTP headers sent with every request (e.g. OpenRouter app
|
|
53
53
|
* attribution). Merged under any per-request attribution headers. */
|
|
@@ -309,13 +309,13 @@ export class OpenAIResponsesProvider implements Provider {
|
|
|
309
309
|
|
|
310
310
|
// A per-conversation prompt-cache key gives OpenAI's cache router a
|
|
311
311
|
// stable affinity key so a conversation's requests land on the same
|
|
312
|
-
// cache shard. Every model
|
|
312
|
+
// cache shard. Every Responses model receives it, including the Codex
|
|
313
|
+
// subscription endpoint: the key is a supported routing field there
|
|
314
|
+
// (the official Codex client defaults it from thread identity). Both
|
|
313
315
|
// breakpoint-capable models (which additionally opt into explicit mode
|
|
314
|
-
// below) and implicit-mode models, which carry no explicit breakpoints
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
// there.
|
|
318
|
-
if (!this.codexSubscription && promptCacheKey) {
|
|
316
|
+
// below) and implicit-mode models, which carry no explicit breakpoints,
|
|
317
|
+
// still gain prefix-cache routing affinity from a stable key.
|
|
318
|
+
if (promptCacheKey) {
|
|
319
319
|
params.prompt_cache_key = promptCacheKey;
|
|
320
320
|
}
|
|
321
321
|
|
|
@@ -329,7 +329,9 @@ export class OpenAIResponsesProvider implements Provider {
|
|
|
329
329
|
// breakpoints neither uses the cache nor incurs cache-write charges,
|
|
330
330
|
// which is exactly the opt-out `disableCache` wants (omitting the param
|
|
331
331
|
// would re-enable implicit mode). The Codex subscription endpoint
|
|
332
|
-
// rejects
|
|
332
|
+
// rejects `prompt_cache_options` and block-level breakpoints, so those
|
|
333
|
+
// stay off there. Codex runs in implicit prefix-cache mode and relies
|
|
334
|
+
// on `prompt_cache_key` above for routing affinity.
|
|
333
335
|
if (
|
|
334
336
|
!this.codexSubscription &&
|
|
335
337
|
PROMPT_CACHE_BREAKPOINT_MODEL_IDS.has(effectiveModel)
|