dsh-agy-link 0.6.49 → 0.6.51

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.51 (2026-11-21)
4
+
5
+ ### English
6
+
7
+ - **Fix(quota): a successful CLI refresh now clears the stale `quotaUnavailable` marker (fixes #151).** The CLI-first path returns as soon as it has families, before the REST/summary branch that owns `clearQuotaUnavailable`. A marker written while the summary endpoint was down therefore outlived the successful refresh: the panel kept showing "quota refresh failed · endpoint unreachable · data from 19:02" while the stored quotas advanced past 22:44. Fresh CLI data is authoritative for this account, so the marker is cleared on that path too.
8
+ - **Fix(client): the decision chips speak the host language (fixes #153, part 1).** `installDecisionChips()` injected hardcoded Simplified Chinese: the header, the button tooltips, and — worst of all — the text written into the composer, so an English-configured host received a Chinese prefix as its own prompt. The copy now goes through the plugin's `locale` binding with English fallbacks, and the four locales define `decision.quickFill` / `decision.insertTooltip` / `decision.insertPayload`. An existing test that asserted the Chinese payload was updated to assert the localized one.
9
+
10
+ ### 中文
11
+
12
+ - **修复(额度):CLI 刷新成功后清除陈旧的 `quotaUnavailable` 标记(修复 #151)。** CLI 优先路径拿到 families 就返回,早于拥有 `clearQuotaUnavailable` 的 REST/汇总分支。于是在汇总接口不可达期间写入的标记会比成功刷新活得更久:面板一直显示「配额刷新失败 · 接口不可达 · 数据停留在 19:02」,而存储的额度其实已推进到 22:44 之后。CLI 的新鲜数据对该账号是权威的,因此这条路径也要清除标记。
13
+ - **修复(客户端):决策芯片改用宿主语言(修复 #153 第一部分)。** `installDecisionChips()` 硬编码了简体中文:标题、按钮 tooltip,以及**最糟的**——直接写进输入框的文本,导致英文配置的宿主把中文前缀当作自己的 prompt。文案现在走插件的 `locale` 绑定并带英文兜底,四个语言都新增 `decision.quickFill` / `decision.insertTooltip` / `decision.insertPayload`。一条原本断言中文 payload 的既有测试已改为断言本地化后的文本。
14
+
15
+ ## 0.6.50 (2026-11-21)
16
+
17
+ ### English
18
+
19
+ - **Fix(watchdog): a scheduled wake-up no longer releases the idle-grace exemption on its own status line (fixes #148).** When agy hands work to the background it asks the model for a short status update before it prints the idle line, so the sequence was: tool returns `state === 'RUNNING'` → `text`/`thinking` step → `root agent idle; waiting …`. `text`/`thinking` cleared the subagent exemption and `RUNNING` counted as a completed hand-off, so nothing held the exemption when the idle line finally arrived.
20
+ - A `schedule` step that returns `RUNNING` is now tracked until it reports a terminal state, and that wait holds the exemption independently; a `text`/`thinking` step no longer cancels it (it still restores the normal idle *budget*, which is a different concern).
21
+ - **`run_command` is deliberately excluded.** agy also uses it for daemons (dev servers, watchers) that never report back, and reclaiming those is exactly what #119 exists for — #124's test pins that. A backgrounded *build* is protected by agy's own count instead (`waiting for N background task(s)` with N > 0 disarms the reaper, shipped in v0.6.46/0.6.48), which needs no exemption and cannot resurrect the daemon case.
22
+ - **Fix(mcp-bridge): `/tools` now lists the caller's own tool surface (fixes #150).** The endpoint called `svc.schemas()` with no scope, so every tool registered inside a DSH preset (`present`, `todo_write`, `job_*`, `schedule_*`, `office_*`) was invisible to an allowlisted agy child even though `/call` could invoke it. The session→agent resolution that `/call` already performed is now a shared `resolveSessionAgent()` used by both endpoints, including the bare-sub-agent-key retry with the `session-` prefix.
23
+
24
+ ### 中文
25
+
26
+ - **修复(watchdog):定时唤醒不再因为自己的状态提示而解除 idle-grace 豁免(修复 #148)。** agy 把工作交给后台时,要求模型先发一句简短状态更新,然后才打印 idle 行,于是顺序是:工具返回 `state === 'RUNNING'` → `text`/`thinking` 步骤 → `root agent idle; waiting …`。而 `text`/`thinking` 会清掉子代理豁免,`RUNNING` 又被当作「已完成交接」,等 idle 行真正出现时已没有任何东西撑着豁免。
27
+ - 返回 `RUNNING` 的 `schedule` 步骤现在被跟踪到它有终态为止,这个等待**独立**持有豁免;`text`/`thinking` 不再取消它(它仍然负责把空闲**预算**恢复正常,那是另一件事)。
28
+ - **`run_command` 被刻意排除。** agy 也用它启动永不回报的守护进程(dev server、watcher),而回收这类进程正是 #119 存在的理由——#124 的测试锁定着这一点。而后台化的**构建**由 agy 自己的计数保护(`waiting for N background task(s)`,N > 0 时不武装收割器,v0.6.46/0.6.48 已发布),既不需要豁免,也不会把守护进程那一类放回来。
29
+ - **修复(mcp-bridge):`/tools` 现在列出调用者自己的工具面(修复 #150)。** 该端点用无 scope 的 `svc.schemas()`,导致注册在 DSH preset 里的工具(`present`、`todo_write`、`job_*`、`schedule_*`、`office_*`)对已加入白名单的 agy 子进程完全不可见,尽管 `/call` 其实能调用它们。`/call` 原本就有的 session→agent 解析被提取为共用的 `resolveSessionAgent()`,两个端点都用它,包括「裸子会话 key 加 `session-` 前缀重试」的行为。
30
+
3
31
  ## 0.6.49 (2026-11-20)
4
32
 
5
33
  ### English
@@ -6887,6 +6887,19 @@ const SUBAGENT_COLLAB_TOOLS = /* @__PURE__ */ new Set([
6887
6887
  "run_workflow",
6888
6888
  "swarm"
6889
6889
  ]);
6890
+ /**
6891
+ * Tools that hand work to the BACKGROUND and return `state === 'RUNNING'` with a
6892
+ * DETERMINISTIC finish: a scheduled wake-up reports back when its timer fires.
6893
+ * The root agent idles until then, so the reaper stays suspended for the wait
6894
+ * (issue #148).
6895
+ *
6896
+ * `run_command` is deliberately NOT here: agy also uses it for daemons (dev
6897
+ * servers, watchers) that never report back, and reclaiming those is exactly
6898
+ * what #119 exists for. A backgrounded BUILD is protected by agy's own count
6899
+ * instead — `waiting for N background task(s)` with N > 0 keeps the reaper
6900
+ * disarmed (see idle-line.ts).
6901
+ */
6902
+ const BACKGROUND_WAIT_TOOLS = /* @__PURE__ */ new Set(["schedule"]);
6890
6903
  function resolveWatchdogBudgets(cfg) {
6891
6904
  const longToolIdleMinutes = cfg.longToolIdleMinutes > 0 ? cfg.longToolIdleMinutes : 0;
6892
6905
  let printTimeoutMinutes = Math.max(longToolIdleMinutes > 0 ? longToolIdleMinutes : Math.ceil(cfg.timeoutMs / 6e4), Math.ceil(cfg.timeoutMs / 6e4));
@@ -6911,6 +6924,36 @@ function isToolStepCompleted(ev) {
6911
6924
  * build, …) — issue #33 — so the watchdog raises the idle budget; bare
6912
6925
  * generation gets a bounded floor so a hung SSE stream can fail and rotate.
6913
6926
  */
6927
+ /**
6928
+ * Tracks backgrounded hand-offs whose completion agy will report later
6929
+ * (`schedule`). They hold the idle-grace exemption on their own: the mapper
6930
+ * treats `RUNNING` as a completed hand-off, so they never appear in
6931
+ * `openToolKeys`, yet the root agent is still waiting on them (issue #148).
6932
+ */
6933
+ function createBackgroundWaits(onChange) {
6934
+ const keys = /* @__PURE__ */ new Set();
6935
+ return {
6936
+ note(stepKey, name, state, completed) {
6937
+ if (!BACKGROUND_WAIT_TOOLS.has(name)) return;
6938
+ const before = keys.size;
6939
+ if (state === "RUNNING") keys.add(stepKey);
6940
+ else if (completed) keys.delete(stepKey);
6941
+ if (keys.size !== before) onChange();
6942
+ },
6943
+ get active() {
6944
+ return keys.size > 0;
6945
+ },
6946
+ clear() {
6947
+ keys.clear();
6948
+ }
6949
+ };
6950
+ }
6951
+ /** Heartbeat log line: what the turn is waiting on and for how long. */
6952
+ function heartbeatMessage(openCount, oldestAt, sinceOutput, longToolIdleMs) {
6953
+ const mins = Math.max(1, Math.round((Date.now() - (openCount === 0 && sinceOutput > 0 ? sinceOutput : oldestAt)) / 6e4));
6954
+ const budget = Math.round(longToolIdleMs / 6e4) + "m";
6955
+ return openCount > 0 ? "agy tool step still running: " + openCount + " open, oldest " + mins + "m (idle budget " + budget + ") — the turn is waiting on agy" : "agy run still working: no new output for " + mins + "m (idle budget " + budget + ") — the turn is waiting on agy; press Stop to cancel";
6956
+ }
6914
6957
  function createToolWatchdog(log, cfg) {
6915
6958
  const openToolKeys = /* @__PURE__ */ new Set();
6916
6959
  const openToolSince = /* @__PURE__ */ new Map();
@@ -6922,8 +6965,9 @@ function createToolWatchdog(log, cfg) {
6922
6965
  const TOOL_HEARTBEAT_MS = 3e5;
6923
6966
  let toolHeartbeat = null;
6924
6967
  let idleGraceExempt = false;
6968
+ const backgroundWaits = createBackgroundWaits(() => syncIdleGraceExempt());
6925
6969
  const syncIdleGraceExempt = () => {
6926
- const next = awaitingSubagent || openToolKeys.size > 0;
6970
+ const next = awaitingSubagent || openToolKeys.size > 0 || backgroundWaits.active;
6927
6971
  if (next === idleGraceExempt) return;
6928
6972
  idleGraceExempt = next;
6929
6973
  runningProc?.exemptIdleGrace(next);
@@ -6952,9 +6996,7 @@ function createToolWatchdog(log, cfg) {
6952
6996
  }
6953
6997
  let oldest = Date.now();
6954
6998
  for (const startedAt of openToolSince.values()) if (startedAt < oldest) oldest = startedAt;
6955
- if (openToolKeys.size === 0 && lastOutputAt > 0) oldest = lastOutputAt;
6956
- const mins = Math.max(1, Math.round((Date.now() - oldest) / 6e4));
6957
- log?.(openToolKeys.size > 0 ? "agy tool step still running: " + openToolKeys.size + " open, oldest " + mins + "m (idle budget " + Math.round(longToolIdleMs / 6e4) + "m) — the turn is waiting on agy" : "agy run still working: no new output for " + mins + "m (idle budget " + Math.round(longToolIdleMs / 6e4) + "m) — the turn is waiting on agy; press Stop to cancel");
6999
+ log?.(heartbeatMessage(openToolKeys.size, oldest, lastOutputAt, longToolIdleMs));
6958
7000
  }, TOOL_HEARTBEAT_MS);
6959
7001
  toolHeartbeat.unref?.();
6960
7002
  };
@@ -6975,6 +7017,7 @@ function createToolWatchdog(log, cfg) {
6975
7017
  if (ev.kind !== "step") return;
6976
7018
  if (ev.stepKind === "tool" && ev.tool !== void 0) {
6977
7019
  if (SUBAGENT_COLLAB_TOOLS.has(ev.tool.name)) setAwaitingSubagent(!isStepFailedOrCanceled(ev));
7020
+ backgroundWaits.note(ev.stepKey, ev.tool.name, ev.state, isToolStepCompleted(ev));
6978
7021
  if (!isToolStepCompleted(ev)) {
6979
7022
  if (!openToolKeys.has(ev.stepKey)) {
6980
7023
  openToolKeys.add(ev.stepKey);
@@ -7002,6 +7045,7 @@ function createToolWatchdog(log, cfg) {
7002
7045
  awaitingSubagent = false;
7003
7046
  openToolKeys.clear();
7004
7047
  openToolSince.clear();
7048
+ backgroundWaits.clear();
7005
7049
  syncIdleGraceExempt();
7006
7050
  }
7007
7051
  };
package/dist/client.js CHANGED
@@ -52,6 +52,9 @@ window.__ModuleLoader__.load({
52
52
  "account.add": "添加 Google 账号",
53
53
  "account.aliasDefault": "备用 Google 账号 {number}",
54
54
  "account.defaultAlias": "主账号(系统登录)",
55
+ "decision.quickFill": "💬 点击选项快速填入:",
56
+ "decision.insertTooltip": "点击填入: {text}",
57
+ "decision.insertPayload": "我选择 {choice}",
55
58
  "account.proxyPlaceholder": "专属代理 URL(如 http://127.0.0.1:7890,留空则继承全局)",
56
59
  "account.aliasPlaceholder": "账号别名(例如:备用账号 2)",
57
60
  "account.removeTitle": "移除此账号",
@@ -286,6 +289,9 @@ window.__ModuleLoader__.load({
286
289
  "account.add": "Add Google account",
287
290
  "account.aliasDefault": "Backup Google account {number}",
288
291
  "account.defaultAlias": "Primary account (system sign-in)",
292
+ "decision.quickFill": "💬 Click an option to fill it in:",
293
+ "decision.insertTooltip": "Insert: {text}",
294
+ "decision.insertPayload": "I choose {choice}",
289
295
  "account.proxyPlaceholder": "Dedicated proxy URL (e.g. http://127.0.0.1:7890; leave blank to inherit global)",
290
296
  "account.aliasPlaceholder": "Account alias (for example: Backup account 2)",
291
297
  "account.removeTitle": "Remove this account",
@@ -520,6 +526,9 @@ window.__ModuleLoader__.load({
520
526
  "account.add": "Adicionar conta Google",
521
527
  "account.aliasDefault": "Conta Google reserva {number}",
522
528
  "account.defaultAlias": "Conta principal (login do sistema)",
529
+ "decision.quickFill": "💬 Clique numa opção para preenchê-la:",
530
+ "decision.insertTooltip": "Inserir: {text}",
531
+ "decision.insertPayload": "Escolho {choice}",
523
532
  "account.proxyPlaceholder": "URL de proxy dedicada (ex.: http://127.0.0.1:7890; deixe vazio para herdar a global)",
524
533
  "account.aliasPlaceholder": "Apelido da conta (por exemplo: Conta reserva 2)",
525
534
  "account.removeTitle": "Remover esta conta",
@@ -754,6 +763,9 @@ window.__ModuleLoader__.load({
754
763
  "account.add": "Añadir cuenta de Google",
755
764
  "account.aliasDefault": "Cuenta de Google de respaldo {number}",
756
765
  "account.defaultAlias": "Cuenta principal (inicio de sesión del sistema)",
766
+ "decision.quickFill": "💬 Haz clic en una opción para rellenarla:",
767
+ "decision.insertTooltip": "Insertar: {text}",
768
+ "decision.insertPayload": "Elijo {choice}",
757
769
  "account.proxyPlaceholder": "URL de proxy dedicada (p. ej., http://127.0.0.1:7890; déjalo vacío para heredar la global)",
758
770
  "account.aliasPlaceholder": "Alias de la cuenta (por ejemplo: Cuenta de respaldo 2)",
759
771
  "account.removeTitle": "Eliminar esta cuenta",
@@ -3754,7 +3766,9 @@ window.__ModuleLoader__.load({
3754
3766
  box.className = "agy-decision-container";
3755
3767
  const header = document.createElement("div");
3756
3768
  header.className = "agy-decision-header";
3757
- header.innerHTML = "<span>💬 点击选项快速填入:</span>";
3769
+ const headerLabel = document.createElement("span");
3770
+ headerLabel.textContent = activeTranslate("decision.quickFill");
3771
+ header.appendChild(headerLabel);
3758
3772
  box.appendChild(header);
3759
3773
  const chips = document.createElement("div");
3760
3774
  chips.className = "agy-decision-chips";
@@ -3762,7 +3776,7 @@ window.__ModuleLoader__.load({
3762
3776
  const chip = document.createElement("button");
3763
3777
  chip.type = "button";
3764
3778
  chip.className = "agy-decision-chip";
3765
- chip.title = `点击填入: ${opt.fullText}`;
3779
+ chip.title = activeTranslate("decision.insertTooltip", { text: opt.fullText });
3766
3780
  const numSpan = document.createElement("span");
3767
3781
  numSpan.className = "agy-decision-chip-num";
3768
3782
  numSpan.textContent = opt.num ?? "👉";
@@ -3774,7 +3788,7 @@ window.__ModuleLoader__.load({
3774
3788
  chip.onclick = (e) => {
3775
3789
  e.stopPropagation();
3776
3790
  const cleanText = opt.fullText.replace(/^[0-9]+[、..:]\s*/, "").trim();
3777
- insertTextIntoChatComposer(`我选择 ${opt.num ? opt.num + " " : ""}${cleanText}`);
3791
+ insertTextIntoChatComposer(activeTranslate("decision.insertPayload", { choice: (opt.num ? opt.num + " " : "") + cleanText }));
3778
3792
  chip.classList.add("selected");
3779
3793
  setTimeout(() => chip.classList.remove("selected"), 1200);
3780
3794
  };
@@ -3797,8 +3811,24 @@ window.__ModuleLoader__.load({
3797
3811
  scanAndEnhanceDecisions();
3798
3812
  }, 100);
3799
3813
  }
3800
- function installDecisionChips() {
3814
+ /** Active translator for the scan pass (module scope: the scan runs outside install). */
3815
+ let activeTranslate = (key, params) => {
3816
+ return ({
3817
+ "decision.quickFill": "💬 Click an option to fill it in:",
3818
+ "decision.insertTooltip": "Insert: {text}",
3819
+ "decision.insertPayload": "I choose {choice}"
3820
+ }[key] ?? key).replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? ""));
3821
+ };
3822
+ function translatorFor(ctx) {
3823
+ try {
3824
+ const bound = (ctx?.locale)?.bind?.(NS);
3825
+ if (typeof bound === "function") return bound;
3826
+ } catch {}
3827
+ return activeTranslate;
3828
+ }
3829
+ function installDecisionChips(ctx) {
3801
3830
  if (typeof window === "undefined" || typeof document === "undefined") return () => {};
3831
+ activeTranslate = translatorFor(ctx);
3802
3832
  decisionChipsDispose?.();
3803
3833
  injectStyles$4();
3804
3834
  const observer = new MutationObserver(() => {
@@ -10374,7 +10404,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10374
10404
  ctx.effect(() => installAutoExpandReasoning());
10375
10405
  ctx.effect(() => installMermaidRendering());
10376
10406
  ctx.effect(() => installImageEnhancer(ctx));
10377
- ctx.effect(() => installDecisionChips());
10407
+ ctx.effect(() => installDecisionChips(ctx));
10378
10408
  ctx.effect(() => installCompactionCard());
10379
10409
  ctx.effect(() => {
10380
10410
  try {
package/dist/index.js CHANGED
@@ -34344,6 +34344,19 @@ const SUBAGENT_COLLAB_TOOLS = /* @__PURE__ */ new Set([
34344
34344
  "run_workflow",
34345
34345
  "swarm"
34346
34346
  ]);
34347
+ /**
34348
+ * Tools that hand work to the BACKGROUND and return `state === 'RUNNING'` with a
34349
+ * DETERMINISTIC finish: a scheduled wake-up reports back when its timer fires.
34350
+ * The root agent idles until then, so the reaper stays suspended for the wait
34351
+ * (issue #148).
34352
+ *
34353
+ * `run_command` is deliberately NOT here: agy also uses it for daemons (dev
34354
+ * servers, watchers) that never report back, and reclaiming those is exactly
34355
+ * what #119 exists for. A backgrounded BUILD is protected by agy's own count
34356
+ * instead — `waiting for N background task(s)` with N > 0 keeps the reaper
34357
+ * disarmed (see idle-line.ts).
34358
+ */
34359
+ const BACKGROUND_WAIT_TOOLS = /* @__PURE__ */ new Set(["schedule"]);
34347
34360
  function resolveWatchdogBudgets(cfg) {
34348
34361
  const longToolIdleMinutes = cfg.longToolIdleMinutes > 0 ? cfg.longToolIdleMinutes : 0;
34349
34362
  let printTimeoutMinutes = Math.max(longToolIdleMinutes > 0 ? longToolIdleMinutes : Math.ceil(cfg.timeoutMs / 6e4), Math.ceil(cfg.timeoutMs / 6e4));
@@ -34368,6 +34381,36 @@ function isToolStepCompleted(ev) {
34368
34381
  * build, …) — issue #33 — so the watchdog raises the idle budget; bare
34369
34382
  * generation gets a bounded floor so a hung SSE stream can fail and rotate.
34370
34383
  */
34384
+ /**
34385
+ * Tracks backgrounded hand-offs whose completion agy will report later
34386
+ * (`schedule`). They hold the idle-grace exemption on their own: the mapper
34387
+ * treats `RUNNING` as a completed hand-off, so they never appear in
34388
+ * `openToolKeys`, yet the root agent is still waiting on them (issue #148).
34389
+ */
34390
+ function createBackgroundWaits(onChange) {
34391
+ const keys = /* @__PURE__ */ new Set();
34392
+ return {
34393
+ note(stepKey, name, state, completed) {
34394
+ if (!BACKGROUND_WAIT_TOOLS.has(name)) return;
34395
+ const before = keys.size;
34396
+ if (state === "RUNNING") keys.add(stepKey);
34397
+ else if (completed) keys.delete(stepKey);
34398
+ if (keys.size !== before) onChange();
34399
+ },
34400
+ get active() {
34401
+ return keys.size > 0;
34402
+ },
34403
+ clear() {
34404
+ keys.clear();
34405
+ }
34406
+ };
34407
+ }
34408
+ /** Heartbeat log line: what the turn is waiting on and for how long. */
34409
+ function heartbeatMessage(openCount, oldestAt, sinceOutput, longToolIdleMs) {
34410
+ const mins = Math.max(1, Math.round((Date.now() - (openCount === 0 && sinceOutput > 0 ? sinceOutput : oldestAt)) / 6e4));
34411
+ const budget = Math.round(longToolIdleMs / 6e4) + "m";
34412
+ return openCount > 0 ? "agy tool step still running: " + openCount + " open, oldest " + mins + "m (idle budget " + budget + ") — the turn is waiting on agy" : "agy run still working: no new output for " + mins + "m (idle budget " + budget + ") — the turn is waiting on agy; press Stop to cancel";
34413
+ }
34371
34414
  function createToolWatchdog(log, cfg) {
34372
34415
  const openToolKeys = /* @__PURE__ */ new Set();
34373
34416
  const openToolSince = /* @__PURE__ */ new Map();
@@ -34379,8 +34422,9 @@ function createToolWatchdog(log, cfg) {
34379
34422
  const TOOL_HEARTBEAT_MS = 3e5;
34380
34423
  let toolHeartbeat = null;
34381
34424
  let idleGraceExempt = false;
34425
+ const backgroundWaits = createBackgroundWaits(() => syncIdleGraceExempt());
34382
34426
  const syncIdleGraceExempt = () => {
34383
- const next = awaitingSubagent || openToolKeys.size > 0;
34427
+ const next = awaitingSubagent || openToolKeys.size > 0 || backgroundWaits.active;
34384
34428
  if (next === idleGraceExempt) return;
34385
34429
  idleGraceExempt = next;
34386
34430
  runningProc?.exemptIdleGrace(next);
@@ -34409,9 +34453,7 @@ function createToolWatchdog(log, cfg) {
34409
34453
  }
34410
34454
  let oldest = Date.now();
34411
34455
  for (const startedAt of openToolSince.values()) if (startedAt < oldest) oldest = startedAt;
34412
- if (openToolKeys.size === 0 && lastOutputAt > 0) oldest = lastOutputAt;
34413
- const mins = Math.max(1, Math.round((Date.now() - oldest) / 6e4));
34414
- log?.(openToolKeys.size > 0 ? "agy tool step still running: " + openToolKeys.size + " open, oldest " + mins + "m (idle budget " + Math.round(longToolIdleMs / 6e4) + "m) — the turn is waiting on agy" : "agy run still working: no new output for " + mins + "m (idle budget " + Math.round(longToolIdleMs / 6e4) + "m) — the turn is waiting on agy; press Stop to cancel");
34456
+ log?.(heartbeatMessage(openToolKeys.size, oldest, lastOutputAt, longToolIdleMs));
34415
34457
  }, TOOL_HEARTBEAT_MS);
34416
34458
  toolHeartbeat.unref?.();
34417
34459
  };
@@ -34432,6 +34474,7 @@ function createToolWatchdog(log, cfg) {
34432
34474
  if (ev.kind !== "step") return;
34433
34475
  if (ev.stepKind === "tool" && ev.tool !== void 0) {
34434
34476
  if (SUBAGENT_COLLAB_TOOLS.has(ev.tool.name)) setAwaitingSubagent(!isStepFailedOrCanceled(ev));
34477
+ backgroundWaits.note(ev.stepKey, ev.tool.name, ev.state, isToolStepCompleted(ev));
34435
34478
  if (!isToolStepCompleted(ev)) {
34436
34479
  if (!openToolKeys.has(ev.stepKey)) {
34437
34480
  openToolKeys.add(ev.stepKey);
@@ -34459,6 +34502,7 @@ function createToolWatchdog(log, cfg) {
34459
34502
  awaitingSubagent = false;
34460
34503
  openToolKeys.clear();
34461
34504
  openToolSince.clear();
34505
+ backgroundWaits.clear();
34462
34506
  syncIdleGraceExempt();
34463
34507
  }
34464
34508
  };
@@ -37305,6 +37349,25 @@ function settledToolResult(result, callId) {
37305
37349
  * may arrive later (optional service): pass a thunk.
37306
37350
  */
37307
37351
  function startMcpBridge(opts) {
37352
+ /**
37353
+ * Resolve the DSH agent that owns the request's `X-DSH-Session`.
37354
+ *
37355
+ * Shared by `/tools` and `/call`: a preset-scoped tool only exists for a
37356
+ * caller scope, so listing without one hides every tool registered inside a
37357
+ * preset (`present`, `todo_write`, `schedule_*`, `office_*`) even when the
37358
+ * allowlist names it (issue #150). DSH session keys come in two forms — a
37359
+ * top-level web session is `session-<uuid>`, a sub-agent/fork session is a
37360
+ * bare `<uuid>` — so the value is tried as given first (a bare sub-agent key
37361
+ * must not be rewritten) and retried once with the `session-` prefix only
37362
+ * when that finds nothing.
37363
+ */
37364
+ const resolveSessionAgent = async (req) => {
37365
+ const sessionHeader = String(req.headers["x-dsh-session"] ?? "");
37366
+ const resolveSession = async (id) => id === "" ? void 0 : await Promise.resolve(opts.resolveAgent?.(id));
37367
+ const agent = await resolveSession(sessionHeader);
37368
+ if (agent === void 0 && sessionHeader !== "" && !sessionHeader.startsWith("session-")) return await resolveSession("session-" + sessionHeader);
37369
+ return agent;
37370
+ };
37308
37371
  const token = randomBytes(24).toString("hex");
37309
37372
  let callSeq = 0;
37310
37373
  const server = createServer((req, res) => {
@@ -37323,7 +37386,7 @@ function startMcpBridge(opts) {
37323
37386
  const allow = opts.allowlist().split(",").map((s) => s.trim()).filter(Boolean);
37324
37387
  const allowSet = new Set(allow);
37325
37388
  const used = /* @__PURE__ */ new Set();
37326
- sendJson$1(res, 200, { tools: svc.schemas().filter((t) => allow.length === 0 || allowSet.has(t.name)).filter((t) => !INTERNAL_TOOL_NAMES.has(t.name)).map((t) => {
37389
+ sendJson$1(res, 200, { tools: svc.schemas(await resolveSessionAgent(req)).filter((t) => allow.length === 0 || allowSet.has(t.name)).filter((t) => !INTERNAL_TOOL_NAMES.has(t.name)).map((t) => {
37327
37390
  const base = toMcpName(t.name);
37328
37391
  let name = base;
37329
37392
  for (let i = 2; used.has(name); i++) name = base + "__" + i;
@@ -37375,10 +37438,7 @@ function startMcpBridge(opts) {
37375
37438
  return;
37376
37439
  }
37377
37440
  try {
37378
- const sessionHeader = String(req.headers["x-dsh-session"] ?? "");
37379
- const resolveSession = async (id) => id === "" ? void 0 : await Promise.resolve(opts.resolveAgent?.(id));
37380
- let agent = await resolveSession(sessionHeader);
37381
- if (agent === void 0 && sessionHeader !== "" && !sessionHeader.startsWith("session-")) agent = await resolveSession("session-" + sessionHeader);
37441
+ const agent = await resolveSessionAgent(req);
37382
37442
  const controller = new AbortController();
37383
37443
  const abortIfOpen = () => {
37384
37444
  if (!res.writableEnded) controller.abort();
@@ -40258,6 +40318,7 @@ async function refreshAccountQuotaPipeline(deps, account, force = false) {
40258
40318
  deps.pool.forgetDedicatedGroup(account.id, "argon");
40259
40319
  deps.pool.clearCooldown(account.id, "argon");
40260
40320
  }
40321
+ deps.pool.clearQuotaUnavailable(account.id);
40261
40322
  deps.pool.updateAccountQuotas(account.id, cliFamilies, email);
40262
40323
  return cliFamilies;
40263
40324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.49",
3
+ "version": "0.6.51",
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",