feat: globalize Magic Notes and improve runtime tools

This commit is contained in:
lofyer
2026-08-10 10:27:14 +08:00
parent 1a8e110866
commit 5ea022ad5c
47 changed files with 2442 additions and 1177 deletions
@@ -110,8 +110,11 @@ describe('magic note analyzer', () => {
} as AgentRuntime
const todo: MagicTodoItem = {
id: '00000000-0000-4000-8000-000000000601',
projectId: '00000000-0000-4000-8000-000000000602',
source: 'manual',
noteId: '00000000-0000-4000-8000-000000000602',
entryId: '00000000-0000-4000-8000-000000000603',
noteTitle: '发布笔记',
sourceIndex: 0,
source: 'note',
title: '整理发布清单',
instructions: '核对版本、说明和构建产物。',
completed: false,
@@ -125,7 +128,7 @@ describe('magic note analyzer', () => {
analyzeMagicTodo(
runtime,
todo,
'00000000-0000-4000-8000-000000000603'
'00000000-0000-4000-8000-000000000604'
)
).resolves.toEqual([
expect.objectContaining({
@@ -141,6 +141,24 @@ export async function analyzeMagicNoteEntry(
)
}
export async function analyzeMagicNoteDraft(
runtime: AgentRuntime,
plainText: string,
requestId: string,
onModelUsage?: (event: RuntimeModelUsageEvent) => void
): Promise<MagicNoteComment[]> {
return analyzeComments(
runtime,
{
source: plainText,
conversationId: `magic-note-drafts:${requestId}`,
subject: '未保存笔记草稿'
},
requestId,
onModelUsage
)
}
export function analyzeMagicTodo(
runtime: AgentRuntime,
todo: MagicTodoItem,