Channel 与隧道
Channel 是 App 与 agent-bridge 之间的云端收件箱,外加一条让 NAT 后机器保持可达的传输层。它不是对话参与方,也不是身份提供者。
Channel and tunnels
Channel is a cloud inbox between the app and agent-bridge, plus a transport so a NAT’d machine stays reachable. It is not a chat participant and not an identity provider.
| 层级Layer | 能力Job |
|---|---|
| 收件箱(主)Inbox (primary) | 异步密文信箱。App / Agent 离线仍可留言;E2E seal-box,服务端只见密文。Async sealed mailbox. App or agent can be offline. E2E seal-box; the server sees ciphertext only. |
| 传输层(辅)Transport (secondary) | HTTP / WebSocket tunnel · /tunnel/connect · /proxy/:channel_id/* |
| 发现 / 接入Discovery | Agent 名片、Noise 白名单中介、接入审批Agent cards, Noise allowlist mediation, access grants |
什么时候需要它
When you need it
同一 Wi-Fi 用 Peer 直连即可,不必开 Channel。出门、差旅、手机 5G 连家里的 Hub 时再配。
On the same Wi-Fi, Peer is enough. Turn on Channel when the phone is away from the hub — travel, cellular, another network.
在 Hub 里打开
Enable it in Hub
shepaw-hub gateway-set-channel \ --server https://channel.shepaw.com \ --channel-id ch_xxx \ --secret ch_sec_... shepaw-hub web # 已配置时自动拉起隧道路由器 shepaw-hub peer-pair # 二维码同时含 local= 与 channel=
收件箱如何串回会话
How the inbox correlates turns
每条留言带 target_id、session_id、request_id、message_id / reply_to、caller_fp。Agent claim 待办 → 处理后回投密文;App 上线走 /inbox/replies 或 WebSocket /inbox/subscribe 收取。
Each note carries target_id, session_id, request_id, message_id / reply_to, and caller_fp. The agent claims pending mail, replies in ciphertext; the app drains /inbox/replies or the /inbox/subscribe WebSocket when it comes online.