@columenlabs/lumen-ai 0.1.278 → 0.1.279

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.
@@ -63,7 +63,16 @@ export function planFetch(base = fetch, name = 'Assistant') {
63
63
  ];
64
64
  const streamed = body.stream === true;
65
65
  body.stream = true;
66
- const res = await base(input, { ...init, body: JSON.stringify(body) });
66
+ // ChatGPT keeps a plan's prompt cache by the request's `session-id` header, not the body's
67
+ // `prompt_cache_key` (OpenAI's own Codex client: "ChatGPT derives cache affinity from the
68
+ // Responses session-id header", codex-rs/core/src/client.rs). Without it each call of a plan
69
+ // went to a fresh cache and read 0 (live 2026-11-14), while the same calls on a key read 92%.
70
+ const headers = new Headers(init?.headers);
71
+ if (typeof body.prompt_cache_key === 'string' && !headers.has('session-id')) {
72
+ headers.set('session-id', body.prompt_cache_key);
73
+ headers.set('thread-id', body.prompt_cache_key);
74
+ }
75
+ const res = await base(input, { ...init, headers, body: JSON.stringify(body) });
67
76
  // A refusal is logged with OpenAI's own reason; the person sees a plain sentence.
68
77
  if (!res.ok)
69
78
  console.error(JSON.stringify({
@@ -1211,7 +1211,11 @@ export class Assistant {
1211
1211
  ...(plan ? {} : { max_output_tokens: max }),
1212
1212
  ...(effort &&
1213
1213
  effort !== 'default' && { reasoning: { effort: effort === 'max' ? 'high' : effort } }),
1214
- }, signal ? { signal } : {});
1214
+ }, {
1215
+ ...(signal ? { signal } : {}),
1216
+ // A ChatGPT plan keeps its prompt cache by this header, not the body's key (planFetch).
1217
+ ...(cacheKey ? { headers: { 'session-id': cacheKey, 'thread-id': cacheKey } } : {}),
1218
+ });
1215
1219
  for await (const e of stream) {
1216
1220
  if (e.type === 'response.output_text.delta' && typeof e.delta === 'string')
1217
1221
  text += e.delta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ai",
3
- "version": "0.1.278",
3
+ "version": "0.1.279",
4
4
  "description": "Lumen's assistant and agent parts: a chat assistant's server (Claude tiers, tools over MCP, the web, hand off, spend caps), serving an MCP server from a Worker, read-only tool sets and metered tool calls.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,8 +57,8 @@
57
57
  "@anthropic-ai/sdk": "0.133.0",
58
58
  "@cloudflare/computer": "0.8.0",
59
59
  "@cloudflare/think": "0.23.0",
60
- "@columenlabs/lumen-ops": "0.1.278",
61
- "@columenlabs/lumen-ui-types": "0.1.278",
60
+ "@columenlabs/lumen-ops": "0.1.279",
61
+ "@columenlabs/lumen-ui-types": "0.1.279",
62
62
  "agents": "0.32.0",
63
63
  "ai": "7.0.162",
64
64
  "just-bash": "3.6.0",