v2.6.0
This commit is contained in:
+30
-12
@@ -172,7 +172,7 @@ export const emailListTool = {
|
||||
},
|
||||
execute: async (args: any): Promise<ToolResult> => {
|
||||
const folder = String(args?.folder || 'INBOX');
|
||||
const limit = Math.min(Number(args?.limit) || 20, 50);
|
||||
const limit = Math.min(Number(args?.limit) || 50, 200);
|
||||
const account = args?.account ? String(args.account) : undefined;
|
||||
const workspacePath = args?._workspacePath || args?._workspace || undefined;
|
||||
try {
|
||||
@@ -274,17 +274,35 @@ export const emailListTool = {
|
||||
return { success: true, stdout: `${folder}: 메일이 없습니다.${errInfo}`, data: [] };
|
||||
}
|
||||
|
||||
const lines = [
|
||||
`📬 ${folder} — 전체 계정에서 ${trimmed.length}개`,
|
||||
'',
|
||||
...trimmed.map((m: any, i: number) =>
|
||||
`${i + 1}. [${m.account}] [UID:${m.uid}] ${m.unread ? '🔵 ' : ''}${m.subject}\n 발신: ${m.from}\n 날짜: ${m.date}`
|
||||
),
|
||||
];
|
||||
if (errors.length) {
|
||||
lines.push('', `⚠️ 일부 계정 오류: ${errors.join('; ')}`);
|
||||
// Group by account, preserving the account order from config
|
||||
const grouped = new Map<string, any[]>();
|
||||
for (const acct of allAccounts) {
|
||||
grouped.set(acct.id, []);
|
||||
}
|
||||
return { success: true, stdout: lines.join('\n'), data: trimmed };
|
||||
for (const m of trimmed) {
|
||||
if (!grouped.has(m.account)) grouped.set(m.account, []);
|
||||
grouped.get(m.account)!.push(m);
|
||||
}
|
||||
const lines: string[] = [];
|
||||
let totalShown = 0;
|
||||
for (const [acctId, msgs] of grouped) {
|
||||
if (msgs.length === 0) {
|
||||
lines.push(`📭 [${acctId}] ${folder} — 메일 없음`, '');
|
||||
continue;
|
||||
}
|
||||
lines.push(`📬 [${acctId}] ${folder} — ${msgs.length}개`, '');
|
||||
for (let i = 0; i < msgs.length; i++) {
|
||||
const m = msgs[i];
|
||||
lines.push(`${i + 1}. [UID:${m.uid}] ${m.unread ? '🔵 ' : ''}${m.subject}\n 발신: ${m.from}\n 날짜: ${m.date}`);
|
||||
totalShown++;
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
lines.unshift(`📬 ${folder} — 전체 계정에서 ${totalShown}개`, '');
|
||||
if (errors.length) {
|
||||
lines.push(`⚠️ 일부 계정 오류: ${errors.join('; ')}`);
|
||||
}
|
||||
return { success: true, stdout: lines.join('\n').replace(/\n{3,}/g, '\n\n').trimEnd(), data: trimmed };
|
||||
} catch (err: any) {
|
||||
return { success: false, error: err.message };
|
||||
}
|
||||
@@ -538,7 +556,7 @@ export const emailSearchTool = {
|
||||
},
|
||||
execute: async (args: any): Promise<ToolResult> => {
|
||||
const folder = String(args?.folder || 'INBOX');
|
||||
const limit = Math.min(Number(args?.limit) || 20, 50);
|
||||
const limit = Math.min(Number(args?.limit) || 50, 200);
|
||||
const account = args?.account ? String(args.account) : undefined;
|
||||
const workspacePath = args?._workspacePath || args?._workspace || undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user