dsh-vertex-argon 2.2.4 → 2.2.5
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/adapter.js +11 -3
- package/google-signatures.js +10 -10
- package/index.js +10 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to **Gemini 4 Adapter** (`dsh-vertex-argon`) are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.2.5] - 2026-11-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Same-Chunk Unsigned-to-Signed Part Boundaries (`google-signatures.js`)**:
|
|
9
|
+
- Tracked `currentFromThisChunk` inside `observe(chunk)` so an unsigned part followed immediately by a signed part (`text` or `thinking`) within the same `candidates[0].content.parts` array always splits 1:1 into separate blocks while preserving cross-chunk delta merging.
|
|
10
|
+
- **Strict `extraBody` Effort/Null Hardening & Direct-Provider Origin Pinning (`adapter.js`)**:
|
|
11
|
+
- Added `'reasoningEffort'`, `'reasoning_effort'`, `'thinkingLevel'`, and `'thinking_level'` to `EXTRA_BODY_STRIPPED_KEYS` (and stripped `reasoningEffort` / `reasoning_effort` on `body` & `cleanConfig` in `gemini4StreamSimple`), and rejected explicit `null` / non-plain-object values for `httpOptions.extraBody`, `extraBody.generationConfig`, and `extraBody.generation_config` with `INVALID_REQUEST`.
|
|
12
|
+
- Pinned `baseUrl` and `contextWindow` on `effectiveModel` in `argonProvider.streamSimple` from `configured` alongside `id`, `provider`, `api`, `maxTokens`, `thinkingLevelMap`, and `[MAX_TOKENS_CEILING]`.
|
|
13
|
+
- **Two-Stage `apply()` Cleanup Rollback (`index.js`)**:
|
|
14
|
+
- Rolled back both `registration?.()` and `unpatchPiAi()` in `try/finally` inside both the `ctx.effect` disposer and `catch` handler if `ctx.effect(...)` throws after `ctx.llm.registerAdapter()` has succeeded.
|
|
15
|
+
|
|
5
16
|
## [2.2.4] - 2026-11-19
|
|
6
17
|
|
|
7
18
|
### Fixed
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**面向 [DeepSeek Harness](<https://github.com/deepseek-ai/deepseek-harness>) 的 Google 官方双通道(Vertex AI + Gemini Developer API)Gemini 4 适配器,原生支持 Argon、Carbon、Hydrogen 与 Neon 八模型路由、GenerateContent / Interactions 双协议、65K+ 多跳长解码与请求级诊断。**
|
|
6
6
|
|
|
7
|
-
- **当前版本**:`2.2.
|
|
7
|
+
- **当前版本**:`2.2.5`([CHANGELOG.md](<CHANGELOG.md>))
|
|
8
8
|
- **npm 包名**:`dsh-vertex-argon`(保留既有包名、官方通道路由与本地存储域 ID,官方通道用户可直接原地升级;`2.0.0` 已移除 `1.6.x` 非官方反代通道)
|
|
9
9
|
- **运行要求**:DSH `>=0.2.0-rc.2`,Node.js `^22.19.0 || >=24.0.0`(见 [package.json](<package.json>))
|
|
10
10
|
|
package/adapter.js
CHANGED
|
@@ -423,6 +423,10 @@ const EXTRA_BODY_STRIPPED_KEYS = [
|
|
|
423
423
|
'thinking_config',
|
|
424
424
|
'thinkingBudget',
|
|
425
425
|
'thinking_budget',
|
|
426
|
+
'thinkingLevel',
|
|
427
|
+
'thinking_level',
|
|
428
|
+
'reasoningEffort',
|
|
429
|
+
'reasoning_effort',
|
|
426
430
|
'includeThoughts',
|
|
427
431
|
'include_thoughts',
|
|
428
432
|
'temperature',
|
|
@@ -439,7 +443,7 @@ const EXTRA_BODY_STRIPPED_KEYS = [
|
|
|
439
443
|
]
|
|
440
444
|
|
|
441
445
|
function sanitizeGemini4ExtraBody(extraBody, stripExplicitCache) {
|
|
442
|
-
if (extraBody === undefined
|
|
446
|
+
if (extraBody === undefined) return extraBody
|
|
443
447
|
if (!isPlainObjectRecord(extraBody)) {
|
|
444
448
|
throw new LlmError('Gemini 4 httpOptions.extraBody must be a plain object.', 'INVALID_REQUEST')
|
|
445
449
|
}
|
|
@@ -450,7 +454,7 @@ function sanitizeGemini4ExtraBody(extraBody, stripExplicitCache) {
|
|
|
450
454
|
delete cleanExtraBody.cached_content
|
|
451
455
|
}
|
|
452
456
|
for (const cfgKey of ['generationConfig', 'generation_config']) {
|
|
453
|
-
if (cleanExtraBody
|
|
457
|
+
if (!Object.hasOwn(cleanExtraBody, cfgKey) || cleanExtraBody[cfgKey] === undefined) continue
|
|
454
458
|
if (!isPlainObjectRecord(cleanExtraBody[cfgKey])) {
|
|
455
459
|
throw new LlmError(`Gemini 4 httpOptions.extraBody.${cfgKey} must be a plain object.`, 'INVALID_REQUEST')
|
|
456
460
|
}
|
|
@@ -580,7 +584,9 @@ export function gemini4StreamSimple(
|
|
|
580
584
|
delete body.cachedContent
|
|
581
585
|
delete body.cached_content
|
|
582
586
|
}
|
|
583
|
-
|
|
587
|
+
delete body.reasoningEffort
|
|
588
|
+
delete body.reasoning_effort
|
|
589
|
+
const { temperature: _t, topP: _tp, topK: _tk, candidateCount: _cc, frequencyPenalty: _fp, presencePenalty: _pp, reasoningEffort: _reBody, reasoning_effort: _reSnake, ...cleanConfig } = body.config
|
|
584
590
|
if (supportsXhigh) {
|
|
585
591
|
delete cleanConfig.cachedContent
|
|
586
592
|
delete cleanConfig.cached_content
|
|
@@ -868,6 +874,8 @@ export function argonProvider(nativeVertex, models, defaultLevel = undefined, na
|
|
|
868
874
|
id: configured.id,
|
|
869
875
|
provider: PROVIDER,
|
|
870
876
|
api: configured.api,
|
|
877
|
+
baseUrl: configured.baseUrl,
|
|
878
|
+
contextWindow: configured.contextWindow,
|
|
871
879
|
maxTokens: configured.maxTokens,
|
|
872
880
|
thinkingLevelMap: configured.thinkingLevelMap,
|
|
873
881
|
[MAX_TOKENS_CEILING]: configured[MAX_TOKENS_CEILING] ?? (Number.isSafeInteger(configured.maxTokens) ? configured.maxTokens : undefined),
|
package/google-signatures.js
CHANGED
|
@@ -115,7 +115,7 @@ export function createGoogleSignatureBridge(context, model) {
|
|
|
115
115
|
const historyDigest = history.digest('hex')
|
|
116
116
|
const content = [], pending = [], standalone = new Map(), usedToolIds = new Set()
|
|
117
117
|
const partial = { role: 'assistant', api: model.api, provider: model.provider, model: model.id, content }
|
|
118
|
-
let current,
|
|
118
|
+
let current, currentFromThisChunk = false, seen = false, bytes = 0
|
|
119
119
|
const emit = event => {
|
|
120
120
|
if (pending.length >= 32768) throw failure('Google response exceeded the bounded pending event count.')
|
|
121
121
|
pending.push({ ...event, partial })
|
|
@@ -136,7 +136,7 @@ export function createGoogleSignatureBridge(context, model) {
|
|
|
136
136
|
...(sig ? { contentSignature: sig } : {}),
|
|
137
137
|
})
|
|
138
138
|
current = undefined
|
|
139
|
-
|
|
139
|
+
currentFromThisChunk = false
|
|
140
140
|
}
|
|
141
141
|
const finishMessage = message => {
|
|
142
142
|
close()
|
|
@@ -160,7 +160,7 @@ export function createGoogleSignatureBridge(context, model) {
|
|
|
160
160
|
},
|
|
161
161
|
observe(chunk) {
|
|
162
162
|
seen = true
|
|
163
|
-
|
|
163
|
+
currentFromThisChunk = false
|
|
164
164
|
for (const part of chunk.candidates?.[0]?.content?.parts ?? []) {
|
|
165
165
|
bytes += Buffer.byteLength(JSON.stringify(part))
|
|
166
166
|
if (bytes > 64 * 1024 * 1024) throw failure('Google response exceeded the bounded signature replay buffer.')
|
|
@@ -180,10 +180,12 @@ export function createGoogleSignatureBridge(context, model) {
|
|
|
180
180
|
if (part.text !== undefined) {
|
|
181
181
|
const type = part.thought === true ? 'thinking' : 'text'
|
|
182
182
|
const sigKey = type === 'text' ? 'textSignature' : 'thinkingSignature'
|
|
183
|
+
const sameChunkSigBoundary = currentFromThisChunk && (Boolean(current?.[sigKey]) || Boolean(sig))
|
|
183
184
|
const splitSigned = type === 'text'
|
|
184
|
-
? (Boolean(current?.textSignature) || (Boolean(sig) && part.text === ''))
|
|
185
|
-
: (
|
|
186
|
-
(Boolean(
|
|
185
|
+
? (Boolean(current?.textSignature) || sameChunkSigBoundary || (Boolean(sig) && part.text === ''))
|
|
186
|
+
: (sameChunkSigBoundary ||
|
|
187
|
+
(Boolean(sig) && (Boolean(current?.thinkingSignature) || part.text === '')) ||
|
|
188
|
+
(Boolean(current?.thinkingSignature) && current.thinking === ''))
|
|
187
189
|
if (!current || current.type !== type || splitSigned) {
|
|
188
190
|
close(); current = type === 'text' ? { type, text: '' } : { type, thinking: '' }
|
|
189
191
|
const index = start(current)
|
|
@@ -191,10 +193,8 @@ export function createGoogleSignatureBridge(context, model) {
|
|
|
191
193
|
}
|
|
192
194
|
const key = type === 'text' ? 'text' : 'thinking'
|
|
193
195
|
current[key] += part.text
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (type === 'thinking') currentSignedInThisChunk = true
|
|
197
|
-
}
|
|
196
|
+
currentFromThisChunk = true
|
|
197
|
+
if (sig) current[sigKey] = sig
|
|
198
198
|
emit({ type: type === 'text' ? 'text_delta' : 'thinking_delta', contentIndex: content.length - 1, delta: part.text })
|
|
199
199
|
}
|
|
200
200
|
if (part.functionCall) {
|
package/index.js
CHANGED
|
@@ -123,11 +123,18 @@ export function apply(ctx, config) {
|
|
|
123
123
|
try {
|
|
124
124
|
registration = ctx.llm.registerAdapter([PROVIDER], adapter)
|
|
125
125
|
ctx.effect(() => () => {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
try {
|
|
127
|
+
registration?.()
|
|
128
|
+
} finally {
|
|
129
|
+
unpatchPiAi()
|
|
130
|
+
}
|
|
128
131
|
})
|
|
129
132
|
} catch (error) {
|
|
130
|
-
|
|
133
|
+
try {
|
|
134
|
+
registration?.()
|
|
135
|
+
} finally {
|
|
136
|
+
unpatchPiAi()
|
|
137
|
+
}
|
|
131
138
|
throw error
|
|
132
139
|
}
|
|
133
140
|
if (typeof ctx.on === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vertex-argon",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "Gemini 4 Adapter for DSH: official Vertex AI & Gemini API channels (Argon, Carbon, Hydrogen & Neon), resilient long decode, explicit service tiers, and request diagnostics.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|