Skip to content

feat(recall): 本地回声记忆与 Wayland 主选区读取 - #3

Merged
KuaaMU merged 1 commit into
mainfrom
feat/recall-echo
Oct 24, 2026
Merged

KuaaMU merged 1 commit into
mainfrom
feat/recall-echo

Conversation

@KuaaMU

@KuaaMU KuaaMU commented Oct 24, 2026

Copy link
Copy Markdown
Owner

做了什么

  • 新增 crates/glint-recall:SQLite + FTS5,记录 Glint 自己的完成轮次;划词时返回一条旧结论(回声)
  • HUD 在宿主徽标下渲染单行回声,未命中不渲染
  • 旧结论以 <prior_answer> 数据块只进入本次请求,不进入对话记录与历史存储
  • 门禁:同线索排除;双方 doc_key 都存在且不同才免 24 小时年龄门槛
  • Wayland 会话优先读 PRIMARY,X11 会话先走 Ctrl+C,修正原生 Wayland 窗口读不到选区的问题
  • 删除单条会话与清空历史时同步清理回声

验证

  • ./scripts/check.sh 全绿(fmt / clippy / core+recall+shell 测试 / 前端 / 契约 / production build)
  • 契约套件 118 注册,80 通过,0 失败
  • 真机验证:回声行渲染、<prior_answer> 被模型引用、PRIMARY 选区读取

注意

  • X11 的 Ctrl+C 回退依赖 xdotool;Wayland 主路径不依赖它
  • 回声库位于 app_data_dir()/recall.sqlite3,懒创建

🤖 Generated with Claude Code

- 新增 glint-recall(SQLite + FTS5):记录完成轮次,划词时返回一条旧结论
- HUD 在宿主徽标下渲染单行回声;未命中不渲染,也没有空状态
- 旧结论以 <prior_answer> 数据块只进入本次请求,不写入对话与历史
- 门禁:同线索排除;双方 doc_key 都存在且不同才免 24 小时年龄门槛
- Wayland 会话优先读 PRIMARY,修正原生 Wayland 窗口读不到选区的问题
- 删除会话时同步清理回声;清空历史时整库删除
- 单测 14 条(只走公开 API)、契约测试、CI 三平台矩阵

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4318487e-b1de-4e54-b686-63157fab408c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T13:58:29.788321Z 3d1bc6a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d1bc6a6a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.ts
function recordRecallTurn(anchor: string, answer: string) {
if (!isTauri()) return;

const cleanAnchor = sanitizeEchoText(anchor).slice(0, 200);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep lookup and stored anchor lengths consistent

For a selected passage over 200 characters, this saves only its first 200 characters, while startNewQuery sends the full selection (up to 3000 characters) to recall_find_echo. If the trailing terms are absent from the stored conclusion, exact matching misses and FTS requires those absent terms, so reselecting the same passage will not produce an echo. Use a consistent anchor representation for recording and lookup, or store the full bounded selection.

Useful? React with 👍 / 👎.

Comment thread src/main.ts
Comment on lines +386 to +387
if (options?.recordAnchor) {
recordRecallTurn(options.recordAnchor, fullTurnText);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent pending turn writes from undoing a history wipe

If a selected-text answer is still streaming when the user confirms Clear History and finishes after recall_wipe completes, the active Done handler still reaches this write and recreates the recall database with the supposedly cleared turn. That memory can then surface from another thread. Invalidate or cancel pending recall writes when clearing history.

Useful? React with 👍 / 👎.

@KuaaMU
KuaaMU merged commit 91d4301 into main Oct 24, 2026
8 checks passed
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