fix: refresh magic notes after external updates

Subscribe the open Magic Notes workspace to committed database changes from desktop and Agent/MCP writes. Preserve selections and unsaved drafts during refresh and external deletion.

File-level commit includes existing runtime edits in shared files; their remaining dependencies are still in the working tree.

Release note: Magic Notes now updates automatically after Agent/MCP edits while preserving your selection and unsaved drafts.
This commit is contained in:
mesalogo
2026-09-15 00:31:21 +08:00
parent fbba2e3abf
commit e1fe1cf10a
19 changed files with 571 additions and 49 deletions
+3 -16
View File
@@ -43,6 +43,7 @@ import {
type ActivityRecord,
type TokenUsageSummary,
type ConversationSnapshot,
type LiveAgentQuestion,
type ConversationAttachment,
type ConversationBranchInput,
type ConversationQueueItem,
@@ -1304,22 +1305,7 @@ export type AgentEvent =
argumentSummary?: string
allowPermanent?: boolean
}
| {
requestId: string
type: 'question'
questionId: string
childTaskId?: string
questions: Array<{
header: string
question: string
options: Array<{
label: string
description: string
}>
multiple: boolean
custom: boolean
}>
}
| LiveAgentQuestion
| {
requestId: string
type: 'question-resolved'
@@ -2286,6 +2272,7 @@ export type DesktopApi = {
listener: (event: MagicNoteAnalysisStreamEvent) => void
) => () => void
onTodoStatusChanged: (listener: () => void) => () => void
onChanged: (listener: () => void) => () => void
}
knowledge: {
externalInstancesList: () => Promise<import('./external-knowledge-contracts').ExternalKnowledgeInstanceSummary[]>
+1
View File
@@ -276,6 +276,7 @@ export const ipcChannels = {
magicTodosList: 'magic-todos:list',
magicTodosStatus: 'magic-todos:status',
magicTodosStatusChanged: 'magic-todos:status-changed',
magicNotesChanged: 'magic-notes:changed',
magicTodosUpdate: 'magic-todos:update',
magicTodosAnalyze: 'magic-todos:analyze',
knowledgeSnapshot: 'knowledge:snapshot',