dsh-agy-link 0.6.43 → 0.6.45

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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.45 (2026-11-20)
4
+
5
+ ### English
6
+
7
+ - **Fix(quota): the free-tier verdict is decided by the API status, so the branch is no longer dead code (fixes #142).** The refusal classifier checked the `license` phrase before `PERMISSION_DENIED`, and a real 403 can carry **both** — so the free-tier branch added in v0.6.42 never ran and those accounts stayed on the 6h licence window instead of the 7-day free-tier one. `PERMISSION_DENIED` (the structured API-level detail) now wins, and a licence phrase **without** it still yields `no_license`, so both branches stay reachable and are pinned by tests.
8
+ - **Fix(client): a file link actually opens in the right Sidebar preview (fixes #141).** `canPreviewFiles()` probed `sidebarRightTabs.get()` with the tab **type id**, but that method is keyed by tab **kind** (`'text'`), so the probe always returned `undefined` and every click fell through to the OS opener. It now looks the id up in `entries()` and falls back to `get('text')` while confirming the returned id, so an unrelated text tab is never mistaken for the preview. `normalizeLocalPath()` also percent-decodes now (after the `?#` split, before separator normalization), so an encoded href (`Bio%20Fuel%20Cell`, `%5C`) matches the session cwd instead of being re-encoded into a path that does not exist.
9
+ - Two existing client tests encoded the *wrong* registry contract (mocking `get()` by id); they now mock the real one, which is what let this bug pass CI.
10
+
11
+ ### 中文
12
+
13
+ - **修复(额度):免费档判定改由 API 状态决定,分支不再不可达(修复 #142)。** 拒绝分类器先匹配 `license` 字样再匹配 `PERMISSION_DENIED`,而真实 403 **两者并存**——于是 v0.6.42 新增的免费档分支从未执行,这类账号仍停留在 6 小时许可窗口而非 7 天免费档窗口。现在结构化的 `PERMISSION_DENIED` 优先;**仅含** license 字样而无该状态时仍判 `no_license`,两个分支都保持可达并有测试锁定。
14
+ - **修复(客户端):文件链接终于进右侧边栏预览(修复 #141)。** `canPreviewFiles()` 用标签**类型 id** 去查 `sidebarRightTabs.get()`,但该方法以标签 **kind**(`'text'`)为键,探测恒为 `undefined`,每次点击都落到系统程序。现在先在 `entries()` 里按 id 查,回退到 `get('text')` 时再核对返回值的 id,避免把别的 text 标签误认成预览。`normalizeLocalPath()` 也补上百分号解码(在 `?#` 拆分之后、分隔符归一之前),因此被编码的 href(`Bio%20Fuel%20Cell`、`%5C`)能与会话 cwd 对上,而不是被二次编码成不存在的路径。
15
+ - 两个既有客户端测试固化的正是**错误的**注册表契约(把 `get()` 当 id 查询用),现已改为真实契约——这正是该 bug 能通过 CI 的原因。
16
+
17
+ ## 0.6.44 (2026-11-20)
18
+
19
+ ### English
20
+
21
+ - **Fix(mcp-bridge): enabling the MCP bridge on the desktop build no longer steals window focus (fixes #140).** The generated `mcp_config.json` entry used `command: process.execPath`, which on the DSH desktop build is the **Electron** binary — so every time Antigravity spawned our stdio bridge it started a second Electron instance, and that window pulled focus back to DSH on each tool call. When the host really is Electron, the entry now carries `ELECTRON_RUN_AS_NODE=1`, which makes the same binary run as a plain Node process; a normal Node host gets no extra variable. The entry is built by a new `mcpServerEntry()` so the behaviour is unit-testable without spawning anything.
22
+
23
+ ### 中文
24
+
25
+ - **修复(mcp-bridge):桌面端开启 MCP bridge 后不再抢走窗口焦点(修复 #140)。** 生成的 `mcp_config.json` 用 `command: process.execPath`,而在 DSH 桌面构建里那就是 **Electron** 可执行文件——于是 Antigravity 每次拉起我们的 stdio bridge 都会启动第二个 Electron 实例,其窗口在每次工具调用时把焦点抢回 DSH。现在检测到宿主确实是 Electron 时,条目会带上 `ELECTRON_RUN_AS_NODE=1`,让同一个二进制以纯 Node 模式运行;普通 Node 宿主不会多出这个变量。条目由新的 `mcpServerEntry()` 构建,因此无需真实 spawn 即可单元测试。
26
+
3
27
  ## 0.6.43 (2026-11-20)
4
28
 
5
29
  ### English
package/dist/client.js CHANGED
@@ -2693,15 +2693,30 @@ window.__ModuleLoader__.load({
2693
2693
  const normalized = filePath.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
2694
2694
  return `dsh-resource://file/session/${encodeSegment(sessionId)}/${normalized.split("/").map(encodeSegment).join("/")}`;
2695
2695
  }
2696
- /** `file:///C:/x` | `file://C:/x` | `C:\x` → `C:/x`, dropping a `#L12` / `?v=1` suffix. */
2696
+ /**
2697
+ * `file:///C:/x` | `file://C:/x` | `C:\x` → `C:/x`, dropping a `#L12` / `?v=1` suffix.
2698
+ *
2699
+ * Percent-decoding happens AFTER the `?#` split (so `%3F` in a name is not
2700
+ * mistaken for a query) and before the separator normalization: an encoded href
2701
+ * (`Bio%20Fuel%20Cell`, `%5C`) otherwise never matches the session cwd, and the
2702
+ * address is then rebuilt with a second round of encoding (issue #141).
2703
+ */
2697
2704
  function normalizeLocalPath(raw) {
2698
2705
  let p = raw.trim();
2699
2706
  if (p.startsWith("file://")) {
2700
2707
  p = p.slice(7);
2701
2708
  if (/^\/[A-Za-z]:/.test(p)) p = p.slice(1);
2702
2709
  }
2703
- const [pathPart] = p.replace(/\\/g, "/").split(/[?#]/);
2704
- return (pathPart ?? "").replace(/^(?:\.\/)+/, "");
2710
+ const [pathPart] = p.split(/[?#]/);
2711
+ return decodePercent(pathPart ?? "").replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
2712
+ }
2713
+ /** Decode a percent-encoded path, keeping the raw text when it is malformed. */
2714
+ function decodePercent(value) {
2715
+ try {
2716
+ return decodeURIComponent(value);
2717
+ } catch {
2718
+ return value;
2719
+ }
2705
2720
  }
2706
2721
  function sidebarRightOf(ctx) {
2707
2722
  const sidebarRight = service$1(ctx, "sidebarRight");
@@ -2714,7 +2729,9 @@ window.__ModuleLoader__.load({
2714
2729
  */
2715
2730
  function canPreviewFiles(ctx) {
2716
2731
  const tabs = service$1(ctx, "sidebarRightTabs");
2717
- return tabs?.get?.(DOCUMENT_PREVIEW_TAB) !== void 0 && tabs?.get?.(DOCUMENT_PREVIEW_TAB) !== null;
2732
+ const registered = tabs?.entries?.();
2733
+ if (Array.isArray(registered) && registered.some((entry) => entry?.id === DOCUMENT_PREVIEW_TAB)) return true;
2734
+ return tabs?.get?.("text")?.id === DOCUMENT_PREVIEW_TAB;
2718
2735
  }
2719
2736
  function mountedSessionId(sidebarRight) {
2720
2737
  const mounted = sidebarRight.mounted?.getSnapshot?.();
package/dist/index.js CHANGED
@@ -37339,6 +37339,28 @@ function writePrivateMcpFile(file, content) {
37339
37339
  chmodSync(file, 384);
37340
37340
  } catch {}
37341
37341
  }
37342
+ /**
37343
+ * The `mcpServers` entry that points Antigravity at our stdio bridge.
37344
+ *
37345
+ * On the DSH desktop build `execPath` is the ELECTRON binary, so launching the
37346
+ * bridge that way started a second Electron instance whose window stole focus
37347
+ * every time a tool call spawned the server (issue #140). `ELECTRON_RUN_AS_NODE`
37348
+ * makes that same binary behave as a plain Node process; a real `node` binary
37349
+ * ignores it, so it is only added when the host actually is Electron.
37350
+ */
37351
+ function mcpServerEntry(bridge, execPath, isElectron) {
37352
+ return {
37353
+ type: "stdio",
37354
+ command: execPath,
37355
+ args: [bridge.bridgeScript],
37356
+ env: {
37357
+ DSH_MCP_URL: bridge.url,
37358
+ DSH_MCP_TOKEN: bridge.token,
37359
+ DSH_MCP_PID: String(process.pid),
37360
+ ...isElectron ? { ELECTRON_RUN_AS_NODE: "1" } : {}
37361
+ }
37362
+ };
37363
+ }
37342
37364
  function writeMcpConfig(file, bridge) {
37343
37365
  const key = mcpServerKey(bridge.port);
37344
37366
  let previous = null;
@@ -37361,16 +37383,7 @@ function writeMcpConfig(file, bridge) {
37361
37383
  const rawPid = (val?.env)?.DSH_MCP_PID;
37362
37384
  if (typeof rawPid === "string" && /^\d+$/.test(rawPid) && !isPidAlive(Number(rawPid))) delete servers[existingKey];
37363
37385
  }
37364
- servers[key] = {
37365
- type: "stdio",
37366
- command: process.execPath,
37367
- args: [bridge.bridgeScript],
37368
- env: {
37369
- DSH_MCP_URL: bridge.url,
37370
- DSH_MCP_TOKEN: bridge.token,
37371
- DSH_MCP_PID: String(process.pid)
37372
- }
37373
- };
37386
+ servers[key] = mcpServerEntry(bridge, process.execPath, process.versions.electron !== void 0);
37374
37387
  root.mcpServers = servers;
37375
37388
  let written = false;
37376
37389
  let writtenBytes = "";
@@ -39818,16 +39831,16 @@ function classifySummaryRefusal(status, bodyText = "") {
39818
39831
  status,
39819
39832
  ...detail === void 0 ? {} : { detail }
39820
39833
  };
39821
- if (status === 403 && /licen[cs]e/i.test(bodyText)) return {
39822
- kind: "no_license",
39823
- status,
39824
- ...detail === void 0 ? {} : { detail }
39825
- };
39826
39834
  if (status === 403 && detail === "PERMISSION_DENIED") return {
39827
39835
  kind: "no_summary_access",
39828
39836
  status,
39829
39837
  detail
39830
39838
  };
39839
+ if (status === 403 && /licen[cs]e/i.test(bodyText)) return {
39840
+ kind: "no_license",
39841
+ status,
39842
+ ...detail === void 0 ? {} : { detail }
39843
+ };
39831
39844
  return {
39832
39845
  kind: "http",
39833
39846
  status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.43",
3
+ "version": "0.6.45",
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",