@kenkaiiii/gg-ai 5.74.2 → 5.75.0
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 +1 -1
- package/dist/index.cjs +32 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
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
|
|
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,20 @@ 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
|
-
|
|
1318
|
+
// `display` defaults to "omitted" on Fable/Mythos 5.x, Opus 5.x/4.8/4.7,
|
|
1319
|
+
// Sonnet 5.x and Haiku 5.5: the model still thinks (and bills for it) but
|
|
1320
|
+
// streams empty thinking blocks, so the app shows no reasoning at all.
|
|
1321
|
+
// "summarized" opts back in; on Opus/Sonnet 4.6 it is already the default.
|
|
1322
|
+
thinking: { type: "adaptive", display: "summarized" },
|
|
1307
1323
|
maxTokens,
|
|
1308
1324
|
outputConfig: { effort }
|
|
1309
1325
|
};
|
|
@@ -2865,7 +2881,7 @@ function extractRequestIdFromMessage(message) {
|
|
|
2865
2881
|
|
|
2866
2882
|
// src/providers/openai-codex.ts
|
|
2867
2883
|
var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
|
|
2868
|
-
var CODEX_CLIENT_VERSION = "0.
|
|
2884
|
+
var CODEX_CLIENT_VERSION = "0.161.0";
|
|
2869
2885
|
var CODEX_REQUEST_COMPRESSION_MIN_BYTES = 16 * 1024;
|
|
2870
2886
|
var zstdInitPromise;
|
|
2871
2887
|
async function encodeCodexRequest(body) {
|
|
@@ -3053,6 +3069,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
3053
3069
|
let outputTokens = 0;
|
|
3054
3070
|
let cacheRead = 0;
|
|
3055
3071
|
let cacheWrite = 0;
|
|
3072
|
+
let thinkingTextEmitted = false;
|
|
3056
3073
|
const diagStart = Date.now();
|
|
3057
3074
|
const diagSeen = /* @__PURE__ */ new Set();
|
|
3058
3075
|
for await (const event of parseSSE(response.body)) {
|
|
@@ -3130,9 +3147,17 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
3130
3147
|
}
|
|
3131
3148
|
}
|
|
3132
3149
|
}
|
|
3150
|
+
if (type === "response.reasoning_summary_part.added") {
|
|
3151
|
+
if (options.thinking && thinkingTextEmitted) {
|
|
3152
|
+
yield { type: "thinking_delta", text: "\n\n" };
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3133
3155
|
if (type === "response.reasoning_summary_text.delta" || type === "response.reasoning_summary.delta" || type === "response.reasoning_text.delta" || type === "response.reasoning.delta") {
|
|
3134
3156
|
const delta = event.delta;
|
|
3135
|
-
if (options.thinking
|
|
3157
|
+
if (options.thinking && delta) {
|
|
3158
|
+
thinkingTextEmitted = true;
|
|
3159
|
+
yield { type: "thinking_delta", text: delta };
|
|
3160
|
+
}
|
|
3136
3161
|
}
|
|
3137
3162
|
if (type === "response.output_item.added") {
|
|
3138
3163
|
const item = event.item;
|
|
@@ -4293,7 +4318,7 @@ providerRegistry.register("huggingface", {
|
|
|
4293
4318
|
// Hugging Face Inference Providers router — one HF token (hf.co/settings/tokens,
|
|
4294
4319
|
// "Make calls to Inference Providers" permission) routes to whichever hosted
|
|
4295
4320
|
// backend serves each open model. Chat Completions-compatible; model ids are
|
|
4296
|
-
// Hub repo paths ("
|
|
4321
|
+
// Hub repo paths ("moonshotai/Kimi-K2.7-Code"), optionally with an
|
|
4297
4322
|
// ":auto"/":fastest"/":cheapest" provider-selection suffix. Billing follows
|
|
4298
4323
|
// each backend's per-token rates on the HF account (small free tier).
|
|
4299
4324
|
stream: (options) => streamOpenAI({
|