@lay111/dsh-plugin-google 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
- package/src/api.js +47 -27
- package/src/models.js +33 -32
package/README.md
CHANGED
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
| 模型 ID | 模型名称 | 深度思考 (Thinking) | 特点与适用场景 |
|
|
42
42
|
| :--- | :--- | :---: | :--- |
|
|
43
43
|
| **`gemini-3.7-flash`** | **Gemini 3.7 Flash High** *(默认旗舰)* | **10,000 Budget 满血思考** | **日常主力推荐**。超强代码逻辑、系统级跨文件重构与复杂 Bug 诊断 |
|
|
44
|
-
| **`gemini-3.7-flash-
|
|
45
|
-
| **`gemini-3.
|
|
46
|
-
| **`gemini-3.5-flash`** | Gemini 3.5 Flash | 4,000 思考 | 经典 Flash 系列稳定模型 |
|
|
47
|
-
| **`gemini-3.1-pro`** | Gemini 3.1 Pro (Agent) | 8,000 思考 | 专为长上下文深度推演设计的 Pro 级模型 |
|
|
44
|
+
| **`gemini-3.7-flash-medium`** | Gemini 3.7 Flash Medium | 5,000 思考 | 均衡模式,兼顾思考深度与低延迟,配额更充裕 |
|
|
45
|
+
| **`gemini-3.7-flash-low`** | Gemini 3.7 Flash Low (Fast) | 1,000 思考 | 极速响应,适合单文件快速修改与小改动 |
|
|
48
46
|
| **`claude-sonnet-4.6`** | Claude Sonnet 4.6 (Thinking) | 深度思考 | 逻辑严密、遵循规范性极强的 Anthropic 顶尖编程模型 |
|
|
49
|
-
| **`
|
|
47
|
+
| **`gemini-3.1-pro`** | Gemini 3.1 Pro (High Reasoning) | 8,000 思考 | Pro 级旗舰深度推演大模型(100万超大上下文) |
|
|
48
|
+
| **`gemini-3.6-flash`** | Gemini 3.6 Flash High | 4,000 思考 | 经典速度极快的高性价比轻量模型 |
|
|
49
|
+
| **`gemini-3.5-flash`** | Gemini 3.5 Flash | 基础模式 | 经典 Flash 系列稳定模型 |
|
|
50
50
|
| **`gpt-oss-120b`** | GPT-OSS 120B (Medium) | 基础思考 | 开源生态 120B 大模型 |
|
|
51
51
|
|
|
52
52
|
---
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -68,23 +68,24 @@ export function formatMessagesToAntigravity(messages, modelSpec, projectId) {
|
|
|
68
68
|
contents.push({ role: 'user', parts: [{ text: 'Hello' }] });
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const isClaude = modelSpec.id.includes('claude');
|
|
71
|
+
const isClaude = modelSpec.id.includes('claude') || modelSpec.wireId.includes('claude');
|
|
72
72
|
const payload = {
|
|
73
73
|
project: projectId || 'aicode-consumers',
|
|
74
74
|
model: modelSpec.wireId,
|
|
75
75
|
requestId: `agent/dsh/${Date.now()}/traj_${Date.now()}/1`,
|
|
76
76
|
request: {
|
|
77
77
|
contents,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
generationConfig: {
|
|
79
|
+
maxOutputTokens: modelSpec.maxTokens || 8192,
|
|
80
|
+
...(modelSpec.supportsThinking
|
|
81
|
+
? {
|
|
81
82
|
thinkingConfig: {
|
|
82
83
|
includeThoughts: true,
|
|
83
84
|
thinkingBudget: modelSpec.thinkingBudget || 10000,
|
|
84
85
|
},
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
86
|
+
}
|
|
87
|
+
: {}),
|
|
88
|
+
},
|
|
88
89
|
...(systemInstruction ? { systemInstruction } : {}),
|
|
89
90
|
labels: {
|
|
90
91
|
trajectory_id: `traj_${Date.now()}`,
|
|
@@ -116,33 +117,52 @@ export async function* streamAntigravity(options, accessToken, projectId) {
|
|
|
116
117
|
|
|
117
118
|
let response = null;
|
|
118
119
|
let lastError = null;
|
|
120
|
+
const maxRetries = 3;
|
|
121
|
+
|
|
122
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
123
|
+
for (const endpoint of ANTIGRAVITY_ENDPOINTS) {
|
|
124
|
+
try {
|
|
125
|
+
const res = await fetch(endpoint, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
Authorization: `Bearer ${accessToken}`,
|
|
129
|
+
'Content-Type': 'application/json',
|
|
130
|
+
Accept: 'text/event-stream',
|
|
131
|
+
'User-Agent': USER_AGENT,
|
|
132
|
+
},
|
|
133
|
+
body: JSON.stringify(payload),
|
|
134
|
+
signal: options.signal,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (res.ok) {
|
|
138
|
+
response = res;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
119
141
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
method: 'POST',
|
|
124
|
-
headers: {
|
|
125
|
-
Authorization: `Bearer ${accessToken}`,
|
|
126
|
-
'Content-Type': 'application/json',
|
|
127
|
-
Accept: 'text/event-stream',
|
|
128
|
-
'User-Agent': USER_AGENT,
|
|
129
|
-
},
|
|
130
|
-
body: JSON.stringify(payload),
|
|
131
|
-
signal: options.signal,
|
|
132
|
-
});
|
|
142
|
+
const status = res.status;
|
|
143
|
+
const errText = await res.text();
|
|
144
|
+
lastError = `(HTTP ${status}) ${errText}`;
|
|
133
145
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
// If rate-limited (429) or temporary server overload (503), wait and retry
|
|
147
|
+
if ((status === 429 || status === 503) && attempt < maxRetries - 1) {
|
|
148
|
+
await new Promise((r) => setTimeout(r, (attempt + 1) * 1500));
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
} catch (err) {
|
|
152
|
+
lastError = err.message;
|
|
153
|
+
if (attempt < maxRetries - 1) {
|
|
154
|
+
await new Promise((r) => setTimeout(r, (attempt + 1) * 1000));
|
|
155
|
+
}
|
|
139
156
|
}
|
|
140
|
-
} catch (err) {
|
|
141
|
-
lastError = err.message;
|
|
142
157
|
}
|
|
158
|
+
|
|
159
|
+
if (response) break;
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
if (!response) {
|
|
163
|
+
if (lastError?.includes('429') || lastError?.includes('exhausted')) {
|
|
164
|
+
throw new Error(`Google Quota Exceeded (429): 当前模型并发或配额超限。建议在 TUI 中输入 /model 切换至 claude-sonnet-4.6、gemini-3.7-flash-medium 或 gemini-3.6-flash,或稍等 20 秒后重试。`);
|
|
165
|
+
}
|
|
146
166
|
throw new Error(`Google Antigravity Upstream Error: ${lastError}`);
|
|
147
167
|
}
|
|
148
168
|
|
package/src/models.js
CHANGED
|
@@ -10,61 +10,62 @@ export const ANTIGRAVITY_MODELS = [
|
|
|
10
10
|
description: 'Google flagship coding model with 10k thinking budget (Fast & Deep)',
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
id: 'gemini-3.7-flash-
|
|
14
|
-
name: 'Gemini 3.7 Flash
|
|
15
|
-
wireId: 'gemini-3.7-flash',
|
|
13
|
+
id: 'gemini-3.7-flash-medium',
|
|
14
|
+
name: 'Gemini 3.7 Flash Medium',
|
|
15
|
+
wireId: 'gemini-3.7-flash-medium',
|
|
16
16
|
contextWindow: 1048576,
|
|
17
17
|
maxTokens: 65536,
|
|
18
|
-
supportsThinking:
|
|
19
|
-
|
|
18
|
+
supportsThinking: true,
|
|
19
|
+
thinkingBudget: 5000,
|
|
20
|
+
description: 'Balanced latency and thinking depth',
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
|
-
id: 'gemini-3.
|
|
23
|
-
name: 'Gemini 3.
|
|
24
|
-
wireId: 'gemini-3.
|
|
23
|
+
id: 'gemini-3.7-flash-low',
|
|
24
|
+
name: 'Gemini 3.7 Flash Low (Fast)',
|
|
25
|
+
wireId: 'gemini-3.7-flash-low',
|
|
25
26
|
contextWindow: 1048576,
|
|
26
27
|
maxTokens: 65536,
|
|
27
28
|
supportsThinking: true,
|
|
28
|
-
thinkingBudget:
|
|
29
|
-
description: 'Fast lightweight
|
|
29
|
+
thinkingBudget: 1000,
|
|
30
|
+
description: 'Fast lightweight thinking mode for rapid iterations',
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
|
-
id: '
|
|
33
|
-
name: '
|
|
34
|
-
wireId: '
|
|
35
|
-
contextWindow:
|
|
36
|
-
maxTokens:
|
|
33
|
+
id: 'claude-sonnet-4.6',
|
|
34
|
+
name: 'Claude Sonnet 4.6 (Thinking)',
|
|
35
|
+
wireId: 'claude-sonnet-4-6',
|
|
36
|
+
contextWindow: 200000,
|
|
37
|
+
maxTokens: 64000,
|
|
37
38
|
supportsThinking: true,
|
|
38
|
-
|
|
39
|
-
description: 'Classic Flash model',
|
|
39
|
+
description: 'Anthropic Claude Sonnet 4.6 with reasoning chain via Google Pro',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
id: 'gemini-3.1-pro',
|
|
43
|
-
name: 'Gemini 3.1 Pro (
|
|
43
|
+
name: 'Gemini 3.1 Pro (High Reasoning)',
|
|
44
44
|
wireId: 'gemini-3.1-pro-low',
|
|
45
45
|
contextWindow: 1048576,
|
|
46
46
|
maxTokens: 65536,
|
|
47
47
|
supportsThinking: true,
|
|
48
48
|
thinkingBudget: 8000,
|
|
49
|
-
description: 'Pro-tier deep reasoning
|
|
49
|
+
description: 'Pro-tier flagship deep reasoning model (8k Thinking)',
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
id: '
|
|
53
|
-
name: '
|
|
54
|
-
wireId: '
|
|
55
|
-
contextWindow:
|
|
56
|
-
maxTokens:
|
|
52
|
+
id: 'gemini-3.6-flash',
|
|
53
|
+
name: 'Gemini 3.6 Flash High',
|
|
54
|
+
wireId: 'gemini-3.6-flash-high',
|
|
55
|
+
contextWindow: 1048576,
|
|
56
|
+
maxTokens: 65536,
|
|
57
57
|
supportsThinking: true,
|
|
58
|
-
|
|
58
|
+
thinkingBudget: 4000,
|
|
59
|
+
description: 'Fast lightweight Flash model with reasoning',
|
|
59
60
|
},
|
|
60
61
|
{
|
|
61
|
-
id: '
|
|
62
|
-
name: '
|
|
63
|
-
wireId: '
|
|
64
|
-
contextWindow:
|
|
65
|
-
maxTokens:
|
|
66
|
-
supportsThinking:
|
|
67
|
-
description: '
|
|
62
|
+
id: 'gemini-3.5-flash',
|
|
63
|
+
name: 'Gemini 3.5 Flash',
|
|
64
|
+
wireId: 'gemini-3.5-flash-low',
|
|
65
|
+
contextWindow: 1048576,
|
|
66
|
+
maxTokens: 65536,
|
|
67
|
+
supportsThinking: false,
|
|
68
|
+
description: 'Classic Flash model',
|
|
68
69
|
},
|
|
69
70
|
{
|
|
70
71
|
id: 'gpt-oss-120b',
|