mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
The CLI already emits memory_saved events and stores Markdown memory files, but the desktop app had no usable surface for seeing or editing those writes. This adds a project memory API, a Settings memory editor, chat memory event cards, and routing from /memory or /context into the memory UI. Constraint: Memory files live under Claude project storage and must remain plain Markdown editable by users. Rejected: Only expose raw filesystem links | users need an in-app review and edit flow from chat. Confidence: high Scope-risk: moderate Directive: Keep memory storage project-scoped and preserve unknown Markdown content when editing. Tested: bun test src/server/__tests__/ws-memory-events.test.ts src/server/__tests__/memory.test.ts Tested: bun run check:server Tested: bun run check:desktop Tested: agent-browser E2E for chat memory card, Open Memory navigation, and responsive Markdown editor layout Not-tested: Live model auto-memory trigger rate with real provider credentials
37 lines
1018 B
TypeScript
37 lines
1018 B
TypeScript
import { describe, expect, it } from 'bun:test'
|
|
import { translateCliMessage } from '../ws/handler.js'
|
|
|
|
describe('WebSocket memory events', () => {
|
|
it('forwards CLI memory_saved system messages to the desktop client', () => {
|
|
const messages = translateCliMessage(
|
|
{
|
|
type: 'system',
|
|
subtype: 'memory_saved',
|
|
writtenPaths: [
|
|
'/Users/test/.claude/projects/example/memory/preferences.md',
|
|
'/Users/test/.claude/projects/example/memory/team/MEMORY.md',
|
|
],
|
|
teamCount: 1,
|
|
verb: 'Saved',
|
|
},
|
|
'session-1',
|
|
)
|
|
|
|
expect(messages).toEqual([
|
|
{
|
|
type: 'system_notification',
|
|
subtype: 'memory_saved',
|
|
message: undefined,
|
|
data: {
|
|
writtenPaths: [
|
|
'/Users/test/.claude/projects/example/memory/preferences.md',
|
|
'/Users/test/.claude/projects/example/memory/team/MEMORY.md',
|
|
],
|
|
teamCount: 1,
|
|
verb: 'Saved',
|
|
},
|
|
},
|
|
])
|
|
})
|
|
})
|