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。

fix(desktop): 本地 learn 待审查计入系统角标

WZBbiao07a733933520
diff --git a/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts b/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts
index 44ba31c439..744dab938e 100644
--- a/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts
+++ b/apps/desktop/src/renderer/__tests__/appAttentionCount.test.ts
@@ -55,14 +55,12 @@ describe('app attention total', () => {
session('local'),
session('remote', { deviceLinkDeviceId: 'device-a' }),
session('scheduler', { source: 'scheduler' }),
- session('learn', { source: 'learn' }),
session('legacy', { title: '[Schedule] nightly', source: 'desktop' }),
],
attentionKinds: new Map([
['local', 'done'],
['remote', 'done'],
['scheduler', 'error'],
- ['learn', 'awaiting'],
['legacy', 'done'],
]),
localSchedules: new Map([
@@ -74,6 +72,17 @@ describe('app attention total', () => {
).toBe(1);
});
+ it('counts a local learn session that is awaiting review', () => {
+ expect(
+ countAppAttention(
+ input({
+ sessions: [session('learn', { source: 'learn' })],
+ attentionKinds: new Map([['learn', 'awaiting']]),
+ }),
+ ),
+ ).toBe(1);
+ });
+
it('still counts user-driven attention on ordinary tasks bound by a heartbeat schedule', () => {
expect(
countAppAttention(
diff --git a/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx b/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx
index a0f5ecd875..607c828916 100644
--- a/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx
+++ b/apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx
@@ -43,6 +43,7 @@ export function AppBadgeAttentionSync() {
allSessions,
runningSessionIds,
);
+ // 远程会话只提供目录 ID 做去重,不计入角标(见 countAppAttention)。
const count = countAppAttention({
sessions: allSessions,
localSchedules,
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
index a6cc288166..cc130890a4 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts
@@ -18,7 +18,15 @@ export interface AppAttentionCountInput {
localSchedules: ReadonlyMap<string, ScheduleAttention>;
}
-/** 与任务行的红/蓝/绿点同源,不随搜索、折叠或当前机器筛选改变。 */
+/**
+ * 与任务行的红/蓝/绿点同源,不随搜索、折叠或当前机器筛选改变。
+ * 例外只覆盖本机没有可处理入口、或自动化完成态:
+ * - device-link 远程会话由对端提醒,本机点不掉;
+ * - scheduler 与 legacy Schedule 标题会话的结果归自动化页;
+ * - 绑在普通会话上的 heartbeat 完成态(done + 未读 run)不计入,
+ * 之后的 awaiting / error 仍计入。
+ * 本地 learn 会话不在例外里:awaiting-review 是本机必须处理的审查。
+ */
export function countAppAttention(input: AppAttentionCountInput): number {
const attentionIds = new Set<string>();
for (const session of input.sessions) {
@@ -26,8 +34,7 @@ export function countAppAttention(input: AppAttentionCountInput): number {
session.status !== 'active' ||
isOrcaWorkerSession(session) ||
session.deviceLinkDeviceId !== undefined ||
- isAutomationGeneratedSession(session) ||
- session.source === 'learn'
+ isAutomationGeneratedSession(session)
)
continue;
const activity = projectSidebarSessionActivity({
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index 2001486fac..3faf991189 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -2825,7 +2825,12 @@ interface ElectronAPI {
) => Promise<{ configured: boolean; enabled: boolean; maskedKey?: string }>;
clear: () => Promise<{ configured: boolean; enabled: boolean }>;
};
- /** 主窗口投影全部任务的关注总数;独立于通知事件及逐任务已读回执。 */
+ /**
+ * 主窗口投影本机需处理任务的关注总数,不是字面「全部任务」。
+ * 不含 device-link 远程会话,不含 scheduler / legacy Schedule 标题自动化会话,
+ * 也不含绑在普通会话上的 heartbeat 完成态(done + 未读 run)。
+ * 本地 learn 会话的待审查等关注态仍计入。独立于通知事件及逐任务已读回执。
+ */
notificationSetAppAttentionCount: (
snapshot: import('../shared/sessionAttention').AppAttentionSnapshot,
) => Promise<void>;
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index f11be5e477..14ab2d722f 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -98,7 +98,7 @@ The grayscale rule is near-absolute. The following are the **only** sanctioned n
> - **Cindy Make source comparison** — the owner-approved source overview (2026-09-20, refined 2026-09-21) combines local main and the online target in one row, with personal below. Matching main hashes appear once in `--status-success`; differing hashes show the local value in `--text-secondary` → the verified online target in `--status-success`, with a `--text-tertiary` arrow. The online green identifies the official target even when local main is behind; difference counts remain explicit. Personal uses an icon-first label flush with the main row's left edge, without chip fill or inset padding: status icon, then `cindy-personal` with the localized status in parentheses, followed by the SHA and change count. The icon, name and parenthesized status inherit one color. Latest uses a check and `--status-success`; missing official updates use a download icon and the existing Light/Dark update foreground `--upgrade-banner-fg`; an inconclusive comparison uses a help icon and `--text-secondary`. The status stays visible; the shared hover/focus `Tip` may explain it further. This is informational, with no click action. During operations that replace the comparison, keep the name neutral and omit the status icon, suffix and tooltip. Personal-only changes do not invalidate latest; unavailable lookups never imply latest or an available update. Each source row wraps independently. Both modes use existing tokens; no other version surface inherits this treatment.
> - **Shared-task mobile confirmations** — only the management page is full-screen. Remove, leave, close-current and close-all use compact confirmations. iOS retains `showConfirm` and the system Alert with supported Liquid Glass / older-system fallback. On 2026-09-20 the user rejected Android's default green-text system Alert: Android uses a centered content-height card, container radius 12, themed elevated surface, neutral outlined Cancel and pill-shaped solid danger action using `sharedTaskConfirmBackground/Foreground`. Reuse Mobile action primitives, minimum target 44, wrap actions when needed, and scroll long descriptions. Android Back cancels; the scrim does not dismiss. Cancellation preserves the task, page, tab and scroll position. An in-task guest exits directly from task details, without another management page. No native configuration changes or simulated iOS glass. Desktop retains the Plan B shared window.
> - **CINDY checked Switch** — `--switch-track-on` uses blue `#417CDD` in CINDY Light and Dark (owner decision 2026-09-15, §15.17). This is an enabled-state signal, independently adjustable from focus, caret and Auto Approval despite sharing their current hue. Other themes retain their own checked-track colors.
-> - **Windows taskbar attention badge** — the native OS overlay uses a fixed red background (`#D91F37`) and white digits with no outline (`#FFFFFF`) in both Light and Dark taskbars. This is the app-wide count of active tasks needing attention, not an error-only status. The image-specific semantic pair lives in `apps/desktop/src/main/windowsBadgeIcon.ts`; it is not an in-app theme token. Keep a 16-logical-pixel transparent canvas and center the circle and digits at 80% of their original size (user refinement, 2026-09-16). Render using the highest connected display scale and pass that physical-size image directly to the Windows Shell through the native taskbar bridge (Electron 41 otherwise forces overlays to 16 physical pixels). Redraw after display/DPI changes and taskbar recreation; keep the multi-resolution Electron overlay as a failure fallback. Use a circle for one digit, a rounded square for multiple digits, and `99+` above 99. The accessibility description keeps the exact total. Only the OS image may use its fitted 8–12px system-font digits; web typography and status-dot color rules are unchanged.
+> - **Windows taskbar attention badge** — the native OS overlay uses a fixed red background (`#D91F37`) and white digits with no outline (`#FFFFFF`) in both Light and Dark taskbars. This is the count of local tasks needing attention, not an error-only status and not a literal total of every task. Device-link sessions owned by another machine are excluded, as are automation-generated sessions (scheduler source or a legacy Schedule title prefix) and a heartbeat completion (done with an unread run) bound to an ordinary task. A local learn session is not that exception: awaiting-review is a review the user must handle on this machine, using the same done / awaiting / error signals. Later awaiting or error attention on a heartbeat-bound ordinary task still counts. The image-specific semantic pair lives in `apps/desktop/src/main/windowsBadgeIcon.ts`; it is not an in-app theme token. Keep a 16-logical-pixel transparent canvas and center the circle and digits at 80% of their original size (user refinement, 2026-09-16). Render using the highest connected display scale and pass that physical-size image directly to the Windows Shell through the native taskbar bridge (Electron 41 otherwise forces overlays to 16 physical pixels). Redraw after display/DPI changes and taskbar recreation; keep the multi-resolution Electron overlay as a failure fallback. Use a circle for one digit, a rounded square for multiple digits, and `99+` above 99. The accessibility description keeps the exact total. Only the OS image may use its fitted 8–12px system-font digits; web typography and status-dot color rules are unchanged.
> - **Toast Info / Success / Warning / Error** — `#417CDD` / `#2AAE5B` / `#F3A115` / `#D91F37`(finalized 2026-07-17; Toast exemption lifted) — used ONLY on the 16×16 lucide icon inside Toast pill notifications. The pill body (background, text, border, close icon) remains strictly grayscale. Info blue #417CDD equals the focus-ring / Auto Approval value (originally #3B82F6, added 2026-07-14, now finalized); success/warning/error equal the global status colors (done green / status error / warning foreground).
> - **Usage History category color (owner-approved 2026-09-08, extended 2026-09-09).** The registered usage heatmap uses a blue intensity scale. Daily token bars and their corresponding model-table swatches/share marks use `--usage-model-1` … `--usage-model-5` as the seed palette; additional models receive theme-derived hues without a top-five cutoff. All model identities in the full history are included, even when absent from the last 30 days. Agent/harness swatches, share marks and the stacked share strip reuse the existing engine identity tokens: `--engine-badge-cc` (terracotta orange), `--engine-badge-codex` (blue), and `--usage-model-1` (owner-chosen teal for pi, to distinguish it from Codex blue). Claude/Codex retain their cross-mode fixed-value contract; pi follows the existing Light/Dark teal values. `--usage-heatmap-high` supplies the high end of the heatmap. The heatmap retains its process-blue alias; category colors do not inherit process/status semantics. Task marks, text and control frames stay neutral. See [the component specification](./usage-history-charts.md); colors.ts remains the seed-value source, with runtime derivation under governance §3.4.
> - **Resource Usage Process Categories** — the Resource Usage table may color only its 14px process-type glyphs so dense rows can be scanned by category (user-requested 2026-08-06). The six category pairs are task Agent blue `#2563EB / #60A5FA`, Agent service purple `#7C3AED / #A78BFA`, main-process pink `#DB2777 / #F472B6`, renderer cyan `#0891B2 / #22D3EE`, GPU amber `#D97706 / #F59E0B`, and utility green `#059669 / #34D399` (Light / Dark). These colors encode process category, **not health or status**; row backgrounds, labels, metrics, selection and actions remain on the neutral system. Direct use is confined to `resource-usage` process glyphs; the explicitly registered Usage History heatmap alias above may also reference the task-blue value. No other table or process UI inherits this permission. Tokens: `--process-agent-task-icon`, `--process-agent-service-icon`, `--process-main-icon`, `--process-renderer-icon`, `--process-gpu-icon`, `--process-utility-icon`.