dsh-agy-link 0.6.2 → 0.6.4
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 +42 -0
- package/dist/client.js +337 -208
- package/dist/index.js +121 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.4 (2026-11-07)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(goal): a completed goal is no longer re-completed on every later turn, and synthetic call ids are unique (issue #80).** (thanks @hjwsm1989, #82)
|
|
8
|
+
- `detectGoalContext()` scanned the whole history, so markers from an already completed goal still matched a brand-new human turn; the adapter then emitted a synthetic `update_goal(complete)` whose call id was deterministic (`…-<goalId>-<revision>`). Nine identical `tool_call` ids piled up in the transcript — harmless on the agy route (it never serializes the transcript) but an immediate, permanent `400 Duplicate 'call_id'` after switching to an HTTP provider.
|
|
9
|
+
- The scan now stops at the newest genuine human message; a new `resolveGoalContext(messages, live)` makes the live goal view authoritative (`live === null` → never synthesize a completion; `undefined` → history fallback for older hosts); and each emission mints a unique id (`…-<time36>-<seq36>`). The `sessionGoal()` log fallback no longer returns a completed/blocked goal.
|
|
10
|
+
|
|
11
|
+
- **Fix(client): compact the account modal and align the quota progress bars.** (thanks @Ronnoc, #81)
|
|
12
|
+
- 4+ accounts now fit without truncating the fourth card (`max-height: min(88vh, 880px)`, tighter card padding/margins); the left window-label column is a fixed 64px so every progress bar starts/ends on the same X; status badges are `nowrap`/`flexShrink: 0` so `冷却中` no longer wraps character-by-character.
|
|
13
|
+
|
|
14
|
+
### 中文
|
|
15
|
+
|
|
16
|
+
- **修复(goal):已完成的目标不再在后续每轮重复完成,合成 call id 也保证唯一(issue #80)。**(感谢 @hjwsm1989,#82)
|
|
17
|
+
- `detectGoalContext()` 扫描整段历史,已完成目标的标记仍会匹配到新的用户轮次,适配器因此反复发出 `update_goal(complete)`,call id 又是确定值(`…-<goalId>-<revision>`);九条相同 `tool_call` id 堆积后在 agy 路由上无感,但切到 HTTP provider 就会永久 `400 Duplicate 'call_id'`。
|
|
18
|
+
- 现在扫描在最近一条真实用户消息处停止;新增 `resolveGoalContext(messages, live)` 让实时 goal 视图权威(`null` → 绝不合成完成;`undefined` → 旧宿主走历史回退);每次发号都唯一(`…-<time36>-<seq36>`);`sessionGoal()` 的日志回退也不再返回已完成/阻塞的目标。
|
|
19
|
+
|
|
20
|
+
- **修复(client):压缩账号弹窗、对齐额度进度条。**(感谢 @Ronnoc,#81)
|
|
21
|
+
- 4 个以上账号不再截断第 4 张卡片(`max-height: min(88vh, 880px)`、更紧凑的卡片内外边距);左侧窗口标签列固定 64px,所有进度条起止 X 对齐;状态徽章 `nowrap`+`flexShrink: 0`,`冷却中` 不再逐字换行。
|
|
22
|
+
|
|
23
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.3...v0.6.4
|
|
24
|
+
|
|
25
|
+
## 0.6.3 (2026-11-06)
|
|
26
|
+
|
|
27
|
+
### English
|
|
28
|
+
|
|
29
|
+
- **Fix(compaction): the compaction card now actually renders in DSH, reports real token deltas, and no longer duplicates across accounts.** (thanks @Ronnoc, #79)
|
|
30
|
+
- 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.
|
|
31
|
+
- 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.
|
|
32
|
+
- 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.
|
|
33
|
+
- Hardening on merge: marker query values now percent-encode `( ) ' !` too, so a digest containing parentheses can't terminate the markdown link early.
|
|
34
|
+
|
|
35
|
+
### 中文
|
|
36
|
+
|
|
37
|
+
- **修复(compaction):压缩卡片现在能在 DSH 里真正渲染、显示真实 token 变化,且不再跨账号重复。**(感谢 @Ronnoc,#79)
|
|
38
|
+
- DSH 的 markdown 渲染器 `allowDangerousHtml: false`,旧的原始 `<div class="agy-compaction-card">` 标记会被转义成可见文本。现改为标准引用块**链接**(`> [✂️ 上下文已压缩 · 128.5k → 14.2k tokens (-89%)](#agy-compaction-card?…)`),由客户端增强器升级为原生卡片;旧的原始/转义标记仍可升级。
|
|
39
|
+
- token 记账只加 `input_tokens`(未缓存增量),导致卡片在 `4.6k → 205` 这种小值就触发;`calcPromptTokens()` 现加上 `cache_read_tokens` + `cache_write_tokens` 得到真实 prompt 规模。
|
|
40
|
+
- 多账号下压缩只清当前账号的绑定,切换账号的后续步骤会重复触发卡片;现按会话清空所有账号的绑定并对重复提示去抖。
|
|
41
|
+
- 合并时加固:标记的查询值额外百分号编码 `( ) ' !`,避免含括号的摘要把 markdown 链接提前截断。
|
|
42
|
+
|
|
43
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.2...v0.6.3
|
|
44
|
+
|
|
3
45
|
## 0.6.2 (2026-11-06)
|
|
4
46
|
|
|
5
47
|
### English
|
package/dist/client.js
CHANGED
|
@@ -139,6 +139,7 @@ window.__ModuleLoader__.load({
|
|
|
139
139
|
"status.loading": "正在加载 Antigravity 状态...",
|
|
140
140
|
"status.authRequired": "需重新登录",
|
|
141
141
|
"account.setActive": "设为当前使用",
|
|
142
|
+
"account.use": "使用",
|
|
142
143
|
"account.settingActive": "切换中",
|
|
143
144
|
"account.activeSet": "已切换当前使用账号",
|
|
144
145
|
"account.activeSetFailed": "该账号当前不可用(冷却或需重新登录)",
|
|
@@ -320,6 +321,7 @@ window.__ModuleLoader__.load({
|
|
|
320
321
|
"status.loading": "Loading Antigravity status...",
|
|
321
322
|
"status.authRequired": "Sign in again required",
|
|
322
323
|
"account.setActive": "Set as in use",
|
|
324
|
+
"account.use": "Use",
|
|
323
325
|
"account.settingActive": "Switching...",
|
|
324
326
|
"account.activeSet": "Active account switched",
|
|
325
327
|
"account.activeSetFailed": "Account not currently eligible (cooldown or auth required)",
|
|
@@ -501,6 +503,7 @@ window.__ModuleLoader__.load({
|
|
|
501
503
|
"status.loading": "Carregando o status do Antigravity...",
|
|
502
504
|
"status.authRequired": "É necessário entrar novamente",
|
|
503
505
|
"account.setActive": "Definir como em uso",
|
|
506
|
+
"account.use": "Usar",
|
|
504
507
|
"account.settingActive": "Alternando...",
|
|
505
508
|
"account.activeSet": "Conta em uso alterada",
|
|
506
509
|
"account.activeSetFailed": "Conta não elegível no momento (cooldown ou login necessário)",
|
|
@@ -682,6 +685,7 @@ window.__ModuleLoader__.load({
|
|
|
682
685
|
"status.loading": "Cargando el estado de Antigravity...",
|
|
683
686
|
"status.authRequired": "Debe iniciar sesión de nuevo",
|
|
684
687
|
"account.setActive": "Establecer como en uso",
|
|
688
|
+
"account.use": "Usar",
|
|
685
689
|
"account.settingActive": "Cambiando...",
|
|
686
690
|
"account.activeSet": "Cuenta en uso cambiada",
|
|
687
691
|
"account.activeSetFailed": "Cuenta no elegible ahora (enfriamiento o requiere login)",
|
|
@@ -4923,79 +4927,165 @@ body.dark .agy-tsl-card,
|
|
|
4923
4927
|
}
|
|
4924
4928
|
return "上下文已压缩";
|
|
4925
4929
|
}
|
|
4930
|
+
function buildCompactionRow(notice) {
|
|
4931
|
+
const { beforeTokens, afterTokens, summary = "" } = notice;
|
|
4932
|
+
const summaryLabel = formatCompactionSummary(beforeTokens, afterTokens);
|
|
4933
|
+
const reductionLabel = calcTokenReduction(beforeTokens, afterTokens);
|
|
4934
|
+
const titleText = getCompactionTitle();
|
|
4935
|
+
const row = document.createElement("div");
|
|
4936
|
+
row.className = "agy-compaction-row";
|
|
4937
|
+
row.setAttribute("data-state", "collapsed");
|
|
4938
|
+
const button = document.createElement("button");
|
|
4939
|
+
button.type = "button";
|
|
4940
|
+
button.className = "agy-compaction-button";
|
|
4941
|
+
button.setAttribute("aria-expanded", "false");
|
|
4942
|
+
button.innerHTML = `
|
|
4943
|
+
<span class="agy-compaction-leading" aria-hidden="true">
|
|
4944
|
+
<svg class="agy-compaction-icon-context" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4945
|
+
<rect x="3" y="4" width="18" height="16" rx="2"></rect>
|
|
4946
|
+
<line x1="7" y1="8" x2="17" y2="8"></line>
|
|
4947
|
+
<line x1="7" y1="12" x2="13" y2="12"></line>
|
|
4948
|
+
<line x1="7" y1="16" x2="11" y2="16"></line>
|
|
4949
|
+
</svg>
|
|
4950
|
+
<svg class="agy-compaction-icon-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4951
|
+
<path d="M9 5l7 7-7 7"></path>
|
|
4952
|
+
</svg>
|
|
4953
|
+
</span>
|
|
4954
|
+
<span class="agy-compaction-title">${titleText}</span>
|
|
4955
|
+
<span class="agy-compaction-sep" aria-hidden="true">·</span>
|
|
4956
|
+
<span class="agy-compaction-summary">${summaryLabel}</span>
|
|
4957
|
+
`;
|
|
4958
|
+
const body = document.createElement("div");
|
|
4959
|
+
body.className = "agy-compaction-body";
|
|
4960
|
+
body.style.display = "none";
|
|
4961
|
+
const metricsBar = document.createElement("div");
|
|
4962
|
+
metricsBar.className = "agy-compaction-metrics-bar";
|
|
4963
|
+
metricsBar.innerHTML = `
|
|
4964
|
+
<span class="agy-metric-item"><strong>压缩前:</strong> ${formatTokenCount(beforeTokens)} tokens</span>
|
|
4965
|
+
<span class="agy-metric-arrow">→</span>
|
|
4966
|
+
<span class="agy-metric-item"><strong>压缩后:</strong> ${formatTokenCount(afterTokens)} tokens</span>
|
|
4967
|
+
<span class="agy-metric-badge">${reductionLabel}</span>
|
|
4968
|
+
`;
|
|
4969
|
+
body.appendChild(metricsBar);
|
|
4970
|
+
if (summary.trim() !== "") {
|
|
4971
|
+
const summaryContent = document.createElement("div");
|
|
4972
|
+
summaryContent.className = "agy-compaction-summary-text";
|
|
4973
|
+
summaryContent.textContent = summary;
|
|
4974
|
+
body.appendChild(summaryContent);
|
|
4975
|
+
}
|
|
4976
|
+
button.addEventListener("click", (e) => {
|
|
4977
|
+
e.stopPropagation();
|
|
4978
|
+
const isExpanded = row.getAttribute("data-state") === "expanded";
|
|
4979
|
+
const nextState = isExpanded ? "collapsed" : "expanded";
|
|
4980
|
+
row.setAttribute("data-state", nextState);
|
|
4981
|
+
button.setAttribute("aria-expanded", String(!isExpanded));
|
|
4982
|
+
body.style.display = isExpanded ? "none" : "block";
|
|
4983
|
+
});
|
|
4984
|
+
row.appendChild(button);
|
|
4985
|
+
row.appendChild(body);
|
|
4986
|
+
return row;
|
|
4987
|
+
}
|
|
4926
4988
|
/**
|
|
4927
|
-
* Scan DOM for
|
|
4989
|
+
* Scan DOM for compaction markers and transform them into
|
|
4928
4990
|
* the interactive DeepSeek-like Compaction Card.
|
|
4929
4991
|
*/
|
|
4930
4992
|
function scanAndEnhanceCompactionCards(root = document) {
|
|
4931
4993
|
if (typeof document === "undefined") return;
|
|
4932
4994
|
if (isInteractionLocked()) return;
|
|
4995
|
+
const anchors = root.querySelectorAll("a[href*=\"#agy-compaction\"]:not([data-agy-compaction-rendered=\"true\"])");
|
|
4996
|
+
for (const anchor of Array.from(anchors)) {
|
|
4997
|
+
anchor.setAttribute("data-agy-compaction-rendered", "true");
|
|
4998
|
+
const href = anchor.getAttribute("href") || "";
|
|
4999
|
+
const qIdx = href.indexOf("?");
|
|
5000
|
+
const queryStr = qIdx >= 0 ? href.slice(qIdx + 1) : "";
|
|
5001
|
+
const params = new URLSearchParams(queryStr);
|
|
5002
|
+
const beforeTokens = parseInt(params.get("before") || "0", 10);
|
|
5003
|
+
const afterTokens = parseInt(params.get("after") || "0", 10);
|
|
5004
|
+
const items = parseInt(params.get("items") || "0", 10);
|
|
5005
|
+
let summary = "";
|
|
5006
|
+
const rawSummary = params.get("summary");
|
|
5007
|
+
if (rawSummary) try {
|
|
5008
|
+
summary = decodeURIComponent(rawSummary);
|
|
5009
|
+
} catch {
|
|
5010
|
+
summary = "";
|
|
5011
|
+
}
|
|
5012
|
+
const container = document.createElement("div");
|
|
5013
|
+
container.className = "agy-compaction-card";
|
|
5014
|
+
container.setAttribute("data-agy-compaction-rendered", "true");
|
|
5015
|
+
const row = buildCompactionRow({
|
|
5016
|
+
beforeTokens,
|
|
5017
|
+
afterTokens,
|
|
5018
|
+
items,
|
|
5019
|
+
summary
|
|
5020
|
+
});
|
|
5021
|
+
container.appendChild(row);
|
|
5022
|
+
let targetNode = anchor;
|
|
5023
|
+
if (targetNode.parentElement && targetNode.parentElement.tagName.toLowerCase() === "p") targetNode = targetNode.parentElement;
|
|
5024
|
+
if (targetNode.parentElement && targetNode.parentElement.tagName.toLowerCase() === "blockquote") targetNode = targetNode.parentElement;
|
|
5025
|
+
if (typeof targetNode.replaceWith === "function") targetNode.replaceWith(container);
|
|
5026
|
+
else if (targetNode.parentNode) targetNode.parentNode.replaceChild(container, targetNode);
|
|
5027
|
+
}
|
|
4933
5028
|
const cards = root.querySelectorAll(".agy-compaction-card:not([data-agy-compaction-rendered=\"true\"])");
|
|
4934
5029
|
for (const card of Array.from(cards)) {
|
|
4935
5030
|
card.setAttribute("data-agy-compaction-rendered", "true");
|
|
4936
5031
|
const beforeTokens = parseInt(card.dataset.before || "0", 10);
|
|
4937
5032
|
const afterTokens = parseInt(card.dataset.after || "0", 10);
|
|
5033
|
+
const items = parseInt(card.dataset.items || "0", 10);
|
|
4938
5034
|
let summary = "";
|
|
4939
5035
|
if (card.dataset.summary) try {
|
|
4940
5036
|
summary = decodeURIComponent(card.dataset.summary);
|
|
4941
5037
|
} catch {
|
|
4942
5038
|
summary = "";
|
|
4943
5039
|
}
|
|
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";
|
|
5040
|
+
const row = buildCompactionRow({
|
|
5041
|
+
beforeTokens,
|
|
5042
|
+
afterTokens,
|
|
5043
|
+
items,
|
|
5044
|
+
summary
|
|
4995
5045
|
});
|
|
4996
5046
|
card.replaceChildren(row);
|
|
4997
|
-
|
|
4998
|
-
|
|
5047
|
+
}
|
|
5048
|
+
const paragraphs = root.querySelectorAll("p:not([data-agy-compaction-rendered=\"true\"])");
|
|
5049
|
+
for (const p of Array.from(paragraphs)) {
|
|
5050
|
+
const text = p.textContent || "";
|
|
5051
|
+
if (!text.includes("class=\"agy-compaction-card\"") && !text.includes("agy-compaction-card")) continue;
|
|
5052
|
+
p.setAttribute("data-agy-compaction-rendered", "true");
|
|
5053
|
+
const beforeMatch = /data-before="(\d+)"/.exec(text);
|
|
5054
|
+
const afterMatch = /data-after="(\d+)"/.exec(text);
|
|
5055
|
+
const itemsMatch = /data-items="(\d+)"/.exec(text);
|
|
5056
|
+
const summaryMatch = /data-summary="([^"]*)"/.exec(text);
|
|
5057
|
+
const beforeTokens = beforeMatch ? parseInt(beforeMatch[1] || "0", 10) : 0;
|
|
5058
|
+
const afterTokens = afterMatch ? parseInt(afterMatch[1] || "0", 10) : 0;
|
|
5059
|
+
const items = itemsMatch ? parseInt(itemsMatch[1] || "0", 10) : 0;
|
|
5060
|
+
let summary = "";
|
|
5061
|
+
if (summaryMatch && summaryMatch[1]) try {
|
|
5062
|
+
summary = decodeURIComponent(summaryMatch[1]);
|
|
5063
|
+
} catch {
|
|
5064
|
+
summary = "";
|
|
5065
|
+
}
|
|
5066
|
+
const container = document.createElement("div");
|
|
5067
|
+
container.className = "agy-compaction-card";
|
|
5068
|
+
container.setAttribute("data-agy-compaction-rendered", "true");
|
|
5069
|
+
const row = buildCompactionRow({
|
|
5070
|
+
beforeTokens,
|
|
5071
|
+
afterTokens,
|
|
5072
|
+
items,
|
|
5073
|
+
summary
|
|
5074
|
+
});
|
|
5075
|
+
container.appendChild(row);
|
|
5076
|
+
let next = p.nextElementSibling;
|
|
5077
|
+
while (next) {
|
|
5078
|
+
const sib = next;
|
|
5079
|
+
const sibTag = sib.tagName ? sib.tagName.toLowerCase() : "";
|
|
5080
|
+
const sibText = (sib.textContent || "").trim();
|
|
5081
|
+
if (sibTag === "blockquote" || sibTag === "p" && (sibText === "</div>" || sibText === "")) {
|
|
5082
|
+
next = sib.nextElementSibling;
|
|
5083
|
+
if (typeof sib.remove === "function") sib.remove();
|
|
5084
|
+
else if (sib.parentNode) sib.parentNode.removeChild(sib);
|
|
5085
|
+
} else break;
|
|
5086
|
+
}
|
|
5087
|
+
if (typeof p.replaceWith === "function") p.replaceWith(container);
|
|
5088
|
+
else if (p.parentNode) p.parentNode.replaceChild(container, p);
|
|
4999
5089
|
}
|
|
5000
5090
|
}
|
|
5001
5091
|
let compactionDispose = null;
|
|
@@ -5587,14 +5677,16 @@ body.dark .agy-tsl-card,
|
|
|
5587
5677
|
style: {
|
|
5588
5678
|
display: "flex",
|
|
5589
5679
|
alignItems: "center",
|
|
5590
|
-
fontSize: "
|
|
5591
|
-
margin: "
|
|
5680
|
+
fontSize: "11px",
|
|
5681
|
+
margin: "1.5px 0"
|
|
5592
5682
|
}
|
|
5593
5683
|
}, h("span", { style: {
|
|
5594
5684
|
width: "64px",
|
|
5685
|
+
minWidth: "64px",
|
|
5686
|
+
maxWidth: "64px",
|
|
5595
5687
|
color: "var(--agy-text-window-label)",
|
|
5596
|
-
fontSize: "
|
|
5597
|
-
fontWeight:
|
|
5688
|
+
fontSize: "10.5px",
|
|
5689
|
+
fontWeight: 600,
|
|
5598
5690
|
flexShrink: 0,
|
|
5599
5691
|
whiteSpace: "nowrap"
|
|
5600
5692
|
} }, windowName), h("div", {
|
|
@@ -5609,46 +5701,62 @@ body.dark .agy-tsl-card,
|
|
|
5609
5701
|
borderRadius: "3px"
|
|
5610
5702
|
}
|
|
5611
5703
|
})), h("div", { style: {
|
|
5612
|
-
display: "
|
|
5704
|
+
display: "flex",
|
|
5613
5705
|
alignItems: "center",
|
|
5614
|
-
gap: "
|
|
5615
|
-
|
|
5616
|
-
|
|
5706
|
+
gap: "6px",
|
|
5707
|
+
width: "235px",
|
|
5708
|
+
minWidth: "235px",
|
|
5709
|
+
maxWidth: "235px",
|
|
5617
5710
|
flexShrink: 0
|
|
5618
5711
|
} }, h("span", {
|
|
5619
5712
|
title: tooltipText,
|
|
5620
5713
|
style: {
|
|
5621
|
-
|
|
5622
|
-
|
|
5714
|
+
width: "38px",
|
|
5715
|
+
minWidth: "38px",
|
|
5716
|
+
maxWidth: "38px",
|
|
5717
|
+
textAlign: "center",
|
|
5718
|
+
boxSizing: "border-box",
|
|
5719
|
+
padding: "1px 0",
|
|
5720
|
+
borderRadius: "3px",
|
|
5623
5721
|
background: c.bg,
|
|
5624
5722
|
color: c.text,
|
|
5625
5723
|
border: `1px solid ${c.border}`,
|
|
5626
5724
|
fontWeight: 700,
|
|
5627
|
-
fontSize: "
|
|
5628
|
-
lineHeight: 1.
|
|
5725
|
+
fontSize: "10.5px",
|
|
5726
|
+
lineHeight: 1.1,
|
|
5727
|
+
flexShrink: 0,
|
|
5629
5728
|
cursor: tooltipText ? "help" : "default"
|
|
5630
5729
|
}
|
|
5631
|
-
}, percent < 0 ? "—" : `${percent}%`),
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5730
|
+
}, percent < 0 ? "—" : `${percent}%`), h("span", {
|
|
5731
|
+
title: resetStr ? `↻ ${resetStr}` : void 0,
|
|
5732
|
+
style: {
|
|
5733
|
+
flex: "1",
|
|
5734
|
+
minWidth: 0,
|
|
5735
|
+
color: "var(--agy-text-secondary)",
|
|
5736
|
+
fontSize: "10px",
|
|
5737
|
+
fontWeight: 500,
|
|
5738
|
+
whiteSpace: "nowrap",
|
|
5739
|
+
overflow: "hidden",
|
|
5740
|
+
textOverflow: "ellipsis"
|
|
5741
|
+
}
|
|
5742
|
+
}, resetStr ? `↻ ${resetStr}` : "")));
|
|
5636
5743
|
};
|
|
5637
|
-
return h("div", {
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5744
|
+
return h("div", {
|
|
5745
|
+
key: familyKey,
|
|
5746
|
+
style: familyKey !== "google" ? {
|
|
5747
|
+
marginTop: "4px",
|
|
5748
|
+
paddingTop: "4px",
|
|
5749
|
+
borderTop: "1px dashed var(--agy-border-box)"
|
|
5750
|
+
} : void 0
|
|
5751
|
+
}, h("div", { style: {
|
|
5644
5752
|
display: "flex",
|
|
5645
5753
|
alignItems: "center",
|
|
5646
|
-
gap: "
|
|
5754
|
+
gap: "5px",
|
|
5647
5755
|
fontWeight: 700,
|
|
5648
|
-
fontSize: "
|
|
5649
|
-
marginBottom: "
|
|
5650
|
-
color: "var(--agy-text-
|
|
5651
|
-
} }, brandIcon(FAMILY_BRAND[familyKey],
|
|
5756
|
+
fontSize: "11px",
|
|
5757
|
+
marginBottom: "2px",
|
|
5758
|
+
color: "var(--agy-text-secondary)"
|
|
5759
|
+
} }, brandIcon(FAMILY_BRAND[familyKey], 12), h("span", null, label)), familyKey !== "argon" || has5h ? renderLine(t("quota.fiveHour"), pct5h, c5h, w5h.resetText ? w5h.resetText + cdNote : expiredFull5h ? t("quota.windowReset") + cdNote : cdNote.replace(/^ · /, ""), info?.remainingFraction, info?.resetTime) : null, renderLine(t("quota.weekly"), pctWeekly, cWeekly, wWeekly.resetText ? wWeekly.resetText : expiredFullWeekly ? t("quota.windowReset") : "", info?.weeklyFraction, info?.weeklyResetTime));
|
|
5652
5760
|
}
|
|
5653
5761
|
const GLOBAL_CSS = `
|
|
5654
5762
|
@keyframes agy-spin {
|
|
@@ -6030,11 +6138,11 @@ html.agy-modal-open body {
|
|
|
6030
6138
|
.agy-modal-panel {
|
|
6031
6139
|
position: relative;
|
|
6032
6140
|
width: 100%;
|
|
6033
|
-
max-width:
|
|
6034
|
-
max-height: min(
|
|
6141
|
+
max-width: 680px;
|
|
6142
|
+
max-height: min(840px, calc(100vh - 48px));
|
|
6035
6143
|
background: var(--agy-bg-panel);
|
|
6036
6144
|
border: 1px solid var(--agy-border-card);
|
|
6037
|
-
border-radius:
|
|
6145
|
+
border-radius: 12px;
|
|
6038
6146
|
box-shadow: var(--agy-shadow-modal);
|
|
6039
6147
|
display: flex;
|
|
6040
6148
|
flex-direction: column;
|
|
@@ -6053,12 +6161,12 @@ html.agy-modal-open body {
|
|
|
6053
6161
|
display: flex;
|
|
6054
6162
|
align-items: center;
|
|
6055
6163
|
justify-content: space-between;
|
|
6056
|
-
padding:
|
|
6057
|
-
font-size:
|
|
6058
|
-
border-radius:
|
|
6164
|
+
padding: 4px 8px;
|
|
6165
|
+
font-size: 11px;
|
|
6166
|
+
border-radius: 5px;
|
|
6059
6167
|
background: var(--agy-bg-subbox);
|
|
6060
6168
|
border: 1px solid var(--agy-border-box);
|
|
6061
|
-
margin:
|
|
6169
|
+
margin: 2px 0;
|
|
6062
6170
|
color: var(--agy-text-primary);
|
|
6063
6171
|
}
|
|
6064
6172
|
|
|
@@ -6142,7 +6250,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6142
6250
|
white-space: nowrap;
|
|
6143
6251
|
}
|
|
6144
6252
|
.agy-quota-line > div:nth-child(2) { grid-area: bar; margin: 0 !important; }
|
|
6145
|
-
.agy-quota-line > div:nth-child(3) { grid-area: cluster; min-width: 0 !important; }
|
|
6253
|
+
.agy-quota-line > div:nth-child(3) { grid-area: cluster; min-width: 0 !important; width: auto !important; }
|
|
6146
6254
|
|
|
6147
6255
|
/* Header actions: the primary action keeps a full row, the two
|
|
6148
6256
|
secondary ones share the next. */
|
|
@@ -6179,13 +6287,14 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6179
6287
|
function injectGlobalStyles() {
|
|
6180
6288
|
if (typeof document === "undefined") return;
|
|
6181
6289
|
const styleId = "dsh-agy-link-global-css";
|
|
6182
|
-
|
|
6183
|
-
|
|
6290
|
+
let st = document.getElementById(styleId);
|
|
6291
|
+
if (st === null) {
|
|
6292
|
+
st = document.createElement("style");
|
|
6184
6293
|
st.id = styleId;
|
|
6185
|
-
st.textContent = GLOBAL_CSS;
|
|
6186
6294
|
const host = document.head ?? document.documentElement;
|
|
6187
6295
|
if (host) host.appendChild(st);
|
|
6188
6296
|
}
|
|
6297
|
+
if (st && st.textContent !== GLOBAL_CSS) st.textContent = GLOBAL_CSS;
|
|
6189
6298
|
}
|
|
6190
6299
|
const S = {
|
|
6191
6300
|
container: {
|
|
@@ -6198,11 +6307,11 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6198
6307
|
display: "flex",
|
|
6199
6308
|
alignItems: "center",
|
|
6200
6309
|
justifyContent: "space-between",
|
|
6201
|
-
padding: "12px
|
|
6310
|
+
padding: "8px 12px",
|
|
6202
6311
|
background: "var(--agy-bg-header)",
|
|
6203
6312
|
border: "1px solid var(--agy-border-card)",
|
|
6204
|
-
borderRadius: "
|
|
6205
|
-
marginBottom: "
|
|
6313
|
+
borderRadius: "8px",
|
|
6314
|
+
marginBottom: "8px",
|
|
6206
6315
|
color: "var(--agy-text-primary)",
|
|
6207
6316
|
boxShadow: "var(--agy-shadow-card)"
|
|
6208
6317
|
},
|
|
@@ -6228,7 +6337,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6228
6337
|
padding: "2px 7px",
|
|
6229
6338
|
borderRadius: "5px",
|
|
6230
6339
|
fontSize: "11px",
|
|
6231
|
-
fontWeight: 600
|
|
6340
|
+
fontWeight: 600,
|
|
6341
|
+
whiteSpace: "nowrap",
|
|
6342
|
+
flexShrink: 0
|
|
6232
6343
|
},
|
|
6233
6344
|
badgeReady: {
|
|
6234
6345
|
display: "inline-flex",
|
|
@@ -6258,8 +6369,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6258
6369
|
background: "var(--agy-bg-card)",
|
|
6259
6370
|
border: "1px solid var(--agy-border-card)",
|
|
6260
6371
|
borderRadius: "8px",
|
|
6261
|
-
padding: "10px
|
|
6262
|
-
marginBottom: "
|
|
6372
|
+
padding: "8px 10px",
|
|
6373
|
+
marginBottom: "6px",
|
|
6263
6374
|
color: "var(--agy-text-primary)",
|
|
6264
6375
|
boxShadow: "var(--agy-shadow-card)",
|
|
6265
6376
|
transition: "border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease"
|
|
@@ -6268,27 +6379,27 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6268
6379
|
background: "var(--agy-bg-card)",
|
|
6269
6380
|
border: "1px solid var(--agy-border-card)",
|
|
6270
6381
|
borderRadius: "8px",
|
|
6271
|
-
padding: "10px
|
|
6272
|
-
marginBottom: "
|
|
6382
|
+
padding: "8px 10px",
|
|
6383
|
+
marginBottom: "6px",
|
|
6273
6384
|
color: "var(--agy-text-primary)",
|
|
6274
6385
|
boxShadow: "var(--agy-shadow-card)",
|
|
6275
6386
|
transition: "border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease"
|
|
6276
6387
|
},
|
|
6277
6388
|
quotaBox: {
|
|
6278
|
-
background: "var(--agy-bg-
|
|
6389
|
+
background: "var(--agy-bg-subbox)",
|
|
6279
6390
|
border: "1px solid var(--agy-border-box)",
|
|
6280
|
-
borderRadius: "
|
|
6281
|
-
padding: "8px
|
|
6282
|
-
marginTop: "
|
|
6391
|
+
borderRadius: "6px",
|
|
6392
|
+
padding: "5px 8px",
|
|
6393
|
+
marginTop: "5px"
|
|
6283
6394
|
},
|
|
6284
6395
|
progressBarBg: {
|
|
6285
6396
|
flex: "1",
|
|
6286
|
-
height: "
|
|
6287
|
-
borderRadius: "
|
|
6397
|
+
height: "6px",
|
|
6398
|
+
borderRadius: "3px",
|
|
6288
6399
|
background: "var(--agy-bg-progress-track)",
|
|
6289
6400
|
border: "1px solid var(--agy-border-box)",
|
|
6290
6401
|
overflow: "hidden",
|
|
6291
|
-
margin: "0
|
|
6402
|
+
margin: "0 8px"
|
|
6292
6403
|
},
|
|
6293
6404
|
btn: {
|
|
6294
6405
|
display: "inline-flex",
|
|
@@ -6321,8 +6432,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6321
6432
|
display: "inline-flex",
|
|
6322
6433
|
alignItems: "center",
|
|
6323
6434
|
justifyContent: "center",
|
|
6324
|
-
padding: "
|
|
6325
|
-
borderRadius: "
|
|
6435
|
+
padding: "2px 6px",
|
|
6436
|
+
borderRadius: "4px",
|
|
6326
6437
|
border: "1px solid var(--agy-danger-border)",
|
|
6327
6438
|
background: "var(--agy-danger-bg)",
|
|
6328
6439
|
color: "var(--agy-danger-text)",
|
|
@@ -6334,26 +6445,26 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6334
6445
|
display: "inline-flex",
|
|
6335
6446
|
alignItems: "center",
|
|
6336
6447
|
justifyContent: "center",
|
|
6337
|
-
padding: "
|
|
6338
|
-
borderRadius: "
|
|
6448
|
+
padding: "2px 6px",
|
|
6449
|
+
borderRadius: "4px",
|
|
6339
6450
|
border: "1px solid var(--agy-border-btn)",
|
|
6340
6451
|
background: "var(--agy-bg-btn)",
|
|
6341
6452
|
color: "var(--agy-text-btn)",
|
|
6342
6453
|
cursor: "pointer",
|
|
6343
|
-
fontSize: "
|
|
6454
|
+
fontSize: "11px",
|
|
6344
6455
|
fontWeight: 600
|
|
6345
6456
|
},
|
|
6346
6457
|
btnSmPrimary: {
|
|
6347
6458
|
display: "inline-flex",
|
|
6348
6459
|
alignItems: "center",
|
|
6349
6460
|
justifyContent: "center",
|
|
6350
|
-
padding: "
|
|
6351
|
-
borderRadius: "
|
|
6461
|
+
padding: "2px 6px",
|
|
6462
|
+
borderRadius: "4px",
|
|
6352
6463
|
border: "1px solid var(--agy-border-btn-primary)",
|
|
6353
6464
|
background: "var(--agy-bg-btn-primary)",
|
|
6354
6465
|
color: "var(--agy-text-btn-primary)",
|
|
6355
6466
|
cursor: "pointer",
|
|
6356
|
-
fontSize: "
|
|
6467
|
+
fontSize: "11px",
|
|
6357
6468
|
fontWeight: 700
|
|
6358
6469
|
},
|
|
6359
6470
|
segGroup: {
|
|
@@ -6864,8 +6975,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6864
6975
|
const cardStyle = {
|
|
6865
6976
|
...S.card,
|
|
6866
6977
|
cursor: "default",
|
|
6867
|
-
padding: "10px
|
|
6868
|
-
marginBottom: "
|
|
6978
|
+
padding: "8px 10px",
|
|
6979
|
+
marginBottom: "6px",
|
|
6869
6980
|
...!acc.enabled ? { opacity: .72 } : {}
|
|
6870
6981
|
};
|
|
6871
6982
|
const legacyDefault = acc.defaultAlias === void 0 && acc.systemHome && acc.alias === "主账号 (系统登录)";
|
|
@@ -6901,21 +7012,22 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6901
7012
|
alignItems: "center",
|
|
6902
7013
|
justifyContent: "space-between",
|
|
6903
7014
|
userSelect: "none",
|
|
6904
|
-
gap: "
|
|
6905
|
-
marginBottom: "
|
|
7015
|
+
gap: "6px",
|
|
7016
|
+
marginBottom: "4px"
|
|
6906
7017
|
} }, h("div", { style: {
|
|
6907
7018
|
display: "flex",
|
|
6908
7019
|
alignItems: "center",
|
|
6909
|
-
gap: "
|
|
6910
|
-
flexWrap: "
|
|
7020
|
+
gap: "4px",
|
|
7021
|
+
flexWrap: "nowrap",
|
|
6911
7022
|
flex: "1",
|
|
6912
|
-
minWidth: 0
|
|
7023
|
+
minWidth: 0,
|
|
7024
|
+
overflow: "hidden"
|
|
6913
7025
|
} }, h("span", {
|
|
6914
7026
|
style: {
|
|
6915
7027
|
...S.badgeTag,
|
|
6916
7028
|
fontWeight: 700,
|
|
6917
|
-
fontSize: "
|
|
6918
|
-
padding: "1px
|
|
7029
|
+
fontSize: "10px",
|
|
7030
|
+
padding: "1px 4px",
|
|
6919
7031
|
background: isPrimary ? "var(--agy-badge-primary-bg)" : "var(--agy-badge-tag-bg)",
|
|
6920
7032
|
color: isPrimary ? "var(--agy-badge-primary-text)" : "var(--agy-badge-tag-text)",
|
|
6921
7033
|
borderColor: isPrimary ? "var(--agy-badge-primary-border)" : "var(--agy-badge-tag-border)"
|
|
@@ -6930,36 +7042,36 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6930
7042
|
className: "agy-btn",
|
|
6931
7043
|
style: {
|
|
6932
7044
|
...S.btnSm,
|
|
6933
|
-
padding: "1px
|
|
6934
|
-
fontSize: "
|
|
7045
|
+
padding: "1px 3px",
|
|
7046
|
+
fontSize: "9px",
|
|
6935
7047
|
lineHeight: 1,
|
|
6936
|
-
height: "
|
|
7048
|
+
height: "17px"
|
|
6937
7049
|
},
|
|
6938
7050
|
title: t("account.moveUp"),
|
|
6939
7051
|
onClick: () => void moveAccount(acc.id, -1)
|
|
6940
|
-
}, uiIcon("arrowUp",
|
|
7052
|
+
}, uiIcon("arrowUp", 9)) : null, accIndex < accounts.length - 1 ? h("button", {
|
|
6941
7053
|
type: "button",
|
|
6942
7054
|
className: "agy-btn",
|
|
6943
7055
|
style: {
|
|
6944
7056
|
...S.btnSm,
|
|
6945
|
-
padding: "1px
|
|
6946
|
-
fontSize: "
|
|
7057
|
+
padding: "1px 3px",
|
|
7058
|
+
fontSize: "9px",
|
|
6947
7059
|
lineHeight: 1,
|
|
6948
|
-
height: "
|
|
7060
|
+
height: "17px"
|
|
6949
7061
|
},
|
|
6950
7062
|
title: t("account.moveDown"),
|
|
6951
7063
|
onClick: () => void moveAccount(acc.id, 1)
|
|
6952
|
-
}, uiIcon("arrowDown",
|
|
7064
|
+
}, uiIcon("arrowDown", 9)) : null) : null, h("span", {
|
|
6953
7065
|
className: "agy-pulse-dot",
|
|
6954
7066
|
style: {
|
|
6955
7067
|
background: dotColor,
|
|
6956
|
-
boxShadow: `0 0
|
|
7068
|
+
boxShadow: `0 0 5px ${dotColor}aa`,
|
|
6957
7069
|
marginLeft: "1px"
|
|
6958
7070
|
}
|
|
6959
7071
|
}), h("span", {
|
|
6960
7072
|
style: {
|
|
6961
7073
|
fontWeight: 700,
|
|
6962
|
-
fontSize: "
|
|
7074
|
+
fontSize: "12px",
|
|
6963
7075
|
color: "var(--agy-text-primary)",
|
|
6964
7076
|
whiteSpace: "nowrap"
|
|
6965
7077
|
},
|
|
@@ -6969,8 +7081,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6969
7081
|
background: "rgba(59, 130, 246, 0.12)",
|
|
6970
7082
|
color: "#3b82f6",
|
|
6971
7083
|
borderColor: "rgba(59, 130, 246, 0.35)",
|
|
6972
|
-
fontSize: "
|
|
6973
|
-
padding: "1px
|
|
7084
|
+
fontSize: "9.5px",
|
|
7085
|
+
padding: "1px 4px",
|
|
6974
7086
|
fontWeight: 700
|
|
6975
7087
|
} }, "AGY"), isAuthRequired ? h("span", { style: {
|
|
6976
7088
|
...S.badgeTag,
|
|
@@ -6978,43 +7090,53 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
6978
7090
|
color: "#ef4444",
|
|
6979
7091
|
borderColor: "#fca5a5",
|
|
6980
7092
|
gap: "3px",
|
|
6981
|
-
fontSize: "
|
|
6982
|
-
padding: "1px
|
|
6983
|
-
fontWeight: 700
|
|
6984
|
-
|
|
7093
|
+
fontSize: "9.5px",
|
|
7094
|
+
padding: "1px 4px",
|
|
7095
|
+
fontWeight: 700,
|
|
7096
|
+
whiteSpace: "nowrap",
|
|
7097
|
+
flexShrink: 0
|
|
7098
|
+
} }, uiIcon("alert", 9, "#ef4444"), t("status.authRequired")) : null, hasCooldown ? h("span", { style: {
|
|
6985
7099
|
...S.badgeTag,
|
|
6986
7100
|
background: "rgba(245, 158, 11, 0.15)",
|
|
6987
7101
|
color: "#f59e0b",
|
|
6988
7102
|
borderColor: "rgba(245, 158, 11, 0.4)",
|
|
6989
7103
|
gap: "3px",
|
|
6990
|
-
fontSize: "
|
|
6991
|
-
padding: "1px
|
|
6992
|
-
fontWeight: 700
|
|
6993
|
-
|
|
7104
|
+
fontSize: "9.5px",
|
|
7105
|
+
padding: "1px 4px",
|
|
7106
|
+
fontWeight: 700,
|
|
7107
|
+
whiteSpace: "nowrap",
|
|
7108
|
+
flexShrink: 0
|
|
7109
|
+
} }, uiIcon("alert", 9, "#f59e0b"), "冷却中") : null, acc.email ? h("span", {
|
|
6994
7110
|
style: {
|
|
6995
7111
|
...S.badgeTag,
|
|
6996
7112
|
background: "var(--agy-badge-email-bg)",
|
|
6997
7113
|
color: "var(--agy-badge-email-text)",
|
|
6998
7114
|
borderColor: "var(--agy-badge-email-border)",
|
|
6999
|
-
gap: "
|
|
7000
|
-
fontSize: "
|
|
7001
|
-
padding: "1px
|
|
7002
|
-
|
|
7115
|
+
gap: "3px",
|
|
7116
|
+
fontSize: "10px",
|
|
7117
|
+
padding: "1px 5px",
|
|
7118
|
+
maxWidth: "135px",
|
|
7119
|
+
overflow: "hidden",
|
|
7120
|
+
textOverflow: "ellipsis",
|
|
7121
|
+
whiteSpace: "nowrap",
|
|
7122
|
+
flexShrink: 1
|
|
7003
7123
|
},
|
|
7004
7124
|
title: acc.email
|
|
7005
|
-
}, uiIcon("mail",
|
|
7125
|
+
}, uiIcon("mail", 9, "var(--agy-badge-email-text)"), acc.email) : null, isInUse ? h("span", {
|
|
7006
7126
|
style: {
|
|
7007
7127
|
...S.badgeTag,
|
|
7008
7128
|
background: "rgba(16, 185, 129, 0.12)",
|
|
7009
7129
|
color: "#10b981",
|
|
7010
7130
|
borderColor: "rgba(16, 185, 129, 0.45)",
|
|
7011
|
-
gap: "
|
|
7012
|
-
fontSize: "
|
|
7013
|
-
padding: "1px
|
|
7014
|
-
fontWeight: 700
|
|
7131
|
+
gap: "2px",
|
|
7132
|
+
fontSize: "9.5px",
|
|
7133
|
+
padding: "1px 4px",
|
|
7134
|
+
fontWeight: 700,
|
|
7135
|
+
whiteSpace: "nowrap",
|
|
7136
|
+
flexShrink: 0
|
|
7015
7137
|
},
|
|
7016
7138
|
title: t("status.inUse")
|
|
7017
|
-
}, uiIcon("zap",
|
|
7139
|
+
}, uiIcon("zap", 9, "#10b981"), t("status.inUse")) : null, (() => {
|
|
7018
7140
|
const effectiveProxy = acc.proxyUrl || pool?.systemProxy;
|
|
7019
7141
|
return effectiveProxy ? h("span", {
|
|
7020
7142
|
style: {
|
|
@@ -7022,29 +7144,29 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7022
7144
|
background: "var(--agy-badge-proxy-bg)",
|
|
7023
7145
|
color: "var(--agy-badge-proxy-text)",
|
|
7024
7146
|
borderColor: "var(--agy-badge-proxy-border)",
|
|
7025
|
-
gap: "
|
|
7026
|
-
fontSize: "
|
|
7027
|
-
padding: "1px
|
|
7147
|
+
gap: "3px",
|
|
7148
|
+
fontSize: "9.5px",
|
|
7149
|
+
padding: "1px 4px"
|
|
7028
7150
|
},
|
|
7029
7151
|
title: effectiveProxy
|
|
7030
|
-
}, uiIcon("globe",
|
|
7152
|
+
}, uiIcon("globe", 9, "var(--agy-badge-proxy-text)"), t("status.proxy")) : null;
|
|
7031
7153
|
})(), !acc.enabled ? h("span", {
|
|
7032
7154
|
style: {
|
|
7033
7155
|
...S.badgeTag,
|
|
7034
7156
|
background: "var(--agy-bg-subbox)",
|
|
7035
7157
|
color: "var(--agy-text-secondary)",
|
|
7036
7158
|
borderColor: "var(--agy-border-subbox)",
|
|
7037
|
-
gap: "
|
|
7038
|
-
fontSize: "
|
|
7039
|
-
padding: "1px
|
|
7159
|
+
gap: "2px",
|
|
7160
|
+
fontSize: "9.5px",
|
|
7161
|
+
padding: "1px 4px",
|
|
7040
7162
|
fontWeight: 700
|
|
7041
7163
|
},
|
|
7042
7164
|
title: t("status.disabled")
|
|
7043
|
-
}, uiIcon("power",
|
|
7165
|
+
}, uiIcon("power", 9, "#64748b"), t("status.disabled")) : null), h("div", {
|
|
7044
7166
|
className: "agy-card-actions",
|
|
7045
7167
|
style: {
|
|
7046
7168
|
display: "flex",
|
|
7047
|
-
gap: "
|
|
7169
|
+
gap: "3px",
|
|
7048
7170
|
alignItems: "center",
|
|
7049
7171
|
flexShrink: 0
|
|
7050
7172
|
}
|
|
@@ -7053,87 +7175,93 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7053
7175
|
className: "agy-btn",
|
|
7054
7176
|
style: acc.enabled ? {
|
|
7055
7177
|
...S.btnSm,
|
|
7056
|
-
gap: "
|
|
7057
|
-
fontSize: "
|
|
7058
|
-
padding: "
|
|
7178
|
+
gap: "2px",
|
|
7179
|
+
fontSize: "10.5px",
|
|
7180
|
+
padding: "1px 5px",
|
|
7181
|
+
height: "21px"
|
|
7059
7182
|
} : {
|
|
7060
7183
|
...S.btnSmPrimary,
|
|
7061
|
-
gap: "
|
|
7062
|
-
fontSize: "
|
|
7063
|
-
padding: "
|
|
7184
|
+
gap: "2px",
|
|
7185
|
+
fontSize: "10.5px",
|
|
7186
|
+
padding: "1px 5px",
|
|
7187
|
+
height: "21px"
|
|
7064
7188
|
},
|
|
7065
7189
|
title: acc.enabled ? t("account.disableTitle") : t("account.enableTitle"),
|
|
7066
7190
|
disabled: accountActionBusy(acc, "enable"),
|
|
7067
7191
|
onClick: () => void toggleAccountEnabled(acc)
|
|
7068
|
-
}, loadingAction === `enable:${acc.id}` ? [renderSpinner(), acc.enabled ? t("account.disable") : t("account.enable")] : [uiIcon("power",
|
|
7192
|
+
}, loadingAction === `enable:${acc.id}` ? [renderSpinner(), acc.enabled ? t("account.disable") : t("account.enable")] : [uiIcon("power", 9, acc.enabled ? "var(--agy-text-secondary)" : "#ffffff"), ` ${acc.enabled ? t("account.disable") : t("account.enable")}`]), h("button", {
|
|
7069
7193
|
type: "button",
|
|
7070
7194
|
className: "agy-btn",
|
|
7071
7195
|
style: {
|
|
7072
7196
|
...S.btnSm,
|
|
7073
|
-
gap: "
|
|
7074
|
-
fontSize: "
|
|
7075
|
-
padding: "
|
|
7076
|
-
|
|
7197
|
+
gap: "2px",
|
|
7198
|
+
fontSize: "10.5px",
|
|
7199
|
+
padding: "1px 5px",
|
|
7200
|
+
height: "21px",
|
|
7077
7201
|
justifyContent: "center"
|
|
7078
7202
|
},
|
|
7079
7203
|
title: t("account.syncTitle"),
|
|
7080
7204
|
disabled: accountActionBusy(acc, "refresh"),
|
|
7081
7205
|
onClick: () => void refreshQuota(acc.id)
|
|
7082
|
-
}, loadingAction === `refresh:${acc.id}` ? [renderSpinner(), t("account.syncing")] : [uiIcon("refresh",
|
|
7206
|
+
}, loadingAction === `refresh:${acc.id}` ? [renderSpinner(), t("account.syncing")] : [uiIcon("refresh", 9), ` ${t("account.sync")}`]), acc.enabled && !acc.authRequired ? h("button", {
|
|
7083
7207
|
type: "button",
|
|
7084
7208
|
className: "agy-btn",
|
|
7085
7209
|
style: {
|
|
7086
7210
|
...S.btnSm,
|
|
7087
|
-
gap: "
|
|
7088
|
-
fontSize: "
|
|
7089
|
-
padding: "
|
|
7090
|
-
|
|
7211
|
+
gap: "2px",
|
|
7212
|
+
fontSize: "10.5px",
|
|
7213
|
+
padding: "1px 5px",
|
|
7214
|
+
height: "21px",
|
|
7091
7215
|
justifyContent: "center"
|
|
7092
7216
|
},
|
|
7093
7217
|
title: t("account.warmupTitle"),
|
|
7094
7218
|
disabled: accountActionBusy(acc, "warmup"),
|
|
7095
7219
|
onClick: () => void warmupAccount(acc.id)
|
|
7096
|
-
}, loadingAction === `warmup:${acc.id}` ? [renderSpinner(), t("account.warmingUp")] : [uiIcon("flame",
|
|
7220
|
+
}, loadingAction === `warmup:${acc.id}` ? [renderSpinner(), t("account.warmingUp")] : [uiIcon("flame", 9, "#f97316"), ` ${t("account.warmup")}`]) : null, acc.enabled && !isInUse ? h("button", {
|
|
7097
7221
|
type: "button",
|
|
7098
7222
|
className: "agy-btn",
|
|
7099
7223
|
style: {
|
|
7100
7224
|
...S.btnSm,
|
|
7101
|
-
gap: "
|
|
7102
|
-
fontSize: "
|
|
7103
|
-
padding: "
|
|
7225
|
+
gap: "2px",
|
|
7226
|
+
fontSize: "10.5px",
|
|
7227
|
+
padding: "1px 5px",
|
|
7228
|
+
height: "21px"
|
|
7104
7229
|
},
|
|
7105
7230
|
title: t("account.setActive"),
|
|
7106
7231
|
disabled: accountActionBusy(acc, "active"),
|
|
7107
7232
|
onClick: () => void setActiveAccount(acc.id)
|
|
7108
|
-
}, loadingAction === `active:${acc.id}` ? [renderSpinner(), t("account.settingActive")] : [uiIcon("zap",
|
|
7233
|
+
}, loadingAction === `active:${acc.id}` ? [renderSpinner(), t("account.settingActive")] : [uiIcon("zap", 9), ` ${t("account.use")}`]) : null, h("button", {
|
|
7109
7234
|
type: "button",
|
|
7110
7235
|
className: "agy-btn",
|
|
7111
7236
|
style: isEditingProxy ? {
|
|
7112
7237
|
...S.btnSmPrimary,
|
|
7113
|
-
gap: "
|
|
7114
|
-
fontSize: "
|
|
7115
|
-
padding: "
|
|
7238
|
+
gap: "2px",
|
|
7239
|
+
fontSize: "10.5px",
|
|
7240
|
+
padding: "1px 5px",
|
|
7241
|
+
height: "21px"
|
|
7116
7242
|
} : {
|
|
7117
7243
|
...S.btnSm,
|
|
7118
|
-
gap: "
|
|
7119
|
-
fontSize: "
|
|
7120
|
-
padding: "
|
|
7244
|
+
gap: "2px",
|
|
7245
|
+
fontSize: "10.5px",
|
|
7246
|
+
padding: "1px 5px",
|
|
7247
|
+
height: "21px"
|
|
7121
7248
|
},
|
|
7122
7249
|
disabled: accountActionBusy(acc, "proxy"),
|
|
7123
7250
|
onClick: () => setEditingProxyId(isEditingProxy ? null : acc.id)
|
|
7124
|
-
}, [uiIcon("globe",
|
|
7251
|
+
}, [uiIcon("globe", 9), ` ${t("proxy.button")}`]), accounts.length > 1 ? h("button", {
|
|
7125
7252
|
type: "button",
|
|
7126
7253
|
className: "agy-btn",
|
|
7127
7254
|
style: {
|
|
7128
7255
|
...S.btnDanger,
|
|
7129
|
-
padding: "
|
|
7130
|
-
fontSize: "
|
|
7256
|
+
padding: "1px 5px",
|
|
7257
|
+
fontSize: "10.5px",
|
|
7258
|
+
height: "21px"
|
|
7131
7259
|
},
|
|
7132
7260
|
title: t("account.removeTitle"),
|
|
7133
7261
|
"aria-label": t("account.removeTitle"),
|
|
7134
7262
|
disabled: accountActionBusy(acc, "remove"),
|
|
7135
7263
|
onClick: () => void removeAccount(acc.id, displayAlias)
|
|
7136
|
-
}, loadingAction === `remove:${acc.id}` ? renderSpinner() : uiIcon("trash",
|
|
7264
|
+
}, loadingAction === `remove:${acc.id}` ? renderSpinner() : uiIcon("trash", 10, "var(--agy-danger-text)")) : null)), h("div", {
|
|
7137
7265
|
key: "agy-body",
|
|
7138
7266
|
style: S.quotaBox
|
|
7139
7267
|
}, renderQuotaBar("Gemini", "google", acc), acc.quotas.argon ? renderQuotaBar("Argon", "argon", acc) : null, h("button", {
|
|
@@ -7144,19 +7272,20 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7144
7272
|
display: "flex",
|
|
7145
7273
|
alignItems: "center",
|
|
7146
7274
|
justifyContent: "center",
|
|
7147
|
-
gap: "
|
|
7148
|
-
marginTop: "
|
|
7149
|
-
padding: "
|
|
7150
|
-
fontSize: "
|
|
7275
|
+
gap: "4px",
|
|
7276
|
+
marginTop: "3px",
|
|
7277
|
+
padding: "2px 8px",
|
|
7278
|
+
fontSize: "10.5px",
|
|
7151
7279
|
fontWeight: 600,
|
|
7152
7280
|
cursor: "pointer",
|
|
7153
7281
|
color: isExpanded ? "var(--dsw-alias-state-business-primary, #3b82f6)" : "var(--agy-text-secondary)",
|
|
7154
|
-
background: "
|
|
7155
|
-
border: "
|
|
7156
|
-
borderRadius: "
|
|
7282
|
+
background: "transparent",
|
|
7283
|
+
border: "none",
|
|
7284
|
+
borderRadius: "4px",
|
|
7285
|
+
opacity: .85
|
|
7157
7286
|
},
|
|
7158
7287
|
onClick: () => toggleExpand(acc.id)
|
|
7159
|
-
}, uiIcon(isExpanded ? "chevronUp" : "chevronDown",
|
|
7288
|
+
}, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 9), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? [
|
|
7160
7289
|
renderQuotaBar("Claude", "anthropic", acc),
|
|
7161
7290
|
renderQuotaBar("GPT-OSS", "openai", acc),
|
|
7162
7291
|
allChildModels.length > 0 ? h("div", { style: {
|
|
@@ -7422,7 +7551,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7422
7551
|
display: "flex",
|
|
7423
7552
|
alignItems: "center",
|
|
7424
7553
|
justifyContent: "space-between",
|
|
7425
|
-
marginBottom: "
|
|
7554
|
+
marginBottom: "5px",
|
|
7426
7555
|
padding: "0 2px"
|
|
7427
7556
|
} }, h("div", { style: {
|
|
7428
7557
|
display: "flex",
|
|
@@ -7430,7 +7559,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7430
7559
|
gap: "6px"
|
|
7431
7560
|
} }, h("span", { style: {
|
|
7432
7561
|
fontWeight: 700,
|
|
7433
|
-
fontSize: "
|
|
7562
|
+
fontSize: "12px",
|
|
7434
7563
|
color: "var(--agy-text-primary)"
|
|
7435
7564
|
} }, `账号池 (${accounts.length})`))), renderedAccountCards, h("div", { style: {
|
|
7436
7565
|
marginTop: "16px",
|
|
@@ -7650,7 +7779,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7650
7779
|
display: "flex",
|
|
7651
7780
|
alignItems: "center",
|
|
7652
7781
|
justifyContent: "space-between",
|
|
7653
|
-
padding: "
|
|
7782
|
+
padding: "10px 16px",
|
|
7654
7783
|
borderBottom: "1px solid var(--agy-border-card)",
|
|
7655
7784
|
background: "var(--agy-bg-header)",
|
|
7656
7785
|
color: "var(--agy-text-primary)"
|
|
@@ -7686,7 +7815,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
|
|
|
7686
7815
|
style: {
|
|
7687
7816
|
overflowY: "auto",
|
|
7688
7817
|
overscrollBehavior: "contain",
|
|
7689
|
-
padding: "
|
|
7818
|
+
padding: "12px 14px",
|
|
7690
7819
|
flex: "1",
|
|
7691
7820
|
minHeight: 0,
|
|
7692
7821
|
background: "var(--agy-bg-panel)"
|
package/dist/index.js
CHANGED
|
@@ -1749,8 +1749,50 @@ function parseGoalRoundText(text) {
|
|
|
1749
1749
|
};
|
|
1750
1750
|
}
|
|
1751
1751
|
/**
|
|
1752
|
+
* Harness-injected user-role source kinds. They are metadata, not instructions,
|
|
1753
|
+
* and must stay transparent to the trailing-span scans.
|
|
1754
|
+
*/
|
|
1755
|
+
const HARNESS_USER_SOURCE_KINDS = /* @__PURE__ */ new Set([
|
|
1756
|
+
"time-context",
|
|
1757
|
+
"skill-catalog",
|
|
1758
|
+
"runtime-context",
|
|
1759
|
+
"model-selection",
|
|
1760
|
+
"system-reminder",
|
|
1761
|
+
"dsh-session-title-llm",
|
|
1762
|
+
"tool-goal",
|
|
1763
|
+
"synthetic"
|
|
1764
|
+
]);
|
|
1765
|
+
/** Whether this user-role message was injected by the harness, not typed by a human. */
|
|
1766
|
+
function isHarnessInjectedMessage(m) {
|
|
1767
|
+
const src = m.source;
|
|
1768
|
+
if (!src || typeof src !== "object") return false;
|
|
1769
|
+
if (typeof src.kind === "string" && HARNESS_USER_SOURCE_KINDS.has(src.kind)) return true;
|
|
1770
|
+
return src.kind === "plugin" && src.form === "snapshot";
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* A genuine human instruction (the current turn's task). Goal-round prompts
|
|
1774
|
+
* (`source.kind === 'goal'`) and harness metadata are not human instructions.
|
|
1775
|
+
*/
|
|
1776
|
+
function isGenuineUserMessage(m) {
|
|
1777
|
+
if (m.role !== "user") return false;
|
|
1778
|
+
const src = m.source;
|
|
1779
|
+
if (src && typeof src === "object" && src.kind === "goal") return false;
|
|
1780
|
+
if (isHarnessInjectedMessage(m)) return false;
|
|
1781
|
+
const text = extractText$1(m);
|
|
1782
|
+
if (text.trim() === "") return false;
|
|
1783
|
+
return !isHarnessInjectedUserText(text);
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1752
1786
|
* Detect whether the incoming request is part of a DSH <goal_round> continuation.
|
|
1753
1787
|
* Extracts goalId, revision, round, and objective if available.
|
|
1788
|
+
*
|
|
1789
|
+
* The scan stops at the newest genuine human message: goal markers BEFORE it
|
|
1790
|
+
* belong to an earlier (possibly already completed) goal and must not leak into
|
|
1791
|
+
* this turn's request. Without that stop every later turn in a session that had
|
|
1792
|
+
* ever run a goal re-synthesized `update_goal(complete)` for the stale goal —
|
|
1793
|
+
* with a deterministic call id, so the transcript accumulated identical
|
|
1794
|
+
* `tool_call` ids and HTTP providers rejected it with
|
|
1795
|
+
* `400 Duplicate 'call_id'` (2026-11-07 incident).
|
|
1754
1796
|
*/
|
|
1755
1797
|
function detectGoalContext(messages) {
|
|
1756
1798
|
let goalId;
|
|
@@ -1781,6 +1823,7 @@ function detectGoalContext(messages) {
|
|
|
1781
1823
|
if (!objective && parsed.objective) objective = parsed.objective;
|
|
1782
1824
|
}
|
|
1783
1825
|
}
|
|
1826
|
+
if (isGenuineUserMessage(m)) break;
|
|
1784
1827
|
}
|
|
1785
1828
|
if (isGoal) return {
|
|
1786
1829
|
goalId,
|
|
@@ -1792,6 +1835,28 @@ function detectGoalContext(messages) {
|
|
|
1792
1835
|
return null;
|
|
1793
1836
|
}
|
|
1794
1837
|
/**
|
|
1838
|
+
* Resolve the goal context that a turn may complete.
|
|
1839
|
+
*
|
|
1840
|
+
* - `live === null`: the host's goal service says there is no active, armed
|
|
1841
|
+
* goal — never synthesize a completion (this is what prevents stale history
|
|
1842
|
+
* from marking an already-completed goal again).
|
|
1843
|
+
* - `live === undefined`: the live goal service is unavailable; fall back to
|
|
1844
|
+
* history detection for that host.
|
|
1845
|
+
* - Otherwise the live view supplies the authoritative id/revision, and a
|
|
1846
|
+
* completion is only emitted for a goal round — a direct human turn must not
|
|
1847
|
+
* silently complete an armed goal.
|
|
1848
|
+
*/
|
|
1849
|
+
function resolveGoalContext(messages, live) {
|
|
1850
|
+
const round = detectGoalContext(messages);
|
|
1851
|
+
if (live === null) return null;
|
|
1852
|
+
if (live === void 0) return round;
|
|
1853
|
+
if (round === null) return null;
|
|
1854
|
+
return {
|
|
1855
|
+
goalId: live.goalId,
|
|
1856
|
+
revision: live.revision
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1795
1860
|
* Detect whether DSH is in Plan Mode.
|
|
1796
1861
|
* DSH plan-mode injects "You are in plan mode" into the runtime context prompt.
|
|
1797
1862
|
*/
|
|
@@ -1850,6 +1915,12 @@ function isPlanToolContinuation(messages) {
|
|
|
1850
1915
|
if (typeof callId === "string" && callId.startsWith("agytc-bridge-plan-")) return true;
|
|
1851
1916
|
return false;
|
|
1852
1917
|
}
|
|
1918
|
+
let goalCallSeq = 0;
|
|
1919
|
+
/** Mint a unique id for one synthetic goal-completion tool call. */
|
|
1920
|
+
function nextGoalCallId(goalId, revision) {
|
|
1921
|
+
goalCallSeq += 1;
|
|
1922
|
+
return toToolCallId$1(`agytc-bridge-goal-${goalId}-${revision}-${Date.now().toString(36)}-${goalCallSeq.toString(36)}`);
|
|
1923
|
+
}
|
|
1853
1924
|
/**
|
|
1854
1925
|
* Build the synthetic `update_goal` tool-call chunk that marks the goal complete on DSH.
|
|
1855
1926
|
*/
|
|
@@ -1865,7 +1936,7 @@ function buildGoalCompleteToolCallBlock(goalContext, blockIdx) {
|
|
|
1865
1936
|
index: blockIdx,
|
|
1866
1937
|
block: {
|
|
1867
1938
|
type: "tool-call",
|
|
1868
|
-
id:
|
|
1939
|
+
id: nextGoalCallId(goalId, revision),
|
|
1869
1940
|
name: "update_goal",
|
|
1870
1941
|
arguments: JSON.stringify({
|
|
1871
1942
|
goal_id: goalId,
|
|
@@ -1914,14 +1985,20 @@ function formatCompactionSummary(before, after) {
|
|
|
1914
1985
|
}
|
|
1915
1986
|
/**
|
|
1916
1987
|
* Render standard compaction marker for the stream.
|
|
1917
|
-
* In raw markdown, this surfaces as an elegant blockquote:
|
|
1918
|
-
* > ✂️ **上下文已压缩** · 128.5k → 14.2k tokens (-89%)
|
|
1988
|
+
* In raw markdown (and DSH markdown which escapes raw HTML), this surfaces as an elegant blockquote:
|
|
1989
|
+
* > [✂️ **上下文已压缩** · 128.5k → 14.2k tokens (-89%)](#agy-compaction-card?before=128500&after=14200&items=18&summary=...)
|
|
1919
1990
|
* In browser DSH, the client enhancer transforms it into the interactive native Compaction Card.
|
|
1920
1991
|
*/
|
|
1992
|
+
/** Percent-encode a value for use inside a markdown link destination.
|
|
1993
|
+
* encodeURIComponent leaves ( ) ' ! alone, but a raw ')' in a query value would
|
|
1994
|
+
* terminate the `](...)` link early and break the marker. */
|
|
1995
|
+
function encodeForMarkdownUrl(value) {
|
|
1996
|
+
return encodeURIComponent(value).replace(/[()'!]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
1997
|
+
}
|
|
1921
1998
|
function renderCompactionMarker(notice) {
|
|
1922
1999
|
const summaryText = formatCompactionSummary(notice.beforeTokens, notice.afterTokens);
|
|
1923
|
-
const encodedSummary = notice.summary ?
|
|
1924
|
-
return
|
|
2000
|
+
const encodedSummary = notice.summary ? encodeForMarkdownUrl(notice.summary) : "";
|
|
2001
|
+
return `> [✂️ **上下文已压缩** · ${summaryText}](#agy-compaction-card?before=${notice.beforeTokens}&after=${notice.afterTokens}&items=${notice.items}&summary=${encodedSummary})\n\n`;
|
|
1925
2002
|
}
|
|
1926
2003
|
//#endregion
|
|
1927
2004
|
//#region src/host/mapper.ts
|
|
@@ -30902,8 +30979,17 @@ async function waitForRunSettle(run, timeoutMs) {
|
|
|
30902
30979
|
}
|
|
30903
30980
|
return run.isSettled;
|
|
30904
30981
|
}
|
|
30982
|
+
function calcPromptTokens(usage) {
|
|
30983
|
+
if (!usage) return void 0;
|
|
30984
|
+
const input = typeof usage.input_tokens === "number" && usage.input_tokens > 0 ? usage.input_tokens : 0;
|
|
30985
|
+
const cacheRead = typeof usage.cache_read_tokens === "number" && usage.cache_read_tokens > 0 ? usage.cache_read_tokens : 0;
|
|
30986
|
+
const cacheWrite = typeof usage.cache_write_tokens === "number" && usage.cache_write_tokens > 0 ? usage.cache_write_tokens : 0;
|
|
30987
|
+
const totalPrompt = input + cacheRead + cacheWrite;
|
|
30988
|
+
return totalPrompt > 0 ? totalPrompt : void 0;
|
|
30989
|
+
}
|
|
30905
30990
|
var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
30906
30991
|
deps;
|
|
30992
|
+
recentlyCompactedSessions = /* @__PURE__ */ new Map();
|
|
30907
30993
|
/**
|
|
30908
30994
|
* Models agy has refused `--effort` for (issue #67). Seeded from the host's
|
|
30909
30995
|
* persisted list on first use, then grown by each refusal. Effort support is
|
|
@@ -31322,20 +31408,8 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31322
31408
|
};
|
|
31323
31409
|
return;
|
|
31324
31410
|
}
|
|
31325
|
-
|
|
31326
|
-
|
|
31327
|
-
const sg = this.deps.sessionGoal(sessionKey);
|
|
31328
|
-
if (sg) {
|
|
31329
|
-
if (!goalContext) goalContext = {
|
|
31330
|
-
goalId: sg.goalId,
|
|
31331
|
-
revision: sg.revision
|
|
31332
|
-
};
|
|
31333
|
-
else {
|
|
31334
|
-
if (!goalContext.goalId) goalContext.goalId = sg.goalId;
|
|
31335
|
-
if (goalContext.revision === void 0) goalContext.revision = sg.revision;
|
|
31336
|
-
}
|
|
31337
|
-
}
|
|
31338
|
-
}
|
|
31411
|
+
const liveGoal = sessionKey !== "" && this.deps.sessionGoal ? this.deps.sessionGoal(sessionKey) : void 0;
|
|
31412
|
+
const goalContext = resolveGoalContext(options.messages, liveGoal);
|
|
31339
31413
|
const supportsGoalUpdate = Boolean(options.tools?.some((t) => t.name === "update_goal"));
|
|
31340
31414
|
const supportsPlanExit = Boolean(options.tools?.some((t) => t.name === "exit_plan_mode")) && isPlanMode(options.messages);
|
|
31341
31415
|
const continuation = detectContinuation(options.messages);
|
|
@@ -31509,7 +31583,9 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31509
31583
|
if (sessionAccountKey !== "") this.deps.store.delete(sessionAccountKey);
|
|
31510
31584
|
binding = void 0;
|
|
31511
31585
|
}
|
|
31512
|
-
const
|
|
31586
|
+
const lastCompactedAt = sessionKey ? this.recentlyCompactedSessions.get(sessionKey) : void 0;
|
|
31587
|
+
const now = Date.now();
|
|
31588
|
+
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
31589
|
let compactionNotice = void 0;
|
|
31514
31590
|
if (persistBinding && binding !== void 0 && isCompacted) {
|
|
31515
31591
|
const beforeTokens = typeof binding.lastInputTokens === "number" && binding.lastInputTokens > 0 ? binding.lastInputTokens : Math.round(binding.lastMessageCount * 750);
|
|
@@ -31531,7 +31607,13 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31531
31607
|
items,
|
|
31532
31608
|
...extractedSummary ? { summary: extractedSummary } : {}
|
|
31533
31609
|
};
|
|
31534
|
-
if (
|
|
31610
|
+
if (sessionKey) {
|
|
31611
|
+
this.recentlyCompactedSessions.set(sessionKey, now);
|
|
31612
|
+
if (this.recentlyCompactedSessions.size > 200) {
|
|
31613
|
+
for (const [k, t] of this.recentlyCompactedSessions) if (now - t > 12e4) this.recentlyCompactedSessions.delete(k);
|
|
31614
|
+
}
|
|
31615
|
+
for (const k of Object.keys(this.deps.store.all())) if (k === sessionKey || k.startsWith(sessionKey + ":")) this.deps.store.delete(k);
|
|
31616
|
+
} else if (sessionAccountKey !== "") this.deps.store.delete(sessionAccountKey);
|
|
31535
31617
|
binding = void 0;
|
|
31536
31618
|
} else if (binding !== void 0 && messages.length < binding.lastMessageCount) {
|
|
31537
31619
|
binding.lastMessageCount = messages.length;
|
|
@@ -32102,7 +32184,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
32102
32184
|
const finalId = binding !== void 0 ? binding.conversationId : conversationId;
|
|
32103
32185
|
if (finalId) {
|
|
32104
32186
|
const finalUsage = rec.lastUsage ?? rec.finalUsage({});
|
|
32105
|
-
const inputTokens = typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens;
|
|
32187
|
+
const inputTokens = calcPromptTokens(finalUsage) ?? (typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens);
|
|
32106
32188
|
this.deps.store.set(sessionAccountKey, {
|
|
32107
32189
|
conversationId: finalId,
|
|
32108
32190
|
lastMessageCount: messages.length,
|
|
@@ -32131,7 +32213,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
32131
32213
|
const finalId = binding !== void 0 ? binding.conversationId : conversationId;
|
|
32132
32214
|
if (finalId) {
|
|
32133
32215
|
const finalUsage = rec.lastUsage ?? rec.finalUsage({});
|
|
32134
|
-
const inputTokens = typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens;
|
|
32216
|
+
const inputTokens = calcPromptTokens(finalUsage) ?? (typeof finalUsage?.input_tokens === "number" && finalUsage.input_tokens > 0 ? finalUsage.input_tokens : binding?.lastInputTokens);
|
|
32135
32217
|
this.deps.store.set(sessionAccountKey, {
|
|
32136
32218
|
conversationId: finalId,
|
|
32137
32219
|
lastMessageCount: messages.length,
|
|
@@ -36893,20 +36975,29 @@ function apply(ctx, entryConfig = {}) {
|
|
|
36893
36975
|
goalId: g.id,
|
|
36894
36976
|
revision: typeof g.revision === "number" ? g.revision : 1
|
|
36895
36977
|
};
|
|
36978
|
+
return null;
|
|
36896
36979
|
}
|
|
36897
36980
|
} catch {}
|
|
36898
36981
|
const session = (ctx.get("sessions") ?? ctx.sessions)?.get(sessionId);
|
|
36899
|
-
|
|
36900
|
-
|
|
36982
|
+
if (!session) return void 0;
|
|
36983
|
+
const evs = session.snapshotEvents?.() ?? session.ownEvents?.() ?? session.log ?? session.events;
|
|
36984
|
+
if (!evs) return void 0;
|
|
36901
36985
|
for (let i = evs.length - 1; i >= 0; i--) {
|
|
36902
36986
|
const ev = evs[i];
|
|
36903
|
-
if (ev?.type
|
|
36904
|
-
|
|
36905
|
-
|
|
36906
|
-
|
|
36987
|
+
if (ev?.type !== "goal/change" || !ev.data || typeof ev.data !== "object") continue;
|
|
36988
|
+
const d = ev.data;
|
|
36989
|
+
switch (d.operation) {
|
|
36990
|
+
case "clear": return null;
|
|
36991
|
+
case "pause":
|
|
36992
|
+
case "block":
|
|
36993
|
+
case "complete": return null;
|
|
36994
|
+
case "create":
|
|
36995
|
+
case "resume": return d.goal?.id ? {
|
|
36907
36996
|
goalId: d.goal.id,
|
|
36908
36997
|
revision: typeof d.goal.revision === "number" ? d.goal.revision : 1
|
|
36909
|
-
};
|
|
36998
|
+
} : null;
|
|
36999
|
+
case "edit": continue;
|
|
37000
|
+
default: return null;
|
|
36910
37001
|
}
|
|
36911
37002
|
}
|
|
36912
37003
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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",
|