dsh-agy-link 0.2.4 → 0.2.6
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 +114 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,10 +10,18 @@ import { randomBytes } from "node:crypto";
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
//#region src/common/types.ts
|
|
12
12
|
const PROVIDER_ID = "antigravity";
|
|
13
|
-
const PLUGIN_ID = "agy-link";
|
|
14
13
|
const DEFAULT_FALLBACK_MODELS = [
|
|
15
14
|
{
|
|
16
|
-
id: "gemini-3-
|
|
15
|
+
id: "gemini-3.7-flash",
|
|
16
|
+
name: "Gemini 3.7 Flash",
|
|
17
|
+
efforts: [
|
|
18
|
+
"low",
|
|
19
|
+
"medium",
|
|
20
|
+
"high"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "gemini-3.6-flash",
|
|
17
25
|
name: "Gemini 3.6 Flash",
|
|
18
26
|
efforts: [
|
|
19
27
|
"low",
|
|
@@ -22,13 +30,80 @@ const DEFAULT_FALLBACK_MODELS = [
|
|
|
22
30
|
]
|
|
23
31
|
},
|
|
24
32
|
{
|
|
25
|
-
id: "gemini-3-
|
|
33
|
+
id: "gemini-3.5-flash",
|
|
34
|
+
name: "Gemini 3.5 Flash",
|
|
35
|
+
efforts: [
|
|
36
|
+
"low",
|
|
37
|
+
"medium",
|
|
38
|
+
"high"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "gemini-3.1-pro",
|
|
26
43
|
name: "Gemini 3.1 Pro",
|
|
27
44
|
efforts: ["low", "high"]
|
|
28
45
|
},
|
|
46
|
+
{
|
|
47
|
+
id: "gemini-3.1-flash-lite",
|
|
48
|
+
name: "Gemini 3.1 Flash Lite"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "gemini-2.5-pro",
|
|
52
|
+
name: "Gemini 2.5 Pro",
|
|
53
|
+
efforts: ["low", "high"]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "gemini-2.5-flash",
|
|
57
|
+
name: "Gemini 2.5 Flash",
|
|
58
|
+
efforts: [
|
|
59
|
+
"low",
|
|
60
|
+
"medium",
|
|
61
|
+
"high"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "gemini-2.5-flash-lite",
|
|
66
|
+
name: "Gemini 2.5 Flash Lite"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "claude-opus-4-8",
|
|
70
|
+
name: "Claude Opus 4.8 (Thinking)"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "claude-opus-4-6",
|
|
74
|
+
name: "Claude Opus 4.6 (Thinking)"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "claude-opus-4-5",
|
|
78
|
+
name: "Claude Opus 4.5 (Thinking)"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "claude-opus-4",
|
|
82
|
+
name: "Claude Opus 4 (Thinking)"
|
|
83
|
+
},
|
|
29
84
|
{
|
|
30
85
|
id: "claude-sonnet-4-6",
|
|
31
86
|
name: "Claude Sonnet 4.6 (Thinking)"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "claude-sonnet-4-5",
|
|
90
|
+
name: "Claude Sonnet 4.5 (Thinking)"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "claude-sonnet-4",
|
|
94
|
+
name: "Claude Sonnet 4 (Thinking)"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "claude-haiku-4-5",
|
|
98
|
+
name: "Claude Haiku 4.5"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "gpt-oss-120b",
|
|
102
|
+
name: "GPT-OSS 120B"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "gpt-oss-20b",
|
|
106
|
+
name: "GPT-OSS 20B"
|
|
32
107
|
}
|
|
33
108
|
];
|
|
34
109
|
function defaultConfig() {
|
|
@@ -250,13 +325,14 @@ function defaultOutput(output) {
|
|
|
250
325
|
return "-> " + (s.length > 2048 ? s.slice(0, 2048) + "... (+" + (s.length - 2048) + " chars)" : s) + "\n";
|
|
251
326
|
}
|
|
252
327
|
function usageFromRaw(raw) {
|
|
253
|
-
|
|
328
|
+
const usage = {
|
|
254
329
|
inputTokens: raw.input_tokens ?? 0,
|
|
255
|
-
outputTokens: raw.output_tokens ?? 0
|
|
256
|
-
cacheReadTokens: raw.cache_read_tokens ?? void 0,
|
|
257
|
-
cacheWriteTokens: raw.cache_write_tokens ?? void 0,
|
|
258
|
-
reasoningTokens: raw.thinking_tokens ?? void 0
|
|
330
|
+
outputTokens: raw.output_tokens ?? 0
|
|
259
331
|
};
|
|
332
|
+
if (raw.cache_read_tokens !== void 0) usage.cacheReadTokens = raw.cache_read_tokens;
|
|
333
|
+
if (raw.cache_write_tokens !== void 0) usage.cacheWriteTokens = raw.cache_write_tokens;
|
|
334
|
+
if (raw.thinking_tokens !== void 0) usage.reasoningTokens = raw.thinking_tokens;
|
|
335
|
+
return usage;
|
|
260
336
|
}
|
|
261
337
|
/** Suffix-delta: emit only what grew; fall back to a newline + full text. */
|
|
262
338
|
function suffixDelta(prev, next) {
|
|
@@ -386,7 +462,7 @@ var EventMapper = class {
|
|
|
386
462
|
yield {
|
|
387
463
|
type: "finish",
|
|
388
464
|
reason: { kind: "stop" },
|
|
389
|
-
|
|
465
|
+
...ev.conversationId !== "" ? { replayState: { response: { conversationId: ev.conversationId } } } : {}
|
|
390
466
|
};
|
|
391
467
|
this.finished = true;
|
|
392
468
|
}
|
|
@@ -624,7 +700,12 @@ function findEntry(catalog, id) {
|
|
|
624
700
|
function defaultEffortFor(entry, cfg) {
|
|
625
701
|
if (!entry.efforts) return void 0;
|
|
626
702
|
if (cfg.defaultEffort !== "" && entry.efforts.includes(cfg.defaultEffort)) return cfg.defaultEffort;
|
|
627
|
-
|
|
703
|
+
for (const pref of [
|
|
704
|
+
"high",
|
|
705
|
+
"medium",
|
|
706
|
+
"low"
|
|
707
|
+
]) if (entry.efforts.includes(pref)) return pref;
|
|
708
|
+
return entry.efforts[entry.efforts.length - 1];
|
|
628
709
|
}
|
|
629
710
|
//#endregion
|
|
630
711
|
//#region src/host/parser.ts
|
|
@@ -757,14 +838,20 @@ function parseUsage(v) {
|
|
|
757
838
|
if (!v || typeof v !== "object") return {};
|
|
758
839
|
const o = v;
|
|
759
840
|
const num = (x) => typeof x === "number" && Number.isFinite(x) ? x : void 0;
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
841
|
+
const out = {};
|
|
842
|
+
const inT = num(o.input_tokens);
|
|
843
|
+
const outT = num(o.output_tokens);
|
|
844
|
+
if (inT !== void 0) out.input_tokens = inT;
|
|
845
|
+
if (outT !== void 0) out.output_tokens = outT;
|
|
846
|
+
const t = num(o.thinking_tokens);
|
|
847
|
+
if (t !== void 0) out.thinking_tokens = t;
|
|
848
|
+
const cr = num(o.cache_read_tokens);
|
|
849
|
+
if (cr !== void 0) out.cache_read_tokens = cr;
|
|
850
|
+
const cw = num(o.cache_write_tokens);
|
|
851
|
+
if (cw !== void 0) out.cache_write_tokens = cw;
|
|
852
|
+
const tot = num(o.total_tokens);
|
|
853
|
+
if (tot !== void 0) out.total_tokens = tot;
|
|
854
|
+
return out;
|
|
768
855
|
}
|
|
769
856
|
/** Parse one decoded JSON object into a typed event; undefined = ignore. */
|
|
770
857
|
function classifyEvent(obj, seq) {
|
|
@@ -785,8 +872,8 @@ function classifyEvent(obj, seq) {
|
|
|
785
872
|
]);
|
|
786
873
|
return {
|
|
787
874
|
kind: "init",
|
|
788
|
-
|
|
789
|
-
|
|
875
|
+
...typeof cid === "string" && cid !== "" ? { conversationId: cid } : {},
|
|
876
|
+
...typeof model === "string" ? { model } : {},
|
|
790
877
|
raw: o
|
|
791
878
|
};
|
|
792
879
|
}
|
|
@@ -806,12 +893,13 @@ function classifyEvent(obj, seq) {
|
|
|
806
893
|
"stepType",
|
|
807
894
|
"type"
|
|
808
895
|
]));
|
|
896
|
+
const toolInfo = stepKind === "tool" ? extractTool(o) : void 0;
|
|
809
897
|
return {
|
|
810
898
|
kind: "step",
|
|
811
899
|
stepKey,
|
|
812
900
|
stepKind,
|
|
813
901
|
text: extractText(o),
|
|
814
|
-
|
|
902
|
+
...toolInfo !== void 0 ? { tool: toolInfo } : {},
|
|
815
903
|
raw: o
|
|
816
904
|
};
|
|
817
905
|
}
|
|
@@ -836,7 +924,7 @@ function classifyEvent(obj, seq) {
|
|
|
836
924
|
conversationId: typeof cid === "string" ? cid : "",
|
|
837
925
|
ok,
|
|
838
926
|
response: typeof response === "string" ? response : "",
|
|
839
|
-
|
|
927
|
+
...typeof error === "string" ? { error } : {},
|
|
840
928
|
usage: parseUsage(inner.usage),
|
|
841
929
|
raw: o
|
|
842
930
|
};
|
|
@@ -1787,10 +1875,12 @@ function defineAgyAskTool(deps) {
|
|
|
1787
1875
|
throw new Error("agy_ask: schema is not valid JSON: " + String(e));
|
|
1788
1876
|
}
|
|
1789
1877
|
const readPaths = typeof args.readPaths === "string" && args.readPaths.trim() !== "" ? args.readPaths.split(/[ ,]+/).filter(Boolean) : [];
|
|
1878
|
+
const entry = findEntry(deps.catalog(), model);
|
|
1879
|
+
const effort = args.effort ?? (entry?.efforts ? defaultEffortFor(entry, cfg) : void 0);
|
|
1790
1880
|
const res = await runAgyOnce(deps, {
|
|
1791
1881
|
prompt: args.prompt,
|
|
1792
1882
|
model: model === "" ? void 0 : model,
|
|
1793
|
-
effort
|
|
1883
|
+
effort,
|
|
1794
1884
|
mode: args.mode,
|
|
1795
1885
|
timeoutMs: args.timeoutMinutes ? args.timeoutMinutes * 6e4 : void 0,
|
|
1796
1886
|
signal: exec.signal,
|
|
@@ -2486,11 +2576,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
2486
2576
|
const catalog = new ModelCatalog(async (signal) => {
|
|
2487
2577
|
const b = bin();
|
|
2488
2578
|
if (!b) throw new Error("agy binary not found");
|
|
2489
|
-
const out = await probeProcess(b, [
|
|
2490
|
-
"models",
|
|
2491
|
-
"--output-format",
|
|
2492
|
-
"json"
|
|
2493
|
-
], 3e4, signal);
|
|
2579
|
+
const out = await probeProcess(b, ["models"], 3e4, signal);
|
|
2494
2580
|
if (out.code !== 0 && out.stdout.trim() === "") throw new Error("agy models failed: " + (out.stderrTail.trim() !== "" ? out.stderrTail.trim().slice(-200) : "exit " + String(out.code)));
|
|
2495
2581
|
return {
|
|
2496
2582
|
stdout: out.stdout,
|
|
@@ -2566,15 +2652,6 @@ function apply(ctx, entryConfig = {}) {
|
|
|
2566
2652
|
} catch (e) {
|
|
2567
2653
|
log("adapter registration failed: " + String(e));
|
|
2568
2654
|
}
|
|
2569
|
-
try {
|
|
2570
|
-
ctx.llm.registerConfigurableProviders([{
|
|
2571
|
-
provider: PROVIDER_ID,
|
|
2572
|
-
displayName: "Antigravity (agy CLI)",
|
|
2573
|
-
settingsNs: PLUGIN_ID,
|
|
2574
|
-
settingsPath: [],
|
|
2575
|
-
declared: false
|
|
2576
|
-
}]);
|
|
2577
|
-
} catch {}
|
|
2578
2655
|
ctx.commands.register(agyCommandDefinition({
|
|
2579
2656
|
cfg: getConfig,
|
|
2580
2657
|
bin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|