dsh-vertex-argon 2.0.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to **Gemini 4 Adapter** (`dsh-vertex-argon`) are documented in this file.
4
4
 
5
+ ## [2.2.0] - 2026-11-19
6
+
7
+ ### Added
8
+ - **Gemini 4 Neon Support Across Both Official Channels (`adapter.js`, `index.js`, `package.json`)**:
9
+ - Added `NEON_MODEL = 'gemini-4-neon'` (Vertex AI) and `GOOGLE_API_NEON_MODEL = 'gemini-4-neon-google'` (Gemini API), `isNeonModel()`, and `supportsXhighReasoning()` (`isHydrogenModel(modelId) || isNeonModel(modelId)`).
10
+ - Updated `isGoogleApiModel`, `officialUpstreamModel`, `detectPiAiArgonRoutes` (`hasVertexNeon` / `hasGoogleNeon` explicit, auto-detection, and empty Argon fallback), and `createArgonAdapter().getProfiles()` (`vn` / `gn` cache keys, `HYDROGEN_THINKING_MAP`), expanding the official matrix to 8 models with 1M context window (`1,048,576`), `65,536` single-hop / `1,048,576` long decode, four reasoning levels (`low` / `medium` / `high` / `xhigh`, `max` → `xhigh`, rejecting `minimal` / `off`), and outbound `cachedContent` / `cached_content` stripping.
11
+
12
+ ### Fixed
13
+ - **Interactions `xhigh` & `max` → `xhigh` Convergence Parity (`interaction-adapter.js`, `interactions-input.js`, `adapter.js`, `index.js`)**:
14
+ - Updated `assertInteractionOptions` and `buildInteractionRequest` to share model-scoped validation (`supportsXhighReasoning`), allowing `['low', 'medium', 'high', 'xhigh']` and narrowing `max` → `xhigh` for both `gemini-4-hydrogen*` and `gemini-4-neon*` across `adapter.stream`, `prepareCall().stream`, and `agent/request` hooks, while keeping Argon and Carbon strictly 3-level (`max` → `high`) and rejecting unsupported efforts before dispatch.
15
+
16
+ ### Changed
17
+ - **Settings UI, Locale & Documentation (`client.js`, `locale/zh.json`, `locale/en.json`, `README.md`, `AGENTS.md`, `docs/implementation/`)**:
18
+ - Bumped version to `2.2.0`, added `gemini-4-neon` keyword, and updated Chinese and English descriptions and setup instructions for the 8-model matrix and Hydrogen/Neon `XHigh` support.
19
+
20
+ ## [2.1.0] - 2026-11-15
21
+
22
+ ### Added
23
+ - **Gemini 4 Hydrogen Support Across Both Official Channels (`adapter.js`, `interaction-adapter.js`, `client.js`, `package.json`)**:
24
+ - Added `HYDROGEN_MODEL = 'gemini-4-hydrogen'` (Vertex AI) and `GOOGLE_API_HYDROGEN_MODEL = 'gemini-4-hydrogen-google'` (Gemini API) alongside Argon and Carbon via `officialUpstreamModel` and `detectPiAiArgonRoutes`, expanding the official matrix to 6 models with shared long-decode, service-tier validation, and cross-model tool-history downgrade protection.
25
+ - **Model-Scoped `xhigh` Reasoning Effort for Hydrogen (`adapter.js`, `interactions-input.js`, `diagnostics.js`, `diagnostic-store.js`, `client.js`)**:
26
+ - Added `HYDROGEN_LEVELS = ['low', 'medium', 'high', 'xhigh']`, `HYDROGEN_THINKING_MAP`, `levelsForModel()`, and `thinkingLevelMapFor()`: Hydrogen supports four reasoning levels (default `high`, mapping `max` → `xhigh` and stripping unsupported `cachedContent` / `cached_content` outbound fields), while Argon and Carbon remain strictly 3-level and reject `xhigh` before dispatch with `UNSUPPORTED_REASONING_EFFORT`.
27
+ - Expanded diagnostic enums and validators to preserve `XHIGH` instead of silently downgrading it to `MEDIUM`.
28
+
29
+ ### Fixed
30
+ - **DSH 0.2.2-rc.2+ Host Bundle Loader Compatibility (`test/host-internals.mjs`)**:
31
+ - Updated client bundle injection marker matching to tolerate `return module.exports` without a trailing semicolon.
32
+
5
33
  ## [2.0.0] - 2026-11-11
6
34
 
7
35
  ### Breaking Changes
package/README.md CHANGED
@@ -2,22 +2,22 @@
2
2
 
3
3
  ![Gemini 4 Adapter](<icon.svg>)
4
4
 
