dsh-agy-link 0.6.46 → 0.6.47

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,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.47 (2026-11-20)
4
+
5
+ ### English
6
+
7
+ - **Perf(translation): warm persistent `agy` worker pool + `low` default effort + zero-enrichment aux path.**
8
+ - Added `TranslationWorkerPool` (`src/features/translation/worker.ts`) for POSIX hosts: keeps at most one warm `agy -p --output-format stream-json --input-format stream-json --mode plan` child (`cwd = tmpdir()`, no `--add-dir` / `--disable-slash-commands`) keyed by `${accountId}|${model}|${effort}`, with idle TTL (`5m`) and turn/char recycle (`8` turns / `32,000` chars). Subsequent translations skip the ~8–9s cold CLI startup and exit wait (~4–9s end-to-end vs ~20–40s before). Windows keeps `ctx.llm.stream` to preserve OS Credential Manager slot locking.
9
+ - Changed default `translateEffort` from `medium` to `low` (plain-language rewriting does not benefit from extended chain-of-thought latency) and updated the four locale hints accordingly.
10
+ - Auxiliary non-image runs (`isAux && !isImage`) now skip `SubagentTracker` and SQLite thought/tool-arg polling in `driveSpan`, and `startAttemptProcess` eagerly persists successful conversation bindings on `result` so rapid back-to-back bound calls never race child exit.
11
+ - **Fix(accounts/models): zero-redundancy per-account model lists, orchestrator model eligibility, and authoritative catalog attribution.**
12
+ - Fixed false `lack model "gemini-pro-orchestrator-neon" in their catalog` rejections on Pro/Ultra accounts: Google's REST `fetchAvailableModels` breakdown never includes CLI-synthesized orchestrator slugs (`gemini-pro-orchestrator-neon`, `gemini-pro-orchestrator-g1-pro`), so whenever an account's per-account `agy models` cache was absent or stale, `accountSupportsModel` vetoed it. `accountSupportsModel` now recognizes backing quota evidence (`gemini-4-neon` for `gemini-pro-orchestrator-neon`, Argon access for `gemini-pro-orchestrator-g1-pro`) and `baseModelSlug` strips `-xhigh` and `-tiered-*` suffixes; global `ModelCatalog.refresh()` now also attributes its result to the exact `probedAccount.id` it ran under, and the issue-#125 self-heal `refreshQuota` also warms undiscovered accounts.
13
+ - Added `buildAccountModelRows()` (`src/common/account-models.ts`) and surfaced `status.accountModels` (keyed by account id) from each account's real `agy models` discovery; `status.catalog.count` now tracks the active account's actual supported model count.
14
+ - Account cards render the deduplicated per-account list (with effort tags when applicable) instead of raw 30+ row REST quota dumps, filtering `-sonar`/`-image` noise, folding `-tiered`/effort suffixes in fallback mode, and leaving unknown quota percentages blank instead of fabricating `100%`.
15
+ - `POST /plugins/agy-link/pool/refresh-quota` now passes `id` to `catalog.forceRefresh(id)` on single-account sync and triggers `catalog.warmAccounts()` on full sync.
16
+ - **Fix(credentials): guard macOS/Linux `systemHome` against stale Keychain/disk clobbering and disabled-primary fallback.**
17
+ - When refreshing an OAuth token for `systemHome` (`acc_primary`) on macOS/Linux, `getValidAccessToken` re-verifies the live OS Keychain `refreshToken` before persisting and discards the response if the user switched accounts in `Antigravity.app` mid-flight; `persistRefreshedToken` also avoids creating a new disk token file under real `HOME` when none exists.
18
+ - Global `ModelCatalog` discovery now strictly skips disabled/unhealthy `lastActiveAccountId` and `primaryAccountId` entries and refuses to fall back to unisolated real `HOME` when all pool accounts are disabled.
19
+ - **Fix(quota): distinguish `VALIDATION_REQUIRED` and `TOS_VIOLATION` from free-tier `403 PERMISSION_DENIED` refusals.**
20
+ - `classifySummaryRefusal()` now checks `TOS_VIOLATION` and `VALIDATION_REQUIRED` BEFORE the generic `403 PERMISSION_DENIED` free-tier branch, preventing Pro/Ultra accounts that require Google web verification from being mislabeled as "free-tier · weekly quota only". Extracts Google's `validation_url` into `quotaUnavailable.actionUrl` and renders a red warning banner with a direct "Verify now" link in the console (all 4 locales).
21
+ - **Fix(adapter): eliminate `agy stream ended without a result event` crashes and dead 3x retry replays on idle-grace termination.**
22
+ - When `agy 1.5+` catches `SIGTERM` from the idle-grace reaper, it can emit a bare `{ ok: false, response: '' }` error result before exiting — which `EventMapper` ignores while `rec.hasResult` became `true`, skipping synthetic reply recovery and settling `failureInfo = null` (causing `agy stream ended without a result event` followed by 3 identical dead-recording replays). `handleAttemptOutcome` now checks for a *consumable* result (`ok || response !== ''`) before skipping recovery, and `AgyAdapter` forgets a settled recording lacking any consumable result past the cursor on retry instead of re-driving it.
23
+ - **Fix(client): eliminate Antigravity console/menu scroll flicker.**
24
+ - Static unreported (`—`) quota bars no longer run infinite `.agy-shimmer-track` GPU animations (shimmer runs only during active refresh), removed `contain: paint` / `transform: translateZ(0)` / `isolation: isolate` from `.agy-shimmer-track` and `transform` / `filter` from `.agy-btn:hover` / `.agy-card-hover`, and added ref-counted `acquireOverlaySuspend()` while `SettingsSection` is mounted so scrolling inside DSH's native Settings -> Antigravity view suspends background conversation scanners.
25
+
26
+ ### 中文
27
+
28
+ - **性能(翻译):常驻热进程池 + 默认 `low` 思考档 + 辅助通道免 SQLite 轮询。**
29
+ - 在 macOS/Linux 新增常驻翻译进程池 `TranslationWorkerPool`(`src/features/translation/worker.ts`):最多保留 1 个 `agy -p --output-format stream-json --input-format stream-json --mode plan`(`cwd = tmpdir()`,不传 `--add-dir` 与 `--disable-slash-commands`),按 `${accountId}|${model}|${effort}` 复用,空闲 `5m` 或累计 `8` 轮 / `32,000` 字符自动回收;后续翻译免除约 8–9 秒 CLI 冷启动与退出等待(端到端降至约 4–9 秒)。Windows 维持 `ctx.llm.stream` 以遵守系统凭据槽互斥锁。
30
+ - 默认 `translateEffort` 由 `medium` 调整为 `low`(口语化「译成人话」无需冗长思维链),同步更新四语言提示文案。
31
+ - 非生图辅助调用(`isAux && !isImage`)跳过 `SubagentTracker` 与 `driveSpan` 的 SQLite 思考/工具参数重试轮询,并在 `result` 成功事件到达时即刻落盘会话绑定,避免连续调用与子进程退出竞态。
32
+ - **修复(账号/模型列表与选号):单账号模型展示 0 冗余、修复编排模型误判不可用及全局发现目录归属。**
33
+ - 修复 Pro/Ultra 账号偶发误报 `lack model "gemini-pro-orchestrator-neon" in their catalog`:Google REST 配额接口(`fetchAvailableModels`)不会返回 CLI 虚拟编排模型(`gemini-pro-orchestrator-neon`、`gemini-pro-orchestrator-g1-pro`),导致账号尚未预热单账号 `agy models` 目录(如刚重启或刚加号)或缓存陈旧时被 `accountSupportsModel` 误拒。现支持分别通过 `gemini-4-neon` 配额与 Argon 权限证据识别编排模型,`baseModelSlug` 同步兼容 `-xhigh` 与 `-tiered-*` 后缀;全局 `ModelCatalog.refresh()` 成功时同步写入实际被探测的 `probedAccount.id` 账号目录,选号自愈 `refreshQuota` 亦补齐 `warmAccounts()`。
34
+ - 新增纯投影模块 `buildAccountModelRows()`(`src/common/account-models.ts`),并在 `/plugins/agy-link/status` 返回分账号发现目录 `accountModels`;`catalog.count` 同步对齐当前活跃账号真实可用模型数。
35
+ - 账号卡片展开列表不再直接平铺原始 REST 配额里的 30+ 冗余行,而是优先展示该账号自身 `agy models` 发现的去重模型与档位,回退时自动折叠 `-tiered`/档位后缀、过滤 `-sonar`/`-image` 内部项、按名称去重,且未知余量留空不伪造 `100%`。
36
+ - `POST /plugins/agy-link/pool/refresh-quota` 单账号刷新时显式传 `catalog.forceRefresh(id)`,全量刷新时同步触发 `catalog.warmAccounts()`。
37
+ - **修复(凭据隔离):加固 macOS/Linux `systemHome` 防切号踩踏与禁用主账号回退防护。**
38
+ - 非 Windows 下刷新 `systemHome`(`acc_primary`)OAuth token 落盘前,再次校验实时系统钥匙串 `refreshToken` 未切换;若刷新途中用户在 `Antigravity.app` 切号则丢弃旧响应,且当真实 `HOME` 下原本无磁盘 token 文件时不新建残片。
39
+ - `ModelCatalog` 全局发现回退严格跳过已停用或异常的 `lastActiveAccountId` / `primaryAccountId`,池内全部账号禁用时拒绝回退真实 `HOME` 触发无隔离探测。
40
+ - **修复(额度提示):区分 `VALIDATION_REQUIRED` / `TOS_VIOLATION` 与免费账号 `403 PERMISSION_DENIED`。**
41
+ - `classifySummaryRefusal()` 现优先识别 `TOS_VIOLATION` 与 `VALIDATION_REQUIRED`,不再把需要 Google 网页验证的 Pro/Ultra 账号误报为「免费账号 · 仅限周配额」;并从 403 响应提取 `validation_url` 存入 `quotaUnavailable.actionUrl`,在控制台以红色提示条直接给出「前往验证」链接(四语言)。
42
+ - **修复(运行稳定性):消除 `agy stream ended without a result event` 偶发失败与 3 次无效重放。**
43
+ - `agy 1.5+` 收到空闲收割 `SIGTERM` 时可能先吐出一个空的 `{ ok: false, response: '' }` 结果信封:`EventMapper` 会忽略该空错误,但原先 `rec.hasResult` 已为 `true` 导致跳过 SQLite 末条回复恢复并落入 `failureInfo = null`,进而触发 `agy stream ended without a result event` 且重试时 3 次重放同一条死记录。现改为判断是否存在可消费结果(`ok || response !== ''`),且续接命中无结果的已结束记录时主动忘记旧记录重新恢复。
44
+ - **修复(客户端):根治滚动 Antigravity 控制台/设置菜单闪屏。**
45
+ - 静态未上报(`—`)的配额条不再常驻无限 `.agy-shimmer-track` 动画(仅真正刷新中显示),移除 `.agy-shimmer-track` 的 `contain: paint` / `transform: translateZ(0)` / `isolation: isolate` 及 `.agy-btn:hover` / `.agy-card-hover` 的 `transform` / `filter` 合成层抖动,并为原生设置页挂载的 `SettingsSection` 增加引用计数 `acquireOverlaySuspend()` 暂停后台会话 DOM 扫描器。
46
+
3
47
  ## 0.6.46 (2026-11-20)
