Repository navigation
feat(chat): show an inline memory receipt with undo under each turn - #53
Merged
Merged
Conversation
Each turn digest now carries the journal id, added/removed counts, origin and revertability of every memory change, and the chat shows them as a small receipt even while tool calls are hidden. Undo refuses (409) when the file changed after that edit, so undoing an older turn can no longer wipe newer memory.
3 tasks done
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.
요약
턴이 메모리를 바꾸면, 답장 아래에 메모리 영수증(파일 이름,
+N/-N, 되돌리기 버튼)을 바로 보여 줍니다. 도구 호출 숨김(기본값) 상태에서도 보입니다. 함께 **되돌리기 해시 검사(409)**를 넣어, 오래된 턴을 되돌릴 때 그 뒤의 더 최근 메모리까지 지워지는 문제를 막았습니다.이유
memory N개로 표시했고, 그 칩도showToolCalls(기본 꺼짐)가 켜져 있을 때만 보였습니다. 그래서 사용자는 봇이 무엇을 기억했는지 채팅에서 볼 수 없었습니다.revertMemoryChange는 파일 전체를before스냅샷으로 덮어씁니다. 되돌리기 버튼을 채팅의 모든 턴 아래에 두면 오래된 턴의 Undo를 누르기 쉬워지고, 누르는 순간 그 뒤의 변경이 조용히 사라집니다. 그래서 영수증보다 이 검사를 먼저 넣었습니다.변경
packages/phone-protocol/src/digest.ts:DigestMemory(journalId,added,removed,via,canRevert) 타입 추가server/digest.ts:buildTurnDigest가 저널 행에서 위 필드를 채움server/memory-journal.ts:revertMemoryChange에서 현재 파일 해시가entry.afterHash와 다르면 409를 돌려줌src/lib/memory.ts: 409를memory.revertConflict번역 문구로 바꿈. 채팅 영수증, 설정의 메모리 화면, 메모리 정리 카드 세 곳이 함께 씀src/components/DigestChip.tsx:MemoryReceipt추가.DigestChip도 이 컴포넌트를 씀.via === "deletion-guard"(feat(memory): restore unauthorized MEMORY.md dated entry deletions at turn end #45)이면 "복원됨" 배지를 보여 줌src/components/ChatView.tsx,src/components/GroupView.tsx,src/components/chat-bubble.ts: 도구 호출을 숨겨도 메모리 변경이 있는 digest는 영수증으로 그림(quietRow)src/locales/{en,ko,pt-br}.json:chat.memoryReceipt.{restored,reverted,revertFailed},memory.revertConflictserver/memory-journal.test.ts(409 케이스, MEMORY.md 생성 픽스처가 디스크에 실제로 쓰도록 수정),server/digest.test.ts,src/components/DigestChip.test.tsBefore / After 증적
ok: true가 나왔고 최근에 추가된third줄이 지워졌습니다.null이어서 채팅에 메모리 변경이 전혀 보이지 않았습니다.409, 파일 유지. 최신 변경 되돌리기 →200. 그 뒤 오래된 변경 되돌리기 →200.MEMORY.md +1 Undo영수증 2개가 보이고,digest-chip은 보이지 않음role=alert), 디스크의MEMORY.md는 fact A/B/C 그대로omb-language=ko)로 바꾼 뒤 409 → "이 변경 뒤에 파일이 또 바뀌었어요. 지금 되돌리면 더 최근 변경까지 지워지니, 최근 변경부터 되돌려 주세요."vitest runChatView·GroupView·DigestChip·OptionsCardRow·Select.guard·bot-panel·bot-settings·room-activity·lib/memory·locales·memory-journal·memory-upkeep·digest·file-size-ratchet → 108개 파일 중 106개 통과(737건 통과). 실패한 2건(ChatView.automation"lets Advanced mode hide routine updates…",BotApiCard.dom"on Starter…")은stash로 되돌린 기준 커밋09d8bda05에서도 똑같이 실패하는 포크의 기존 문제입니다.pnpm run typecheckexit 0,pnpm run buildexit 0, pre-push(14개 파일) 통과한계