@chenacc/agentbridge 0.1.1 → 0.1.2
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/README.md +11 -0
- package/package.json +3 -2
- package/src/config.js +4 -0
- package/src/server.js +11 -1
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ Echo 适配器不接触任何 AI 工具,只验证「CLI → 本机 Bridge →
|
|
|
99
99
|
|
|
100
100
|
| 场景 | 模式 | 手机要求 |
|
|
101
101
|
|---|---|---|
|
|
102
|
+
| 什么都不装、也不连同一个 Wi-Fi(DSH 插件默认) | Cloudflare Tunnel(自动) | 只需浏览器 |
|
|
102
103
|
| 同一可信 Wi-Fi | 局域网 | 浏览器 / 微信 |
|
|
103
104
|
| 跨网络,但属同一私有网络 | Tailscale | 同一 tailnet |
|
|
104
105
|
| Tailscale 不稳定 | ZeroTier | 同一私有网络 |
|
|
@@ -177,6 +178,14 @@ node .\bin\agentbridge.js phone --agent codex --session <thread-id>
|
|
|
177
178
|
|
|
178
179
|
**第 0 步:桥。** 插件是遥控器,桥是基站。从 0.2.0 起桥随插件一起安装,**DSH Desktop 启动时插件会自己在后台把它拉起来**,正常情况你什么都不用敲。
|
|
179
180
|
|
|
181
|
+
从 0.3.0 起,插件默认再开一条 **Cloudflare 隧道**,把桥映射成公网 https 域名,于是手机不必和电脑在同一个 Wi-Fi——扫描、出差、用流量都能开。这一步需要一个 Cloudflare 官方小工具:
|
|
182
|
+
|
|
183
|
+
```powershell
|
|
184
|
+
winget install --id Cloudflare.cloudflared
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
没装也不影响使用,只是退回"手机与电脑同一 Wi-Fi"。想一直走局域网,设 `AGENTBRIDGE_NO_TUNNEL=1`;想用固定域名,去 Cloudflare 建命名隧道并把 `AGENTBRIDGE_PUBLIC_ORIGIN` 指向它。
|
|
188
|
+
|
|
180
189
|
只有自动启动失败(沙箱限制、端口被占)才需要手动来一条:
|
|
181
190
|
|
|
182
191
|
```powershell
|
|
@@ -283,6 +292,8 @@ node .\bin\agentbridge.js phone --agent deepseek-harness
|
|
|
283
292
|
|
|
284
293
|
若自动选择的局域网地址手机访问不到,显式指定 `AGENTBRIDGE_PUBLIC_ORIGIN`;Windows 防火墙提示时只放行「专用网络」。
|
|
285
294
|
|
|
295
|
+
自动选地址时会跳过 `169.254.x.x`(网卡没拿到租约时的临时地址,手机根本路由不到)和 Hyper-V / WSL / 蓝牙这类虚拟网卡,优先真实的 Wi-Fi 或以太网地址。扫码后如果微信弹出「该地址为 IP 地址,请使用域名访问网站」,点「继续访问」即可;手机上不了网、或者只有手机流量没连同一个 Wi-Fi 时,二维码里的地址是打不开的。
|
|
296
|
+
|
|
286
297
|
## 安全边界
|
|
287
298
|
|
|
288
299
|

