@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/README.md CHANGED
@@ -40,7 +40,7 @@ Tool parameters are Zod schemas. Converted to JSON Schema at the provider bounda
40
40
 
41
41
  | Provider | Models | Notes |
42
42
  |---|---|---|
43
- | `anthropic` | Claude Opus 5.5, Sonnet 5.5, Haiku 4.5 | Extended thinking, prompt caching, server-side compaction |
43
+ | `anthropic` | Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 | Extended thinking, prompt caching, server-side compaction |
44
44
  | `openai` | GPT-4.1, o3, o4-mini | Supports OAuth (codex endpoint) and API keys |
45
45
  | `glm` | GLM-5.3 | Z.AI platform, OpenAI-compatible |
46
46
  | `moonshot` | Kimi K3, Kimi K2.8 Preview, Kimi K2.7 Code | Moonshot platform, OpenAI-compatible |
package/dist/index.cjs CHANGED
@@ -516,10 +516,22 @@ function zodToJsonSchema(schema) {
516
516
  if (cached) return cached;
517
517
  const jsonSchema = import_zod.z.toJSONSchema(schema);
518
518
  const { $schema: _schema, ...rest } = jsonSchema;
519
- const normalized = normalizeRootForAnthropic(rest);
519
+ const normalized = normalizeRootForAnthropic(stripNoOpKeywords(rest));
520
520
  schemaCache.set(schema, normalized);
521
521
  return normalized;
522
522
  }
523
+ function stripNoOpKeywords(node) {
524
+ if (Array.isArray(node)) return node.map(stripNoOpKeywords);
525
+ if (node === null || typeof node !== "object") return node;
526
+ const out = {};
527
+ for (const [key, value] of Object.entries(node)) {
528
+ if (key === "maximum" && value === Number.MAX_SAFE_INTEGER) continue;
529
+ if (key === "minimum" && value === Number.MIN_SAFE_INTEGER) continue;
530
+ if (key === "additionalProperties" && value === false) continue;
531
+ out[key] = stripNoOpKeywords(value);
532
+ }
533
+ return out;
534
+ }
523
535
  function resolveToolSchema(tool) {
524
536
  const schema = tool.rawInputSchema ?? zodToJsonSchema(tool.parameters);
525
537
  if (schema.type === "object" && schema.properties === void 0) {
@@ -1294,16 +1306,23 @@ function toAnthropicToolChoice(choice) {
1294
1306
  return { type: "tool", name: choice.name };
1295
1307
  }
1296
1308
  function isAdaptiveThinkingModel(model) {
1297
- return /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|fable-5|mythos-5/.test(model);
1309
+ return /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|haiku-5|fable-5|mythos-5/.test(model);
1298
1310
  }
1299
1311
  function toAnthropicThinking(level, maxTokens, model) {
1300
1312
  if (isAdaptiveThinkingModel(model)) {
1301
1313
  let effort = level;
1302
- if (effort === "xhigh" && !/opus-5|opus-4-8|opus-4-7|sonnet-5[-.]5/.test(model)) {
1314
+ if (effort === "xhigh" && !/opus-5|opus-4-8|opus-4-7|sonnet-5[-.]5|haiku-5[-.]5/.test(model)) {
1303
1315
  effort = "high";
1304
1316
  }
1305
1317
  return {
1306
- thinking: { type: "adaptive" },
1318
+ // "omitted" (what Claude Code sends): the model still thinks, but
1319
+ // thinking blocks stream empty (signature only). The app never renders
1320
+ // reasoning text, and "summarized" costs speed on Haiku 5.5: bench/h2h
1321
+ // measured output tok/s over each whole request at 151 (summarized) vs
1322
+ // 191 (omitted); Claude Code 195. Sonnet/Opus 5.5 measured even either way.
1323
+ // The UI's "Thinking…" timer keys off the empty thinking_delta emitted
1324
+ // when a thinking block opens, so it is unaffected.
1325
+ thinking: { type: "adaptive", display: "omitted" },
1307
1326
  maxTokens,
1308
1327
  outputConfig: { effort }
1309
1328
  };
@@ -2865,7 +2884,7 @@ function extractRequestIdFromMessage(message) {
2865
2884
 
2866
2885
  // src/providers/openai-codex.ts
2867
2886
  var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
2868
- var CODEX_CLIENT_VERSION = "0.159.1";
2887
+ var CODEX_CLIENT_VERSION = "0.161.0";
2869
2888
  var CODEX_REQUEST_COMPRESSION_MIN_BYTES = 16 * 1024;
2870
2889
  var zstdInitPromise;
2871
2890
  async function encodeCodexRequest(body) {
@@ -3053,6 +3072,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
3053
3072
  let outputTokens = 0;
3054
3073
  let cacheRead = 0;
3055
3074
  let cacheWrite = 0;
3075
+ let thinkingTextEmitted = false;
3056
3076
  const diagStart = Date.now();
3057
3077
  const diagSeen = /* @__PURE__ */ new Set();
3058
3078
  for await (const event of parseSSE(response.body)) {
@@ -3130,9 +3150,17 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
3130
3150
  }
3131
3151
  }
3132
3152
  }
3153
+ if (type === "response.reasoning_summary_part.added") {
3154
+ if (options.thinking && thinkingTextEmitted) {
3155
+ yield { type: "thinking_delta", text: "\n\n" };
3156
+ }
3157
+ }
3133
3158
  if (type === "response.reasoning_summary_text.delta" || type === "response.reasoning_summary.delta" || type === "response.reasoning_text.delta" || type === "response.reasoning.delta") {
3134
3159
  const delta = event.delta;
3135
- if (options.thinking) yield { type: "thinking_delta", text: delta };
3160
+ if (options.thinking && delta) {
3161
+ thinkingTextEmitted = true;
3162
+ yield { type: "thinking_delta", text: delta };
3163
+ }
3136
3164
  }
3137
3165
  if (type === "response.output_item.added") {
3138
3166
  const item = event.item;
@@ -4293,7 +4321,7 @@ providerRegistry.register("huggingface", {
4293
4321
  // Hugging Face Inference Providers router — one HF token (hf.co/settings/tokens,
4294
4322
  // "Make calls to Inference Providers" permission) routes to whichever hosted
4295
4323
  // backend serves each open model. Chat Completions-compatible; model ids are
4296
- // Hub repo paths ("Qwen/Qwen3-Coder-480B-A35B-Instruct"), optionally with an
4324
+ // Hub repo paths ("moonshotai/Kimi-K2.7-Code"), optionally with an
4297
4325
  // ":auto"/":fastest"/":cheapest" provider-selection suffix. Billing follows
4298
4326
  // each backend's per-token rates on the HF account (small free tier).
4299
4327
  stream: (options) => streamOpenAI({