@kenkaiiii/gg-ai 4.14.0 → 4.14.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.cjs CHANGED
@@ -1145,7 +1145,13 @@ async function prewarmAnthropicCache(options) {
1145
1145
  },
1146
1146
  {
1147
1147
  signal: options.signal ?? void 0,
1148
- ...isOAuth ? { headers: { "anthropic-beta": "claude-code-20250219,oauth-2025-04-20" } } : {}
1148
+ ...(() => {
1149
+ const betas = [
1150
+ ...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
1151
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1152
+ ];
1153
+ return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
1154
+ })()
1149
1155
  }
1150
1156
  );
1151
1157
  } catch {
@@ -1229,7 +1235,12 @@ async function* runStream(options) {
1229
1235
  ...options.compaction ? ["compact-2026-01-12"] : [],
1230
1236
  ...options.clearToolUses ? ["context-management-2025-06-27"] : [],
1231
1237
  "fine-grained-tool-streaming-2025-05-14",
1232
- ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : []
1238
+ ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : [],
1239
+ // The 1-h cache TTL (cacheRetention "long") is gated behind this beta. Without
1240
+ // it Anthropic silently ignores ttl:"1h" and falls back to the 5-min default,
1241
+ // so a pre-warmed cache expires before the user's first turn. cacheControl.ttl
1242
+ // is only "1h" on the first-party endpoint (see toAnthropicCacheControl).
1243
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1233
1244
  ];
1234
1245
  const requestOptions = {
1235
1246
  signal: options.signal ?? void 0,