Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(desktop): 接通插件推荐任务与首页随机推荐 (#3992)

Dash47dacc6139c6
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
index 991f664334..d5f724bf44 100644
--- a/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
@@ -338,6 +338,20 @@ describe('GhostManager · 存量插件一次性迁移(§5 升级无感)', () =>
});
});
+ it.each([2, 3] as const)('keeps v%s legacy recommendation metadata approved across reload', async (schemaVersion) => {
+ const recommendations = { custom: 'unrelated metadata' };
+ const manifest = schemaVersion === 2
+ ? { ...goodManifest(), recommendations }
+ : { schemaVersion: 3, minCindyVersion: '0.1.61', id: 'hello', name: 'Hello', version: '1.0.0', entry: 'main.js', recommendations };
+ await writeLegacyInstall('hello', manifest);
+ expect((await manager.migrateLegacyApprovalsOnce()).migrated).toEqual(['hello']);
+ expect(manager.list()[0]).toMatchObject({ enabled: true, approval: { state: 'approved' } });
+ const approved = manager.approvedInstallEvidence('hello')?.approvedManifest;
+ if (schemaVersion === 2) expect(approved).not.toHaveProperty('recommendations');
+ else expect(approved).toHaveProperty('recommendations', recommendations);
+ expect(manager.list()[0]).toMatchObject({ enabled: true, approval: { state: 'approved' } });
+ });
+
it('带 setup.kv 的旧安装无感迁移并保留标准化就绪声明', async () => {
await writeLegacyInstall('hello', setupKvManifest(), {
files: { 'settings.html': '<!doctype html>' },
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostIpcSenderTrust.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostIpcSenderTrust.test.ts
index 8138fffd1d..94da96f5d8 100644
--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostIpcSenderTrust.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostIpcSenderTrust.test.ts
@@ -27,6 +27,7 @@ const TRUSTED_SENDER_CHANNELS = [
'ghosts:export',
'ghosts:set-enabled',
'ghosts:restore-builtin',
+ 'ghosts:mark-used',
] as const;
function handlerBlock(source: string, channel: string): string {
@@ -53,4 +54,27 @@ describe('高权限 ghost IPC 的来源闸(源码契约)', () => {
).toBe(false);
});
}
+
+ it('keeps recommendation snapshots behind the trusted app frame check', () => {
+ const start = source.indexOf("ipcMain.on('ghosts:recommendations'");
+ expect(start).toBeGreaterThan(-1);
+ const block = source.slice(start, source.indexOf('\n });', start));
+ expect(block).toMatch(/if \(!isTrustedAppRendererEvent\(event\)\)\s*\{\s*event.returnValue = empty;\s*return;/);
+ expect(block.indexOf('isTrustedAppRendererEvent')).toBeLessThan(
+ block.indexOf('readGhostRecommendationEntries'),
+ );
+ });
+
+ it('binds runtime replacement to the live logic sender, never a payload plugin id', () => {
+ const block = handlerBlock(source, 'ghost-pipe:send');
+ const updateStart = block.indexOf("if (type === 'recommendations-update')");
+ expect(updateStart).toBeGreaterThan(-1);
+ const beforeUpdate = block.slice(0, updateStart);
+ expect(beforeUpdate).toContain('ghostIdForLogicWebContents(event.sender.id)');
+ expect(beforeUpdate).toContain('requireGhostAvailableForActiveSession(id)');
+ const update = block.slice(updateStart, block.indexOf("if (type === 'tool-result')"));
+ expect(update).toContain('!ghost.enabled');
+ expect(update).toContain('replaceGhostRecommendations(id,');
+ expect(update).not.toMatch(/payload\.(?:id|ghostId)/);
+ });
});
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostRecommendations.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostRecommendations.test.ts
new file mode 100644
index 0000000000..8302ab9978
--- /dev/null
+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostRecommendations.test.ts
@@ -0,0 +1,120 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import type { InstalledGhost } from '../../../shared/ghost';
+import { validateGhostManifest } from '../../../shared/ghost';
+import { buildGhostRecommendationSnapshot } from '../ghostRecommendationSnapshot';
+
+const state = vi.hoisted(() => ({
+ owner: 'owner-a',
+ buckets: new Map<string, Record<string, unknown>>(),
+}));
+vi.mock('../../appSessionState.js', () => ({ ownerScopedUserDataPath: () => state.owner }));
+vi.mock('electron-store', () => ({
+ default: class {
+ constructor(private options: { cwd: string; defaults: Record<string, unknown> }) {
+ if (!state.buckets.has(options.cwd))
+ state.buckets.set(options.cwd, structuredClone(options.defaults));
+ }
+ get(key: string) {
+ return state.buckets.get(this.options.cwd)?.[key];
+ }
+ set(key: string, value: unknown) {
+ state.buckets.get(this.options.cwd)![key] = structuredClone(value);
+ }
+ },
+}));
+import {
+ readGhostRecommendationEntries,
+ replaceGhostRecommendations,
+ markGhostRecommendationInstalled,
+ consumeGhostRecommendationPriority,
+ forgetGhostRecommendations,
+} from '../ghostRecommendationStore';
+const item = { id: 'one', label: 'Review email', prompt: 'Review email for me.' };
+const ghost = {
+ enabled: true,
+ manifest: { id: 'example', recommendations: [item] },
+} as unknown as InstalledGhost;
+beforeEach(() => {
+ state.owner = 'owner-a';
+ state.buckets.set('owner-a', { entries: [] });
+ state.buckets.set('owner-b', { entries: [] });
+});
+describe('plugin recommendation state', () => {
+ it('replaces, withdraws, preserves install priority and isolates owners', () => {
+ markGhostRecommendationInstalled('example');
+ const installedAt = readGhostRecommendationEntries()[0].installedAt;
+ expect(replaceGhostRecommendations('example', [item])).toEqual({ ok: true });
+ expect(replaceGhostRecommendations('example', [])).toEqual({ ok: true });
+ expect(readGhostRecommendationEntries()[0]).toEqual({ id: 'example', items: [], installedAt });
+ expect(
+ buildGhostRecommendationSnapshot(state.owner, [ghost], readGhostRecommendationEntries(), [])
+ .sources[0].items,
+ ).toEqual([]);
+ state.owner = 'owner-b';
+ expect(readGhostRecommendationEntries()).toEqual([]);
+ state.owner = 'owner-a';
+ expect(readGhostRecommendationEntries()[0].items).toEqual([]);
+ consumeGhostRecommendationPriority('example');
+ expect(
+ buildGhostRecommendationSnapshot(state.owner, [ghost], readGhostRecommendationEntries(), [])
+ .newlyInstalledId,
+ ).toBeNull();
+ forgetGhostRecommendations('example');
+ expect(readGhostRecommendationEntries()).toEqual([]);
+ });
+ it('rejects invalid replacement without losing previous tasks', () => {
+ replaceGhostRecommendations('example', [item]);
+ expect(replaceGhostRecommendations('example', [{ ...item, pluginId: 'other' }]).ok).toBe(false);
+ expect(readGhostRecommendationEntries()[0].items).toEqual([item]);
+ });
+ it('keeps no-field old plugins and uses only currently installed identities', () => {
+ expect(
+ buildGhostRecommendationSnapshot('a', [ghost], [], ['gone', 'example']).recentIds,
+ ).toEqual(['example']);
+ expect(
+ buildGhostRecommendationSnapshot('a', [], [{ id: 'gone', installedAt: 1 }], [])
+ .newlyInstalledId,
+ ).toBeNull();
+ const old = {
+ schemaVersion: 2,
+ id: 'old',
+ name: 'Old',
+ version: '1',
+ entry: 'main.js',
+ slots: [],
+ };
+ expect(validateGhostManifest(old).ok).toBe(true);
+ const result = validateGhostManifest({ ...old, recommendations: [item] });
+ expect(result.ok).toBe(true);
+ expect(result.ok && result.manifest).not.toHaveProperty('recommendations');
+ });
+ it.each(['legacy metadata', { custom: true }, [{ ...item, priority: 99 }]])(
+ 'preserves opaque v3 metadata without publishing invalid recommendations: %j',
+ (recommendations) => {
+ const parsed = validateGhostManifest({
+ schemaVersion: 3,
+ minCindyVersion: '0.1.61',
+ id: 'example',
+ name: 'Example',
+ version: '1',
+ entry: 'main.js',
+ recommendations,
+ });
+ expect(parsed.ok).toBe(true);
+ if (!parsed.ok) throw new Error(parsed.reason);
+ expect(parsed.manifest.recommendations).toEqual(recommendations);
+ const installed = { ...ghost, manifest: parsed.manifest };
+ expect(
+ buildGhostRecommendationSnapshot('a', [installed], [], []).sources[0].items,
+ ).toBeUndefined();
+ expect(
+ buildGhostRecommendationSnapshot('a', [installed], [{ id: 'example', items: [item] }], [])
+ .sources[0].items,
+ ).toEqual([item]);
+ expect(
+ buildGhostRecommendationSnapshot('a', [installed], [{ id: 'example', items: [] }], [])
+ .sources[0].items,
+ ).toEqual([]);
+ },
+ );
+});
diff --git a/apps/desktop/src/main/cindy-brain/forge.ts b/apps/desktop/src/main/cindy-brain/forge.ts
index 19a85e74b3..f0b93a68a1 100644
--- a/apps/desktop/src/main/cindy-brain/forge.ts
+++ b/apps/desktop/src/main/cindy-brain/forge.ts
@@ -4287,6 +4287,36 @@ const opened = await cindy.iosSimulator.request({
- 页面需要电子脑逻辑时仍先 \`fetch('/wake')\`,通信和媒体协议与 §5 完全相同。插件停用、
卸载或失去批准后,Host 会卸载页面并退出该路由。
+## 4.21 为插件添加推荐任务(可选内容)
+
+在 v3 ghost.json 顶层添加 \`recommendations\` 数组,每条包含稳定 \`id\`、短标题
+\`label\` 和完整 \`prompt\`。最多 24 条,id 为 1–64 位小写字母、数字或连字符,
+label 为 1–120 字符,prompt 为 1–8000 字符;整份列表 UTF-8 不超过 64 KiB。
+可选 \`locales\` 按 en / zh-CN / zh-TW / ja / ko 提供 \`{label,prompt}\`,
+缺当前语言时使用 en,再回退条目自身。不要放秘密或其它账号的内容。
+宿主在生成首页候选时校验此列表,不合格的列表不展示,但不影响插件安装、批准和运行。
+v2 清单继续忽略此扩展字段;运行时更新始终严格校验,不合格的更新不会替换原列表。
+
+\`\`\`json
+{"recommendations":[{"id":"daily-mail","label":"整理今天需要处理的邮件","prompt":"整理今天需要我处理的邮件,列出待办和原文中的截止时间。先给清单,不发送或删除邮件。"}]}
+\`\`\`
+
+运行中的电子脑可调用 \`await cindy.recommendations(items)\`,等价于
+\`cindy.send({type:'recommendations-update',items})\`。Host 从真实沙箱绑定取得身份,
+只替换调用插件自己的完整推荐任务列表;返回 \`{ok:true}\` 或 \`{ok:false,errorCode}\`。
+这不是能力 slot,不执行任务、不授予新权限。面板仍为零桥,需要更新时经同源通信
+交给电子脑。Node 子程序同样由自己的 main.js 代转管子。
+
+运行时列表按当前用户保存,重启保留;卸载清除,停用保留。空数组明确撤下全部推荐,
+不会退回初始推荐任务列表;不提供此字段的旧插件继续正常使用。首页打开或换批时读取最新列表,
+不为获取推荐任务启动所有插件;已显示的一批保持稳定,点击前重新核对是否撤回或改变。
+
+Cindy 统一归类、随机选择与排序,同批每个场景和每个插件最多一条。增加推荐任务数量不会增加
+插件的抽取机会。若只想提供某个场景的任务,替换为仅含该任务的列表即可,但不能指定
+首页位置或优先级。用户主动首装优先,更新包或替换推荐任务列表不算新安装,首次使用后回到普通排序。
+点击推荐后才将 prompt 作为普通用户消息发送,绝不进入系统提示词。未安装/未启用时
+进入已有插件详情,由用户安装或启用后继续;账号配置仍复用 Host Setup 的原调用接续。
+
## 5. 面板(panel.html/css/js)
- 显示形态由 \`panel.position\` 决定:\`left\`(缺省)= 停靠主聊天窗左侧的常驻
diff --git a/apps/desktop/src/main/cindy-brain/ghostRecommendationSnapshot.ts b/apps/desktop/src/main/cindy-brain/ghostRecommendationSnapshot.ts
new file mode 100644
index 0000000000..cd56595674
--- /dev/null
+++ b/apps/desktop/src/main/cindy-brain/ghostRecommendationSnapshot.ts
@@ -0,0 +1,35 @@
+import type { InstalledGhost } from '../../shared/ghost.js';
+import type { HomePluginRecommendationsSnapshot } from '../../shared/homePluginRecommendations.js';
+import { validateGhostRecommendations, type GhostRecommendation } from '@cindy/plugin-protocol';
+
+export function buildGhostRecommendationSnapshot(
+ ownerId: string | null,
+ ghosts: InstalledGhost[],
+ entries: { id: string; items?: GhostRecommendation[]; installedAt?: number }[],
+ recentIds: string[],
+): HomePluginRecommendationsSnapshot {
+ const sources = ghosts.map((g) => {
+ // Keep legacy manifest/receipt content intact; invalid optional metadata must not disable a plugin.
+ const candidates =
+ entries.find((e) => e.id === g.manifest.id)?.items ?? g.manifest.recommendations;
+ const validated =
+ candidates === undefined ? undefined : validateGhostRecommendations(candidates);
+ const items = validated?.ok ? validated.items : undefined;
+ return {
+ ghostId: g.manifest.id,
+ name: g.manifest.name,
+ enabled: g.enabled,
+ ...(items !== undefined ? { items } : {}),
+ };
+ });
+ const installed = new Set(sources.map((s) => s.ghostId));
+ return {
+ ownerId,
+ sources,
+ recentIds: recentIds.filter((id) => installed.has(id)),
+ newlyInstalledId:
+ entries
+ .filter((e) => e.installedAt && installed.has(e.id))
+ .sort((a, b) => b.installedAt! - a.installedAt!)[0]?.id ?? null,
+ };
+}
diff --git a/apps/desktop/src/main/cindy-brain/ghostRecommendationStore.ts b/apps/desktop/src/main/cindy-brain/ghostRecommendationStore.ts
new file mode 100644
index 0000000000..99db76e364
--- /dev/null
+++ b/apps/desktop/src/main/cindy-brain/ghostRecommendationStore.ts
@@ -0,0 +1,85 @@
+import Store from 'electron-store';
+import { validateGhostRecommendations, type GhostRecommendation } from '@cindy/plugin-protocol';
+import { ownerScopedUserDataPath } from '../appSessionState.js';
+import { isValidGhostId } from '../../shared/ghost.js';
+
+interface Entry {
+ id: string;
+ items?: GhostRecommendation[];
+ installedAt?: number;
+}
+interface Shape {
+ entries: Entry[];
+}
+let instance: Store<Shape> | undefined;
+let directory: string | undefined;
+function store(): Store<Shape> {
+ const current = ownerScopedUserDataPath();
+ if (!instance || directory !== current) {
+ instance = new Store<Shape>({
+ name: 'ghost-recommendations',
+ cwd: current,
+ defaults: { entries: [] },
+ clearInvalidConfig: true,
+ });
+ directory = current;
+ }
+ return instance;
+}
+
+export function readGhostRecommendationEntries(): Entry[] {
+ const raw: unknown = store().get('entries');
+ if (!Array.isArray(raw)) return [];
+ return raw.flatMap((entry): Entry[] => {
+ if (!entry || !isValidGhostId(entry.id)) return [];
+ const parsed =
+ entry.items === undefined ? undefined : validateGhostRecommendations(entry.items);
+ return [
+ {
+ id: entry.id,
+ ...(parsed?.ok ? { items: parsed.items } : {}),
+ ...(typeof entry.installedAt === 'number' && Number.isFinite(entry.installedAt)
+ ? { installedAt: entry.installedAt }
+ : {}),
+ },
+ ];
+ });
+}
+
+function update(id: string, patch: Partial<Entry>): void {
+ if (!isValidGhostId(id)) throw new Error('Invalid plugin identity');
+ const entries = readGhostRecommendationEntries();
+ const previous = entries.find((e) => e.id === id);
+ store().set('entries', [...entries.filter((e) => e.id !== id), { ...previous, ...patch, id }]);
+}
+
+/** Caller derives identity from the live sandbox binding, never from author payload. */
+export function replaceGhostRecommendations(
+ id: string,
+ value: unknown,
+): { ok: boolean; errorCode?: string } {
+ const parsed = validateGhostRecommendations(value);
+ if (!parsed.ok) return { ok: false, errorCode: 'INVALID_PARAMS' };
+ try {
+ update(id, { items: parsed.items });
+ } catch {
+ return { ok: false, errorCode: 'INTERNAL' };
+ }
+ return { ok: true };
+}
+
+/** Explicit first installs only. Updates/default installs must not call this. */
+export function markGhostRecommendationInstalled(id: string): void {
+ update(id, { installedAt: Date.now() });
+}
+
+export function consumeGhostRecommendationPriority(id: string): void {
+ update(id, { installedAt: undefined });
+}
+
+export function forgetGhostRecommendations(id: string): void {
+ store().set(
+ 'entries',
+ readGhostRecommendationEntries().filter((e) => e.id !== id),
+ );
+}
diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.ts
index 3a4458e8e3..49f4e3147e 100644
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@ -15,6 +15,14 @@ import path from 'node:path';
import { isDeepStrictEqual } from 'node:util';
import { supportsCindyVersion } from '@cindy/plugin-protocol';
+import { buildGhostRecommendationSnapshot } from './ghostRecommendationSnapshot.js';
+import {
+ readGhostRecommendationEntries,
+ replaceGhostRecommendations,
+ markGhostRecommendationInstalled,
+ consumeGhostRecommendationPriority,
+ forgetGhostRecommendations,
+} from './ghostRecommendationStore.js';
import { createLogger } from '../logger.js';
import { throwIpcError } from '../utils/ipcValidate.js';
@@ -5879,6 +5887,13 @@ export async function installOrUpdateLocalGhostPackageFromForge(
enable: true,
expectedPackageSha256: expected.packageSha256,
...(installOrigin ? { installOrigin } : {}),
+ }).then((ghost) => {
+ try {
+ markGhostRecommendationInstalled(ghost.manifest.id);
+ } catch {
+ log.warn('ghost recommendation install history unavailable');
+ }
+ return ghost;
}),
action: 'installed',
};
@@ -6264,6 +6279,11 @@ async function uninstallGhostAndCleanupLocked(
error: error instanceof Error ? error.message : String(error),
});
}
+ try {
+ forgetGhostRecommendations(id);
+ } catch {
+ log.warn('ghost recommendation cleanup unavailable', { id });
+ }
// 未读随意识一起走:包都没了还留一颗点,用户既点不开也清不掉。
// 限速记账一并抹掉,重装后的第一条不该被上一世的时刻挡住。
extinguishGhostUnread(id);
@@ -6828,6 +6848,11 @@ export function registerGhostIpc(): void {
if (!id) throwIpcError('PERMISSION_DENIED', '非意识电子脑上下文');
requireGhostAvailableForActiveSession(id);
const type = (payload as { type?: unknown } | null)?.type;
+ if (type === 'recommendations-update') {
+ const ghost = findAvailableGhost(id);
+ if (!ghost || !ghost.enabled) return { ok: false, errorCode: 'GHOST_ASLEEP' };
+ return replaceGhostRecommendations(id, (payload as { items?: unknown }).items);
+ }
if (type === 'tool-result') {
// 交卷结果不回传细节(accepted=false 的原因只进日志,不给沙箱探测面)。
const outcome = getGhostPipeDispatcher().handleToolResult(id, payload);
@@ -7064,6 +7089,25 @@ export function registerGhostIpc(): void {
ipcMain.on('ghosts:list', (event) => {
event.returnValue = { ghosts: availableGhosts().map(projectGhostForRenderer) };
});
+ // Author tasks may contain private context: local trusted application UI only.
+ ipcMain.on('ghosts:recommendations', (event) => {
+ const empty = { ownerId: null, sources: [], recentIds: [], newlyInstalledId: null };
+ if (!isTrustedAppRendererEvent(event)) {
+ event.returnValue = empty;
+ return;
+ }
+ try {
+ event.returnValue = buildGhostRecommendationSnapshot(
+ getActiveAppSession().dataOwnerId,
+ availableGhosts(),
+ readGhostRecommendationEntries(),
+ loadGhostRecentIds(),
+ );
+ } catch {
+ log.warn('ghost recommendation snapshot unavailable');
+ event.returnValue = empty;
+ }
+ });
// Plugin 页的已安装快捷行按最近成功使用排序。历史是主机 UI 状态,不写入
// publisher-owned manifest;同步读保证列表首帧不先按扫描序再跳成最近序。
@@ -7079,13 +7123,19 @@ export function registerGhostIpc(): void {
event.returnValue = { ids: [] };
}
});
- ipcMain.handle('ghosts:mark-used', (_event, id: unknown) => {
+ ipcMain.handle('ghosts:mark-used', (event, id: unknown) => {
+ assertTrustedAppRendererEvent(event);
if (typeof id !== 'string' || !isValidGhostId(id)) {
throwIpcError('INVALID_PARAMS', 'id must be a valid Ghost id');
}
if (!findAvailableGhost(id)) {
throwIpcError('NOT_FOUND', `意识 ${id} 未安装`);
}
+ try {
+ consumeGhostRecommendationPriority(id);
+ } catch {
+ log.warn('ghost recommendation priority cleanup unavailable', { id });
+ }
try {
const ids = markGhostRecentlyUsed(id);
broadcastGhostRecentUsageChanged(ids);
@@ -7273,12 +7323,17 @@ export function registerGhostIpc(): void {
textDefaultId === null || textDefaultLabel === null
? null
: { id: textDefaultId, label: textDefaultLabel },
- declaredModel: declaredResolved && declaredRaw
- ? {
- id: encodeCatalogPin(declaredResolved.providerId, declaredResolved.agentKind, declaredResolved.model),
- label: declaredRaw,
- }
- : null,
+ declaredModel:
+ declaredResolved && declaredRaw
+ ? {
+ id: encodeCatalogPin(
+ declaredResolved.providerId,
+ declaredResolved.agentKind,
+ declaredResolved.model,
+ ),
+ label: declaredRaw,
+ }
+ : null,
// 存量轻量档位钉(目录扩展前钉下的合法值)的展示名表:渲染层据此给
// 老钉值回显友好名,而不是把合法档位钉当 stale 原样露出 id。
utilityProfiles: utilityModelPinOptions(),
@@ -7435,6 +7490,13 @@ export function registerGhostIpc(): void {
ghostId: probe.manifest.id,
enable,
expectedPackageSha256,
+ }).then((ghost) => {
+ try {
+ markGhostRecommendationInstalled(ghost.manifest.id);
+ } catch {
+ log.warn('ghost recommendation install history unavailable');
+ }
+ return ghost;
}),
};
} finally {
@@ -7467,10 +7529,7 @@ export function registerGhostIpc(): void {
throwIpcError('INVALID_PARAMS', 'expectedPackageSha256 must come from ghosts:inspect');
}
if (!isGhostInstallApprovalToken(expectedInstalledApproval)) {
- throwIpcError(
- 'INVALID_PARAMS',
- 'expectedInstalledApproval must come from ghosts:list',
- );
+ throwIpcError('INVALID_PARAMS', 'expectedInstalledApproval must come from ghosts:list');
}
const inspected = await manager.inspect(lizFilePath);
if ('rejection' in inspected) throwInstallError(inspected.rejection);
@@ -7784,7 +7843,9 @@ export function registerGhostIpc(): void {
}
const releaseMutation = beginGhostMutation();
try {
- const set = await getGhostLibraryBindingStore().setBinding(id, candidate, (root) => statfsFreeBytes(root));
+ const set = await getGhostLibraryBindingStore().setBinding(id, candidate, (root) =>
+ statfsFreeBytes(root),
+ );
if (!set.ok) return { ok: false as const, message: set.message };
await getGhostLibrarySlot().disposeGhost(id); // 作废会话,下一请求用新根
await refreshMivoLibraryExtraDirGrant();
diff --git a/apps/desktop/src/main/plugin-market/registerIpc.ts b/apps/desktop/src/main/plugin-market/registerIpc.ts
index 3a4d26bb77..2a2fb1833a 100644
--- a/apps/desktop/src/main/plugin-market/registerIpc.ts
+++ b/apps/desktop/src/main/plugin-market/registerIpc.ts
@@ -13,9 +13,12 @@ import {
} from '../../shared/pluginMarket.js';
import {
sendToTrustedAppWindows,
+ getGhostManager,
setGhostUninstallLedgerPreparer,
} from '../cindy-brain/index.js';
import { createLogger } from '../logger.js';
+import { getActiveAppSession } from '../appSessionState.js';
+import { markGhostRecommendationInstalled } from '../cindy-brain/ghostRecommendationStore.js';
import { assertTrustedAppRendererEvent } from '../security/trustedAppRenderer.js';
import { requireObject, requireString, throwIpcError } from '../utils/ipcValidate.js';
import { parseMarketSource } from './sources/parse.js';
@@ -199,19 +202,31 @@ export function registerPluginMarketIpc(): void {
if (typeof allowSourceReplacement !== 'boolean') {
throwIpcError('INVALID_PARAMS', 'allowSourceReplacement must be a boolean');
}
- return invokePluginMarket(() =>
- service().install(
- requireString(pluginId, 'pluginId'),
- {
- expectedReleaseId,
- ...(expectedInstalledApproval !== undefined
- ? { expectedInstalledApproval }
- : {}),
- ...(expectedManifest !== undefined ? { expectedManifest } : {}),
- allowSourceReplacement,
- },
- ),
+ const owner = getActiveAppSession();
+ const previouslyInstalled = new Set(
+ getGhostManager()
+ .list()
+ .map((g) => g.manifest.id),
);
+ return invokePluginMarket(async () => {
+ const result = await service().install(requireString(pluginId, 'pluginId'), {
+ expectedReleaseId,
+ ...(expectedInstalledApproval !== undefined ? { expectedInstalledApproval } : {}),
+ ...(expectedManifest !== undefined ? { expectedManifest } : {}),
+ allowSourceReplacement,
+ });
+ if (
+ getActiveAppSession().generation === owner.generation &&
+ !previouslyInstalled.has(result.ghost.manifest.id)
+ ) {
+ try {
+ markGhostRecommendationInstalled(result.ghost.manifest.id);
+ } catch {
+ log.warn('ghost recommendation install history unavailable');
+ }
+ }
+ return result;
+ });
},
);
ipcMain.handle('plugin-market:uninstall', (event, pluginId: unknown) => {
diff --git a/apps/desktop/src/preload/ghostPreload.ts b/apps/desktop/src/preload/ghostPreload.ts
index 7124d038b2..6ffe41392b 100644
--- a/apps/desktop/src/preload/ghostPreload.ts
+++ b/apps/desktop/src/preload/ghostPreload.ts
@@ -55,6 +55,8 @@ contextBridge.exposeInMainWorld('cindy', {
return () => listeners.delete(cb);
},
send: (payload: unknown): Promise<unknown> => ipcRenderer.invoke('ghost-pipe:send', payload),
+ recommendations: (items: unknown[]): Promise<unknown> =>
+ ipcRenderer.invoke('ghost-pipe:send', { type: 'recommendations-update', items }),
request: (req: Record<string, unknown>): Promise<unknown> =>
ipcRenderer.invoke('ghost-pipe:send', { ...req, type: 'host-request' }),
fetch: (req: Record<string, unknown>): Promise<unknown> =>
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index b80d9e0b07..93c4b29277 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -1144,6 +1144,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
// 意识仓库 (shared/ghost.ts)。listSync 走 sendSync:意识面板要与内置
// 面板同帧注册进布局引擎(规则 7 无跳变);目录扫描极小,同步读不卡启动。
ghosts: {
+ recommendationsSync: (): import('../shared/homePluginRecommendations').HomePluginRecommendationsSnapshot =>
+ ipcRenderer.sendSync('ghosts:recommendations'),
listSync: (): { ghosts: unknown[] } => ipcRenderer.sendSync('ghosts:list'),
recentUsageSync: (): { ids: string[] } => {
try {
diff --git a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
index a414e913ff..9b0df0b922 100644
--- a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
@@ -119,9 +119,7 @@ describe('NewMakerDraftRoute CREATE AGENT visual contract', () => {
expect(source).toContain('absolute right-0 top-[22px]');
// 快捷入口与输入框同宽(w-full 跟随父列 inputWidth),左右两缘对齐 ChatInput;
// 旧 800px 封顶在宽窗口下右缘短一截,2026-07-24 用户反馈后摘除。
- expect(source).toContain(
- '<HomeSuggestionList narrow={isDraftNarrow} onSelect={handleHomeSuggestion} />',
- );
+ expect(source).toMatch(/<HomeSuggestionList[\s\S]*?narrow=\{isDraftNarrow\}[\s\S]*?onSelect=\{handleHomeSuggestion\}[\s\S]*?onPluginSelect=\{handlePluginSuggestion\}/);
expect(source).toContain('<HomeZeroModelAction');
expect(source).not.toContain('ConnectProviderCard');
expect(source).not.toMatch(/data-testid="create-agent-quick-starts"/);
@@ -137,7 +135,7 @@ describe('NewMakerDraftRoute CREATE AGENT visual contract', () => {
);
for (const invariant of [
- 'onSend={handleComposerSend}',
+ 'onSend={handleSend}',
'onBeforeVoiceInputStart={handleBeforeVoiceInputStart}',
'externalDragOver={pageDragOver}',
'sessionId={undefined}',
@@ -190,27 +188,21 @@ describe('NewMakerDraftRoute CREATE AGENT visual contract', () => {
expect(source).not.toContain('boxShadow');
});
- it('clears a failed suggestion prompt before the next ordinary send', () => {
+ it('sends suggestions without first writing into the visible home composer', () => {
const suggestionBlock = source.slice(
source.indexOf('const handleHomeSuggestion'),
source.indexOf('// 注意:不要给 ChatInput 加 key 强制 remount'),
);
- expect(suggestionBlock).toContain('const pendingPrompt = prompt;');
- expect(suggestionBlock).toContain('pendingHomePromptRef.current = pendingPrompt;');
- expect(suggestionBlock).toContain(').finally(() => {');
- expect(suggestionBlock).toContain('if (pendingHomePromptRef.current === pendingPrompt)');
- expect(source).toContain('const payload = pendingHomePromptRef.current ?? message;');
-
- // 这就是回归场景:建议发送失败后,普通发送只能使用自己的文本。
- let pendingPrompt: string | null = '完整的建议 prompt';
- const ordinaryMessage = '用户随后输入的普通消息';
- const settledPrompt = pendingPrompt;
- if (pendingPrompt === settledPrompt) {
- pendingPrompt = null;
- }
- const payload = pendingPrompt ?? ordinaryMessage;
- expect(payload).toBe(ordinaryMessage);
+ expect(suggestionBlock).toContain('if (sendInFlightRef.current) return;');
+ expect(suggestionBlock).toMatch(/void handleSend\(\s*prompt,/);
+ expect(suggestionBlock).toContain('recoveryDraftDoc: plainTextToTiptapDoc(prompt)');
+ expect(suggestionBlock).not.toContain('saveComposerDraft(');
+ expect(suggestionBlock).not.toContain('quickStartTextToTiptapDoc(');
+ // 普通发送直接使用输入内容,不再经过可能残留推荐内容的中转 ref。
+ expect(source).toContain('onSend={handleSend}');
+ expect(source).not.toContain('pendingHomePromptRef');
+ expect(source).not.toContain('handleComposerSend');
});
it('keeps brand lockup tokens from the Figma slices', () => {
diff --git a/apps/desktop/src/renderer/__tests__/newMakerLocalFirstMessageSend.test.ts b/apps/desktop/src/renderer/__tests__/newMakerLocalFirstMessageSend.test.ts
index ffc8262a80..3092143a18 100644
--- a/apps/desktop/src/renderer/__tests__/newMakerLocalFirstMessageSend.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerLocalFirstMessageSend.test.ts
@@ -75,6 +75,12 @@ describe('NewMakerDraftRoute local first-message send', () => {
expect(fifoRestore).toBeGreaterThan(restore);
expect(fifoRestore).toBeLessThan(catchRestore);
expect(saveDraft).toBe(-1);
+ expect(source.slice(localSend, fifoRestore)).toContain(
+ 'const preNavDraftDoc = opts?.recoveryDraftDoc ?? preNavDraft?.text ?? null;',
+ );
+ expect(source.slice(fifoRestore, catchRestore)).toContain(
+ 'text: preNavDraftDoc ?? plainTextToTiptapDoc(message)',
+ );
expect(source.slice(localSend, fifoRestore)).toContain(
'rewriteBrowserCommentsFromRehomedFiles(',
);
diff --git a/apps/desktop/src/renderer/__tests__/newMakerWorktreeSend.test.ts b/apps/desktop/src/renderer/__tests__/newMakerWorktreeSend.test.ts
index 770501973c..a30f894966 100644
--- a/apps/desktop/src/renderer/__tests__/newMakerWorktreeSend.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerWorktreeSend.test.ts
@@ -89,6 +89,13 @@ describe('NewMakerDraftRoute worktree send flow', () => {
expect(restoreHelper).toBeGreaterThan(-1);
expect(saveDraft).toBeGreaterThan(failedCard);
expect(restoreText).toBeGreaterThan(restoreHelper);
+ const draftSnapshot = source.indexOf('const preNavDraft = getComposerDraft(');
+ expect(draftSnapshot).toBeGreaterThan(-1);
+ expect(draftSnapshot).toBeLessThan(restoreHelper);
+ expect(source.slice(draftSnapshot, restoreHelper)).toContain(
+ 'const preNavDraftDoc = opts?.recoveryDraftDoc ?? preNavDraft?.text ?? null;',
+ );
+ expect(source.slice(restoreHelper, restoreText)).toContain('text: preNavDraftDoc ??');
expect(source.slice(restoreHelper, restoreHelper + 500)).toContain(
'browserComments: rehomedComments',
);
diff --git a/apps/desktop/src/renderer/__tests__/pluginRecommendationRecovery.test.tsx b/apps/desktop/src/renderer/__tests__/pluginRecommendationRecovery.test.tsx
new file mode 100644
index 0000000000..ea076370f6
--- /dev/null
+++ b/apps/desktop/src/renderer/__tests__/pluginRecommendationRecovery.test.tsx
@@ -0,0 +1,106 @@
+/** @vitest-environment jsdom */
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { useCallback, useEffect, useRef, useState } from 'react';
+import { act, renderHook } from '@testing-library/react';
+import ts from 'typescript';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { expandGhostCommand } from '../cindy-brain/ghostCommand';
+import type { InstalledGhost } from '../../shared/ghost';
+
+// Execute the production callbacks without mounting the unrelated full desktop shell.
+function compile(source: string, bindings: Record<string, unknown>) {
+ const code = ts.transpileModule(source, {
+ compilerOptions: { target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.None },
+ }).outputText;
+ return new Function(...Object.keys(bindings), code)(...Object.values(bindings));
+}
+afterEach(() => vi.unstubAllGlobals());
+
+describe('plugin recommendation recovery', () => {
+ it.each(['mail', undefined])(
+ 'keeps the actual plugin-bound message in the retry draft (command=%s)',
+ async (command) => {
+ const source = readFileSync(
+ resolve(__dirname, '../features/cc-agent/NewMakerDraftRoute.tsx'),
+ 'utf8',
+ );
+ const block = source.slice(
+ source.indexOf(' const runPluginSuggestion ='),
+ source.indexOf(' const handlePluginSuggestion ='),
+ );
+ const suggestion = { id: 'one', pluginId: 'mail', prompt: 'Review my mail' };
+ const ghost = { manifest: { id: 'mail', name: 'Mail', command }, enabled: true };
+ const handleSend = vi.fn(async () => false);
+ vi.stubGlobal('electronAPI', {});
+ Object.assign(window, { electronAPI: { ghosts: { listSync: () => ({ ghosts: [ghost] }) } } });
+ const run = compile(`${block}\nreturn runPluginSuggestion;`, {
+ useCallback: (callback: unknown) => callback,
+ sendInFlightRef: { current: false },
+ pluginSuggestionFlight: { current: false },
+ pluginSuggestionMounted: { current: true },
+ currentPluginSuggestionContext: {
+ current: { generation: 1, dataOwnerId: 'owner', targetKey: 'local' },
+ },
+ readPluginRecommendationSnapshot: () => ({ ownerId: 'owner' }),
+ buildHomeTaskCatalog: () => [suggestion],
+ filterGhostsForWorkdir: (ghosts: unknown[]) => ghosts,
+ expandGhostCommand,
+ plainTextToTiptapDoc: (text: string) => ({ text }),
+ handleSend,
+ i18n: { language: 'en' },
+ t: () => 'Use plugin mail via ghost_info and ghost_call',
+ isRemoteProjectDraft: false,
+ isDeviceLinkDraft: false,
+ navigate: vi.fn(),
+ toast: { error: vi.fn() },
+ });
+ await run({ suggestion, ownerId: 'owner', targetKey: 'local', workingDir: '/project' });
+ expect(handleSend).toHaveBeenCalledOnce();
+ const [sent, , , , , , options] = handleSend.mock.calls[0] as unknown as [
+ string,
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ { recoveryDraftDoc: { text: string } },
+ ];
+ expect(sent).toContain(command ? '$mail' : 'ghost_info');
+ expect(expandGhostCommand(options.recoveryDraftDoc.text, [ghost as InstalledGhost])).toBe(
+ sent,
+ );
+ },
+ );
+
+ it('loads project overrides on entry and clears them when choosing global scope', () => {
+ const source = readFileSync(
+ resolve(__dirname, '../features/plugin/GhostPluginPage.tsx'),
+ 'utf8',
+ );
+ const block = source.slice(
+ source.indexOf(' const [scopeDir, setScopeDir]'),
+ source.indexOf(' const [recentGhostIds, setRecentGhostIds]'),
+ );
+ const workdirPrefsSync = vi.fn(() => ({ disabled: ['mail'] }));
+ vi.stubGlobal('electronAPI', { ghosts: { workdirPrefsSync } });
+ const useScope = compile(
+ `return function useScope() { ${block}\nreturn {scopeDir, projectDisabled, handlePickScope, effectiveEnabled}; }`,
+ {
+ useState,
+ useRef,
+ useEffect,
+ useCallback,
+ recommendation: { nonce: 'one', workingDir: '/project', suggestion: { pluginId: 'mail' } },
+ ghosts: [{ manifest: { id: 'mail' }, enabled: true }],
+ },
+ );
+ const { result } = renderHook(() => useScope());
+ expect(workdirPrefsSync).toHaveBeenCalledWith('/project');
+ expect(result.current.scopeDir).toBe('/project');
+ expect(result.current.effectiveEnabled('mail', true)).toBe(false);
+ act(() => result.current.handlePickScope(null));
+ expect(result.current.projectDisabled.size).toBe(0);
+ expect(result.current.effectiveEnabled('mail', true)).toBe(true);
+ });
+});
diff --git a/apps/desktop/src/renderer/features/cc-agent/HomeSuggestionList.tsx b/apps/desktop/src/renderer/features/cc-agent/HomeSuggestionList.tsx
index ebe2cac60f..50bc19245a 100644
--- a/apps/desktop/src/renderer/features/cc-agent/HomeSuggestionList.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/HomeSuggestionList.tsx
@@ -1,17 +1,27 @@
-import { useMemo, useState } from 'react';
+import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
AppWindow,
+ BookOpen,
+ CalendarCheck,
Code2,
+ Eye,
FileText,
FolderDown,
FolderGit2,
+ Folders,
+ Gamepad2,
Gauge,
Hammer,
HardDrive,
+ Images,
+ MessageSquarePlus,
+ Newspaper,
+ Puzzle,
Receipt,
Shuffle,
Sparkles,
+ TrendingUp,
Wallet,
Wifi,
X,
@@ -22,12 +32,16 @@ import { cn } from '@/lib/utils';
import {
type HomeSuggestionId,
- homeSuggestionBatch,
- homeSuggestionLabelKey,
isHomeSuggestionsHidden,
- nextHomeSuggestionBatch,
setHomeSuggestionsHidden,
} from './homeSuggestions';
+import {
+ buildHomeTaskCatalog,
+ nextHomeTaskBatch,
+ readPluginRecommendationSnapshot,
+ type HomeTaskBatch,
+ type HomeTaskSuggestion,
+} from './pluginHomeSuggestions';
const ICONS: Record<HomeSuggestionId, LucideIcon> = {
downloadsDesktop: FolderDown,
@@ -42,35 +56,70 @@ const ICONS: Record<HomeSuggestionId, LucideIcon> = {
diagnoseNetwork: Wifi,
subscriptionSpend: Receipt,
expenseTracker: Wallet,
+ stockDigest: TrendingUp,
+ morningBrief: Newspaper,
+ watchWebpage: Eye,
+ kidsGame: Gamepad2,
+ habitTracker: CalendarCheck,
+ organizeFolder: Folders,
+ photoTimeline: Images,
+ photoAlbumPage: Images,
+ exploreRepo: BookOpen,
+ initAgentDoc: FileText,
+ makePlugin: Puzzle,
+ sendFeedback: MessageSquarePlus,
+ readOwnSource: Code2,
};
export function HomeSuggestionList({
narrow,
onSelect,
+ onPluginSelect,
+ includePlugins = true,
}: {
narrow: boolean;
onSelect: (id: HomeSuggestionId) => void;
+ onPluginSelect?: (suggestion: HomeTaskSuggestion) => void;
+ includePlugins?: boolean;
}) {
- const { t } = useTranslation();
- const [batchIndex, setBatchIndex] = useState(0);
+ const { t, i18n } = useTranslation();
+ const batchSize = narrow ? 2 : 4;
+ const draw = (previous: HomeTaskBatch | null) => {
+ const snapshot = readPluginRecommendationSnapshot();
+ return nextHomeTaskBatch(
+ buildHomeTaskCatalog(
+ snapshot,
+ i18n?.resolvedLanguage ?? i18n?.language ?? 'en',
+ t,
+ includePlugins && !!onPluginSelect,
+ ),
+ snapshot,
+ previous,
+ batchSize,
+ );
+ };
+ const [batch, setBatch] = useState(() => draw(null));
const [hidden, setHidden] = useState(isHomeSuggestionsHidden);
- const batch = useMemo(() => homeSuggestionBatch(batchIndex), [batchIndex]);
- const visible = narrow ? batch.slice(0, 2) : batch;
+ if (batchSize > batch.displayedCount) {
+ setBatch({ ...batch, displayedCount: batchSize });
+ }
+ const visible = batch.items.slice(0, batchSize);
if (hidden) return null;
return (
<div data-testid="home-suggestions" className="group/sug mt-4 w-full">
<div className="flex flex-col items-start gap-px">
- {visible.map((id) => {
- const Icon = ICONS[id];
+ {visible.map((item) => {
+ const { id } = item;
+ const Icon = item.builtinId ? ICONS[item.builtinId] : Puzzle;
return (
<button
key={id}
type="button"
data-testid={`home-suggestion-${id}`}
- onClick={() => onSelect(id)}
+ onClick={() => (item.builtinId ? onSelect(item.builtinId) : onPluginSelect?.(item))}
className={cn(
'inline-flex h-[38px] max-w-full items-center gap-2.5 rounded-full px-3',
'text-14 text-[var(--text-secondary)] transition-colors',
@@ -78,7 +127,7 @@ export function HomeSuggestionList({
)}
>
<Icon size={16} strokeWidth={2} className="shrink-0 text-current" />
- <span className="min-w-0 truncate">{t(homeSuggestionLabelKey(id))}</span>
+ <span className="min-w-0 truncate">{item.label}</span>
</button>
);
})}
@@ -87,11 +136,11 @@ export function HomeSuggestionList({
<button
type="button"
data-testid="home-suggestions-shuffle"
- onClick={() => setBatchIndex((index) => nextHomeSuggestionBatch(index))}
+ onClick={() => setBatch((previous) => draw(previous))}
className={cn(
'inline-flex items-center gap-1 rounded-lg px-2 py-1 text-12',
- 'text-[var(--text-tertiary)] opacity-0 transition-opacity',
- 'group-hover/sug:opacity-100 hover:bg-[var(--surface-chip)] hover:text-[var(--text-primary)]',
+ 'text-[var(--text-secondary)] opacity-0 transition-opacity',
+ 'group-hover/sug:opacity-100 hover:bg-[var(--surface-hover)]',
)}
>
<Shuffle size={11} strokeWidth={2} />
@@ -106,8 +155,8 @@ export function HomeSuggestionList({
}}
className={cn(
'inline-flex items-center gap-1 rounded-lg px-2 py-1 text-12',
- 'text-[var(--text-tertiary)] opacity-0 transition-opacity',
- 'group-hover/sug:opacity-100 hover:bg-[var(--surface-chip)] hover:text-[var(--text-primary)]',
+ 'text-[var(--text-secondary)] opacity-0 transition-opacity',
+ 'group-hover/sug:opacity-100 hover:bg-[var(--surface-hover)]',
)}
>
<X size={11} strokeWidth={2} />
diff --git a/apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx b/apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx
index 99026ff9ea..df37e2954c 100644
--- a/apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx
@@ -124,7 +124,6 @@ import {
clearDraftAndNotify as clearComposerDraftAndNotify,
getDraft as getComposerDraft,
plainTextToTiptapDoc,
- quickStartTextToTiptapDoc,
restoreRemoteOptimisticDraft,
saveDraft as saveComposerDraft,
} from '@/lib/composerDraftStore';
@@ -173,11 +172,19 @@ import { CrossAgentConvertDialog } from '@/components/ui/cross-agent-convert-dia
import type { MakerVendor } from '@/lib/ccAgent.types';
import { ChevronDown, MessageSquare, MonitorSmartphone } from 'lucide-react';
import { HomeSuggestionList } from './HomeSuggestionList';
+import { type HomeSuggestionId, homeSuggestionPromptKey } from './homeSuggestions';
import {
- type HomeSuggestionId,
- homeSuggestionLabelKey,
- homeSuggestionPromptKey,
-} from './homeSuggestions';
+ buildHomeTaskCatalog,
+ readPluginRecommendationSnapshot,
+ type HomeTaskSuggestion,
+} from './pluginHomeSuggestions';
+import {
+ startPendingPluginSuggestion,
+ takePendingPluginSuggestion,
+ type PluginSuggestionRequest,
+} from './pendingPluginSuggestion';
+import { expandGhostCommand } from '@/cindy-brain/ghostCommand';
+import { filterGhostsForWorkdir } from '@/cindy-brain/ghostWorkdirFilter';
import type { Effort, PermissionMode } from '@/lib/userPreferences.types';
import {
categorizeByFilename,
@@ -625,7 +632,7 @@ interface DraftTargetRequest {
}
export function NewMakerDraftRoute() {
- const { t } = useTranslation();
+ const { t, i18n } = useTranslation();
const { dataOwnerId } = useAuth();
const draft = useNewMakerDraft();
const location = useLocation();
@@ -2976,7 +2983,6 @@ export function NewMakerDraftRoute() {
// ref 负责同步 guard,state 只负责驱动 UI 禁用;所有写入都经 markSendInFlight,
// 避免其中一半提前释放后让旧草稿目标被消费。
const sendInFlightRef = useRef(false);
- const pendingHomePromptRef = useRef<string | null>(null);
const [sendInFlight, setSendInFlight] = useState(false);
const markSendInFlight = useCallback((value: boolean) => {
sendInFlightRef.current = value;
@@ -3332,6 +3338,8 @@ export function NewMakerDraftRoute() {
agentReferences?: AgentInputReference[];
pastedTextRanges?: PastedTextRange[];
slashCommandRanges?: SlashCommandRange[];
+ // 推荐直接发送,不写首页草稿;失败时在新任务中恢复这份完整内容。
+ recoveryDraftDoc?: JSONContent;
onAccepted?: () => void;
},
): Promise<boolean | undefined> => {
@@ -3907,9 +3915,9 @@ export function NewMakerDraftRoute() {
// 里, route change 在那次 commit 同时发生,旧的 draft route 直接被 unmount,
// 不会暴露 cleared 后的视觉状态。clearFiles 仍然在 React 提交 unmount cleanup
// 之前同步执行,所以 useAttachments 的 cleanup 不会把刚送出去的附件回写到 store。
- // 保存原始 doc JSON(含 quickStartPill 等 mark),供 worktree 失败恢复时原样还原。
+ // 推荐恢复独立的完整内容;普通发送保留原始富文本,供 worktree 失败时还原。
const preNavDraft = getComposerDraft(NEW_MAKER_DRAFT_KEY);
- const preNavDraftDoc = preNavDraft?.text ?? null;
+ const preNavDraftDoc = opts?.recoveryDraftDoc ?? preNavDraft?.text ?? null;
const preNavBrowserComments = preNavDraft?.browserComments ?? [];
navigate(`/cc-agent/${newSession.id}`, { replace: true });
// clearDraftAndNotify (not bare clear): onSend returned false above
@@ -4198,7 +4206,7 @@ export function NewMakerDraftRoute() {
const rehydratedFiles = await rehomeDraftAttachments(files, newSession.id);
const sendWorkingDir = workingDir ?? newSession.workingDir;
const preNavDraft = getComposerDraft(NEW_MAKER_DRAFT_KEY);
- const preNavDraftDoc = preNavDraft?.text ?? null;
+ const preNavDraftDoc = opts?.recoveryDraftDoc ?? preNavDraft?.text ?? null;
const preNavBrowserComments = rewriteBrowserCommentsFromRehomedFiles(
preNavDraft?.browserComments,
rehydratedFiles,
@@ -4217,6 +4225,8 @@ export function NewMakerDraftRoute() {
const navigateToSession = () => {
navigate(orcaNavTarget ?? `/cc-agent/${newSession.id}`, {
replace: true,
+ // 新任务已发布到侧栏;同步提交详情,避免默认 transition 继续显示首页。
+ flushSync: true,
state: orcaWorkersRevealState
? { orcaWorkersReveal: orcaWorkersRevealState }
: undefined,
@@ -4280,11 +4290,7 @@ export function NewMakerDraftRoute() {
ranges: readonly T[] | undefined,
): T[] | undefined => {
if (!ranges) return undefined;
- return rebaseInlineRangesAfterSlashCommandRewrite(
- ranges,
- message,
- dispatchedMessage,
- );
+ return rebaseInlineRangesAfterSlashCommandRewrite(ranges, message, dispatchedMessage);
};
const sendPromise = makerChatStore.sendMessage(
newSession.id,
@@ -5031,36 +5037,10 @@ export function NewMakerDraftRoute() {
return proceed;
}, [vendorAuthGate]);
- const handleComposerSend = useCallback(
- (
- message: string,
- model: string,
- effort: Effort,
- permissionMode: PermissionMode,
- files?: Parameters<typeof handleSend>[4],
- mentions?: Parameters<typeof handleSend>[5],
- opts?: Parameters<typeof handleSend>[6],
- ) => {
- const payload = pendingHomePromptRef.current ?? message;
- pendingHomePromptRef.current = null;
- return handleSend(payload, model, effort, permissionMode, files, mentions, opts);
- },
- [handleSend],
- );
-
const handleHomeSuggestion = useCallback(
(id: HomeSuggestionId) => {
- const label = t(homeSuggestionLabelKey(id));
+ if (sendInFlightRef.current) return;
const prompt = t(homeSuggestionPromptKey(id));
- const currentDraft = getComposerDraft(NEW_MAKER_DRAFT_KEY);
- saveComposerDraft(NEW_MAKER_DRAFT_KEY, {
- text: quickStartTextToTiptapDoc(label),
- attachments: currentDraft?.attachments ?? attachmentState.attachments,
- quotes: currentDraft?.quotes,
- browserComments: currentDraft?.browserComments,
- });
- const pendingPrompt = prompt;
- pendingHomePromptRef.current = pendingPrompt;
void handleSend(
prompt,
draftInitialModel,
@@ -5068,14 +5048,11 @@ export function NewMakerDraftRoute() {
chatInitialPermissionMode,
attachmentState.attachments,
undefined,
- { providerId: chatInitialProviderId },
- ).finally(() => {
- // 清理失败路径上的完整 prompt,避免下一次普通发送被旧建议稿覆盖。
- // 用值校验保护连续点击两条建议时后一次 pending prompt。
- if (pendingHomePromptRef.current === pendingPrompt) {
- pendingHomePromptRef.current = null;
- }
- });
+ {
+ providerId: chatInitialProviderId,
+ recoveryDraftDoc: plainTextToTiptapDoc(prompt),
+ },
+ );
},
[
attachmentState.attachments,
@@ -5088,6 +5065,168 @@ export function NewMakerDraftRoute() {
],
);
+ const pluginSuggestionFlight = useRef(false);
+ const pluginSuggestionMounted = useRef(true);
+ useEffect(() => {
+ pluginSuggestionMounted.current = true;
+ return () => {
+ pluginSuggestionMounted.current = false;
+ };
+ }, []);
+ const pluginSuggestionTargetKey = JSON.stringify([
+ effectiveWorkingDir,
+ effectiveRemoteHostId,
+ isDeviceLinkDraft,
+ ]);
+ const currentPluginSuggestionContext = useRef({
+ dataOwnerId,
+ targetKey: pluginSuggestionTargetKey,
+ generation: 0,
+ });
+ if (
+ currentPluginSuggestionContext.current.dataOwnerId !== dataOwnerId ||
+ currentPluginSuggestionContext.current.targetKey !== pluginSuggestionTargetKey
+ ) {
+ currentPluginSuggestionContext.current = {
+ dataOwnerId,
+ targetKey: pluginSuggestionTargetKey,
+ generation: currentPluginSuggestionContext.current.generation + 1,
+ };
+ }
+
+ const runPluginSuggestion = useCallback(
+ async (request: PluginSuggestionRequest) => {
+ if (sendInFlightRef.current || pluginSuggestionFlight.current) return;
+ pluginSuggestionFlight.current = true;
+ try {
+ const { suggestion } = request;
+ const snapshot = readPluginRecommendationSnapshot();
+ const generation = currentPluginSuggestionContext.current.generation;
+ const stillCurrent = () =>
+ pluginSuggestionMounted.current &&
+ currentPluginSuggestionContext.current.generation === generation &&
+ currentPluginSuggestionContext.current.dataOwnerId === request.ownerId &&
+ currentPluginSuggestionContext.current.targetKey === request.targetKey;
+ if (
+ !stillCurrent() ||
+ snapshot.ownerId !== request.ownerId ||
+ isRemoteProjectDraft ||
+ isDeviceLinkDraft
+ )
+ return;
+ const current = buildHomeTaskCatalog(
+ snapshot,
+ i18n.resolvedLanguage ?? i18n.language,
+ t,
+ ).find((x) => x.id === suggestion.id);
+ if (!current || current.prompt !== suggestion.prompt) {
+ toast.info(t('newChat.pluginSuggestions.changed'));
+ return;
+ }
+ const ghost = window.electronAPI.ghosts
+ .listSync()
+ .ghosts.find((g) => g.manifest.id === suggestion.pluginId);
+ const usable =
+ ghost && ghost.enabled && filterGhostsForWorkdir([ghost], request.workingDir).length > 0;
+ if (!usable) {
+ let route: string;
+ if (ghost) {
+ route = `/plugins?ghost=${encodeURIComponent(ghost.manifest.id)}`;
+ } else {
+ const market = await window.electronAPI.pluginMarket.snapshot();
+ if (!stillCurrent() || readPluginRecommendationSnapshot().ownerId !== request.ownerId)
+ return;
+ const matches = market.items.filter(
+ (item) => item.ghostId === suggestion.pluginId && item.installState !== 'conflict',
+ );
+ // Do not silently choose between competing publishers/sources with the same id.
+ if (matches.length !== 1) {
+ toast.info(t('newChat.pluginSuggestions.unavailable'));
+ return;
+ }
+ route = `/plugins?market=${encodeURIComponent(matches[0].pluginId)}`;
+ }
+ if (!stillCurrent()) return;
+ const nonce = startPendingPluginSuggestion(request);
+ navigate(`${route}&recommendation=${encodeURIComponent(nonce)}`);
+ return;
+ }
+ const recoveryPrompt = ghost.manifest.command
+ ? `$${ghost.manifest.command} ${suggestion.prompt}`
+ : `${suggestion.prompt}\n\n${t('newChat.pluginSuggestions.usePlugin', { name: ghost.manifest.name, id: ghost.manifest.id })}`;
+ // Retry goes through ChatInput, which expands $commands itself.
+ const prompt = ghost.manifest.command
+ ? expandGhostCommand(recoveryPrompt, [ghost])
+ : recoveryPrompt;
+ await handleSend(
+ prompt,
+ request.model,
+ request.effort,
+ request.permissionMode,
+ request.files,
+ undefined,
+ {
+ providerId: request.providerId,
+ recoveryDraftDoc: plainTextToTiptapDoc(recoveryPrompt),
+ onAccepted: () => {
+ void window.electronAPI.ghosts.markUsed(ghost.manifest.id).catch(() => undefined);
+ },
+ },
+ );
+ } catch {
+ if (pluginSuggestionMounted.current)
+ toast.error(t('newChat.pluginSuggestions.unavailable'));
+ } finally {
+ pluginSuggestionFlight.current = false;
+ }
+ },
+ [
+ handleSend,
+ i18n.language,
+ i18n.resolvedLanguage,
+ isDeviceLinkDraft,
+ isRemoteProjectDraft,
+ navigate,
+ t,
+ ],
+ );
+
+ const handlePluginSuggestion = useCallback(
+ (suggestion: HomeTaskSuggestion) => {
+ if (!dataOwnerId) return;
+ void runPluginSuggestion({
+ suggestion,
+ ownerId: dataOwnerId,
+ targetKey: pluginSuggestionTargetKey,
+ workingDir: effectiveWorkingDir,
+ model: draftInitialModel,
+ effort: (draftInitialEffort ?? 'medium') as Effort,
+ permissionMode: chatInitialPermissionMode,
+ providerId: chatInitialProviderId,
+ files: attachmentState.attachments,
+ });
+ },
+ [
+ attachmentState.attachments,
+ chatInitialPermissionMode,
+ chatInitialProviderId,
+ dataOwnerId,
+ draftInitialEffort,
+ draftInitialModel,
+ effectiveWorkingDir,
+ pluginSuggestionTargetKey,
+ runPluginSuggestion,
+ ],
+ );
+
+ useEffect(() => {
+ const nonce = (location.state as { pluginSuggestionNonce?: unknown } | null)
+ ?.pluginSuggestionNonce;
+ if (typeof nonce !== 'string') return;
+ const request = takePendingPluginSuggestion(nonce, dataOwnerId, pluginSuggestionTargetKey);
+ if (request) void runPluginSuggestion(request);
+ }, [dataOwnerId, location.state, pluginSuggestionTargetKey, runPluginSuggestion]);
+
// 注意:不要给 ChatInput 加 key 强制 remount。ChatInput 内部 activeModel /
// activeEffort / activePermissionMode 都是每次 render 直接从 props 派生
// (见 ChatInput.tsx 第 459 行注释 "derive directly from props every render"),
@@ -5304,7 +5443,7 @@ export function NewMakerDraftRoute() {
>
<div className="w-full">
<ChatInput
- onSend={handleComposerSend}
+ onSend={handleSend}
onBeforeVoiceInputStart={handleBeforeVoiceInputStart}
externalDragOver={pageDragOver}
visualVariant="create-agent"
@@ -5477,7 +5616,13 @@ export function NewMakerDraftRoute() {
{/* 用户 2026-09-06 重申撤掉首页订阅/赠送告知卡,见 DESIGN.md §1.1。
有模型时直接显示建议行;账号与余额详情继续在设置页查看。 */}
{!showProviderOnboardingCard && (
- <HomeSuggestionList narrow={isDraftNarrow} onSelect={handleHomeSuggestion} />
+ <HomeSuggestionList
+ key={`${dataOwnerId}:${isRemoteProjectDraft || isDeviceLinkDraft}:${i18n.resolvedLanguage ?? i18n.language}`}
+ narrow={isDraftNarrow}
+ onSelect={handleHomeSuggestion}
+ includePlugins={!isRemoteProjectDraft && !isDeviceLinkDraft}
+ onPluginSelect={handlePluginSuggestion}
+ />
)}
{/* 首页「新建目标」弹窗:无 sessionId → onCreate 建会话并 setGoal(见 handleCreateGoal)。
initialObjective = 点「新建目标」时输入框里已有的文字。 */}
diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/HomeSuggestionList.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/HomeSuggestionList.test.tsx
new file mode 100644
index 0000000000..03783d0d6b
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/HomeSuggestionList.test.tsx
@@ -0,0 +1,75 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import React from 'react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { HomeSuggestionList } from '../HomeSuggestionList';
+import { HOME_SUGGESTION_CATALOG, HOME_SUGGESTION_IDS } from '../homeSuggestions';
+
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+
+beforeEach(() => localStorage.clear());
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe('HomeSuggestionList', () => {
+ it.each([false, true])(
+ 'shows distinct categories and reaches every topic through shuffle (narrow=%s)',
+ (narrow) => {
+ const onSelect = vi.fn();
+ render(<HomeSuggestionList narrow={narrow} onSelect={onSelect} />);
+ const seen = new Set<string>();
+ let previousIds: string[] = [];
+ // A full catalog-length run is an upper bound even if only one new topic fits per batch.
+ for (let index = 0; index < HOME_SUGGESTION_IDS.length; index++) {
+ const rows = screen.getAllByTestId(/^home-suggestion-/);
+ expect(rows).toHaveLength(narrow ? 2 : 4);
+ const ids = rows.map((row) =>
+ row.getAttribute('data-testid')!.replace('home-suggestion-', ''),
+ );
+ expect(ids.some((id) => previousIds.includes(id))).toBe(false);
+ previousIds = ids;
+ ids.forEach((id) => seen.add(id));
+ const categories = ids.map(
+ (id) => HOME_SUGGESTION_CATALOG.find((entry) => entry.id === id)!.category,
+ );
+ expect(new Set(categories).size).toBe(rows.length);
+ fireEvent.click(rows[0]);
+ expect(onSelect).toHaveBeenLastCalledWith(ids[0]);
+ fireEvent.click(screen.getByTestId('home-suggestions-shuffle'));
+ }
+ expect(seen).toEqual(new Set(HOME_SUGGESTION_IDS));
+ },
+ );
+
+ it('keeps the visible batch stable through rerenders and width changes', () => {
+ const onSelect = vi.fn();
+ const { rerender } = render(<HomeSuggestionList narrow={false} onSelect={onSelect} />);
+ const ids = () =>
+ screen.getAllByTestId(/^home-suggestion-/).map((row) => row.getAttribute('data-testid'));
+ const wide = ids();
+ rerender(<HomeSuggestionList narrow={false} onSelect={vi.fn()} />);
+ expect(ids()).toEqual(wide);
+ rerender(<HomeSuggestionList narrow onSelect={onSelect} />);
+ expect(ids()).toEqual(wide.slice(0, 2));
+ rerender(<HomeSuggestionList narrow={false} onSelect={onSelect} />);
+ expect(ids()).toEqual(wide);
+ });
+
+ it('does not forget topics exposed by expanding and then shrinking the window', () => {
+ vi.spyOn(Math, 'random').mockReturnValue(0);
+ const onSelect = vi.fn();
+ const { rerender } = render(<HomeSuggestionList narrow onSelect={onSelect} />);
+ const ids = () =>
+ screen.getAllByTestId(/^home-suggestion-/).map((row) => row.getAttribute('data-testid'));
+ rerender(<HomeSuggestionList narrow={false} onSelect={onSelect} />);
+ const seen = ids();
+ rerender(<HomeSuggestionList narrow onSelect={onSelect} />);
+ fireEvent.click(screen.getByTestId('home-suggestions-shuffle'));
+ rerender(<HomeSuggestionList narrow={false} onSelect={onSelect} />);
+ expect(ids().some((id) => seen.includes(id))).toBe(false);
+ });
+});
diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/homeSuggestions.test.ts b/apps/desktop/src/renderer/features/cc-agent/__tests__/homeSuggestions.test.ts
index 90f5bbde79..49ef316cea 100644
--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/homeSuggestions.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/homeSuggestions.test.ts
@@ -1,14 +1,15 @@
+import { readFileSync } from 'node:fs';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import {
- HOME_SUGGESTION_BATCH_COUNT,
HOME_SUGGESTION_BATCH_SIZE,
+ HOME_SUGGESTION_CATALOG,
HOME_SUGGESTION_IDS,
- homeSuggestionBatch,
homeSuggestionLabelKey,
homeSuggestionPromptKey,
isHomeSuggestionsHidden,
nextHomeSuggestionBatch,
+ selectHomeSuggestionBatch,
setHomeSuggestionsHidden,
} from '../homeSuggestions';
@@ -32,17 +33,160 @@ describe('homeSuggestions', () => {
vi.unstubAllGlobals();
});
- it('keeps three batches of four and cycles', () => {
- expect(HOME_SUGGESTION_IDS).toHaveLength(12);
- expect(HOME_SUGGESTION_BATCH_COUNT).toBe(3);
- expect(homeSuggestionBatch(0)).toEqual(HOME_SUGGESTION_IDS.slice(0, 4));
- expect(homeSuggestionBatch(1)).toEqual(HOME_SUGGESTION_IDS.slice(4, 8));
- expect(homeSuggestionBatch(2)).toEqual(HOME_SUGGESTION_IDS.slice(8, 12));
- expect(homeSuggestionBatch(3)).toEqual(homeSuggestionBatch(0));
- expect(nextHomeSuggestionBatch(2)).toBe(0);
+ it('provides the reviewed 25 topics across eight broad categories', () => {
+ expect(HOME_SUGGESTION_IDS).toHaveLength(25);
+ expect(new Set(HOME_SUGGESTION_IDS).size).toBe(25);
+ expect(new Set(HOME_SUGGESTION_CATALOG.map(({ category }) => category)).size).toBe(8);
expect(HOME_SUGGESTION_BATCH_SIZE).toBe(4);
});
+ it.each([2, 4] as const)(
+ 'draws %i distinct visible categories without adjacent repeats or hidden-topic starvation',
+ (size) => {
+ for (const seed of [0, 1, 42, 2026]) {
+ let value = seed;
+ const random = () => {
+ value = (Math.imul(value, 1664525) + 1013904223) >>> 0;
+ return value / 2 ** 32;
+ };
+ let state = nextHomeSuggestionBatch(null, size, random);
+ const seen = new Set<string>();
+ for (let index = 0; index < HOME_SUGGESTION_IDS.length; index++) {
+ const visible = state.ids.slice(0, size);
+ expect(visible).toHaveLength(size);
+ const categories = visible.map(
+ (id) => HOME_SUGGESTION_CATALOG.find((entry) => entry.id === id)!.category,
+ );
+ expect(new Set(categories).size).toBe(size);
+ visible.forEach((id) => seen.add(id));
+ const next = nextHomeSuggestionBatch(state, size, random);
+ expect(next.ids.some((id) => visible.includes(id))).toBe(false);
+ state = next;
+ }
+ expect(seen).toEqual(new Set(HOME_SUGGESTION_IDS));
+ }
+ },
+ );
+
+ it('randomizes fresh openings instead of using a fixed first batch', () => {
+ const first = nextHomeSuggestionBatch(null, 4, () => 0);
+ const another = nextHomeSuggestionBatch(null, 4, () => 0.999);
+ expect(first.ids).not.toEqual(another.ids);
+ expect(first.seenIds).toEqual([]);
+ });
+
+ it('counts only visible topics as seen on narrow screens', () => {
+ const previous = nextHomeSuggestionBatch(null, 2, () => 0);
+ const next = nextHomeSuggestionBatch(previous, 2, () => 0.999);
+ expect(next.seenIds).toEqual(previous.ids.slice(0, 2));
+ });
+
+ it('remembers all four topics after shrinking a previously wide batch', () => {
+ const previous = nextHomeSuggestionBatch(null, 4, () => 0);
+ const next = nextHomeSuggestionBatch(previous, 2, () => 0);
+ expect(next.seenIds).toEqual(previous.ids);
+ expect(next.ids.some((id) => previous.ids.includes(id))).toBe(false);
+ expect(next.displayedCount).toBe(2);
+ });
+
+ it('prioritizes the last unseen topic and resets history after all topics have been shown', () => {
+ const previous = {
+ ids: HOME_SUGGESTION_IDS.slice(0, 4),
+ seenIds: HOME_SUGGESTION_IDS.filter((id) => id !== 'photoAlbumPage'),
+ displayedCount: 4 as const,
+ };
+ expect(nextHomeSuggestionBatch(previous, 4, () => 0).ids[0]).toBe('photoAlbumPage');
+ const reset = nextHomeSuggestionBatch(
+ { ...previous, seenIds: [...HOME_SUGGESTION_IDS] },
+ 4,
+ () => 0,
+ );
+ expect(reset.seenIds).toEqual([]);
+ expect(reset.ids.some((id) => previous.ids.includes(id))).toBe(false);
+ });
+
+ it.each(['zh-CN', 'zh-TW', 'en', 'ja', 'ko'])(
+ 'has a complete localized title and prompt for every topic in %s',
+ (locale) => {
+ const resource = JSON.parse(
+ readFileSync(
+ new URL(`../../../i18n/locales/${locale}/common.json`, import.meta.url),
+ 'utf8',
+ ),
+ );
+ const catalog = resource.newChat.homeSuggestions;
+ expect(
+ Object.keys(catalog)
+ .filter((key) => !['shuffle', 'dismiss'].includes(key))
+ .sort(),
+ ).toEqual([...HOME_SUGGESTION_IDS].sort());
+ for (const id of HOME_SUGGESTION_IDS) {
+ expect(catalog[id].label.trim().length).toBeGreaterThan(0);
+ expect(catalog[id].prompt.trim().length).toBeGreaterThan(0);
+ }
+ expect(catalog.stockDigest.prompt).toContain('2400.HK');
+ },
+ );
+
+ it('applies category and plugin quotas independently', () => {
+ const candidates = [
+ { id: 'mail:inbox', category: 'email', pluginId: 'mail' },
+ { id: 'mail:receipts', category: 'documents', pluginId: 'mail' },
+ { id: 'other-mail:reply', category: 'email', pluginId: 'other-mail' },
+ { id: 'summarize', category: 'documents' },
+ { id: 'cleanup', category: 'computer' },
+ { id: 'build', category: 'create' },
+ ];
+ expect(selectHomeSuggestionBatch(candidates).map(({ id }) => id)).toEqual([
+ 'mail:inbox',
+ 'summarize',
+ 'cleanup',
+ 'build',
+ ]);
+ });
+
+ it.each([2, 4] as const)('counts a pinned new plugin against both quotas at size %i', (size) => {
+ const candidates = [
+ { id: 'old-mail:reply', category: 'email', pluginId: 'old-mail' },
+ { id: 'new-mail:receipts', category: 'documents', pluginId: 'new-mail' },
+ { id: 'summarize', category: 'documents' },
+ { id: 'cleanup', category: 'computer' },
+ { id: 'build', category: 'create' },
+ { id: 'new-mail:inbox', category: 'email', pluginId: 'new-mail' },
+ ];
+ expect(
+ selectHomeSuggestionBatch(candidates, { size, pinnedId: 'new-mail:inbox' }).map(
+ ({ id }) => id,
+ ),
+ ).toEqual(['new-mail:inbox', 'summarize', 'cleanup', 'build'].slice(0, size));
+ });
+
+ it('applies the same quotas when filling a short batch from earlier suggestions', () => {
+ expect(
+ selectHomeSuggestionBatch([{ id: 'mail:inbox', category: 'email', pluginId: 'mail' }], {
+ fallback: [
+ { id: 'mail:receipts', category: 'documents', pluginId: 'mail' },
+ { id: 'other-mail:reply', category: 'email', pluginId: 'other-mail' },
+ { id: 'files:summarize', category: 'documents', pluginId: 'files' },
+ ],
+ }).map(({ id }) => id),
+ ).toEqual(['mail:inbox', 'files:summarize']);
+ });
+
+ it('does not relax quotas to fill the batch when only one category is available', () => {
+ const candidates = HOME_SUGGESTION_CATALOG.filter(({ category }) => category === 'computer');
+ expect(selectHomeSuggestionBatch(candidates)).toEqual([candidates[0]]);
+ expect(selectHomeSuggestionBatch([])).toEqual([]);
+ });
+
+ it('ignores withdrawn pins and does not mutate the ranked pool', () => {
+ const candidates = Object.freeze([
+ { id: 'cleanup', category: 'computer' },
+ { id: 'build', category: 'create' },
+ ]);
+ expect(selectHomeSuggestionBatch(candidates, { pinnedId: 'removed' })).toEqual(candidates);
+ });
+
it('builds i18n keys for the visible line and the submitted prompt', () => {
expect(homeSuggestionLabelKey('whySlow')).toBe('newChat.homeSuggestions.whySlow.label');
expect(homeSuggestionPromptKey('whySlow')).toBe('newChat.homeSuggestions.whySlow.prompt');
diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/pendingPluginSuggestion.test.ts b/apps/desktop/src/renderer/features/cc-agent/__tests__/pendingPluginSuggestion.test.ts
new file mode 100644
index 0000000000..4c1d9b54ee
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/pendingPluginSuggestion.test.ts
@@ -0,0 +1,55 @@
+import { beforeEach, describe, expect, it } from 'vitest';
+import {
+ cancelPendingPluginSuggestion,
+ getPendingPluginSuggestion,
+ readyPendingPluginSuggestion,
+ startPendingPluginSuggestion,
+ takePendingPluginSuggestion,
+ type PluginSuggestionRequest,
+} from '../pendingPluginSuggestion';
+const request: PluginSuggestionRequest = {
+ ownerId: 'a',
+ targetKey: 'local',
+ workingDir: null,
+ model: 'test',
+ effort: 'medium',
+ permissionMode: 'default',
+ files: [],
+ suggestion: {
+ id: 'plugin:test:one',
+ category: 'email',
+ label: 'Mail',
+ prompt: 'My full prompt',
+ pluginId: 'test',
+ },
+};
+beforeEach(() => cancelPendingPluginSuggestion());
+describe('installation continuation', () => {
+ it('preserves the full task and consumes it exactly once only after successful setup action', () => {
+ const nonce = startPendingPluginSuggestion(request);
+ expect(readyPendingPluginSuggestion(nonce, 'a', 'other')).toBeNull();
+ expect(readyPendingPluginSuggestion(nonce, 'a', 'test')).toBe(nonce);
+ expect(takePendingPluginSuggestion(nonce, 'a', 'local')?.suggestion.prompt).toBe(
+ 'My full prompt',
+ );
+ expect(takePendingPluginSuggestion(nonce, 'a', 'local')).toBeNull();
+ });
+ it('ignores completion after cancellation or after another selection', () => {
+ const old = startPendingPluginSuggestion(request);
+ cancelPendingPluginSuggestion(old);
+ expect(readyPendingPluginSuggestion(old, 'a', 'test')).toBeNull();
+ const next = startPendingPluginSuggestion({
+ ...request,
+ suggestion: { ...request.suggestion, prompt: 'New' },
+ });
+ expect(readyPendingPluginSuggestion(old, 'a', 'test')).toBeNull();
+ expect(getPendingPluginSuggestion()?.nonce).toBe(next);
+ });
+ it('does not resume under another owner or a changed execution target', () => {
+ const nonce = startPendingPluginSuggestion(request);
+ expect(readyPendingPluginSuggestion(nonce, 'b', 'test')).toBeNull();
+ readyPendingPluginSuggestion(nonce, 'a', 'test');
+ expect(takePendingPluginSuggestion(nonce, 'a', 'remote')).toBeNull();
+ expect(getPendingPluginSuggestion()).toBeNull();
+ });
+});
diff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/pluginHomeSuggestions.test.ts b/apps/desktop/src/renderer/features/cc-agent/__tests__/pluginHomeSuggestions.test.ts
new file mode 100644
index 0000000000..4f856c6159
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/pluginHomeSuggestions.test.ts
@@ -0,0 +1,119 @@
+import { describe, expect, it } from 'vitest';
+import type { HomePluginRecommendationsSnapshot } from '../../../../shared/homePluginRecommendations';
+import {
+ buildHomeTaskCatalog,
+ nextHomeTaskBatch,
+ pluginSuggestionCategory,
+ type HomeTaskBatch,
+} from '../pluginHomeSuggestions';
+
+const empty: HomePluginRecommendationsSnapshot = {
+ ownerId: 'a',
+ sources: [],
+ recentIds: [],
+ newlyInstalledId: null,
+};
+const task = { id: 'one', label: 'Review email', prompt: 'Review email' };
+const t = (key: string) => key;
+function random(seed: number) {
+ return () => {
+ seed = (seed * 1664525 + 1013904223) >>> 0;
+ return seed / 4294967296;
+ };
+}
+
+describe('host plugin recommendation selection', () => {
+ it('includes curated installation tasks and respects an explicit empty author catalog', () => {
+ expect(buildHomeTaskCatalog(empty, 'en', t).filter((x) => x.needsInstall)).toHaveLength(3);
+ const snapshot = {
+ ...empty,
+ sources: [{ ghostId: 'google-gmail', name: 'Gmail', enabled: true, items: [] }],
+ };
+ expect(buildHomeTaskCatalog(snapshot, 'en', t)).toHaveLength(25);
+ expect(buildHomeTaskCatalog({ ...empty, ownerId: null }, 'en', t)).toHaveLength(25);
+ expect(buildHomeTaskCatalog(empty, 'en', t, false)).toHaveLength(25);
+ });
+ it('uses broad host categories across publishers', () => {
+ expect(pluginSuggestionCategory(task)).toBe('email');
+ expect(pluginSuggestionCategory({ ...task, label: '整理邮件' })).toBe('email');
+ expect(
+ pluginSuggestionCategory({ ...task, label: 'Unknown workflow', prompt: 'Help me' }),
+ ).toBe('pluginTasks');
+ expect(
+ pluginSuggestionCategory({ ...task, label: '审查未提交改动', prompt: 'Review my changes' }),
+ ).toBe('development');
+ });
+ it('pins a new install and never doubles a category or a plugin, including fallback', () => {
+ const snapshot = {
+ ...empty,
+ newlyInstalledId: 'new-mail',
+ sources: [
+ { ghostId: 'new-mail', name: 'New', enabled: true, items: [task] },
+ { ghostId: 'other-mail', name: 'Other', enabled: true, items: [task] },
+ ],
+ };
+ const catalog = buildHomeTaskCatalog(snapshot, 'en', t);
+ let batch: HomeTaskBatch | null = null;
+ const rng = random(123);
+ for (let i = 0; i < 40; i++) {
+ batch = nextHomeTaskBatch(catalog, snapshot, batch, 4, rng);
+ expect(batch.items[0].pluginId).toBe('new-mail');
+ expect(new Set(batch.items.map((x) => x.category)).size).toBe(4);
+ const plugins = batch.items.flatMap((x) => (x.pluginId ? [x.pluginId] : []));
+ expect(new Set(plugins).size).toBe(plugins.length);
+ expect(batch.items.filter((x) => x.needsInstall).length).toBeLessThanOrEqual(1);
+ expect(batch.items.some((x) => x.builtinId)).toBe(true);
+ }
+ });
+ it('does not multiply source tickets when a plugin contributes more tasks', () => {
+ const count = (many: boolean) => {
+ const sources = ['one', 'two'].map((ghostId) => ({
+ ghostId,
+ name: ghostId,
+ enabled: true,
+ items: Array.from({ length: many && ghostId === 'one' ? 24 : 1 }, (_, i) => ({
+ ...task,
+ id: `task-${i}`,
+ })),
+ }));
+ const snapshot = { ...empty, sources };
+ const catalog = buildHomeTaskCatalog(snapshot, 'en', t);
+ const counts = { one: 0, two: 0 };
+ const rng = random(2026);
+ for (let i = 0; i < 1200; i++)
+ for (const item of nextHomeTaskBatch(catalog, snapshot, null, 4, rng).items)
+ if (item.pluginId === 'one' || item.pluginId === 'two') counts[item.pluginId]++;
+ return counts;
+ };
+ const counts = count(true);
+ expect(Math.abs(counts.one - counts.two)).toBeLessThan(100);
+ expect(counts.one).toBeGreaterThan(100);
+ });
+ it('filters withdrawn ids and keeps unseen/adjacent rules for ordinary batches', () => {
+ const snapshot = {
+ ...empty,
+ sources: [
+ { ghostId: 'work', name: 'Work', enabled: true, items: [task, { ...task, id: 'two' }] },
+ ],
+ };
+ const catalog = buildHomeTaskCatalog(snapshot, 'en', t);
+ const rng = random(21);
+ let batch: HomeTaskBatch | null = null;
+ const seen = new Set<string>();
+ for (let i = 0; i < 60; i++) {
+ const next = nextHomeTaskBatch(catalog, snapshot, batch, 4, rng);
+ expect(next.items.some((x) => batch?.items.some((y) => x.id === y.id))).toBe(false);
+ next.items.forEach((x) => seen.add(x.id));
+ batch = next;
+ }
+ expect(seen.size).toBe(catalog.length);
+ const next = nextHomeTaskBatch(
+ catalog.filter((x) => !x.pluginId),
+ empty,
+ batch,
+ 4,
+ rng,
+ );
+ expect(next.items.every((x) => !x.pluginId)).toBe(true);
+ });
+});
diff --git a/apps/desktop/src/renderer/features/cc-agent/homeSuggestions.ts b/apps/desktop/src/renderer/features/cc-agent/homeSuggestions.ts
index a3a96a69b3..47885785f8 100644
--- a/apps/desktop/src/renderer/features/cc-agent/homeSuggestions.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/homeSuggestions.ts
@@ -1,24 +1,138 @@
export const HOME_SUGGESTION_BATCH_SIZE = 4;
export const HOME_SUGGESTIONS_HIDDEN_KEY = 'cindy.homeSuggestions.hidden';
-export const HOME_SUGGESTION_IDS = [
- 'downloadsDesktop',
- 'whatCindyCanDo',
- 'recentDocs',
- 'listCodeProjects',
- 'storageUsage',
- 'unusedApps',
- 'uncommittedChanges',
- 'devEnvironment',
- 'whySlow',
- 'diagnoseNetwork',
- 'subscriptionSpend',
- 'expenseTracker',
+// Broad user scenarios, not individual actions such as cleanup/diagnose/organize.
+export const HOME_SUGGESTION_CATALOG = [
+ { id: 'storageUsage', category: 'computer' },
+ { id: 'whySlow', category: 'computer' },
+ { id: 'downloadsDesktop', category: 'computer' },
+ { id: 'diagnoseNetwork', category: 'computer' },
+ { id: 'unusedApps', category: 'computer' },
+ { id: 'stockDigest', category: 'automation' },
+ { id: 'morningBrief', category: 'automation' },
+ { id: 'watchWebpage', category: 'automation' },
+ { id: 'expenseTracker', category: 'create' },
+ { id: 'kidsGame', category: 'create' },
+ { id: 'habitTracker', category: 'create' },
+ { id: 'recentDocs', category: 'documents' },
+ { id: 'subscriptionSpend', category: 'documents' },
+ { id: 'organizeFolder', category: 'documents' },
+ { id: 'photoTimeline', category: 'photos' },
+ { id: 'photoAlbumPage', category: 'photos' },
+ { id: 'uncommittedChanges', category: 'development' },
+ { id: 'exploreRepo', category: 'development' },
+ { id: 'initAgentDoc', category: 'development' },
+ { id: 'listCodeProjects', category: 'development' },
+ { id: 'devEnvironment', category: 'development' },
+ { id: 'makePlugin', category: 'cindy' },
+ { id: 'sendFeedback', category: 'cindy' },
+ { id: 'readOwnSource', category: 'cindy' },
+ { id: 'whatCindyCanDo', category: 'discovery' },
] as const;
-export type HomeSuggestionId = (typeof HOME_SUGGESTION_IDS)[number];
+export type HomeSuggestionId = (typeof HOME_SUGGESTION_CATALOG)[number]['id'];
+export const HOME_SUGGESTION_IDS = HOME_SUGGESTION_CATALOG.map(({ id }) => id);
-export const HOME_SUGGESTION_BATCH_COUNT = HOME_SUGGESTION_IDS.length / HOME_SUGGESTION_BATCH_SIZE;
+export interface HomeSuggestionCandidate {
+ /** Globally unique identity and broad category assigned by the host. */
+ id: string;
+ category: string;
+ pluginId?: string;
+ needsInstall?: boolean;
+}
+
+/** Candidates arrive in host priority order; every position shares the same quotas. */
+export function selectHomeSuggestionBatch<T extends HomeSuggestionCandidate>(
+ candidates: readonly T[],
+ {
+ size = HOME_SUGGESTION_BATCH_SIZE,
+ pinnedId,
+ fallback = [],
+ }: { size?: 2 | 4; pinnedId?: string; fallback?: readonly T[] } = {},
+): T[] {
+ const selected: T[] = [];
+ const ids = new Set<string>();
+ const categories = new Set<string>();
+ const plugins = new Set<string>();
+ let installGuideSelected = false;
+ // A withdrawn candidate cannot be revived just because its old ID was pinned.
+ const pinned = candidates.find(({ id }) => id === pinnedId);
+ for (const candidate of [...(pinned ? [pinned] : []), ...candidates, ...fallback]) {
+ if (
+ ids.has(candidate.id) ||
+ categories.has(candidate.category) ||
+ (candidate.pluginId !== undefined && plugins.has(candidate.pluginId)) ||
+ (candidate.needsInstall === true && installGuideSelected)
+ ) {
+ continue;
+ }
+ selected.push(candidate);
+ ids.add(candidate.id);
+ categories.add(candidate.category);
+ if (candidate.pluginId !== undefined) plugins.add(candidate.pluginId);
+ if (candidate.needsInstall) installGuideSelected = true;
+ if (selected.length === size) break;
+ }
+ return selected;
+}
+
+export function shuffled<T>(items: readonly T[], random: () => number): T[] {
+ const result = [...items];
+ for (let i = result.length - 1; i > 0; i--) {
+ const j = Math.floor(random() * (i + 1));
+ [result[i], result[j]] = [result[j], result[i]];
+ }
+ return result;
+}
+
+/** Give each category an equal draw, regardless of how many topics it contains. */
+export function randomCategoryOrder<T extends HomeSuggestionCandidate>(
+ candidates: readonly T[],
+ random: () => number,
+): T[] {
+ const groups = new Map<string, T[]>();
+ for (const candidate of candidates) {
+ const group = groups.get(candidate.category) ?? [];
+ group.push(candidate);
+ groups.set(candidate.category, group);
+ }
+ return shuffled([...groups.values()], random).flatMap((group) => shuffled(group, random));
+}
+
+export interface HomeSuggestionBatchState {
+ ids: HomeSuggestionId[];
+ seenIds: HomeSuggestionId[];
+ /** Largest number of rows displayed in this batch, even after shrinking the window. */
+ displayedCount: 2 | 4;
+}
+
+/** Random draws, with unseen topics first and the current visible topics last. */
+export function nextHomeSuggestionBatch(
+ previous: HomeSuggestionBatchState | null = null,
+ visibleCount: 2 | 4 = HOME_SUGGESTION_BATCH_SIZE,
+ random: () => number = Math.random,
+): HomeSuggestionBatchState {
+ const previousIds = new Set(previous?.ids.slice(0, previous.displayedCount));
+ const seen = new Set([...(previous?.seenIds ?? []), ...previousIds]);
+ if (seen.size === HOME_SUGGESTION_CATALOG.length) seen.clear();
+
+ const available = HOME_SUGGESTION_CATALOG.filter(({ id }) => !previousIds.has(id));
+ const unseen = available.filter(({ id }) => !seen.has(id));
+ const seenBefore = available.filter(({ id }) => seen.has(id));
+ const candidates = [
+ ...randomCategoryOrder(unseen, random),
+ ...randomCategoryOrder(seenBefore, random),
+ ];
+ const selected = selectHomeSuggestionBatch(candidates, {
+ fallback: randomCategoryOrder(
+ HOME_SUGGESTION_CATALOG.filter(({ id }) => previousIds.has(id)),
+ random,
+ ),
+ });
+ // Prepare four rows so resizing preserves the batch. Only visible rows enter history
+ // on the next shuffle; the two hidden rows on narrow screens remain eligible.
+ return { ids: selected.map(({ id }) => id), seenIds: [...seen], displayedCount: visibleCount };
+}
export function homeSuggestionLabelKey(
id: HomeSuggestionId,
@@ -32,17 +146,6 @@ export function homeSuggestionPromptKey(
return `newChat.homeSuggestions.${id}.prompt`;
}
-export function homeSuggestionBatch(index: number): HomeSuggestionId[] {
- const batchCount = HOME_SUGGESTION_BATCH_COUNT;
- const normalized = ((index % batchCount) + batchCount) % batchCount;
- const start = normalized * HOME_SUGGESTION_BATCH_SIZE;
- return HOME_SUGGESTION_IDS.slice(start, start + HOME_SUGGESTION_BATCH_SIZE);
-}
-
-export function nextHomeSuggestionBatch(index: number): number {
- return (index + 1) % HOME_SUGGESTION_BATCH_COUNT;
-}
-
export function isHomeSuggestionsHidden(): boolean {
if (typeof localStorage === 'undefined') return false;
try {
diff --git a/apps/desktop/src/renderer/features/cc-agent/pendingPluginSuggestion.ts b/apps/desktop/src/renderer/features/cc-agent/pendingPluginSuggestion.ts
new file mode 100644
index 0000000000..b31d507389
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/pendingPluginSuggestion.ts
@@ -0,0 +1,71 @@
+import type { AttachedFile } from '@/lib/fileTypes';
+import type { Effort, PermissionMode } from '@/lib/userPreferences.types';
+import type { HomeTaskSuggestion } from './pluginHomeSuggestions';
+
+export interface PluginSuggestionRequest {
+ suggestion: HomeTaskSuggestion;
+ ownerId: string;
+ targetKey: string;
+ workingDir: string | null;
+ model: string;
+ effort: Effort;
+ permissionMode: PermissionMode;
+ providerId?: string | null;
+ files: AttachedFile[];
+}
+export interface PendingPluginSuggestion extends PluginSuggestionRequest {
+ nonce: string;
+ phase: 'setup' | 'ready';
+}
+let pending: PendingPluginSuggestion | null = null;
+const listeners = new Set<() => void>();
+function publish(): void {
+ listeners.forEach((fn) => fn());
+}
+export const subscribePendingPluginSuggestion = (fn: () => void) => {
+ listeners.add(fn);
+ return () => {
+ listeners.delete(fn);
+ };
+};
+export const getPendingPluginSuggestion = () => pending;
+export function startPendingPluginSuggestion(request: PluginSuggestionRequest): string {
+ pending = { ...request, nonce: crypto.randomUUID(), phase: 'setup' };
+ publish();
+ return pending.nonce;
+}
+export function cancelPendingPluginSuggestion(nonce?: string): void {
+ if (pending && (!nonce || pending.nonce === nonce)) {
+ pending = null;
+ publish();
+ }
+}
+export function readyPendingPluginSuggestion(
+ nonce: string | undefined,
+ ownerId: string | null,
+ ghostId: string,
+): string | null {
+ if (
+ !pending ||
+ pending.nonce !== nonce ||
+ pending.ownerId !== ownerId ||
+ pending.suggestion.pluginId !== ghostId ||
+ pending.phase !== 'setup'
+ )
+ return null;
+ pending = { ...pending, phase: 'ready' };
+ publish();
+ return pending.nonce;
+}
+export function takePendingPluginSuggestion(
+ nonce: string,
+ ownerId: string | null,
+ targetKey: string,
+): PendingPluginSuggestion | null {
+ const result = pending;
+ if (!result || result.nonce !== nonce) return null;
+ cancelPendingPluginSuggestion(nonce);
+ return result.phase === 'ready' && result.ownerId === ownerId && result.targetKey === targetKey
+ ? result
+ : null;
+}
diff --git a/apps/desktop/src/renderer/features/cc-agent/pluginHomeSuggestions.ts b/apps/desktop/src/renderer/features/cc-agent/pluginHomeSuggestions.ts
new file mode 100644
index 0000000000..f2585ae2ab
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/pluginHomeSuggestions.ts
@@ -0,0 +1,168 @@
+import { localizeGhostRecommendation, type GhostRecommendation } from '@cindy/plugin-protocol';
+import type { HomePluginRecommendationsSnapshot } from '../../../shared/homePluginRecommendations';
+import {
+ HOME_SUGGESTION_CATALOG,
+ homeSuggestionLabelKey,
+ homeSuggestionPromptKey,
+ randomCategoryOrder,
+ selectHomeSuggestionBatch,
+ shuffled,
+ type HomeSuggestionId,
+} from './homeSuggestions';
+
+export interface HomeTaskSuggestion {
+ id: string;
+ category: string;
+ label: string;
+ prompt: string;
+ builtinId?: HomeSuggestionId;
+ pluginId?: string;
+ taskId?: string;
+ needsInstall?: boolean;
+ ownerId?: string | null;
+}
+export interface HomeTaskBatch {
+ items: HomeTaskSuggestion[];
+ seenIds: string[];
+ displayedCount: 2 | 4;
+}
+
+/** The host owns a closed set of broad scenarios; authors cannot invent quota keys. */
+export function pluginSuggestionCategory(item: GhostRecommendation): string {
+ const text =
+ `${item.label} ${item.locales?.en?.label ?? ''} ${item.prompt} ${item.locales?.en?.prompt ?? ''}`.toLowerCase();
+ const rules: [RegExp, string][] = [
+ [/email|e-mail|inbox|mail\b|邮件|郵件|メール|메일/, 'email'],
+ [/photo|album|image|照片|相册|相冊|画像|写真|사진|앨범/, 'photos'],
+ [/calendar|meeting|schedule|日历|日曆|会议|會議|会議|일정|캘린더/, 'calendar'],
+ [/daily|every day|monitor|每天|每日|盯|監視|모니터|매일/, 'automation'],
+ [
+ /code|repo|pull request|bug|\bgit\b|commit|代码|代碼|项目|專案|审查.*改动|審查.*改動|未提交|コード|コミット|코드|커밋/,
+ 'development',
+ ],
+ [/document|spreadsheet|file|整理|文档|文件|文書|문서|파일/, 'documents'],
+ [/game|build|create|游戏|遊戲|制作|製作|ゲーム|게임/, 'create'],
+ [/computer|disk|network|电脑|電腦|网速|網速|パソコン|컴퓨터/, 'computer'],
+ ];
+ return rules.find(([pattern]) => pattern.test(text))?.[1] ?? 'pluginTasks';
+}
+
+export function readPluginRecommendationSnapshot(): HomePluginRecommendationsSnapshot {
+ try {
+ return window.electronAPI.ghosts.recommendationsSync();
+ } catch {
+ return { ownerId: null, sources: [], recentIds: [], newlyInstalledId: null };
+ }
+}
+
+export function buildHomeTaskCatalog(
+ snapshot: HomePluginRecommendationsSnapshot,
+ locale: string,
+ t: (key: string) => string,
+ includePlugins = true,
+): HomeTaskSuggestion[] {
+ const builtins: HomeTaskSuggestion[] = HOME_SUGGESTION_CATALOG.map(({ id, category }) => ({
+ id,
+ category,
+ builtinId: id,
+ label: t(homeSuggestionLabelKey(id)),
+ prompt: t(homeSuggestionPromptKey(id)),
+ }));
+ if (!includePlugins || !snapshot.ownerId) return builtins;
+ const mailItems: GhostRecommendation[] = ['today', 'unanswered', 'reply'].map((id) => ({
+ id,
+ label: t(`newChat.pluginSuggestions.mail.${id}.label`),
+ prompt: t(`newChat.pluginSuggestions.mail.${id}.prompt`),
+ }));
+ const sources = [...snapshot.sources];
+ if (!sources.some((s) => s.ghostId === 'google-gmail')) {
+ sources.push({ ghostId: 'google-gmail', name: 'Gmail', enabled: false, items: mailItems });
+ }
+ for (const source of sources) {
+ const installed = snapshot.sources.some((s) => s.ghostId === source.ghostId);
+ // Legacy Gmail gets curated examples; an explicit empty runtime/manifest list stays empty.
+ const items = source.items ?? (source.ghostId === 'google-gmail' ? mailItems : []);
+ for (const raw of items) {
+ const item = localizeGhostRecommendation(raw, locale);
+ builtins.push({
+ id: `plugin:${source.ghostId}:${item.id}`,
+ category: source.ghostId === 'google-gmail' ? 'email' : pluginSuggestionCategory(raw),
+ label: item.label,
+ prompt: item.prompt,
+ pluginId: source.ghostId,
+ taskId: item.id,
+ needsInstall: !installed,
+ ownerId: snapshot.ownerId,
+ });
+ }
+ }
+ return builtins;
+}
+
+export function nextHomeTaskBatch(
+ catalog: HomeTaskSuggestion[],
+ snapshot: HomePluginRecommendationsSnapshot,
+ previous: HomeTaskBatch | null,
+ visibleCount: 2 | 4,
+ random: () => number = Math.random,
+): HomeTaskBatch {
+ const previousIds = new Set(previous?.items.slice(0, previous.displayedCount).map((x) => x.id));
+ const currentIds = new Set(catalog.map((x) => x.id));
+ const seen = new Set(
+ [...(previous?.seenIds ?? []), ...previousIds].filter((id) => currentIds.has(id)),
+ );
+ if (seen.size === catalog.length) seen.clear();
+ const pluginGroups = new Map<string, HomeTaskSuggestion[]>();
+ const candidates = catalog.filter((item) => {
+ if (!item.pluginId) return true;
+ const group = pluginGroups.get(item.pluginId) ?? [];
+ group.push(item);
+ pluginGroups.set(item.pluginId, group);
+ return false;
+ });
+ // One candidate per source BEFORE ranking: adding tasks never multiplies a plugin's tickets.
+ for (const group of pluginGroups.values()) {
+ const fresh = group.filter((x) => !seen.has(x.id) && !previousIds.has(x.id));
+ const alternatives = group.filter((x) => !previousIds.has(x.id));
+ candidates.push(
+ shuffled(fresh.length ? fresh : alternatives.length ? alternatives : group, random)[0],
+ );
+ }
+ const available = candidates.filter((x) => !previousIds.has(x.id));
+ const ranked = [
+ ...randomCategoryOrder(
+ available.filter((x) => !seen.has(x.id)),
+ random,
+ ),
+ ...randomCategoryOrder(
+ available.filter((x) => seen.has(x.id)),
+ random,
+ ),
+ ];
+ const pinned = candidates.find(
+ (x) => x.pluginId === snapshot.newlyInstalledId && !x.needsInstall,
+ );
+ // Recent use is a modest hint, not a permanent slot or a raw tool-call counter.
+ const recent = ranked.filter(
+ (x) => x.pluginId && snapshot.recentIds.slice(0, 5).includes(x.pluginId),
+ );
+ if (recent.length && random() < 0.35) ranked.unshift(shuffled(recent, random)[0]);
+ let items = selectHomeSuggestionBatch(pinned ? [pinned, ...ranked] : ranked, {
+ fallback: randomCategoryOrder(
+ candidates.filter((x) => previousIds.has(x.id)),
+ random,
+ ),
+ });
+ // Keep a general task visible even when many plugins are installed.
+ if (items.length > 1 && items.every((x) => x.pluginId)) {
+ const fallback = ranked.find(
+ (x) => !x.pluginId && !items.some((y) => y.category === x.category),
+ );
+ if (fallback) items = [...items.slice(0, -1), fallback];
+ }
+ if (items.slice(0, 2).every((x) => x.pluginId)) {
+ const generalIndex = items.findIndex((x) => x.builtinId);
+ if (generalIndex > 1) [items[1], items[generalIndex]] = [items[generalIndex], items[1]];
+ }
+ return { items, seenIds: [...seen], displayedCount: visibleCount };
+}
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
index 7f5244b102..590dd82a7d 100644
--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
@@ -48,6 +48,13 @@ import { toast } from '@/lib/toast';
import { extractIpcError } from '@/utils/ipcError';
import { useAuth } from '@/contexts/AuthContext';
import { useInstalledGhosts } from '@/cindy-brain/useInstalledGhosts';
+import {
+ cancelPendingPluginSuggestion,
+ getPendingPluginSuggestion,
+ readyPendingPluginSuggestion,
+ subscribePendingPluginSuggestion,
+} from '@/features/cc-agent/pendingPluginSuggestion';
+import { readPluginRecommendationSnapshot } from '@/features/cc-agent/pluginHomeSuggestions';
import { NEW_MAKER_DRAFT_KEY } from '@/features/cc-agent/newMakerDraftKeys';
import {
getDraft as getComposerDraft,
@@ -395,6 +402,62 @@ export function GhostPluginPage({
[t],
);
const { user, mode, dataOwnerId } = useAuth();
+ const [recommendationNonce] = useState(() => searchParams.get('recommendation'));
+ const pendingRecommendation = useSyncExternalStore(
+ subscribePendingPluginSuggestion,
+ getPendingPluginSuggestion,
+ );
+ const recommendation =
+ pendingRecommendation?.nonce === recommendationNonce &&
+ pendingRecommendation.ownerId === dataOwnerId
+ ? pendingRecommendation
+ : null;
+ const recommendationPageMounted = useRef(false);
+ useEffect(() => {
+ recommendationPageMounted.current = true;
+ if (getPendingPluginSuggestion()?.ownerId !== dataOwnerId) cancelPendingPluginSuggestion();
+ return () => {
+ recommendationPageMounted.current = false;
+ queueMicrotask(() => {
+ if (!recommendationPageMounted.current && getPendingPluginSuggestion()?.phase === 'setup') {
+ cancelPendingPluginSuggestion(recommendationNonce ?? undefined);
+ }
+ });
+ };
+ }, [dataOwnerId, recommendationNonce]);
+ const continueRecommendation = useCallback(
+ (nonce: string | undefined, ghostId: string) => {
+ if (!recommendationPageMounted.current || !nonce) return false;
+ const snapshot = readPluginRecommendationSnapshot();
+ if (
+ snapshot.ownerId !== dataOwnerId ||
+ !snapshot.sources.some((s) => s.ghostId === ghostId && s.enabled)
+ )
+ return false;
+ const ready = readyPendingPluginSuggestion(nonce, dataOwnerId, ghostId);
+ if (!ready) return false;
+ navigate('/cc-agent/new', { state: { pluginSuggestionNonce: ready }, flushSync: true });
+ return true;
+ },
+ [dataOwnerId, navigate],
+ );
+ const recommendationNotice = recommendation ? (
+ <div
+ role="status"
+ className="flex shrink-0 items-center justify-between gap-3 border-b border-[var(--border-default)] px-4 py-3 text-13 text-[var(--text-secondary)]"
+ >
+ <span>
+ {t('newChat.pluginSuggestions.pending', { task: recommendation.suggestion.label })}
+ </span>
+ <button
+ type="button"
+ className="shrink-0 rounded-full px-2 py-1 hover:bg-[var(--surface-hover)]"
+ onClick={() => cancelPendingPluginSuggestion(recommendation.nonce)}
+ >
+ {t('newChat.pluginSuggestions.cancel')}
+ </button>
+ </div>
+ ) : null;
const showEnterprise = user?.membershipKind === 'org';
const ghosts = useInstalledGhosts();
useMainViewVisibilityRevision();
@@ -524,6 +587,11 @@ export function GhostPluginPage({
setProjectDisabled(new Set());
}
}, []);
+ useEffect(() => {
+ if (!recommendation) return;
+ const target = ghosts.find((g) => g.manifest.id === recommendation.suggestion.pluginId);
+ handlePickScope(target?.enabled ? recommendation.workingDir : null);
+ }, [recommendation?.nonce, handlePickScope]);
const effectiveEnabled = useCallback(
(id: string, globallyEnabled: boolean) =>
scopeDir === null ? globallyEnabled : globallyEnabled && !projectDisabled.has(id),
@@ -870,6 +938,7 @@ export function GhostPluginPage({
const handleToggle = useCallback(
async (id: string, enabled: boolean, displayName: string) => {
+ const pendingNonce = getPendingPluginSuggestion()?.nonce;
try {
const dir = scopeDirRef.current;
if (dir) {
@@ -886,11 +955,12 @@ export function GhostPluginPage({
} else {
await window.electronAPI.ghosts.setEnabled(id, enabled);
}
+ if (enabled) continueRecommendation(pendingNonce, id);
} catch (error) {
toast.error(t(ghostInstallErrorKey(extractIpcError(error)?.code)));
}
},
- [t],
+ [continueRecommendation, t],
);
/** Main 在同一次 install IPC 事务内校验真实包与市场声明的能力上限。 */
@@ -1269,6 +1339,14 @@ export function GhostPluginPage({
if (requestId === marketDetailRequestRef.current) throw error;
}
}, []);
+ useEffect(() => {
+ const pluginId = searchParams.get('market');
+ if (!pluginId) return;
+ const next = new URLSearchParams(searchParams);
+ next.delete('market');
+ setSearchParams(next, { replace: true });
+ void handleSelectMarket(pluginId);
+ }, [handleSelectMarket, searchParams, setSearchParams]);
usePluginMarketLocaleRefresh(
marketLocale,
async () => {
@@ -1295,6 +1373,7 @@ export function GhostPluginPage({
const runMarketInstallFlow = useCallback(
async (marketDetailArg: PluginMarketDetail) => {
+ const pendingNonce = getPendingPluginSuggestion()?.nonce;
const marketDetail = marketDetailArg;
// 确认框等待期间也持有 lease。账号/模式切换会清除当前 lease,
// 旧确认回调恢复后必须先验权,不能在新会话里继续安装。
@@ -1342,6 +1421,7 @@ export function GhostPluginPage({
isStillActive: () => isMarketBusyLeaseActive(marketBusyLease),
});
if (!ghost || !isMarketBusyLeaseActive(marketBusyLease)) return;
+ if (continueRecommendation(pendingNonce, ghost.manifest.id)) return;
// 市场首装装完即开(2026-07-26 定案),toast 用"已安装";更新路径如实
// 用"已更新"(生效状态未被改变),并留在当前页方便连续更新多个插件。
toast.success(
@@ -1376,6 +1456,7 @@ export function GhostPluginPage({
ghosts,
isMarketBusyLeaseActive,
installMarketPackage,
+ continueRecommendation,
refreshMarket,
refreshVisibleMarketDetail,
releaseMarketBusy,
@@ -1423,21 +1504,25 @@ export function GhostPluginPage({
if (marketDetail) {
return (
<div className="flex h-full min-h-0 w-full">
- <div className="min-w-0 flex-1">
- <MarketPluginDetailView
- detail={marketDetail}
- busy={marketBusyId === marketDetail.pluginId}
- onBack={() => {
- marketDetailRequestRef.current += 1;
- setMarketDetail(null);
- }}
- onInstall={
- canOfferMarketInstall(mode, marketDetail.ghostId)
- ? () => void handleInstallFromMarket()
- : undefined
- }
- onIconLoadError={handleMarketIconLoadError}
- />
+ <div className="flex min-w-0 flex-1 flex-col">
+ {recommendationNotice}
+ <div className="min-h-0 flex-1">
+ <MarketPluginDetailView
+ detail={marketDetail}
+ busy={marketBusyId === marketDetail.pluginId}
+ onBack={() => {
+ cancelPendingPluginSuggestion(recommendationNonce ?? undefined);
+ marketDetailRequestRef.current += 1;
+ setMarketDetail(null);
+ }}
+ onInstall={
+ canOfferMarketInstall(mode, marketDetail.ghostId)
+ ? () => void handleInstallFromMarket()
+ : undefined
+ }
+ onIconLoadError={handleMarketIconLoadError}
+ />
+ </div>
</div>
{panelAside}
</div>
@@ -1447,39 +1532,45 @@ export function GhostPluginPage({
if (selectedDetail) {
return (
<div className="flex h-full min-h-0 w-full">
- <div className="min-w-0 flex-1">
- <GhostPluginDetailView
- ghost={selectedGhost}
- detail={selectedDetail}
- panelStatus={panelStatus}
- enabledOverride={
- selectedGhost
- ? effectiveEnabled(selectedGhost.manifest.id, selectedGhost.enabled)
- : undefined
- }
- onBack={() => setSelectedId(null)}
- onToggle={(enabled) =>
- void handleToggle(selectedDetail.id, enabled, selectedDetail.name)
- }
- onUse={handleUse}
- mainViewSidebarVisible={selectedMainViewSidebarVisible}
- onMainViewSidebarVisibleChange={handleMainViewSidebarVisibleChange}
- onUpdate={() => void handleUpdate()}
- onUpdateFromFile={() => void handleUpdateFromFile()}
- onReapprove={() => void handleRecoverInstall(selectedDetail.id)}
- updateVersion={selectedMarketUpdate?.version}
- updateBusy={(selectedMarketUpdate !== null && marketBusyId !== null) || batchRunning}
- onUninstall={() => void handleUninstall()}
- // 官方保留前缀(cindy-/filo-/xd-)的插件走本地装入会被拒,
- // 导出产物无法重装,不提供导出项。
- onExport={
- selectedGhost && !isOfficialGhostId(selectedDetail.id)
- ? () => void handleExport()
- : undefined
- }
- toggleDisabled={scopeDir !== null && selectedGhost !== null && !selectedGhost.enabled}
- onIconLoadError={handleMarketIconLoadError}
- />
+ <div className="flex min-w-0 flex-1 flex-col">
+ {recommendationNotice}
+ <div className="min-h-0 flex-1">
+ <GhostPluginDetailView
+ ghost={selectedGhost}
+ detail={selectedDetail}
+ panelStatus={panelStatus}
+ enabledOverride={
+ selectedGhost
+ ? effectiveEnabled(selectedGhost.manifest.id, selectedGhost.enabled)
+ : undefined
+ }
+ onBack={() => {
+ cancelPendingPluginSuggestion(recommendationNonce ?? undefined);
+ setSelectedId(null);
+ }}
+ onToggle={(enabled) =>
+ void handleToggle(selectedDetail.id, enabled, selectedDetail.name)
+ }
+ onUse={handleUse}
+ mainViewSidebarVisible={selectedMainViewSidebarVisible}
+ onMainViewSidebarVisibleChange={handleMainViewSidebarVisibleChange}
+ onUpdate={() => void handleUpdate()}
+ onUpdateFromFile={() => void handleUpdateFromFile()}
+ onReapprove={() => void handleRecoverInstall(selectedDetail.id)}
+ updateVersion={selectedMarketUpdate?.version}
+ updateBusy={(selectedMarketUpdate !== null && marketBusyId !== null) || batchRunning}
+ onUninstall={() => void handleUninstall()}
+ // 官方保留前缀(cindy-/filo-/xd-)的插件走本地装入会被拒,
+ // 导出产物无法重装,不提供导出项。
+ onExport={
+ selectedGhost && !isOfficialGhostId(selectedDetail.id)
+ ? () => void handleExport()
+ : undefined
+ }
+ toggleDisabled={scopeDir !== null && selectedGhost !== null && !selectedGhost.enabled}
+ onIconLoadError={handleMarketIconLoadError}
+ />
+ </div>
</div>
{panelAside}
</div>
@@ -1511,6 +1602,7 @@ export function GhostPluginPage({
)}
>
<PluginManagementPage>
+ {recommendationNotice}
<header className="plugin-motion-page-header pb-2">
<div className="min-w-0">
<div className="flex flex-wrap items-center justify-between gap-3">
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 5650518085..aa1c290af1 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -6957,53 +6957,105 @@
"homeSuggestions": {
"shuffle": "Show more",
"dismiss": "Don't show again",
+ "storageUsage": {
+ "label": "Clean up my computer",
+ "prompt": "Help me find things worth cleaning up on my computer and how much space I could free. Let me confirm before cleaning anything up."
+ },
+ "whySlow": {
+ "label": "Find out why my computer is slow",
+ "prompt": "Help me find out why my computer is slow and suggest ways to improve it."
+ },
"downloadsDesktop": {
- "label": "See what's piled up in Downloads and on the Desktop",
- "prompt": "Look at my Downloads folder and Desktop. List what has piled up: the largest items, obvious duplicates, things untouched for six months or more, and anything safe to archive. For each item, say where it is, how big it is, and why you suggest dealing with it. This round is read-only; wait for me before moving or deleting anything."
+ "label": "Organize my Downloads and Desktop",
+ "prompt": "Help me organize my Downloads folder and desktop so things are easy to find. Show me the plan first."
},
- "whatCindyCanDo": {
- "label": "Look at this computer and tell me what you can help with",
- "prompt": "Look at what is installed on this computer and the kinds of things I seem to work on. Then tell me the specific ways you can help, each in one sentence: when I would use it and what it would save me. Do not recite a feature list; ground it in what actually exists on this machine."
+ "diagnoseNetwork": {
+ "label": "Diagnose my network speed",
+ "prompt": "Help me find out why my internet is slow and suggest how to fix it."
+ },
+ "unusedApps": {
+ "label": "Find apps I rarely use that still take up space",
+ "prompt": "Help me find apps that may have gone unused for a long time and take up space. Let me confirm before uninstalling anything."
+ },
+ "stockDigest": {
+ "label": "Send me a daily stock briefing",
+ "prompt": "Set up a daily stock briefing for me. We can start with 2400.HK (XD Inc.); ask which other stocks interest me and when I'd like to receive it."
+ },
+ "morningBrief": {
+ "label": "Create my daily morning briefing",
+ "prompt": "Set up a daily morning briefing for me. Work with me to choose the topics and delivery time."
+ },
+ "watchWebpage": {
+ "label": "Keep an eye on a webpage for me",
+ "prompt": "Watch a webpage for me and let me know when something I care about changes. Work with me to choose the URL, what to watch for, and how often to check."
+ },
+ "expenseTracker": {
+ "label": "Make a simple expense tracker",
+ "prompt": "Help me build a personal expense tracker. We can talk through the features and how I'll use it, then let me try it out."
+ },
+ "kidsGame": {
+ "label": "I want to make a game",
+ "prompt": "I want to make a game. Help me develop my idea or suggest some fun concepts, then let's choose a direction and build it together."
+ },
+ "habitTracker": {
+ "label": "Make a habit tracker",
+ "prompt": "Build a habit-tracking page that fits what I want to keep doing, and let me try it out."
},
"recentDocs": {
- "label": "Review my recent documents and make a list",
- "prompt": "Look at documents I have opened or edited recently. Group them by topic, tell me how many piles of work I have, how far each has gotten, and whether anything looks abandoned. Give me a list with each file's location. Read-only; do not change my files."
+ "label": "Summarize these materials in one page",
+ "prompt": "Turn the materials I provide into a one-page summary so I can quickly grasp the key points."
},
- "listCodeProjects": {
- "label": "List the code projects on this computer",
- "prompt": "Find code projects in the directories I commonly use. For each one, one sentence on what it is, what it is written in, and when it last changed. Then say which look like the main line of work and which look abandoned. If you find none, say so. This round is read-only; do not change any files."
+ "subscriptionSpend": {
+ "label": "Tally my subscription spending",
+ "prompt": "Help me review my subscription spending and find subscriptions worth canceling or changing. Give me suggestions first."
},
- "storageUsage": {
- "label": "Show what's using up disk space",
- "prompt": "Survey disk use on this computer. List directories and files from largest to smallest, and say which are caches, duplicates, or old things I probably forgot. Give a ranking plus one conclusion: which categories would free the most space. Count only; do not delete anything."
+ "organizeFolder": {
+ "label": "Sort and organize this folder",
+ "prompt": "Help me organize a folder so files are easier to find. Let's agree on the folder and plan first. Don't delete any files."
},
- "unusedApps": {
- "label": "List apps I installed but barely use",
- "prompt": "Look at apps installed on this computer. Rank them by disk use and last-opened time, and point out which have not been opened in a long time but still take a lot of space. Give me a list; do not uninstall anything yet."
+ "photoTimeline": {
+ "label": "Organize my photos into a timeline",
+ "prompt": "Help me organize my photos into a clear timeline, keeping the originals."
+ },
+ "photoAlbumPage": {
+ "label": "Turn these photos into an album webpage",
+ "prompt": "Build a beautiful, easy-to-browse album website with my photos. Open it for me when it's ready, and keep the original photos."
},
"uncommittedChanges": {
- "label": "Find my latest project and check uncommitted work",
- "prompt": "Find the code project I touched most recently. Review uncommitted changes, say what they are doing, and flag anything that looks wrong or missing. Read-only; do not change files or commit."
+ "label": "Review my uncommitted changes",
+ "prompt": "Review the uncommitted changes in my project for problems and omissions. Give me suggestions without modifying files."
+ },
+ "exploreRepo": {
+ "label": "Show me around this project",
+ "prompt": "Show me around this project: what it does, how to run it, and which parts are worth exploring further."
+ },
+ "initAgentDoc": {
+ "label": "Generate an AGENTS.md",
+ "prompt": "Help me create a suitable AGENTS.md for my project. If guidance files already exist, suggest additions without overwriting them."
+ },
+ "listCodeProjects": {
+ "label": "List my code projects and explain what each does",
+ "prompt": "Help me take stock of the code projects on my computer and explain what each one does."
},
"devEnvironment": {
- "label": "Check my development environment",
- "prompt": "Check this machine's development environment: language runtimes and package managers, their versions, obvious conflicts or stale versions, and git config problems. Give a snapshot plus one conclusion: what to fix first. Inspect only; do not install or change config."
+ "label": "Check my development environment for problems",
+ "prompt": "Check my development environment for things worth fixing or improving. Give me suggestions first."
},
- "whySlow": {
- "label": "Find out why this computer is slow",
- "prompt": "Find out why this computer feels slow: load, memory, disk, uptime, and the processes using the most CPU or memory. Give a short conclusion with evidence. Read-only; do not change anything, kill processes, or ask what I have open."
+ "makePlugin": {
+ "label": "Make a plugin for Cindy",
+ "prompt": "I want to make a Cindy plugin. Help me develop my requirements or suggest useful, fun ideas, then build it once we've chosen a direction."
},
- "diagnoseNetwork": {
- "label": "Diagnose my network speed",
- "prompt": "Diagnose this computer's network: ping, DNS, and whether it is wired or Wi-Fi. Give a one- or two-sentence conclusion. Do not run a long speed test or ask about my ISP."
+ "sendFeedback": {
+ "label": "Send feedback to Cindy's developers",
+ "prompt": "Help me turn my thoughts about Cindy into clear feedback. Let me review it before submitting."
},
- "subscriptionSpend": {
- "label": "Tally my subscription spending",
- "prompt": "Scan Downloads, receipts, and local invoices for subscription charges. List service names and amounts. If you find nothing, say so. Do not change subscriptions, ask for a bank card, or sign in to email."
+ "readOwnSource": {
+ "label": "Explore Cindy's own source code",
+ "prompt": "Show me Cindy's source code (github.com/makecindy/cindy), explain how you're built, and explore some interesting parts with me."
},
- "expenseTracker": {
- "label": "Make a simple expense tracker",
- "prompt": "In this conversation's workspace, make a local expense tracker I can open: date, amount, category, notes. No backend, and do not ask which extra features I want."
+ "whatCindyCanDo": {
+ "label": "Find a few things you can help me with",
+ "prompt": "Based on my recent tasks and your current capabilities, suggest concrete things you could do to save me effort. Let me choose one to start."
}
},
"noProvider": {
@@ -7592,6 +7644,27 @@
"offlineHint": "Offline — available once connected",
"attachmentsDropped": "Removed {{count}} attachment(s) — they live on the previous device",
"attachmentsRemoteUnsupported": "File attachments aren't supported on a remote device — skipped {{count}} (images are fine)"
+ },
+ "pluginSuggestions": {
+ "changed": "This suggestion has changed. Shuffle the suggestions and choose again.",
+ "unavailable": "This plugin is currently unavailable. Check it on the Plugins page.",
+ "pending": "After you install or enable the plugin, “{{task}}” will continue.",
+ "cancel": "Cancel continuation",
+ "usePlugin": "Use the {{name}} plugin ({{id}}) to complete this task. First query ghost_info for its current tools, then call ghost_call as needed. If an account connection is required, use the plugin’s existing connection flow.",
+ "mail": {
+ "today": {
+ "label": "Organize today’s emails that need my attention",
+ "prompt": "Help me find today's emails that need my attention and turn them into a to-do list. Leave the emails unchanged for now."
+ },
+ "unanswered": {
+ "label": "Find important emails I haven’t answered",
+ "prompt": "Help me find unanswered emails worth my attention and see which ones need a follow-up."
+ },
+ "reply": {
+ "label": "Draft a reply to this email",
+ "prompt": "Draft a reply to this email, taking the conversation and my thoughts into account. Don't send it yet."
+ }
+ }
}
},
"onboarding": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index fee62b52bd..62d615b183 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -6955,53 +6955,105 @@
"homeSuggestions": {
"shuffle": "別の提案",
"dismiss": "今後表示しない",
+ "storageUsage": {
+ "label": "パソコンの不要なファイルを片付けて",
+ "prompt": "パソコンの中から整理するとよさそうなものを探して、どれくらい容量を空けられるか教えて。整理する前に私に確認して。"
+ },
+ "whySlow": {
+ "label": "パソコンが重い理由を調べて",
+ "prompt": "パソコンが重い理由を調べて、原因と改善案を教えて。"
+ },
"downloadsDesktop": {
- "label": "ダウンロードとデスクトップの溜まりを一覧にする",
- "prompt": "ダウンロードフォルダとデスクトップを見て、何が溜まっているか整理して。容量が大きいもの、明らかな重複、半年以上触っていないもの、安全にアーカイブできそうなものをリストにして。各項目は場所・サイズ・理由を明記。このラウンドは閲覧のみ。動かす・削除するのは確認後。"
+ "label": "ダウンロードとデスクトップを整理して",
+ "prompt": "ダウンロードフォルダとデスクトップを、すっきりして探しやすい状態に整理して。まず整理の案を見せて。"
},
- "whatCindyCanDo": {
- "label": "このパソコンを見て、何を手伝えるか教えて",
- "prompt": "このパソコンに入っているもの、普段扱っている種類から、私が何をしている人か見当をつけて。そのうえで、あなたの能力で具体的に手伝えることを数個、一文ずつ:いつ使うか、何が省けるか。機能一覧の読み上げはせず、このマシンに実際にあるものに即して。"
+ "diagnoseNetwork": {
+ "label": "ネットの遅さを診断して",
+ "prompt": "ネットが遅い理由を調べて、問題と解決方法を教えて。"
+ },
+ "unusedApps": {
+ "label": "長く使っていないアプリと占有容量を調べて",
+ "prompt": "パソコンで長く使っていない可能性があり、容量も取っているアプリを探して。アンインストール前に私に確認して。"
+ },
+ "stockDigest": {
+ "label": "毎日の株式レポートを届けて",
+ "prompt": "毎日の株式レポートを設定して。2400.HK(心動公司)から始めてもいいので、ほかに注目している銘柄と受け取りたい時刻を聞いて。"
+ },
+ "morningBrief": {
+ "label": "私向けの毎朝のニュースを作って",
+ "prompt": "毎朝のニュースを設定して。知りたい内容と受け取る時刻を一緒に決めて。"
+ },
+ "watchWebpage": {
+ "label": "気になるウェブページの変化を見守って",
+ "prompt": "ウェブページを見守って、気になる変化があったら知らせて。URL、注目する点、確認頻度を一緒に決めて。"
+ },
+ "expenseTracker": {
+ "label": "使いやすい家計簿ツールを作って",
+ "prompt": "私に合う家計簿ツールを作って。機能や使い方は一緒に相談して、できたら試させて。"
+ },
+ "kidsGame": {
+ "label": "ゲームを作りたい",
+ "prompt": "ゲームを作りたい。今あるアイデアを磨くのを手伝うか、面白いアイデアをいくつか提案して。方向性を選んで、一緒に形にしよう。"
+ },
+ "habitTracker": {
+ "label": "自分に合う習慣の記録ページを作って",
+ "prompt": "続けたいことに合う習慣の記録ページを作って。できたら試させて。"
},
"recentDocs": {
- "label": "最近の文書を見てリストにまとめて",
- "prompt": "最近開いた・編集した文書をテーマごとにまとめ、いくつの仕事の山があるか、それぞれどこまで進んでいるか、放置されていないかを教えて。各ファイルの場所付きのリストを。読み取り専用。ファイルは動かさない。"
+ "label": "この資料を 1 ページにまとめて",
+ "prompt": "渡した資料を 1 ページにまとめて、要点をすぐにつかめるようにして。"
},
- "listCodeProjects": {
- "label": "このパソコンのコードプロジェクトを一覧して",
- "prompt": "よく使うディレクトリからコードプロジェクトを見つけ、それぞれ何をするか・何で書いているか・最後の変更はいつか一文で。本線に見えるものと放棄済みに見えるものを分けて。一つもなければ、見つからなかったと言って。このラウンドは読み取り専用。ファイルは変更しない。"
+ "subscriptionSpend": {
+ "label": "サブスクの支出を整理して",
+ "prompt": "サブスクにいくら使っているか整理して、解約や見直しを検討するとよさそうなものを探して。まずは提案だけして。"
},
- "storageUsage": {
- "label": "ディスクを何が圧迫しているか調べて",
- "prompt": "このパソコンのストレージを大きい順に見て、キャッシュ、重複、忘れている古いものを区別して。占用ランキングと、どれを消せば一番空くかの一文結論を。集計のみ。削除しない。"
+ "organizeFolder": {
+ "label": "フォルダの中身を分類して整理して",
+ "prompt": "フォルダを整理して、ファイルを探しやすくして。まず対象のフォルダと整理の案を一緒に決めて。ファイルは削除しないで。"
},
- "unusedApps": {
- "label": "入っているアプリで、長いこと使っていないものを",
- "prompt": "インストール済みアプリを容量と最終使用で並べ、長く開いていないのに場所を取っているものを指摘。リストだけ。まだアンインストールしない。"
+ "photoTimeline": {
+ "label": "写真を時系列に整理して",
+ "prompt": "写真を分かりやすい時系列に整理して。元の写真は残して。"
+ },
+ "photoAlbumPage": {
+ "label": "この写真でアルバムページを作って",
+ "prompt": "私の写真で、きれいで見やすいアルバムのウェブページを作って。できたら開いて見せて。元の写真は残して。"
},
"uncommittedChanges": {
- "label": "最近触ったプロジェクトの未コミットを見て",
- "prompt": "最近触ったコードプロジェクトの未コミット変更を見て、何をしているか、明らかな問題や漏れがないか教えて。読み取り専用。ファイルは動かさず、コミットもしない。"
+ "label": "未コミットの変更をレビューして",
+ "prompt": "プロジェクトの未コミットの変更をレビューして、問題や不足を見つけて。まずは提案だけにして、ファイルは変更しないで。"
+ },
+ "exploreRepo": {
+ "label": "このプロジェクトを案内して",
+ "prompt": "このプロジェクトを案内して。何をするものか、どう動かすか、詳しく見るとよさそうな箇所を教えて。"
+ },
+ "initAgentDoc": {
+ "label": "AGENTS.md を作って",
+ "prompt": "プロジェクトに合う AGENTS.md を作って。既存のガイドがあれば、まず追記案を示して、直接上書きしないで。"
+ },
+ "listCodeProjects": {
+ "label": "パソコン内のコードプロジェクトと用途を一覧にして",
+ "prompt": "パソコンのコードプロジェクトを一覧にして、それぞれ何をするものか教えて。"
},
"devEnvironment": {
- "label": "開発環境を一通り点検して",
- "prompt": "このマシンの開発環境を点検:言語ランタイムとパッケージマネージャ、各バージョン、衝突や明らかな古さ、git 設定の問題。現状リストと、先に直すべき箇所の一文。点検のみ。インストールや設定変更はしない。"
+ "label": "開発環境を点検して改善点を教えて",
+ "prompt": "開発環境を点検して、直したり改善したりするとよさそうな箇所を見つけて。まずは提案だけして。"
},
- "whySlow": {
- "label": "パソコンが重い理由を調べて",
- "prompt": "このパソコンが重い理由を調べて:負荷、メモリ、ディスク、起動時間、CPU/メモリを食っているプロセス。結論を短く根拠つきで。読み取り専用。何も変えず、プロセスを殺さず、何を開いているかも聞かない。"
+ "makePlugin": {
+ "label": "Cindy のプラグインを作って",
+ "prompt": "Cindy のプラグインを作りたい。要望を整理するのを手伝うか、役に立つ面白いアイデアをいくつか提案して。方向性を選んでから作って。"
},
- "diagnoseNetwork": {
- "label": "ネット速度を診断して",
- "prompt": "このパソコンのネットワークを診断:ping、DNS、有線か Wi-Fi か。結論は一、二文。長時間のスピードテストはしない。回線業者も聞かない。"
+ "sendFeedback": {
+ "label": "Cindy の開発者に意見を届けて",
+ "prompt": "Cindy への意見を分かりやすいフィードバックにまとめて。私が確認してから送って。"
},
- "subscriptionSpend": {
- "label": "サブスクの支出を洗い出して",
- "prompt": "ダウンロード、領収書、ローカルの請求からサブスク課金を洗い出し、サービス名と金額を列挙。見つからなければ、見つからないと言って。サブスクは変更せず、カードも聞かない、メールにもログインしない。"
+ "readOwnSource": {
+ "label": "Cindy 自身のソースコードを見せて",
+ "prompt": "Cindy のソースコード(github.com/makecindy/cindy)を案内して、あなたがどう実装されているか教えて。それから面白そうな部分を選んで詳しく見よう。"
},
- "expenseTracker": {
- "label": "家計簿の小さなツールを作って",
- "prompt": "この会話のワークスペースに、すぐ開けるローカルの家計簿を作って:日付、金額、分類、メモ。バックエンドなし。追加機能も聞かない。"
+ "whatCindyCanDo": {
+ "label": "今、手伝えることをいくつか提案して",
+ "prompt": "最近の私のセッションと今使える機能をもとに、手間を減らせる具体的なことをいくつか提案して。私が 1 つ選んで始められるようにして。"
}
},
"noProvider": {
@@ -7590,6 +7642,27 @@
"offlineHint": "オフライン — 接続後に利用可能",
"attachmentsDropped": "添付ファイル {{count}} 件を削除しました(前のデバイス上のファイルです)",
"attachmentsRemoteUnsupported": "リモートデバイスではファイル添付に未対応のため {{count}} 件をスキップしました(画像は可)"
+ },
+ "pluginSuggestions": {
+ "changed": "このおすすめは更新されました。おすすめを入れ替えて、もう一度選んでください。",
+ "unavailable": "このプラグインは現在利用できません。プラグインページで確認してください。",
+ "pending": "プラグインをインストールまたは有効化すると、「{{task}}」を続行します。",
+ "cancel": "続行をキャンセル",
+ "usePlugin": "{{name}} プラグイン({{id}})を使って、このタスクを完了してください。まず ghost_info で現在のツールを確認し、必要に応じて ghost_call を呼び出してください。アカウントの接続が必要な場合は、プラグインの既存の接続フローを使ってください。",
+ "mail": {
+ "today": {
+ "label": "今日対応が必要なメールを整理する",
+ "prompt": "今日対応が必要なメールを調べて、やることをまとめて。まだメールは変更しないで。"
+ },
+ "unanswered": {
+ "label": "まだ返信していない重要なメールを探す",
+ "prompt": "まだ返信していない、気に留めておくべきメールを探して、どれに対応が必要か確認して。"
+ },
+ "reply": {
+ "label": "このメールへの返信を下書きする",
+ "prompt": "このメールへの返信の下書きを作って。これまでのやり取りと私の考えを踏まえて、まだ送信しないで。"
+ }
+ }
}
},
"onboarding": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 68129a9fdf..53f5d07d18 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -6955,53 +6955,105 @@
"homeSuggestions": {
"shuffle": "다른 제안",
"dismiss": "다시 보지 않기",
+ "storageUsage": {
+ "label": "컴퓨터의 불필요한 파일을 정리해 줘",
+ "prompt": "컴퓨터에서 정리할 만한 내용을 찾아서 얼마나 공간을 확보할 수 있는지 알려줘. 정리하기 전에 내가 확인하게 해 줘."
+ },
+ "whySlow": {
+ "label": "컴퓨터가 왜 느린지 알아봐",
+ "prompt": "컴퓨터가 왜 느린지 알아보고, 원인과 개선 방법을 알려줘."
+ },
"downloadsDesktop": {
- "label": "다운로드와 바탕화면에 쌓인 것을 정리 목록으로",
- "prompt": "다운로드 폴더와 바탕화면을 보고 무엇이 쌓였는지 정리해 줘. 용량이 큰 것, 분명한 중복, 반년 이상 안 만진 것, 안전하게 보관할 수 있는 것을 목록으로. 각 항목은 위치, 크기, 이유를 밝혀. 이번 라운드는 읽기만. 옮기거나 지우기 전에 내가 확인할게."
+ "label": "다운로드 폴더와 바탕화면을 정리해 줘",
+ "prompt": "다운로드 폴더와 바탕화면을 깔끔하고 찾기 쉽게 정리해 줘. 먼저 정리 계획을 보여 줘."
},
- "whatCindyCanDo": {
- "label": "이 컴퓨터를 보고 뭘 도와줄 수 있는지 알려줘",
- "prompt": "이 컴퓨터에 설치된 것과 평소 다루는 종류를 보고 내가 무엇을 하는 사람인지 가늠해. 그다음 네 능력으로 구체적으로 도와줄 일을 몇 가지, 한 문장씩: 언제 쓰는지, 무엇을 덜어 주는지. 기능 목록을 읽지 말고 이 머신에 실제로 있는 것에 맞춰."
+ "diagnoseNetwork": {
+ "label": "인터넷이 느린 원인을 진단해 줘",
+ "prompt": "인터넷이 왜 느린지 알아보고, 문제와 해결 방법을 알려줘."
+ },
+ "unusedApps": {
+ "label": "오래 안 쓰면서 공간을 차지하는 앱을 찾아줘",
+ "prompt": "컴퓨터에서 오래 안 썼을 가능성이 있으면서 공간을 차지하는 앱을 찾아줘. 제거하기 전에 내가 확인하게 해 줘."
+ },
+ "stockDigest": {
+ "label": "매일 주식 브리핑을 보내줘",
+ "prompt": "매일 받아 볼 주식 브리핑을 설정해 줘. 2400.HK(XD Inc.)부터 시작해도 되니, 다른 관심 종목과 받고 싶은 시간을 물어봐."
+ },
+ "morningBrief": {
+ "label": "나만의 매일 아침 브리핑을 만들어 줘",
+ "prompt": "매일 아침 브리핑을 설정해 줘. 관심 있는 내용과 받을 시간을 함께 정해 줘."
+ },
+ "watchWebpage": {
+ "label": "관심 있는 웹페이지의 변화를 지켜봐 줘",
+ "prompt": "웹페이지를 지켜보다가 내가 관심 있는 변화가 생기면 알려줘. 주소, 관심 사항, 확인 주기를 함께 정해 줘."
+ },
+ "expenseTracker": {
+ "label": "간단한 가계부 도구를 만들어 줘",
+ "prompt": "나에게 맞는 가계부 도구를 만들어 줘. 기능과 사용법은 함께 이야기하고, 완성하면 써 보게 해 줘."
+ },
+ "kidsGame": {
+ "label": "게임을 만들고 싶어",
+ "prompt": "게임을 만들고 싶어. 내 아이디어를 다듬도록 도와주거나 재미있는 아이디어를 몇 가지 추천해 줘. 방향을 고른 뒤 함께 만들어 보자."
+ },
+ "habitTracker": {
+ "label": "나에게 맞는 습관 기록 페이지를 만들어 줘",
+ "prompt": "내가 꾸준히 하고 싶은 일에 맞는 습관 기록 페이지를 만들어 줘. 완성하면 써 보게 해 줘."
},
"recentDocs": {
- "label": "최근 문서를 보고 목록으로 정리해 줘",
- "prompt": "최근에 열거나 고친 문서를 주제별로 묶고, 일이 몇 더미인지, 각각 어디까지 왔는지, 방치된 게 있는지 알려 줘. 각 파일 위치가 있는 목록. 읽기 전용. 파일은 건드리지 마."
+ "label": "이 자료들을 한 페이지로 요약해 줘",
+ "prompt": "내가 제공한 자료를 한 페이지로 정리해서 핵심을 빠르게 파악할 수 있게 해 줘."
},
- "listCodeProjects": {
- "label": "이 컴퓨터의 코드 프로젝트를 나열해 줘",
- "prompt": "자주 쓰는 디렉터리에서 코드 프로젝트를 찾아, 각각 무엇을 하는지, 무엇으로 짰는지, 마지막 변경이 언제인지 한 문장으로. 본선처럼 보이는 것과 포기한 것처럼 보이는 것을 나눠. 하나도 없으면 없다고 말해. 이번 라운드는 읽기 전용. 파일은 바꾸지 마."
+ "subscriptionSpend": {
+ "label": "내 구독 지출을 정리해 줘",
+ "prompt": "구독에 얼마나 쓰고 있는지 정리하고, 취소하거나 조정할 만한 항목을 찾아줘. 우선 제안만 해 줘."
},
- "storageUsage": {
- "label": "디스크를 무엇이 차지하는지 살펴봐",
- "prompt": "이 컴퓨터 저장 공간을 큰 것부터 보고, 캐시, 중복, 잊힌 오래된 것을 구분해. 점유 순위와 무엇을 지워야 공간이 가장 많이 남는지 한 줄 결론. 집계만. 지우지 마."
+ "organizeFolder": {
+ "label": "폴더를 분류해서 정리해 줘",
+ "prompt": "파일을 찾기 쉽도록 폴더를 정리해 줘. 먼저 대상 폴더와 정리 계획을 함께 정하고, 파일은 삭제하지 마."
},
- "unusedApps": {
- "label": "설치해 두고 안 쓰는 앱을 찾아줘",
- "prompt": "설치된 앱을 용량과 최근 사용으로 줄 세우고, 오래 안 열었는데 자리를 많이 차지하는 것을 짚어. 목록만. 아직 제거하지 마."
+ "photoTimeline": {
+ "label": "사진을 시간순으로 정리해 줘",
+ "prompt": "사진을 보기 좋은 타임라인으로 정리해 줘. 원본 사진은 보존해 줘."
+ },
+ "photoAlbumPage": {
+ "label": "이 사진들로 앨범 페이지를 만들어 줘",
+ "prompt": "내 사진으로 예쁘고 둘러보기 편한 앨범 웹페이지를 만들어 줘. 완성하면 열어서 보여 주고, 원본 사진은 보존해 줘."
},
"uncommittedChanges": {
- "label": "최근 프로젝트의 미커밋을 확인해 줘",
- "prompt": "최근에 만진 코드 프로젝트의 커밋하지 않은 변경을 보고, 무엇을 하는지, 분명한 문제나 빠뜨린 게 있는지 알려 줘. 읽기 전용. 파일은 건드리지 말고 커밋도 하지 마."
+ "label": "커밋하지 않은 변경 사항을 리뷰해 줘",
+ "prompt": "프로젝트의 커밋하지 않은 변경 사항을 리뷰해서 문제와 빠진 부분을 찾아줘. 우선 제안만 하고, 파일은 수정하지 마."
+ },
+ "exploreRepo": {
+ "label": "이 프로젝트를 안내해 줘",
+ "prompt": "이 프로젝트를 안내해 줘. 무엇을 하는지, 어떻게 실행하는지, 더 살펴볼 만한 부분은 어디인지 알려줘."
+ },
+ "initAgentDoc": {
+ "label": "AGENTS.md를 만들어 줘",
+ "prompt": "프로젝트에 맞는 AGENTS.md를 만들어 줘. 기존 안내 파일이 있으면 먼저 보완할 내용을 제안하고, 바로 덮어쓰지 마."
+ },
+ "listCodeProjects": {
+ "label": "컴퓨터의 코드 프로젝트와 용도를 정리해 줘",
+ "prompt": "컴퓨터의 코드 프로젝트를 정리하고, 각각 무엇을 하는 프로젝트인지 알려줘."
},
"devEnvironment": {
- "label": "개발 환경을 한 번 점검해 줘",
- "prompt": "이 머신의 개발 환경을 점검: 언어 런타임과 패키지 매니저, 각 버전, 충돌이나 너무 오래된 것, git 설정 문제. 현황 목록과 먼저 고칠 곳 한 줄. 점검만. 설치하거나 설정을 바꾸지 마."
+ "label": "개발 환경을 점검하고 개선점을 알려줘",
+ "prompt": "개발 환경을 점검해서 고치거나 개선할 만한 부분을 찾아줘. 우선 제안만 해 줘."
},
- "whySlow": {
- "label": "컴퓨터가 왜 느린지 알아봐",
- "prompt": "이 컴퓨터가 왜 느린지 알아봐: 부하, 메모리, 디스크, 켜 둔 시간, CPU/메모리를 많이 쓰는 프로세스. 근거 있는 짧은 결론. 읽기 전용. 아무것도 바꾸지 말고, 프로세스를 죽이지 말고, 무엇을 열어 뒀는지도 묻지 마."
+ "makePlugin": {
+ "label": "Cindy 플러그인을 만들어 줘",
+ "prompt": "Cindy 플러그인을 만들고 싶어. 원하는 것을 구체화하도록 도와주거나 유용하고 재미있는 아이디어를 몇 가지 추천해 줘. 방향을 고른 뒤 만들어 줘."
},
- "diagnoseNetwork": {
- "label": "네트워크 속도를 진단해 줘",
- "prompt": "이 컴퓨터 네트워크를 진단: ping, DNS, 유선인지 Wi-Fi인지. 한두 문장 결론. 긴 속도 테스트는 하지 마. 통신사도 묻지 마."
+ "sendFeedback": {
+ "label": "Cindy 개발자에게 의견을 전해 줘",
+ "prompt": "Cindy에 대한 내 의견을 이해하기 쉬운 피드백으로 정리해 줘. 내가 검토한 뒤에 제출해 줘."
},
- "subscriptionSpend": {
- "label": "구독 지출을 집계해 줘",
- "prompt": "다운로드, 영수증, 로컬 청구서에서 구독 결제를 찾아 서비스 이름과 금액을 나열해. 없으면 없다고 말해. 구독은 바꾸지 말고, 카드도 묻지 말고, 메일에도 로그인하지 마."
+ "readOwnSource": {
+ "label": "Cindy의 소스 코드를 보여 줘",
+ "prompt": "Cindy 소스 코드(github.com/makecindy/cindy)를 보면서 네가 어떻게 구현되었는지 알려줘. 그런 다음 재미있는 부분을 골라 더 깊이 살펴보자."
},
- "expenseTracker": {
- "label": "간단한 가계부 도구를 만들어 줘",
- "prompt": "이 대화 작업 공간에 바로 열 수 있는 로컬 가계부를 만들어: 날짜, 금액, 분류, 메모. 백엔드 없이. 추가 기능도 묻지 마."
+ "whatCindyCanDo": {
+ "label": "지금 도와줄 수 있는 일을 제안해 줘",
+ "prompt": "내 최근 세션과 지금 사용할 수 있는 기능을 바탕으로, 내 수고를 덜어 줄 구체적인 일을 몇 가지 추천해 줘. 그중 하나를 골라 시작하게 해 줘."
}
},
"noProvider": {
@@ -7590,6 +7642,27 @@
"offlineHint": "오프라인 — 연결 후 사용 가능",
"attachmentsDropped": "첨부파일 {{count}}개를 제거했습니다 — 이전 기기에 있는 파일입니다",
"attachmentsRemoteUnsupported": "원격 기기에서는 파일 첨부를 지원하지 않아 {{count}}개를 건너뛰었습니다(이미지는 가능)"
+ },
+ "pluginSuggestions": {
+ "changed": "이 추천이 업데이트되었습니다. 추천을 바꾼 뒤 다시 선택해 주세요.",
+ "unavailable": "지금은 이 플러그인을 사용할 수 없습니다. 플러그인 페이지에서 확인해 주세요.",
+ "pending": "플러그인을 설치하거나 활성화하면 “{{task}}” 작업이 이어집니다.",
+ "cancel": "이어가기 취소",
+ "usePlugin": "{{name}} 플러그인({{id}})을 사용해 이 작업을 완료해 주세요. 먼저 ghost_info로 현재 도구를 확인한 다음 필요에 따라 ghost_call을 호출하세요. 계정 연결이 필요하면 플러그인의 기존 연결 절차를 사용하세요.",
+ "mail": {
+ "today": {
+ "label": "오늘 처리해야 할 메일 정리하기",
+ "prompt": "오늘 처리해야 할 이메일을 살펴보고 할 일을 정리해 줘. 아직 이메일은 변경하지 마."
+ },
+ "unanswered": {
+ "label": "아직 답장하지 않은 중요한 메일 찾기",
+ "prompt": "아직 답장하지 않은 주목할 만한 이메일을 찾아서, 어떤 메일에 후속 대응이 필요한지 살펴봐 줘."
+ },
+ "reply": {
+ "label": "이 메일에 답장 초안 만들기",
+ "prompt": "이 메일의 답장 초안을 써 줘. 주고받은 메일과 내 생각을 반영하고, 아직 보내지는 마."
+ }
+ }
}
},
"onboarding": {
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 42bbe6c13e..837e94bdae 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -6955,53 +6955,105 @@
"homeSuggestions": {
"shuffle": "换一批",
"dismiss": "不再显示",
+ "storageUsage": {
+ "label": "给电脑清一次垃圾",
+ "prompt": "帮我找出电脑里值得清理的内容,看看能省出多少空间,清理前让我确认。"
+ },
+ "whySlow": {
+ "label": "查查电脑为什么卡",
+ "prompt": "帮我查查电脑为什么卡,找出原因并给我改善建议。"
+ },
"downloadsDesktop": {
- "label": "看看我的下载和桌面堆了什么,列一份该清理的清单",
- "prompt": "看一下我的下载文件夹和桌面,统计都堆了些什么:占空间最大的、明显重复的、半年以上没动过的、以及能安全归档的。给我一份清单,每一项标清在哪、多大、为什么建议处理。这一轮只看不动,等我确认再说要不要动手。"
+ "label": "彻底整理下载和桌面",
+ "prompt": "帮我把下载文件夹和桌面整理得清爽、好找,先给我看看整理方案。"
},
- "whatCindyCanDo": {
- "label": "看看我这台电脑上都有什么,你能帮我做哪些事",
- "prompt": "看一下我这台电脑上装了什么、我平时在弄什么类型的东西,据此判断我大概是做什么的。然后告诉我:以你的能力,最能帮到我的具体是哪几件事,每件用一句话说清在什么场景下用、能替我省掉什么。不要念功能清单,要针对我这台机器上真实存在的东西说。"
+ "diagnoseNetwork": {
+ "label": "诊断一下网速",
+ "prompt": "帮我查查网速为什么慢,找出问题并建议怎么解决。"
+ },
+ "unusedApps": {
+ "label": "盘一下我装了哪些应用,哪些很久没用还占着地方",
+ "prompt": "帮我找出电脑上可能很久没用、又占空间的应用,卸载前让我确认。"
+ },
+ "stockDigest": {
+ "label": "每天送我一份股票简报",
+ "prompt": "帮我设置每日股票简报。可以从 2400.HK(心动公司)开始,再问问我还关注哪些股票、想什么时候收到。"
+ },
+ "morningBrief": {
+ "label": "定制我的每日晨报",
+ "prompt": "帮我设置每日晨报,和我确定关注的内容和接收时间。"
+ },
+ "watchWebpage": {
+ "label": "替我盯住一个网页",
+ "prompt": "帮我盯住一个网页,有我关心的变化时提醒我。和我确定网址、关注点和检查频率。"
+ },
+ "expenseTracker": {
+ "label": "做个记账小工具",
+ "prompt": "帮我做个适合自己的记账小工具,功能和用法可以一起聊聊,做好后给我试用。"
+ },
+ "kidsGame": {
+ "label": "我要做一个游戏",
+ "prompt": "我想做一个游戏。帮我完善已有的想法,或者推荐几个有趣的创意,选好方向后一起做出来。"
+ },
+ "habitTracker": {
+ "label": "做一个习惯打卡页",
+ "prompt": "帮我做个习惯打卡页,适合我想坚持的事,做好后给我试用。"
},
"recentDocs": {
- "label": "看一遍我最近在弄的文档,帮我理成一份清单",
- "prompt": "看一下我最近一段时间打开和改过的文档,按主题归一归,告诉我我手上大概有几摊事、每摊到哪一步了、有没有明显烂尾的。给我一份清单,标清每份文件在哪。只读,不要动我的文件。"
+ "label": "把这些材料汇总成一页",
+ "prompt": "把我提供的材料整理成一页,让我快速抓住重点。"
},
- "listCodeProjects": {
- "label": "把我电脑上的代码项目列出来,讲清每个是干什么的",
- "prompt": "在我常用的目录里找出所有代码项目,列成一份清单:每个项目一句话说清是干什么的、用什么写的、最近一次改动是什么时候。然后指出哪几个看起来是主线、哪几个像是已经放弃的。如果一个都没找到,直接告诉我没找到。这一轮只读,不要改任何文件。"
+ "subscriptionSpend": {
+ "label": "盘点我的订阅支出",
+ "prompt": "帮我盘点订阅都花了多少钱,找出值得取消或调整的项目,先给我建议。"
},
- "storageUsage": {
- "label": "盘一下这台电脑的存储,空间到底被什么吃掉了",
- "prompt": "盘一遍这台电脑的存储:按占用从大到小列出目录和文件,指出哪些是缓存、哪些是重复、哪些是我大概忘了的旧东西。给我一份占用排行加一句结论:删掉哪几类能腾出最多空间。只统计,不要删任何东西。"
+ "organizeFolder": {
+ "label": "把这个文件夹归类整理",
+ "prompt": "帮我整理一个文件夹,让文件更容易找。先和我确定文件夹及整理方案,不删除文件。"
},
- "unusedApps": {
- "label": "盘一下我装了哪些应用,哪些很久没用还占着地方",
- "prompt": "看一下这台电脑装了哪些应用,按占用空间和最近使用时间排一排,指出哪些很久没打开还占着大块地方。给我一份清单,先不要卸载任何东西。"
+ "photoTimeline": {
+ "label": "把照片整理成时间线",
+ "prompt": "帮我把照片整理成清楚的时间线,保留原图。"
+ },
+ "photoAlbumPage": {
+ "label": "把这批照片做成相册页",
+ "prompt": "用我的照片做一个漂亮、方便翻看的相册网页,做好后打开给我看,保留原图。"
},
"uncommittedChanges": {
- "label": "找出我最近在改的项目,看看有什么没提交的、有没有隐患",
- "prompt": "找出我最近动过的那个代码项目,看一遍还没提交的改动,告诉我这些改动在干什么、有没有明显的问题或漏掉的地方。只读,不要动我的文件,也不要提交任何东西。"
+ "label": "审查我未提交的改动",
+ "prompt": "帮我审查项目里还没提交的改动,找出问题和遗漏,先给建议,不修改文件。"
+ },
+ "exploreRepo": {
+ "label": "带我了解这个项目",
+ "prompt": "带我了解这个项目,讲清它是做什么的、怎么运行,以及值得深入看的地方。"
+ },
+ "initAgentDoc": {
+ "label": "生成 AGENTS.md",
+ "prompt": "帮我为项目生成合适的 AGENTS.md。如果已经有指导文件,先给补充建议,不直接覆盖。"
+ },
+ "listCodeProjects": {
+ "label": "把我电脑上的代码项目列出来,讲清每个是干什么的",
+ "prompt": "帮我盘点电脑上的代码项目,讲清每个项目是做什么的。"
},
"devEnvironment": {
"label": "检查一遍我的开发环境,有没有该修的",
- "prompt": "检查这台机器的开发环境:装了哪些语言运行时和包管理器、各自什么版本、有没有版本冲突或者明显过旧的、git 配置有没有问题。给我一份现状清单加一句结论:哪几处建议先修。只检查,不要自己动手装或改配置。"
+ "prompt": "帮我检查开发环境,找出值得修复或改善的地方,先给建议。"
},
- "whySlow": {
- "label": "查查电脑为什么卡",
- "prompt": "查这台电脑现在为什么卡:负载、内存、磁盘、开机时长、占 CPU/内存最多的几个进程。用几句话给结论和依据。只读,不要改任何东西,不要杀进程,不要问我开了什么。"
+ "makePlugin": {
+ "label": "给 Cindy 做个插件",
+ "prompt": "我想给 Cindy 做个插件。帮我完善需求,或者推荐几个有用、有趣的创意,选好方向后做出来。"
},
- "diagnoseNetwork": {
- "label": "诊断一下网速",
- "prompt": "诊断这台电脑的网络:ping、DNS、现在是有线还是 Wi-Fi,用一两句话给结论。不要跑长时间测速,不要问运营商。"
+ "sendFeedback": {
+ "label": "给 Cindy 的开发者提个意见",
+ "prompt": "帮我把对 Cindy 的意见整理成清楚的反馈,给我看过后再提交。"
},
- "subscriptionSpend": {
- "label": "盘点我的订阅支出",
- "prompt": "扫一遍下载、收据和本地账单,盘点我的订阅都在扣多少钱:列出服务名和金额。找不到就直接说找不到。不要改订阅、不要问银行卡、不要登录邮箱。"
+ "readOwnSource": {
+ "label": "看看 Cindy 自己的源码",
+ "prompt": "带我看看 Cindy 的源码(github.com/makecindy/cindy),讲讲你是怎么实现的,再挑有趣的部分深入看看。"
},
- "expenseTracker": {
- "label": "做个记账小工具",
- "prompt": "在这个任务的工作目录里做一个能直接打开的本地记账小工具:日期、金额、分类、备注。不要后端、不要问还要哪些功能。"
+ "whatCindyCanDo": {
+ "label": "找出几件你能帮我的事",
+ "prompt": "结合我最近的任务和你现在的能力,推荐几件能帮我省事的具体事情,让我选一个开始。"
}
},
"noProvider": {
@@ -7590,6 +7642,27 @@
"offlineHint": "离线 · 连上后可用",
"attachmentsDropped": "已移除 {{count}} 个附件:它们是上一台设备上的文件",
"attachmentsRemoteUnsupported": "远程设备暂不支持文件附件,已跳过 {{count}} 个(图片可以)"
+ },
+ "pluginSuggestions": {
+ "changed": "这条推荐已更新,请换一批后重新选择。",
+ "unavailable": "暂时无法使用这个插件,请到插件页检查。",
+ "pending": "安装或启用插件后,将继续「{{task}}」。",
+ "cancel": "取消接续",
+ "usePlugin": "请使用 {{name}} 插件({{id}})完成这个任务。先通过 ghost_info 查询当前工具,再按需要调用 ghost_call;需要连接账号时,使用插件现有的连接流程。",
+ "mail": {
+ "today": {
+ "label": "整理今天需要我处理的邮件",
+ "prompt": "帮我看看今天有哪些邮件需要处理,整理出待办事项,先不改动邮件。"
+ },
+ "unanswered": {
+ "label": "找出还没回复的重要邮件",
+ "prompt": "帮我找出还没回复、值得关注的邮件,看看哪些需要跟进。"
+ },
+ "reply": {
+ "label": "把这封邮件整理成回复草稿",
+ "prompt": "帮我为这封邮件写一份回复草稿,结合邮件往来和我的想法,先不发送。"
+ }
+ }
}
},
"onboarding": {
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index bae839b13a..b1073984e9 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -6955,53 +6955,105 @@
"homeSuggestions": {
"shuffle": "換一批",
"dismiss": "不再顯示",
+ "storageUsage": {
+ "label": "給電腦清一次垃圾",
+ "prompt": "幫我找出電腦裡值得清理的內容,看看能省出多少空間,清理前讓我確認。"
+ },
+ "whySlow": {
+ "label": "查查電腦為什麼卡",
+ "prompt": "幫我查查電腦為什麼卡,找出原因並給我改善建議。"
+ },
"downloadsDesktop": {
- "label": "看看我的下載和桌面堆了什麼,列一份該清理的清單",
- "prompt": "看一下我的下載資料夾和桌面,統計都堆了些什麼:占空間最大的、明顯重複的、半年以上沒動過的、以及能安全封存的。給我一份清單,每一項標清在哪、多大、為什麼建議處理。這一輪只看不動,等我確認再說要不要動手。"
+ "label": "徹底整理下載和桌面",
+ "prompt": "幫我把下載資料夾和桌面整理得清爽、好找,先給我看看整理方案。"
},
- "whatCindyCanDo": {
- "label": "看看我這台電腦上都有什麼,你能幫我做哪些事",
- "prompt": "看一下我這台電腦上裝了什麼、我平時在弄什麼類型的東西,據此判斷我大概是做什麼的。然後告訴我:以你的能力,最能幫到我的具體是哪幾件事,每件用一句話說清在什麼場景下用、能替我省掉什麼。不要念功能清單,要針對我這台機器上真實存在的東西說。"
+ "diagnoseNetwork": {
+ "label": "診斷一下網速",
+ "prompt": "幫我查查網速為什麼慢,找出問題並建議怎麼解決。"
+ },
+ "unusedApps": {
+ "label": "盤點我裝了哪些應用程式,哪些很久沒用還占著空間",
+ "prompt": "幫我找出電腦上可能很久沒用、又占空間的應用程式,解除安裝前讓我確認。"
+ },
+ "stockDigest": {
+ "label": "每天送我一份股票簡報",
+ "prompt": "幫我設定每日股票簡報。可以從 2400.HK(心動公司)開始,再問問我還關注哪些股票、想什麼時候收到。"
+ },
+ "morningBrief": {
+ "label": "訂製我的每日晨報",
+ "prompt": "幫我設定每日晨報,和我確定關注的內容和接收時間。"
+ },
+ "watchWebpage": {
+ "label": "替我盯住一個網頁",
+ "prompt": "幫我盯住一個網頁,有我關心的變化時提醒我。和我確定網址、關注點和檢查頻率。"
+ },
+ "expenseTracker": {
+ "label": "做個記帳小工具",
+ "prompt": "幫我做個適合自己的記帳小工具,功能和用法可以一起聊聊,做好後給我試用。"
+ },
+ "kidsGame": {
+ "label": "我要做一個遊戲",
+ "prompt": "我想做一個遊戲。幫我完善已有的想法,或者推薦幾個有趣的創意,選好方向後一起做出來。"
+ },
+ "habitTracker": {
+ "label": "做一個習慣打卡頁",
+ "prompt": "幫我做個習慣打卡頁,適合我想堅持的事,做好後給我試用。"
},
"recentDocs": {
- "label": "看一遍我最近在弄的文件,幫我理成一份清單",
- "prompt": "看一下我最近一段時間打開和改過的文件,按主題歸一歸,告訴我我手上大概有幾攤事、每攤到哪一步了、有沒有明顯爛尾的。給我一份清單,標清每份檔案在哪。唯讀,不要動我的檔案。"
+ "label": "把這些資料彙整成一頁",
+ "prompt": "把我提供的資料整理成一頁,讓我快速掌握重點。"
},
- "listCodeProjects": {
- "label": "把我電腦上的程式專案列出來,講清每個是幹什麼的",
- "prompt": "在我常用的目錄裡找出所有程式專案,列成一份清單:每個專案一句話說清是幹什麼的、用什麼寫的、最近一次改動是什麼時候。然後指出哪幾個看起來是主線、哪幾個像是已經放棄的。如果一個都沒找到,直接告訴我沒找到。這一輪唯讀,不要改任何檔案。"
+ "subscriptionSpend": {
+ "label": "盤點我的訂閱支出",
+ "prompt": "幫我盤點訂閱都花了多少錢,找出值得取消或調整的項目,先給我建議。"
},
- "storageUsage": {
- "label": "盤一下這台電腦的儲存,空間到底被什麼吃掉了",
- "prompt": "盤一遍這台電腦的儲存:按占用從大到小列出目錄和檔案,指出哪些是快取、哪些是重複、哪些是我大概忘了的舊東西。給我一份占用排行加一句結論:刪掉哪幾類能騰出最多空間。只統計,不要刪任何東西。"
+ "organizeFolder": {
+ "label": "把這個資料夾分類整理",
+ "prompt": "幫我整理一個資料夾,讓檔案更容易找。先和我確定資料夾及整理方案,不刪除檔案。"
},
- "unusedApps": {
- "label": "盤一下我裝了哪些應用,哪些很久沒用還占著地方",
- "prompt": "看一下這台電腦裝了哪些應用,按占用空間和最近使用時間排一排,指出哪些很久沒打開還占著大塊地方。給我一份清單,先不要解除安裝任何東西。"
+ "photoTimeline": {
+ "label": "把照片整理成時間軸",
+ "prompt": "幫我把照片整理成清楚的時間軸,保留原圖。"
+ },
+ "photoAlbumPage": {
+ "label": "把這批照片做成相簿頁",
+ "prompt": "用我的照片做一個漂亮、方便翻看的相簿網頁,做好後開啟給我看,保留原圖。"
},
"uncommittedChanges": {
- "label": "找出我最近在改的專案,看看有什麼沒提交的、有沒有隱患",
- "prompt": "找出我最近動過的那個程式專案,看一遍還沒提交的改動,告訴我這些改動在幹什麼、有沒有明顯的問題或漏掉的地方。唯讀,不要動我的檔案,也不要提交任何東西。"
+ "label": "審查我未提交的改動",
+ "prompt": "幫我審查專案裡還沒提交的變更,找出問題和遺漏,先給建議,不修改檔案。"
+ },
+ "exploreRepo": {
+ "label": "帶我了解這個專案",
+ "prompt": "帶我了解這個專案,講清它是做什麼的、怎麼執行,以及值得深入看的地方。"
+ },
+ "initAgentDoc": {
+ "label": "產生 AGENTS.md",
+ "prompt": "幫我為專案產生合適的 AGENTS.md。如果已經有指導檔案,先給補充建議,不直接覆寫。"
+ },
+ "listCodeProjects": {
+ "label": "把我電腦上的程式專案列出來,講清每個是做什麼的",
+ "prompt": "幫我盤點電腦上的程式碼專案,講清每個專案是做什麼的。"
},
"devEnvironment": {
"label": "檢查一遍我的開發環境,有沒有該修的",
- "prompt": "檢查這台機器的開發環境:裝了哪些語言執行環境和套件管理器、各自什麼版本、有沒有版本衝突或者明顯過舊的、git 設定有沒有問題。給我一份現狀清單加一句結論:哪幾處建議先修。只檢查,不要自己動手安裝或改設定。"
+ "prompt": "幫我檢查開發環境,找出值得修復或改善的地方,先給建議。"
},
- "whySlow": {
- "label": "查查電腦為什麼卡",
- "prompt": "查這台電腦現在為什麼卡:負載、記憶體、磁碟、開機時長、占 CPU/記憶體最多的幾個行程。用幾句話給結論和依據。唯讀,不要改任何東西,不要結束行程,不要問我開了什麼。"
+ "makePlugin": {
+ "label": "給 Cindy 做個插件",
+ "prompt": "我想給 Cindy 做個插件。幫我完善需求,或者推薦幾個有用、有趣的創意,選好方向後做出來。"
},
- "diagnoseNetwork": {
- "label": "診斷一下網速",
- "prompt": "診斷這台電腦的網路:ping、DNS、現在是有線還是 Wi-Fi,用一兩句話給結論。不要跑長時間測速,不要問電信業者。"
+ "sendFeedback": {
+ "label": "給 Cindy 的開發者提個意見",
+ "prompt": "幫我把對 Cindy 的意見整理成清楚的回饋,給我看過後再提交。"
},
- "subscriptionSpend": {
- "label": "盤點我的訂閱支出",
- "prompt": "掃一遍下載、收據和本機帳單,盤點我的訂閱都在扣多少錢:列出服務名和金額。找不到就直接說找不到。不要改訂閱、不要問銀行卡、不要登入信箱。"
+ "readOwnSource": {
+ "label": "看看 Cindy 自己的原始碼",
+ "prompt": "帶我看看 Cindy 的原始碼(github.com/makecindy/cindy),講講你是怎麼實現的,再挑有趣的部分深入看看。"
},
- "expenseTracker": {
- "label": "做個記帳小工具",
- "prompt": "在這個任務的工作目錄裡做一個能直接打開的本機記帳小工具:日期、金額、分類、備註。不要後端、不要問還要哪些功能。"
+ "whatCindyCanDo": {
+ "label": "找出幾件你能幫我的事",
+ "prompt": "結合我最近的任務和你現在的能力,推薦幾件能幫我省事的具體事情,讓我選一個開始。"
}
},
"noProvider": {
@@ -7590,6 +7642,27 @@
"offlineHint": "離線 · 連上後可用",
"attachmentsDropped": "已移除 {{count}} 個附件:它們是上一臺裝置上的檔案",
"attachmentsRemoteUnsupported": "遠端裝置暫不支援檔案附件,已跳過 {{count}} 個(圖片可以)"
+ },
+ "pluginSuggestions": {
+ "changed": "這條推薦已更新,請換一批後重新選擇。",
+ "unavailable": "暫時無法使用這個插件,請到插件頁檢查。",
+ "pending": "安裝或啟用插件後,將繼續「{{task}}」。",
+ "cancel": "取消接續",
+ "usePlugin": "請使用 {{name}} 插件({{id}})完成這個任務。先透過 ghost_info 查詢目前的工具,再依需要呼叫 ghost_call;需要連接帳號時,使用插件現有的連接流程。",
+ "mail": {
+ "today": {
+ "label": "整理今天需要我處理的郵件",
+ "prompt": "幫我看看今天有哪些郵件需要處理,整理出待辦事項,先不改動郵件。"
+ },
+ "unanswered": {
+ "label": "找出還沒回覆的重要郵件",
+ "prompt": "幫我找出還沒回覆、值得關注的郵件,看看哪些需要跟進。"
+ },
+ "reply": {
+ "label": "把這封郵件整理成回覆草稿",
+ "prompt": "幫我為這封郵件寫一份回覆草稿,結合郵件往來和我的想法,先不寄送。"
+ }
+ }
}
},
"onboarding": {
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index eed55341c7..bb9d4bb907 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -1283,6 +1283,7 @@ interface ElectronAPI {
/** 意识仓库 —— 数据模型与校验见 shared/ghost.ts,main 端见 main/cindy-brain/。 */
ghosts: {
+ recommendationsSync: () => import('../shared/homePluginRecommendations').HomePluginRecommendationsSnapshot;
/** 首帧同步拉取已装清单(规则 7:意识面板与内置面板同帧注册,无跳变)。 */
listSync: () => { ghosts: import('../shared/ghost').InstalledGhost[] };
onForgeOidcInstallConfirmRequest: (
diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.ts
index 6e7eae5c9c..2e0521d224 100644
--- a/apps/desktop/src/shared/ghost.ts
+++ b/apps/desktop/src/shared/ghost.ts
@@ -1,4 +1,5 @@
import {
+ type GhostRecommendation,
GHOST_LOCALES,
GHOST_MANIFEST_SUMMARY_MAX_CHARS,
GHOST_OAUTH_SCOPES_MAX,
@@ -1367,6 +1368,8 @@ export function isGhostSetupErrorCode(value: unknown): value is GhostSetupErrorC
/** ghost.json 清单(不变量由 validateGhostManifest 保证)。 */
export interface GhostManifest {
+ /** Optional v3 extension, validated only when projecting homepage recommendations. */
+ recommendations?: unknown;
/** 原始清单格式版本;v2 已在解析边界投影成与 v3 相同的直接字段。 */
schemaVersion: 2 | 3;
/** 唯一标识,同时是安装目录名与 panelKind 后缀。 */
@@ -6218,6 +6221,12 @@ export type GhostPipeHostRequest =
capability: GhostMediaCapability;
};
+/** Replaces only the calling plugin's catalog; never starts a task. */
+export interface GhostPipeRecommendationsUpdate {
+ type: 'recommendations-update';
+ items: GhostRecommendation[];
+}
+
/** 插件请求 Agent 新回合时可选的会话处理方式。 */
export const GHOST_AGENT_RUN_MODES = ['continue', 'fork', 'new'] as const;
export type GhostAgentRunMode = (typeof GHOST_AGENT_RUN_MODES)[number];
diff --git a/apps/desktop/src/shared/homePluginRecommendations.ts b/apps/desktop/src/shared/homePluginRecommendations.ts
new file mode 100644
index 0000000000..0584e4cd90
--- /dev/null
+++ b/apps/desktop/src/shared/homePluginRecommendations.ts
@@ -0,0 +1,16 @@
+import type { GhostRecommendation } from '@cindy/plugin-protocol';
+
+export interface HomePluginRecommendationSource {
+ ghostId: string;
+ name: string;
+ enabled: boolean;
+ /** undefined = legacy plugin; [] = author explicitly withdrew all tasks. */
+ items?: GhostRecommendation[];
+}
+
+export interface HomePluginRecommendationsSnapshot {
+ ownerId: string | null;
+ sources: HomePluginRecommendationSource[];
+ recentIds: string[];
+ newlyInstalledId: string | null;
+}
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index c2b5c38e12..bc270ec589 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -36,7 +36,7 @@
| `desktop.overlay.splash` | desktop | 启动遮罩 | App → SplashScreen;同源 gating 下并挂 LoginBrandStage(z-9980 品牌画布,启动期即可见、Splash(z-9999) 之下) | LoginBrandStage, SplashScreen | apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/splash/SplashScreen.tsx | 3 | 0 | 5 |
| `desktop.overlay.toast` | desktop | Toast | App 常驻 ToastContainer(用户可见出口,不展开业务逻辑) | Toast, ToastContainer | apps/desktop/src/renderer/components/ui/toast/Toast.tsx, apps/desktop/src/renderer/components/ui/toast/ToastContainer.tsx, apps/desktop/src/renderer/components/ui/toast/index.ts | 7 | 4 | 3 |
| `desktop.plugins.app-main` | desktop | 插件主视图 | hash `/apps/:ghostId`(GhostMainViewFeatureLayout) | GhostMainViewFeatureLayout, GhostMainViewHost | apps/desktop/src/renderer/features/plugin/GhostMainViewFeatureLayout.tsx, apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 0 | 0 | 0 |
-| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 49 | 0 | 81 |
+| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 49 | 0 | 82 |
| `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderDialog.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 142 | 121 | 726 |
| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/globals.css | 145 | 72 | 288 |
| `desktop.skillhub.local` | desktop | SkillHub 本地技能 | hash `/skillhub/local` 及详情 `/skillhub/local/:kind/global/:name`、`/skillhub/local/:kind/project/:projectHash/:name` | InstallTargetPicker, PluginManagementLayout, SkillhubDetailView, SkillhubFeatureLayout, SkillhubHomeView, SkillhubMarketPreviewPanel | apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubFeatureLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketPreviewPanel.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx | 41 | 0 | 71 |
diff --git a/packages/plugin-protocol/src/__tests__/recommendations.test.ts b/packages/plugin-protocol/src/__tests__/recommendations.test.ts
new file mode 100644
index 0000000000..f420c18125
--- /dev/null
+++ b/packages/plugin-protocol/src/__tests__/recommendations.test.ts
@@ -0,0 +1,90 @@
+import { describe, expect, it } from "vitest";
+import {
+ localizeGhostRecommendation,
+ validateGhostRecommendations,
+} from "../recommendations.js";
+import { validateGhostManifest } from "../manifest.js";
+
+const item = {
+ id: "mail",
+ label: "Review email",
+ prompt: "List the emails needing my attention.",
+};
+const manifest = {
+ schemaVersion: 3,
+ minCindyVersion: "0.1.61",
+ id: "example",
+ name: "Example",
+ version: "1",
+ entry: "main.js",
+};
+describe("optional recommendation contract", () => {
+ it("keeps legacy manifests valid and accepts complete replacement including empty", () => {
+ expect(validateGhostManifest(manifest).ok).toBe(true);
+ const result = validateGhostManifest({
+ ...manifest,
+ recommendations: [item],
+ });
+ expect(result.ok && result.manifest.recommendations).toEqual([item]);
+ expect(validateGhostRecommendations([])).toEqual({ ok: true, items: [] });
+ });
+ it.each(
+ [
+ [item, item],
+ [{ ...item, id: "../other" }],
+ [{ ...item, priority: 99 }],
+ [{ ...item, label: "" }],
+ [{ ...item, prompt: "a".repeat(8001) }],
+ Array.from({ length: 25 }, (_, i) => ({ ...item, id: `item-${i}` })),
+ ].map((value) => ({ value })),
+ )("rejects invalid or quota-controlling author content", ({ value }) => {
+ expect(validateGhostRecommendations(value).ok).toBe(false);
+ // This was historically an opaque extension. Invalid recommendations must not reject
+ // an otherwise valid installed plugin or change its approved manifest contents.
+ const parsed = validateGhostManifest({
+ ...manifest,
+ recommendations: value,
+ });
+ expect(parsed.ok && parsed.manifest.recommendations).toEqual(value);
+ });
+ it.each(["legacy metadata", { custom: true }, [item]])(
+ "ignores v2 extension metadata: %j",
+ (recommendations) => {
+ const parsed = validateGhostManifest({
+ ...manifest,
+ schemaVersion: 2,
+ slots: [],
+ recommendations,
+ });
+ expect(parsed.ok).toBe(true);
+ expect(parsed.ok && parsed.manifest).not.toHaveProperty(
+ "recommendations",
+ );
+ },
+ );
+ it("bounds total bytes and rejects cyclic data without throwing", () => {
+ expect(
+ validateGhostRecommendations(
+ Array.from({ length: 24 }, (_, i) => ({
+ ...item,
+ id: `item-${i}`,
+ prompt: "界".repeat(2000),
+ })),
+ ).ok,
+ ).toBe(false);
+ const cyclic: unknown[] = [];
+ cyclic.push(cyclic);
+ expect(validateGhostRecommendations(cyclic).ok).toBe(false);
+ });
+ it("localizes text with an English fallback", () => {
+ const translated = {
+ ...item,
+ locales: {
+ en: { label: "English", prompt: "English prompt" },
+ "zh-TW": { label: "郵件", prompt: "檢查郵件" },
+ },
+ };
+ expect(localizeGhostRecommendation(translated, "zh-TW").label).toBe("郵件");
+ expect(localizeGhostRecommendation(translated, "ko").label).toBe("English");
+ });
+});
diff --git a/packages/plugin-protocol/src/index.ts b/packages/plugin-protocol/src/index.ts
index cead9581a7..e514e2ab5a 100644
--- a/packages/plugin-protocol/src/index.ts
+++ b/packages/plugin-protocol/src/index.ts
@@ -1,3 +1,4 @@
export * from './manifest.js';
+export * from './recommendations.js';
export * from './delivery.js';
export * from './memberUpload.js';
diff --git a/packages/plugin-protocol/src/manifest.ts b/packages/plugin-protocol/src/manifest.ts
index 015d6e7aeb..fbe55cf139 100644
--- a/packages/plugin-protocol/src/manifest.ts
+++ b/packages/plugin-protocol/src/manifest.ts
@@ -1,3 +1,4 @@
+
/** `.cindy` 包根目录中的 manifest 文件名。 */
export const GHOST_MANIFEST_FILE = 'ghost.json';
@@ -852,6 +853,8 @@ export const GHOST_SETUP_KV_KEY_RE = /^[A-Za-z0-9_.-]{1,64}$/;
/** 已校验的 ghost.json 协议文档;Desktop 会再投影成无 slots 的运行时模型。 */
export interface GhostManifest {
+ /** Optional v3 extension; consumers validate it without changing legacy approval content. */
+ recommendations?: unknown;
/** v2 仅作存量兼容;新插件使用 v3。 */
schemaVersion: 2 | typeof GHOST_MANIFEST_SCHEMA_VERSION;
/** 唯一标识,同时是安装目录名与 panelKind 后缀。 */
diff --git a/packages/plugin-protocol/src/recommendations.ts b/packages/plugin-protocol/src/recommendations.ts
new file mode 100644
index 0000000000..dac4e9c0ee
--- /dev/null
+++ b/packages/plugin-protocol/src/recommendations.ts
@@ -0,0 +1,90 @@
+/** Optional author content, never a capability grant or a model system instruction. */
+export interface GhostRecommendation {
+ id: string;
+ label: string;
+ prompt: string;
+ locales?: Partial<
+ Record<
+ "en" | "zh-CN" | "zh-TW" | "ja" | "ko",
+ { label: string; prompt: string }
+ >
+ >;
+}
+
+export function validateGhostRecommendations(
+ value: unknown,
+): { ok: true; items: GhostRecommendation[] } | { ok: false; reason: string } {
+ const fail = {
+ ok: false as const,
+ reason:
+ "recommendations must contain at most 24 unique tasks (id, label, prompt, optional locales), within 64 KiB",
+ };
+ if (!Array.isArray(value) || value.length > 24) return fail;
+ try {
+ if (new TextEncoder().encode(JSON.stringify(value)).length > 65536)
+ return fail;
+ } catch {
+ return fail;
+ }
+ const ids = new Set<string>();
+ const text = (x: unknown, max: number): x is string =>
+ typeof x === "string" && x.trim().length > 0 && x.length <= max;
+ const object = (x: unknown): x is Record<string, unknown> =>
+ x !== null && typeof x === "object" && !Array.isArray(x);
+ const items: GhostRecommendation[] = [];
+ for (const raw of value) {
+ if (
+ !object(raw) ||
+ Object.keys(raw).some(
+ (k) => !["id", "label", "prompt", "locales"].includes(k),
+ ) ||
+ typeof raw.id !== "string" ||
+ !/^[a-z0-9][a-z0-9-]{0,63}$/.test(raw.id) ||
+ ids.has(raw.id) ||
+ !text(raw.label, 120) ||
+ !text(raw.prompt, 8000)
+ )
+ return fail;
+ ids.add(raw.id);
+ const locales: GhostRecommendation["locales"] = {};
+ if (raw.locales !== undefined) {
+ if (!object(raw.locales)) return fail;
+ for (const [locale, entry] of Object.entries(raw.locales)) {
+ if (
+ !["en", "zh-CN", "zh-TW", "ja", "ko"].includes(locale) ||
+ !object(entry) ||
+ Object.keys(entry).some((k) => k !== "label" && k !== "prompt") ||
+ !text(entry.label, 120) ||
+ !text(entry.prompt, 8000)
+ )
+ return fail;
+ locales[locale as keyof typeof locales] = {
+ label: entry.label,
+ prompt: entry.prompt,
+ };
+ }
+ }
+ items.push({
+ id: raw.id,
+ label: raw.label,
+ prompt: raw.prompt,
+ ...(raw.locales === undefined ? {} : { locales }),
+ });
+ }
+ return { ok: true, items };
+}
+
+export function localizeGhostRecommendation(
+ item: GhostRecommendation,
+ locale: string,
+): GhostRecommendation {
+ const translated =
+ item.locales?.[
+ locale as keyof NonNullable<GhostRecommendation["locales"]>
+ ] ?? item.locales?.en;
+ return {
+ id: item.id,
+ label: translated?.label ?? item.label,
+ prompt: translated?.prompt ?? item.prompt,
+ };
+}