Skip to content

Email for professionals and teams

Translate the email assistant

Hieu Nguyen (Jack)06f881b31601
diff --git a/src/components/agent/agent-panel.tsx b/src/components/agent/agent-panel.tsx
index ef55b4f..1532716 100644
--- a/src/components/agent/agent-panel.tsx
+++ b/src/components/agent/agent-panel.tsx
@@ -5,6 +5,7 @@ import "./style.scss"
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
import { usePathname } from "next/navigation";
import { ArrowLeft, FileText, ListChecks, LoaderCircle, Maximize2, Minimize2, Pause, PauseCircle, PenLine, Plus, Send, Settings2, Sparkles, Square, Trash2, X } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import { authFetch } from "@/lib/auth/client";
import { getUserTimeZone } from "@/lib/time/utils";
import { useSelectedMailbox } from "@/components/mailbox-provider";
@@ -21,6 +22,7 @@ import type { AgentConversation, AgentConversationsResponse, AgentErrorResponse,
import { activeAgentTool, activeAgentToolLabel, appendAgentReasoning, consumeAgentStream, editQueuedAgentMessage, enqueueAgentMessage, groupAgentMessages, isAgentScrollAtBottom, markAgentDraftSent, normalizeAgentHistory, readAgentConversationId, removeQueuedAgentMessage, resizeAgentInput, saveAgentConversationId, shouldSubmitAgentInput, steerQueuedAgentMessage, uniqueAgentDraftActions } from "./utils";
export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentPanelProps) {
+ const { t } = useLanguage();
const { selectedMailbox } = useSelectedMailbox();
const pathname = usePathname();
const { openDraftComposer } = useCompose();
@@ -55,13 +57,13 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
const mailboxId = selectedMailbox?.id;
const selectedMessageId = pathname.match(/^\/(?:inbox|sent|archived|spam|trash|starred|snoozed|folders\/[^/]+)\/([^/]+)/)?.[1] ?? null;
const welcomePrompts = selectedMessageId ? [
- { label: "Summarize this email", detail: "Get the key points", prompt: `Read the thread containing email ${selectedMessageId} and summarize its key points.`, icon: FileText },
- { label: "Suggest a reply", detail: "Create a draft for review", prompt: `Read the thread containing email ${selectedMessageId} and draft a reply.`, icon: PenLine },
- { label: "List action items", detail: "Find next steps in this email", prompt: `Read the thread containing email ${selectedMessageId} and list the action items.`, icon: ListChecks },
+ { label: t("agent.welcome.sumThis"), detail: t("agent.welcome.sumThisDetail"), prompt: `Read the thread containing email ${selectedMessageId} and summarize its key points.`, icon: FileText },
+ { label: t("agent.welcome.reply"), detail: t("agent.welcome.replyDetail"), prompt: `Read the thread containing email ${selectedMessageId} and draft a reply.`, icon: PenLine },
+ { label: t("agent.welcome.actionsThis"), detail: t("agent.welcome.actionsThisDetail"), prompt: `Read the thread containing email ${selectedMessageId} and list the action items.`, icon: ListChecks },
] : [
- { label: "Summarize recent mail", detail: "Catch up on your inbox", prompt: "Summarize my recent email in this mailbox.", icon: FileText },
- { label: "Suggest a reply", detail: "Create a draft for review", prompt: "Read my latest email and draft a reply.", icon: PenLine },
- { label: "Find action items", detail: "See what needs attention", prompt: "Find action items in my recent email.", icon: ListChecks },
+ { label: t("agent.welcome.sumRecent"), detail: t("agent.welcome.sumRecentDetail"), prompt: "Summarize my recent email in this mailbox.", icon: FileText },
+ { label: t("agent.welcome.reply"), detail: t("agent.welcome.replyDetail"), prompt: "Read my latest email and draft a reply.", icon: PenLine },
+ { label: t("agent.welcome.actions"), detail: t("agent.welcome.actionsDetail"), prompt: "Find action items in my recent email.", icon: ListChecks },
];
const refresh = useCallback(async () => {
@@ -73,7 +75,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
]);
if (!settingsResponse.ok) {
const data = await settingsResponse.json().catch(() => ({})) as AgentErrorResponse;
- setError(data.error || "Could not load assistant settings");
+ setError(data.error || t("agent.panel.settingsLoadFailed"));
return;
}
if (settingsResponse.ok) {
@@ -87,7 +89,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
}
if (conversationsResponse.ok) setConversations(((await conversationsResponse.json()) as AgentConversationsResponse).conversations ?? []);
if (jobsResponse.ok) setJobs(((await jobsResponse.json()) as AgentJobsResponse).jobs ?? []);
- }, [mailboxId]);
+ }, [mailboxId, t]);
useEffect(() => {
abort.current?.abort();
@@ -106,7 +108,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
setView("chat");
if (menuRef.current) menuRef.current.open = false;
setError(null);
- void refresh().catch(() => { if (!cancelled) setError("Could not load assistant settings"); });
+ void refresh().catch(() => { if (!cancelled) setError(t("agent.panel.settingsLoadFailed")); });
const savedId = readAgentConversationId(mailboxId);
selectedConversationRef.current = savedId;
setLoadingConversation(Boolean(savedId));
@@ -178,11 +180,11 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
if (menuRef.current) menuRef.current.open = false;
try {
const response = await authFetch(`/api/agent/conversations/${id}?mailboxId=${encodeURIComponent(mailboxId)}`);
- if (!response.ok) throw new Error("Could not load conversation");
+ if (!response.ok) throw new Error(t("agent.panel.conversationLoadFailed"));
const history = await response.json() as AgentHistoryResponse;
if (selectedConversationRef.current === id) setMessages(normalizeAgentHistory(history.messages ?? []));
} catch (cause) {
- if (selectedConversationRef.current === id) setError(cause instanceof Error ? cause.message : "Could not load conversation");
+ if (selectedConversationRef.current === id) setError(cause instanceof Error ? cause.message : t("agent.panel.conversationLoadFailed"));
} finally {
if (selectedConversationRef.current === id) setLoadingConversation(false);
}
@@ -193,7 +195,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
setDeletingConversationId(id);
try {
const response = await authFetch(`/api/agent/conversations/${encodeURIComponent(id)}`, { method: "DELETE" });
- if (!response.ok) throw new Error("Could not delete conversation");
+ if (!response.ok) throw new Error(t("agent.panel.conversationDeleteFailed"));
setConversations((current) => current.filter((item) => item.id !== id));
if (selectedConversationRef.current === id || conversationId === id) {
abort.current?.abort();
@@ -210,7 +212,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
setLoadingConversation(false);
}
} catch (cause) {
- setError(cause instanceof Error ? cause.message : "Could not delete conversation");
+ setError(cause instanceof Error ? cause.message : t("agent.panel.conversationDeleteFailed"));
} finally {
setDeletingConversationId(null);
}
@@ -232,7 +234,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
setMessages((current) => [...current, { id: userMessageId, role: "user", content: text, createdAt: new Date(startedAt).toISOString() }, { id: assistantMessageId, role: "assistant", content: "", pending: true }]);
try {
const response = await authFetch("/api/agent/chat", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ mailboxId, ...(selectedConversationRef.current ? { conversationId: selectedConversationRef.current } : {}), text, timeZone: getUserTimeZone() }), signal: controller.signal });
- if (!response.ok) throw new Error(((await response.json()) as AgentErrorResponse).error || "Assistant unavailable");
+ if (!response.ok) throw new Error(((await response.json()) as AgentErrorResponse).error || t("agent.panel.unavailable"));
accepted = true;
const responseConversationId = response.headers.get("X-Conversation-Id");
if (responseConversationId && generation === queueGenerationRef.current) { selectedConversationRef.current = responseConversationId; saveAgentConversationId(mailboxId, responseConversationId); setConversationId(responseConversationId); }
@@ -263,7 +265,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
else setInput((current) => current || text);
}
} else setMessages((current) => current.map((item) => item.id === assistantMessageId ? { ...item, pending: false, durationMs: Date.now() - startedAt, createdAt: new Date().toISOString() } : item));
- if (!controller.signal.aborted) setError(cause instanceof Error ? cause.message : "Assistant failed");
+ if (!controller.signal.aborted) setError(cause instanceof Error ? cause.message : t("agent.panel.failed"));
streamErrored = !controller.signal.aborted;
} finally {
if (abort.current !== controller) return;
@@ -302,29 +304,29 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
setError(null);
try {
const response = await authFetch("/api/agent/settings", { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify(settings) });
- if (!response.ok) throw new Error(((await response.json()) as AgentErrorResponse).error || "Could not save settings");
+ if (!response.ok) throw new Error(((await response.json()) as AgentErrorResponse).error || t("agent.panel.saveFailed"));
await refresh();
- } catch (cause) { setError(cause instanceof Error ? cause.message : "Could not save settings"); }
+ } catch (cause) { setError(cause instanceof Error ? cause.message : t("agent.panel.saveFailed")); }
finally { setBusy(false); }
}
async function retryJob(id: string) {
const response = await authFetch(`/api/agent/jobs/${id}/retry`, { method: "POST" });
if (response.ok) await refresh();
- else setError(((await response.json()) as AgentErrorResponse).error || "Could not retry draft");
+ else setError(((await response.json()) as AgentErrorResponse).error || t("agent.panel.retryFailed"));
}
async function discardJobDraft(draftId: string) {
const response = await authFetch(`/api/drafts/${encodeURIComponent(draftId)}`, { method: "DELETE" });
if (response.ok) await refresh();
- else setError(((await response.json()) as AgentErrorResponse).error || "Could not discard draft");
+ else setError(((await response.json()) as AgentErrorResponse).error || t("agent.panel.discardFailed"));
}
async function startDraftReview(draftId: string, revision: number) {
setApprovingId(draftId);
setError(null);
try { setDraftReview({ ...await requestDraftReview(draftId, revision), draftId }); }
- catch (cause) { setError(cause instanceof Error ? cause.message : "Could not open draft review"); }
+ catch (cause) { setError(cause instanceof Error ? cause.message : t("agent.panel.reviewFailed")); }
finally { setApprovingId(null); }
}
@@ -336,52 +338,52 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
const result = await approveAgentAction(item.recordId);
setMessages((current) => current.map((message) => message.id === item.id ? { ...message, content: JSON.stringify(result) } : message));
window.dispatchEvent(new Event("mailflare:messages-changed"));
- } catch (cause) { setError(cause instanceof Error ? cause.message : "Could not approve action"); }
+ } catch (cause) { setError(cause instanceof Error ? cause.message : t("agent.panel.approveFailed")); }
finally { setApprovingId(null); }
}
const draftActions = uniqueAgentDraftActions(messages);
const activeTool = busy ? activeAgentTool(messages) : null;
- return <section id="email-assistant-panel" className="flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl border border-neutral-200/70 bg-white text-neutral-900 shadow-xl shadow-neutral-300/30 max-md:rounded-b-none max-md:border-0 max-md:shadow-none" aria-label="Email assistant">
+ return <section id="email-assistant-panel" className="flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl border border-neutral-200/70 bg-white text-neutral-900 shadow-xl shadow-neutral-300/30 max-md:rounded-b-none max-md:border-0 max-md:shadow-none" aria-label={t("agent.panel.label")}>
<header className="flex h-14 shrink-0 items-center justify-between gap-2 border-b border-neutral-100 pl-4 pr-2">
- <div className="flex min-w-0 items-center gap-2.5">{view === "settings" ? <button type="button" className="-ml-2 rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={() => setView("chat")} aria-label="Back to assistant" title="Back to assistant"><ArrowLeft size={18} /></button> : <Sparkles className="h-5 w-5 shrink-0 fill-blue-400/20 text-blue-600/70" aria-hidden="true" />}<div className="min-w-0"><strong className="block truncate text-sm font-semibold">{view === "settings" ? "Settings" : "Assistant"}</strong></div></div>
- <div className="flex shrink-0 items-center gap-0.5"><details ref={menuRef} className="relative"><summary className={`list-none cursor-pointer rounded-full p-2 hover:bg-neutral-100 [&::-webkit-details-marker]:hidden ${view === "settings" ? "text-blue-700" : "text-neutral-600 hover:text-neutral-900"}`} aria-label="Assistant conversations and settings"><Settings2 size={18} /></summary><div className="absolute -right-16 top-full z-30 mt-2 flex w-72 flex-col overflow-hidden rounded-2xl border border-neutral-200 bg-white py-2 text-sm shadow-xl"><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { abort.current?.abort(); abort.current = null; runningRef.current = false; queueGenerationRef.current += 1; queuedMessagesRef.current = []; setQueuedMessages([]); setBusy(false); selectedConversationRef.current = null; stickToBottomRef.current = true; if (mailboxId) saveAgentConversationId(mailboxId, null); setConversationId(null); setMessages([]); setLoadingConversation(false); setInput(""); setView("chat"); menuRef.current!.open = false; }}><Plus size={16} /> New chat</button><div className="mx-3 my-2 border-t border-neutral-100" />{conversations.length ? <><p className="px-4 pb-1 text-xs font-medium text-neutral-500">Previous chats</p><div className="max-h-64 overflow-y-auto">{conversations.map((item) => <div key={item.id} className={`group flex items-center hover:bg-neutral-50 ${conversationId === item.id ? "bg-blue-50 text-blue-700" : "text-neutral-700"}`}><button type="button" className="min-w-0 flex-1 truncate py-2 pl-4 pr-2 text-left" onClick={() => void selectConversation(item.id)}>{item.title}</button><button type="button" className="mr-2 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-neutral-500 opacity-0 transition-opacity hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100" aria-label={`Delete ${item.title}`} title="Delete chat" disabled={deletingConversationId !== null} onClick={() => void deleteConversation(item.id)}><Trash2 size={15} /></button></div>)}</div></> : <p className="px-4 py-3 text-neutral-500">No previous chats</p>}<div className="mx-3 my-2 border-t border-neutral-100" /><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { setView((current) => current === "settings" ? "chat" : "settings"); menuRef.current!.open = false; }}><Settings2 size={16} /> {view === "settings" ? "Back to chat" : "Settings"}</button></div></details><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onToggleFullSize} aria-label={fullSize ? "Exit full size assistant" : "Expand assistant to full size"} aria-pressed={fullSize} title={fullSize ? "Exit full size" : "Full size"}>{fullSize ? <Minimize2 size={18} /> : <Maximize2 size={18} />}</button><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onClose} aria-label="Close assistant"><X size={18} /></button></div>
+ <div className="flex min-w-0 items-center gap-2.5">{view === "settings" ? <button type="button" className="-ml-2 rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={() => setView("chat")} aria-label={t("agent.panel.backToAssistant")} title={t("agent.panel.backToAssistant")}><ArrowLeft size={18} /></button> : <Sparkles className="h-5 w-5 shrink-0 fill-blue-400/20 text-blue-600/70" aria-hidden="true" />}<div className="min-w-0"><strong className="block truncate text-sm font-semibold">{view === "settings" ? t("agent.panel.settings") : t("agent.panel.assistant")}</strong></div></div>
+ <div className="flex shrink-0 items-center gap-0.5"><details ref={menuRef} className="relative"><summary className={`list-none cursor-pointer rounded-full p-2 hover:bg-neutral-100 [&::-webkit-details-marker]:hidden ${view === "settings" ? "text-blue-700" : "text-neutral-600 hover:text-neutral-900"}`} aria-label={t("agent.panel.menuLabel")}><Settings2 size={18} /></summary><div className="absolute -right-16 top-full z-30 mt-2 flex w-72 flex-col overflow-hidden rounded-2xl border border-neutral-200 bg-white py-2 text-sm shadow-xl"><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { abort.current?.abort(); abort.current = null; runningRef.current = false; queueGenerationRef.current += 1; queuedMessagesRef.current = []; setQueuedMessages([]); setBusy(false); selectedConversationRef.current = null; stickToBottomRef.current = true; if (mailboxId) saveAgentConversationId(mailboxId, null); setConversationId(null); setMessages([]); setLoadingConversation(false); setInput(""); setView("chat"); menuRef.current!.open = false; }}><Plus size={16} /> {t("agent.panel.newChat")}</button><div className="mx-3 my-2 border-t border-neutral-100" />{conversations.length ? <><p className="px-4 pb-1 text-xs font-medium text-neutral-500">{t("agent.panel.previousChats")}</p><div className="max-h-64 overflow-y-auto">{conversations.map((item) => <div key={item.id} className={`group flex items-center hover:bg-neutral-50 ${conversationId === item.id ? "bg-blue-50 text-blue-700" : "text-neutral-700"}`}><button type="button" className="min-w-0 flex-1 truncate py-2 pl-4 pr-2 text-left" onClick={() => void selectConversation(item.id)}>{item.title}</button><button type="button" className="mr-2 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-neutral-500 opacity-0 transition-opacity hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100" aria-label={t("agent.panel.deleteChatLabel", { title: item.title })} title={t("agent.panel.deleteChat")} disabled={deletingConversationId !== null} onClick={() => void deleteConversation(item.id)}><Trash2 size={15} /></button></div>)}</div></> : <p className="px-4 py-3 text-neutral-500">{t("agent.panel.noChats")}</p>}<div className="mx-3 my-2 border-t border-neutral-100" /><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { setView((current) => current === "settings" ? "chat" : "settings"); menuRef.current!.open = false; }}><Settings2 size={16} /> {view === "settings" ? t("agent.panel.backToChat") : t("agent.panel.settings")}</button></div></details><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onToggleFullSize} aria-label={fullSize ? t("agent.panel.exitFull") : t("agent.panel.expandFull")} aria-pressed={fullSize} title={fullSize ? t("agent.panel.exitFullTitle") : t("agent.panel.fullTitle")}>{fullSize ? <Minimize2 size={18} /> : <Maximize2 size={18} />}</button><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onClose} aria-label={t("agent.panel.close")}><X size={18} /></button></div>
</header>
{error && <p role="alert" className="mx-4 mt-3 break-words rounded-xl border border-red-100 bg-red-50 p-3 text-sm text-red-700">{error}</p>}
{view === "chat" && <>
<div ref={chatScrollRef} onScroll={(event) => { stickToBottomRef.current = isAgentScrollAtBottom(event.currentTarget); }} className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-5 text-sm sm:px-5">
<div className="mx-auto max-w-3xl space-y-5">
- {settings && !providerConfigured && <p className="rounded-2xl border border-amber-100 bg-amber-50 p-3 text-amber-800">Configure an AI provider to use chat and auto-drafts.</p>}
+ {settings && !providerConfigured && <p className="rounded-2xl border border-amber-100 bg-amber-50 p-3 text-amber-800">{t("agent.panel.configureProvider")}</p>}
{loadingConversation && <ConversationSkeleton />}
- {!loadingConversation && messages.length === 0 && settings && <div className="pt-3"><label className="agent-welcome-heading mt-1 font-medium leading-tight text-neutral-800">How can I help you today?</label><div className="mt-7 space-y-2">{welcomePrompts.map((item) => { const Icon = item.icon; return <button key={item.label} type="button" className="agent-welcome-prompt flex w-full items-center gap-3 rounded-2xl bg-[#f0f3f9] px-3 py-3 text-left transition-colors hover:bg-[#e6ecf6] disabled:cursor-not-allowed disabled:opacity-50" disabled={!providerConfigured || busy} onClick={() => submitMessage(item.prompt)}><span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-white text-neutral-800"><Icon size={18} /></span><span className="min-w-0"><span className="block font-medium text-neutral-800">{item.label}</span><span className="block text-xs text-neutral-500">{item.detail}</span></span></button>; })}</div></div>}
+ {!loadingConversation && messages.length === 0 && settings && <div className="pt-3"><label className="agent-welcome-heading mt-1 font-medium leading-tight text-neutral-800">{t("agent.panel.welcome")}</label><div className="mt-7 space-y-2">{welcomePrompts.map((item) => { const Icon = item.icon; return <button key={item.label} type="button" className="agent-welcome-prompt flex w-full items-center gap-3 rounded-2xl bg-[#f0f3f9] px-3 py-3 text-left transition-colors hover:bg-[#e6ecf6] disabled:cursor-not-allowed disabled:opacity-50" disabled={!providerConfigured || busy} onClick={() => submitMessage(item.prompt)}><span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-white text-neutral-800"><Icon size={18} /></span><span className="min-w-0"><span className="block font-medium text-neutral-800">{item.label}</span><span className="block text-xs text-neutral-500">{item.detail}</span></span></button>; })}</div></div>}
{groupAgentMessages(messages).map((turn) => <AgentTurnView key={turn.id} turn={turn} draftActions={draftActions} onOpenDraft={openDraftComposer} onApproveDraft={(draftId, revision) => void startDraftReview(draftId, revision)} onApproveAction={(item) => void confirmAction(item)} approvingId={approvingId} />)}
- {jobs.filter((job) => job.status === "completed" && job.draftId).slice(0, 5).map((job) => <div key={job.id} className="rounded-2xl border border-neutral-200 bg-white p-3"><p>Auto-draft ready</p><div className="mt-2 flex gap-3 text-blue-700"><button type="button" onClick={() => openDraftComposer(job.draftId!)}>Open draft</button><button type="button" disabled={busy} onClick={() => submitMessage(`Read the thread containing email ${job.sourceMessageId} and draft another reply. Preserve the existing draft.`)}>Regenerate</button><button type="button" className="text-red-600" onClick={() => void discardJobDraft(job.draftId!)}>Discard</button></div></div>)}
+ {jobs.filter((job) => job.status === "completed" && job.draftId).slice(0, 5).map((job) => <div key={job.id} className="rounded-2xl border border-neutral-200 bg-white p-3"><p>{t("agent.panel.autoDraftReady")}</p><div className="mt-2 flex gap-3 text-blue-700"><button type="button" onClick={() => openDraftComposer(job.draftId!)}>{t("agent.panel.openDraft")}</button><button type="button" disabled={busy} onClick={() => submitMessage(`Read the thread containing email ${job.sourceMessageId} and draft another reply. Preserve the existing draft.`)}>{t("agent.panel.regenerate")}</button><button type="button" className="text-red-600" onClick={() => void discardJobDraft(job.draftId!)}>{t("agent.panel.discard")}</button></div></div>)}
</div>
</div>
<QueuedAgentMessages messages={queuedMessages} running={busy} onRemove={(id) => { queuedMessagesRef.current = removeQueuedAgentMessage(queuedMessagesRef.current, id); setQueuedMessages(queuedMessagesRef.current); }} onEdit={(id, text) => { queuedMessagesRef.current = editQueuedAgentMessage(queuedMessagesRef.current, id, text); setQueuedMessages(queuedMessagesRef.current); }} onSteer={(id) => { queuedMessagesRef.current = steerQueuedAgentMessage(queuedMessagesRef.current, id); setQueuedMessages(queuedMessagesRef.current); if (runningRef.current) abort.current?.abort(); else { const [next, ...remaining] = queuedMessagesRef.current; if (next) { queuedMessagesRef.current = remaining; setQueuedMessages(remaining); void send(next.text, next); } } }} />
{busy && <div role="status" aria-live="polite" className="mx-auto w-full max-w-3xl space-y-1 px-5 py-2 text-sm text-neutral-500">
- {activeTool && <div className="flex items-center gap-2"><LoaderCircle size={14} className="shrink-0 animate-spin" aria-hidden="true" /><span>{activeAgentToolLabel(activeTool.toolName)}</span></div>}
- <div className="flex items-center gap-2"><LoaderCircle size={14} className="shrink-0 animate-spin" aria-hidden="true" /><span>Working...</span></div>
+ {activeTool && <div className="flex items-center gap-2"><LoaderCircle size={14} className="shrink-0 animate-spin" aria-hidden="true" /><span>{activeAgentToolLabel(activeTool.toolName, t)}</span></div>}
+ <div className="flex items-center gap-2"><LoaderCircle size={14} className="shrink-0 animate-spin" aria-hidden="true" /><span>{t("agent.panel.working")}</span></div>
</div>}
- <form className="relative mx-auto w-full max-w-3xl pb-2 px-3" onSubmit={(event) => { event.preventDefault(); submitMessage(input); }}><textarea ref={inputRef} rows={1} className="block w-full resize-none rounded-4xl bg-blue-100/40 px-4 py-3 pr-20 text-sm leading-5 outline-none focus:border-blue-300 disabled:opacity-50" value={input} onChange={(event) => setInput(event.target.value)} onKeyDown={(event) => { if (!shouldSubmitAgentInput(event)) return; event.preventDefault(); if (input.trim() && settings && providerConfigured && !loadingConversation) event.currentTarget.form?.requestSubmit(); }} placeholder="Enter a prompt here" name="message" disabled={!settings || !providerConfigured || loadingConversation} />
+ <form className="relative mx-auto w-full max-w-3xl pb-2 px-3" onSubmit={(event) => { event.preventDefault(); submitMessage(input); }}><textarea ref={inputRef} rows={1} className="block w-full resize-none rounded-4xl bg-blue-100/40 px-4 py-3 pr-20 text-sm leading-5 outline-none focus:border-blue-300 disabled:opacity-50" value={input} onChange={(event) => setInput(event.target.value)} onKeyDown={(event) => { if (!shouldSubmitAgentInput(event)) return; event.preventDefault(); if (input.trim() && settings && providerConfigured && !loadingConversation) event.currentTarget.form?.requestSubmit(); }} placeholder={t("agent.panel.promptPlaceholder")} name="message" disabled={!settings || !providerConfigured || loadingConversation} />
<div className="absolute bottom-3.5 right-4 flex justify-end gap-2">
- {busy ? <Button type="button" variant="ghost" size="sm" onClick={() => abort.current?.abort()} className="bg-neutral-500/10 text-neutral-500 rounded-full" aria-label="Stop response" title="Stop response"><Pause size={16} /></Button> : <Button type="submit" variant="ghost" size="sm" disabled={!input.trim() || !settings || !providerConfigured || loadingConversation} aria-label="Send message" title="Send message"><Send size={18} /></Button>}
+ {busy ? <Button type="button" variant="ghost" size="sm" onClick={() => abort.current?.abort()} className="bg-neutral-500/10 text-neutral-500 rounded-full" aria-label={t("agent.panel.stop")} title={t("agent.panel.stop")}><Pause size={16} /></Button> : <Button type="submit" variant="ghost" size="sm" disabled={!input.trim() || !settings || !providerConfigured || loadingConversation} aria-label={t("agent.panel.send")} title={t("agent.panel.send")}><Send size={18} /></Button>}
</div>
</form>
</>}
{view === "settings" && <div className="min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain p-4 text-sm">
- {!canManage && <p>Mailbox management permission is required to change these settings.</p>}
+ {!canManage && <p>{t("agent.panel.needPermission")}</p>}
{settings && <>
- <label className="block">Draft reviewer<select className="mt-2 w-full rounded-xl border border-neutral-200 bg-white p-2 outline-none focus:border-blue-400" value={settings.reviewerUserId ?? ""} disabled={!canManage} onChange={(event) => setSettings({ ...settings, reviewerUserId: event.target.value })}>{reviewers.map((reviewer) => <option key={reviewer.id} value={reviewer.id}>{reviewer.name} ({reviewer.email})</option>)}</select></label>
- <label className="block">Model<select className="mt-2 w-full rounded-xl border border-neutral-200 bg-white p-2 outline-none focus:border-blue-400" value={settings.modelId ?? ""} disabled={!canManage || !availableModels.length} onChange={(event) => setSettings({ ...settings, modelId: event.target.value })}>{!availableModels.length && <option value="">No models configured</option>}{availableModels.map((model) => <option key={model} value={model}>{model}</option>)}</select></label>
- <div className="flex items-center justify-between gap-3"><span>Automatically draft replies</span><Switch checked={settings.autoDraftEnabled} disabled={!canManage || autoReplyEnabled} onCheckedChange={(checked) => setSettings({ ...settings, autoDraftEnabled: checked })} aria-label="Automatically draft replies" /></div>
- {autoReplyEnabled && <p className="text-amber-700">Disable out-of-office auto-replies to enable AI drafts.</p>}
- <label className="block">Writing instructions<textarea className="mt-2 min-h-32 w-full rounded-xl border border-neutral-200 p-2 outline-none focus:border-blue-400" value={settings.instructions} disabled={!canManage} onChange={(event) => setSettings({ ...settings, instructions: event.target.value })} /></label>
- <label className="block">Daily auto-draft limit<input className="mt-2 w-full rounded-xl border border-neutral-200 p-2 outline-none focus:border-blue-400" type="number" min="1" max="100" value={settings.dailyLimit} disabled={!canManage} onChange={(event) => setSettings({ ...settings, dailyLimit: Number(event.target.value) })} /></label>
- <Button type="button" size="sm" disabled={!canManage || busy} onClick={() => void saveSettings()}>Save settings</Button>
+ <label className="block">{t("agent.panel.reviewer")}<select className="mt-2 w-full rounded-xl border border-neutral-200 bg-white p-2 outline-none focus:border-blue-400" value={settings.reviewerUserId ?? ""} disabled={!canManage} onChange={(event) => setSettings({ ...settings, reviewerUserId: event.target.value })}>{reviewers.map((reviewer) => <option key={reviewer.id} value={reviewer.id}>{reviewer.name} ({reviewer.email})</option>)}</select></label>
+ <label className="block">{t("agent.panel.model")}<select className="mt-2 w-full rounded-xl border border-neutral-200 bg-white p-2 outline-none focus:border-blue-400" value={settings.modelId ?? ""} disabled={!canManage || !availableModels.length} onChange={(event) => setSettings({ ...settings, modelId: event.target.value })}>{!availableModels.length && <option value="">{t("agent.panel.noModels")}</option>}{availableModels.map((model) => <option key={model} value={model}>{model}</option>)}</select></label>
+ <div className="flex items-center justify-between gap-3"><span>{t("agent.panel.autoDraft")}</span><Switch checked={settings.autoDraftEnabled} disabled={!canManage || autoReplyEnabled} onCheckedChange={(checked) => setSettings({ ...settings, autoDraftEnabled: checked })} aria-label={t("agent.panel.autoDraft")} /></div>
+ {autoReplyEnabled && <p className="text-amber-700">{t("agent.panel.disableOoo")}</p>}
+ <label className="block">{t("agent.panel.instructions")}<textarea className="mt-2 min-h-32 w-full rounded-xl border border-neutral-200 p-2 outline-none focus:border-blue-400" value={settings.instructions} disabled={!canManage} onChange={(event) => setSettings({ ...settings, instructions: event.target.value })} /></label>
+ <label className="block">{t("agent.panel.dailyLimit")}<input className="mt-2 w-full rounded-xl border border-neutral-200 p-2 outline-none focus:border-blue-400" type="number" min="1" max="100" value={settings.dailyLimit} disabled={!canManage} onChange={(event) => setSettings({ ...settings, dailyLimit: Number(event.target.value) })} /></label>
+ <Button type="button" size="sm" disabled={!canManage || busy} onClick={() => void saveSettings()}>{t("agent.panel.save")}</Button>
</>}
- <p className="text-xs text-neutral-500">Selected email and thread content is sent to the configured AI provider when you use chat or auto-drafts. Drafts always need your confirmation before sending.</p>
- {jobs.filter((job) => job.status === "failed" || job.status === "skipped").slice(0, 5).map((job) => <p key={job.id} className="text-xs">{job.status}: {job.reason}{job.status === "failed" && <button type="button" className="ml-2 text-blue-700 underline" onClick={() => void retryJob(job.id)}>Retry</button>}</p>)}
+ <p className="text-xs text-neutral-500">{t("agent.panel.privacy")}</p>
+ {jobs.filter((job) => job.status === "failed" || job.status === "skipped").slice(0, 5).map((job) => <p key={job.id} className="text-xs">{job.status}: {job.reason}{job.status === "failed" && <button type="button" className="ml-2 text-blue-700 underline" onClick={() => void retryJob(job.id)}>{t("agent.panel.retry")}</button>}</p>)}
</div>}
{draftReview && <SendReview approvalId={draftReview.approvalId} snapshot={draftReview.snapshot} onClose={() => setDraftReview(null)} onSent={() => { setMessages((current) => markAgentDraftSent(current, draftReview.draftId)); setDraftReview(null); void refresh(); }} />}
</section>;
diff --git a/src/components/agent/agent-turn.tsx b/src/components/agent/agent-turn.tsx
index 8b1c672..7c86d51 100644
--- a/src/components/agent/agent-turn.tsx
+++ b/src/components/agent/agent-turn.tsx
@@ -5,11 +5,13 @@ import ReactMarkdown from "react-markdown";
import Link from "next/link";
import remarkGfm from "remark-gfm";
import { ChevronDown, Clock3 } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import type { AgentTurnProps } from "./types";
import { agentDraftIdFromHref, formatAgentDuration } from "./utils";
import { AgentDraftActions, AgentPendingActions, AgentToolActivity } from "./tool-activity";
export function AgentTurnView({ turn, draftActions, onOpenDraft, onApproveDraft, onApproveAction, approvingId }: AgentTurnProps) {
+ const { t } = useLanguage();
const [workOpen, setWorkOpen] = useState(turn.running);
const [prevRunning, setPrevRunning] = useState(turn.running);
if (turn.running !== prevRunning) {
@@ -18,12 +20,12 @@ export function AgentTurnView({ turn, draftActions, onOpenDraft, onApproveDraft,
}
const turnDraftActions = draftActions.filter((action) => turn.activity.some((item) => item.id === action.messageId));
const workContent = <div className="mt-2 space-y-2 text-xs">
- {turn.activity.length ? turn.activity.map((item) => item.role === "reasoning" ? <p key={item.id} className="whitespace-pre-wrap break-words text-xs text-neutral-600 pl-5">{item.content}</p> : <AgentToolActivity key={item.id} item={item} forceOpen={turn.running} />) : <p className="text-neutral-400">{turn.running ? "Waiting for the model..." : "No tool details were provided."}</p>}
+ {turn.activity.length ? turn.activity.map((item) => item.role === "reasoning" ? <p key={item.id} className="whitespace-pre-wrap break-words text-xs text-neutral-600 pl-5">{item.content}</p> : <AgentToolActivity key={item.id} item={item} forceOpen={turn.running} />) : <p className="text-neutral-400">{turn.running ? t("agent.turn.waiting") : t("agent.turn.noDetails")}</p>}
</div>;
return <div className="space-y-3 py-2">
{turn.user && <div className="ml-auto w-fit max-w-[90%] whitespace-pre-wrap break-words rounded-2xl bg-blue-100/65 px-4 py-3 text-sm leading-relaxed text-black">{turn.user.content}</div>}
{(turn.assistant || turn.activity.length > 0) && <div className="space-y-3">
- {turn.running ? turn.activity.length > 0 && <div className="text-neutral-500">{workContent}</div> : <details open={workOpen} onToggle={(event) => setWorkOpen(event.currentTarget.open)} className="group/process text-neutral-500"><summary className="flex w-fit cursor-pointer list-none items-center gap-1.5 py-1 [&::-webkit-details-marker]:hidden"><Clock3 size={13} className="text-neutral-400" aria-hidden="true" /><span>{turn.durationMs !== null ? `Worked for ${formatAgentDuration(turn.durationMs)}` : "Work details"}</span><ChevronDown size={13} className="transition-transform group-open/process:rotate-180" aria-hidden="true" /></summary>{workContent}</details>}
+ {turn.running ? turn.activity.length > 0 && <div className="text-neutral-500">{workContent}</div> : <details open={workOpen} onToggle={(event) => setWorkOpen(event.currentTarget.open)} className="group/process text-neutral-500"><summary className="flex w-fit cursor-pointer list-none items-center gap-1.5 py-1 [&::-webkit-details-marker]:hidden"><Clock3 size={13} className="text-neutral-400" aria-hidden="true" /><span>{turn.durationMs !== null ? t("agent.turn.workedFor", { duration: formatAgentDuration(turn.durationMs) }) : t("agent.turn.workDetails")}</span><ChevronDown size={13} className="transition-transform group-open/process:rotate-180" aria-hidden="true" /></summary>{workContent}</details>}
{turn.assistant?.content && <div className="break-words text-sm leading-relaxed text-neutral-900 [&_a]:text-blue-700 [&_li]:ml-4 [&_li]:list-disc [&_p]:mb-3 message-content"><ReactMarkdown remarkPlugins={[remarkGfm]} skipHtml components={{ img: () => null, a: ({ href, children }) => { const draftId = agentDraftIdFromHref(href); return draftId ? <Link href={`/drafts/${encodeURIComponent(draftId)}`}>{children}</Link> : href?.startsWith("/") && !href.startsWith("//") ? <Link href={href}>{children}</Link> : <a href={href}>{children}</a>; } }}>{turn.assistant.content}</ReactMarkdown></div>}
{turnDraftActions.map((action) => <AgentDraftActions key={action.draftId} action={action} onOpenDraft={onOpenDraft} onApproveDraft={onApproveDraft} approvingId={approvingId} />)}
{turn.activity.filter((item) => item.role === "tool").map((item) => <AgentPendingActions key={`${item.id}:actions`} item={item} onApproveAction={onApproveAction} approvingId={approvingId} />)}
diff --git a/src/components/agent/conversation-skeleton.tsx b/src/components/agent/conversation-skeleton.tsx
index 13c12f2..09a44cd 100644
--- a/src/components/agent/conversation-skeleton.tsx
+++ b/src/components/agent/conversation-skeleton.tsx
@@ -1,7 +1,12 @@
+"use client";
+
+import { useLanguage } from "@/components/language-provider";
+
import { Skeleton } from "@/components/ui/skeleton";
export function ConversationSkeleton() {
- return <div role="status" aria-label="Loading conversation" className="space-y-6 py-2">
+ const { t } = useLanguage();
+ return <div role="status" aria-label={t("agent.loadingConversation")} className="space-y-6 py-2">
<div className="flex justify-end"><Skeleton className="h-12 w-3/5 max-w-72 rounded-2xl bg-blue-100/65" /></div>
<div className="space-y-3">
<Skeleton className="h-3 w-24" />
diff --git a/src/components/agent/queued-messages.tsx b/src/components/agent/queued-messages.tsx
index 928360c..d858c16 100644
--- a/src/components/agent/queued-messages.tsx
+++ b/src/components/agent/queued-messages.tsx
@@ -2,16 +2,18 @@
import { useState } from "react";
import { CornerDownRight, Pencil, Trash2 } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import type { QueuedAgentMessagesProps } from "./types";
export function QueuedAgentMessages({ messages, running, onRemove, onEdit, onSteer }: QueuedAgentMessagesProps) {
+ const { t } = useLanguage();
const [editingId, setEditingId] = useState<string | null>(null);
const [editText, setEditText] = useState("");
if (!messages.length) return null;
- return <div className="mx-auto w-full max-w-3xl px-3" aria-label="Queued assistant messages"><div className="max-h-48 overflow-y-auto rounded-t-2xl border border-b-0 border-blue-100 bg-blue-50/70 px-2 py-1 shadow-sm">
+ return <div className="mx-auto w-full max-w-3xl px-3" aria-label={t("agent.queue.label")}><div className="max-h-48 overflow-y-auto rounded-t-2xl border border-b-0 border-blue-100 bg-blue-50/70 px-2 py-1 shadow-sm">
{messages.map((item) => <div key={item.id} className="flex min-w-0 items-center gap-2 rounded-xl px-2 py-2 text-sm text-neutral-700 hover:bg-white/70">
<CornerDownRight size={15} className="shrink-0 text-neutral-400" aria-hidden="true" />
- {editingId === item.id ? <form className="flex min-w-0 flex-1 items-center gap-2" onSubmit={(event) => { event.preventDefault(); if (!editText.trim()) return; onEdit(item.id, editText); setEditingId(null); }}><textarea autoFocus rows={2} className="min-w-0 flex-1 resize-y rounded-lg border border-blue-200 bg-white px-2 py-1 outline-none focus:border-blue-400" value={editText} onChange={(event) => setEditText(event.target.value)} aria-label="Edit queued message" /><button type="submit" className="shrink-0 font-medium text-blue-700" disabled={!editText.trim()}>Save</button><button type="button" className="shrink-0 text-neutral-500" onClick={() => setEditingId(null)}>Cancel</button></form> : <><span className="min-w-0 flex-1 truncate" title={item.text}>{item.text}</span><button type="button" className="shrink-0 rounded-lg px-2 py-1 text-neutral-500 hover:bg-blue-100 hover:text-blue-700" onClick={() => onSteer(item.id)} title={running ? "Stop the current response and send this message next" : "Send this queued message now"}>{running ? "Steer" : "Send now"}</button><button type="button" className="shrink-0 rounded-lg p-1.5 text-neutral-500 hover:bg-blue-100 hover:text-blue-700" aria-label="Edit queued message" title="Edit queued message" onClick={() => { setEditingId(item.id); setEditText(item.text); }}><Pencil size={15} /></button><button type="button" className="shrink-0 rounded-lg p-1.5 text-neutral-500 hover:bg-red-50 hover:text-red-600" aria-label="Remove queued message" title="Remove queued message" onClick={() => onRemove(item.id)}><Trash2 size={15} /></button></>}
+ {editingId === item.id ? <form className="flex min-w-0 flex-1 items-center gap-2" onSubmit={(event) => { event.preventDefault(); if (!editText.trim()) return; onEdit(item.id, editText); setEditingId(null); }}><textarea autoFocus rows={2} className="min-w-0 flex-1 resize-y rounded-lg border border-blue-200 bg-white px-2 py-1 outline-none focus:border-blue-400" value={editText} onChange={(event) => setEditText(event.target.value)} aria-label={t("agent.queue.edit")} /><button type="submit" className="shrink-0 font-medium text-blue-700" disabled={!editText.trim()}>{t("settings.autoReply.save")}</button><button type="button" className="shrink-0 text-neutral-500" onClick={() => setEditingId(null)}>{t("common.cancel")}</button></form> : <><span className="min-w-0 flex-1 truncate" title={item.text}>{item.text}</span><button type="button" className="shrink-0 rounded-lg px-2 py-1 text-neutral-500 hover:bg-blue-100 hover:text-blue-700" onClick={() => onSteer(item.id)} title={running ? t("agent.queue.steerTitle") : t("agent.queue.sendNowTitle")}>{running ? t("agent.queue.steer") : t("agent.queue.sendNow")}</button><button type="button" className="shrink-0 rounded-lg p-1.5 text-neutral-500 hover:bg-blue-100 hover:text-blue-700" aria-label={t("agent.queue.edit")} title={t("agent.queue.edit")} onClick={() => { setEditingId(item.id); setEditText(item.text); }}><Pencil size={15} /></button><button type="button" className="shrink-0 rounded-lg p-1.5 text-neutral-500 hover:bg-red-50 hover:text-red-600" aria-label={t("agent.queue.remove")} title={t("agent.queue.remove")} onClick={() => onRemove(item.id)}><Trash2 size={15} /></button></>}
</div>)}
</div></div>;
}
diff --git a/src/components/agent/send-review.tsx b/src/components/agent/send-review.tsx
index 44c482d..2ff9c3d 100644
--- a/src/components/agent/send-review.tsx
+++ b/src/components/agent/send-review.tsx
@@ -1,12 +1,14 @@
"use client";
import { useState } from "react";
+import { useLanguage } from "@/components/language-provider";
import { authFetch } from "@/lib/auth/client";
import { formatUserDate } from "@/lib/time/utils";
import { htmlToPlainText } from "@/components/compose/rich-text-utils";
import type { SendReviewProps } from "./send-review-types";
export function SendReview({ approvalId, snapshot, onClose, onSent }: SendReviewProps) {
+ const { t } = useLanguage();
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
async function confirm() {
@@ -15,30 +17,30 @@ export function SendReview({ approvalId, snapshot, onClose, onSent }: SendReview
try {
const response = await authFetch(`/api/agent/approvals/${approvalId}/confirm`, { method: "POST" });
const result = await response.json() as { status?: string; messageId?: string; error?: string };
- if (!response.ok || result.status !== "sent" || !result.messageId) throw new Error(result.error || "Delivery needs review");
+ if (!response.ok || result.status !== "sent" || !result.messageId) throw new Error(result.error || t("agent.review.deliveryNeedsReview"));
window.dispatchEvent(new Event("mailflare:messages-changed"));
onSent?.(result.messageId);
- } catch (cause) { setError(cause instanceof Error ? cause.message : "Could not send"); }
+ } catch (cause) { setError(cause instanceof Error ? cause.message : t("agent.review.couldNotSend")); }
finally { setBusy(false); }
}
- return <div className="fixed inset-0 z-[70] flex items-center justify-center bg-neutral-950/60 p-4" role="dialog" aria-modal="true" aria-label="Review email before sending">
+ return <div className="fixed inset-0 z-[70] flex items-center justify-center bg-neutral-950/60 p-4" role="dialog" aria-modal="true" aria-label={t("agent.review.dialog")}>
<div className="max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-xl bg-white p-5 shadow-2xl">
- <h2 className="text-lg font-semibold">{snapshot.scheduledAt ? "Review and schedule" : "Review and send"}</h2>
- <p className="mt-1 text-sm text-neutral-500">Confirm this exact AI draft before it is {snapshot.scheduledAt ? "scheduled" : "delivered"}.</p>
+ <h2 className="text-lg font-semibold">{snapshot.scheduledAt ? t("agent.review.reviewSchedule") : t("agent.review.reviewSend")}</h2>
+ <p className="mt-1 text-sm text-neutral-500">{snapshot.scheduledAt ? t("agent.review.confirmScheduled") : t("agent.review.confirmDelivered")}</p>
<dl className="mt-4 grid grid-cols-[5rem_1fr] gap-2 text-sm break-words">
- <dt className="text-neutral-500">From</dt><dd>{snapshot.from}</dd>
- <dt className="text-neutral-500">To</dt><dd>{snapshot.to}</dd>
- {snapshot.cc && <><dt className="text-neutral-500">Cc</dt><dd>{snapshot.cc}</dd></>}
- {snapshot.bcc && <><dt className="text-neutral-500">Bcc</dt><dd>{snapshot.bcc}</dd></>}
- <dt className="text-neutral-500">Subject</dt><dd>{snapshot.subject}</dd>
- {snapshot.scheduledAt && <><dt className="text-neutral-500">Send at</dt><dd>{formatUserDate(snapshot.scheduledAt, { dateStyle: "medium", timeStyle: "short" })}</dd></>}
+ <dt className="text-neutral-500">{t("agent.review.from")}</dt><dd>{snapshot.from}</dd>
+ <dt className="text-neutral-500">{t("agent.review.to")}</dt><dd>{snapshot.to}</dd>
+ {snapshot.cc && <><dt className="text-neutral-500">{t("agent.review.cc")}</dt><dd>{snapshot.cc}</dd></>}
+ {snapshot.bcc && <><dt className="text-neutral-500">{t("agent.review.bcc")}</dt><dd>{snapshot.bcc}</dd></>}
+ <dt className="text-neutral-500">{t("agent.review.subject")}</dt><dd>{snapshot.subject}</dd>
+ {snapshot.scheduledAt && <><dt className="text-neutral-500">{t("agent.review.sendAt")}</dt><dd>{formatUserDate(snapshot.scheduledAt, { dateStyle: "medium", timeStyle: "short" })}</dd></>}
</dl>
<pre className="mt-4 max-h-72 overflow-auto whitespace-pre-wrap rounded-lg border border-neutral-200 p-3 text-sm">{snapshot.text || htmlToPlainText(snapshot.html || "")}</pre>
- {snapshot.attachments.length > 0 && <p className="mt-3 text-sm">Attachments: {snapshot.attachments.map((item) => item.filename).join(", ")}</p>}
+ {snapshot.attachments.length > 0 && <p className="mt-3 text-sm">{t("agent.review.attachments", { list: snapshot.attachments.map((item) => item.filename).join(", ") })}</p>}
{error && <p className="mt-3 text-sm text-red-600">{error}</p>}
<div className="mt-5 flex justify-end gap-3">
- {onClose && <button type="button" className="rounded-lg border px-4 py-2" onClick={onClose} disabled={busy}>Cancel</button>}
- <button type="button" className="rounded-lg bg-blue-600 px-4 py-2 font-medium text-white disabled:opacity-50" onClick={() => void confirm()} disabled={busy}>{busy ? snapshot.scheduledAt ? "Scheduling…" : "Sending…" : snapshot.scheduledAt ? "Confirm and schedule" : "Confirm and send"}</button>
+ {onClose && <button type="button" className="rounded-lg border px-4 py-2" onClick={onClose} disabled={busy}>{t("common.cancel")}</button>}
+ <button type="button" className="rounded-lg bg-blue-600 px-4 py-2 font-medium text-white disabled:opacity-50" onClick={() => void confirm()} disabled={busy}>{busy ? snapshot.scheduledAt ? t("agent.review.scheduling") : t("agent.review.sending") : snapshot.scheduledAt ? t("agent.review.confirmSchedule") : t("agent.review.confirmSend")}</button>
</div>
</div>
</div>;
diff --git a/src/components/agent/tool-activity.tsx b/src/components/agent/tool-activity.tsx
index b3c8e41..dec9063 100644
--- a/src/components/agent/tool-activity.tsx
+++ b/src/components/agent/tool-activity.tsx
@@ -2,6 +2,7 @@
import { useState } from "react";
import { ChevronLeft, Wrench } from "lucide-react";
+import { useLanguage } from "@/components/language-provider";
import type { AgentDraftAction, AgentEmailReference, AgentMessage, AgentTurnProps } from "./types";
import { agentActionProposal, agentToolLabel, draftFromToolContent, parseAgentToolContent } from "./utils";
import { AgentEmailLink } from "./email-link";
@@ -13,13 +14,14 @@ function emailReferences(value: Record<string, unknown>): AgentEmailReference[]
}
export function AgentToolActivity({ item, forceOpen }: { item: AgentMessage; forceOpen: boolean }) {
+ const { t } = useLanguage();
const [open, setOpen] = useState(forceOpen);
const [prevForceOpen, setPrevForceOpen] = useState(forceOpen);
if (forceOpen !== prevForceOpen) {
setPrevForceOpen(forceOpen);
setOpen(forceOpen);
}
- const display = agentToolLabel(item.toolName, item.toolState, item.content);
+ const display = agentToolLabel(item.toolName, item.toolState, item.content, t);
const result = parseAgentToolContent(item.content);
const emails = result ? emailReferences(result) : [];
return <details className="group/tool text-xs text-neutral-600" open={forceOpen || open} onToggle={(event) => { if (!forceOpen) setOpen(event.currentTarget.open); }}>
@@ -33,26 +35,28 @@ export function AgentToolActivity({ item, forceOpen }: { item: AgentMessage; for
{emails.length > 0 && <ul className="space-y-1.5">{emails.map((email) => <li key={email.id} className="break-words"><AgentEmailLink email={email} className="font-medium text-blue-700 hover:underline" />{email.from && <span className="text-neutral-500"> · {email.from}</span>}{email.snippet && <p className="line-clamp-2 text-neutral-500">{email.snippet}</p>}</li>)}</ul>}
{result && Object.entries(result).filter(([key, value]) => !["emails", "text", "attachments", "result", "id", "subject", "from", "snippet", "url", "reviewUrl", "action", "status"].includes(key) && value !== null && typeof value !== "object").map(([key, value]) => <p key={key} className="break-words"><span className="text-neutral-400">{key.replace(/([A-Z])/g, " $1")}: </span>{String(value)}</p>)}
{typeof result?.text === "string" && <p className="max-h-36 overflow-y-auto whitespace-pre-wrap break-words">{result.text}</p>}
- {Array.isArray(result?.attachments) && result.attachments.length > 0 && <p>Attachments: {result.attachments.map((file: { filename?: string }) => file.filename || "attachment").join(", ")}</p>}
+ {Array.isArray(result?.attachments) && result.attachments.length > 0 && <p>{t("agent.activity.attachments", { list: result.attachments.map((file: { filename?: string }) => file.filename || t("agent.activity.attachment")).join(", ") })}</p>}
{!result && item.content && <p className="whitespace-pre-wrap break-words">{item.content}</p>}
</div>
</details>;
}
export function AgentDraftActions({ action, onOpenDraft, onApproveDraft, approvingId }: { action: AgentDraftAction } & Pick<AgentTurnProps, "onOpenDraft" | "onApproveDraft" | "approvingId">) {
+ const { t } = useLanguage();
return <div className="flex flex-wrap items-center justify-end gap-3 text-xs">
- <button type="button" onClick={() => onOpenDraft(action.draftId)} className="text-blue-700 hover:underline">Edit draft</button>
- <button type="button" className="rounded-lg bg-blue-600 px-3 py-2 font-medium text-white disabled:opacity-50" disabled={approvingId === action.draftId} onClick={() => onApproveDraft(action.draftId, action.revision)}>{action.scheduledAt ? "Schedule" : "Approve to send"}</button>
+ <button type="button" onClick={() => onOpenDraft(action.draftId)} className="text-blue-700 hover:underline">{t("agent.activity.editDraft")}</button>
+ <button type="button" className="rounded-lg bg-blue-600 px-3 py-2 font-medium text-white disabled:opacity-50" disabled={approvingId === action.draftId} onClick={() => onApproveDraft(action.draftId, action.revision)}>{action.scheduledAt ? t("agent.activity.schedule") : t("agent.activity.approveSend")}</button>
</div>;
}
export function AgentPendingActions({ item, onApproveAction, approvingId }: Pick<AgentTurnProps, "onApproveAction" | "approvingId"> & { item: AgentMessage }) {
+ const { t } = useLanguage();
const proposal = agentActionProposal(item.content);
if (proposal?.status !== "pending_approval" || draftFromToolContent(item.content)) return null;
return <div className="space-y-2 text-xs">
{proposal.emails && <ul className="space-y-1">{proposal.emails.map((email) => <li key={email.id}><AgentEmailLink email={email} className="text-blue-700 hover:underline" /></li>)}</ul>}
<div className="flex flex-wrap items-center justify-end gap-3">
- <button type="button" className="rounded-lg bg-blue-600 px-3 py-2 font-medium text-white disabled:opacity-50" disabled={!item.recordId || approvingId === item.id} onClick={() => onApproveAction(item)}>{approvingId === item.id ? "Approving…" : proposal.action === "discard_draft" ? "Approve discard" : proposal.action === "mark_email_read" ? "Approve status change" : `Approve move to ${proposal.destination}`}</button>
+ <button type="button" className="rounded-lg bg-blue-600 px-3 py-2 font-medium text-white disabled:opacity-50" disabled={!item.recordId || approvingId === item.id} onClick={() => onApproveAction(item)}>{approvingId === item.id ? t("agent.activity.approving") : proposal.action === "discard_draft" ? t("agent.activity.approveDiscard") : proposal.action === "mark_email_read" ? t("agent.activity.approveStatus") : t("agent.activity.approveMove", { destination: proposal.destination })}</button>
</div>
</div>;
}
diff --git a/src/components/agent/utils.ts b/src/components/agent/utils.ts
index ed97fae..014761e 100644
--- a/src/components/agent/utils.ts
+++ b/src/components/agent/utils.ts
@@ -1,3 +1,4 @@
+import { defaultTranslator, type Translator } from "@/lib/i18n/utils";
import type { KeyboardEvent } from "react";
import type { AgentActionProposal, AgentDraftAction, AgentEmailReference, AgentEvent, AgentMessage, AgentTurn, QueuedAgentMessage } from "./types";
@@ -154,26 +155,16 @@ export function formatAgentDuration(durationMs: number): string {
return `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, "0")}s`;
}
-export const AGENT_TOOL_LABELS: Record<string, { running: string; completed: string; description: string }> = {
- list_emails: { running: "Listing emails...", completed: "Listed emails", description: "Listed email in the selected mailbox folder." },
- get_email: { running: "Reading email...", completed: "Read email", description: "Read an email and its attachment details." },
- get_thread: { running: "Reading thread...", completed: "Read thread", description: "Read the conversation containing an email." },
- search_emails: { running: "Searching emails...", completed: "Searched email", description: "Searched email subjects and bodies in this mailbox." },
- draft_email: { running: "Drafting email...", completed: "Drafted email", description: "Saved a new email draft for review. No email was sent." },
- draft_reply: { running: "Drafting reply...", completed: "Drafted reply", description: "Saved a reply draft for review. No email was sent." },
- mark_email_read: { running: "Preparing read status...", completed: "Prepared read status", description: "Prepared an email read status change for approval." },
- move_email: { running: "Preparing email move...", completed: "Prepared email move", description: "Prepared an email move for approval." },
- move_emails: { running: "Preparing email moves...", completed: "Prepared email moves", description: "Prepared email moves for approval." },
- discard_draft: { running: "Preparing draft removal...", completed: "Prepared draft removal", description: "Prepared an assistant draft removal for approval." },
- get_schedule: { running: "Getting schedule...", completed: "Got schedule", description: "Read calendar events in the requested range." },
- search_events: { running: "Searching events...", completed: "Searched events", description: "Searched calendar events." },
- get_event: { running: "Reading event...", completed: "Read event", description: "Read a calendar event." },
- create_event: { running: "Creating event...", completed: "Created event", description: "Created a calendar event." },
- update_events: { running: "Updating events...", completed: "Updated events", description: "Updated calendar events." },
- delete_events: { running: "Deleting events...", completed: "Deleted events", description: "Deleted calendar events." },
- find_free_time: { running: "Finding free time...", completed: "Found free time", description: "Checked calendar availability." },
- get_calendars: { running: "Getting calendars...", completed: "Got calendars", description: "Listed available calendars." },
-};
+export const AGENT_TOOL_NAMES = [
+ "list_emails", "get_email", "get_thread", "search_emails", "draft_email", "draft_reply", "mark_email_read", "move_email", "move_emails",
+ "discard_draft", "get_schedule", "search_events", "get_event", "create_event", "update_events", "delete_events", "find_free_time", "get_calendars",
+] as const;
+
+type AgentToolName = typeof AGENT_TOOL_NAMES[number];
+
+function agentToolText(name: string | null | undefined, part: "running" | "completed" | "description", t: Translator): string | null {
+ return (AGENT_TOOL_NAMES as readonly string[]).includes(name ?? "") ? t(`agent.tool.${name as AgentToolName}.${part}`) : null;
+}
export function activeAgentTool(messages: AgentMessage[]): AgentMessage | null {
for (let index = messages.length - 1; index >= 0; index--) {
@@ -184,8 +175,8 @@ export function activeAgentTool(messages: AgentMessage[]): AgentMessage | null {
return null;
}
-export function activeAgentToolLabel(name: string | null | undefined): string {
- return AGENT_TOOL_LABELS[name ?? ""]?.running ?? "Using tool...";
+export function activeAgentToolLabel(name: string | null | undefined, t: Translator = defaultTranslator): string {
+ return agentToolText(name, "running", t) ?? t("agent.tool.using");
}
export function agentEmailHref(email: Pick<AgentEmailReference, "id" | "status" | "url">): string {
@@ -216,15 +207,15 @@ export function agentActionProposal(content: string): AgentActionProposal | null
return value && (value.action === "move_email" || value.action === "move_emails" || value.action === "mark_email_read" || value.action === "discard_draft") && (value.status === "pending_approval" || value.status === "processing" || value.status === "approved") ? value as AgentActionProposal : null;
}
-export function agentToolLabel(name: string | null | undefined, state: AgentMessage["toolState"], content: string): { label: string; description: string } {
+export function agentToolLabel(name: string | null | undefined, state: AgentMessage["toolState"], content: string, t: Translator = defaultTranslator): { label: string; description: string } {
const fallback = (name ?? "Tool").replace(/_/g, " ");
- const display = AGENT_TOOL_LABELS[name ?? ""];
- if (!display) return { label: fallback.charAt(0).toUpperCase() + fallback.slice(1), description: "Used an email tool." };
- if (state === "running") return { label: display.running, description: display.description };
+ const description = agentToolText(name, "description", t);
+ if (description === null) return { label: fallback.charAt(0).toUpperCase() + fallback.slice(1), description: t("agent.tool.fallbackDescription") };
+ if (state === "running") return { label: agentToolText(name, "running", t)!, description };
const result = parseAgentToolContent(content);
const emails = Array.isArray(result?.emails) ? result.emails.length : typeof result?.id === "string" || typeof result?.emailId === "string" ? 1 : null;
- if ((name === "search_emails" || name === "list_emails") && emails !== null) return { label: `${name === "search_emails" ? "Searched" : "Listed"} ${emails} ${emails === 1 ? "email" : "emails"}`, description: display.description };
- if (name === "get_thread" && emails !== null) return { label: `Read ${emails} ${emails === 1 ? "email" : "emails"} in thread`, description: display.description };
- if ((name === "move_emails" || name === "move_email") && emails !== null) return { label: `${result?.status === "approved" ? "Moved" : "Prepared"} ${emails} ${emails === 1 ? "email" : "emails"}${result?.status === "approved" ? "" : " for review"}`, description: display.description };
- return { label: display.completed, description: display.description };
+ if ((name === "search_emails" || name === "list_emails") && emails !== null) return { label: t(name === "search_emails" ? "agent.tool.searchedCount" : "agent.tool.listedCount", { count: emails }), description };
+ if (name === "get_thread" && emails !== null) return { label: t("agent.tool.threadCount", { count: emails }), description };
+ if ((name === "move_emails" || name === "move_email") && emails !== null) return { label: t(result?.status === "approved" ? "agent.tool.movedCount" : "agent.tool.preparedCount", { count: emails }), description };
+ return { label: agentToolText(name, "completed", t)!, description };
}
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index f943b26..0561199 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -1662,5 +1662,168 @@
"public.loadingAvailability": "Loading availability",
"public.loadingAvailabilityEllipsis": "Loading availability…",
"public.loadingMeetings": "Loading meetings",
- "public.loadingMeetingsEllipsis": "Loading meetings…"
+ "public.loadingMeetingsEllipsis": "Loading meetings…",
+ "agent.tool.list_emails.running": "Listing emails...",
+ "agent.tool.list_emails.completed": "Listed emails",
+ "agent.tool.list_emails.description": "Listed email in the selected mailbox folder.",
+ "agent.tool.get_email.running": "Reading email...",
+ "agent.tool.get_email.completed": "Read email",
+ "agent.tool.get_email.description": "Read an email and its attachment details.",
+ "agent.tool.get_thread.running": "Reading thread...",
+ "agent.tool.get_thread.completed": "Read thread",
+ "agent.tool.get_thread.description": "Read the conversation containing an email.",
+ "agent.tool.search_emails.running": "Searching emails...",
+ "agent.tool.search_emails.completed": "Searched email",
+ "agent.tool.search_emails.description": "Searched email subjects and bodies in this mailbox.",
+ "agent.tool.draft_email.running": "Drafting email...",
+ "agent.tool.draft_email.completed": "Drafted email",
+ "agent.tool.draft_email.description": "Saved a new email draft for review. No email was sent.",
+ "agent.tool.draft_reply.running": "Drafting reply...",
+ "agent.tool.draft_reply.completed": "Drafted reply",
+ "agent.tool.draft_reply.description": "Saved a reply draft for review. No email was sent.",
+ "agent.tool.mark_email_read.running": "Preparing read status...",
+ "agent.tool.mark_email_read.completed": "Prepared read status",
+ "agent.tool.mark_email_read.description": "Prepared an email read status change for approval.",
+ "agent.tool.move_email.running": "Preparing email move...",
+ "agent.tool.move_email.completed": "Prepared email move",
+ "agent.tool.move_email.description": "Prepared an email move for approval.",
+ "agent.tool.move_emails.running": "Preparing email moves...",
+ "agent.tool.move_emails.completed": "Prepared email moves",
+ "agent.tool.move_emails.description": "Prepared email moves for approval.",
+ "agent.tool.discard_draft.running": "Preparing draft removal...",
+ "agent.tool.discard_draft.completed": "Prepared draft removal",
+ "agent.tool.discard_draft.description": "Prepared an assistant draft removal for approval.",
+ "agent.tool.get_schedule.running": "Getting schedule...",
+ "agent.tool.get_schedule.completed": "Got schedule",
+ "agent.tool.get_schedule.description": "Read calendar events in the requested range.",
+ "agent.tool.search_events.running": "Searching events...",
+ "agent.tool.search_events.completed": "Searched events",
+ "agent.tool.search_events.description": "Searched calendar events.",
+ "agent.tool.get_event.running": "Reading event...",
+ "agent.tool.get_event.completed": "Read event",
+ "agent.tool.get_event.description": "Read a calendar event.",
+ "agent.tool.create_event.running": "Creating event...",
+ "agent.tool.create_event.completed": "Created event",
+ "agent.tool.create_event.description": "Created a calendar event.",
+ "agent.tool.update_events.running": "Updating events...",
+ "agent.tool.update_events.completed": "Updated events",
+ "agent.tool.update_events.description": "Updated calendar events.",
+ "agent.tool.delete_events.running": "Deleting events...",
+ "agent.tool.delete_events.completed": "Deleted events",
+ "agent.tool.delete_events.description": "Deleted calendar events.",
+ "agent.tool.find_free_time.running": "Finding free time...",
+ "agent.tool.find_free_time.completed": "Found free time",
+ "agent.tool.find_free_time.description": "Checked calendar availability.",
+ "agent.tool.get_calendars.running": "Getting calendars...",
+ "agent.tool.get_calendars.completed": "Got calendars",
+ "agent.tool.get_calendars.description": "Listed available calendars.",
+ "agent.tool.fallbackDescription": "Used an email tool.",
+ "agent.tool.using": "Using tool...",
+ "agent.tool.searchedCount.one": "Searched {count} email",
+ "agent.tool.searchedCount.other": "Searched {count} emails",
+ "agent.tool.listedCount.one": "Listed {count} email",
+ "agent.tool.listedCount.other": "Listed {count} emails",
+ "agent.tool.threadCount.one": "Read {count} email in thread",
+ "agent.tool.threadCount.other": "Read {count} emails in thread",
+ "agent.tool.movedCount.one": "Moved {count} email",
+ "agent.tool.movedCount.other": "Moved {count} emails",
+ "agent.tool.preparedCount.one": "Prepared {count} email for review",
+ "agent.tool.preparedCount.other": "Prepared {count} emails for review",
+ "agent.welcome.sumThis": "Summarize this email",
+ "agent.welcome.sumThisDetail": "Get the key points",
+ "agent.welcome.reply": "Suggest a reply",
+ "agent.welcome.replyDetail": "Create a draft for review",
+ "agent.welcome.actionsThis": "List action items",
+ "agent.welcome.actionsThisDetail": "Find next steps in this email",
+ "agent.welcome.sumRecent": "Summarize recent mail",
+ "agent.welcome.sumRecentDetail": "Catch up on your inbox",
+ "agent.welcome.actions": "Find action items",
+ "agent.welcome.actionsDetail": "See what needs attention",
+ "agent.panel.settingsLoadFailed": "Could not load assistant settings",
+ "agent.panel.conversationLoadFailed": "Could not load conversation",
+ "agent.panel.conversationDeleteFailed": "Could not delete conversation",
+ "agent.panel.unavailable": "Assistant unavailable",
+ "agent.panel.failed": "Assistant failed",
+ "agent.panel.saveFailed": "Could not save settings",
+ "agent.panel.retryFailed": "Could not retry draft",
+ "agent.panel.discardFailed": "Could not discard draft",
+ "agent.panel.reviewFailed": "Could not open draft review",
+ "agent.panel.approveFailed": "Could not approve action",
+ "agent.panel.label": "Email assistant",
+ "agent.panel.backToAssistant": "Back to assistant",
+ "agent.panel.settings": "Settings",
+ "agent.panel.assistant": "Assistant",
+ "agent.panel.menuLabel": "Assistant conversations and settings",
+ "agent.panel.newChat": "New chat",
+ "agent.panel.previousChats": "Previous chats",
+ "agent.panel.deleteChatLabel": "Delete {title}",
+ "agent.panel.deleteChat": "Delete chat",
+ "agent.panel.noChats": "No previous chats",
+ "agent.panel.backToChat": "Back to chat",
+ "agent.panel.exitFull": "Exit full size assistant",
+ "agent.panel.expandFull": "Expand assistant to full size",
+ "agent.panel.exitFullTitle": "Exit full size",
+ "agent.panel.fullTitle": "Full size",
+ "agent.panel.close": "Close assistant",
+ "agent.panel.configureProvider": "Configure an AI provider to use chat and auto-drafts.",
+ "agent.panel.welcome": "How can I help you today?",
+ "agent.panel.autoDraftReady": "Auto-draft ready",
+ "agent.panel.openDraft": "Open draft",
+ "agent.panel.regenerate": "Regenerate",
+ "agent.panel.discard": "Discard",
+ "agent.panel.working": "Working...",
+ "agent.panel.promptPlaceholder": "Enter a prompt here",
+ "agent.panel.stop": "Stop response",
+ "agent.panel.send": "Send message",
+ "agent.panel.needPermission": "Mailbox management permission is required to change these settings.",
+ "agent.panel.reviewer": "Draft reviewer",
+ "agent.panel.model": "Model",
+ "agent.panel.noModels": "No models configured",
+ "agent.panel.autoDraft": "Automatically draft replies",
+ "agent.panel.disableOoo": "Disable out-of-office auto-replies to enable AI drafts.",
+ "agent.panel.instructions": "Writing instructions",
+ "agent.panel.dailyLimit": "Daily auto-draft limit",
+ "agent.panel.save": "Save settings",
+ "agent.panel.privacy": "Selected email and thread content is sent to the configured AI provider when you use chat or auto-drafts. Drafts always need your confirmation before sending.",
+ "agent.panel.retry": "Retry",
+ "agent.review.dialog": "Review email before sending",
+ "agent.review.reviewSchedule": "Review and schedule",
+ "agent.review.reviewSend": "Review and send",
+ "agent.review.confirmScheduled": "Confirm this exact AI draft before it is scheduled.",
+ "agent.review.confirmDelivered": "Confirm this exact AI draft before it is delivered.",
+ "agent.review.from": "From",
+ "agent.review.to": "To",
+ "agent.review.cc": "Cc",
+ "agent.review.bcc": "Bcc",
+ "agent.review.subject": "Subject",
+ "agent.review.sendAt": "Send at",
+ "agent.review.attachments": "Attachments: {list}",
+ "agent.review.deliveryNeedsReview": "Delivery needs review",
+ "agent.review.couldNotSend": "Could not send",
+ "agent.review.scheduling": "Scheduling…",
+ "agent.review.sending": "Sending…",
+ "agent.review.confirmSchedule": "Confirm and schedule",
+ "agent.review.confirmSend": "Confirm and send",
+ "agent.turn.waiting": "Waiting for the model...",
+ "agent.turn.noDetails": "No tool details were provided.",
+ "agent.turn.workedFor": "Worked for {duration}",
+ "agent.turn.workDetails": "Work details",
+ "agent.activity.attachments": "Attachments: {list}",
+ "agent.activity.attachment": "attachment",
+ "agent.activity.editDraft": "Edit draft",
+ "agent.activity.schedule": "Schedule",
+ "agent.activity.approveSend": "Approve to send",
+ "agent.activity.approving": "Approving…",
+ "agent.activity.approveDiscard": "Approve discard",
+ "agent.activity.approveStatus": "Approve status change",
+ "agent.activity.approveMove": "Approve move to {destination}",
+ "agent.queue.label": "Queued assistant messages",
+ "agent.queue.edit": "Edit queued message",
+ "agent.queue.steerTitle": "Stop the current response and send this message next",
+ "agent.queue.sendNowTitle": "Send this queued message now",
+ "agent.queue.steer": "Steer",
+ "agent.queue.sendNow": "Send now",
+ "agent.queue.remove": "Remove queued message",
+ "agent.loadingConversation": "Loading conversation",
+ "agent.duration.lessThanSecond": "<1s"
}
diff --git a/src/lib/i18n/pt-BR.json b/src/lib/i18n/pt-BR.json
index fe20633..936871a 100644
--- a/src/lib/i18n/pt-BR.json
+++ b/src/lib/i18n/pt-BR.json
@@ -1662,5 +1662,168 @@
"public.loadingAvailability": "Carregando disponibilidade",
"public.loadingAvailabilityEllipsis": "Carregando disponibilidade…",
"public.loadingMeetings": "Carregando reuniões",
- "public.loadingMeetingsEllipsis": "Carregando reuniões…"
+ "public.loadingMeetingsEllipsis": "Carregando reuniões…",
+ "agent.tool.list_emails.running": "Listando e-mails...",
+ "agent.tool.list_emails.completed": "E-mails listados",
+ "agent.tool.list_emails.description": "Listou e-mails da pasta da caixa de correio selecionada.",
+ "agent.tool.get_email.running": "Lendo e-mail...",
+ "agent.tool.get_email.completed": "E-mail lido",
+ "agent.tool.get_email.description": "Leu um e-mail e os detalhes dos anexos.",
+ "agent.tool.get_thread.running": "Lendo conversa...",
+ "agent.tool.get_thread.completed": "Conversa lida",
+ "agent.tool.get_thread.description": "Leu a conversa que contém um e-mail.",
+ "agent.tool.search_emails.running": "Pesquisando e-mails...",
+ "agent.tool.search_emails.completed": "E-mails pesquisados",
+ "agent.tool.search_emails.description": "Pesquisou assuntos e corpos de e-mails nesta caixa de correio.",
+ "agent.tool.draft_email.running": "Redigindo e-mail...",
+ "agent.tool.draft_email.completed": "E-mail redigido",
+ "agent.tool.draft_email.description": "Salvou um novo rascunho de e-mail para revisão. Nenhum e-mail foi enviado.",
+ "agent.tool.draft_reply.running": "Redigindo resposta...",
+ "agent.tool.draft_reply.completed": "Resposta redigida",
+ "agent.tool.draft_reply.description": "Salvou um rascunho de resposta para revisão. Nenhum e-mail foi enviado.",
+ "agent.tool.mark_email_read.running": "Preparando status de leitura...",
+ "agent.tool.mark_email_read.completed": "Status de leitura preparado",
+ "agent.tool.mark_email_read.description": "Preparou uma alteração do status de leitura de um e-mail para aprovação.",
+ "agent.tool.move_email.running": "Preparando a movimentação do e-mail...",
+ "agent.tool.move_email.completed": "Movimentação de e-mail preparada",
+ "agent.tool.move_email.description": "Preparou a movimentação de um e-mail para aprovação.",
+ "agent.tool.move_emails.running": "Preparando as movimentações de e-mails...",
+ "agent.tool.move_emails.completed": "Movimentações de e-mails preparadas",
+ "agent.tool.move_emails.description": "Preparou movimentações de e-mails para aprovação.",
+ "agent.tool.discard_draft.running": "Preparando a remoção do rascunho...",
+ "agent.tool.discard_draft.completed": "Remoção de rascunho preparada",
+ "agent.tool.discard_draft.description": "Preparou a remoção de um rascunho do assistente para aprovação.",
+ "agent.tool.get_schedule.running": "Obtendo agenda...",
+ "agent.tool.get_schedule.completed": "Agenda obtida",
+ "agent.tool.get_schedule.description": "Leu eventos do calendário no período solicitado.",
+ "agent.tool.search_events.running": "Pesquisando eventos...",
+ "agent.tool.search_events.completed": "Eventos pesquisados",
+ "agent.tool.search_events.description": "Pesquisou eventos do calendário.",
+ "agent.tool.get_event.running": "Lendo evento...",
+ "agent.tool.get_event.completed": "Evento lido",
+ "agent.tool.get_event.description": "Leu um evento do calendário.",
+ "agent.tool.create_event.running": "Criando evento...",
+ "agent.tool.create_event.completed": "Evento criado",
+ "agent.tool.create_event.description": "Criou um evento no calendário.",
+ "agent.tool.update_events.running": "Atualizando eventos...",
+ "agent.tool.update_events.completed": "Eventos atualizados",
+ "agent.tool.update_events.description": "Atualizou eventos do calendário.",
+ "agent.tool.delete_events.running": "Excluindo eventos...",
+ "agent.tool.delete_events.completed": "Eventos excluídos",
+ "agent.tool.delete_events.description": "Excluiu eventos do calendário.",
+ "agent.tool.find_free_time.running": "Procurando horários livres...",
+ "agent.tool.find_free_time.completed": "Horários livres encontrados",
+ "agent.tool.find_free_time.description": "Verificou a disponibilidade do calendário.",
+ "agent.tool.get_calendars.running": "Obtendo calendários...",
+ "agent.tool.get_calendars.completed": "Calendários obtidos",
+ "agent.tool.get_calendars.description": "Listou os calendários disponíveis.",
+ "agent.tool.fallbackDescription": "Usou uma ferramenta de e-mail.",
+ "agent.tool.using": "Usando ferramenta...",
+ "agent.tool.searchedCount.one": "Pesquisou {count} e-mail",
+ "agent.tool.searchedCount.other": "Pesquisou {count} e-mails",
+ "agent.tool.listedCount.one": "Listou {count} e-mail",
+ "agent.tool.listedCount.other": "Listou {count} e-mails",
+ "agent.tool.threadCount.one": "Leu {count} e-mail na conversa",
+ "agent.tool.threadCount.other": "Leu {count} e-mails na conversa",
+ "agent.tool.movedCount.one": "Moveu {count} e-mail",
+ "agent.tool.movedCount.other": "Moveu {count} e-mails",
+ "agent.tool.preparedCount.one": "Preparou {count} e-mail para revisão",
+ "agent.tool.preparedCount.other": "Preparou {count} e-mails para revisão",
+ "agent.welcome.sumThis": "Resumir este e-mail",
+ "agent.welcome.sumThisDetail": "Obtenha os pontos principais",
+ "agent.welcome.reply": "Sugerir uma resposta",
+ "agent.welcome.replyDetail": "Crie um rascunho para revisão",
+ "agent.welcome.actionsThis": "Listar itens de ação",
+ "agent.welcome.actionsThisDetail": "Encontre os próximos passos neste e-mail",
+ "agent.welcome.sumRecent": "Resumir e-mails recentes",
+ "agent.welcome.sumRecentDetail": "Coloque sua caixa de entrada em dia",
+ "agent.welcome.actions": "Encontrar itens de ação",
+ "agent.welcome.actionsDetail": "Veja o que precisa de atenção",
+ "agent.panel.settingsLoadFailed": "Não foi possível carregar as configurações do assistente",
+ "agent.panel.conversationLoadFailed": "Não foi possível carregar a conversa",
+ "agent.panel.conversationDeleteFailed": "Não foi possível excluir a conversa",
+ "agent.panel.unavailable": "Assistente indisponível",
+ "agent.panel.failed": "Falha do assistente",
+ "agent.panel.saveFailed": "Não foi possível salvar as configurações",
+ "agent.panel.retryFailed": "Não foi possível tentar o rascunho novamente",
+ "agent.panel.discardFailed": "Não foi possível descartar o rascunho",
+ "agent.panel.reviewFailed": "Não foi possível abrir a revisão do rascunho",
+ "agent.panel.approveFailed": "Não foi possível aprovar a ação",
+ "agent.panel.label": "Assistente de e-mail",
+ "agent.panel.backToAssistant": "Voltar ao assistente",
+ "agent.panel.settings": "Configurações",
+ "agent.panel.assistant": "Assistente",
+ "agent.panel.menuLabel": "Conversas e configurações do assistente",
+ "agent.panel.newChat": "Nova conversa",
+ "agent.panel.previousChats": "Conversas anteriores",
+ "agent.panel.deleteChatLabel": "Excluir {title}",
+ "agent.panel.deleteChat": "Excluir conversa",
+ "agent.panel.noChats": "Nenhuma conversa anterior",
+ "agent.panel.backToChat": "Voltar à conversa",
+ "agent.panel.exitFull": "Sair do assistente em tamanho total",
+ "agent.panel.expandFull": "Expandir o assistente para tamanho total",
+ "agent.panel.exitFullTitle": "Sair do tamanho total",
+ "agent.panel.fullTitle": "Tamanho total",
+ "agent.panel.close": "Fechar assistente",
+ "agent.panel.configureProvider": "Configure um provedor de IA para usar o chat e os rascunhos automáticos.",
+ "agent.panel.welcome": "Como posso ajudar você hoje?",
+ "agent.panel.autoDraftReady": "Rascunho automático pronto",
+ "agent.panel.openDraft": "Abrir rascunho",
+ "agent.panel.regenerate": "Gerar novamente",
+ "agent.panel.discard": "Descartar",
+ "agent.panel.working": "Trabalhando...",
+ "agent.panel.promptPlaceholder": "Digite uma mensagem aqui",
+ "agent.panel.stop": "Parar resposta",
+ "agent.panel.send": "Enviar mensagem",
+ "agent.panel.needPermission": "É necessária permissão de gerenciamento da caixa de correio para alterar estas configurações.",
+ "agent.panel.reviewer": "Revisor de rascunhos",
+ "agent.panel.model": "Modelo",
+ "agent.panel.noModels": "Nenhum modelo configurado",
+ "agent.panel.autoDraft": "Redigir respostas automaticamente",
+ "agent.panel.disableOoo": "Desative as respostas automáticas de ausência para ativar os rascunhos de IA.",
+ "agent.panel.instructions": "Instruções de escrita",
+ "agent.panel.dailyLimit": "Limite diário de rascunhos automáticos",
+ "agent.panel.save": "Salvar configurações",
+ "agent.panel.privacy": "O conteúdo do e-mail e da conversa selecionados é enviado ao provedor de IA configurado quando você usa o chat ou os rascunhos automáticos. Os rascunhos sempre precisam da sua confirmação antes do envio.",
+ "agent.panel.retry": "Tentar novamente",
+ "agent.review.dialog": "Revisar o e-mail antes de enviar",
+ "agent.review.reviewSchedule": "Revisar e agendar",
+ "agent.review.reviewSend": "Revisar e enviar",
+ "agent.review.confirmScheduled": "Confirme exatamente este rascunho de IA antes de ele ser agendado.",
+ "agent.review.confirmDelivered": "Confirme exatamente este rascunho de IA antes de ele ser entregue.",
+ "agent.review.from": "De",
+ "agent.review.to": "Para",
+ "agent.review.cc": "Cc",
+ "agent.review.bcc": "Cco",
+ "agent.review.subject": "Assunto",
+ "agent.review.sendAt": "Enviar em",
+ "agent.review.attachments": "Anexos: {list}",
+ "agent.review.deliveryNeedsReview": "A entrega precisa de revisão",
+ "agent.review.couldNotSend": "Não foi possível enviar",
+ "agent.review.scheduling": "Agendando…",
+ "agent.review.sending": "Enviando…",
+ "agent.review.confirmSchedule": "Confirmar e agendar",
+ "agent.review.confirmSend": "Confirmar e enviar",
+ "agent.turn.waiting": "Aguardando o modelo...",
+ "agent.turn.noDetails": "Nenhum detalhe da ferramenta foi fornecido.",
+ "agent.turn.workedFor": "Trabalhou por {duration}",
+ "agent.turn.workDetails": "Detalhes do trabalho",
+ "agent.activity.attachments": "Anexos: {list}",
+ "agent.activity.attachment": "anexo",
+ "agent.activity.editDraft": "Editar rascunho",
+ "agent.activity.schedule": "Agendar",
+ "agent.activity.approveSend": "Aprovar para enviar",
+ "agent.activity.approving": "Aprovando…",
+ "agent.activity.approveDiscard": "Aprovar descarte",
+ "agent.activity.approveStatus": "Aprovar alteração de status",
+ "agent.activity.approveMove": "Aprovar movimentação para {destination}",
+ "agent.queue.label": "Mensagens do assistente na fila",
+ "agent.queue.edit": "Editar mensagem na fila",
+ "agent.queue.steerTitle": "Parar a resposta atual e enviar esta mensagem em seguida",
+ "agent.queue.sendNowTitle": "Enviar esta mensagem da fila agora",
+ "agent.queue.steer": "Redirecionar",
+ "agent.queue.sendNow": "Enviar agora",
+ "agent.queue.remove": "Remover mensagem da fila",
+ "agent.loadingConversation": "Carregando conversa",
+ "agent.duration.lessThanSecond": "<1s"
}