Skip to content

feat(plugins): 支持输入框引用扩展与会话引用插件 - #698

Open
zszz3 wants to merge 6 commits into
vastsa:mainfrom
zszz3:codex/plugin-session-references
Open

zszz3 wants to merge 6 commits into
vastsa:mainfrom
zszz3:codex/plugin-session-references

Conversation

@zszz3

@zszz3 zszz3 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

改动

支持受信插件向输入框注册补全候选和引用标签,并提供会话引用示例:输入 @ 选择历史会话,发送时展开最多 10 组已完成问答(24,000 字符内),输入框和聊天记录保留简短标签。候选最多显示 5 条,文件默认折叠,可用鼠标或键盘展开。

  • 可选 renderer 入口派生高风险 ui.renderer 授权;只加载获准、启用且在当前项目生效的插件,卸载时清理注册。此入口运行在应用界面中,不是沙箱。
  • 引用经通用 SDK 注册、去重、删除和解析;普通发送、追加消息及排队共用展开逻辑,单个解析失败退回标签。
  • 可选显示元数据贯穿持久化与队列;SQLite v19 → v20 迁移先备份,旧消息无需改写。重启后仍能展示标签并恢复队列草稿。复制和编辑使用界面显示的文本。
  • 同步 SDK、开发工具校验、权限文案、规范和示例说明。

本次覆盖 #545 的补全与引用两个扩展点(7、14),提供 #446 的插件实现入口;不包含其他界面插槽或 #447 的百分比预算界面。原生 Pi 续接与远程主机暂不支持引用提交,会拒绝并恢复草稿。

当前候选验证(2026-09-23)

候选提交:aff4fc3cb0f1ed97c69ec3d48244c528a9dc4a6a;目标 main:3d9c3498fb9fdb1bfec81158f6dbfa7dfa150b42。

本次以合并方式解决 9 个文件的冲突,保留运行时双方导入、shared 导出、各语言文案及存储规范。队列恢复同时保留插件引用身份、显示标签、文件 token 和图片附件;保存中队列行先出现,再异步解析引用,兼容主线的 admission 操作保护。未新增测试或用例,未重写分支历史。

通过的检查:

  • JS 构建、Desktop 类型检查、lint、文档检查(514 页)、相对目标分支的差异检查与主线包含检查。
  • Rust 构建、fmt、clippy(保留既有 4 条警告)、host-core 648 项现有测试。
  • Plugin SDK 328 项、shared 1012 项现有测试。
  • 队列、发送状态、结束后调度、消息展示与交互性能相关 75 项现有 Desktop 测试。
  • Desktop 全部测试文件覆盖:首轮 2666 项通过,3 个测试文件因从仓库根目录启动而找不到相对路径;切换到 apps/desktop 后重跑这 3 个文件,31 项通过,合计 2697 项通过。
  • 临时混合恢复检查:同一排队消息中的会话引用、文件删除 token 和图片全部保留。
  • 既有临时 Electron 引用检查:候选上限、文件折叠、去重/删除、发送、排队、追加消息、标签展示及卸载。
  • 既有临时 Host 检查:v19 升级、旧队列保留、v20 显示元数据重启读回及 renderer 授权派生。
  • pnpm test:e2e:boot:隔离启动、preload / IPC、800 会话响应性及项目删除 IPC 检查通过。

环境:macOS arm64,独立 worktree、临时 profile,复用已有 Electron 43.6.0 和 Cargo 缓存。上游运行时依赖从 0.86.1 升级至 0.87.1,本地依赖不兼容,因此按锁文件更新并重新构建;验证使用此候选构建的 host-core。未调用真实模型服务,未使用生产数据,未运行 verify:ui:*。初轮类型检查读取旧构建产物,完成构建后重新执行通过。

CI 以最新提交为准。本次只解决冲突并更新 PR,不合并。Vercel 授权状态独立于本地验证。

Allow trusted renderer plugins to contribute completion candidates and inline references without adding session-specific composer behavior. Resolve selected references at submission while preserving their display form across queued turns and transcript reloads.

Include a bounded session Q&A example under @, with five visible reference candidates and a collapsible file group. Review renderer trust explicitly and preserve existing database rows through the schema upgrade.
Keep the newly integrated context-menu copy actions consistent with the reference chips shown in the transcript. Copying a user turn or conversation should not unexpectedly expose its expanded historical context.
The composer token helper moved and user messages now separate visible labels from model-facing content. Update the existing source checks and presentation loader to follow those paths while retaining their original regression assertions.
Preserve the composer reference contracts alongside the latest upstream ADR catalog and acceptance scenarios. Keep the shared branch history intact while incorporating current main.
Preserve reference labels while using the active edit draft for the message menu. Retain both sets of architecture and acceptance documentation.
Preserve plugin reference identity and labels together with restored
file and image attachments when integrating the latest main branch.
Publish pending queue rows before asynchronous reference resolution so
admission controls remain locked throughout submission.

Retain both sides of runtime imports, shared exports, localized messages,
and storage documentation without changing extension trust boundaries.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant