@kenkaiiii/gg-ai 5.92.0 → 5.94.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/NOTICE +1 -1
- package/README.md +177 -144
- package/dist/index.cjs +31 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -21
- package/dist/index.d.ts +1 -21
- package/dist/index.js +31 -201
- package/dist/index.js.map +1 -1
- package/package.json +20 -3
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
CLAUDE_CODE_FALLBACK_VERSION: () => CLAUDE_CODE_FALLBACK_VERSION,
|
|
34
33
|
CODEX_CLIENT_VERSION: () => CODEX_CLIENT_VERSION,
|
|
35
34
|
EventStream: () => EventStream,
|
|
36
35
|
FAST_MODE_SUFFIX: () => FAST_MODE_SUFFIX,
|
|
@@ -52,8 +51,6 @@ __export(index_exports, {
|
|
|
52
51
|
formatChatError: () => formatChatError,
|
|
53
52
|
formatError: () => formatError,
|
|
54
53
|
formatErrorForDisplay: () => formatErrorForDisplay,
|
|
55
|
-
getClaudeCliUserAgent: () => getClaudeCliUserAgent,
|
|
56
|
-
getClaudeCodeVersion: () => getClaudeCodeVersion,
|
|
57
54
|
hasLoneSurrogate: () => hasLoneSurrogate,
|
|
58
55
|
isHardBillingMessage: () => isHardBillingMessage,
|
|
59
56
|
isUsageLimitError: () => isUsageLimitError,
|
|
@@ -68,7 +65,6 @@ __export(index_exports, {
|
|
|
68
65
|
palsuThinking: () => palsuThinking,
|
|
69
66
|
palsuToolCall: () => palsuToolCall,
|
|
70
67
|
parseFastModeRejection: () => parseFastModeRejection,
|
|
71
|
-
pendingClaudeCodeVersionRefresh: () => pendingClaudeCodeVersionRefresh,
|
|
72
68
|
preconnectOrigin: () => preconnectOrigin,
|
|
73
69
|
preconnectProvider: () => preconnectProvider,
|
|
74
70
|
prewarmAnthropicCache: () => prewarmAnthropicCache,
|
|
@@ -96,7 +92,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
96
92
|
var FAST_MODE_SUFFIX = "-fast";
|
|
97
93
|
var FAST_MODE_BASE_MODELS = {
|
|
98
94
|
anthropic: ["claude-opus-5-5"],
|
|
99
|
-
openai: ["gpt-6-astra", "gpt-6.1-sol", "gpt-6-luna"]
|
|
95
|
+
openai: ["gpt-6-astra", "gpt-6.1-sol", "gpt-6.1-terra", "gpt-6-luna"]
|
|
100
96
|
};
|
|
101
97
|
function resolveFastModeModel(provider, model) {
|
|
102
98
|
if (!model.endsWith(FAST_MODE_SUFFIX)) return { model, fast: false };
|
|
@@ -702,145 +698,6 @@ var StreamResult = class _StreamResult {
|
|
|
702
698
|
}
|
|
703
699
|
};
|
|
704
700
|
|
|
705
|
-
// src/claude-code-version.ts
|
|
706
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
707
|
-
var import_node_os = __toESM(require("os"), 1);
|
|
708
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
709
|
-
|
|
710
|
-
// src/utils/diag.ts
|
|
711
|
-
var _diagFn = null;
|
|
712
|
-
function setProviderDiagnostic(fn) {
|
|
713
|
-
_diagFn = fn;
|
|
714
|
-
}
|
|
715
|
-
function providerDiag(phase, data) {
|
|
716
|
-
_diagFn?.(phase, data);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
// src/claude-code-version.ts
|
|
720
|
-
var NPM_LATEST_URL = "https://registry.npmjs.org/@anthropic-ai/claude-code/latest";
|
|
721
|
-
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
722
|
-
var FETCH_TIMEOUT_MS = 3e3;
|
|
723
|
-
var CLAUDE_CODE_FALLBACK_VERSION = "2.1.316";
|
|
724
|
-
function isOlder(a, b) {
|
|
725
|
-
const pa = a.split(".").map((n) => Number.parseInt(n, 10) || 0);
|
|
726
|
-
const pb = b.split(".").map((n) => Number.parseInt(n, 10) || 0);
|
|
727
|
-
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
728
|
-
const x = pa[i] ?? 0;
|
|
729
|
-
const y = pb[i] ?? 0;
|
|
730
|
-
if (x !== y) return x < y;
|
|
731
|
-
}
|
|
732
|
-
return false;
|
|
733
|
-
}
|
|
734
|
-
function atLeastFallback(version) {
|
|
735
|
-
return isOlder(version, CLAUDE_CODE_FALLBACK_VERSION) ? CLAUDE_CODE_FALLBACK_VERSION : version;
|
|
736
|
-
}
|
|
737
|
-
var memoryCache = null;
|
|
738
|
-
var inflight = null;
|
|
739
|
-
function agentDir() {
|
|
740
|
-
return import_node_path.default.join(import_node_os.default.homedir(), ".gg");
|
|
741
|
-
}
|
|
742
|
-
function cachePath() {
|
|
743
|
-
return import_node_path.default.join(agentDir(), "claude-code-version.json");
|
|
744
|
-
}
|
|
745
|
-
async function readDiskCache() {
|
|
746
|
-
try {
|
|
747
|
-
const raw = await import_promises.default.readFile(cachePath(), "utf-8");
|
|
748
|
-
const parsed = JSON.parse(raw);
|
|
749
|
-
if (typeof parsed.version === "string" && typeof parsed.fetchedAt === "number") {
|
|
750
|
-
return parsed;
|
|
751
|
-
}
|
|
752
|
-
return null;
|
|
753
|
-
} catch {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
async function writeDiskCache(data) {
|
|
758
|
-
try {
|
|
759
|
-
await import_promises.default.mkdir(agentDir(), { recursive: true, mode: 448 });
|
|
760
|
-
await import_promises.default.writeFile(cachePath(), JSON.stringify(data), { mode: 384 });
|
|
761
|
-
} catch (err) {
|
|
762
|
-
providerDiag("claude_code_version_cache_write_failed", {
|
|
763
|
-
error: err instanceof Error ? err.message : String(err)
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
async function fetchLatest() {
|
|
768
|
-
const controller = new AbortController();
|
|
769
|
-
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
770
|
-
try {
|
|
771
|
-
const response = await fetch(NPM_LATEST_URL, { signal: controller.signal });
|
|
772
|
-
if (!response.ok) return null;
|
|
773
|
-
const data = await response.json();
|
|
774
|
-
if (typeof data.version === "string" && /^\d/.test(data.version)) {
|
|
775
|
-
return data.version;
|
|
776
|
-
}
|
|
777
|
-
return null;
|
|
778
|
-
} catch {
|
|
779
|
-
return null;
|
|
780
|
-
} finally {
|
|
781
|
-
clearTimeout(timer);
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
var refreshing = null;
|
|
785
|
-
function refreshInBackground() {
|
|
786
|
-
refreshing ??= (async () => {
|
|
787
|
-
try {
|
|
788
|
-
const fetched = await fetchLatest();
|
|
789
|
-
if (!fetched) return;
|
|
790
|
-
await writeDiskCache({ version: fetched, fetchedAt: Date.now() });
|
|
791
|
-
memoryCache = { version: fetched, expiresAt: Date.now() + CACHE_TTL_MS };
|
|
792
|
-
} finally {
|
|
793
|
-
refreshing = null;
|
|
794
|
-
}
|
|
795
|
-
})();
|
|
796
|
-
return refreshing;
|
|
797
|
-
}
|
|
798
|
-
function pendingClaudeCodeVersionRefresh() {
|
|
799
|
-
return refreshing;
|
|
800
|
-
}
|
|
801
|
-
async function getClaudeCodeVersion() {
|
|
802
|
-
if (memoryCache && Date.now() < memoryCache.expiresAt) {
|
|
803
|
-
return memoryCache.version;
|
|
804
|
-
}
|
|
805
|
-
if (inflight) return inflight;
|
|
806
|
-
inflight = (async () => {
|
|
807
|
-
const disk = await readDiskCache();
|
|
808
|
-
const diskFresh = disk && Date.now() - disk.fetchedAt < CACHE_TTL_MS;
|
|
809
|
-
if (disk && diskFresh) {
|
|
810
|
-
const version = atLeastFallback(disk.version);
|
|
811
|
-
memoryCache = { version, expiresAt: Date.now() + CACHE_TTL_MS };
|
|
812
|
-
return version;
|
|
813
|
-
}
|
|
814
|
-
if (disk) {
|
|
815
|
-
const version = atLeastFallback(disk.version);
|
|
816
|
-
memoryCache = { version, expiresAt: Date.now() + 5 * 60 * 1e3 };
|
|
817
|
-
void refreshInBackground();
|
|
818
|
-
return version;
|
|
819
|
-
}
|
|
820
|
-
const fetched = await fetchLatest();
|
|
821
|
-
if (fetched) {
|
|
822
|
-
await writeDiskCache({ version: fetched, fetchedAt: Date.now() });
|
|
823
|
-
memoryCache = { version: fetched, expiresAt: Date.now() + CACHE_TTL_MS };
|
|
824
|
-
return fetched;
|
|
825
|
-
}
|
|
826
|
-
const resolved = CLAUDE_CODE_FALLBACK_VERSION;
|
|
827
|
-
memoryCache = { version: resolved, expiresAt: Date.now() + 5 * 60 * 1e3 };
|
|
828
|
-
providerDiag("claude_code_version_fallback", { version: resolved });
|
|
829
|
-
return resolved;
|
|
830
|
-
})();
|
|
831
|
-
try {
|
|
832
|
-
return await inflight;
|
|
833
|
-
} finally {
|
|
834
|
-
inflight = null;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
function claudeCliUserAgent(version) {
|
|
838
|
-
return `claude-cli/${version} (external, cli)`;
|
|
839
|
-
}
|
|
840
|
-
async function getClaudeCliUserAgent() {
|
|
841
|
-
return claudeCliUserAgent(await getClaudeCodeVersion());
|
|
842
|
-
}
|
|
843
|
-
|
|
844
701
|
// src/utils/provider-options.ts
|
|
845
702
|
var RESERVED_BODY_FIELDS = /* @__PURE__ */ new Set([
|
|
846
703
|
"contents",
|
|
@@ -2066,7 +1923,7 @@ function toGlmReasoningEffort(level) {
|
|
|
2066
1923
|
}
|
|
2067
1924
|
function toCodexReasoningEffort(level, model) {
|
|
2068
1925
|
if (level !== "ultra") return level;
|
|
2069
|
-
return model === "gpt-6-astra" || model === "gpt-6.1-sol" ? "xhigh" : "max";
|
|
1926
|
+
return model === "gpt-6-astra" || model === "gpt-6.1-sol" || model === "gpt-6.1-terra" ? "xhigh" : "max";
|
|
2070
1927
|
}
|
|
2071
1928
|
var DECLARED_EFFORT_ORDER = ["low", "medium", "high", "xhigh", "max"];
|
|
2072
1929
|
function effortForRequest(level, model, declared) {
|
|
@@ -2203,8 +2060,7 @@ var anthropicServerFallback = {
|
|
|
2203
2060
|
}
|
|
2204
2061
|
};
|
|
2205
2062
|
function serverFallbackKey(options) {
|
|
2206
|
-
|
|
2207
|
-
return `${options.baseUrl ?? process.env.ANTHROPIC_BASE_URL ?? ""}|${auth}`;
|
|
2063
|
+
return options.baseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "";
|
|
2208
2064
|
}
|
|
2209
2065
|
function isDirectAnthropicApi(baseUrl) {
|
|
2210
2066
|
const effective = baseUrl ?? process.env.ANTHROPIC_BASE_URL;
|
|
@@ -2237,30 +2093,18 @@ function sumUsageIterations(usage) {
|
|
|
2237
2093
|
}
|
|
2238
2094
|
return totals;
|
|
2239
2095
|
}
|
|
2240
|
-
async function withClaudeUserAgent(options) {
|
|
2241
|
-
if (options.userAgent || !options.apiKey?.startsWith("sk-ant-oat")) return options;
|
|
2242
|
-
return { ...options, userAgent: await getClaudeCliUserAgent() };
|
|
2243
|
-
}
|
|
2244
2096
|
function createClient(options) {
|
|
2245
|
-
const
|
|
2246
|
-
const userAgent = isOAuth ? options.userAgent ?? claudeCliUserAgent(CLAUDE_CODE_FALLBACK_VERSION) : "";
|
|
2247
|
-
const cacheKey = `${options.apiKey ?? ""}|${options.baseUrl ?? ""}|${userAgent}`;
|
|
2097
|
+
const cacheKey = `${options.apiKey ?? ""}|${options.baseUrl ?? ""}`;
|
|
2248
2098
|
if (!options.fetch) {
|
|
2249
2099
|
const cached = anthropicClientCache.get(cacheKey);
|
|
2250
2100
|
if (cached) return cached;
|
|
2251
2101
|
}
|
|
2252
2102
|
const client = new import_sdk.default({
|
|
2253
|
-
|
|
2103
|
+
apiKey: options.apiKey,
|
|
2254
2104
|
...options.baseUrl ? { baseURL: options.baseUrl } : {},
|
|
2255
2105
|
// Default transport lifts undici's 300s header/body caps (see provider-fetch.ts).
|
|
2256
2106
|
fetch: options.fetch ?? providerFetch,
|
|
2257
|
-
maxRetries: 0
|
|
2258
|
-
...isOAuth ? {
|
|
2259
|
-
defaultHeaders: {
|
|
2260
|
-
"user-agent": userAgent,
|
|
2261
|
-
"x-app": "cli"
|
|
2262
|
-
}
|
|
2263
|
-
} : {}
|
|
2107
|
+
maxRetries: 0
|
|
2264
2108
|
});
|
|
2265
2109
|
if (!options.fetch) {
|
|
2266
2110
|
if (anthropicClientCache.size >= 8) {
|
|
@@ -2273,13 +2117,10 @@ function createClient(options) {
|
|
|
2273
2117
|
}
|
|
2274
2118
|
async function prewarmAnthropicCache(options) {
|
|
2275
2119
|
try {
|
|
2276
|
-
const client = createClient(
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
userAgent: options.userAgent
|
|
2281
|
-
})
|
|
2282
|
-
);
|
|
2120
|
+
const client = createClient({
|
|
2121
|
+
apiKey: options.apiKey,
|
|
2122
|
+
baseUrl: options.baseUrl
|
|
2123
|
+
});
|
|
2283
2124
|
const cacheControl = toAnthropicCacheControl(options.cacheRetention ?? "long", options.baseUrl);
|
|
2284
2125
|
const { system, messages } = toAnthropicMessages(
|
|
2285
2126
|
[
|
|
@@ -2288,21 +2129,13 @@ async function prewarmAnthropicCache(options) {
|
|
|
2288
2129
|
],
|
|
2289
2130
|
cacheControl
|
|
2290
2131
|
);
|
|
2291
|
-
const isOAuth = options.apiKey.startsWith("sk-ant-oat");
|
|
2292
|
-
const fullSystem = isOAuth ? [
|
|
2293
|
-
{
|
|
2294
|
-
type: "text",
|
|
2295
|
-
text: "You are Claude Code, Anthropic's official CLI for Claude."
|
|
2296
|
-
},
|
|
2297
|
-
...system ?? []
|
|
2298
|
-
] : system;
|
|
2299
2132
|
const tools = options.tools?.length ? toAnthropicTools(options.tools, {
|
|
2300
2133
|
cacheControl,
|
|
2301
2134
|
// Keep the serialized tool bytes identical to runStream so the
|
|
2302
2135
|
// prewarmed prompt cache actually hits — both are gated by the flag.
|
|
2303
2136
|
enableFineGrainedToolStreaming: fineGrainedToolStreamingEnabled()
|
|
2304
2137
|
}) : void 0;
|
|
2305
|
-
if (estimatePrefixTokens(
|
|
2138
|
+
if (estimatePrefixTokens(system, tools) < anthropicMinCacheableTokens(options.model)) {
|
|
2306
2139
|
return;
|
|
2307
2140
|
}
|
|
2308
2141
|
await client.messages.create(
|
|
@@ -2310,7 +2143,7 @@ async function prewarmAnthropicCache(options) {
|
|
|
2310
2143
|
model: options.model,
|
|
2311
2144
|
max_tokens: 1,
|
|
2312
2145
|
messages,
|
|
2313
|
-
...
|
|
2146
|
+
...system ? { system } : {},
|
|
2314
2147
|
...tools ? {
|
|
2315
2148
|
tools: [
|
|
2316
2149
|
...tools,
|
|
@@ -2321,10 +2154,7 @@ async function prewarmAnthropicCache(options) {
|
|
|
2321
2154
|
{
|
|
2322
2155
|
signal: options.signal ?? void 0,
|
|
2323
2156
|
...(() => {
|
|
2324
|
-
const betas = [
|
|
2325
|
-
...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
|
|
2326
|
-
...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
|
|
2327
|
-
];
|
|
2157
|
+
const betas = cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : [];
|
|
2328
2158
|
return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
|
|
2329
2159
|
})()
|
|
2330
2160
|
}
|
|
@@ -2336,8 +2166,7 @@ function streamAnthropic(options) {
|
|
|
2336
2166
|
return new StreamResult(runStream(options), options.signal);
|
|
2337
2167
|
}
|
|
2338
2168
|
async function* runStream(options) {
|
|
2339
|
-
const client = createClient(
|
|
2340
|
-
const isOAuth = options.apiKey?.startsWith("sk-ant-oat");
|
|
2169
|
+
const client = createClient(options);
|
|
2341
2170
|
const useStreaming = options.streaming !== false && !options.prewarm;
|
|
2342
2171
|
const cacheControl = toAnthropicCacheControl(options.cacheRetention, options.baseUrl);
|
|
2343
2172
|
const supportsFirstPartyToolExtras = !options.baseUrl || options.baseUrl.includes("api.anthropic.com");
|
|
@@ -2347,18 +2176,11 @@ async function* runStream(options) {
|
|
|
2347
2176
|
const useServerFallback = options.provider !== "minimax" && isDirectAnthropicApi(options.baseUrl) && !anthropicServerFallback.disabled.has(fallbackKey);
|
|
2348
2177
|
const deferredPlan = options.provider === "anthropic" && isDirectAnthropicApi(options.baseUrl) && supportsAnthropicDeferredTools(options.model) ? planDeferredTools(options.tools, options.deferredTools, downgradedMessages) : void 0;
|
|
2349
2178
|
const toolReferences = deferredPlan?.loaded;
|
|
2350
|
-
const { system
|
|
2179
|
+
const { system, messages } = toAnthropicMessages(downgradedMessages, cacheControl, {
|
|
2351
2180
|
fallbackBlocks: useServerFallback,
|
|
2352
2181
|
toolReferences
|
|
2353
2182
|
});
|
|
2354
2183
|
const useFastMode = options.speed === "fast" && options.provider === "anthropic" && isDirectAnthropicApi(options.baseUrl);
|
|
2355
|
-
const system = isOAuth ? [
|
|
2356
|
-
{
|
|
2357
|
-
type: "text",
|
|
2358
|
-
text: "You are Claude Code, Anthropic's official CLI for Claude."
|
|
2359
|
-
},
|
|
2360
|
-
...rawSystem ?? []
|
|
2361
|
-
] : rawSystem;
|
|
2362
2184
|
let maxTokens = options.maxTokens ?? 4096;
|
|
2363
2185
|
let thinking;
|
|
2364
2186
|
let outputConfig;
|
|
@@ -2434,7 +2256,6 @@ async function* runStream(options) {
|
|
|
2434
2256
|
const params = mergeProviderOptions(baseParams, options.providerOptions);
|
|
2435
2257
|
const hasAdaptiveThinking = isAdaptiveThinkingModel(options.model);
|
|
2436
2258
|
const betaHeaders = [
|
|
2437
|
-
...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
|
|
2438
2259
|
...options.compaction ? ["compact-2026-01-12"] : [],
|
|
2439
2260
|
...options.clearToolUses ? ["context-management-2025-06-27"] : [],
|
|
2440
2261
|
// Eager tool-input streaming beta — opt-in only (see
|
|
@@ -2930,6 +2751,15 @@ function fnv1aHash(value) {
|
|
|
2930
2751
|
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
2931
2752
|
}
|
|
2932
2753
|
|
|
2754
|
+
// src/utils/diag.ts
|
|
2755
|
+
var _diagFn = null;
|
|
2756
|
+
function setProviderDiagnostic(fn) {
|
|
2757
|
+
_diagFn = fn;
|
|
2758
|
+
}
|
|
2759
|
+
function providerDiag(phase, data) {
|
|
2760
|
+
_diagFn?.(phase, data);
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2933
2763
|
// src/providers/moonshot-video.ts
|
|
2934
2764
|
async function uploadMoonshotVideos(client, messages, signal) {
|
|
2935
2765
|
for (const msg of messages) {
|
|
@@ -3173,11 +3003,11 @@ async function* runStream2(options) {
|
|
|
3173
3003
|
}
|
|
3174
3004
|
const requestParams = mergeProviderOptions(params, options.providerOptions);
|
|
3175
3005
|
if (getEnvironment()?.GGAI_DUMP_REQUEST) {
|
|
3176
|
-
const
|
|
3006
|
+
const fs = await import("fs");
|
|
3177
3007
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3178
3008
|
const dumpPath = `/tmp/ggai-request-${ts}.json`;
|
|
3179
|
-
|
|
3180
|
-
|
|
3009
|
+
fs.writeFileSync(dumpPath, JSON.stringify(requestParams, null, 2));
|
|
3010
|
+
fs.appendFileSync(
|
|
3181
3011
|
"/tmp/ggai-requests.log",
|
|
3182
3012
|
`[${ts}] ${dumpPath} messages=${requestParams.messages.length}
|
|
3183
3013
|
`
|
|
@@ -3507,7 +3337,7 @@ function toError2(err, provider = "openai") {
|
|
|
3507
3337
|
}
|
|
3508
3338
|
|
|
3509
3339
|
// src/providers/openai-codex.ts
|
|
3510
|
-
var
|
|
3340
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
3511
3341
|
var zstd = __toESM(require("@bokuweb/zstd-wasm"), 1);
|
|
3512
3342
|
|
|
3513
3343
|
// src/utils/sse.ts
|
|
@@ -4153,7 +3983,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
4153
3983
|
Authorization: `Bearer ${options.apiKey}`,
|
|
4154
3984
|
"OpenAI-Beta": "responses=experimental",
|
|
4155
3985
|
originator: responsesLite ? "codex_cli_rs" : "ggcoder",
|
|
4156
|
-
"User-Agent": responsesLite ? `codex_cli_rs/${CODEX_CLIENT_VERSION}` : `ggcoder (${
|
|
3986
|
+
"User-Agent": responsesLite ? `codex_cli_rs/${CODEX_CLIENT_VERSION}` : `ggcoder (${import_node_os.default.platform()} ${import_node_os.default.release()}; ${import_node_os.default.arch()})`,
|
|
4157
3987
|
...responsesLite ? { version: CODEX_CLIENT_VERSION } : {},
|
|
4158
3988
|
...liteShape ? { "X-OpenAI-Internal-Codex-Responses-Lite": "true" } : {}
|
|
4159
3989
|
};
|
|
@@ -5293,8 +5123,8 @@ function bound(text) {
|
|
|
5293
5123
|
const trimmed = text.trim();
|
|
5294
5124
|
return trimmed.length > MAX_ERROR_MESSAGE_CHARS ? `${trimmed.slice(0, MAX_ERROR_MESSAGE_CHARS)}\u2026` : trimmed;
|
|
5295
5125
|
}
|
|
5296
|
-
function joinUrl(baseUrl,
|
|
5297
|
-
return `${baseUrl.replace(/\/+$/, "")}/${
|
|
5126
|
+
function joinUrl(baseUrl, path) {
|
|
5127
|
+
return `${baseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
5298
5128
|
}
|
|
5299
5129
|
|
|
5300
5130
|
// src/providers/gemini-embeddings.ts
|
|
@@ -6602,7 +6432,6 @@ function palsuRerankScore(query, document) {
|
|
|
6602
6432
|
}
|
|
6603
6433
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6604
6434
|
0 && (module.exports = {
|
|
6605
|
-
CLAUDE_CODE_FALLBACK_VERSION,
|
|
6606
6435
|
CODEX_CLIENT_VERSION,
|
|
6607
6436
|
EventStream,
|
|
6608
6437
|
FAST_MODE_SUFFIX,
|
|
@@ -6624,8 +6453,6 @@ function palsuRerankScore(query, document) {
|
|
|
6624
6453
|
formatChatError,
|
|
6625
6454
|
formatError,
|
|
6626
6455
|
formatErrorForDisplay,
|
|
6627
|
-
getClaudeCliUserAgent,
|
|
6628
|
-
getClaudeCodeVersion,
|
|
6629
6456
|
hasLoneSurrogate,
|
|
6630
6457
|
isHardBillingMessage,
|
|
6631
6458
|
isUsageLimitError,
|
|
@@ -6640,7 +6467,6 @@ function palsuRerankScore(query, document) {
|
|
|
6640
6467
|
palsuThinking,
|
|
6641
6468
|
palsuToolCall,
|
|
6642
6469
|
parseFastModeRejection,
|
|
6643
|
-
pendingClaudeCodeVersionRefresh,
|
|
6644
6470
|
preconnectOrigin,
|
|
6645
6471
|
preconnectProvider,
|
|
6646
6472
|
prewarmAnthropicCache,
|