@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.js CHANGED
@@ -1090,7 +1090,13 @@ async function prewarmAnthropicCache(options) {
1090
1090
  },
1091
1091
  {
1092
1092
  signal: options.signal ?? void 0,
1093
- ...isOAuth ? { headers: { "anthropic-beta": "claude-code-20250219,oauth-2025-04-20" } } : {}
1093
+ ...(() => {
1094
+ const betas = [
1095
+ ...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
1096
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1097
+ ];
1098
+ return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
1099
+ })()
1094
1100
  }
1095
1101
  );
1096
1102
  } catch {
@@ -1174,7 +1180,12 @@ async function* runStream(options) {
1174
1180
  ...options.compaction ? ["compact-2026-01-12"] : [],
1175
1181
  ...options.clearToolUses ? ["context-management-2025-06-27"] : [],
1176
1182
  "fine-grained-tool-streaming-2025-05-14",
1177
- ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : []
1183
+ ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : [],
1184
+ // The 1-h cache TTL (cacheRetention "long") is gated behind this beta. Without
1185
+ // it Anthropic silently ignores ttl:"1h" and falls back to the 5-min default,
1186
+ // so a pre-warmed cache expires before the user's first turn. cacheControl.ttl
1187
+ // is only "1h" on the first-party endpoint (see toAnthropicCacheControl).
1188
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1178
1189
  ];
1179
1190
  const requestOptions = {
1180
1191
  signal: options.signal ?? void 0,