@anthonyhaussman/opencode-agy-auth 1.3.5 → 1.3.6-alpha.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/dist/index.js +183 -73
- package/dist/index.js.map +1 -1
- package/dist/src/plugin/cache.d.ts +7 -0
- package/dist/src/plugin/v2-session.d.ts +1 -0
- package/dist/src/plugin/v2.d.ts +1 -0
- package/dist/src/sdk/agy-cli-version.d.ts +1 -1
- package/dist/src/sdk/request/prepare.d.ts +3 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -268,7 +268,7 @@ function createAgyActivityRequestId() {
|
|
|
268
268
|
import os from "os";
|
|
269
269
|
|
|
270
270
|
// src/sdk/agy-cli-version.ts
|
|
271
|
-
var AGY_CLI_VERSION = "1.3.
|
|
271
|
+
var AGY_CLI_VERSION = "1.3.6";
|
|
272
272
|
|
|
273
273
|
// src/sdk/user-agent.ts
|
|
274
274
|
var cachedUserAgent = null;
|
|
@@ -2098,6 +2098,35 @@ function getLatestSignature(sessionId) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
return void 0;
|
|
2100
2100
|
}
|
|
2101
|
+
function getSignatureForText(sessionId, text) {
|
|
2102
|
+
if (!sessionId || !text) return void 0;
|
|
2103
|
+
const textHash = hashText(text);
|
|
2104
|
+
const sessionMemCache = signatureCache.get(sessionId);
|
|
2105
|
+
if (sessionMemCache) {
|
|
2106
|
+
const entry = sessionMemCache.get(textHash);
|
|
2107
|
+
if (entry) {
|
|
2108
|
+
if (Date.now() - entry.timestamp <= SIGNATURE_CACHE_TTL_MS) {
|
|
2109
|
+
return entry.signature;
|
|
2110
|
+
}
|
|
2111
|
+
sessionMemCache.delete(textHash);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
if (diskCache) {
|
|
2115
|
+
const diskKey = makeDiskKey(sessionId, textHash);
|
|
2116
|
+
const diskValue = diskCache.retrieve(diskKey);
|
|
2117
|
+
if (diskValue) {
|
|
2118
|
+
if (!sessionMemCache) {
|
|
2119
|
+
const newMemCache = /* @__PURE__ */ new Map();
|
|
2120
|
+
signatureCache.set(sessionId, newMemCache);
|
|
2121
|
+
newMemCache.set(textHash, { signature: diskValue, timestamp: Date.now() });
|
|
2122
|
+
} else {
|
|
2123
|
+
sessionMemCache.set(textHash, { signature: diskValue, timestamp: Date.now() });
|
|
2124
|
+
}
|
|
2125
|
+
return diskValue;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
return void 0;
|
|
2129
|
+
}
|
|
2101
2130
|
|
|
2102
2131
|
// src/sdk/request/turn-state-tracker.ts
|
|
2103
2132
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4, renameSync as renameSync3, unlinkSync as unlinkSync3 } from "fs";
|
|
@@ -2136,7 +2165,7 @@ function hashString(str) {
|
|
|
2136
2165
|
}
|
|
2137
2166
|
function isThinkingPart(part) {
|
|
2138
2167
|
if (!part || typeof part !== "object") return false;
|
|
2139
|
-
return part.thought === true || part.type === "thinking" || part.type === "redacted_thinking";
|
|
2168
|
+
return part.thought === true || part.type === "thinking" || part.type === "redacted_thinking" || part.type === "reasoning";
|
|
2140
2169
|
}
|
|
2141
2170
|
function isFunctionResponsePart(part) {
|
|
2142
2171
|
return part && typeof part === "object" && "functionResponse" in part;
|
|
@@ -2156,7 +2185,7 @@ function messageHasThinking(msg) {
|
|
|
2156
2185
|
}
|
|
2157
2186
|
if (Array.isArray(msg.content)) {
|
|
2158
2187
|
return msg.content.some(
|
|
2159
|
-
(block) => block?.type === "thinking" || block?.type === "redacted_thinking"
|
|
2188
|
+
(block) => block?.type === "thinking" || block?.type === "redacted_thinking" || block?.type === "reasoning"
|
|
2160
2189
|
);
|
|
2161
2190
|
}
|
|
2162
2191
|
return false;
|
|
@@ -2263,7 +2292,7 @@ function deduplicateThinkingText(response, sentBuffer, displayedThinkingHashes)
|
|
|
2263
2292
|
if (!Array.isArray(content.parts)) return candidate;
|
|
2264
2293
|
const newParts = content.parts.map((part) => {
|
|
2265
2294
|
const p = part;
|
|
2266
|
-
if (p.thought === true || p.type === "thinking") {
|
|
2295
|
+
if (p.thought === true || p.type === "thinking" || p.type === "reasoning") {
|
|
2267
2296
|
const fullText = p.text || p.thinking || "";
|
|
2268
2297
|
if (displayedThinkingHashes) {
|
|
2269
2298
|
const hash2 = hashString(fullText);
|
|
@@ -2299,7 +2328,7 @@ function deduplicateThinkingText(response, sentBuffer, displayedThinkingHashes)
|
|
|
2299
2328
|
let thinkingIndex = 0;
|
|
2300
2329
|
const newContent = resp.content.map((block) => {
|
|
2301
2330
|
const b = block;
|
|
2302
|
-
if (b?.type === "thinking") {
|
|
2331
|
+
if (b?.type === "thinking" || b?.type === "reasoning") {
|
|
2303
2332
|
const fullText = b.thinking || b.text || "";
|
|
2304
2333
|
if (displayedThinkingHashes) {
|
|
2305
2334
|
const hash2 = hashString(fullText);
|
|
@@ -2345,17 +2374,18 @@ function cacheThinkingSignaturesFromResponse(response, signatureSessionKey, sign
|
|
|
2345
2374
|
if (!Array.isArray(content.parts)) return;
|
|
2346
2375
|
content.parts.forEach((part) => {
|
|
2347
2376
|
const p = part;
|
|
2348
|
-
if (p.thought === true || p.type === "thinking") {
|
|
2377
|
+
if (p.thought === true || p.type === "thinking" || p.type === "reasoning") {
|
|
2349
2378
|
const text = p.text || p.thinking || "";
|
|
2350
2379
|
if (text) {
|
|
2351
2380
|
const current = thoughtBuffer.get(index) ?? "";
|
|
2352
2381
|
thoughtBuffer.set(index, current + text);
|
|
2353
2382
|
}
|
|
2354
2383
|
}
|
|
2355
|
-
|
|
2384
|
+
const partSignature = p.thoughtSignature || p.state?.thoughtSignature || p.signature;
|
|
2385
|
+
if (partSignature) {
|
|
2356
2386
|
const fullText = thoughtBuffer.get(index) ?? "";
|
|
2357
2387
|
if (fullText) {
|
|
2358
|
-
const signature =
|
|
2388
|
+
const signature = partSignature;
|
|
2359
2389
|
onCacheSignature?.(signatureSessionKey, fullText, signature);
|
|
2360
2390
|
signatureStore.set(signatureSessionKey, { text: fullText, signature });
|
|
2361
2391
|
}
|
|
@@ -2367,17 +2397,18 @@ function cacheThinkingSignaturesFromResponse(response, signatureSessionKey, sign
|
|
|
2367
2397
|
const CLAUDE_BUFFER_KEY = 0;
|
|
2368
2398
|
resp.content.forEach((block) => {
|
|
2369
2399
|
const b = block;
|
|
2370
|
-
if (b?.type === "thinking") {
|
|
2400
|
+
if (b?.type === "thinking" || b?.type === "reasoning") {
|
|
2371
2401
|
const text = b.thinking || b.text || "";
|
|
2372
2402
|
if (text) {
|
|
2373
2403
|
const current = thoughtBuffer.get(CLAUDE_BUFFER_KEY) ?? "";
|
|
2374
2404
|
thoughtBuffer.set(CLAUDE_BUFFER_KEY, current + text);
|
|
2375
2405
|
}
|
|
2376
2406
|
}
|
|
2377
|
-
|
|
2407
|
+
const blockSignature = b?.signature || b?.thoughtSignature || b?.state?.thoughtSignature;
|
|
2408
|
+
if (blockSignature) {
|
|
2378
2409
|
const fullText = thoughtBuffer.get(CLAUDE_BUFFER_KEY) ?? "";
|
|
2379
2410
|
if (fullText) {
|
|
2380
|
-
const signature =
|
|
2411
|
+
const signature = blockSignature;
|
|
2381
2412
|
onCacheSignature?.(signatureSessionKey, fullText, signature);
|
|
2382
2413
|
signatureStore.set(signatureSessionKey, { text: fullText, signature });
|
|
2383
2414
|
}
|
|
@@ -2453,7 +2484,7 @@ function createStreamingTransformer(signatureStore, callbacks, options = {}) {
|
|
|
2453
2484
|
hasSeenUsageMetadata = true;
|
|
2454
2485
|
}
|
|
2455
2486
|
if (!streamHasThinking) {
|
|
2456
|
-
streamHasThinking = event.includes('"thought":true') || event.includes('"type":"thinking"');
|
|
2487
|
+
streamHasThinking = event.includes('"thought":true') || event.includes('"type":"thinking"') || event.includes('"type":"reasoning"');
|
|
2457
2488
|
}
|
|
2458
2489
|
if (!streamHasToolCalls) {
|
|
2459
2490
|
streamHasToolCalls = event.includes('"functionCall"');
|
|
@@ -2477,7 +2508,7 @@ function createStreamingTransformer(signatureStore, callbacks, options = {}) {
|
|
|
2477
2508
|
hasSeenUsageMetadata = true;
|
|
2478
2509
|
}
|
|
2479
2510
|
if (!streamHasThinking) {
|
|
2480
|
-
streamHasThinking = buffer.includes('"thought":true') || buffer.includes('"type":"thinking"');
|
|
2511
|
+
streamHasThinking = buffer.includes('"thought":true') || buffer.includes('"type":"thinking"') || buffer.includes('"type":"reasoning"');
|
|
2481
2512
|
}
|
|
2482
2513
|
if (!streamHasToolCalls) {
|
|
2483
2514
|
streamHasToolCalls = buffer.includes('"functionCall"');
|
|
@@ -16061,9 +16092,6 @@ var models_default = {
|
|
|
16061
16092
|
"gemini-3.5-flash-lite"
|
|
16062
16093
|
],
|
|
16063
16094
|
defaultAgentModelId: "gemini-3.8-flash-high",
|
|
16064
|
-
deprecatedModelIds: {
|
|
16065
|
-
"gemini-3.1-pro-high": "gemini-pro-agent"
|
|
16066
|
-
},
|
|
16067
16095
|
experimentIds: [
|
|
16068
16096
|
106826239,
|
|
16069
16097
|
106828853,
|
|
@@ -16083,7 +16111,6 @@ var models_default = {
|
|
|
16083
16111
|
106015333,
|
|
16084
16112
|
106568772,
|
|
16085
16113
|
105867471,
|
|
16086
|
-
106749606,
|
|
16087
16114
|
106123599,
|
|
16088
16115
|
106121401,
|
|
16089
16116
|
106100625,
|
|
@@ -16106,6 +16133,7 @@ var models_default = {
|
|
|
16106
16133
|
106228452,
|
|
16107
16134
|
106121607,
|
|
16108
16135
|
106793059,
|
|
16136
|
+
106848342,
|
|
16109
16137
|
105979531,
|
|
16110
16138
|
105979553,
|
|
16111
16139
|
106015328,
|
|
@@ -16181,7 +16209,7 @@ var models_default = {
|
|
|
16181
16209
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16182
16210
|
quotaInfo: {
|
|
16183
16211
|
remainingFraction: 1,
|
|
16184
|
-
resetTime: "2026-10-
|
|
16212
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16185
16213
|
},
|
|
16186
16214
|
recommended: true,
|
|
16187
16215
|
supportedMimeTypes: {
|
|
@@ -16222,7 +16250,7 @@ var models_default = {
|
|
|
16222
16250
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16223
16251
|
quotaInfo: {
|
|
16224
16252
|
remainingFraction: 1,
|
|
16225
|
-
resetTime: "2026-10-
|
|
16253
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16226
16254
|
},
|
|
16227
16255
|
recommended: true,
|
|
16228
16256
|
supportedMimeTypes: {
|
|
@@ -16263,7 +16291,7 @@ var models_default = {
|
|
|
16263
16291
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16264
16292
|
quotaInfo: {
|
|
16265
16293
|
remainingFraction: 1,
|
|
16266
|
-
resetTime: "2026-10-
|
|
16294
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16267
16295
|
},
|
|
16268
16296
|
recommended: true,
|
|
16269
16297
|
supportedMimeTypes: {
|
|
@@ -16304,7 +16332,7 @@ var models_default = {
|
|
|
16304
16332
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16305
16333
|
quotaInfo: {
|
|
16306
16334
|
remainingFraction: 1,
|
|
16307
|
-
resetTime: "2026-10-
|
|
16335
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16308
16336
|
},
|
|
16309
16337
|
recommended: true,
|
|
16310
16338
|
supportedMimeTypes: {
|
|
@@ -16345,7 +16373,7 @@ var models_default = {
|
|
|
16345
16373
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16346
16374
|
quotaInfo: {
|
|
16347
16375
|
remainingFraction: 1,
|
|
16348
|
-
resetTime: "2026-10-
|
|
16376
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16349
16377
|
},
|
|
16350
16378
|
recommended: true,
|
|
16351
16379
|
supportedMimeTypes: {
|
|
@@ -16386,7 +16414,7 @@ var models_default = {
|
|
|
16386
16414
|
modelProvider: "MODEL_PROVIDER_ANTHROPIC",
|
|
16387
16415
|
quotaInfo: {
|
|
16388
16416
|
remainingFraction: 1,
|
|
16389
|
-
resetTime: "2026-10-
|
|
16417
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
16390
16418
|
},
|
|
16391
16419
|
recommended: true,
|
|
16392
16420
|
supportedMimeTypes: {
|
|
@@ -16424,8 +16452,8 @@ var models_default = {
|
|
|
16424
16452
|
},
|
|
16425
16453
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16426
16454
|
quotaInfo: {
|
|
16427
|
-
remainingFraction: 0.
|
|
16428
|
-
resetTime: "2026-10-
|
|
16455
|
+
remainingFraction: 0.96159846,
|
|
16456
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16429
16457
|
},
|
|
16430
16458
|
recommended: true,
|
|
16431
16459
|
supportedMimeTypes: {
|
|
@@ -16507,8 +16535,8 @@ var models_default = {
|
|
|
16507
16535
|
},
|
|
16508
16536
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16509
16537
|
quotaInfo: {
|
|
16510
|
-
remainingFraction: 0.
|
|
16511
|
-
resetTime: "2026-10-
|
|
16538
|
+
remainingFraction: 0.96159846,
|
|
16539
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16512
16540
|
},
|
|
16513
16541
|
recommended: true,
|
|
16514
16542
|
supportedMimeTypes: {
|
|
@@ -16590,8 +16618,8 @@ var models_default = {
|
|
|
16590
16618
|
},
|
|
16591
16619
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16592
16620
|
quotaInfo: {
|
|
16593
|
-
remainingFraction: 0.
|
|
16594
|
-
resetTime: "2026-10-
|
|
16621
|
+
remainingFraction: 0.96159846,
|
|
16622
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16595
16623
|
},
|
|
16596
16624
|
recommended: true,
|
|
16597
16625
|
supportedMimeTypes: {
|
|
@@ -16670,8 +16698,8 @@ var models_default = {
|
|
|
16670
16698
|
},
|
|
16671
16699
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16672
16700
|
quotaInfo: {
|
|
16673
|
-
remainingFraction: 0.
|
|
16674
|
-
resetTime: "2026-10-
|
|
16701
|
+
remainingFraction: 0.96159846,
|
|
16702
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16675
16703
|
},
|
|
16676
16704
|
recommended: true,
|
|
16677
16705
|
requiresImageOutputOutsideFunctionResponses: true,
|
|
@@ -16748,8 +16776,8 @@ var models_default = {
|
|
|
16748
16776
|
},
|
|
16749
16777
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16750
16778
|
quotaInfo: {
|
|
16751
|
-
remainingFraction: 0.
|
|
16752
|
-
resetTime: "2026-10-
|
|
16779
|
+
remainingFraction: 0.96159846,
|
|
16780
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16753
16781
|
},
|
|
16754
16782
|
recommended: true,
|
|
16755
16783
|
supportedMimeTypes: {
|
|
@@ -16854,8 +16882,8 @@ var models_default = {
|
|
|
16854
16882
|
},
|
|
16855
16883
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16856
16884
|
quotaInfo: {
|
|
16857
|
-
remainingFraction: 0.
|
|
16858
|
-
resetTime: "2026-10-
|
|
16885
|
+
remainingFraction: 0.96159846,
|
|
16886
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16859
16887
|
},
|
|
16860
16888
|
recommended: true,
|
|
16861
16889
|
supportedMimeTypes: {
|
|
@@ -16922,8 +16950,8 @@ var models_default = {
|
|
|
16922
16950
|
model: "MODEL_PLACEHOLDER_M21",
|
|
16923
16951
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16924
16952
|
quotaInfo: {
|
|
16925
|
-
remainingFraction: 0.
|
|
16926
|
-
resetTime: "2026-10-
|
|
16953
|
+
remainingFraction: 0.96159846,
|
|
16954
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16927
16955
|
}
|
|
16928
16956
|
},
|
|
16929
16957
|
"gemini-3.1-flash-lite": {
|
|
@@ -16945,8 +16973,8 @@ var models_default = {
|
|
|
16945
16973
|
},
|
|
16946
16974
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
16947
16975
|
quotaInfo: {
|
|
16948
|
-
remainingFraction: 0.
|
|
16949
|
-
resetTime: "2026-10-
|
|
16976
|
+
remainingFraction: 0.96159846,
|
|
16977
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
16950
16978
|
},
|
|
16951
16979
|
recommended: true,
|
|
16952
16980
|
supportedMimeTypes: {
|
|
@@ -17053,8 +17081,8 @@ var models_default = {
|
|
|
17053
17081
|
},
|
|
17054
17082
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17055
17083
|
quotaInfo: {
|
|
17056
|
-
remainingFraction: 0.
|
|
17057
|
-
resetTime: "2026-10-
|
|
17084
|
+
remainingFraction: 0.96159846,
|
|
17085
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17058
17086
|
},
|
|
17059
17087
|
recommended: true,
|
|
17060
17088
|
supportedMimeTypes: {
|
|
@@ -17134,8 +17162,8 @@ var models_default = {
|
|
|
17134
17162
|
},
|
|
17135
17163
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17136
17164
|
quotaInfo: {
|
|
17137
|
-
remainingFraction: 0.
|
|
17138
|
-
resetTime: "2026-10-
|
|
17165
|
+
remainingFraction: 0.96159846,
|
|
17166
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17139
17167
|
},
|
|
17140
17168
|
recommended: true,
|
|
17141
17169
|
supportedMimeTypes: {
|
|
@@ -17242,8 +17270,8 @@ var models_default = {
|
|
|
17242
17270
|
},
|
|
17243
17271
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17244
17272
|
quotaInfo: {
|
|
17245
|
-
remainingFraction: 0.
|
|
17246
|
-
resetTime: "2026-10-
|
|
17273
|
+
remainingFraction: 0.96159846,
|
|
17274
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17247
17275
|
},
|
|
17248
17276
|
recommended: true,
|
|
17249
17277
|
supportedMimeTypes: {
|
|
@@ -17354,8 +17382,8 @@ var models_default = {
|
|
|
17354
17382
|
},
|
|
17355
17383
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17356
17384
|
quotaInfo: {
|
|
17357
|
-
remainingFraction: 0.
|
|
17358
|
-
resetTime: "2026-10-
|
|
17385
|
+
remainingFraction: 0.96159846,
|
|
17386
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17359
17387
|
},
|
|
17360
17388
|
recommended: true,
|
|
17361
17389
|
supportedMimeTypes: {
|
|
@@ -17466,8 +17494,8 @@ var models_default = {
|
|
|
17466
17494
|
},
|
|
17467
17495
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17468
17496
|
quotaInfo: {
|
|
17469
|
-
remainingFraction: 0.
|
|
17470
|
-
resetTime: "2026-10-
|
|
17497
|
+
remainingFraction: 0.96159846,
|
|
17498
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17471
17499
|
},
|
|
17472
17500
|
recommended: true,
|
|
17473
17501
|
supportedMimeTypes: {
|
|
@@ -17578,8 +17606,8 @@ var models_default = {
|
|
|
17578
17606
|
},
|
|
17579
17607
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17580
17608
|
quotaInfo: {
|
|
17581
|
-
remainingFraction: 0.
|
|
17582
|
-
resetTime: "2026-10-
|
|
17609
|
+
remainingFraction: 0.96159846,
|
|
17610
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17583
17611
|
},
|
|
17584
17612
|
recommended: true,
|
|
17585
17613
|
supportedMimeTypes: {
|
|
@@ -17689,8 +17717,8 @@ var models_default = {
|
|
|
17689
17717
|
},
|
|
17690
17718
|
modelProvider: "MODEL_PROVIDER_GOOGLE",
|
|
17691
17719
|
quotaInfo: {
|
|
17692
|
-
remainingFraction: 0.
|
|
17693
|
-
resetTime: "2026-10-
|
|
17720
|
+
remainingFraction: 0.96159846,
|
|
17721
|
+
resetTime: "2026-10-15T23:50:41Z"
|
|
17694
17722
|
},
|
|
17695
17723
|
recommended: true,
|
|
17696
17724
|
supportedMimeTypes: {
|
|
@@ -18098,7 +18126,7 @@ monitors {
|
|
|
18098
18126
|
modelProvider: "MODEL_PROVIDER_OPENAI",
|
|
18099
18127
|
quotaInfo: {
|
|
18100
18128
|
remainingFraction: 1,
|
|
18101
|
-
resetTime: "2026-10-
|
|
18129
|
+
resetTime: "2026-10-16T00:05:09Z"
|
|
18102
18130
|
},
|
|
18103
18131
|
recommended: true,
|
|
18104
18132
|
supportsThinking: true,
|
|
@@ -18886,10 +18914,20 @@ function prepareAgyRequest(input, init, accessToken, projectId, thinkingConfigDe
|
|
|
18886
18914
|
sessionId
|
|
18887
18915
|
};
|
|
18888
18916
|
}
|
|
18917
|
+
var LEGACY_MODEL_ENUM_FALLBACKS = {
|
|
18918
|
+
"gemini-3.1-pro-high": "MODEL_PLACEHOLDER_M16",
|
|
18919
|
+
"gemini-pro-agent": "MODEL_PLACEHOLDER_M16"
|
|
18920
|
+
};
|
|
18889
18921
|
function getModelEnum(modelName) {
|
|
18890
18922
|
const deprecated = models_default.deprecatedModelIds;
|
|
18891
|
-
if (deprecated && deprecated[modelName]
|
|
18892
|
-
|
|
18923
|
+
if (deprecated && deprecated[modelName]) {
|
|
18924
|
+
const entry = deprecated[modelName];
|
|
18925
|
+
if (typeof entry === "string" && LEGACY_MODEL_ENUM_FALLBACKS[entry]) {
|
|
18926
|
+
return LEGACY_MODEL_ENUM_FALLBACKS[entry];
|
|
18927
|
+
}
|
|
18928
|
+
if (entry.newModelEnum) {
|
|
18929
|
+
return entry.newModelEnum;
|
|
18930
|
+
}
|
|
18893
18931
|
}
|
|
18894
18932
|
const models = models_default.models;
|
|
18895
18933
|
if (models && models[modelName] && models[modelName].model) {
|
|
@@ -18898,12 +18936,15 @@ function getModelEnum(modelName) {
|
|
|
18898
18936
|
if (deprecated && deprecated[modelName] && deprecated[modelName].oldModelEnum) {
|
|
18899
18937
|
return deprecated[modelName].oldModelEnum;
|
|
18900
18938
|
}
|
|
18939
|
+
if (LEGACY_MODEL_ENUM_FALLBACKS[modelName]) {
|
|
18940
|
+
return LEGACY_MODEL_ENUM_FALLBACKS[modelName];
|
|
18941
|
+
}
|
|
18901
18942
|
return "MODEL_PLACEHOLDER_M16";
|
|
18902
18943
|
}
|
|
18903
18944
|
function isClaudeModel(model) {
|
|
18904
18945
|
return model.toLowerCase().includes("claude");
|
|
18905
18946
|
}
|
|
18906
|
-
function sanitizeClaudeThinkingParts(contents, model) {
|
|
18947
|
+
function sanitizeClaudeThinkingParts(contents, model, sessionId) {
|
|
18907
18948
|
if (!isClaudeModel(model) || !Array.isArray(contents)) {
|
|
18908
18949
|
return;
|
|
18909
18950
|
}
|
|
@@ -18913,12 +18954,49 @@ function sanitizeClaudeThinkingParts(contents, model) {
|
|
|
18913
18954
|
if (!Array.isArray(turn.parts)) continue;
|
|
18914
18955
|
const filteredParts = turn.parts.filter((part) => {
|
|
18915
18956
|
if (!part || typeof part !== "object") return true;
|
|
18916
|
-
const isThinking = part.thought === true || part.type === "thinking" || typeof part.thinking === "string";
|
|
18957
|
+
const isThinking = part.thought === true || part.type === "thinking" || part.type === "reasoning" || typeof part.thinking === "string";
|
|
18917
18958
|
if (!isThinking) {
|
|
18918
18959
|
return true;
|
|
18919
18960
|
}
|
|
18920
|
-
|
|
18961
|
+
let sig = typeof part.signature === "string" ? part.signature : typeof part.thoughtSignature === "string" ? part.thoughtSignature : typeof part.state?.thoughtSignature === "string" ? part.state.thoughtSignature : void 0;
|
|
18962
|
+
let recovered = false;
|
|
18963
|
+
if ((!sig || sig === "skip_thought_signature_validator") && sessionId) {
|
|
18964
|
+
const text = typeof part.text === "string" ? part.text : typeof part.thinking === "string" ? part.thinking : void 0;
|
|
18965
|
+
if (text) {
|
|
18966
|
+
const recoveredSig = getSignatureForText(sessionId, text);
|
|
18967
|
+
if (recoveredSig) {
|
|
18968
|
+
sig = recoveredSig;
|
|
18969
|
+
recovered = true;
|
|
18970
|
+
}
|
|
18971
|
+
}
|
|
18972
|
+
if (!sig) {
|
|
18973
|
+
const latest = getLatestSignature(sessionId);
|
|
18974
|
+
if (latest) {
|
|
18975
|
+
sig = latest;
|
|
18976
|
+
recovered = true;
|
|
18977
|
+
}
|
|
18978
|
+
}
|
|
18979
|
+
}
|
|
18921
18980
|
const isValidSig = typeof sig === "string" && sig.length > 0 && sig !== "skip_thought_signature_validator";
|
|
18981
|
+
if (isValidSig) {
|
|
18982
|
+
if (part.type === "reasoning") {
|
|
18983
|
+
part.thoughtSignature = sig;
|
|
18984
|
+
part.signature = sig;
|
|
18985
|
+
if (part.state) {
|
|
18986
|
+
part.state.thoughtSignature = sig;
|
|
18987
|
+
}
|
|
18988
|
+
} else if (recovered) {
|
|
18989
|
+
if (typeof part.thoughtSignature === "string" || part.thought) {
|
|
18990
|
+
part.thoughtSignature = sig;
|
|
18991
|
+
}
|
|
18992
|
+
if (part.type === "thinking" || typeof part.thinking === "string") {
|
|
18993
|
+
part.signature = sig;
|
|
18994
|
+
}
|
|
18995
|
+
if (!part.thoughtSignature && !part.signature) {
|
|
18996
|
+
part.signature = sig;
|
|
18997
|
+
}
|
|
18998
|
+
}
|
|
18999
|
+
}
|
|
18922
19000
|
return isValidSig;
|
|
18923
19001
|
});
|
|
18924
19002
|
if (filteredParts.length === 0) {
|
|
@@ -18989,7 +19067,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
|
|
|
18989
19067
|
contents2 = ensureTrailingUserTurn(contents2);
|
|
18990
19068
|
const latestSig = getLatestSignature(sessionId2);
|
|
18991
19069
|
applyLatestSignature(contents2, latestSig);
|
|
18992
|
-
sanitizeClaudeThinkingParts(contents2, effectiveModel || requestedModel);
|
|
19070
|
+
sanitizeClaudeThinkingParts(contents2, effectiveModel || requestedModel, sessionId2);
|
|
18993
19071
|
requestPayloadInside.contents = contents2;
|
|
18994
19072
|
}
|
|
18995
19073
|
return { body: JSON.stringify(wrappedBody2), userPromptId: userPromptId2, sessionId: sessionId2 };
|
|
@@ -19031,7 +19109,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
|
|
|
19031
19109
|
contents = ensureTrailingUserTurn(contents);
|
|
19032
19110
|
const latestSig = getLatestSignature(sessionId);
|
|
19033
19111
|
applyLatestSignature(contents, latestSig);
|
|
19034
|
-
sanitizeClaudeThinkingParts(contents, effectiveModel || requestedModel);
|
|
19112
|
+
sanitizeClaudeThinkingParts(contents, effectiveModel || requestedModel, sessionId);
|
|
19035
19113
|
requestPayload.contents = contents;
|
|
19036
19114
|
}
|
|
19037
19115
|
if ("model" in requestPayload) {
|
|
@@ -20469,6 +20547,26 @@ function createV2HttpRequestHook(state = {}) {
|
|
|
20469
20547
|
}
|
|
20470
20548
|
} catch {
|
|
20471
20549
|
}
|
|
20550
|
+
let bodyPayload = event.body;
|
|
20551
|
+
if (bodyPayload === void 0 && event.request) {
|
|
20552
|
+
if (typeof event.request.clone === "function") {
|
|
20553
|
+
try {
|
|
20554
|
+
bodyPayload = await event.request.clone().text();
|
|
20555
|
+
} catch {
|
|
20556
|
+
}
|
|
20557
|
+
} else if (event.request.body !== void 0) {
|
|
20558
|
+
bodyPayload = event.request.body;
|
|
20559
|
+
}
|
|
20560
|
+
}
|
|
20561
|
+
if (bodyPayload) {
|
|
20562
|
+
try {
|
|
20563
|
+
const parsed2 = typeof bodyPayload === "string" ? JSON.parse(bodyPayload) : bodyPayload;
|
|
20564
|
+
if (parsed2 && typeof parsed2 === "object" && typeof parsed2.sessionId === "string") {
|
|
20565
|
+
state.lastSessionId = parsed2.sessionId;
|
|
20566
|
+
}
|
|
20567
|
+
} catch {
|
|
20568
|
+
}
|
|
20569
|
+
}
|
|
20472
20570
|
if (authRecord && authRecord.access) {
|
|
20473
20571
|
let projectContext;
|
|
20474
20572
|
try {
|
|
@@ -20495,17 +20593,6 @@ function createV2HttpRequestHook(state = {}) {
|
|
|
20495
20593
|
modifiedUrl = modifiedUrl.replace(`models/${originalBase}`, `models/${resolvedBase}`);
|
|
20496
20594
|
}
|
|
20497
20595
|
}
|
|
20498
|
-
let bodyPayload = event.body;
|
|
20499
|
-
if (bodyPayload === void 0 && event.request) {
|
|
20500
|
-
if (typeof event.request.clone === "function") {
|
|
20501
|
-
try {
|
|
20502
|
-
bodyPayload = await event.request.clone().text();
|
|
20503
|
-
} catch {
|
|
20504
|
-
}
|
|
20505
|
-
} else if (event.request.body !== void 0) {
|
|
20506
|
-
bodyPayload = event.request.body;
|
|
20507
|
-
}
|
|
20508
|
-
}
|
|
20509
20596
|
let preExistingUserAgent;
|
|
20510
20597
|
if (typeof event.headers?.get === "function") {
|
|
20511
20598
|
preExistingUserAgent = event.headers.get("user-agent") || event.headers.get("User-Agent") || void 0;
|
|
@@ -20529,6 +20616,9 @@ function createV2HttpRequestHook(state = {}) {
|
|
|
20529
20616
|
authRecord.access,
|
|
20530
20617
|
projectContext.effectiveProjectId
|
|
20531
20618
|
);
|
|
20619
|
+
if (transformed.sessionId) {
|
|
20620
|
+
state.lastSessionId = transformed.sessionId;
|
|
20621
|
+
}
|
|
20532
20622
|
const targetUrl = toUrlString(transformed.request);
|
|
20533
20623
|
if (typeof event.url === "string") {
|
|
20534
20624
|
event.url = targetUrl;
|
|
@@ -20645,7 +20735,7 @@ function createV2HttpResponseHook(state = {}) {
|
|
|
20645
20735
|
!!isStreaming,
|
|
20646
20736
|
null,
|
|
20647
20737
|
parsedModel,
|
|
20648
|
-
|
|
20738
|
+
state.lastSessionId,
|
|
20649
20739
|
void 0
|
|
20650
20740
|
);
|
|
20651
20741
|
event.response = transformed;
|
|
@@ -20687,6 +20777,26 @@ function registerV2SessionHooks(ctx) {
|
|
|
20687
20777
|
|
|
20688
20778
|
// src/plugin/v2.ts
|
|
20689
20779
|
async function setupOpenCodeV2(ctx) {
|
|
20780
|
+
try {
|
|
20781
|
+
initDiskSignatureCache({
|
|
20782
|
+
enabled: true,
|
|
20783
|
+
memory_ttl_seconds: 3600,
|
|
20784
|
+
disk_ttl_seconds: 86400,
|
|
20785
|
+
write_interval_seconds: 30
|
|
20786
|
+
});
|
|
20787
|
+
} catch (e) {
|
|
20788
|
+
console.warn(`[Agy Auth] initDiskSignatureCache failed, running without signature disk cache: ${e instanceof Error ? e.message : e}`);
|
|
20789
|
+
}
|
|
20790
|
+
try {
|
|
20791
|
+
initTurnStateTracker();
|
|
20792
|
+
} catch (e) {
|
|
20793
|
+
console.warn(`[Agy Auth] initTurnStateTracker failed, running without turn-state tracking: ${e instanceof Error ? e.message : e}`);
|
|
20794
|
+
}
|
|
20795
|
+
try {
|
|
20796
|
+
initCooldownPersistence();
|
|
20797
|
+
} catch (e) {
|
|
20798
|
+
console.warn(`[Agy Auth] initCooldownPersistence failed, running without cooldown disk persistence: ${e instanceof Error ? e.message : e}`);
|
|
20799
|
+
}
|
|
20690
20800
|
const resolveVariants = (modelId) => {
|
|
20691
20801
|
const mapping = TIER_MAPPING[modelId];
|
|
20692
20802
|
if (!mapping) return void 0;
|