@kenkaiiii/gg-ai 5.74.3 → 5.75.1

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
@@ -443,10 +443,22 @@ function zodToJsonSchema(schema) {
443
443
  if (cached) return cached;
444
444
  const jsonSchema = z.toJSONSchema(schema);
445
445
  const { $schema: _schema, ...rest } = jsonSchema;
446
- const normalized = normalizeRootForAnthropic(rest);
446
+ const normalized = normalizeRootForAnthropic(stripNoOpKeywords(rest));
447
447
  schemaCache.set(schema, normalized);
448
448
  return normalized;
449
449
  }
450
+ function stripNoOpKeywords(node) {
451
+ if (Array.isArray(node)) return node.map(stripNoOpKeywords);
452
+ if (node === null || typeof node !== "object") return node;
453
+ const out = {};
454
+ for (const [key, value] of Object.entries(node)) {
455
+ if (key === "maximum" && value === Number.MAX_SAFE_INTEGER) continue;
456
+ if (key === "minimum" && value === Number.MIN_SAFE_INTEGER) continue;
457
+ if (key === "additionalProperties" && value === false) continue;
458
+ out[key] = stripNoOpKeywords(value);
459
+ }
460
+ return out;
461
+ }
450
462
  function resolveToolSchema(tool) {
451
463
  const schema = tool.rawInputSchema ?? zodToJsonSchema(tool.parameters);
452
464
  if (schema.type === "object" && schema.properties === void 0) {
@@ -1221,16 +1233,23 @@ function toAnthropicToolChoice(choice) {
1221
1233
  return { type: "tool", name: choice.name };
1222
1234
  }
1223
1235
  function isAdaptiveThinkingModel(model) {
1224
- return /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|fable-5|mythos-5/.test(model);
1236
+ return /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|haiku-5|fable-5|mythos-5/.test(model);
1225
1237
  }
1226
1238
  function toAnthropicThinking(level, maxTokens, model) {
1227
1239
  if (isAdaptiveThinkingModel(model)) {
1228
1240
  let effort = level;
1229
- if (effort === "xhigh" && !/opus-5|opus-4-8|opus-4-7|sonnet-5[-.]5/.test(model)) {
1241
+ if (effort === "xhigh" && !/opus-5|opus-4-8|opus-4-7|sonnet-5[-.]5|haiku-5[-.]5/.test(model)) {
1230
1242
  effort = "high";
1231
1243
  }
1232
1244
  return {
1233
- thinking: { type: "adaptive" },
1245
+ // "omitted" (what Claude Code sends): the model still thinks, but
1246
+ // thinking blocks stream empty (signature only). The app never renders
1247
+ // reasoning text, and "summarized" costs speed on Haiku 5.5: bench/h2h
1248
+ // measured output tok/s over each whole request at 151 (summarized) vs
1249
+ // 191 (omitted); Claude Code 195. Sonnet/Opus 5.5 measured even either way.
1250
+ // The UI's "Thinking…" timer keys off the empty thinking_delta emitted
1251
+ // when a thinking block opens, so it is unaffected.
1252
+ thinking: { type: "adaptive", display: "omitted" },
1234
1253
  maxTokens,
1235
1254
  outputConfig: { effort }
1236
1255
  };
@@ -2792,7 +2811,7 @@ function extractRequestIdFromMessage(message) {
2792
2811
 
2793
2812
  // src/providers/openai-codex.ts
2794
2813
  var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
2795
- var CODEX_CLIENT_VERSION = "0.159.1";
2814
+ var CODEX_CLIENT_VERSION = "0.161.0";
2796
2815
  var CODEX_REQUEST_COMPRESSION_MIN_BYTES = 16 * 1024;
2797
2816
  var zstdInitPromise;
2798
2817
  async function encodeCodexRequest(body) {
@@ -2980,6 +2999,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
2980
2999
  let outputTokens = 0;
2981
3000
  let cacheRead = 0;
2982
3001
  let cacheWrite = 0;
3002
+ let thinkingTextEmitted = false;
2983
3003
  const diagStart = Date.now();
2984
3004
  const diagSeen = /* @__PURE__ */ new Set();
2985
3005
  for await (const event of parseSSE(response.body)) {
@@ -3057,9 +3077,17 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
3057
3077
  }
3058
3078
  }
3059
3079
  }
3080
+ if (type === "response.reasoning_summary_part.added") {
3081
+ if (options.thinking && thinkingTextEmitted) {
3082
+ yield { type: "thinking_delta", text: "\n\n" };
3083
+ }
3084
+ }
3060
3085
  if (type === "response.reasoning_summary_text.delta" || type === "response.reasoning_summary.delta" || type === "response.reasoning_text.delta" || type === "response.reasoning.delta") {
3061
3086
  const delta = event.delta;
3062
- if (options.thinking) yield { type: "thinking_delta", text: delta };
3087
+ if (options.thinking && delta) {
3088
+ thinkingTextEmitted = true;
3089
+ yield { type: "thinking_delta", text: delta };
3090
+ }
3063
3091
  }
3064
3092
  if (type === "response.output_item.added") {
3065
3093
  const item = event.item;
@@ -4220,7 +4248,7 @@ providerRegistry.register("huggingface", {
4220
4248
  // Hugging Face Inference Providers router — one HF token (hf.co/settings/tokens,
4221
4249
  // "Make calls to Inference Providers" permission) routes to whichever hosted
4222
4250
  // backend serves each open model. Chat Completions-compatible; model ids are
4223
- // Hub repo paths ("Qwen/Qwen3-Coder-480B-A35B-Instruct"), optionally with an
4251
+ // Hub repo paths ("moonshotai/Kimi-K2.7-Code"), optionally with an
4224
4252
  // ":auto"/":fastest"/":cheapest" provider-selection suffix. Billing follows
4225
4253
  // each backend's per-token rates on the HF account (small free tier).
4226
4254
  stream: (options) => streamOpenAI({