AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
style(ai): compact local agent process details
tianma-ifebcf78b457e1
diff --git a/apps/web/src/components/ai-sidebar/AiSidebar.tsx b/apps/web/src/components/ai-sidebar/AiSidebar.tsxindex b701d4df..655ca938 100644--- a/apps/web/src/components/ai-sidebar/AiSidebar.tsx+++ b/apps/web/src/components/ai-sidebar/AiSidebar.tsx@@ -84,6 +84,7 @@ import {import { cn } from "@/lib/utils";import { CompanionQuestionForm } from "../CompanionQuestionForm";import { AiSidebarMessage } from "./AiSidebarMessage";+import { AiSidebarLocalProcess } from "./AiSidebarLocalProcess";const SIDEBAR_DEFAULT_WIDTH = 380;const sidebarThreadClassName = cn(@@ -1608,24 +1609,14 @@ function AiSidebarSession({<AttachmentChips items={turn.attachments} /></Message><Message from="assistant">- {turn.reasoning.trim() ? (- <Reasoning isStreaming={turn.status === "running"}>- <ReasoningTrigger getThinkingMessage={() => t("companion.process")} />- <ReasoningContent>{turn.reasoning}</ReasoningContent>- </Reasoning>+ {turn.reasoning.trim() || turn.tools.length ? (+ <AiSidebarLocalProcess reasoning={turn.reasoning} tools={turn.tools} running={turn.status === "running"} />) : turn.status === "running" ? (<p role="status" className="flex items-center gap-2 text-xs text-slate-500"><Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden="true" />{t("aiAssistant.sidebar.working")}</p>) : null}- {turn.tools.length ? (- <ul className="space-y-1 text-xs text-slate-500">- {turn.tools.map((tool) => (- <li key={tool.id}>{t("aiAssistant.sidebar.toolProgress", { name: tool.title || tool.name, status: tool.status })}</li>- ))}- </ul>- ) : null}{turn.images.length ? (<div className="flex flex-col gap-2">{turn.images.map((image, index) => (diff --git a/apps/web/src/components/ai-sidebar/AiSidebarLocalProcess.tsx b/apps/web/src/components/ai-sidebar/AiSidebarLocalProcess.tsxnew file mode 100644index 00000000..856d0ac0--- /dev/null+++ b/apps/web/src/components/ai-sidebar/AiSidebarLocalProcess.tsx@@ -0,0 +1,85 @@+import { CollapsibleContent } from "@/components/ui/collapsible";+import { Reasoning, ReasoningTrigger } from "@/components/ai-elements/reasoning";+import { Loader2 } from "lucide-react";+import { useTranslation } from "react-i18next";+import { AiSidebarMessage } from "./AiSidebarMessage";++type ToolRow = { id: string; name: string; status: string; title?: string };++const opaqueToolName = /^(?:exec|call)[-_][a-z0-9-]+$|^tool[-_][a-z0-9-]{8,}$/i;++function toolSummary(tool: ToolRow, t: (key: string) => string) {+ const title = tool.title?.trim() ?? "";+ if (/^web search(?::|$)/i.test(title)) {+ return { label: t("aiAssistant.sidebar.processTools.webSearch"), detail: title.replace(/^web search\s*:?\s*/i, "") };+ }+ if (/^image generation$/i.test(title)) return { label: t("aiAssistant.sidebar.processTools.imageGeneration"), detail: "" };+ if (tool.name === "exec_command" || /^exec[-_]/i.test(title) || /^exec[-_]/i.test(tool.name)) {+ return { label: t("aiAssistant.sidebar.processTools.command"), detail: "" };+ }+ if (title && !opaqueToolName.test(title)) return { label: title, detail: "" };+ if (tool.name && !opaqueToolName.test(tool.name)) return { label: tool.name.replaceAll("_", " "), detail: "" };+ return { label: t("aiAssistant.sidebar.processTools.other"), detail: "" };+}++function statusKey(status: string) {+ if (status === "completed" || status === "done") return "completed";+ if (status === "failed" || status === "error") return "failed";+ if (status === "in_progress" || status === "running") return "running";+ return "pending";+}++export function AiSidebarLocalProcess({ reasoning, tools, running }: { reasoning: string; tools: ToolRow[]; running: boolean }) {+ const { t } = useTranslation();+ if (!reasoning.trim() && !tools.length) return null;+ return (+ <Reasoning isStreaming={running} defaultOpen={false} className="mb-2">+ <ReasoningTrigger+ className="w-auto py-1 text-xs text-slate-500 hover:text-slate-800 [&_svg]:size-3.5"+ getThinkingMessage={() => (+ <span className="flex items-center gap-1.5">+ {t("companion.process")}+ {running ? <Loader2 className="size-3 animate-spin" aria-hidden="true" /> : null}+ </span>+ )}+ />+ <CollapsibleContent className="mt-2 max-h-80 overflow-y-auto rounded-lg border border-slate-200 bg-slate-50/70 p-3 text-xs leading-5 text-slate-600">+ {reasoning.trim() ? (+ <div className="[&_p]:my-1 [&_h1]:my-1 [&_h2]:my-1 [&_h3]:my-1 [&_li]:my-0">+ <AiSidebarMessage className="text-xs leading-5">{reasoning}</AiSidebarMessage>+ </div>+ ) : null}+ {tools.length ? (+ <div className={reasoning.trim() ? "mt-3 border-t border-slate-200 pt-2" : ""}>+ <p className="mb-1.5 text-[11px] font-medium text-slate-500">{t("aiAssistant.sidebar.processTools.activity")}</p>+ <ul className="space-y-1.5">+ {tools.slice(-5).map((tool) => {+ const { label, detail } = toolSummary(tool, t);+ const state = statusKey(tool.status);+ return (+ <li key={tool.id} className="flex min-w-0 items-center gap-2">+ <span className={`size-1.5 shrink-0 rounded-full ${state === "running" ? "bg-sky-500" : state === "failed" ? "bg-rose-500" : "bg-slate-400"}`} aria-hidden="true" />+ <span className="min-w-0 flex-1 truncate">+ {label}{detail ? <span className="text-slate-400"> · {detail}</span> : null}+ </span>+ <span className="shrink-0 text-[11px] text-slate-400">{t(`aiAssistant.sidebar.processTools.${state}`)}</span>+ </li>+ );+ })}+ </ul>+ <details className="mt-2 text-[11px] text-slate-500">+ <summary className="w-fit cursor-pointer rounded-sm hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400">+ {t("aiAssistant.sidebar.processTools.raw")}+ </summary>+ <ul className="mt-1.5 space-y-1 border-l border-slate-200 pl-2 font-mono leading-4">+ {tools.map((tool) => (+ <li key={tool.id} className="break-all">{tool.title || tool.name} · {tool.status}</li>+ ))}+ </ul>+ </details>+ </div>+ ) : null}+ </CollapsibleContent>+ </Reasoning>+ );+}diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex ca954ef3..1d6b81fa 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -1367,6 +1367,18 @@ export const enUS = {proposalConfirmOther: "Confirm",proposalDismiss: "Dismiss",toolProgress: "{{name}} · {{status}}",+ processTools: {+ activity: "Tool activity",+ webSearch: "Web search",+ imageGeneration: "Image generation",+ command: "Run command",+ other: "Tool call",+ pending: "Waiting",+ running: "Running",+ completed: "Completed",+ failed: "Incomplete",+ raw: "Raw log",+ },generatedImage: "Generated image",downloadImage: "Download image",imageSaveFailed: "The image could not be saved locally. Download it now; it may be lost when you close this page.",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex d7524e2a..3b49086b 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -1367,6 +1367,18 @@ export const ja = {proposalConfirmOther: "確認",proposalDismiss: "無視",toolProgress: "{{name}} · {{status}}",+ processTools: {+ activity: "ツールの実行",+ webSearch: "ウェブ検索",+ imageGeneration: "画像生成",+ command: "コマンド実行",+ other: "ツール呼び出し",+ pending: "待機中",+ running: "実行中",+ completed: "完了",+ failed: "未完了",+ raw: "元のログ",+ },generatedImage: "生成された画像",downloadImage: "画像をダウンロード",imageSaveFailed: "画像を端末に保存できませんでした。今すぐダウンロードしてください。ページを閉じると失われる可能性があります。",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 58f9fad7..1a7d67c3 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -1367,6 +1367,18 @@ export const zhCN = {proposalConfirmOther: "确认",proposalDismiss: "忽略",toolProgress: "{{name}} · {{status}}",+ processTools: {+ activity: "工具活动",+ webSearch: "网页搜索",+ imageGeneration: "生成图片",+ command: "运行命令",+ other: "工具调用",+ pending: "等待中",+ running: "进行中",+ completed: "已完成",+ failed: "未完成",+ raw: "原始记录",+ },generatedImage: "生成的图片",downloadImage: "下载图片",imageSaveFailed: "图片暂时无法保存到本机。请先下载图片,关闭页面后可能无法找回。",