|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenacc/agentbridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Control local coding agents from a phone through a secure WeChat QR web console.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"verify:responsive": "node scripts/verify-responsive.mjs",
|
|
59
59
|
"verify:guide": "node scripts/verify-product-guide.mjs",
|
|
60
60
|
"verify:release": "node scripts/verify-plugin-release.mjs",
|
|
61
|
-
"check": "node --check src/server.js && node --check src/cli.js && node --check src/cc-switch-models.js && node --check src/workspaces/workspace-catalog.js && node --check src/conversations/conversation-catalog.js && node --check src/adapters/capabilities.js && node --check src/adapters/claude.js && node --check src/adapters/codex.js && node --check src/adapters/deepseek-harness.js && node --check src/adapters/dsh-desktop.js && node --check src/dsh-desktop-channels.js && node --check src/event-store.js && node --check src/notifier.js && node --check src/attachments.js && node --check src/session-manager.js && node --check integrations/dsh-phone/lib/index.js && node --check src/adapters/zcode-native.js && node --check public/adapter-capabilities.js && node --check public/workspace-navigation.js && node --check public/markdown.js && node --check public/highlight.js && node --check public/transcript.js && node --check public/app.js && node --check scripts/verify-workspace-ui.mjs && node --check scripts/verify-message-blocks.mjs && node --check scripts/verify-background-scrim.mjs && node --check scripts/verify-model-control.mjs && node --check scripts/verify-notifications.mjs && node --check scripts/verify-attachments.mjs && node --check scripts/verify-features.mjs && node --check scripts/verify-quick-nav.mjs && node --check scripts/verify-questions.mjs && node --check scripts/verify-responsive.mjs && node --check scripts/verify-product-guide.mjs && node --check scripts/verify-plugin-release.mjs"
|
|
61
|
+
"check": "node --check src/server.js && node --check src/cli.js && node --check src/config.js && node --check src/cc-switch-models.js && node --check src/workspaces/workspace-catalog.js && node --check src/conversations/conversation-catalog.js && node --check src/adapters/capabilities.js && node --check src/adapters/claude.js && node --check src/adapters/codex.js && node --check src/adapters/deepseek-harness.js && node --check src/adapters/dsh-desktop.js && node --check src/dsh-desktop-channels.js && node --check src/event-store.js && node --check src/notifier.js && node --check src/attachments.js && node --check src/session-manager.js && node --check integrations/dsh-phone/lib/index.js && node --check integrations/dsh-phone/lib/tunnel.js && node --check src/adapters/zcode-native.js && node --check public/adapter-capabilities.js && node --check public/workspace-navigation.js && node --check public/markdown.js && node --check public/highlight.js && node --check public/transcript.js && node --check public/app.js && node --check scripts/verify-workspace-ui.mjs && node --check scripts/verify-message-blocks.mjs && node --check scripts/verify-background-scrim.mjs && node --check scripts/verify-model-control.mjs && node --check scripts/verify-notifications.mjs && node --check scripts/verify-attachments.mjs && node --check scripts/verify-features.mjs && node --check scripts/verify-quick-nav.mjs && node --check scripts/verify-questions.mjs && node --check scripts/verify-responsive.mjs && node --check scripts/verify-product-guide.mjs && node --check scripts/verify-plugin-release.mjs",
|
|
62
|
+
"verify:remote": "node scripts/verify-remote-tunnel.mjs"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
65
|
"katex": "0.19.1",
|
package/src/config.js
CHANGED
|
@@ -166,6 +166,10 @@ export function loadConfig(env = process.env, workspace = process.cwd()) {
|
|
|
166
166
|
pairingTtlMs: Number.parseInt(env.AGENTBRIDGE_PAIRING_TTL_MS ?? "300000", 10),
|
|
167
167
|
sessionTtlMs: Number.parseInt(env.AGENTBRIDGE_SESSION_TTL_MS ?? "259200000", 10),
|
|
168
168
|
machineName: env.AGENTBRIDGE_MACHINE_NAME ?? os.hostname(),
|
|
169
|
+
// Set by the DSH plugin when it spawns the bridge itself. It lets the plugin
|
|
170
|
+
// recognise its own child in /api/health and restart it to change the public
|
|
171
|
+
// address, without ever touching a bridge the user started by hand.
|
|
172
|
+
autostart: env.AGENTBRIDGE_AUTOSTART === "1",
|
|
169
173
|
// Outbound notifications: unset webhook means the feature is simply off.
|
|
170
174
|
notifyWebhook: pick(env, "AGENTBRIDGE_NOTIFY_WEBHOOK", notifyFile.webhook),
|
|
171
175
|
notifyFormat: pick(env, "AGENTBRIDGE_NOTIFY_FORMAT", notifyFile.format ?? "json").toLowerCase(),
|
package/src/server.js
CHANGED
|
@@ -390,7 +390,17 @@ export async function createBridge(options = {}) {
|
|
|
390
390
|
const url = new URL(req.url, `http://${req.headers.host ?? "localhost"}`);
|
|
391
391
|
try {
|
|
392
392
|
if (req.method === "GET" && url.pathname === "/api/health") {
|
|
393
|
-
|
|
393
|
+
// The advertised origin is public information (it is printed inside every
|
|
394
|
+
// QR code), and exposing it here is what lets the DSH plugin notice that a
|
|
395
|
+
// running bridge still advertises a stale address.
|
|
396
|
+
return json(res, shuttingDown ? 503 : 200, {
|
|
397
|
+
ok: !shuttingDown,
|
|
398
|
+
shuttingDown,
|
|
399
|
+
lastSeq: eventStore.lastSeq,
|
|
400
|
+
advertisedOrigin: config.advertisedOrigin,
|
|
401
|
+
accessKeyRequired: Boolean(config.accessKey),
|
|
402
|
+
autostart: config.autostart === true,
|
|
403
|
+
});
|
|
394
404
|
}
|
|
395
405
|
|
|
396
406
|
if (shuttingDown) throw Object.assign(new Error("AgentBridge is shutting down"), { statusCode: 503, code: "BRIDGE_SHUTTING_DOWN" });
|