@liang-hz/agent-in-chrome 0.55.2 → 0.55.5

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.
@@ -446,30 +446,37 @@ export function readClaudeSubagent(meta, local, { fs = fsMod, home = osMod.homed
446
446
  return null;
447
447
  }
448
448
 
449
+ export function workbuddyConfigDir({ env = process.env, home = osMod.homedir() } = {}) {
450
+ const d = typeof env.WORKBUDDY_CONFIG_DIR === "string" ? env.WORKBUDDY_CONFIG_DIR.trim() : "";
451
+ return d || path.join(home, ".workbuddy");
452
+ }
453
+
449
454
  export function readWorkbuddySessionTitle({
450
455
  env = process.env,
456
+ home = osMod.homedir(),
451
457
  fs = fsMod,
452
458
  exec = execFileSync,
453
459
  alive = pidAlive,
454
460
  meta = null,
455
461
  enginePid = null,
456
462
  } = {}) {
457
- const dir = typeof env.WORKBUDDY_CONFIG_DIR === "string" ? env.WORKBUDDY_CONFIG_DIR : "";
463
+ const dir = workbuddyConfigDir({ env, home });
458
464
  if (!path.isAbsolute(dir)) return null;
459
465
  const id =
460
466
  workbuddyConversationId(meta) ||
461
467
  workbuddyEngineSession(dir, enginePid, { fs }) ||
462
468
  workbuddyOnlyLiveSession(dir, { fs, alive });
463
469
  if (!id) return null;
464
- /* `${id}` 是直接拼进 SQL 字符串的(sqlite3 CLI 不好参数化),所以上面三个来源都必须
465
- * 先过 CONV_UUID_RE 才走得到这里:把那个锚放宽就等于开一个注入口。 */
470
+ /* id 会以绑定参数进查询(CLI 退路里才落成字面量,本层有转义兜底)。形状锚
471
+ * CONV_UUID_RE 照旧不许放宽:它是这条链的第一道闸,不是最后一道。 */
466
472
  try {
467
- const out = exec(
468
- process.platform === "win32" ? "sqlite3" : "/usr/bin/sqlite3",
469
- ["-readonly", path.join(dir, "workbuddy.db"), `select coalesce(custom_title, title) from sessions where id='${id}' and deleted_at is null`],
470
- { encoding: "utf8", timeout: 2000 }
473
+ const rows = sqliteColumn(
474
+ path.join(dir, "workbuddy.db"),
475
+ "select coalesce(custom_title, title) from sessions where id=? and deleted_at is null",
476
+ [id],
477
+ exec
471
478
  );
472
- return clip(String(out || "").trim(), 60);
479
+ return clip(String(rows[0] ?? "").trim(), 60);
473
480
  } catch {
474
481
  return null;
475
482
  }
@@ -610,6 +617,59 @@ export function resetTitleMemo() {
610
617
  titleMemo.clear();
611
618
  dshCwdMemo.clear();
612
619
  agWsMemo.clear();
620
+ dshTalkMemo.clear();
621
+ dshHeaderMemo.clear();
622
+ }
623
+
624
+ // 顶层 await:只等一个内置模块的 import(微任务级),之后所有读库函数保持同步——
625
+ // 调用方(每帧的身份刷新)是同步上下文,等不起 promise。
626
+ //
627
+ // import 本身会把 ExperimentalWarning 打上 stderr(首次加载 node:sqlite 时发一次)。
628
+ // server 走 stdio,stderr 是日志的家,一点噪声都会进客户端的日志面板,一条实验
629
+ // 警告都嫌多。警告是经 process.emitWarning 发出来的,只在这一次 import 的窗口里
630
+ // 换上一张只滤这一条的滤网,走完立刻还原;其余警告原样放行。加
631
+ // process.on("warning") 监听压不掉它——默认打印器照跑。
632
+ const NODE_SQLITE = await (async () => {
633
+ const origEmitWarning = process.emitWarning;
634
+ process.emitWarning = function (warning, ...args) {
635
+ const msg = typeof warning === "string" ? warning : warning?.message;
636
+ if (typeof msg === "string" && /^SQLite is an experimental feature/.test(msg)) return;
637
+ return origEmitWarning.call(process, warning, ...args);
638
+ };
639
+ try {
640
+ return (await import("node:sqlite").catch(() => null))?.DatabaseSync ?? null;
641
+ } finally {
642
+ process.emitWarning = origEmitWarning;
643
+ }
644
+ })();
645
+
646
+ /* 只给测试用:换掉读库实现(传 null 恢复默认),让四家读取器不必真库也能验 */
647
+ let sqliteColumnImpl = null;
648
+ export function setSqliteColumn(fn) {
649
+ sqliteColumnImpl = fn;
650
+ }
651
+
652
+ export function sqliteColumn(db, sql, params = [], exec = execFileSync) {
653
+ if (sqliteColumnImpl) return sqliteColumnImpl(db, sql, params);
654
+ if (NODE_SQLITE) {
655
+ if (!fsMod.existsSync(db)) throw new Error(`no such db: ${db}`);
656
+ const d = new NODE_SQLITE(db, { readOnly: true });
657
+ try {
658
+ return d.prepare(sql).all(...params).map((row) => Object.values(row)[0]);
659
+ } finally {
660
+ try {
661
+ d.close();
662
+ } catch {}
663
+ }
664
+ }
665
+ const bin = process.platform === "win32" ? "sqlite3" : "/usr/bin/sqlite3";
666
+ let i = 0;
667
+ const literal = sql.replace(/\?/g, () => `'${String(params[i++] ?? "").replace(/'/g, "''")}'`);
668
+ const out = exec(bin, ["-readonly", db, literal], { encoding: "utf8", timeout: 2000, maxBuffer: 16 << 20 });
669
+ return String(out || "")
670
+ .split("\n")
671
+ .map((l) => l.replace(/\r$/, ""))
672
+ .filter((l, idx, arr) => !(idx === arr.length - 1 && l === ""));
613
673
  }
614
674
 
615
675
  export function zcodeDataDir({ env = process.env, home = osMod.homedir() } = {}) {
@@ -625,12 +685,12 @@ export function readZcodeSessionTitle(meta, { env = process.env, home = osMod.ho
625
685
  if (!isMain && !isSub) return null;
626
686
  const db = path.join(zcodeDataDir({ env, home }), "cli", "db", "db.sqlite");
627
687
  if (!fs.existsSync(db)) return null;
628
- const sql = isSub
629
- ? `select title from session where id=(select parent_id from session where id='${id}') and title_source in ('generated','custom')`
630
- : `select title from session where id='${id}' and title_source in ('generated','custom')`;
631
688
  return memoTitle(`zcode:${db}:${id}`, () => {
632
- const out = exec("/usr/bin/sqlite3", ["-readonly", db, sql], { encoding: "utf8", timeout: 2000 });
633
- return clip(String(out || "").trim(), 60);
689
+ const sql = isSub
690
+ ? "select title from session where id=(select parent_id from session where id=?) and title_source in ('generated','custom')"
691
+ : "select title from session where id=? and title_source in ('generated','custom')";
692
+ const rows = sqliteColumn(db, sql, [id], exec);
693
+ return clip(String(rows[0] ?? "").trim(), 60);
634
694
  });
635
695
  }
636
696
 
@@ -795,9 +855,15 @@ export function dshHome({ env = process.env, home = osMod.homedir() } = {}) {
795
855
  return path.isAbsolute(d) ? d : path.join(home, ".dsh");
796
856
  }
797
857
 
858
+ const DSH_DESKTOP_APP = /DeepSeek Harness\.app[\\/]Contents[\\/]MacOS[\\/]/;
859
+
798
860
  export function isDshClient(clientCommand) {
799
861
  const s = String(clientCommand || "");
800
- return /@deepseek-ai[\\/]dsh[\\/]/.test(s) || /[\\/]\.bin[\\/]dsh(\.cmd|\.exe|\.bat)?(\s|$)/.test(s);
862
+ return (
863
+ /@deepseek-ai[\\/]dsh[\\/]/.test(s) ||
864
+ /[\\/]\.bin[\\/]dsh(\.cmd|\.exe|\.bat)?(\s|$)/.test(s) ||
865
+ DSH_DESKTOP_APP.test(s)
866
+ );
801
867
  }
802
868
 
803
869
  export function decodeZstdFrames(buf, { zlib = zlibMod } = {}) {
@@ -817,13 +883,112 @@ export function decodeZstdFrames(buf, { zlib = zlibMod } = {}) {
817
883
 
818
884
  const dshCwdMemo = new Map();
819
885
 
886
+ const DSH_LOG_NAME = /^session(?:\.v(\d+))?\.jsonl\.zstd$/;
887
+
888
+ function dshLogFile(dir, fs = fsMod) {
889
+ let names;
890
+ try {
891
+ names = fs.readdirSync(dir);
892
+ } catch {
893
+ return null;
894
+ }
895
+ let best = null;
896
+ let bestV = -1;
897
+ for (const n of names) {
898
+ const m = DSH_LOG_NAME.exec(n);
899
+ if (!m) continue;
900
+ const v = m[1] === undefined ? 0 : Number(m[1]);
901
+ if (v <= bestV) continue;
902
+ bestV = v;
903
+ best = path.join(dir, n);
904
+ }
905
+ return best;
906
+ }
907
+
908
+ const dshTalkMemo = new Map();
909
+
910
+ function dshHasConversation(c, fs = fsMod) {
911
+ let key;
912
+ try {
913
+ const st = fs.statSync(c.file);
914
+ key = `${c.file}:${st.mtimeMs}:${st.size}`;
915
+ } catch {
916
+ return false;
917
+ }
918
+ const hit = dshTalkMemo.get(key);
919
+ if (hit !== undefined) return hit;
920
+ let ok = false;
921
+ try {
922
+ const text = decodeZstdFrames(fs.readFileSync(c.file));
923
+ ok = typeof text === "string" && (text.includes('"type":"user/message"') || text.includes('"type":"session/title"'));
924
+ } catch {
925
+ ok = false;
926
+ }
927
+ if (dshTalkMemo.size >= TITLE_MEMO_MAX) dshTalkMemo.clear();
928
+ dshTalkMemo.set(key, ok);
929
+ return ok;
930
+ }
931
+
932
+ const DSH_SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
933
+
934
+ function dshLogById(root, id, fs) {
935
+ if (!DSH_SESSION_ID.test(id)) return null;
936
+ let dirs;
937
+ try {
938
+ dirs = fs.readdirSync(root);
939
+ } catch {
940
+ return null;
941
+ }
942
+ for (const d of dirs.slice(0, 500)) {
943
+ const file = dshLogFile(path.join(root, d, id), fs);
944
+ if (file) return { id, file };
945
+ }
946
+ return null;
947
+ }
948
+
949
+ const dshHeaderMemo = new Map();
950
+
951
+ function dshHeader(file, fs) {
952
+ const hit = dshHeaderMemo.get(file);
953
+ if (hit !== undefined) return hit;
954
+ let h = null;
955
+ try {
956
+ const first = zlibMod.zstdDecompressSync ? zlibMod.zstdDecompressSync(fs.readFileSync(file)) : null;
957
+ const parsed = first ? JSON.parse(first.toString("utf8").split("\n")[0]) : null;
958
+ if (parsed && parsed.type === "session") h = parsed;
959
+ } catch {}
960
+ if (dshHeaderMemo.size >= TITLE_MEMO_MAX) dshHeaderMemo.clear();
961
+ dshHeaderMemo.set(file, h);
962
+ return h;
963
+ }
964
+
820
965
  /*
821
- * 恰好一个活跃会话时返回 { id, title, cwd };分不出(0 个或多个活跃)就 null。
822
- * title 可能暂缺(LLM 标题是首轮之后才生成的)——cwd 先到先用,两者不互相拖累。
966
+ * 子任务会话上溯到它所属的主会话。
967
+ *
968
+ * 子会话的头里有 `origin:"subagent"` 和 `parentSession`(dsH 侧写入点见
969
+ * subagent/child-agent.ts 的 childSessionMeta)。**卡片上「会话名」只有一行**,它要回答的
970
+ * 是「这些页属于我哪一段对话」——而子任务的标题就是那段委派提示词的开头,盖上去等于把
971
+ * 用户刚说的话又抄一遍。这条口径与 ZCode 顺着 parent_id 报主会话标题完全一致(那边注释
972
+ * 原话:「拿 subagent 的名字盖掉主会话的名字是显示错,不是少显示」)。
973
+ *
974
+ * 工作区**也一起取主会话的**:子会话虽然继承了父会话的 cwd,但同一条归属链上取回来更硬——
975
+ * 不去依赖「继承」这个实现细节。
976
+ *
977
+ * 父会话解不出来(已被清理、读不动)就停在能解到的那一层:宁可显示子会话,也不显示空。
823
978
  */
824
- export function readDshSession(local, { env = process.env, home = osMod.homedir(), fs = fsMod, now = Date.now() } = {}) {
825
- if (!local || !isDshClient(local.clientCommand)) return null;
826
- const root = path.join(dshHome({ env, home }), "sessions");
979
+ function dshRootOf(root, start, fs, { maxHops = 8 } = {}) {
980
+ let cur = start;
981
+ for (let i = 0; i < maxHops; i++) {
982
+ const h = dshHeader(cur.file, fs);
983
+ if (!h || (h.origin !== "subagent" && typeof h.parentSession !== "string")) return cur;
984
+ const up = typeof h.parentSession === "string" ? dshLogById(root, h.parentSession, fs) : null;
985
+ if (!up) return cur;
986
+ cur = up;
987
+ }
988
+ return cur;
989
+ }
990
+
991
+ function dshPickLive(root, fs, now) {
827
992
  const live = [];
828
993
  let dirs;
829
994
  try {
@@ -839,17 +1004,29 @@ export function readDshSession(local, { env = process.env, home = osMod.homedir(
839
1004
  continue;
840
1005
  }
841
1006
  for (const s of subs) {
842
- if (!s.startsWith("session-")) continue;
843
- const file = path.join(root, d, s, "session.jsonl.zstd");
1007
+ const file = dshLogFile(path.join(root, d, s), fs);
1008
+ if (!file) continue;
844
1009
  try {
845
1010
  const st = fs.statSync(file);
846
1011
  if (now - st.mtimeMs <= DSH_LIVE_WINDOW_MS) live.push({ id: s, file });
847
1012
  } catch {}
848
- if (live.length > 1) return null;
849
1013
  }
850
1014
  }
851
- if (live.length !== 1) return null;
852
- const { id, file } = live[0];
1015
+ const talking = live.length === 1 ? live : live.filter((c) => dshHasConversation(c, fs));
1016
+ return talking.length === 1 ? talking[0] : null;
1017
+ }
1018
+
1019
+ /*
1020
+ * 恰好一个活跃会话时返回 { id, title, cwd };分不出(0 个或多个活跃)就 null。
1021
+ * title 可能暂缺(LLM 标题是首轮之后才生成的)——cwd 先到先用,两者不互相拖累。
1022
+ */
1023
+ export function readDshSession(local, { env = process.env, home = osMod.homedir(), fs = fsMod, now = Date.now(), meta = null } = {}) {
1024
+ if (!local || !isDshClient(local.clientCommand)) return null;
1025
+ const root = path.join(dshHome({ env, home }), "sessions");
1026
+ const asked = meta && typeof meta === "object" && typeof meta.session_id === "string" ? meta.session_id.trim() : "";
1027
+ const picked = (asked ? dshLogById(root, asked, fs) : null) || dshPickLive(root, fs, now);
1028
+ if (!picked) return null;
1029
+ const { id, file } = dshRootOf(root, picked, fs);
853
1030
 
854
1031
  let cwd = dshCwdMemo.get(id);
855
1032
  const title = memoTitle(`dsh:${file}`, () => {
@@ -898,6 +1075,44 @@ export function readDshSession(local, { env = process.env, home = osMod.homedir(
898
1075
  return { id, title: title || null, cwd: cwd || null };
899
1076
  }
900
1077
 
1078
+ function dshOwnTitle(file, fs) {
1079
+ return memoTitle(`dsh-own:${file}`, () => {
1080
+ let text;
1081
+ try {
1082
+ text = decodeZstdFrames(fs.readFileSync(file));
1083
+ } catch {
1084
+ return null;
1085
+ }
1086
+ if (!text) return null;
1087
+ let found = null;
1088
+ for (const line of text.split("\n")) {
1089
+ if (!line.includes('"session/title"')) continue;
1090
+ try {
1091
+ const ev = JSON.parse(line);
1092
+ if (ev?.type === "session/title") {
1093
+ const t = clip(ev.data?.title, 60);
1094
+ if (t) found = t;
1095
+ }
1096
+ } catch {}
1097
+ }
1098
+ return found;
1099
+ });
1100
+ }
1101
+
1102
+ export function readDshSubagent(meta, local, { env = process.env, home = osMod.homedir(), fs = fsMod } = {}) {
1103
+ if (!local || !isDshClient(local.clientCommand)) return null;
1104
+ const id = meta && typeof meta === "object" && typeof meta.session_id === "string" ? meta.session_id.trim() : "";
1105
+ if (!id) return null;
1106
+ const own = dshLogById(path.join(dshHome({ env, home }), "sessions"), id, fs);
1107
+ if (!own) return null;
1108
+ const h = dshHeader(own.file, fs);
1109
+ if (!h || (h.origin !== "subagent" && typeof h.parentSession !== "string")) return null;
1110
+ const label = dshOwnTitle(own.file, fs);
1111
+ const type = typeof h.agentPreset === "string" && h.agentPreset ? clip(h.agentPreset, 40) : null;
1112
+ if (!label && !type) return null;
1113
+ return { label: label || null, type };
1114
+ }
1115
+
901
1116
  /* 会话 id 进路径、SQL 与提取流程前的锚(安全边界,勿放宽):只放行 UUID 形状,`..`、`/`、
902
1117
  * 引号一概进不来——id 来自 MCP 调用方给的 _meta,是外部输入。
903
1118
  *
@@ -1059,14 +1274,15 @@ export function readAntigravitySessionTitle(meta, local, { fs = fsMod, home = os
1059
1274
  try {
1060
1275
  if (fs.statSync(`${db}-wal`).size <= AG_DB_MAX) fs.copyFileSync(`${db}-wal`, `${copy}-wal`);
1061
1276
  } catch {}
1062
- const out = exec(
1063
- process.platform === "win32" ? "sqlite3" : "/usr/bin/sqlite3",
1064
- [copy, `select hex(step_payload) from steps where step_type = ${AG_META_STEP} and length(step_payload) <= ${AG_STEP_MAX} order by idx limit ${AG_STEP_ROWS}`],
1065
- { encoding: "utf8", timeout: 2000, maxBuffer: AG_OUT_MAX }
1277
+ const lines = sqliteColumn(
1278
+ copy,
1279
+ `select hex(step_payload) from steps where step_type = ${AG_META_STEP} and length(step_payload) <= ${AG_STEP_MAX} order by idx limit ${AG_STEP_ROWS}`,
1280
+ [],
1281
+ exec
1066
1282
  );
1067
1283
  const rows = [];
1068
- for (const line of String(out || "").split("\n")) {
1069
- const hex = line.trim();
1284
+ for (const line of lines) {
1285
+ const hex = String(line ?? "").trim();
1070
1286
  if (hex && /^(?:[0-9a-f]{2})+$/i.test(hex)) rows.push(Buffer.from(hex, "hex"));
1071
1287
  }
1072
1288
  return agTitleFromRows(rows);
@@ -1094,45 +1310,61 @@ export function codexThreadId(meta) {
1094
1310
  return CONV_UUID_RE.test(id) ? id : null;
1095
1311
  }
1096
1312
 
1097
- export function readCodexSessionTitle(meta, { env = process.env, home = osMod.homedir(), fs = fsMod } = {}) {
1313
+ export function readCodexSessionTitle(meta, { env = process.env, home = osMod.homedir(), fs = fsMod, exec = execFileSync } = {}) {
1098
1314
  const id = codexThreadId(meta);
1099
1315
  if (!id) return null;
1100
- const file = path.join(codexHome({ env, home }), "session_index.jsonl");
1316
+ const dir = codexHome({ env, home });
1317
+ const file = path.join(dir, "session_index.jsonl");
1101
1318
  return memoTitle(`codex:${file}:${id}`, () => {
1102
1319
  let size = 0;
1103
1320
  try {
1104
1321
  size = fs.statSync(file).size;
1105
1322
  } catch {
1106
- return null;
1323
+ size = 0;
1107
1324
  }
1108
- let text;
1109
- if (size > CODEX_INDEX_MAX && fs.openSync && fs.readSync) {
1110
- const fd = fs.openSync(file, "r");
1111
- try {
1112
- const buf = Buffer.alloc(CODEX_INDEX_TAIL);
1113
- const n = fs.readSync(fd, buf, 0, CODEX_INDEX_TAIL, size - CODEX_INDEX_TAIL);
1114
- text = buf.toString("utf8", 0, n);
1115
- } finally {
1325
+ if (size > 0) {
1326
+ let text;
1327
+ if (size > CODEX_INDEX_MAX && fs.openSync && fs.readSync) {
1328
+ const fd = fs.openSync(file, "r");
1116
1329
  try {
1117
- fs.closeSync(fd);
1118
- } catch {}
1330
+ const buf = Buffer.alloc(CODEX_INDEX_TAIL);
1331
+ const n = fs.readSync(fd, buf, 0, CODEX_INDEX_TAIL, size - CODEX_INDEX_TAIL);
1332
+ text = buf.toString("utf8", 0, n);
1333
+ } finally {
1334
+ try {
1335
+ fs.closeSync(fd);
1336
+ } catch {}
1337
+ }
1338
+ } else {
1339
+ text = fs.readFileSync(file, "utf8");
1119
1340
  }
1120
- } else {
1121
- text = fs.readFileSync(file, "utf8");
1122
- }
1123
- const needle = `"id":"${id}"`;
1124
- const lines = String(text).split("\n");
1125
- for (let i = lines.length - 1; i >= 0; i--) {
1126
- if (!lines[i].includes(needle)) continue;
1127
- let d = null;
1128
- try {
1129
- d = JSON.parse(lines[i]);
1130
- } catch {
1131
- continue;
1341
+ const needle = `"id":"${id}"`;
1342
+ const lines = String(text).split("\n");
1343
+ for (let i = lines.length - 1; i >= 0; i--) {
1344
+ if (!lines[i].includes(needle)) continue;
1345
+ let d = null;
1346
+ try {
1347
+ d = JSON.parse(lines[i]);
1348
+ } catch {
1349
+ continue;
1350
+ }
1351
+ if (!d || d.id !== id) continue;
1352
+ const name = clip(d.thread_name, 60);
1353
+ if (name) return name;
1354
+ break;
1132
1355
  }
1133
- if (!d || d.id !== id) continue;
1134
- return clip(d.thread_name, 60);
1135
1356
  }
1357
+ try {
1358
+ const dbs = fs
1359
+ .readdirSync(dir)
1360
+ .filter((f) => /^state_\d+\.sqlite$/.test(f))
1361
+ .sort((a, b) => Number(b.match(/\d+/)[0]) - Number(a.match(/\d+/)[0]));
1362
+ for (const f of dbs) {
1363
+ const rows = sqliteColumn(path.join(dir, f), "select title from threads where id=?", [id], exec);
1364
+ const title = String(rows[0] ?? "").trim();
1365
+ if (title) return clip(title, 60);
1366
+ }
1367
+ } catch {}
1136
1368
  return null;
1137
1369
  });
1138
1370
  }
@@ -1228,19 +1460,19 @@ export function readSessionTitle(local, { fs = fsMod, home = osMod.homedir(), en
1228
1460
  if (tr) return tr;
1229
1461
  const ag = readAntigravitySessionTitle(meta, local, { fs, home, exec });
1230
1462
  if (ag) return ag;
1231
- const cx = readCodexSessionTitle(meta, { env, home, fs });
1463
+ const cx = readCodexSessionTitle(meta, { env, home, fs, exec });
1232
1464
  if (cx) return cx;
1233
1465
  if (isOpencodeClient(local.clientCommand)) {
1234
1466
  const oc = opencodeSessionOf(tool, at, { env, home, fs, exec });
1235
1467
  if (oc?.title) return oc.title;
1236
1468
  }
1237
- const ds = dsh !== undefined ? dsh : readDshSession(local, { env, home, fs });
1469
+ const ds = dsh !== undefined ? dsh : readDshSession(local, { env, home, fs, meta });
1238
1470
  if (ds?.title) return ds.title;
1239
1471
  const t = readHostSessionTitle(local.hostSessionId, { fs, home, env });
1240
1472
  if (t) return t;
1241
1473
  const file = readClientSessionFile(local.clientPid, { fs, home });
1242
1474
  if (file && file.nameSource !== "derived") return clip(file.name, 60);
1243
- const wb = readWorkbuddySessionTitle({ env, fs, exec, alive, meta, enginePid: local.clientPid });
1475
+ const wb = readWorkbuddySessionTitle({ env, home, fs, exec, alive, meta, enginePid: local.clientPid });
1244
1476
  if (wb) return wb;
1245
1477
  return local.sessionName || null;
1246
1478
  }
@@ -1255,7 +1487,7 @@ export function readSessionTitle(local, { fs = fsMod, home = osMod.homedir(), en
1255
1487
  */
1256
1488
  export function readSessionIdentity(local, { fs = fsMod, home = osMod.homedir(), env = process.env, exec = execFileSync, alive = pidAlive, meta = null, tmp, tool = null, at = null } = {}) {
1257
1489
  if (!local) return { title: null, workspace: null, workspaceKind: null };
1258
- const ds = readDshSession(local, { env, home, fs });
1490
+ const ds = readDshSession(local, { env, home, fs, meta });
1259
1491
  const title = readSessionTitle(local, { fs, home, env, exec, alive, meta, dsh: ds, tool, at });
1260
1492
  const agDir = readAntigravityWorkspace(meta, local, { fs, home });
1261
1493
  const oc = isOpencodeClient(local.clientCommand) ? opencodeSessionOf(tool, at, { env, home, fs, exec }) : null;