dsh-agy-link 0.4.99 → 0.4.100

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.100 (2026-11-02)
4
+
5
+ ### English
6
+
7
+ - **Fix(host): stop dropping reasoning text on tool turns; debounce the negative thought cache.** (thanks @Ronnoc, #65)
8
+ - With `--input-format stream-json`, thought text is written asynchronously to agy's SQLite DB, so on turns that immediately call a tool the initial `text` step often found `null`, and `cache.checkedSteps` then cached that miss for 5 minutes — the model's thoughts never surfaced. The cache miss skip is now a 500 ms debounce, pending thought steps are retried when tool steps arrive, and `flushBannerOnlyThoughts()` appends late-arriving prose to the reasoning block before a tool cut / result envelope closes it. Also resolves conversation DB dirs from the real HOME for isolated pool accounts.
9
+
10
+ ### 中文
11
+
12
+ - **修复(host):工具轮不再丢弃思考正文;负缓存改为短去抖。**(感谢 @Ronnoc,#65)
13
+ - `--input-format stream-json` 下思考正文异步写入 agy 的 SQLite,若回合立即调用工具,初始 `text` 步骤常读不到(null),而 `cache.checkedSteps` 会把这次未命中缓存 5 分钟,导致思考内容永远不显示。现未命中跳过改为 500ms 去抖、工具步骤到来时重试待定思考步骤,并在工具切分/结果信封关闭前用 `flushBannerOnlyThoughts()` 补写迟到的正文;同时支持从真实 HOME 解析池账号的会话 DB 目录。
14
+
15
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.99...v0.4.100
16
+
3
17
  ## 0.4.99 (2026-10-31)
4
18
 
5
19
  ### English
package/dist/index.js CHANGED
@@ -1899,6 +1899,7 @@ var EventMapper = class {
1899
1899
  * banner and the entry is consumed.
1900
1900
  */
1901
1901
  bannerOnlyShown = /* @__PURE__ */ new Set();
1902
+ bannerOnlyIndices = /* @__PURE__ */ new Map();
1902
1903
  bannerOnlyThinkingEmitted = false;
1903
1904
  sawTextStep;
1904
1905
  finished = false;
@@ -1973,7 +1974,10 @@ var EventMapper = class {
1973
1974
  const hasText = text !== void 0 && text.trim() !== "";
1974
1975
  if (!hasText && !allowBannerOnly) return;
1975
1976
  const bannerAlreadyShown = this.bannerOnlyShown.has(stepKey);
1976
- if (hasText) this.bannerOnlyShown.delete(stepKey);
1977
+ if (hasText) {
1978
+ this.bannerOnlyShown.delete(stepKey);
1979
+ this.bannerOnlyIndices.delete(stepKey);
1980
+ } else this.bannerOnlyIndices.set(stepKey, absIndex);
1977
1981
  yield* this.ensureBlock("reasoning");
1978
1982
  const banner = thoughtTokens > 0 ? "[agy · " + thoughtTokens + " tokens]" : "[agy]";
1979
1983
  const combined = !hasText ? `${banner}\n` : bannerAlreadyShown ? `${text.trim()}\n` : `${banner} ${text.trim()}\n`;
@@ -1985,10 +1989,27 @@ var EventMapper = class {
1985
1989
  * it mints the mirror callId and is what continuation detection parses
1986
1990
  * back out of the DSH message list.
1987
1991
  */
1992
+ /**
1993
+ * Flush any thinking prose that resolved in the DB after its banner-only
1994
+ * placeholder already streamed (e.g. tool-heavy steps where thoughts resolved
1995
+ * during tool execution).
1996
+ */
1997
+ *flushBannerOnlyThoughts() {
1998
+ if (this.bannerOnlyShown.size === 0) return;
1999
+ for (const [stepKey, absIdx] of Array.from(this.bannerOnlyIndices.entries())) {
2000
+ if (!this.bannerOnlyShown.has(stepKey)) continue;
2001
+ const text = this.opts.resolvedThoughts?.get(absIdx);
2002
+ if (text !== void 0 && text.trim() !== "") {
2003
+ yield* this.emitThinking(stepKey, absIdx, 0);
2004
+ this.bannerOnlyIndices.delete(stepKey);
2005
+ }
2006
+ }
2007
+ }
1988
2008
  *map(ev, absIndex) {
1989
2009
  if (this.finished) return;
1990
2010
  if (ev.kind === "init") return;
1991
2011
  if (ev.kind === "garbage") return;
2012
+ yield* this.flushBannerOnlyThoughts();
1992
2013
  if (ev.kind === "step") {
1993
2014
  if (ev.usage) this.opts.usage?.noteStepUsage(ev.usage);
1994
2015
  if (ev.stepKind === "text") {
@@ -2075,6 +2096,7 @@ var EventMapper = class {
2075
2096
  if (this.announcedTools.has(ev.stepKey)) return;
2076
2097
  this.announcedTools.add(ev.stepKey);
2077
2098
  if (!this.opts.cutOnTool) return;
2099
+ yield* this.flushBannerOnlyThoughts();
2078
2100
  const close = this.closeOpen();
2079
2101
  if (close) yield close;
2080
2102
  const idx = this.blockIdx;
@@ -2146,6 +2168,7 @@ var EventMapper = class {
2146
2168
  const d = this.appendDelta(ev.response);
2147
2169
  if (d) yield d;
2148
2170
  }
2171
+ yield* this.flushBannerOnlyThoughts();
2149
2172
  const close = this.closeOpen();
2150
2173
  if (close) yield close;
2151
2174
  yield {
@@ -29728,11 +29751,13 @@ function conversationsDirCandidates(accountHome) {
29728
29751
  if (gch !== void 0 && gch !== "") push(join(gch, "antigravity-cli", "conversations"));
29729
29752
  push(AGY_DB_DIR);
29730
29753
  push(join(homedir(), ".gemini", "antigravity-cli", "conversations"));
29731
- const poolBase = join(homedir(), ".dsh", "agy-accounts");
29732
- try {
29733
- for (const ent of readdirSync(poolBase)) {
29754
+ const realHome = process.env.USERPROFILE || process.env.HOME || homedir();
29755
+ const poolBases = [join(homedir(), ".dsh", "agy-accounts")];
29756
+ if (realHome && realHome !== homedir()) poolBases.push(join(realHome, ".dsh", "agy-accounts"));
29757
+ for (const pb of poolBases) try {
29758
+ for (const ent of readdirSync(pb)) {
29734
29759
  if (ent.startsWith(".")) continue;
29735
- push(join(poolBase, ent, ".gemini", "antigravity-cli", "conversations"));
29760
+ push(join(pb, ent, ".gemini", "antigravity-cli", "conversations"));
29736
29761
  }
29737
29762
  } catch {}
29738
29763
  return dirs;
@@ -30213,7 +30238,7 @@ async function readFullToolArgs(conversationId, stepIndex, accountHome) {
30213
30238
  if (cache?.conversationId === conversationId && cache.loaded && now - cacheTime < MAX_CACHE_AGE_MS) {
30214
30239
  const cached = cache.steps.get(stepIndex);
30215
30240
  if (cached !== void 0) return cached;
30216
- if (cache.checkedSteps.has(stepIndex)) return null;
30241
+ if (cache.checkedSteps.has(stepIndex) && now - cacheTime < 500) return null;
30217
30242
  }
30218
30243
  await loadCached(conversationId, accountHome);
30219
30244
  return cache?.steps.get(stepIndex) ?? null;
@@ -30229,7 +30254,7 @@ async function readStepThoughts(conversationId, stepIndex, accountHome) {
30229
30254
  if (cache?.conversationId === conversationId && cache.loaded && now - cacheTime < MAX_CACHE_AGE_MS) {
30230
30255
  const cached = cache.thoughts.get(stepIndex);
30231
30256
  if (cached !== void 0) return cached;
30232
- if (cache.checkedSteps.has(stepIndex)) return null;
30257
+ if (cache.checkedSteps.has(stepIndex) && now - cacheTime < 500) return null;
30233
30258
  }
30234
30259
  await loadCached(conversationId, accountHome);
30235
30260
  return cache?.thoughts.get(stepIndex) ?? null;
@@ -31867,13 +31892,14 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
31867
31892
  supportsPlanExit
31868
31893
  });
31869
31894
  let i = from;
31895
+ const pendingThoughtSteps = /* @__PURE__ */ new Map();
31870
31896
  try {
31871
31897
  for await (const ev of rec.eventsFrom(from)) {
31872
31898
  if (abortedLocally || signal?.aborted) break;
31873
31899
  const recordedThought = rec.getThoughts(i);
31874
31900
  if (recordedThought !== void 0) resolvedThoughts.set(i, recordedThought);
31875
31901
  else if (ev.kind === "step") {
31876
- const rawObj = ev.raw && typeof ev.raw === "object" ? ev.raw : null;
31902
+ const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
31877
31903
  const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
31878
31904
  const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
31879
31905
  const stepIdx = parseInt(ev.stepKey, 10);
@@ -31890,11 +31916,27 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
31890
31916
  if (th !== null && th.trim() !== "") {
31891
31917
  resolvedThoughts.set(i, th);
31892
31918
  rec.setThoughts(i, th);
31893
- }
31919
+ } else if ((ev.usage?.thinking_tokens ?? 0) > 0 || ev.stepKind === "thinking") pendingThoughtSteps.set(i, ev.stepKey);
31894
31920
  } catch {}
31895
31921
  }
31922
+ if (pendingThoughtSteps.size > 0) {
31923
+ const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
31924
+ const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
31925
+ const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
31926
+ if (activeConvId !== null) for (const [prevI, prevStepKey] of Array.from(pendingThoughtSteps.entries())) {
31927
+ const prevStepIdx = parseInt(prevStepKey, 10);
31928
+ if (Number.isFinite(prevStepIdx)) try {
31929
+ const th = await readStepThoughts(activeConvId, prevStepIdx, rec.accountHome);
31930
+ if (th !== null && th.trim() !== "") {
31931
+ resolvedThoughts.set(prevI, th);
31932
+ rec.setThoughts(prevI, th);
31933
+ pendingThoughtSteps.delete(prevI);
31934
+ }
31935
+ } catch {}
31936
+ }
31937
+ }
31896
31938
  if (ev.kind === "step" && ev.stepKind === "tool" && ev.tool) {
31897
- const rawObj = ev.raw && typeof ev.raw === "object" ? ev.raw : null;
31939
+ const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
31898
31940
  const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
31899
31941
  const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
31900
31942
  const stepIdx = parseInt(ev.stepKey, 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.4.99",
3
+ "version": "0.4.100",
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",