dsh-agy-link 0.6.39 → 0.6.40

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.40 (2026-11-19)
4
+
5
+ ### English
6
+
7
+ - **Improve(diagnostics): `AGY_NOT_INSTALLED` now says where agy was searched and how to point at it (merges PR #133).** The error used to read only "install it via …", which says "not installed" — but the more common case is the CLI being installed while a GUI-launched host inherits a different `PATH`. `resolveAgyBin()`'s probe list was computed and then discarded; it is now preserved. `agyBinCandidates()` splits the collection out, `agyBinDiagnostics()` adds the configured `agyBin` and the per-platform install hint, and `agyNotInstalledMessage()` reports the probed locations, both documented overrides (`agyBin` config / `DSH_AGY_BIN`) and a `/agy doctor` pointer. The header badge uses the same text, and `/agy doctor` lists every probed path under `agy lookup`. `resolveAgyBin()` keeps its signature and behaviour; 9 new tests. Thanks to @angel12538.
8
+ - **Test:** the PATH-probe case now injects its own `PATH` instead of assuming the host has a `nodejs` directory, so it passes on any machine.
9
+
10
+ ### 中文
11
+
12
+ - **改进(诊断):`AGY_NOT_INSTALLED` 现在会说明搜索过哪些位置、以及如何指向二进制(合并 PR #133)。** 此前错误文案只有「install it via …」,读起来就是「没装」——但更常见的情况是 CLI 已安装,只是 GUI 启动的宿主继承了不同的 `PATH`。`resolveAgyBin()` 原本算完探测列表就丢弃,现在保留下来:`agyBinCandidates()` 拆出候选收集,`agyBinDiagnostics()` 补充已配置的 `agyBin` 与各平台安装提示,`agyNotInstalledMessage()` 输出探测位置、两种已文档化的覆盖方式(`agyBin` 配置 / `DSH_AGY_BIN`)以及 `/agy doctor` 指路。头部徽标复用同一文案,`/agy doctor` 在 `agy lookup` 段列出每个探测路径。`resolveAgyBin()` 签名与行为不变;新增 9 条测试。感谢 @angel12538。
13
+ - **测试**:PATH 探测用例改为注入自定义 `PATH`,不再假设宿主存在 `nodejs` 目录,因此任何机器都能通过。
14
+
3
15
  ## 0.6.39 (2026-11-19)
4
16
 
5
17
  ### English
@@ -1541,6 +1541,107 @@ function defaultPoolData() {
1541
1541
  };
1542
1542
  }
1543
1543
  //#endregion
1544
+ //#region src/runtime/agy/bin.ts
1545
+ const IS_WIN$3 = process.platform === "win32";
1546
+ /** Executable candidates for one PATH entry, per-platform. Exported for tests. */
1547
+ function binCandidates(dir, platform = process.platform) {
1548
+ return (platform === "win32" ? [
1549
+ ".exe",
1550
+ ".cmd",
1551
+ ".bat"
1552
+ ] : [""]).map((e) => join(dir, "agy" + e));
1553
+ }
1554
+ /** True when the resolved bin is a Windows cmd shim (needs shell wrapping). */
1555
+ function isCmdShim(bin) {
1556
+ return /\.(cmd|bat)$/i.test(bin);
1557
+ }
1558
+ /** cmd.exe argument quoting (cross-spawn rules). Exported for tests. */
1559
+ function windowsQuote(arg) {
1560
+ if (/[ \t\n\v"]/.test(arg) === false) return arg;
1561
+ let escaped = arg.replace(/(\\+)\"/g, "$1$1\\\"").replace(/(\\+)$/, "$1$1");
1562
+ escaped = "\"" + escaped.replace(/"/g, "\\\"") + "\"";
1563
+ return escaped;
1564
+ }
1565
+ /**
1566
+ * Every location the plugin probes for the agy executable.
1567
+ *
1568
+ * Kept separate from `resolveAgyBin` so a failed lookup can report WHERE it
1569
+ * looked: a missing binary is otherwise indistinguishable from a broken PATH,
1570
+ * and the user is left guessing which install layout they should match.
1571
+ */
1572
+ function agyBinCandidates(cfg) {
1573
+ const candidates = [];
1574
+ if (cfg.agyBin !== "") candidates.push(cfg.agyBin);
1575
+ const pathEnv = process.env.PATH ?? "";
1576
+ for (const dir of pathEnv.split(delimiter)) if (dir !== "") candidates.push(...binCandidates(dir));
1577
+ const home = homedir();
1578
+ if (IS_WIN$3) {
1579
+ const local = process.env.LOCALAPPDATA ?? "";
1580
+ const appData = process.env.APPDATA ?? "";
1581
+ if (local !== "") {
1582
+ candidates.push(join(local, "agy", "bin", "agy.exe"));
1583
+ candidates.push(join(local, "agy", "bin", "agy.cmd"));
1584
+ candidates.push(join(local, "agy", "bin", "agy.bat"));
1585
+ candidates.push(join(local, "agy", "agy.exe"));
1586
+ candidates.push(join(local, "Programs", "agy", "agy.exe"));
1587
+ candidates.push(join(local, "Programs", "agy", "bin", "agy.exe"));
1588
+ candidates.push(join(local, "Microsoft", "WinGet", "Links", "agy.exe"));
1589
+ candidates.push(join(local, "pnpm", "agy.cmd"));
1590
+ candidates.push(join(local, "pnpm", "agy.exe"));
1591
+ }
1592
+ if (appData !== "") {
1593
+ candidates.push(join(appData, "npm", "agy.cmd"));
1594
+ candidates.push(join(appData, "Roaming", "npm", "agy.cmd"));
1595
+ }
1596
+ candidates.push(join(home, ".local", "bin", "agy.exe"));
1597
+ candidates.push(join(home, ".local", "bin", "agy.cmd"));
1598
+ candidates.push(join(home, ".bun", "bin", "agy.exe"));
1599
+ candidates.push(join(home, ".cargo", "bin", "agy.exe"));
1600
+ candidates.push(join(home, "scoop", "shims", "agy.exe"));
1601
+ } else {
1602
+ candidates.push(join(home, ".local", "bin", "agy"));
1603
+ candidates.push("/usr/local/bin/agy");
1604
+ candidates.push("/opt/homebrew/bin/agy");
1605
+ candidates.push("/opt/homebrew/sbin/agy");
1606
+ candidates.push("/home/linuxbrew/.linuxbrew/bin/agy");
1607
+ candidates.push(join(home, ".bun", "bin", "agy"));
1608
+ candidates.push(join(home, ".cargo", "bin", "agy"));
1609
+ candidates.push(join(home, ".local", "share", "pnpm", "agy"));
1610
+ candidates.push(join(home, "Library", "pnpm", "agy"));
1611
+ candidates.push(join(home, ".yarn", "bin", "agy"));
1612
+ candidates.push(join(home, ".npm-global", "bin", "agy"));
1613
+ candidates.push(join(home, ".volta", "bin", "agy"));
1614
+ candidates.push(join(home, ".asdf", "shims", "agy"));
1615
+ candidates.push(join(home, ".nix-profile", "bin", "agy"));
1616
+ candidates.push("/run/current-system/sw/bin/agy");
1617
+ try {
1618
+ const nvmNodeDir = join(home, ".nvm", "versions", "node");
1619
+ if (existsSync(nvmNodeDir)) for (const v of readdirSync(nvmNodeDir)) candidates.push(join(nvmNodeDir, v, "bin", "agy"));
1620
+ } catch {}
1621
+ candidates.push(join(home, ".local", "share", "fnm", "current", "bin", "agy"));
1622
+ candidates.push(join(home, ".fnm", "current", "bin", "agy"));
1623
+ candidates.push(join(home, "Library", "Application Support", "fnm", "current", "bin", "agy"));
1624
+ }
1625
+ return candidates;
1626
+ }
1627
+ function agyBinDiagnostics(cfg) {
1628
+ return {
1629
+ probed: agyBinCandidates(cfg),
1630
+ configured: cfg.agyBin,
1631
+ installHint: IS_WIN$3 ? "the official installer defaults to " + join(process.env.LOCALAPPDATA ?? "%LOCALAPPDATA%", "agy", "bin", "agy.exe") : "the official installer defaults to " + join(homedir(), ".local", "bin", "agy")
1632
+ };
1633
+ }
1634
+ function resolveAgyBin(cfg) {
1635
+ const hits = [];
1636
+ for (const c of agyBinCandidates(cfg)) try {
1637
+ accessSync(c, constants.F_OK);
1638
+ hits.push(c);
1639
+ } catch {
1640
+ continue;
1641
+ }
1642
+ return hits.find((h) => !isCmdShim(h)) ?? hits[0] ?? null;
1643
+ }
1644
+ //#endregion
1544
1645
  //#region src/provider/call-context.ts
1545
1646
  /**
1546
1647
  * Effective agy permission mode for one turn.
@@ -1556,9 +1657,27 @@ function defaultPoolData() {
1556
1657
  function effectivePermissionMode(configured, dshPlanMode, isAux) {
1557
1658
  return dshPlanMode && !isAux ? "plan" : configured;
1558
1659
  }
1660
+ /**
1661
+ * Message for a missing agy executable.
1662
+ *
1663
+ * A bare "not found on PATH" is unactionable: the user cannot tell whether the
1664
+ * CLI is missing, installed outside the probed locations, or simply not on the
1665
+ * PATH the GUI host inherited. The message therefore names the locations that
1666
+ * were probed and both documented ways to point the plugin at a binary the
1667
+ * probes do not cover.
1668
+ */
1669
+ function agyNotInstalledMessage(cfg) {
1670
+ const diag = agyBinDiagnostics(cfg);
1671
+ const lines = ["agy binary not found — install it via https://antigravity.google/docs/cli/install", "probed " + diag.probed.length + " location(s): " + diag.probed.join(", ")];
1672
+ if (diag.configured !== "") lines.push("configured agyBin (" + diag.configured + ") does not exist either");
1673
+ lines.push(diag.installHint);
1674
+ lines.push("if agy is installed elsewhere, set the plugin config agyBin to its absolute path, or the DSH_AGY_BIN environment variable");
1675
+ lines.push("run /agy doctor for a full report");
1676
+ return lines.join("\n");
1677
+ }
1559
1678
  function resolveCallContext(input) {
1560
1679
  const { options, cfg, bin } = input;
1561
- if (!bin) throw new LlmError("agy binary not found on PATH — install it via https://antigravity.google/docs/cli/install", Err.AGY_NOT_INSTALLED);
1680
+ if (!bin) throw new LlmError(agyNotInstalledMessage(cfg), Err.AGY_NOT_INSTALLED);
1562
1681
  const isReview = typeof options.system === "string" && options.system.includes("REVIEW_POLICY");
1563
1682
  const purpose = options.purpose ?? "chat";
1564
1683
  const isTitle = purpose === "session-title";
@@ -5003,90 +5122,6 @@ function makeLineDecoder(encoding) {
5003
5122
  };
5004
5123
  }
5005
5124
  //#endregion
5006
- //#region src/runtime/agy/bin.ts
5007
- const IS_WIN$3 = process.platform === "win32";
5008
- /** Executable candidates for one PATH entry, per-platform. Exported for tests. */
5009
- function binCandidates(dir, platform = process.platform) {
5010
- return (platform === "win32" ? [
5011
- ".exe",
5012
- ".cmd",
5013
- ".bat"
5014
- ] : [""]).map((e) => join(dir, "agy" + e));
5015
- }
5016
- /** True when the resolved bin is a Windows cmd shim (needs shell wrapping). */
5017
- function isCmdShim(bin) {
5018
- return /\.(cmd|bat)$/i.test(bin);
5019
- }
5020
- /** cmd.exe argument quoting (cross-spawn rules). Exported for tests. */
5021
- function windowsQuote(arg) {
5022
- if (/[ \t\n\v"]/.test(arg) === false) return arg;
5023
- let escaped = arg.replace(/(\\+)\"/g, "$1$1\\\"").replace(/(\\+)$/, "$1$1");
5024
- escaped = "\"" + escaped.replace(/"/g, "\\\"") + "\"";
5025
- return escaped;
5026
- }
5027
- function resolveAgyBin(cfg) {
5028
- const candidates = [];
5029
- if (cfg.agyBin !== "") candidates.push(cfg.agyBin);
5030
- const pathEnv = process.env.PATH ?? "";
5031
- for (const dir of pathEnv.split(delimiter)) if (dir !== "") candidates.push(...binCandidates(dir));
5032
- const home = homedir();
5033
- if (IS_WIN$3) {
5034
- const local = process.env.LOCALAPPDATA ?? "";
5035
- const appData = process.env.APPDATA ?? "";
5036
- if (local !== "") {
5037
- candidates.push(join(local, "agy", "bin", "agy.exe"));
5038
- candidates.push(join(local, "agy", "bin", "agy.cmd"));
5039
- candidates.push(join(local, "agy", "bin", "agy.bat"));
5040
- candidates.push(join(local, "agy", "agy.exe"));
5041
- candidates.push(join(local, "Programs", "agy", "agy.exe"));
5042
- candidates.push(join(local, "Programs", "agy", "bin", "agy.exe"));
5043
- candidates.push(join(local, "Microsoft", "WinGet", "Links", "agy.exe"));
5044
- candidates.push(join(local, "pnpm", "agy.cmd"));
5045
- candidates.push(join(local, "pnpm", "agy.exe"));
5046
- }
5047
- if (appData !== "") {
5048
- candidates.push(join(appData, "npm", "agy.cmd"));
5049
- candidates.push(join(appData, "Roaming", "npm", "agy.cmd"));
5050
- }
5051
- candidates.push(join(home, ".local", "bin", "agy.exe"));
5052
- candidates.push(join(home, ".local", "bin", "agy.cmd"));
5053
- candidates.push(join(home, ".bun", "bin", "agy.exe"));
5054
- candidates.push(join(home, ".cargo", "bin", "agy.exe"));
5055
- candidates.push(join(home, "scoop", "shims", "agy.exe"));
5056
- } else {
5057
- candidates.push(join(home, ".local", "bin", "agy"));
5058
- candidates.push("/usr/local/bin/agy");
5059
- candidates.push("/opt/homebrew/bin/agy");
5060
- candidates.push("/opt/homebrew/sbin/agy");
5061
- candidates.push("/home/linuxbrew/.linuxbrew/bin/agy");
5062
- candidates.push(join(home, ".bun", "bin", "agy"));
5063
- candidates.push(join(home, ".cargo", "bin", "agy"));
5064
- candidates.push(join(home, ".local", "share", "pnpm", "agy"));
5065
- candidates.push(join(home, "Library", "pnpm", "agy"));
5066
- candidates.push(join(home, ".yarn", "bin", "agy"));
5067
- candidates.push(join(home, ".npm-global", "bin", "agy"));
5068
- candidates.push(join(home, ".volta", "bin", "agy"));
5069
- candidates.push(join(home, ".asdf", "shims", "agy"));
5070
- candidates.push(join(home, ".nix-profile", "bin", "agy"));
5071
- candidates.push("/run/current-system/sw/bin/agy");
5072
- try {
5073
- const nvmNodeDir = join(home, ".nvm", "versions", "node");
5074
- if (existsSync(nvmNodeDir)) for (const v of readdirSync(nvmNodeDir)) candidates.push(join(nvmNodeDir, v, "bin", "agy"));
5075
- } catch {}
5076
- candidates.push(join(home, ".local", "share", "fnm", "current", "bin", "agy"));
5077
- candidates.push(join(home, ".fnm", "current", "bin", "agy"));
5078
- candidates.push(join(home, "Library", "Application Support", "fnm", "current", "bin", "agy"));
5079
- }
5080
- const hits = [];
5081
- for (const c of candidates) try {
5082
- accessSync(c, constants.F_OK);
5083
- hits.push(c);
5084
- } catch {
5085
- continue;
5086
- }
5087
- return hits.find((h) => !isCmdShim(h)) ?? hits[0] ?? null;
5088
- }
5089
- //#endregion
5090
5125
  //#region src/runtime/agy/env.ts
5091
5126
  const IS_WIN$2 = process.platform === "win32";
5092
5127
  /**
package/dist/index.js CHANGED
@@ -2891,7 +2891,14 @@ function windowsQuote(arg) {
2891
2891
  escaped = "\"" + escaped.replace(/"/g, "\\\"") + "\"";
2892
2892
  return escaped;
2893
2893
  }
2894
- function resolveAgyBin(cfg) {
2894
+ /**
2895
+ * Every location the plugin probes for the agy executable.
2896
+ *
2897
+ * Kept separate from `resolveAgyBin` so a failed lookup can report WHERE it
2898
+ * looked: a missing binary is otherwise indistinguishable from a broken PATH,
2899
+ * and the user is left guessing which install layout they should match.
2900
+ */
2901
+ function agyBinCandidates(cfg) {
2895
2902
  const candidates = [];
2896
2903
  if (cfg.agyBin !== "") candidates.push(cfg.agyBin);
2897
2904
  const pathEnv = process.env.PATH ?? "";
@@ -2944,8 +2951,18 @@ function resolveAgyBin(cfg) {
2944
2951
  candidates.push(join(home, ".fnm", "current", "bin", "agy"));
2945
2952
  candidates.push(join(home, "Library", "Application Support", "fnm", "current", "bin", "agy"));
2946
2953
  }
2954
+ return candidates;
2955
+ }
2956
+ function agyBinDiagnostics(cfg) {
2957
+ return {
2958
+ probed: agyBinCandidates(cfg),
2959
+ configured: cfg.agyBin,
2960
+ installHint: IS_WIN$3 ? "the official installer defaults to " + join(process.env.LOCALAPPDATA ?? "%LOCALAPPDATA%", "agy", "bin", "agy.exe") : "the official installer defaults to " + join(homedir(), ".local", "bin", "agy")
2961
+ };
2962
+ }
2963
+ function resolveAgyBin(cfg) {
2947
2964
  const hits = [];
2948
- for (const c of candidates) try {
2965
+ for (const c of agyBinCandidates(cfg)) try {
2949
2966
  accessSync(c, constants.F_OK);
2950
2967
  hits.push(c);
2951
2968
  } catch {
@@ -29572,9 +29589,27 @@ async function runAgyOnce(deps, req) {
29572
29589
  function effectivePermissionMode(configured, dshPlanMode, isAux) {
29573
29590
  return dshPlanMode && !isAux ? "plan" : configured;
29574
29591
  }
29592
+ /**
29593
+ * Message for a missing agy executable.
29594
+ *
29595
+ * A bare "not found on PATH" is unactionable: the user cannot tell whether the
29596
+ * CLI is missing, installed outside the probed locations, or simply not on the
29597
+ * PATH the GUI host inherited. The message therefore names the locations that
29598
+ * were probed and both documented ways to point the plugin at a binary the
29599
+ * probes do not cover.
29600
+ */
29601
+ function agyNotInstalledMessage(cfg) {
29602
+ const diag = agyBinDiagnostics(cfg);
29603
+ const lines = ["agy binary not found — install it via https://antigravity.google/docs/cli/install", "probed " + diag.probed.length + " location(s): " + diag.probed.join(", ")];
29604
+ if (diag.configured !== "") lines.push("configured agyBin (" + diag.configured + ") does not exist either");
29605
+ lines.push(diag.installHint);
29606
+ lines.push("if agy is installed elsewhere, set the plugin config agyBin to its absolute path, or the DSH_AGY_BIN environment variable");
29607
+ lines.push("run /agy doctor for a full report");
29608
+ return lines.join("\n");
29609
+ }
29575
29610
  function resolveCallContext(input) {
29576
29611
  const { options, cfg, bin } = input;
29577
- if (!bin) throw new LlmError("agy binary not found on PATH — install it via https://antigravity.google/docs/cli/install", Err.AGY_NOT_INSTALLED);
29612
+ if (!bin) throw new LlmError(agyNotInstalledMessage(cfg), Err.AGY_NOT_INSTALLED);
29578
29613
  const isReview = typeof options.system === "string" && options.system.includes("REVIEW_POLICY");
29579
29614
  const purpose = options.purpose ?? "chat";
29580
29615
  const isTitle = purpose === "session-title";
@@ -36271,6 +36306,13 @@ function writeDoctorReport(deps) {
36271
36306
  lines.push("- generated: " + (/* @__PURE__ */ new Date()).toISOString());
36272
36307
  lines.push("- agy binary: " + (deps.bin() ?? "NOT FOUND"));
36273
36308
  lines.push("- agy version: " + (deps.version() ?? "unknown"));
36309
+ if (deps.bin() === null) {
36310
+ const diag = agyBinDiagnostics(cfg);
36311
+ lines.push("- agy lookup: NOT FOUND — probed " + diag.probed.length + " location(s)");
36312
+ for (const p of diag.probed) lines.push(" - " + p);
36313
+ lines.push("- agy lookup: install hint — " + diag.installHint);
36314
+ lines.push("- agy lookup: override — set plugin config agyBin, or the DSH_AGY_BIN environment variable");
36315
+ }
36274
36316
  lines.push("- agy auto-updater: " + (cfg.suppressAgyAutoUpdate ? describeAgyAutoUpdate() : "not suppressed (suppressAgyAutoUpdate=false)"));
36275
36317
  const cfgDump = {
36276
36318
  ...cfg,
@@ -43126,7 +43168,7 @@ function apply(ctx, entryConfig = {}) {
43126
43168
  }
43127
43169
  const currentBin = bin();
43128
43170
  if (!currentBin) {
43129
- services.status.dormantReason = "agy binary not found — install via https://antigravity.google/docs/cli/install";
43171
+ services.status.dormantReason = agyNotInstalledMessage(getConfig());
43130
43172
  log("dormant: agy binary not found");
43131
43173
  return;
43132
43174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.39",
3
+ "version": "0.6.40",
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",