手机版:会话历史裸显意识指令追加段,需折叠渲染(规则 26 跟进)
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 背景
用户以 `$指令` 显式点名意识时,desktop 发送期会在用户消息尾部追加 `[意识指令]` 硬指令段(`apps/desktop/src/renderer/cindy-brain/ghostCommand.ts` 的 `expandGhostCommand`)。desktop 渲染时由 `splitGhostDirective` 把该段从正文剥离,折叠进「意识召唤卡片」(`GhostSummonCard`),不裸显。
手机版(`apps/mobile`)渲染会话历史时**没有等价的剥离/折叠逻辑**,指令段会作为消息正文裸显在气泡里——这是既有欠账(旧模板 ~150 字符)。
## 为什么现在要修
0f4d81ba9 起,硬指令内嵌被点名意识的工具清单 JSON(免 ghost_list 往返),追加段体积上限增至 ~8KB(体积闸)。手机端裸显从"一小段机器文案"变成"一面 JSON 墙",量变到质变,影响手机端阅读体验。
## 要做什么
- 手机版消息渲染接入与 desktop 同源的指令段解析(`splitGhostDirective` 的模板/正则逻辑,注意生成端与解析端必须严格同源,新旧两种 command 模板 + mention 模板都要认),把指令段从正文剥离;
- 渲染形态可以从简:不要求 1:1 复刻 desktop 召唤卡,最低要求是折叠(如"⚡ 召唤了意识 X"一行 + 可展开查看原文),不裸显;
- 历史消息(旧模板)与新消息(内嵌工具清单模板)都要覆盖。
## 参考
- 生成/解析单一事实源:`apps/desktop/src/renderer/cindy-brain/ghostCommand.ts`
- desktop 渲染:`apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx`、`UserMessage.tsx`
- 相关 commit:0f4d81ba9(内嵌工具清单)、其 commit message 的规则 26 段
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Research direction
Start with apps/desktop/src/renderer/cindy-brain/ghostCommand.ts to understand the shared splitGhostDirective templates and compare its use in GhostSummonCard.tsx and UserMessage.tsx. Then inspect the apps/mobile conversation-history renderer and determine where both legacy and embedded-tool-list command forms should be removed from the message body. Done means mobile history folds both forms instead of showing them raw, with expandable original text or an equivalent compact presentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100