5
- **面向 [DeepSeek Harness](<https://github.com/deepseek-ai/deepseek-harness>) 的 Google 官方双通道(Vertex AI + Gemini Developer API)Gemini 4 适配器,原生支持 Argon 与 Carbon 四模型路由、GenerateContent / Interactions 双协议、65K+ 多跳长解码与请求级诊断。**
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.0.0`([CHANGELOG.md](<CHANGELOG.md>))
7
+ - **当前版本**:`2.2.0`([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
 
11
- [快速开始](<#快速开始>) · [双官方通道与四模型](<#双官方通道与四模型>) · [长解码与流式恢复](<#generatecontent长解码与四项韧性机制>) · [配置速查](<#完整配置13-项>) · [诊断与工具](<#gemini-4-诊断与-argon_inspect-工具>) · [长解码实测参考](<#历史实测参考奥德赛七号全年舰长日志>)
11
+ [快速开始](<#快速开始>) · [双官方通道与八模型](<#双官方通道与八模型>) · [长解码与流式恢复](<#generatecontent长解码与四项韧性机制>) · [配置速查](<#完整配置13-项>) · [诊断与工具](<#gemini-4-诊断与-argon_inspect-工具>) · [长解码实测参考](<#历史实测参考奥德赛七号全年舰长日志>)
12
12
 
13
13
  ---
14
14
 
15
15
  ## 核心特性
16
16
 
17
- - **双官方通道 × 四模型路由**:同时接入 Google Cloud **Vertex AI**(`gemini-4-argon` / `gemini-4-carbon`)与 **Gemini Developer API**(`gemini-4-argon-google` / `gemini-4-carbon-google`),两通道凭据与网关严格隔离,绝不暗中互借或静默回退。
17
+ - **双官方通道 × 八模型路由**:同时接入 Google Cloud **Vertex AI**(`gemini-4-argon` / `gemini-4-carbon` / `gemini-4-hydrogen` / `gemini-4-neon`)与 **Gemini Developer API**(`gemini-4-argon-google` / `gemini-4-carbon-google` / `gemini-4-hydrogen-google` / `gemini-4-neon-google`),两通道凭据与网关严格隔离,绝不暗中互借或静默回退。
18
18
  - **65K+ 多跳长解码与流自愈**:单跳上限 `65,536` tokens,最大输出预算可达 `1,048,576`(最多 32 跳);首个检查点前实时流式输出,支持检查点尾段回滚续传、逐跳四阶段超时看门狗、零交付首包重试、仅思考结束单次续答自愈,以及 `MALFORMED_FUNCTION_CALL` 后 `VALIDATED` → `AUTO` 工具模式自动退避。
19
19
  - **Interactions 协议与后台任务恢复**:支持前台流式及显式授权后的云端后台执行;内置 `creating` 预写防重计费锁、`last_event_id` 断点续读、`2026-05-20` 独立生命周期事件兼容,以及同会话新提示词触发的历史死锁非流式探针对账。
20
- - **签名保真与跨模型安全降级**:完整保留并回放 `thoughtSignature` / `thought_signature`(含无文本独立签名块);原生映射 `low` / `medium` / `high` 三档思考级别(宿主或子代理传入 `max` 时自动收敛为 `high`,永不下发 `thinkingBudget`);在 Argon ↔ Carbon 或跨通道切换时自动将旧工具历史安全降级为文本记录并清洗污染块。
20
+ - **签名保真与跨模型安全降级**:完整保留并回放 `thoughtSignature` / `thought_signature`(含无文本独立签名块);Argon / Carbon 原生映射 `low` / `medium` / `high` 三档(`max` 收敛为 `high`),Hydrogen / Neon 额外放行 `xhigh` 第四档(`max` 收敛为 `xhigh` 并剥离显式 `cachedContent` / `cached_content`,永不下发 `thinkingBudget`);在 Argon ↔ Carbon ↔ Hydrogen ↔ Neon 或跨通道切换时自动将旧工具历史安全降级为文本记录并清洗污染块。
21
21
  - **Gemini 4 诊断面板与只读工具**:在右侧栏、会话详情页与单条回复底部提供请求摘要、基础 Token 水位(严格区分首跳上下文水位与跨跳累计用量)、11 列逐跳轨迹、分页原始响应证据、云端 Interaction ID 只读查询与全局恢复锁管理,并向智能体提供延迟加载的只读工具 `argon_inspect`。
22
22
 
23
23
  ---
@@ -40,7 +40,7 @@ dsh plugin --profile desktop add dsh-vertex-argon
40
40
 
41
41
  ### 2. 声明模型入口
42
42
 
43
- 在 DSH「**设置 → 模型**」的原生 `Google` 或 `Google Vertex AI` 供应商下添加 `gemini-4-argon` 和/或 `gemini-4-carbon`,插件会自动识别并在模型选择器中暴露 **Gemini 4 Adapter** 分组下的对应模型。
43
+ 在 DSH「**设置 → 模型**」的原生 `Google` 或 `Google Vertex AI` 供应商下添加 `gemini-4-argon`、`gemini-4-carbon`、`gemini-4-hydrogen` 和/或 `gemini-4-neon`,插件会自动识别并在模型选择器中暴露 **Gemini 4 Adapter** 分组下的对应模型。
44
44
 
45
45
  ### 3. 配置官方凭据
46
46
 
@@ -52,7 +52,7 @@ dsh plugin --profile desktop add dsh-vertex-argon
52
52
 
53
53
  ---
54
54
 
55
- ## 双官方通道与四模型
55
+ ## 双官方通道与八模型
56
56
 
57
57
  底层 Provider ID 为 `google-vertex-argon`,模型选择器分组显示为 **Gemini 4 Adapter**(实现见 [adapter.js](<adapter.js>) 与 [google-connection.js](<google-connection.js>))。
58
58
 
@@ -60,13 +60,17 @@ dsh plugin --profile desktop add dsh-vertex-argon
60
60
  |---|---|---|---|---|
61
61
  | **Vertex AI** | `gemini-4-argon` | `gemini-4-argon` | `google-vertex` | `vertexProtocol` / `vertexServiceTier` |
62
62
  | **Vertex AI** | `gemini-4-carbon` | `gemini-4-carbon` | `google-vertex` | `vertexProtocol` / `vertexServiceTier` |
63
+ | **Vertex AI** | `gemini-4-hydrogen` | `gemini-4-hydrogen` | `google-vertex` | `vertexProtocol` / `vertexServiceTier` |
64
+ | **Vertex AI** | `gemini-4-neon` | `gemini-4-neon` | `google-vertex` | `vertexProtocol` / `vertexServiceTier` |
63
65
  | **Gemini API** | `gemini-4-argon-google` | `gemini-4-argon` | `google-generative-ai` | `googleProtocol` / `googleServiceTier` |
64
66
  | **Gemini API** | `gemini-4-carbon-google` | `gemini-4-carbon` | `google-generative-ai` | `googleProtocol` / `googleServiceTier` |
67
+ | **Gemini API** | `gemini-4-hydrogen-google` | `gemini-4-hydrogen` | `google-generative-ai` | `googleProtocol` / `googleServiceTier` |
68
+ | **Gemini API** | `gemini-4-neon-google` | `gemini-4-neon` | `google-generative-ai` | `googleProtocol` / `googleServiceTier` |
65
69
 
66
70
  ### 跨模型切换与历史清洗规则
67
71
 
68
72
  - **同模型连续对话**:完整保留原生 `thoughtSignature` / `thought_signature` 与 `functionCall` / `functionResponse` 签名回放。
69
- - **跨模型或跨通道切换(如 Argon ↔ Carbon、Vertex ↔ Gemini API)**:出站前自动将含推理或工具调用的旧回合降级为纯文本记录(剔除旧思考块,将已完成工具调用转为角色安全的文本摘要,未完成调用直接拦截),避免因底层摘除跨模型签名而发出裸 `functionCall` 或孤立 `functionResponse`。
73
+ - **跨模型或跨通道切换(如 Argon ↔ Carbon ↔ Hydrogen ↔ Neon、Vertex ↔ Gemini API)**:出站前自动将含推理或工具调用的旧回合降级为纯文本记录(剔除旧思考块,将已完成工具调用转为角色安全的文本摘要,未完成调用直接拦截),避免因底层摘除跨模型签名而发出裸 `functionCall` 或孤立 `functionResponse`。
70
74
  - **原生入口兼容保护**:插件同时为宿主原生 `google` 与 `google-vertex` 适配器中的 Gemini 4 模型注入 GenerateContent 思考档位映射、采样参数剥离与签名回放保护。
71
75
 
72
76
  ---
@@ -89,7 +93,7 @@ dsh plugin --profile desktop add dsh-vertex-argon
89
93
  | 分组 | 配置项 | 默认值 | 取值范围与说明 |
90
94
  |---|---|---|---|
91
95
  | 基础与生成 | `showInModelPicker` | `true` | 是否在会话模型选择器中显示 **Gemini 4 Adapter** 分组 |
92
- | 基础与生成 | `reasoning` | `medium` | 默认思考档位:`low` / `medium` / `high` |
96
+ | 基础与生成 | `reasoning` | `medium` | 默认思考档位:`low` / `medium` / `high`(Hydrogen 与 Neon 会话内额外支持 `xhigh`) |
93
97
  | 基础与生成 | `maxTokens` | `65536` | `1`–`1048576`;超过 `65,536` 需启用长解码(窗口 > 131K 时自动预留 131,072 历史空间) |
94
98
  | 基础与生成 | `contextWindow` | `1048576` | `1`–`1048576`;供 DSH 本地预算与上下文压缩计算使用 |
95
99
  | 基础与生成 | `longDecode` | `true` | 控制 > 65,536 输出上限、GenerateContent 检查点续传与仅思考自愈 |
package/adapter.js CHANGED
@@ -25,29 +25,74 @@ export const MODEL = 'gemini-4-argon'
25
25
  export const GOOGLE_API_MODEL = 'gemini-4-argon-google'
26
26
  export const CARBON_MODEL = 'gemini-4-carbon'
27
27
  export const GOOGLE_API_CARBON_MODEL = 'gemini-4-carbon-google'
28
- /** Gemini API 官方直连模型判定(Argon 与 Carbon)。 */
28
+ export const HYDROGEN_MODEL = 'gemini-4-hydrogen'
29
+ export const GOOGLE_API_HYDROGEN_MODEL = 'gemini-4-hydrogen-google'
30
+ export const NEON_MODEL = 'gemini-4-neon'
31
+ export const GOOGLE_API_NEON_MODEL = 'gemini-4-neon-google'
32
+ /** Gemini API 官方直连模型判定(Argon、Carbon、Hydrogen 与 Neon)。 */
29
33
  export function isGoogleApiModel(modelId) {
30
- return modelId === GOOGLE_API_MODEL || modelId === GOOGLE_API_CARBON_MODEL
34
+ return (
35
+ modelId === GOOGLE_API_MODEL ||
36
+ modelId === GOOGLE_API_CARBON_MODEL ||
37
+ modelId === GOOGLE_API_HYDROGEN_MODEL ||
38
+ modelId === GOOGLE_API_NEON_MODEL
39
+ )
31
40
  }
32
41
  /** 官方直连(Vertex AI / Gemini API)对应的上游模型 ID。 */
33
42
  export function officialUpstreamModel(modelId) {
43
+ if (modelId === NEON_MODEL || modelId === GOOGLE_API_NEON_MODEL) return NEON_MODEL
44
+ if (modelId === HYDROGEN_MODEL || modelId === GOOGLE_API_HYDROGEN_MODEL) return HYDROGEN_MODEL
34
45
  return modelId === CARBON_MODEL || modelId === GOOGLE_API_CARBON_MODEL ? CARBON_MODEL : MODEL
35
46
  }
36
47
  export const LEVELS = ['low', 'medium', 'high']
48
+ /**
49
+ * Gemini 4 Hydrogen 与 Neon 支持的第四档 xhigh(官方默认 high)。
50
+ * Argon / Carbon 的允许集合必须严格维持三档,绝不泄漏 xhigh。
51
+ */
52
+ export const HYDROGEN_LEVELS = ['low', 'medium', 'high', 'xhigh']
37
53
  export const MAX_SINGLE_CALL_TOKENS = 65536
38
54
  export const MAX_LONG_DECODE_TOKENS = 1048576
39
55
  const COMPACTION_HEADROOM_FLOOR = 131072
40
56
  const ENV_KEYS = ['GOOGLE_APPLICATION_CREDENTIALS', 'GOOGLE_CLOUD_PROJECT', 'GCLOUD_PROJECT', 'GOOGLE_CLOUD_LOCATION', 'GOOGLE_CLOUD_API_KEY']
41
57
  const DEFAULT_THINKING_MAP = { off: null, minimal: null, low: 'low', medium: 'medium', high: 'high', xhigh: null, max: null }
58
+ /** Hydrogen 与 Neon 的档位映射:把 xhigh 放行到 thinkingConfig。 */
59
+ const HYDROGEN_THINKING_MAP = { off: null, minimal: null, low: 'low', medium: 'medium', high: 'high', xhigh: 'xhigh', max: null }
60
+
61
+ /** Hydrogen 模型 ID 判定:同时识别 `gemini-4-hydrogen` 与 `gemini-4-hydrogen-google`(可带 models/ 前缀)。 */
62
+ export function isHydrogenModel(modelId) {
63
+ return typeof modelId === 'string' && /^(?:models\/)?gemini-4-hydrogen(?:-google)?$/i.test(modelId)
64
+ }
65
+
66
+ /** Neon 模型 ID 判定:同时识别 `gemini-4-neon` 与 `gemini-4-neon-google`(可带 models/ 前缀)。 */
67
+ export function isNeonModel(modelId) {
68
+ return typeof modelId === 'string' && /^(?:models\/)?gemini-4-neon(?:-google)?$/i.test(modelId)
69
+ }
70
+
71
+ /** 判断模型是否支持 xhigh 第四档思考及对应无显式缓存限制(Hydrogen 与 Neon)。 */
72
+ export function supportsXhighReasoning(modelId) {
73
+ return isHydrogenModel(modelId) || isNeonModel(modelId)
74
+ }
75
+
76
+ /** 模型对应的合法思考档位集合:Hydrogen 与 Neon 放行 xhigh。 */
77
+ export function levelsForModel(modelId) {
78
+ return supportsXhighReasoning(modelId) ? HYDROGEN_LEVELS : LEVELS
79
+ }
80
+
81
+ /** 模型对应的档位映射表:Hydrogen 与 Neon 放行 xhigh,其余模型仍为 null。 */
82
+ export function thinkingLevelMapFor(modelId) {
83
+ return supportsXhighReasoning(modelId) ? HYDROGEN_THINKING_MAP : DEFAULT_THINKING_MAP
84
+ }
42
85
 
43
86
  // The host's agent/request hook already narrows 'max' to 'high'. Direct adapter
44
87
  // callers (advisor tools calling adapter.stream / prepareCall().stream) bypass
45
88
  // that hook, so the same narrowing has to happen at this boundary too.
46
- export function narrowMaxReasoning(options) {
89
+ export function narrowMaxReasoning(options, modelId = options?.model) {
47
90
  if (!options || typeof options !== 'object') return options
48
91
  const requested = [options.reasoning, options.reasoningEffort]
49
92
  if (!requested.some(value => typeof value === 'string' && value.toLowerCase() === 'max')) return options
50
- return { ...options, reasoning: 'high', reasoningEffort: 'high' }
93
+ // Hydrogen 与 Neon 的最高档是 xhigh;其余模型仍是 high。
94
+ const ceiling = supportsXhighReasoning(modelId) ? 'xhigh' : 'high'
95
+ return { ...options, reasoning: ceiling, reasoningEffort: ceiling }
51
96
  }
52
97
 
53
98
  const readVal = v => (v && typeof v === 'object' && typeof v.get === 'function') ? v.get() : v
@@ -70,6 +115,10 @@ export function detectPiAiArgonRoutes(ctx, explicitRoutes) {
70
115
  if (explicitRoutes && typeof explicitRoutes === 'object') {
71
116
  const hasVertexCarbon = Boolean(explicitRoutes.hasVertexCarbon)
72
117
  const hasGoogleCarbon = Boolean(explicitRoutes.hasGoogleCarbon)
118
+ const hasVertexHydrogen = Boolean(explicitRoutes.hasVertexHydrogen)
119
+ const hasGoogleHydrogen = Boolean(explicitRoutes.hasGoogleHydrogen)
120
+ const hasVertexNeon = Boolean(explicitRoutes.hasVertexNeon)
121
+ const hasGoogleNeon = Boolean(explicitRoutes.hasGoogleNeon)
73
122
  const hasVertexArgon = explicitRoutes.hasVertexArgon !== undefined
74
123
  ? Boolean(explicitRoutes.hasVertexArgon)
75
124
  : explicitRoutes.hasVertex !== false
@@ -77,12 +126,16 @@ export function detectPiAiArgonRoutes(ctx, explicitRoutes) {
77
126
  ? Boolean(explicitRoutes.hasGoogleArgon)
78
127
  : Boolean(explicitRoutes.hasGoogle)
79
128
  return {
80
- hasVertex: hasVertexArgon || hasVertexCarbon,
81
- hasGoogle: hasGoogleArgon || hasGoogleCarbon,
129
+ hasVertex: hasVertexArgon || hasVertexCarbon || hasVertexHydrogen || hasVertexNeon,
130
+ hasGoogle: hasGoogleArgon || hasGoogleCarbon || hasGoogleHydrogen || hasGoogleNeon,
82
131
  hasVertexArgon,
83
132
  hasGoogleArgon,
84
133
  hasVertexCarbon,
85
134
  hasGoogleCarbon,
135
+ hasVertexHydrogen,
136
+ hasGoogleHydrogen,
137
+ hasVertexNeon,
138
+ hasGoogleNeon,
86
139
  googleApiKeyEnv: googleKeyEnvironment(explicitRoutes.googleApiKeyEnv),
87
140
  googleBaseUrl: explicitRoutes.googleBaseUrl,
88
141
  vertexBaseUrl: explicitRoutes.vertexBaseUrl,
@@ -102,15 +155,23 @@ export function detectPiAiArgonRoutes(ctx, explicitRoutes) {
102
155
  const hasVertexArgon = hasModel(vertexModels, /^(?:models\/)?gemini-4-argon\b/i)
103
156
  const hasGoogleCarbon = hasModel(googleModels, /^(?:models\/)?gemini-4-carbon\b/i)
104
157
  const hasVertexCarbon = hasModel(vertexModels, /^(?:models\/)?gemini-4-carbon\b/i)
105
- const hasGoogle = hasGoogleArgon || hasGoogleCarbon
106
- const hasVertex = hasVertexArgon || hasVertexCarbon || !hasGoogle
158
+ const hasGoogleHydrogen = hasModel(googleModels, /^(?:models\/)?gemini-4-hydrogen\b/i)
159
+ const hasVertexHydrogen = hasModel(vertexModels, /^(?:models\/)?gemini-4-hydrogen\b/i)
160
+ const hasGoogleNeon = hasModel(googleModels, /^(?:models\/)?gemini-4-neon\b/i)
161
+ const hasVertexNeon = hasModel(vertexModels, /^(?:models\/)?gemini-4-neon\b/i)
162
+ const hasGoogle = hasGoogleArgon || hasGoogleCarbon || hasGoogleHydrogen || hasGoogleNeon
163
+ const hasVertex = hasVertexArgon || hasVertexCarbon || hasVertexHydrogen || hasVertexNeon || !hasGoogle
107
164
  return {
108
165
  hasVertex,
109
166
  hasGoogle,
110
- hasVertexArgon: hasVertexArgon || (!hasGoogle && !hasVertexCarbon),
167
+ hasVertexArgon: hasVertexArgon || (!hasGoogle && !hasVertexCarbon && !hasVertexHydrogen && !hasVertexNeon),
111
168
  hasGoogleArgon,
112
169
  hasVertexCarbon,
113
170
  hasGoogleCarbon,
171
+ hasVertexHydrogen,
172
+ hasGoogleHydrogen,
173
+ hasVertexNeon,
174
+ hasGoogleNeon,
114
175
  googleApiKeyEnv: googleKeyEnvironment(readVal(googleCfg?.apiKeyEnv)),
115
176
  googleBaseUrl: readVal(googleCfg?.baseURL),
116
177
  vertexBaseUrl: readVal(vertexCfg?.baseURL),
@@ -124,6 +185,10 @@ export function detectPiAiArgonRoutes(ctx, explicitRoutes) {
124
185
  hasGoogleArgon: false,
125
186
  hasVertexCarbon: false,
126
187
  hasGoogleCarbon: false,
188
+ hasVertexHydrogen: false,
189
+ hasGoogleHydrogen: false,
190
+ hasVertexNeon: false,
191
+ hasGoogleNeon: false,
127
192
  googleApiKeyEnv: 'GOOGLE_API_KEY',
128
193
  }
129
194
  }
@@ -266,11 +331,23 @@ export function gemini4StreamSimple(
266
331
  assertPreparedStructuredOutput(structuredOutput)
267
332
  ensureGemini4ApiClientPatch()
268
333
  const fallback = defaultLevel ?? (/cyber-permissive/i.test(requestModel?.id ?? '') ? 'high' : 'medium')
334
+ const modelId = requestModel?.id
335
+ const supportsXhigh = supportsXhighReasoning(modelId)
269
336
  const requestedLevel = options.reasoning ?? fallback
270
- const rawLevel = typeof requestedLevel === 'string' && requestedLevel.toLowerCase() === 'max' ? 'high' : requestedLevel
337
+ // max 按目标模型收敛:Hydrogen 与 Neon 收到四档最高档 xhigh,Argon / Carbon 仍是 high。
338
+ const rawLevel = typeof requestedLevel === 'string' && requestedLevel.toLowerCase() === 'max'
339
+ ? (supportsXhigh ? 'xhigh' : 'high')
340
+ : (typeof requestedLevel === 'string' ? requestedLevel.toLowerCase() : requestedLevel)
271
341
  const mapped = requestModel?.thinkingLevelMap?.[rawLevel] ?? rawLevel
272
342
  const level = typeof mapped === 'string' ? mapped.toLowerCase() : fallback
273
- if (!LEVELS.includes(level)) throw new LlmError('Gemini 4 (Argon / Carbon) requires low, medium or high.', 'UNSUPPORTED_REASONING_EFFORT')
343
+ if (!levelsForModel(modelId).includes(level)) {
344
+ throw new LlmError(
345
+ supportsXhigh
346
+ ? 'Gemini 4 (Hydrogen / Neon) requires low, medium, high or xhigh.'
347
+ : 'Gemini 4 (Argon / Carbon) requires low, medium or high.',
348
+ 'UNSUPPORTED_REASONING_EFFORT',
349
+ )
350
+ }
274
351
  const { reasoning, thinking, thinkingBudgets, temperature, onPayload: prior, onProviderStreamEvent: priorEvent, ...rest } = options
275
352
  const requestedMaxTokens = options.maxTokens ?? requestModel.maxTokens
276
353
  const effectiveMaxTokens =
@@ -309,7 +386,16 @@ export function gemini4StreamSimple(
309
386
  }
310
387
  body = signatures.restorePayload(body)
311
388
  if (structuredOutput) body = structuredOutput.generateContent(body)
389
+ // Gemini 4 Hydrogen / Neon 官方不支持显式缓存(cachedContents),残留字段会被上游拒绝。
390
+ if (supportsXhigh) {
391
+ delete body.cachedContent
392
+ delete body.cached_content
393
+ }
312
394
  const { temperature: _t, topP: _tp, topK: _tk, candidateCount: _cc, frequencyPenalty: _fp, presencePenalty: _pp, ...cleanConfig } = body.config
395
+ if (supportsXhigh) {
396
+ delete cleanConfig.cachedContent
397
+ delete cleanConfig.cached_content
398
+ }
313
399
  const prevHttpOptions =
314
400
  cleanConfig.httpOptions && typeof cleanConfig.httpOptions === 'object' && !Array.isArray(cleanConfig.httpOptions)
315
401
  ? cleanConfig.httpOptions
@@ -360,7 +446,7 @@ export function installGemini4PiAiPatch(recordDiagnostic, configInput = {}, resp
360
446
  for (const m of piProvider.getModels()) {
361
447
  if (isGemini4Model(m) && !m.reasoning) {
362
448
  m.reasoning = true
363
- m.thinkingLevelMap = { ...DEFAULT_THINKING_MAP }
449
+ m.thinkingLevelMap = { ...thinkingLevelMapFor(m.id) }
364
450
  }
365
451
  }
366
452
  } catch {}
@@ -538,9 +624,9 @@ export class ArgonAdapter extends LlmAdapter {
538
624
  if (provider === PROVIDER && cfg) resolveServicePolicy(cfg, googleApi ? 'google-generative-ai' : 'google-vertex', protocol)
539
625
  const prepared = await this.inner.prepareCall(provider, model, signal)
540
626
  if (provider === PROVIDER && protocol === 'interactions' && this.interactionHandler) {
541
- return { model: prepared.model, stream: options => this.interactionHandler(narrowMaxReasoning(options), cfg) }
627
+ return { model: prepared.model, stream: options => this.interactionHandler(narrowMaxReasoning(options && typeof options === 'object' && !options.model ? { ...options, model } : options, model), cfg) }
542
628
  }
543
- return { ...prepared, stream: options => prepared.stream(generateContentHistory(narrowMaxReasoning(options), model)) }
629
+ return { ...prepared, stream: options => prepared.stream(generateContentHistory(narrowMaxReasoning(options, model), model)) }
544
630
  }
545
631
  async *stream(options) {
546
632
  const prepared = await this.prepareCall(options.provider, options.model, options.signal)
@@ -606,6 +692,10 @@ export function createArgonAdapter(ctx, configInput, nativeVertex = googleVertex
606
692
  ga: detected.hasGoogleArgon,
607
693
  vc: detected.hasVertexCarbon,
608
694
  gc: detected.hasGoogleCarbon,
695
+ vh: detected.hasVertexHydrogen,
696
+ gh: detected.hasGoogleHydrogen,
697
+ vn: detected.hasVertexNeon,
698
+ gn: detected.hasGoogleNeon,
609
699
  ge: detected.googleApiKeyEnv,
610
700
  gb: detected.googleBaseUrl,
611
701
  vb: detected.vertexBaseUrl,
@@ -667,6 +757,36 @@ export function createArgonAdapter(ctx, configInput, nativeVertex = googleVertex
667
757
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
668
758
  })
669
759
  }
760
+ if (detected.hasVertexHydrogen) {
761
+ models.push({
762
+ id: HYDROGEN_MODEL,
763
+ name: detected.hasGoogle ? 'Gemini 4 Hydrogen (Vertex AI)' : 'Gemini 4 Hydrogen',
764
+ provider: PROVIDER,
765
+ api: 'google-vertex',
766
+ baseUrl: detected.vertexBaseUrl || 'https://{location}-aiplatform.googleapis.com',
767
+ reasoning: true,
768
+ input: ['text', 'image'],
769
+ contextWindow: cfg.contextWindow,
770
+ maxTokens: cfg.maxTokens,
771
+ thinkingLevelMap: { ...HYDROGEN_THINKING_MAP },
772
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
773
+ })
774
+ }
775
+ if (detected.hasVertexNeon) {
776
+ models.push({
777
+ id: NEON_MODEL,
778
+ name: detected.hasGoogle ? 'Gemini 4 Neon (Vertex AI)' : 'Gemini 4 Neon',
779
+ provider: PROVIDER,
780
+ api: 'google-vertex',
781
+ baseUrl: detected.vertexBaseUrl || 'https://{location}-aiplatform.googleapis.com',
782
+ reasoning: true,
783
+ input: ['text', 'image'],
784
+ contextWindow: cfg.contextWindow,
785
+ maxTokens: cfg.maxTokens,
786
+ thinkingLevelMap: { ...HYDROGEN_THINKING_MAP },
787
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
788
+ })
789
+ }
670
790
  if (detected.hasGoogleArgon ?? detected.hasGoogle) {
671
791
  models.push({
672
792
  id: GOOGLE_API_MODEL,
@@ -697,6 +817,36 @@ export function createArgonAdapter(ctx, configInput, nativeVertex = googleVertex
697
817
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
698
818
  })
699
819
  }
820
+ if (detected.hasGoogleHydrogen) {
821
+ models.push({
822
+ id: GOOGLE_API_HYDROGEN_MODEL,
823
+ name: 'Gemini 4 Hydrogen (Gemini API)',
824
+ provider: PROVIDER,
825
+ api: 'google-generative-ai',
826
+ baseUrl: detected.googleBaseUrl || 'https://generativelanguage.googleapis.com/v1beta',
827
+ reasoning: true,
828
+ input: ['text', 'image'],
829
+ contextWindow: cfg.contextWindow,
830
+ maxTokens: cfg.maxTokens,
831
+ thinkingLevelMap: { ...HYDROGEN_THINKING_MAP },
832
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
833
+ })
834
+ }
835
+ if (detected.hasGoogleNeon) {
836
+ models.push({
837
+ id: GOOGLE_API_NEON_MODEL,
838
+ name: 'Gemini 4 Neon (Gemini API)',
839
+ provider: PROVIDER,
840
+ api: 'google-generative-ai',
841
+ baseUrl: detected.googleBaseUrl || 'https://generativelanguage.googleapis.com/v1beta',
842
+ reasoning: true,
843
+ input: ['text', 'image'],
844
+ contextWindow: cfg.contextWindow,
845
+ maxTokens: cfg.maxTokens,
846
+ thinkingLevelMap: { ...HYDROGEN_THINKING_MAP },
847
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
848
+ })
849
+ }
700
850
  const configuredMaxTokens = new Map(models.map(m => [m.id, cfg.maxTokens]))
701
851
  const provider = argonProvider({ ...nativeVertex, auth }, models, cfg.reasoning, nativeGoogle, cfg.longDecode, recordDiagnostic, cfg, responseHub, structuredOutput)
702
852
  cachedKey = key
@@ -709,6 +859,8 @@ export function createArgonAdapter(ctx, configInput, nativeVertex = googleVertex
709
859
  maxRequestImageBytes: 20 * 1024 * 1024,
710
860
  requestImagePixelBudget: 2048 * 2048,
711
861
  requestImageMaxBytes: 1024 * 1024,
862
+ maxRequestImages: 50,
863
+ imageOffloadCountQuantum: 10,
712
864
  retryPolicy: resolveRetryPolicy(undefined, 'local-vertex-argon'),
713
865
  modelErrors: new Map(),
714
866
  configuredMaxTokens,
package/client.js CHANGED
@@ -153,7 +153,7 @@ window.__ModuleLoader__.load({
153
153
  const dictionaries = {
154
154
  zh: {
155
155
  title: 'Gemini 4 Adapter',
156
- subtitle: '聚合 Gemini API 与 Vertex AI 官方双通道(Argon / Carbon)· 原生三档思考、独立协议与韧性长解码',
156
+ subtitle: '聚合 Gemini API 与 Vertex AI 官方双通道(Argon / Carbon / Hydrogen / Neon)· 原生思考档位、独立协议与韧性长解码',
157
157
  summaryLabel: '当前配置摘要',
158
158
  summaryLongDecode: '长解码',
159
159
  summaryEffectiveCap: '静态有效预算上限',
@@ -164,7 +164,7 @@ window.__ModuleLoader__.load({
164
164
  visible: '已显示',
165
165
  hidden: '已隐藏',
166
166
  reasoningLabel: '默认思考档位(Thinking Level)',
167
- reasoningHint: '固定 Low / Medium(默认) / High 三档,按所选协议映射原生思考级别与思考摘要,永不发送 thinkingBudget。',
167
+ reasoningHint: '通道默认支持 Low / Medium(默认) / High 三档;Gemini 4 Hydrogen 与 Neon 会话内额外支持 XHigh 第四档。按所选协议映射原生思考级别与思考摘要,永不发送 thinkingBudget。',
168
168
  level_low: 'Low(低)',
169
169
  level_medium: 'Medium(默认)',
170
170
  level_high: 'High(高)',
@@ -199,12 +199,12 @@ window.__ModuleLoader__.load({
199
199
  advTitle: '5. 能力边界、自动兼容与接入说明',
200
200
  capabilities: '实测边界:两通道 GenerateContent 均有真实生成记录,两通道 Interactions 短调用与本地工具往返已实测;Gemini Interactions 后台已测至 63,303 tokens 与单次 POST 冷恢复入口;严格跨 65,536 真实输出尚未观测,Vertex Interactions > 65,536 保持门控。',
201
201
  how: '自动检测与凭据复用',
202
- step1: '在 DSH「设置 → 模型」的 Google 或 Google Vertex AI 中添加 gemini-4-argon / gemini-4-carbon 后,本分组自动出现对应双通道入口。',
202
+ step1: '在 DSH「设置 → 模型」的 Google 或 Google Vertex AI 中添加 gemini-4-argon / gemini-4-carbon / gemini-4-hydrogen / gemini-4-neon 后,本分组自动出现对应双通道入口。',
203
203
  step2: 'Vertex AI 读取 GOOGLE_APPLICATION_CREDENTIALS / GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_LOCATION;Gemini API 复用已配置的 GOOGLE_API_KEY。',
204
204
  step3: '插件同时为原生 google 与 google-vertex 入口注入 GenerateContent 兼容保护(原生思考档位映射、剥离采样参数与签名回传);Interactions 后台冷恢复与单次 POST 防重锁属于本插件对应的 Interactions 协议通道。',
205
205
  scope: '路由标识',
206
206
  detail: 'GenerateContent 检查点重连、工具签名回放与 Interactions 未知远端状态防重锁均为各自协议的内置自动机制;若遇云端终止未确认或未知中断,请结合下方诊断记录人工核查。',
207
- route: '提供方路由:google-vertex-argon · 模型 ID:gemini-4-argon / gemini-4-carbon (Vertex AI) · gemini-4-argon-google / gemini-4-carbon-google (Gemini API)',
207
+ route: '提供方路由:google-vertex-argon · 模型 ID:gemini-4-argon / gemini-4-carbon / gemini-4-hydrogen / gemini-4-neon (Vertex AI) · gemini-4-argon-google / gemini-4-carbon-google / gemini-4-hydrogen-google / gemini-4-neon-google (Gemini API)',
208
208
  recoveryTitle: '后台任务恢复',
209
209
  recoveryHint: '最近 20 条脱敏状态,未解除记录优先。这里只解除本地防重拦截,不取消云端任务,也不自动重发。',
210
210
  recoveryRefresh: '刷新恢复状态',
@@ -238,7 +238,7 @@ window.__ModuleLoader__.load({
238
238
  },
239
239
  en: {
240
240
  title: 'Gemini 4 Adapter',
241
- subtitle: 'Official Gemini API & Vertex AI dual-route integration (Argon & Carbon) · native thinking levels, independent protocols & resilient long decode',
241
+ subtitle: 'Official Gemini API & Vertex AI dual-route integration (Argon, Carbon, Hydrogen & Neon) · native thinking levels, independent protocols & resilient long decode',
242
242
  summaryLabel: 'Current configuration',
243
243
  summaryLongDecode: 'Long Decode',
244
244
  summaryEffectiveCap: 'Static effective cap',
@@ -249,7 +249,7 @@ window.__ModuleLoader__.load({
249
249
  visible: 'Visible',
250
250
  hidden: 'Hidden',
251
251
  reasoningLabel: 'Default Thinking Level',
252
- reasoningHint: 'Supports Low, Medium (default), and High, mapped to each protocol\'s native thinking level and summary output without sending thinkingBudget.',
252
+ reasoningHint: 'The channel defaults to Low, Medium (default), and High; Gemini 4 Hydrogen and Neon additionally accept XHigh in-session. Mapped to each protocol\'s native thinking level and summary output without sending thinkingBudget.',
253
253
  level_low: 'Low',
254
254
  level_medium: 'Medium (Default)',
255
255
  level_high: 'High',
@@ -284,12 +284,12 @@ window.__ModuleLoader__.load({
284
284
  advTitle: '5. Capabilities, Verification & Setup Guide',
285
285
  capabilities: 'Verification boundaries: both routes have live-verified GenerateContent generation records, and both routes have live-verified Interactions short calls and local tool round-trips. Gemini Interactions background is verified up to 63,303 tokens with single-POST cold resume entry; strict > 65,536 live output is not yet observed, and Vertex Interactions > 65,536 remains gated.',
286
286
  how: 'Auto-detection & credential reuse',
287
- step1: 'Add gemini-4-argon or gemini-4-carbon under Google or Google Vertex AI in Models settings to expose both routes automatically.',
287
+ step1: 'Add gemini-4-argon, gemini-4-carbon, gemini-4-hydrogen, or gemini-4-neon under Google or Google Vertex AI in Models settings to expose both routes automatically.',
288
288
  step2: 'Vertex AI reads GOOGLE_APPLICATION_CREDENTIALS / GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_LOCATION; Gemini API reuses your configured GOOGLE_API_KEY.',
289
289
  step3: 'Native google and google-vertex entries receive GenerateContent compatibility protection (native thinkingLevel mapping, sampling parameter stripping, and thoughtSignature replay); Interactions background cold resume and single-POST dedup locks belong to this plugin\'s Interactions protocol route.',
290
290
  scope: 'Route identifiers',
291
291
  detail: 'GenerateContent checkpoint reconnect, tool signature replay, and Interactions unknown-remote-state dedup locks run automatically within their respective protocols; if remote termination is unconfirmed or interrupted in an unknown state, inspect the diagnostics panel below.',
292
- route: 'Provider route: google-vertex-argon · Models: gemini-4-argon / gemini-4-carbon (Vertex AI) · gemini-4-argon-google / gemini-4-carbon-google (Gemini API)',
292
+ route: 'Provider route: google-vertex-argon · Models: gemini-4-argon / gemini-4-carbon / gemini-4-hydrogen / gemini-4-neon (Vertex AI) · gemini-4-argon-google / gemini-4-carbon-google / gemini-4-hydrogen-google / gemini-4-neon-google (Gemini API)',
293
293
  recoveryTitle: 'Background Task Recovery',
294
294
  recoveryHint: 'Latest 20 redacted states, unreleased records first. This only releases the local duplicate-send block; it never cancels a cloud task or automatically resends a request.',
295
295
  recoveryRefresh: 'Refresh recovery status',
@@ -66,7 +66,7 @@ export const recordSchema = z.object({
66
66
  remoteCancellation: z.enum(['not-requested', 'confirmed', 'unconfirmed']).optional(),
67
67
  serviceTier: z.object({ requested: z.enum(['standard', 'flex', 'priority']), observed: z.enum(['standard', 'flex', 'priority', 'provisioned', 'mixed']).nullable(), source: z.enum(['response-header', 'traffic-type']).nullable() }).strict().optional(),
68
68
  apiVersion: z.enum(['v1', 'v1beta1', 'v1beta']),
69
- thinkingLevel: z.enum(['LOW', 'MEDIUM', 'HIGH']),
69
+ thinkingLevel: z.enum(['LOW', 'MEDIUM', 'HIGH', 'XHIGH']),
70
70
  longDecodeEnabled: z.boolean(),
71
71
  configuredMaxTokens: positiveInt.nullable(),
72
72
  hopCount: count,
package/diagnostics.js CHANGED
@@ -89,7 +89,7 @@ export function createArgonDiagnosticTracker(meta, record, captureOptions = {})
89
89
  remoteCancellation: 'not-requested',
90
90
  serviceTier: { requested: ['standard', 'flex', 'priority'].includes(meta?.requestedServiceTier) ? meta.requestedServiceTier : 'standard', observed: null, source: null },
91
91
  apiVersion: meta?.apiVersion === 'v1' ? 'v1' : 'v1beta1',
92
- thinkingLevel: ['LOW', 'MEDIUM', 'HIGH'].includes(meta?.thinkingLevel) ? meta.thinkingLevel : 'MEDIUM',
92
+ thinkingLevel: ['LOW', 'MEDIUM', 'HIGH', 'XHIGH'].includes(meta?.thinkingLevel) ? meta.thinkingLevel : 'MEDIUM',
93
93
  longDecodeEnabled: meta?.longDecode !== false,
94
94
  configuredMaxTokens: Number.isSafeInteger(meta?.maxTokens) && meta.maxTokens > 0 ? meta.maxTokens : null,
95
95
  hopCount: 0,
package/index.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  PROVIDER,
16
16
  NATIVE_PROVIDER,
17
17
  LEVELS,
18
+ supportsXhighReasoning,
18
19
  MAX_SINGLE_CALL_TOKENS,
19
20
  MAX_LONG_DECODE_TOKENS,
20
21
  } from './adapter.js'
@@ -136,7 +137,11 @@ export function apply(ctx, config) {
136
137
  /^(?:models\/)?gemini-4\b/i.test(proposed?.model ?? ''))) &&
137
138
  proposed.reasoningEffort === 'max'
138
139
  ) {
139
- return { ...proposed, reasoningEffort: 'high' }
140
+ // Hydrogen 与 Neon 的最高档是第四档 xhigh;其余 Gemini 4 模型仍是 high。
141
+ return {
142
+ ...proposed,
143
+ reasoningEffort: supportsXhighReasoning(proposed?.model) ? 'xhigh' : 'high',
144
+ }
140
145
  }
141
146
  return proposed
142
147
  })
@@ -5,15 +5,20 @@ import { createArgonDiagnosticTracker } from './diagnostics.js'
5
5
  import { interactionExitReason } from './interaction-lifecycle.js'
6
6
  import { resolveServicePolicy } from './service-level.js'
7
7
  // 循环导入:adapter.js 只在本模块的函数被调用时才读取这些绑定,函数声明本身已提升。
8
- import { isGoogleApiModel, officialUpstreamModel } from './adapter.js'
8
+ import { isGoogleApiModel, officialUpstreamModel, supportsXhighReasoning, levelsForModel } from './adapter.js'
9
9
 
10
10
  const terminalStates = new Set(['completed', 'requires_action', 'incomplete', 'failed', 'cancelled', 'budget_exceeded'])
11
11
  export function assertInteractionOptions(options, cfg, route) {
12
12
  const max = options.maxTokens ?? cfg.maxTokens
13
13
  if (!Number.isSafeInteger(max) || max <= 0 || max > cfg.maxTokens) throw new Error('Interactions output budget must be a positive integer within the configured effective cap.')
14
+ const xhighSupported = supportsXhighReasoning(options.model)
14
15
  const requestedLevel = options.reasoningEffort ?? cfg.reasoning
15
- const level = typeof requestedLevel === 'string' && requestedLevel.toLowerCase() === 'max' ? 'high' : requestedLevel
16
- if (!['low', 'medium', 'high'].includes(level)) throw new Error('Argon requires low, medium, or high thinking.')
16
+ const normalizedRequested = typeof requestedLevel === 'string' ? requestedLevel.toLowerCase() : requestedLevel
17
+ // max 按目标模型收敛:Hydrogen 与 Neon 收到四档最高档 xhigh,Argon / Carbon 仍是 high。
18
+ const level = normalizedRequested === 'max' ? (xhighSupported ? 'xhigh' : 'high') : normalizedRequested
19
+ if (!levelsForModel(options.model).includes(level)) {
20
+ throw new Error(xhighSupported ? 'Gemini 4 (Hydrogen / Neon) requires low, medium, high, or xhigh thinking.' : 'Argon requires low, medium, or high thinking.')
21
+ }
17
22
  if (cfg.interactionsBackground && !cfg.allowInteractionStorage) throw new Error('Background Interactions requires explicit cloud-storage consent in Gemini 4 Adapter settings.')
18
23
  if (max > 65536 && !cfg.interactionsBackground) throw new Error('Interactions above 65,536 tokens requires background execution; no request was sent.')
19
24
  if (route === 'google-vertex' && max > 65536) throw new Error('Vertex Interactions long decode is not verified; choose GenerateContent or explicitly lower the budget to 65,536.')
@@ -62,11 +62,16 @@ async function contentOf(blocks, settings, scrubText = false) {
62
62
  // forged function calls or fake thought signatures.
63
63
  export async function buildInteractionRequest(options, settings) {
64
64
  const max = options.maxTokens ?? settings.maxTokens ?? 65536
65
+ const interactionModel = String(settings.upstreamModel ?? options.model ?? '')
66
+ const supportsXhigh = /^(?:models\/)?gemini-4-(?:hydrogen|neon)(?:-google)?$/i.test(interactionModel)
65
67
  const requestedLevel = options.reasoningEffort ?? settings.reasoning ?? 'medium'
66
- const level = typeof requestedLevel === 'string' && requestedLevel.toLowerCase() === 'max' ? 'high' : requestedLevel
68
+ const normalizedRequested = typeof requestedLevel === 'string' ? requestedLevel.toLowerCase() : requestedLevel
69
+ // max 按目标模型收敛:Hydrogen 与 Neon 收到四档最高档 xhigh,Argon / Carbon 仍是 high。
70
+ const level = normalizedRequested === 'max' ? (supportsXhigh ? 'xhigh' : 'high') : normalizedRequested
67
71
  for (const flag of [settings.background, settings.store]) if (flag !== undefined && typeof flag !== 'boolean') throw new Error('Interactions background and storage consent must be booleans.')
68
72
  if (!Number.isSafeInteger(max) || max<1 || max>1048576) throw new Error('Invalid Interactions output token budget.')
69
- if (!['low','medium','high'].includes(level)) throw new Error('Argon requires low, medium, or high thinking.')
73
+ const allowedLevels = supportsXhigh ? ['low','medium','high','xhigh'] : ['low','medium','high']
74
+ if (!allowedLevels.includes(level)) throw new Error(supportsXhigh ? 'Gemini 4 (Hydrogen / Neon) requires low, medium, high, or xhigh thinking.' : 'Argon requires low, medium, or high thinking.')
70
75
  if (settings.background && !settings.store) throw new Error('Background Interactions requires explicit storage consent.')
71
76
  if (max>65536 && !settings.background) throw new Error('Interactions above 65,536 tokens requires background execution.')
72
77
  if (max>65536 && settings.route==='google-vertex') throw new Error('Vertex Interactions long decode is not verified; use GenerateContent.')
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Gemini 4 Adapter",
4
- "description": "Official Vertex AI and Gemini API Gemini 4 adapter for DSH (Argon and Carbon): resilient multi-hop long decode, explicit protocols and service tiers, background recovery, and request diagnostics."
4
+ "description": "Official Vertex AI and Gemini API Gemini 4 adapter for DSH (Argon, Carbon, Hydrogen and Neon): resilient multi-hop long decode, explicit protocols and service tiers, background recovery, and request diagnostics."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Gemini 4 Adapter",
4
- "description": "面向 DSH 的 Gemini 4 官方双通道适配器(Vertex AI 与 Gemini API,覆盖 Argon 与 Carbon 模型),支持 65K+ 多跳长解码、显式协议与服务层级、后台任务恢复及请求级诊断。"
4
+ "description": "面向 DSH 的 Gemini 4 官方双通道适配器(Vertex AI 与 Gemini API,覆盖 Argon、Carbon、Hydrogen 与 Neon 模型),支持 65K+ 多跳长解码、显式协议与服务层级、后台任务恢复及请求级诊断。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-vertex-argon",
3
- "version": "2.0.0",
4
- "description": "Gemini 4 Adapter for DSH: official Vertex AI & Gemini API channels (Argon & Carbon), resilient long decode, explicit service tiers, and request diagnostics.",
3
+ "version": "2.2.0",
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": {
7
7
  "type": "git",
@@ -63,6 +63,8 @@
63
63
  "gemini",
64
64
  "gemini-4-argon",
65
65
  "gemini-4-carbon",
66
+ "gemini-4-hydrogen",
67
+ "gemini-4-neon",
66
68
  "plugin"
67
69
  ],
68
70
  "dsh": {