4
48
 
5
49
  ### English
@@ -162,7 +162,7 @@ function defaultConfig() {
162
162
  warmupModels: [PREFERRED_GEMINI_FLASH, PREFERRED_CLAUDE],
163
163
  autoTranslate: false,
164
164
  translateModel: PREFERRED_GEMINI_FLASH,
165
- translateEffort: "medium",
165
+ translateEffort: "low",
166
166
  translateTargetLanguage: "中文(简体)",
167
167
  translateMaxChars: 8e3,
168
168
  translateMaxTokens: 4096,
@@ -1480,7 +1480,7 @@ function accountHasArgon(acc, pool, catalog) {
1480
1480
  if (catalog && catalog.source === "discovered") return catalog.models?.some((m) => isArgonModel(m.id)) ?? false;
1481
1481
  return false;
1482
1482
  }
1483
- const EFFORT_SUFFIX_RE = /-(?:low|medium|high|tiered|thinking)$/i;
1483
+ const EFFORT_SUFFIX_RE = /-(?:tiered-)?(?:low|medium|high|xhigh|tiered|thinking)$/i;
1484
1484
  /**
1485
1485
  * Return the un-tiered base model slug (e.g. claude-opus-4-6-thinking -> claude-opus-4-6,
1486
1486
  * claude-opus-5-5-high -> claude-opus-5-5).
@@ -1502,6 +1502,14 @@ function modelMatches(requestedModel, candidateModelId) {
1502
1502
  if (r === c) return true;
1503
1503
  return baseModelSlug(r) === baseModelSlug(c);
1504
1504
  }
1505
+ function quotaSupportsModel(acc, clean, pool, catalog) {
1506
+ const familyQuotaModels = acc.quotas?.[modelFamilyOf(clean)]?.models;
1507
+ if (Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches(clean, m.modelId))) return true;
1508
+ const lower = clean.toLowerCase();
1509
+ if (lower === "gemini-pro-orchestrator-neon") return Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches("gemini-4-neon", m.modelId));
1510
+ if (lower === "gemini-pro-orchestrator-g1-pro") return accountHasArgon(acc, pool, catalog);
1511
+ return false;
1512
+ }
1505
1513
  /**
1506
1514
  * Determine whether a managed account supports a specific model.
1507
1515
  * If the account's quota or discovered catalog enumerates models for that family,
@@ -1514,14 +1522,13 @@ function accountSupportsModel(acc, model, pool, catalog) {
1514
1522
  if (isArgonModel(clean)) return accountHasArgon(acc, pool, catalog);
1515
1523
  if (catalog && catalog.source === "discovered" && Array.isArray(catalog.models) && catalog.models.length > 0) {
1516
1524
  if (catalog.models.some((m) => modelMatches(clean, m.id))) return true;
1517
- const familyQuotaModels = acc.quotas?.[modelFamilyOf(clean)]?.models;
1518
- if (Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches(clean, m.modelId))) return true;
1525
+ if (quotaSupportsModel(acc, clean, pool, catalog)) return true;
1519
1526
  return false;
1520
1527
  }
1521
1528
  const family = modelFamilyOf(clean);
1522
1529
  const familyQuota = acc.quotas?.[family];
1523
1530
  if (familyQuota) {
1524
- if (Array.isArray(familyQuota.models) && familyQuota.models.length > 0) return familyQuota.models.some((m) => modelMatches(clean, m.modelId));
1531
+ if (Array.isArray(familyQuota.models) && familyQuota.models.length > 0) return quotaSupportsModel(acc, clean, pool, catalog);
1525
1532
  return true;
1526
1533
  }
1527
1534
  if (acc.quotas && Object.keys(acc.quotas).length > 0 && acc.quotas.google !== void 0) return false;
@@ -2501,6 +2508,20 @@ var RunRecording = class {
2501
2508
  }
2502
2509
  return null;
2503
2510
  }
2511
+ /**
2512
+ * True when at least one consumable `result` event (`ok` or non-empty
2513
+ * `response`) exists at index >= `from`. A settled recording with
2514
+ * `failureInfo === null` and no consumable result at `>= from` would always
2515
+ * fail with `agy stream ended without a result event` if re-driven.
2516
+ */
2517
+ hasConsumableResultFrom(from) {
2518
+ const start = Math.max(0, from);
2519
+ for (let i = start; i < this.events.length; i++) {
2520
+ const ev = this.events[i];
2521
+ if (ev !== void 0 && ev.kind === "result" && (ev.ok || ev.response !== "")) return true;
2522
+ }
2523
+ return false;
2524
+ }
2504
2525
  /** Event at an absolute index (bounds-checked). */
2505
2526
  eventAt(index) {
2506
2527
  return this.events[index];
@@ -3864,7 +3885,7 @@ async function resolveEventToolArgs(rec, ev, i, resolved) {
3864
3885
  }
3865
3886
  }
3866
3887
  }
