支持桌宠客户端 - #1
Open
xiaoshihou514 wants to merge 3 commits into
Open
Conversation
Author
体验层配置项 enabled(默认 true,settings 可配,热生效)控制网页端 client 是否渲染宠物:false 时挂载后立即卸载(host 引导期隐藏,不闪一下),运行中 热切换同样卸载;Node half 端点不受影响,外部消费者照常读取。 决策:decisions/implemented/feature/2026-08-14-web-pet-disable-switch.md
- POST /whale-girl/presence(显示层写面,跨源校验 + body 上限,与 /interact
同级安全面):{online:true} 续命 45s / {online:false} 即时下线
- /state 下发 companionOnline;网页端 client 在场期间隐藏(syncInert companion
分支),心跳过期自动恢复——桌面端被杀/崩溃不会让网页端永久隐藏
- src/presence.mjs 纯逻辑 + 单测;路由经 routes.mjs 单一来源
- 契约文档 external-consumers.md 更新;决策记录并入 2026-08-14-web-pet-disable-switch
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
支持桌宠客户端
背景
/whale-girl/state原本按单个客户端设计:读取时消费turnCompleted标记,多客户端并发会互相抢占状态。改动
1. 非消费式多客户端快照
/state增加apiVersion: 1turnCompleted改为基于绝对截止时间(turnCompletedUntil),任意数量消费者共享同一完成窗口,读取不再互相抢占docs/external-consumers.md与 snapshot 单测2. 网页端渲染开关(
enabled)enabled(默认true,settings 可配、热生效)控制网页端 client 是否渲染3. 桌面伴侣在场心跳(presence)
POST /whale-girl/presence(跨源校验 + body 上限,显示层写面):桌面端每 15s 续命(TTL 45s),退出时发{online:false}/state下发companionOnline;在场期间网页端宠物自动隐藏,心跳过期(≤45s)自动恢复——桌面端崩溃也不会让网页端永久隐藏不变
现有网页端宠物的安装方式与交互不变;外部消费者自行负责断线重连与轮询兜底。