agent-bridge-service 0.2.1 → 0.2.3

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
@@ -5,6 +5,21 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
6
6
  to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.3](https://github.com/shaylanwu/agent-bridge/compare/v0.2.2...v0.2.3) (2026-10-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **auth:** 修复 Windows 下经 cmd start 打开授权页会截断 & 之后的参数 ([d4227c4](https://github.com/shaylanwu/agent-bridge/commit/d4227c44d62ab23e9c4785804ea089dfb9f50714))
14
+ * **site:** 先 build 再 check,避免版本历史页滞后挡住部署 ([d0486f5](https://github.com/shaylanwu/agent-bridge/commit/d0486f5d5b1037b70220909bd150b9b29459c81e))
15
+
16
+ ## [0.2.2](https://github.com/shaylanwu/agent-bridge/compare/v0.2.1...v0.2.2) (2026-10-24)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **site:** 先 build 再 check,避免版本历史页滞后挡住部署 ([a353563](https://github.com/shaylanwu/agent-bridge/commit/a353563d288633737860fe69c8f47d5395088ec0))
22
+
8
23
  ## [0.2.1](https://github.com/shaylanwu/agent-bridge/compare/v0.2.0...v0.2.1) (2026-10-24)
9
24
 
10
25
 
@@ -24,9 +24,31 @@ export function createPkce() {
24
24
  const challenge = base64url(createHash('sha256').update(verifier).digest());
25
25
  return { verifier, challenge };
26
26
  }
27
+ /**
28
+ * 唤起浏览器的命令(纯函数,可在非 Windows 上单测)。
29
+ *
30
+ * ⛔ Windows 不得走 `cmd /c start "" <url>`:Node 只在参数含空格时加引号,而授权 URL
31
+ * 里全是 `&`,cmd 会把 `&` 当成**命令分隔符** —— 浏览器只收到第一个 query 参数
32
+ * (2026-10-24 实测:`?client_id=agent-bridge` 之后的 `code_challenge` / `redirect_uri`
33
+ * 全被当成命令吞掉,平台授权页读不到 code_challenge,报「授权链接无效」)。
34
+ *
35
+ * ✅ 走 `rundll32 url.dll,FileProtocolHandler`:由 CreateProcess 直接收 argv,
36
+ * 全程不经任何 shell 解析,`&` 无需引号、无需转义,也不会引入 `shell: true`
37
+ * (对齐 always-on.md §4「参数一律字符串数组传给 spawn」)。
38
+ * 实测对照:cmd start 只送到 `?client_id=agent-bridge`;rundll32 整条送达(含 state)。
39
+ * 取舍:rundll32 对超长 URL(~2048 字符)有限制,而授权 URL 实测约 200 字符,够用。
40
+ * (`explorer.exe <url>` 是另一条零引号路径,但本机 Win11 实测不再转交默认浏览器,弃用。)
41
+ */
42
+ export function browserOpenCommand(platform, url) {
43
+ if (platform === 'win32') {
44
+ return { cmd: 'rundll32.exe', args: ['url.dll,FileProtocolHandler', url] };
45
+ }
46
+ if (platform === 'darwin')
47
+ return { cmd: 'open', args: [url] };
48
+ return { cmd: 'xdg-open', args: [url] };
49
+ }
27
50
  export function openBrowser(url) {
28
- const cmd = process.platform === 'win32' ? 'cmd' : process.platform === 'darwin' ? 'open' : 'xdg-open';
29
- const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
51
+ const { cmd, args } = browserOpenCommand(process.platform, url);
30
52
  const child = spawn(cmd, args, { stdio: 'ignore', detached: true, windowsHide: true });
31
53
  child.on('error', () => {
32
54
  /* 打不开浏览器由调用方降级到 device code */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-service",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Give a remote platform control of the AI agents installed on your machine, over an outbound WebSocket",
5
5
  "type": "module",
6
6
  "bin": {