3867
- async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice) {
3888
+ async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment = false) {
3868
3889
  if (signal?.aborted) {
3869
3890
  rec.requestAbort?.();
3870
3891
  yield {
@@ -3882,14 +3903,14 @@ async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContex
3882
3903
  deps.runs.remember(rec);
3883
3904
  deps.runs.pin(rec.runId);
3884
3905
  try {
3885
- yield* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice);
3906
+ yield* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment);
3886
3907
  } finally {
3887
3908
  deps.runs.unpin(rec.runId);
3888
3909
  deps.runs.remember(rec);
3889
3910
  }
3890
3911
  }
3891
3912
  /** Body of {@link driveSpan}: map recorded events until the span finishes. */
3892
- async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice) {
3913
+ async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment = false) {
3893
3914
  const queue = new ChunkQueue();
3894
3915
  let abortedLocally = false;
3895
3916
  const onAbort = () => {
@@ -3930,9 +3951,11 @@ async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalCo
3930
3951
  try {
3931
3952
  for await (const ev of rec.eventsFrom(from)) {
3932
3953
  if (abortedLocally || signal?.aborted) break;
3933
- await resolveEventThought(rec, ev, i, resolvedThoughts, pendingThoughtSteps);
3934
- if (pendingThoughtSteps.size > 0) await resolvePendingThoughts(rec, ev, resolvedThoughts, pendingThoughtSteps);
3935
- await resolveEventToolArgs(rec, ev, i, resolved);
3954
+ if (!skipDbEnrichment) {
3955
+ await resolveEventThought(rec, ev, i, resolvedThoughts, pendingThoughtSteps);
3956
+ if (pendingThoughtSteps.size > 0) await resolvePendingThoughts(rec, ev, resolvedThoughts, pendingThoughtSteps);
3957
+ await resolveEventToolArgs(rec, ev, i, resolved);
3958
+ }
3936
3959
  for (const ch of mapper.map(ev, i)) queue.push(ch);
3937
3960
  i++;
3938
3961
  if (mapper.isFinished) {
@@ -4783,7 +4806,7 @@ var ModelCatalog = class ModelCatalog {
4783
4806
  const ac = new AbortController();
4784
4807
  const timer = setTimeout(() => ac.abort(), 3e4);
4785
4808
  try {
4786
- const { stdout, stderr } = await this.discover(ac.signal, accountId);
4809
+ const { stdout, stderr, accountId: probedAccountId } = await this.discover(ac.signal, accountId);
4787
4810
  if (isUnauthenticatedModelsFallback(stdout, stderr)) {
4788
4811
  const msg = "agy models returned unauthenticated fallback output";
4789
4812
  if (accountId) {
@@ -4812,7 +4835,10 @@ var ModelCatalog = class ModelCatalog {
4812
4835
  if (accountId) {
4813
4836
  this.accountCatalogs.set(accountId, newCatalog);
4814
4837
  if (this.current.source !== "discovered") this.current = newCatalog;
4815
- } else this.current = newCatalog;
4838
+ } else {
4839
+ this.current = newCatalog;
4840
+ if (probedAccountId) this.accountCatalogs.set(probedAccountId, newCatalog);
4841
+ }
4816
4842
  this.persistToDisk();
4817
4843
  if (changed && announce) this.onUpdate?.();
4818
4844
  return;
@@ -34101,7 +34127,7 @@ function buildSpawnArgs(input, printTimeoutMinutes, log) {
34101
34127
  };
34102
34128
  }
34103
34129
  /** Create the recording, parser, HOME snapshot and tool watchdog for one run. */
34104
- function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34130
+ function createAttemptRecorder(deps, cfg, account, initialConversationId, trackSubagents = true) {
34105
34131
  const rec = deps.runs.create();
34106
34132
  rec.accountHome = account && account.dir ? account.dir : void 0;
34107
34133
  const conversationsDir = conversationsDirFor(rec.accountHome);
@@ -34109,7 +34135,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34109
34135
  const parser = new StreamJsonParser();
34110
34136
  deps.onParser?.(parser);
34111
34137
  const watchdog = createToolWatchdog(deps.log, cfg);
34112
- const tracker = new SubagentTracker({
34138
+ const tracker = trackSubagents ? new SubagentTracker({
34113
34139
  conversationId: initialConversationId,
34114
34140
  resumed: Boolean(initialConversationId),
34115
34141
  accountHome: rec.accountHome,
@@ -34120,7 +34146,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34120
34146
  noteActivity: () => {
34121
34147
  watchdog.markEvent();
34122
34148
  }
34123
- });
34149
+ }) : void 0;
34124
34150
  const state = {
34125
34151
  rec,
34126
34152
  parser,
@@ -34130,8 +34156,8 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34130
34156
  printTimeoutMinutes: watchdog.printTimeoutMinutes,
34131
34157
  attachProcess: (proc) => {
34132
34158
  watchdog.attach(proc);
34133
- tracker.start();
34134
- proc.outcome.finally(() => tracker.stop());
34159
+ tracker?.start();
34160
+ proc.outcome.finally(() => tracker?.stop());
34135
34161
  },
34136
34162
  feedLine: (line, onEvent, onFirstEvent) => {
34137
34163
  watchdog.markEvent();
@@ -34139,11 +34165,11 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34139
34165
  for (const ev of parser.feed(line + "\n")) {
34140
34166
  if (ev.kind === "init" && ev.conversationId) {
34141
34167
  state.streamCid = ev.conversationId;
34142
- tracker.setConversationId(ev.conversationId);
34168
+ tracker?.setConversationId(ev.conversationId);
34143
34169
  }
34144
34170
  if (ev.kind === "result" && ev.conversationId !== "") {
34145
34171
  state.streamCid = ev.conversationId;
34146
- tracker.setConversationId(ev.conversationId);
34172
+ tracker?.setConversationId(ev.conversationId);
34147
34173
  }
34148
34174
  watchdog.trackStep(ev);
34149
34175
  rec.append(ev);
@@ -34156,7 +34182,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34156
34182
  for (const ev of parser.flush()) {
34157
34183
  if (ev.kind === "result" && ev.conversationId !== "") {
34158
34184
  state.streamCid = ev.conversationId;
34159
- tracker.setConversationId(ev.conversationId);
34185
+ tracker?.setConversationId(ev.conversationId);
34160
34186
  }
34161
34187
  rec.append(ev);
34162
34188
  if (typeof onEvent === "function") try {
@@ -34166,7 +34192,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
34166
34192
  },
34167
34193
  stop: () => {
34168
34194
  watchdog.stop();
34169
- tracker.stop();
34195
+ tracker?.stop();
34170
34196
  },
34171
34197
  conversationId: () => state.streamCid ?? diffConversations(before, conversationsDir).conversationId
34172
34198
  };
@@ -34230,6 +34256,19 @@ async function waitForRunSettle(run, timeoutMs) {
34230
34256
  }
34231
34257
  return run.isSettled;
34232
34258
  }
34259
+ function persistBindingOnResult(deps, input, recorder, ev) {
34260
+ if (ev.kind !== "result" || !ev.ok || looksLikeTosViolation(ev.response) || !input.persistBinding || input.sessionAccountKey === "" || deps.isSuperseded(input.sessionKey, recorder.rec)) return;
34261
+ const finalId = input.binding !== void 0 ? input.binding.conversationId : ev.conversationId || recorder.streamCid;
34262
+ if (!finalId) return;
34263
+ const mergedImages = input.binding?.sentImageIds || input.newlySentImageIds.length > 0 ? [.../* @__PURE__ */ new Set([...input.binding?.sentImageIds ?? [], ...input.newlySentImageIds])] : void 0;
34264
+ deps.store.set(input.sessionAccountKey, {
34265
+ conversationId: finalId,
34266
+ lastMessageCount: input.messages.length,
34267
+ updatedAt: Date.now(),
34268
+ model: input.activeModel,
34269
+ ...mergedImages && mergedImages.length > 0 ? { sentImageIds: mergedImages } : {}
34270
+ });
34271
+ }
34233
34272
  /**
34234
34273
  * Spawn the child under the held slot. Installs the line callback (parser feed
34235
34274
  * + tool watchdog + first-event hand-off), registers the run for steer
@@ -34273,9 +34312,10 @@ async function startAttemptProcess(deps, input, spawn, recorder, slot) {
34273
34312
  stdinPayload: spawn.stdinPayload,
34274
34313
  preemptAutoUpdate: cfg.suppressAgyAutoUpdate,
34275
34314
  stderrKeepalive: true,
34276
- onLine: (line) => {
34277
- recorder.feedLine(line, input.agyOnEvent, () => slotHandoff?.onFirstEvent());
34278
- }
34315
+ onLine: (line) => recorder.feedLine(line, (ev) => {
34316
+ persistBindingOnResult(deps, input, recorder, ev);
34317
+ input.agyOnEvent?.(ev);
34318
+ }, () => slotHandoff?.onFirstEvent())
34279
34319
  });
34280
34320
  spawned = true;
34281
34321
  recorder.attachProcess(proc);
@@ -34785,7 +34825,8 @@ async function handleAttemptOutcome(deps, input, ctx) {
34785
34825
  deps.clearInFlightPrompt(sessionKey, spawn.prompt);
34786
34826
  recorder.drain(input.agyOnEvent);
34787
34827
  const conversationId = recorder.conversationId();
34788
- if (!rec.hasResult && outcome.idleGraceTerminated) {
34828
+ const existingRes = rec.getResultEvent();
34829
+ if (!(existingRes !== null && (existingRes.ok || existingRes.response !== "")) && outcome.idleGraceTerminated) {
34789
34830
  const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
34790
34831
  const synthResult = {
34791
34832
  kind: "result",
@@ -34846,7 +34887,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
34846
34887
  * queue notices; the outcome closure runs detached exactly as before.
34847
34888
  */
34848
34889
  async function* runAgyAttempt(deps, input) {
34849
- const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId);
34890
+ const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId, !input.isAux);
34850
34891
  const spawn = buildSpawnArgs(input, recorder.printTimeoutMinutes, deps.log);
34851
34892
  const slot = yield* dispatchCredentialSlot(deps, {
34852
34893
  ...input,
@@ -35091,13 +35132,14 @@ var AgyAdapter = class extends LlmAdapter {
35091
35132
  if (continuation !== null) {
35092
35133
  const rec = this.deps.runs.get(continuation.runId);
35093
35134
  const deadFailure = rec !== void 0 && rec.isSettled ? rec.failureInfo : null;
35094
- if (rec !== void 0 && !(deadFailure !== null && this.claimFailover(sessionKey, deadFailure.code))) {
35135
+ const deadMissingResult = rec !== void 0 && rec.isSettled && deadFailure === null && !rec.hasConsumableResultFrom(continuation.eventIndex + 1);
35136
+ if (rec !== void 0 && !deadMissingResult && !(deadFailure !== null && this.claimFailover(sessionKey, deadFailure.code))) {
35095
35137
  yield* driveSpan(this.deps, rec, continuation.eventIndex + 1, hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal);
35096
35138
  return;
35097
35139
  }
35098
35140
  if (rec !== void 0) {
35099
35141
  this.deps.runs.forget(continuation.runId);
35100
- this.warnOnce("dead-continuation:" + continuation.runId, "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
35142
+ this.warnOnce("dead-continuation:" + continuation.runId, deadMissingResult ? "agy run " + continuation.runId + " settled without a consumable result — retrying this step instead of replaying an empty stream" : "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
35101
35143
  } else this.warnOnce("stale-continuation:" + continuation.runId, "agy run " + continuation.runId + " is no longer available in memory (server restarted?) — falling back to fresh turn prompt assembly");
35102
35144
  }
35103
35145
  const catalog = this.deps.catalog.get();
@@ -35282,7 +35324,7 @@ var AgyAdapter = class extends LlmAdapter {
35282
35324
  signal: options.signal,
35283
35325
  agyOnEvent: options.agyOnEvent
35284
35326
  });
35285
- yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice);
35327
+ yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice, isAux && !isImage);
35286
35328
  }
35287
35329
  };
35288
35330
  //#endregion