dsh-agy-link 0.2.5 → 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 +26 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -325,13 +325,14 @@ function defaultOutput(output) {
|
|
|
325
325
|
return "-> " + (s.length > 2048 ? s.slice(0, 2048) + "... (+" + (s.length - 2048) + " chars)" : s) + "\n";
|
|
326
326
|
}
|
|
327
327
|
function usageFromRaw(raw) {
|
|
328
|
-
|
|
328
|
+
const usage = {
|
|
329
329
|
inputTokens: raw.input_tokens ?? 0,
|
|
330
|
-
outputTokens: raw.output_tokens ?? 0
|
|
331
|
-
cacheReadTokens: raw.cache_read_tokens ?? void 0,
|
|
332
|
-
cacheWriteTokens: raw.cache_write_tokens ?? void 0,
|
|
333
|
-
reasoningTokens: raw.thinking_tokens ?? void 0
|
|
330
|
+
outputTokens: raw.output_tokens ?? 0
|
|
334
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;
|
|
335
336
|
}
|
|
336
337
|
/** Suffix-delta: emit only what grew; fall back to a newline + full text. */
|
|
337
338
|
function suffixDelta(prev, next) {
|
|
@@ -461,7 +462,7 @@ var EventMapper = class {
|
|
|
461
462
|
yield {
|
|
462
463
|
type: "finish",
|
|
463
464
|
reason: { kind: "stop" },
|
|
464
|
-
|
|
465
|
+
...ev.conversationId !== "" ? { replayState: { response: { conversationId: ev.conversationId } } } : {}
|
|
465
466
|
};
|
|
466
467
|
this.finished = true;
|
|
467
468
|
}
|
|
@@ -837,14 +838,20 @@ function parseUsage(v) {
|
|
|
837
838
|
if (!v || typeof v !== "object") return {};
|
|
838
839
|
const o = v;
|
|
839
840
|
const num = (x) => typeof x === "number" && Number.isFinite(x) ? x : void 0;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
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;
|
|
848
855
|
}
|
|
849
856
|
/** Parse one decoded JSON object into a typed event; undefined = ignore. */
|
|
850
857
|
function classifyEvent(obj, seq) {
|
|
@@ -865,8 +872,8 @@ function classifyEvent(obj, seq) {
|
|
|
865
872
|
]);
|
|
866
873
|
return {
|
|
867
874
|
kind: "init",
|
|
868
|
-
|
|
869
|
-
|
|
875
|
+
...typeof cid === "string" && cid !== "" ? { conversationId: cid } : {},
|
|
876
|
+
...typeof model === "string" ? { model } : {},
|
|
870
877
|
raw: o
|
|
871
878
|
};
|
|
872
879
|
}
|
|
@@ -886,12 +893,13 @@ function classifyEvent(obj, seq) {
|
|
|
886
893
|
"stepType",
|
|
887
894
|
"type"
|
|
888
895
|
]));
|
|
896
|
+
const toolInfo = stepKind === "tool" ? extractTool(o) : void 0;
|
|
889
897
|
return {
|
|
890
898
|
kind: "step",
|
|
891
899
|
stepKey,
|
|
892
900
|
stepKind,
|
|
893
901
|
text: extractText(o),
|
|
894
|
-
|
|
902
|
+
...toolInfo !== void 0 ? { tool: toolInfo } : {},
|
|
895
903
|
raw: o
|
|
896
904
|
};
|
|
897
905
|
}
|
|
@@ -916,7 +924,7 @@ function classifyEvent(obj, seq) {
|
|
|
916
924
|
conversationId: typeof cid === "string" ? cid : "",
|
|
917
925
|
ok,
|
|
918
926
|
response: typeof response === "string" ? response : "",
|
|
919
|
-
|
|
927
|
+
...typeof error === "string" ? { error } : {},
|
|
920
928
|
usage: parseUsage(inner.usage),
|
|
921
929
|
raw: o
|
|
922
930
|
};
|
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",
|