Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(companion): expose paw mode activity

tianma-if7bec84802ea6
diff --git a/apps/web/src/components/CompanionDiscoveryHub.test.mjs b/apps/web/src/components/CompanionDiscoveryHub.test.mjs
index 0537fb8e..d8445881 100644
--- a/apps/web/src/components/CompanionDiscoveryHub.test.mjs
+++ b/apps/web/src/components/CompanionDiscoveryHub.test.mjs
@@ -12,10 +12,10 @@ import Hub from "./CompanionDiscoveryHub.tsx";
import { CompanionDiscoverySettingsCard } from "./settings/CompanionDiscoverySettingsCard.tsx";
import { discoverySettingsKey, discoveryFeedKey } from "../hooks/useCompanionDiscovery.ts";
-async function render(enabled, locale = "zh-CN", card = false) {
+async function render(enabled, locale = "zh-CN", card = false, settings = {}, items = []) {
const client = new QueryClient({ defaultOptions: { queries: { gcTime: Infinity } } });
- client.setQueryData(discoverySettingsKey("test"), { enabled, version: 0, lastCheckAt: null, lastStatus: "quiet" });
- client.setQueryData(discoveryFeedKey("test"), []);
+ client.setQueryData(discoverySettingsKey("test"), { enabled, version: 0, lastCheckAt: null, lastStatus: "quiet", ...settings });
+ client.setQueryData(discoveryFeedKey("test"), items);
const i18n = createInstance(); await i18n.init({ lng: locale, resources: { "zh-CN": { translation: zhCN }, "en-US": { translation: enUS } } });
const component = card ? createElement(CompanionDiscoverySettingsCard, { scope: "test", onOpenCompanion() {} })
: createElement(Hub, { scope: "test", onOpenNote() {}, async onNotesChanged() {}, onOpenSettings() {} });
@@ -29,20 +29,34 @@ describe("quiet discovery UI", () => {
expect(html).toContain('aria-label="来自 EdgeEver 的发现"');
expect(html).not.toContain('role="dialog"'); expect(html).not.toContain("有新发现");
});
- test("Paw mode briefly explains benefits and confirmation without notebook selection", async () => {
+ test("Paw mode explains benefits and exposes its inactive state without personalization controls", async () => {
const html = await render(false, "zh-CN", true);
expect(html).toContain("开启后,EdgeEver 会像猫爪轻推纸片一样,帮你归拢零散碎片、将新想法沉淀到已有笔记、挑出过往的相关灵感。只在有价值时轻量提醒,改动完全由你决定。");
+ expect(html).toContain("用得越久,猫爪越懂你。");
expect(html).toContain("猫爪模式");
- expect(html).not.toContain("默认模型服务商"); expect(html).not.toContain("24 小时");
+ expect(html).toContain("猫爪状态"); expect(html).toContain("未运行");
+ expect(html).toContain("尚未检查"); expect(html).toContain("启用后才会检查");
+ expect(html).not.toContain("个性化偏好"); expect(html).not.toContain("发现时参考个人记忆");
expect(html).toContain('role="switch"'); expect(html).not.toContain('disabled=""');
expect(html).toContain('aria-checked="false"');
expect(html).not.toContain('role="checkbox"'); expect(html).not.toContain("<fieldset");
expect(html).toContain("对话与个人记忆");
});
+ test("enabled settings show the real check state and latest generated discovery", async () => {
+ const html = await render(true, "zh-CN", true,
+ { lastStatus: "ready", lastCheckAt: "2026-09-04T06:30:00.000Z" },
+ [{ id: "discovery", kind: "insight", title: "两个产品想法可以互相补充", body: "早期记录解释了新方案的取舍。",
+ sources: [], action: null, seen: false, createdAt: "2026-09-04T06:30:00.000Z" }]);
+ expect(html).toContain("最近检查完成"); expect(html).toContain("最近检查"); expect(html).toContain("下次检查");
+ expect(html).toContain("最近发现"); expect(html).toContain("两个产品想法可以互相补充");
+ expect(html).toContain("早期记录解释了新方案的取舍。"); expect(html).not.toContain("个性化偏好");
+ });
test("English settings have matching concise benefits and no raw translation keys", async () => {
const html = await render(false, "en-US", true);
expect(html).toContain("When enabled, EdgeEver quietly helps tuck scattered fragments together, append new ideas to existing notes, and surface relevant past insights like a gentle cat paw. It nudges you only when valuable, and all changes remain entirely up to you.");
- expect(html).not.toContain("default model provider"); expect(html).not.toContain("one minute");
+ expect(html).toContain("The longer you use it, the better Paw mode understands you.");
+ expect(html).toContain("Paw status"); expect(html).toContain("Not running");
+ expect(html).not.toContain("Personal preferences"); expect(html).not.toContain("one minute");
expect(html).not.toContain("companion.discovery."); expect(html).toContain("Paw mode");
});
test("checks are event-driven, sync-gated and cancel on cleanup", () => {
diff --git a/apps/web/src/components/settings/CompanionDiscoverySettingsCard.tsx b/apps/web/src/components/settings/CompanionDiscoverySettingsCard.tsx
index 2d156f4c..0e7b49ac 100644
--- a/apps/web/src/components/settings/CompanionDiscoverySettingsCard.tsx
+++ b/apps/web/src/components/settings/CompanionDiscoverySettingsCard.tsx
@@ -1,5 +1,5 @@
import { useState } from "react";
-import { useQueryClient } from "@tanstack/react-query";
+import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
@@ -10,12 +10,19 @@ import { discoveryFeedKey, discoverySettingsKey, useCompanionDiscoverySettings }
export function CompanionDiscoverySettingsCard({ scope, onOpenCompanion }: {
scope: string; onOpenCompanion: () => void;
}) {
- const { t } = useTranslation();
+ const { t, i18n } = useTranslation();
const query = useCompanionDiscoverySettings(scope);
const client = useQueryClient();
const [busy, setBusy] = useState(false);
const [error, setError] = useState(false);
const settings = query.data;
+ const enabled = settings?.enabled === true;
+ const feed = useQuery({ queryKey: discoveryFeedKey(scope), queryFn: async () => (await api.listCompanionDiscoveries()).items,
+ enabled, staleTime: 60_000, retry: false });
+ const latest = feed.data?.[0];
+ const formatTime = (value: string) => new Intl.DateTimeFormat(i18n.resolvedLanguage ?? "en-US", {
+ dateStyle: "medium", timeStyle: "short",
+ }).format(new Date(value));
const save = async (enabled: boolean) => {
if (!settings || busy) return;
setBusy(true); setError(false);
@@ -30,6 +37,7 @@ export function CompanionDiscoverySettingsCard({ scope, onOpenCompanion }: {
<CardHeader className="p-4 sm:p-5">
<CardTitle className="text-sm">{t("companion.discovery.settingsTitle")}</CardTitle>
<CardDescription>{t("companion.discovery.description")}</CardDescription>
+ <p className="pt-1 text-sm font-medium text-emerald-700">{t("companion.discovery.tagline")}</p>
</CardHeader>
<CardContent className="space-y-4 px-4 pb-4 sm:px-5">
<div className="flex items-center justify-between gap-3">
@@ -39,6 +47,36 @@ export function CompanionDiscoverySettingsCard({ scope, onOpenCompanion }: {
onCheckedChange={enabled => void save(enabled)} />
</div>
{error || query.isError ? <p role="alert" className="text-sm text-destructive">{t("companion.discovery.settingsFailed")}</p> : null}
+ <section className="space-y-3 rounded-lg border border-slate-200 bg-slate-50 p-4" aria-labelledby="companion-discovery-status-title">
+ <div className="flex items-center justify-between gap-3">
+ <h3 id="companion-discovery-status-title" className="text-sm font-medium">{t("companion.discovery.transparency.title")}</h3>
+ <span className="inline-flex items-center gap-2 text-sm font-medium" role="status">
+ <span className={`h-2 w-2 rounded-full ${enabled ? settings?.lastStatus === "failed" ? "bg-rose-500" : settings?.lastStatus === "running" ? "animate-pulse bg-amber-500" : "bg-emerald-500" : "bg-slate-400"}`} />
+ {t(`companion.discovery.transparency.state.${enabled ? settings?.lastStatus ?? "quiet" : "disabled"}`)}
+ </span>
+ </div>
+ <dl className="grid gap-3 text-sm sm:grid-cols-2">
+ <div><dt className="text-xs text-slate-500">{t("companion.discovery.transparency.lastCheck")}</dt>
+ <dd className="mt-1 text-slate-700">{settings?.lastCheckAt ? formatTime(settings.lastCheckAt) : t("companion.discovery.transparency.neverChecked")}</dd></div>
+ <div><dt className="text-xs text-slate-500">{t("companion.discovery.transparency.nextCheck")}</dt>
+ <dd className="mt-1 text-slate-700">{t(enabled ? "companion.discovery.transparency.nextCheckEnabled" : "companion.discovery.transparency.nextCheckDisabled")}</dd></div>
+ </dl>
+ <p className="text-xs leading-relaxed text-slate-500">{t("companion.discovery.transparency.scope")}</p>
+ </section>
+ {enabled ? <section className="space-y-3" aria-labelledby="companion-latest-discovery-title">
+ <h3 id="companion-latest-discovery-title" className="text-sm font-medium">{t("companion.discovery.transparency.latest")}</h3>
+ {feed.isPending ? <p role="status" className="text-sm text-slate-500">{t("common.loading")}</p> : null}
+ {feed.isError ? <p role="alert" className="text-sm text-destructive">{t("companion.discovery.loadFailed")}</p> : null}
+ {!feed.isPending && !feed.isError && !latest ? <p className="rounded-lg border border-dashed border-slate-200 p-4 text-sm text-slate-500">{t("companion.discovery.transparency.noDiscovery")}</p> : null}
+ {latest ? <article className="space-y-2 rounded-lg border border-slate-200 p-4">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <p className="text-xs text-emerald-700">{t(`companion.discovery.kind.${latest.kind}`)}</p>
+ <time className="text-xs text-slate-500" dateTime={latest.createdAt}>{formatTime(latest.createdAt)}</time>
+ </div>
+ <h4 className="break-words text-sm font-medium text-slate-900">{latest.title}</h4>
+ <p className="whitespace-pre-wrap break-words text-sm leading-relaxed text-slate-600">{latest.body}</p>
+ </article> : null}
+ </section> : null}
<Button size="sm" variant="ghost" onClick={onOpenCompanion}>{t("companion.discovery.openCompanion")}</Button>
</CardContent>
</Card>;
diff --git a/docs/personality-memory-agent.md b/docs/personality-memory-agent.md
index dd0a2863..731a0925 100644
--- a/docs/personality-memory-agent.md
+++ b/docs/personality-memory-agent.md
@@ -20,9 +20,11 @@ The main flow is: normal note-taking → the Agent identifies an opportunity at
- Suggestions do not enter the normal note list or automatically become “AI suggestion drafts.” Notes are created or modified only after confirmation of the corresponding write.
- Users may dismiss suggestions or disable the mode. Disabling invalidates unconfirmed discovery actions; already-started confirmed operations retain receipts. Disabling does not undo completed changes.
-The settings page keeps only a short benefit description:
+The settings page starts with a short benefit description, then makes the background behavior visible without adding configuration burden. A read-only status panel shows whether Paw mode is idle, checking, ready, or failed; the last check time; the conditions for another check; the data scope and confirmation boundary; and the latest generated discovery when one exists:
> When enabled, EdgeEver quietly helps tuck scattered fragments together, append new ideas to existing notes, and surface relevant past insights like a gentle cat paw. It nudges you only when valuable, and all changes remain entirely up to you.
+>
+> The longer you use it, the better Paw mode understands you.
## 3. Current capabilities and boundaries
diff --git a/docs/personality-memory-agent.zh-CN.md b/docs/personality-memory-agent.zh-CN.md
index 0bb79363..4595cab7 100644
--- a/docs/personality-memory-agent.zh-CN.md
+++ b/docs/personality-memory-agent.zh-CN.md
@@ -20,9 +20,11 @@ Agent 是围绕用户知识工作的长期助手,不是一个熟悉笔记的
- 建议不混入正常笔记,也不默认生成「AI 建议草稿」。只有确认了相应写入操作,才创建或修改笔记。
- 用户可忽略建议或关闭模式。关闭后未确认的发现操作失效;已经开始的确认操作保留执行记录,关闭不等于撤销已完成的修改。
-设置页只保留简短用途介绍:
+设置页以简短用途介绍开头,再以只读状态呈现后台行为,不增加配置负担。状态面板展示猫爪处于安静观察、检查中、发现就绪或检查失败,最近检查时间、下次检查条件、数据范围与确认边界;存在生成结果时还展示最近一条发现:
> 开启后,EdgeEver 会像猫爪轻推纸片一样,帮你归拢零散碎片、将新想法沉淀到已有笔记、挑出过往的相关灵感。只在有价值时轻量提醒,改动完全由你决定。
+>
+> 用得越久,猫爪越懂你。
## 3. 当前能力与边界
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 8363b5a8..2ea430a5 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -7,6 +7,7 @@ export const enUS = {
settingsTitle: "Paw mode",
title: "Discoveries from EdgeEver",
description: "When enabled, EdgeEver quietly helps tuck scattered fragments together, append new ideas to existing notes, and surface relevant past insights like a gentle cat paw. It nudges you only when valuable, and all changes remain entirely up to you.",
+ tagline: "The longer you use it, the better Paw mode understands you.",
enable: "Enable Paw mode",
settingsFailed: "Settings were not saved. Check your connection or refresh and retry.",
openCompanion: "Conversation and personal memory",
@@ -19,6 +20,18 @@ export const enUS = {
dismiss: "Skip this",
kind: { insight: "Knowledge connection · No action needed", merge: "Suggestion · Combine ideas", append: "Suggestion · Add to an existing note" },
checkStatus: { quiet: "Checks happen as needed and may incur model charges. No useful result means no notification.", ready: "The latest check completed.", running: "Checking related notes.", failed: "The latest check did not finish. Check your default model and connection; this attempt is not retried automatically." },
+ transparency: {
+ title: "Paw status",
+ state: { disabled: "Not running", quiet: "Watching quietly", ready: "Latest check complete", running: "Checking", failed: "Check did not finish" },
+ lastCheck: "Last check",
+ neverChecked: "Not checked yet",
+ nextCheck: "Next check",
+ nextCheckEnabled: "After notes change, the app is idle, and at least 24 hours have passed since the last check",
+ nextCheckDisabled: "Checks begin after Paw mode is enabled",
+ scope: "Each check sends only a small selection of relevant notes from this account to the default model. It stays quiet without a useful result, and every note change requires your approval.",
+ latest: "Latest discovery",
+ noDiscovery: "No discovery has been worth interrupting you for yet. Paw mode will quietly wait for new note changes.",
+ },
},
"actions": {
"confirmTool": "Confirm this operation",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 8bb01616..06abbcad 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -7,6 +7,7 @@ export const zhCN = {
settingsTitle: "猫爪模式",
title: "来自 EdgeEver 的发现",
description: "开启后,EdgeEver 会像猫爪轻推纸片一样,帮你归拢零散碎片、将新想法沉淀到已有笔记、挑出过往的相关灵感。只在有价值时轻量提醒,改动完全由你决定。",
+ tagline: "用得越久,猫爪越懂你。",
enable: "启用猫爪模式",
settingsFailed: "设置未保存。请检查连接或刷新后重试。",
openCompanion: "对话与个人记忆",
@@ -19,6 +20,18 @@ export const zhCN = {
dismiss: "略过这条",
kind: { insight: "知识关联 · 无需操作", merge: "整理建议 · 合并点子", append: "整理建议 · 补入已有笔记" },
checkStatus: { quiet: "检查按需发生,可能产生模型费用;没有有价值的结果就保持安静。", ready: "最近一次检查已完成。", running: "正在检查相关笔记。", failed: "最近一次检查未完成。请检查默认模型和网络;同一轮检查不自动重试。" },
+ transparency: {
+ title: "猫爪状态",
+ state: { disabled: "未运行", quiet: "安静观察中", ready: "最近检查完成", running: "正在检查", failed: "检查未完成" },
+ lastCheck: "最近检查",
+ neverChecked: "尚未检查",
+ nextCheck: "下次检查",
+ nextCheckEnabled: "笔记有新变化、应用空闲,且距上次检查至少 24 小时后",
+ nextCheckDisabled: "启用后才会检查",
+ scope: "每次只选取当前账户中少量相关笔记交给默认模型。没有有价值的结果时保持安静;任何笔记改动都需要你确认。",
+ latest: "最近发现",
+ noDiscovery: "还没有生成值得提醒你的发现。猫爪会继续安静等待新的笔记变化。",
+ },
},
"actions": {
"confirmTool": "确认执行此操作",