This repository was archived by the owner on Aug 11, 2026. It is now read-only.
Repository navigation
feat(device-link): notify 帧与 hello-ack capabilities 能力协商(移动推送) - #3
Merged
Merged
Conversation
- EnvelopeKind 新增连接层 'notify'(client→server,relay 消费不转发): 请求给本账号已注册推送 token 的移动设备发系统推送 - HelloAckPayload 新增可选 capabilities(append-only 能力集)+ SERVER_CAPABILITY_NOTIFY 常量:客户端只有看到声明才发 notify, 规避老 relay 对未知 kind 的静默黑洞;不 bump PROTOCOL_VERSION - RelayErrorCode 新增 RATE_LIMITED(notify 频控;旧客户端不发 notify 不会收到) - NotifyPayload 类型 + NOTIFY_*_MAX_LENGTH 字段上限常量 - docs/device-link-protocol.md 同步:kind 表、能力协商、错误码、 版本纪律新增 capability 协商例外条款 两侧同步升级安排:relay server(cindy-server)先合入并部署声明能力, 客户端仓(cindy-moved)随后 bump 指针接入;任意新旧组合可安全共存。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
正文由发送端裁剪长度与敏感度,relay 不落盘通知内容;移除「只放标题与终态」 的旧约束措辞。类型不变,仅注释与文档。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机 / Motivation
给「桌面任务终态 → 手机系统推送」提供中继层协议支撑:桌面端在会话完成 / 出错 / 待回复时,经已有的 device-link relay 长连接请求 server 给本账号已注册推送 token 的移动设备下发 APNs 推送。手机端后台 WS 会被 iOS 挂起,系统推送是唯一可靠的后台触达通道。
变更类型 / Change type
兼容性影响 / Compatibility impact
全部 append-only,不 bump
PROTOCOL_VERSION:EnvelopeKind新增连接层'notify'(client→server,relay 消费不转发)。relay 对未知 kind 静默丢弃(黑洞),因此引入hello-ack.capabilities能力协商:server 声明'notify'(常量SERVER_CAPABILITY_NOTIFY)后客户端才允许发送。capabilities= 空集 → 不发送(降级为无手机推送);HelloAckPayload.capabilities?: string[](可选新增字段)。RelayErrorCode新增'RATE_LIMITED'(notify 频控):只会发给已声明 notify capability 的 server 的对话方,老客户端不发 notify、不会收到。NotifyPayload类型 +NOTIFY_*_MAX_LENGTH字段上限常量。docs/device-link-protocol.md§9 版本纪律补充「relay 消费(不转发)的连接层新 kind 可用 capability 协商代替 version bump」的例外条款。两侧同步升级安排:server(cindy-server)先合入部署(声明能力),客户端仓(cindy-moved)随后 bump 指针接入;两个消费方 PR 均已就绪,合并本 PR 后跟进。
「三件套」自查 / The "trio"
docs/device-link-protocol.md§9 的承载范围约定,device-link-protocol 包只承载类型与常量,parse 校验由消费方实现:relay 侧校验在 cindy-serverdevice-link-server/src/device-link/notify.ts(错误信息带字段名)notify.test.ts(roundTrip + 坏帧拒收,fixture 全部中性占位值)与deviceLinkRelay.test.ts(能力声明 / 下发 / BAD_REQUEST / RATE_LIMITED)docs/device-link-protocol.mdkind 表、能力协商、错误码、payload 参考、版本纪律检查项 / Checklist
pnpm test与pnpm typecheck通过(本地全绿)🤖 Generated with Claude Code