Repository navigation
[6216] 附件 mogan 包:%chat 协议 v2(attachments)+ 假附件插件 + 📎 UI/预检/下发 - #4725
Merged
Merged
Conversation
- chat-input 增 attachments 字段(sha256/filename/size 三键,字段恒在、空表恒输出 []) - chat-tab-send/chat-tab-session-send 6→7 参,尾参 attachments(空表传 '()) - 新建假附件插件 TeXmacs/plugins/attachment/:不联网、立即 ready、确定性假 sha256, 假提取文本按缓存约定写 ~/.cache/Liiistem/attachment/extract/<yyyymm>/<sha256>/result.json - 假 llm 插件按 sha256 读缓存回显注入行,%chat 线格式追加写 /tmp/ai-chat-debug.log - glue_qt.lua 新增 qt-chat-attachment-ready / qt-chat-attachment-error
- AttachmentItem 增 taskId/sha256/ready;path 只流向附件插件,不进 %chat 协议 - 📎 按钮多选文件 + 预检(白名单单源、≤10 个、≤80MiB 累计),通过后派发 ingest - 处理中:附件按钮旋转动画(QBasicTimer 80ms 步进 45°),发送按钮禁用(Generating 时保持 Stop 可用) - ready 事件回填 sha256 弹 chip(输入框外部上方、按宽度手动分行、✕ 删除);error 事件 toast 并移除 - 发送时 attachments 随协议下发,成功后清空 chips
- C++:预检白名单/数量/80MiB 边界、attachment_items_to_scheme 三键与 ready 过滤、 format_attachment_size、AttachmentItem 默认值与相等性 - Scheme:attachments 空恒 []、非空三键无 path、7 参 chat-tab-send 回显、 假附件插件 ingest→ready/error、假 llm 按 sha256 注入回显闭环
… launcher/serializer 共享助手,清理死代码与过时注释
PinkMagicFly
force-pushed
the
pigmagicfly/6216/attachment-protocol-ui
branch
from
October 15, 2026 03:08
3d98926 to
276a419
Compare
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.
任务
6216:附件 mogan 包——%chat 协议 v2(attachments)+ 假附件插件 + 📎 UI/预检/下发。任务文档见 LiiiLabs/dev-agent#134。
What
chat-input增attachments顶层数组字段(恒在,空表输出[]),每项sha256/filename两键——llm 插件只接收 sha 与文件名,附件正文由附件插件按 sha256 从抽取缓存装配,本地路径不出进程;chat-tab-send/chat-tab-session-send6→7 参(尾参 attachments,空表传'())。TeXmacs/plugins/attachment/):%attachmentingest/ready/error 协议,不联网、立即 ready、假 sha256 为 path 字符串的确定性散列。预检在插件侧(扩展名白名单 / 每轮 ≤10 个 / 每轮 ≤80MiB,均含已选累计——ingest 请求携带count/bytes,违规回 error 事件由 UI toast;文件对话框不做类型过滤)。<缓存基目录>/Liiistem/attachment/extract/<yyyymm>/<sha256>/result.json二元数组(基目录按平台惯例解析:Windows%LOCALAPPDATA%、macOS~/Library/Caches、LinuxXDG_CACHE_HOME未设置回退~/.cache,对齐 mogan C++get_tm_cache_path分布)、月度清理(保留当月与上月、ingest 入口触发)、命中刷新(保留原文仅刷 ts 重写至当月);写入方(tm-attachment.scm)与读取方(tm-llm.scm)各自内联同一约定,只依赖 goldfish 内置库,真实插件(商业版覆盖goldfish/目录)遵从同一约定。[fake] attachment <sha256> injected回显;TM_LLM_CHAT_DEBUG=1时收到的 %chat 线格式追加写/tmp/ai-chat-debug.log供验收核对(默认关闭)。Why
附件解耦架构(6212 定稿):独立附件插件负责 sha256/抽取/缓存,%chat 协议只传 sha256+filename,彻底消除本地路径暴露;预检与缓存删除策略归属插件(真实插件遵从同一约定),mogan UI 不再内嵌策略;假插件闭环让协议与 UI 链路不依赖真实插件即可端到端验收。
验证
xmake b stem✅(基于最新 origin/main rebase 后重建)attachment-ingest未绑定(idle 延迟初始化未触发),plugin-initialize 'attachment强载后符号绑定且连接注册(before=#f after=#t conn=#t)——附件入口已按 llm 同款在call前强载,冷启动直接点 📎 不再误报插件不可用(b50441791)xmake r chat-protocol-test— 48 correct, 0 failed(attachments 空恒[]、非空两键无 path/size、7 参回显、插件侧预检白名单(含 stem/tmu)/数量/80MiB 边界、月度清理与命中刷新、假 llm 注入闭环)xmake r qt_chat_controller_test— 32 passed(两键序列化、ready 过滤)xmake r qt_chat_tab_widget_test— 136 passed(format_attachment_size、chips、附件状态)xmake r chat-list-test/chat-tree-ops-test— 91+3 correct(回归)gf fmt --check全量通过手动验收
GUI 行为按任务文档 §3.1 手动验收(附件选择与处理状态 / chips 展示与管理 / 预检 toast / 发送与线格式核验 / 假插件解耦闭环),待人工确认。
跨机验收提示:
plugins/attachment/是新增数据目录,xmake b stem不会刷新运行时数据——拉取本 PR 后必须执行xmake install stem(xmake r stem用build/packages/stem/data,安装的 .app 用 bundle 内数据),否则插件列表发现不了附件插件,点 📎 会报「附件插件不可用」。此为数据未刷新的准确提示,非代码缺陷。🤖 Generated with Claude Code