@lay111/dsh-plugin-google 1.0.3 β 1.0.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/bin/setup.js +2 -1
- package/package.json +2 -8
- package/src/adapter.js +20 -9
- package/src/api.js +40 -34
- package/src/index.js +0 -19
package/bin/setup.js
CHANGED
|
@@ -7,6 +7,7 @@ import { startGoogleOAuthLogin, getActiveAccount } from '../src/auth.js';
|
|
|
7
7
|
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
const PLUGIN_ROOT = path.resolve(__dirname, '..');
|
|
10
|
+
const PLUGIN_ENTRY = path.join(PLUGIN_ROOT, 'src', 'index.js');
|
|
10
11
|
|
|
11
12
|
const HOME = os.homedir();
|
|
12
13
|
const DSH_HOME = path.join(HOME, '.dsh');
|
|
@@ -37,7 +38,7 @@ console.log('π§© [2/3] ε
¨ε±ζθ½½ Google εηζδ»Άθ³ζζ DSH Profile (W
|
|
|
37
38
|
const globalPatchPath = path.join(DSH_HOME, 'cordis.patch.yml');
|
|
38
39
|
const globalPatchContent = `- insert:
|
|
39
40
|
- id: dsh-antigravity
|
|
40
|
-
name: ${
|
|
41
|
+
name: ${PLUGIN_ENTRY}
|
|
41
42
|
`;
|
|
42
43
|
fs.writeFileSync(globalPatchPath, globalPatchContent, 'utf-8');
|
|
43
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lay111/dsh-plugin-google",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Native DeepSeek Harness Plugin for Google Antigravity Pro & Gemini/Claude Models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -24,13 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
27
|
-
"@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-rc.2"
|
|
28
|
-
"@deepseek-ai/dsh-commands": "^0.1.0-rc.6 || ^0.1.1-rc.2"
|
|
29
|
-
},
|
|
30
|
-
"peerDependenciesMeta": {
|
|
31
|
-
"@deepseek-ai/dsh-commands": {
|
|
32
|
-
"optional": true
|
|
33
|
-
}
|
|
27
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-rc.2"
|
|
34
28
|
},
|
|
35
29
|
"keywords": [
|
|
36
30
|
"deepseek-harness",
|
package/src/adapter.js
CHANGED
|
@@ -24,24 +24,35 @@ export class AntigravityLlmAdapter {
|
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async
|
|
27
|
+
async resolveModel(provider, modelId, signal) {
|
|
28
28
|
const model = findModel(modelId);
|
|
29
29
|
return {
|
|
30
30
|
provider: 'antigravity',
|
|
31
31
|
id: model.id,
|
|
32
32
|
name: model.name,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
inputModalities: ['text'],
|
|
34
|
+
context: { contextWindow: model.contextWindow },
|
|
35
|
+
defaultMaxTokens: model.maxTokens,
|
|
36
|
+
reasoning: model.supportsThinking
|
|
37
|
+
? {
|
|
38
|
+
efforts: [
|
|
39
|
+
{ id: 'high', name: 'High' },
|
|
40
|
+
{ id: 'off', name: 'Off' },
|
|
41
|
+
],
|
|
42
|
+
defaultEffort: 'high',
|
|
43
|
+
}
|
|
40
44
|
: undefined,
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
async
|
|
48
|
+
async prepareCall(provider, modelId, signal) {
|
|
49
|
+
return {
|
|
50
|
+
model: await this.resolveModel(provider, modelId, signal),
|
|
51
|
+
stream: (options) => this.stream(options),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async *stream(options) {
|
|
45
56
|
const { accessToken, projectId } = await getValidAccessToken();
|
|
46
57
|
yield* streamAntigravity(options, accessToken, projectId);
|
|
47
58
|
}
|
package/src/api.js
CHANGED
|
@@ -24,8 +24,8 @@ export function formatMessagesToAntigravity(messages, modelSpec, projectId) {
|
|
|
24
24
|
for (const block of message.content) {
|
|
25
25
|
if (block.type === 'text') {
|
|
26
26
|
parts.push({ text: block.text });
|
|
27
|
-
} else if (block.type === 'thought') {
|
|
28
|
-
parts.push({ thought: true, text: block.text });
|
|
27
|
+
} else if (block.type === 'thought' || block.type === 'reasoning') {
|
|
28
|
+
parts.push({ thought: true, text: block.text || block.thought || '' });
|
|
29
29
|
} else if (block.type === 'tool-call') {
|
|
30
30
|
parts.push({
|
|
31
31
|
functionCall: {
|
|
@@ -128,47 +128,53 @@ export async function* streamAntigravity(options, accessToken, projectId) {
|
|
|
128
128
|
buffer = lines.pop() || '';
|
|
129
129
|
|
|
130
130
|
for (const line of lines) {
|
|
131
|
-
|
|
131
|
+
let trimmed = line.trim();
|
|
132
132
|
if (!trimmed) continue;
|
|
133
|
+
if (trimmed.startsWith('data:')) {
|
|
134
|
+
trimmed = trimmed.slice(5).trim();
|
|
135
|
+
}
|
|
136
|
+
if (trimmed === '[DONE]') break;
|
|
133
137
|
|
|
134
138
|
try {
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
139
|
+
const items = Array.isArray(JSON.parse(trimmed)) ? JSON.parse(trimmed) : [JSON.parse(trimmed)];
|
|
140
|
+
for (const item of items) {
|
|
141
|
+
const candidate = item.response?.candidates?.[0] || item.candidates?.[0];
|
|
142
|
+
if (!candidate) continue;
|
|
143
|
+
|
|
144
|
+
for (const part of candidate.content?.parts || []) {
|
|
145
|
+
if (part.thought) {
|
|
146
|
+
yield {
|
|
147
|
+
type: 'reasoning-delta',
|
|
148
|
+
index: blockIndex,
|
|
149
|
+
text: part.text || '',
|
|
150
|
+
};
|
|
151
|
+
} else if (part.text) {
|
|
152
|
+
yield {
|
|
153
|
+
type: 'text-delta',
|
|
154
|
+
index: blockIndex,
|
|
155
|
+
text: part.text || '',
|
|
156
|
+
};
|
|
157
|
+
} else if (part.functionCall) {
|
|
158
|
+
const callId = `call_${Math.random().toString(36).slice(2, 10)}`;
|
|
159
|
+
yield {
|
|
160
|
+
type: 'tool-call-delta',
|
|
161
|
+
index: blockIndex++,
|
|
162
|
+
id: callId,
|
|
163
|
+
name: part.functionCall.name,
|
|
164
|
+
argumentsDelta: JSON.stringify(part.functionCall.args || {}),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
138
168
|
|
|
139
|
-
|
|
140
|
-
if (part.thought) {
|
|
141
|
-
yield {
|
|
142
|
-
type: 'reasoning-delta',
|
|
143
|
-
index: blockIndex,
|
|
144
|
-
text: part.text || '',
|
|
145
|
-
};
|
|
146
|
-
} else if (part.text) {
|
|
169
|
+
if (candidate.finishReason) {
|
|
147
170
|
yield {
|
|
148
|
-
type: '
|
|
149
|
-
|
|
150
|
-
text: part.text || '',
|
|
151
|
-
};
|
|
152
|
-
} else if (part.functionCall) {
|
|
153
|
-
const callId = `call_${Math.random().toString(36).slice(2, 10)}`;
|
|
154
|
-
yield {
|
|
155
|
-
type: 'tool-call-delta',
|
|
156
|
-
index: blockIndex++,
|
|
157
|
-
id: callId,
|
|
158
|
-
name: part.functionCall.name,
|
|
159
|
-
argumentsDelta: JSON.stringify(part.functionCall.args || {}),
|
|
171
|
+
type: 'finish',
|
|
172
|
+
reason: 'stop',
|
|
160
173
|
};
|
|
161
174
|
}
|
|
162
175
|
}
|
|
163
|
-
|
|
164
|
-
if (candidate.finishReason) {
|
|
165
|
-
yield {
|
|
166
|
-
type: 'finish',
|
|
167
|
-
reason: candidate.finishReason.toLowerCase() === 'stop' ? 'stop' : 'stop',
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
176
|
} catch {
|
|
171
|
-
// ignore partial
|
|
177
|
+
// ignore partial chunks
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AntigravityLlmAdapter } from './adapter.js';
|
|
2
|
-
import { startGoogleOAuthLogin, getActiveAccount } from './auth.js';
|
|
3
2
|
|
|
4
3
|
export const name = 'dsh-antigravity';
|
|
5
4
|
export const inject = ['llm'];
|
|
@@ -10,24 +9,6 @@ export function apply(ctx) {
|
|
|
10
9
|
// 1. Register the native LLM adapter with DeepSeek Harness
|
|
11
10
|
ctx.llm.registerAdapter(['antigravity'], adapter);
|
|
12
11
|
|
|
13
|
-
// 2. Register slash command if commands service is present
|
|
14
|
-
if (ctx.commands) {
|
|
15
|
-
ctx.commands.command('auth/google', 'Log in to Google Antigravity Pro').action(async () => {
|
|
16
|
-
console.log('Initiating Google OAuth login flow...');
|
|
17
|
-
const account = await startGoogleOAuthLogin();
|
|
18
|
-
console.log(`Successfully logged in as: ${account.email}`);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
ctx.commands.command('auth/status', 'Check Google Antigravity account status').action(() => {
|
|
22
|
-
const active = getActiveAccount();
|
|
23
|
-
if (active) {
|
|
24
|
-
console.log(`Active Account: ${active.email} (Project: ${active.projectId})`);
|
|
25
|
-
} else {
|
|
26
|
-
console.log('No Google Antigravity account currently logged in.');
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
12
|
ctx.logger?.info('Google Antigravity plugin mounted successfully.');
|
|
32
13
|
}
|
|
33
14
|
|