dsh-agy-link 0.6.2 → 0.6.3
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 +20 -0
- package/dist/client.js +140 -54
- package/dist/index.js +31 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.3 (2026-11-06)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(compaction): the compaction card now actually renders in DSH, reports real token deltas, and no longer duplicates across accounts.** (thanks @Ronnoc, #79)
|
|
8
|
+
- DSH's markdown renderer uses `allowDangerousHtml: false`, so the previous raw `<div class="agy-compaction-card">` marker was escaped into visible text. The marker is now a standard blockquote **link** (`> [✂️ 上下文已压缩 · 128.5k → 14.2k tokens (-89%)](#agy-compaction-card?…)`) that the client enhancer upgrades to the native card — and legacy raw/escaped markers still upgrade.
|
|
9
|
+
- Token accounting summed only `input_tokens` (the uncached delta), so cards fired at tiny counts like `4.6k → 205`; `calcPromptTokens()` now adds `cache_read_tokens` + `cache_write_tokens` for the real prompt size.
|
|
10
|
+
- Multi-account compaction cleared only the active account's binding, so rotating steps re-triggered duplicate cards; compaction now invalidates every binding for the session across accounts and debounces repeated notices.
|
|
11
|
+
- Hardening on merge: marker query values now percent-encode `( ) ' !` too, so a digest containing parentheses can't terminate the markdown link early.
|
|
12
|
+
|
|
13
|
+
### 中文
|
|
14
|
+
|
|
15
|
+
- **修复(compaction):压缩卡片现在能在 DSH 里真正渲染、显示真实 token 变化,且不再跨账号重复。**(感谢 @Ronnoc,#79)
|
|
16
|
+
- DSH 的 markdown 渲染器 `allowDangerousHtml: false`,旧的原始 `<div class="agy-compaction-card">` 标记会被转义成可见文本。现改为标准引用块**链接**(`> [✂️ 上下文已压缩 · 128.5k → 14.2k tokens (-89%)](#agy-compaction-card?…)`),由客户端增强器升级为原生卡片;旧的原始/转义标记仍可升级。
|
|
17
|
+
- token 记账只加 `input_tokens`(未缓存增量),导致卡片在 `4.6k → 205` 这种小值就触发;`calcPromptTokens()` 现加上 `cache_read_tokens` + `cache_write_tokens` 得到真实 prompt 规模。
|
|
18
|
+
- 多账号下压缩只清当前账号的绑定,切换账号的后续步骤会重复触发卡片;现按会话清空所有账号的绑定并对重复提示去抖。
|
|
19
|
+
- 合并时加固:标记的查询值额外百分号编码 `( ) ' !`,避免含括号的摘要把 markdown 链接提前截断。
|
|
20
|
+
|
|
21
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.2...v0.6.3
|
|
22
|
+
|
|
3
23
|
## 0.6.2 (2026-11-06)
|
|
4
24
|
|
|
5
25
|
### English
|
package/dist/client.js
CHANGED
|
@@ -4923,79 +4923,165 @@ body.dark .agy-tsl-card,
|
|
|
4923
4923
|
}
|
|
4924
4924
|
return "上下文已压缩";
|
|
4925
4925
|
}
|
|
4926
|
+
function buildCompactionRow(notice) {
|
|
4927
|
+
const { beforeTokens, afterTokens, summary = "" } = notice;
|
|
4928
|
+
const summaryLabel = formatCompactionSummary(beforeTokens, afterTokens);
|
|
4929
|
+
const reductionLabel = calcTokenReduction(beforeTokens, afterTokens);
|
|
4930
|
+
const titleText = getCompactionTitle();
|
|
4931
|
+
const row = document.createElement("div");
|
|
4932
|
+
row.className = "agy-compaction-row";
|
|
4933
|
+
row.setAttribute("data-state", "collapsed");
|
|
4934
|
+
const button = document.createElement("button");
|
|
4935
|
+
button.type = "button";
|
|
4936
|
+
button.className = "agy-compaction-button";
|
|
4937
|
+
button.setAttribute("aria-expanded", "false");
|
|
4938
|
+
button.innerHTML = `
|
|
4939
|
+
<span class="agy-compaction-leading" aria-hidden="true">
|
|
4940
|
+
<svg class="agy-compaction-icon-context" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4941
|
+
<rect x="3" y="4" width="18" height="16" rx="2"></rect>
|
|
4942
|
+
<line x1="7" y1="8" x2="17" y2="8"></line>
|
|
4943
|
+
<line x1="7" y1="12" x2="13" y2="12"></line>
|
|
4944
|
+
<line x1="7" y1="16" x2="11" y2="16"></line>
|
|
4945
|
+
</svg>
|
|
4946
|
+
<svg class="agy-compaction-icon-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4947
|
+
<path d="M9 5l7 7-7 7"></path>
|
|
4948
|
+
</svg>
|
|
4949
|
+
</span>
|
|
4950
|
+
<span class="agy-compaction-title">${titleText}</span>
|
|
4951
|
+
<span class="agy-compaction-sep" aria-hidden="true">·</span>
|
|
4952
|
+
<span class="agy-compaction-summary">${summaryLabel}</span>
|
|
4953
|
+
`;
|
|
4954
|
+
const body = document.createElement("div");
|
|
4955
|
+
body.className = "agy-compaction-body";
|
|
4956
|
+
body.style.display = "none";
|
|
4957
|
+
const metricsBar = document.createElement("div");
|
|
4958
|
+
metricsBar.className = "agy-compaction-metrics-bar";
|
|
4959
|
+
metricsBar.innerHTML = `
|
|
4960
|
+
<span class="agy-metric-item"><strong>压缩前:</strong> ${formatTokenCount(beforeTokens)} tokens</span>
|
|
4961
|
+
<span class="agy-metric-arrow">→</span>
|
|
4962
|
+
<span class="agy-metric-item"><strong>压缩后:</strong> ${formatTokenCount(afterTokens)} tokens</span>
|
|
4963
|
+
<span class="agy-metric-badge">${reductionLabel}</span>
|
|
4964
|
+
`;
|
|
4965
|
+
body.appendChild(metricsBar);
|
|
4966
|
+
if (summary.trim() !== "") {
|
|
4967
|
+
const summaryContent = document.createElement("div");
|
|
4968
|
+
summaryContent.className = "agy-compaction-summary-text";
|
|
4969
|
+
summaryContent.textContent = summary;
|
|
4970
|
+
body.appendChild(summaryContent);
|
|
4971
|
+
}
|
|
4972
|
+
button.addEventListener("click", (e) => {
|
|
4973
|
+
e.stopPropagation();
|
|
4974
|
+
const isExpanded = row.getAttribute("data-state") === "expanded";
|
|
4975
|
+
const nextState = isExpanded ? "collapsed" : "expanded";
|
|
4976
|
+
row.setAttribute("data-state", nextState);
|
|
4977
|
+
button.setAttribute("aria-expanded", String(!isExpanded));
|
|
4978
|
+
body.style.display = isExpanded ? "none" : "block";
|
|
4979
|
+
});
|
|
4980
|
+
row.appendChild(button);
|
|
4981
|
+
row.appendChild(body);
|
|
4982
|
+
return row;
|
|
4983
|
+
}
|
|
4926
4984
|
/**
|
|
4927
|
-
* Scan DOM for
|
|
4985
|
+
* Scan DOM for compaction markers and transform them into
|
|
4928
4986
|
* the interactive DeepSeek-like Compaction Card.
|
|
4929
4987
|
*/
|
|
4930
4988
|
function scanAndEnhanceCompactionCards(root = document) {
|
|
4931
4989
|
if (typeof document === "undefined") return;
|
|
4932
4990
|
if (isInteractionLocked()) return;
|
|
4991
|
+
const anchors = root.querySelectorAll("a[href*=\"#agy-compaction\"]:not([data-agy-compaction-rendered=\"true\"])");
|
|
4992
|
+
for (const anchor of Array.from(anchors)) {
|
|
4993
|
+
anchor.setAttribute("data-agy-compaction-rendered", "true");
|
|
4994
|
+
const href = anchor.getAttribute("href") || "";
|
|
4995
|
+
const qIdx = href.indexOf("?");
|
|
4996
|
+
const queryStr = qIdx >= 0 ? href.slice(qIdx + 1) : "";
|
|
4997
|
+
const params = new URLSearchParams(queryStr);
|
|
4998
|
+
const beforeTokens = parseInt(params.get("before") || "0", 10);
|
|
4999
|
+
const afterTokens = parseInt(params.get("after") || "0", 10);
|
|
5000
|
+
const items = parseInt(params.get("items") || "0", 10);
|
|
5001
|
+
let summary = "";
|
|
5002
|
+
const rawSummary = params.get("summary");
|
|
5003
|
+
if (rawSummary) try {
|
|
5004
|
+
summary = decodeURIComponent(rawSummary);
|
|
5005
|
+
} catch {
|
|
5006
|
+
summary = "";
|
|
5007
|
+
}
|
|
5008
|
+
const container = document.createElement("div");
|
|
5009
|
+
container.className = "agy-compaction-card";
|
|
5010
|
+
container.setAttribute("data-agy-compaction-rendered", "true");
|
|
5011
|
+
const row = buildCompactionRow({
|
|
5012
|
+
beforeTokens,
|
|
5013
|
+
afterTokens,
|
|
5014
|
+
items,
|
|
5015
|
+
summary
|
|
5016
|
+
});
|
|
5017
|
+
container.appendChild(row);
|
|
5018
|
+
let targetNode = anchor;
|
|
5019
|
+
if (targetNode.parentElement && targetNode.parentElement.tagName.toLowerCase() === "p") targetNode = targetNode.parentElement;
|
|
5020
|
+
if (targetNode.parentElement && targetNode.parentElement.tagName.toLowerCase() === "blockquote") targetNode = targetNode.parentElement;
|
|
5021
|
+
if (typeof targetNode.replaceWith === "function") targetNode.replaceWith(container);
|
|
5022
|
+
else if (targetNode.parentNode) targetNode.parentNode.replaceChild(container, targetNode);
|
|
5023
|
+
}
|
|
4933
5024
|
const cards = root.querySelectorAll(".agy-compaction-card:not([data-agy-compaction-rendered=\"true\"])");
|
|
4934
5025
|
for (const card of Array.from(cards)) {
|
|
4935
5026
|
card.setAttribute("data-agy-compaction-rendered", "true");
|
|
4936
5027
|
const beforeTokens = parseInt(card.dataset.before || "0", 10);
|
|
4937
5028
|
const afterTokens = parseInt(card.dataset.after || "0", 10);
|
|
5029
|
+
const items = parseInt(card.dataset.items || "0", 10);
|
|
4938
5030
|
let summary = "";
|
|
4939
5031
|
if (card.dataset.summary) try {
|
|
4940
5032
|
summary = decodeURIComponent(card.dataset.summary);
|
|
4941
5033
|
} catch {
|
|
4942
5034
|
summary = "";
|
|
4943
5035
|
}
|
|
4944
|
-
const
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
row.setAttribute("data-state", "collapsed");
|
|
4950
|
-
const button = document.createElement("button");
|
|
4951
|
-
button.type = "button";
|
|
4952
|
-
button.className = "agy-compaction-button";
|
|
4953
|
-
button.setAttribute("aria-expanded", "false");
|
|
4954
|
-
button.innerHTML = `
|
|
4955
|
-
<span class="agy-compaction-leading" aria-hidden="true">
|
|
4956
|
-
<svg class="agy-compaction-icon-context" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4957
|
-
<rect x="3" y="4" width="18" height="16" rx="2"></rect>
|
|
4958
|
-
<line x1="7" y1="8" x2="17" y2="8"></line>
|
|
4959
|
-
<line x1="7" y1="12" x2="13" y2="12"></line>
|
|
4960
|
-
<line x1="7" y1="16" x2="11" y2="16"></line>
|
|
4961
|
-
</svg>
|
|
4962
|
-
<svg class="agy-compaction-icon-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4963
|
-
<path d="M9 5l7 7-7 7"></path>
|
|
4964
|
-
</svg>
|
|
4965
|
-
</span>
|
|
4966
|
-
<span class="agy-compaction-title">${titleText}</span>
|
|
4967
|
-
<span class="agy-compaction-sep" aria-hidden="true">·</span>
|
|
4968
|
-
<span class="agy-compaction-summary">${summaryLabel}</span>
|
|
4969
|
-
`;
|
|
4970
|
-
const body = document.createElement("div");
|
|
4971
|
-
body.className = "agy-compaction-body";
|
|
4972
|
-
body.style.display = "none";
|
|
4973
|
-
const metricsBar = document.createElement("div");
|
|
4974
|
-
metricsBar.className = "agy-compaction-metrics-bar";
|
|
4975
|
-
metricsBar.innerHTML = `
|
|
4976
|
-
<span class="agy-metric-item"><strong>压缩前:</strong> ${formatTokenCount(beforeTokens)} tokens</span>
|
|
4977
|
-
<span class="agy-metric-arrow">→</span>
|
|
4978
|
-
<span class="agy-metric-item"><strong>压缩后:</strong> ${formatTokenCount(afterTokens)} tokens</span>
|
|
4979
|
-
<span class="agy-metric-badge">${reductionLabel}</span>
|
|
4980
|
-
`;
|
|
4981
|
-
body.appendChild(metricsBar);
|
|
4982
|
-
if (summary.trim() !== "") {
|
|
4983
|
-
const summaryContent = document.createElement("div");
|
|
4984
|
-
summaryContent.className = "agy-compaction-summary-text";
|
|
4985
|
-
summaryContent.textContent = summary;
|
|
4986
|
-
body.appendChild(summaryContent);
|
|
4987
|
-
}
|
|
4988
|
-
button.addEventListener("click", (e) => {
|
|
4989
|
-
e.stopPropagation();
|
|
4990
|
-
const isExpanded = row.getAttribute("data-state") === "expanded";
|
|
4991
|
-
const nextState = isExpanded ? "collapsed" : "expanded";
|
|
4992
|
-
row.setAttribute("data-state", nextState);
|
|
4993
|
-
button.setAttribute("aria-expanded", String(!isExpanded));
|
|
4994
|
-
body.style.display = isExpanded ? "none" : "block";
|
|
5036
|
+
const row = buildCompactionRow({
|
|
5037
|
+
beforeTokens,
|
|
5038
|
+
afterTokens,
|
|
5039
|
+
items,
|
|
5040
|
+
summary
|
|
4995
5041
|
});
|
|
4996
5042
|
card.replaceChildren(row);
|
|
4997
|
-
|
|
4998
|
-
|
|
5043
|
+
}
|
|
5044
|
+
const paragraphs = root.querySelectorAll("p:not([data-agy-compaction-rendered=\"true\"])");
|
|
5045
|
+
for (const p of Array.from(paragraphs)) {
|
|
5046
|
+
const text = p.textContent || "";
|
|
5047
|
+
if (!text.includes("class=\"agy-compaction-card\"") && !text.includes("agy-compaction-card")) continue;
|
|
5048
|
+
p.setAttribute("data-agy-compaction-rendered", "true");
|
|
5049
|
+
const beforeMatch = /data-before="(\d+)"/.exec(text);
|
|
5050
|
+
const afterMatch = /data-after="(\d+)"/.exec(text);
|
|
5051
|
+
const itemsMatch = /data-items="(\d+)"/.exec(text);
|
|
5052
|
+
const summaryMatch = /data-summary="([^"]*)"/.exec(text);
|
|
5053
|
+
const beforeTokens = beforeMatch ? parseInt(beforeMatch[1] || "0", 10) : 0;
|
|
5054
|
+
const afterTokens = afterMatch ? parseInt(afterMatch[1] || "0", 10) : 0;
|
|
5055
|
+
const items = itemsMatch ? parseInt(itemsMatch[1] || "0", 10) : 0;
|
|
5056
|
+
let summary = "";
|
|
5057
|
+
if (summaryMatch && summaryMatch[1]) try {
|
|
5058
|
+
summary = decodeURIComponent(summaryMatch[1]);
|
|
5059
|
+
} catch {
|
|
5060
|
+
summary = "";
|
|
5061
|
+
}
|
|
5062
|
+
const container = document.createElement("div");
|
|
5063
|
+
container.className = "agy-compaction-card";
|
|
5064
|
+
container.setAttribute("data-agy-compaction-rendered", "true");
|
|
5065
|
+
const row = buildCompactionRow({
|
|
5066
|
+
beforeTokens,
|
|
5067
|
+
afterTokens,
|
|
5068
|
+
items,
|
|
5069
|
+
summary
|
|
5070
|
+
});
|
|
5071
|
+
container.appendChild(row);
|
|
5072
|
+
let next = p.nextElementSibling;
|
|
5073
|
+
while (next) {
|
|
5074
|
+
const sib = next;
|
|
5075
|
+
const sibTag = sib.tagName ? sib.tagName.toLowerCase() : "";
|
|
5076
|
+
const sibText = (sib.textContent || "").trim();
|
|
5077
|
+
if (sibTag === "blockquote" || sibTag === "p" && (sibText === "</div>" || sibText === "")) {
|
|
5078
|
+
next = sib.nextElementSibling;
|
|
5079
|
+
if (typeof sib.remove === "function") sib.remove();
|
|
5080
|
+
else if (sib.parentNode) sib.parentNode.removeChild(sib);
|
|
5081
|
+
} else break;
|
|
5082
|
+
}
|
|
5083
|
+
if (typeof p.replaceWith === "function") p.replaceWith(container);
|
|
5084
|
+
else if (p.parentNode) p.parentNode.replaceChild(container, p);
|
|
4999
5085
|
}
|
|
5000
5086
|
}
|
|
5001
5087
|
let compactionDispose = null;
|
package/dist/index.js
CHANGED
|
@@ -1914,14 +1914,20 @@ function formatCompactionSummary(before, after) {
|
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
1916
1916
|
* Render standard compaction marker for the stream.
|
|
1917
|
-
* In raw markdown, this surfaces as an elegant blockquote:
|
|
1918
|
-
* > ✂️ **上下文已压缩** · 128.5k → 14.2k tokens (-89%)
|
|
1917
|
+
* In raw markdown (and DSH markdown which escapes raw HTML), this surfaces as an elegant blockquote:
|
|
1918
|
+
* > [✂️ **上下文已压缩** · 128.5k → 14.2k tokens (-89%)](#agy-compaction-card?before=128500&after=14200&items=18&summary=...)
|
|
1919
1919
|
* In browser DSH, the client enhancer transforms it into the interactive native Compaction Card.
|
|
1920
1920
|
*/
|
|
1921
|
+
/** Percent-encode a value for use inside a markdown link destination.
|
|
1922
|
+
* encodeURIComponent leaves ( ) ' ! alone, but a raw ')' in a query value would
|
|
1923
|
+
* terminate the `](...)` link early and break the marker. */
|
|
1924
|
+
function encodeForMarkdownUrl(value) {
|
|
1925
|
+
return encodeURIComponent(value).replace(/[()'!]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
1926
|
+
}
|
|
1921
1927
|
function renderCompactionMarker(notice) {
|
|
1922
1928
|
const summaryText = formatCompactionSummary(notice.beforeTokens, notice.afterTokens);
|
|
1923
|
-
const encodedSummary = notice.summary ?
|
|
1924
|
-
return
|
|
1929
|
+
const encodedSummary = notice.summary ? encodeForMarkdownUrl(notice.summary) : "";
|
|
1930
|
+
return `> [✂️ **上下文已压缩** · ${summaryText}](#agy-compaction-card?before=${notice.beforeTokens}&after=${notice.afterTokens}&items=${notice.items}&summary=${encodedSummary})\n\n`;
|
|
1925
1931
|
}
|
|
1926
1932
|
//#endregion
|
|
1927
1933
|
//#region src/host/mapper.ts
|
|
@@ -30902,8 +30908,17 @@ async function waitForRunSettle(run, timeoutMs) {
|
|
|
30902
30908
|
}
|
|
30903
30909
|
return run.isSettled;
|
|
30904
30910
|
}
|
|
30911
|
+
function calcPromptTokens(usage) {
|
|
30912
|
+
if (!usage) return void 0;
|
|
30913
|
+
const input = typeof usage.input_tokens === "number" && usage.input_tokens > 0 ? usage.input_tokens : 0;
|
|
30914
|
+
const cacheRead = typeof usage.cache_read_tokens === "number" && usage.cache_read_tokens > 0 ? usage.cache_read_tokens : 0;
|
|
30915
|
+
const cacheWrite = typeof usage.cache_write_tokens === "number" && usage.cache_write_tokens > 0 ? usage.cache_write_tokens : 0;
|
|
30916
|
+
const totalPrompt = input + cacheRead + cacheWrite;
|
|
30917
|
+
return totalPrompt > 0 ? totalPrompt : void 0;
|
|
30918
|
+
}
|
|
30905
30919
|
var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
30906
30920
|
deps;
|
|
30921
|
+
recentlyCompactedSessions = /* @__PURE__ */ new Map();
|
|
30907
30922
|
/**
|
|
30908
30923
|
* Models agy has refused `--effort` for (issue #67). Seeded from the host's
|
|
30909
30924
|
* persisted list on first use, then grown by each refusal. Effort support is
|
|
@@ -31509,7 +31524,9 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31509
31524
|
if (sessionAccountKey !== "") this.deps.store.delete(sessionAccountKey);
|
|
31510
31525
|
binding = void 0;
|
|
31511
31526
|
}
|
|
31512
|
-
const
|
|
31527
|
+
const lastCompactedAt = sessionKey ? this.recentlyCompactedSessions.get(sessionKey) : void 0;
|
|
31528
|
+
const now = Date.now();
|
|
31529
|
+
const isCompacted = binding !== void 0 && (!lastCompactedAt || now - lastCompactedAt > 6e4) && (messages.length <= 4 && binding.lastMessageCount >= 5 || binding.lastMessageCount > 10 && messages.length < Math.floor(binding.lastMessageCount * .8) || binding.lastMessageCount <= 10 && messages.length < binding.lastMessageCount - 2);
|
|
31513
31530
|
let compactionNotice = void 0;
|
|
31514
31531
|
if (persistBinding && binding !== void 0 && isCompacted) {
|
|
31515
31532
|
const beforeTokens = typeof binding.lastInputTokens === "number" && binding.lastInputTokens > 0 ? binding.lastInputTokens : Math.round(binding.lastMessageCount * 750);
|
|
@@ -31531,7 +31548,13 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31531
31548
|
items,
|
|
31532
31549
|
...extractedSummary ? { summary: extractedSummary } : {}
|
|
31533
31550
|
};
|
|
31534
|
-
if (
|
|
31551
|
+
if (sessionKey) {
|
|
31552
|
+
this.recentlyCompactedSessions.set(sessionKey, now);
|
|
31553
|
+
if (this.recentlyCompactedSessions.size > 200) {
|
|
31554
|
+
for (const [k, t] of this.recentlyCompactedSessions) if (now - t > 12e4) this.recentlyCompactedSessions.delete(k);
|
|
31555
|
+
}
|
|
31556
|
+
for (const k of Object.keys(this.deps.store.all())) if (k === sessionKey || k.startsWith(sessionKey + ":")) this.deps.store.delete(k);
|
|
31557
|
+
} else if (sessionAccountKey !== "") this.deps.store.delete(sessionAccountKey);
|
|
31535
31558
|
binding = void 0;
|
|
31536
31559
|
} else if (binding !== void 0 && messages.length < binding.lastMessageCount) {
|
|
31537
31560
|
binding.lastMessageCount = messages.length;
|
|
@@ -32102,7 +32125,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
32102
32125
|
const finalId = binding !== void 0 ? binding.conversationId : conversationId;
|
|
32103
32126
|
if (finalId) {
|
|
32104
32127
|
const finalUsage = rec.lastUsage ?? rec.finalUsage({});
|
|
32105
|
-
const inputTokens = typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens;
|
|
32128
|
+
const inputTokens = calcPromptTokens(finalUsage) ?? (typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens);
|
|
32106
32129
|
this.deps.store.set(sessionAccountKey, {
|
|
32107
32130
|
conversationId: finalId,
|
|
32108
32131
|
lastMessageCount: messages.length,
|
|
@@ -32131,7 +32154,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
32131
32154
|
const finalId = binding !== void 0 ? binding.conversationId : conversationId;
|
|
32132
32155
|
if (finalId) {
|
|
32133
32156
|
const finalUsage = rec.lastUsage ?? rec.finalUsage({});
|
|
32134
|
-
const inputTokens = typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens;
|
|
32157
|
+
const inputTokens = calcPromptTokens(finalUsage) ?? (typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens);
|
|
32135
32158
|
this.deps.store.set(sessionAccountKey, {
|
|
32136
32159
|
conversationId: finalId,
|
|
32137
32160
|
lastMessageCount: messages.length,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
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",
|