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): unify Cindy Make sidebar and remote resource cards

Lizi3f25de23ff23
diff --git a/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts b/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
index 3038ea0c27..03b5af44f3 100644
--- a/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
+++ b/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
@@ -89,7 +89,13 @@ describe('Cindy Make composer presentation', () => {
}
const expression = topSlot.initializer.expression;
const renderSlot = (cindyMakeRecoveryId: string | null, session: { id: string } | null) =>
- evaluate(expression, { createElement, CindyMakeEditingActions: 'editing-actions', cindyMakeRecoveryId, session });
+ evaluate(expression, {
+ createElement,
+ CindyMakeEditingActions: 'editing-actions',
+ cindyMakeRecoveryId,
+ session,
+ remoteMakeCards: { blocked: false, handlesSession: false, supported: false },
+ });
// Recovery must still reach ChatInput, never replace it with a blocking card.
for (let child: ts.Node = input; !ts.isJsxExpression(child.parent); child = child.parent) {
@@ -104,6 +110,7 @@ describe('Cindy Make composer presentation', () => {
sessionBinding: { attached: false }, sessionId: 'task-a', session: { id: 'task-a' },
cindyMakeComposerPhase: null, cindyMakePendingTest: null,
cindyMakeRecoveryId: 'continued-completion',
+ remoteMakeCards: { blocked: false, handlesSession: false, supported: false },
worktreePreparing: false, smoothedBranchName: null, shareSelectionActive: false,
})), parent.condition.getText(ast)).toBe(false);
}
@@ -134,6 +141,7 @@ describe('Cindy Make composer presentation', () => {
cindyMakeComposerPhase: phase,
cindyMakePendingTest: pendingTest,
cindyMakeRecoveryId: recoveryId,
+ remoteMakeCards: { blocked: false, handlesSession: false, supported: false },
})).toBe(Boolean(phase || pendingTest));
}
}
diff --git a/apps/desktop/src/renderer/__tests__/mainListModel.test.ts b/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
index 34a8a9ea36..2bc472f8c7 100644
--- a/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
+++ b/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
@@ -151,7 +151,7 @@ describe('Cindy Make sidebar group', () => {
expect(mixed.sessions).toEqual([personal, ordinary]);
});
- it('orders the root and its tasks by the existing attention priorities', () => {
+ it('keeps the root first while ordering its tasks by the existing attention priorities', () => {
const waiting = make('waiting', '2026-09-17T01:00:00Z');
const newer = make('newer', '2026-09-17T02:00:00Z');
const newest = session({ updatedAt: '2026-09-17T03:00:00Z' });
@@ -172,6 +172,47 @@ describe('Cindy Make sidebar group', () => {
expect(getMainListEntrySessions(entries[0])).toEqual([waiting, newer]);
});
+ it.each(['recency', 'created', 'priority'] as const)(
+ 'keeps idle Cindy Make first under %s, custom project order and device grouping',
+ (sortBy) => {
+ const local = make('local', '2026-09-17T01:00:00Z');
+ const remote = make('remote', '2026-09-17T01:00:00Z', { deviceLinkDeviceId: 'remote-device' });
+ const newer = session({ updatedAt: '2026-09-18T00:00:00Z' });
+ const remoteNewer = session({ updatedAt: '2026-09-18T00:00:00Z', deviceLinkDeviceId: 'remote-device' });
+ for (const groupBy of ['project', 'flat'] as const) {
+ for (const projectOrder of ['activity', 'custom'] as const) {
+ const options = {
+ sortBy,
+ projectOrder,
+ manualProjectOrder: ['local:ordinary'],
+ priorityContext: {
+ ...NO_PRIORITY,
+ attentionSessionIds: new Set([newer.id, remoteNewer.id]),
+ waitingSessionIds: new Set([newer.id, remoteNewer.id]),
+ },
+ };
+ const entries = buildMainListEntries({
+ projects: [project('ordinary', [newer]), project('make', [local])],
+ dialogues: [remoteNewer],
+ unclassified: [remote],
+ groupBy,
+ groupDialogue: false,
+ ...options,
+ });
+ expect(entries[0].kind).toBe('cindy-make-group');
+ expect(getMainListEntrySessions(entries[0])).toHaveLength(2);
+ const sections = splitEntriesByDevice(entries, ['remote-device'], options);
+ expect(sections.map((section) => section.entries[0].kind)).toEqual([
+ 'cindy-make-group',
+ 'cindy-make-group',
+ ]);
+ expect(getMainListEntrySessions(sections[0].entries[0])).toEqual([local]);
+ expect(getMainListEntrySessions(sections[1].entries[0])).toEqual([remote]);
+ }
+ }
+ },
+ );
+
it('separates local and remote Cindy Make roots by device', () => {
const local = make('local', '2026-09-17T01:00:00Z');
const remote = make('remote', '2026-09-17T02:00:00Z', { deviceLinkDeviceId: 'remote-device' });
diff --git a/apps/desktop/src/renderer/__tests__/onlineDeviceHeaders.test.tsx b/apps/desktop/src/renderer/__tests__/onlineDeviceHeaders.test.tsx
index 8de8b95061..b96f83d0fd 100644
--- a/apps/desktop/src/renderer/__tests__/onlineDeviceHeaders.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/onlineDeviceHeaders.test.tsx
@@ -1,8 +1,10 @@
// @vitest-environment jsdom
import type { ReactNode } from 'react';
-import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import type { Session } from '@/lib/ccAgent.types';
+import type { ProjectNode } from '../features/cc-agent/lib/projectGrouping';
import {
ProjectsSection,
type ProjectsSectionProps,
@@ -26,14 +28,30 @@ vi.mock('../features/cc-agent/sidebar/MainListScopeHeader', () => ({
MainListScopeHeader: ({ fold }: { fold: { label: string; onClick: () => void } | null }) =>
fold ? <button onClick={fold.onClick}>{fold.label}</button> : null,
}));
-vi.mock('@/components/sidebar/SortableList', () => ({ SortableList: () => null }));
-vi.mock('../features/cc-agent/sidebar/sections/ProjectNode', () => ({ ProjectNode: () => null }));
+vi.mock('@/components/sidebar/SortableList', () => ({
+ SortableList: ({
+ items,
+ renderItem,
+ }: {
+ items: ProjectNode[];
+ renderItem: (item: ProjectNode) => ReactNode;
+ }) => <>{items.map(renderItem)}</>,
+}));
+vi.mock('../features/cc-agent/sidebar/sections/ProjectNode', () => ({
+ ProjectNode: ({ project }: { project: ProjectNode }) => <span>{project.displayName}</span>,
+}));
// Keep device grouping real; the header bridge is outside this rendering test.
vi.mock('../features/cc-agent/sidebar/DeviceSectionHeader', () => ({
DeviceSectionHeader: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
vi.mock('../features/cc-agent/sidebar/sections/UnclassifiedSection', () => ({
- UnclassifiedSection: () => null,
+ UnclassifiedSection: ({ sessions }: { sessions: Session[] }) => (
+ <>
+ {sessions.map((session) => (
+ <span key={session.id}>{session.title}</span>
+ ))}
+ </>
+ ),
}));
vi.mock('@/features/bots/BotAvatar', () => ({ BotAvatar: () => <span>Bot avatar</span> }));
vi.mock('../features/cc-agent/sidebar/SessionItem', () => ({ SessionItem: () => null }));
@@ -153,3 +171,103 @@ describe('Online device headers without tasks', () => {
expect(screen.queryByText('Remote device')).toBeNull();
});
});
+
+describe('Cindy Make sidebar entry', () => {
+ function makeProps(groupDevice: boolean, custom: boolean) {
+ const p = props(groupDevice);
+ const make = {
+ id: 'make',
+ title: 'Make task',
+ source: 'cindy-make',
+ status: 'active',
+ createdAt: '2026-09-17T00:00:00Z',
+ updatedAt: '2026-09-17T00:00:00Z',
+ } as Session;
+ const ordinary = {
+ ...make,
+ id: 'ordinary',
+ source: undefined,
+ title: 'Ordinary draft',
+ createdAt: '2026-09-22T00:00:00Z',
+ updatedAt: '2026-09-22T00:00:00Z',
+ };
+ p.unclassified = [ordinary, make];
+ p.projects = [
+ {
+ projectKey: 'local:/ordinary',
+ displayName: 'Ordinary project',
+ workingDir: '/ordinary',
+ scope: 'local',
+ remoteHostId: null,
+ deviceLinkDeviceId: null,
+ deviceLinkDeviceName: null,
+ deviceLinkConnectionStatus: null,
+ segments: 1,
+ sessions: [ordinary],
+ latestActivityAt: ordinary.updatedAt,
+ },
+ ];
+ p.filter.projectOrder = custom ? 'custom' : 'activity';
+ p.filter.manualProjectOrder = ['local:/ordinary'];
+ return p;
+ }
+
+ it.each([false, true])(
+ 'renders Make before projects and drafts with device grouping %s',
+ (groupDevice) => {
+ for (const custom of [false, true]) {
+ render(<ProjectsSection {...makeProps(groupDevice, custom)} />);
+ const make = screen.getByText('settings.cindyMake.title');
+ const project = screen.getByText('Ordinary project');
+ expect(
+ make.compareDocumentPosition(project) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ if (!groupDevice) {
+ expect(
+ make.compareDocumentPosition(screen.getByText('Ordinary draft')) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ }
+ expect(screen.getAllByText('settings.cindyMake.title')).toHaveLength(1);
+ cleanup();
+ }
+ },
+ );
+
+ it('opens the settings creation dialog without toggling the group and resets it after cancel', async () => {
+ render(<ProjectsSection {...makeProps(false, false)} />);
+ const header = screen.getByText('settings.cindyMake.title').closest('[role="button"]')!;
+ fireEvent.click(header);
+ expect(header.getAttribute('aria-expanded')).toBe('false');
+ const create = within(header as HTMLElement).getByRole('button', {
+ name: 'settings.cindyMake.create.title',
+ });
+ fireEvent.click(create);
+ const dialog = await screen.findByRole('dialog', { name: 'settings.cindyMake.create.title' });
+ expect(header.getAttribute('aria-expanded')).toBe('false');
+ fireEvent.change(within(dialog).getByRole('textbox'), {
+ target: { value: 'Change the sidebar' },
+ });
+ fireEvent.click(
+ within(dialog).getByRole('button', { name: 'settings.cindyMake.create.cancel' }),
+ );
+ expect(screen.queryByRole('dialog')).toBeNull();
+ fireEvent.click(create);
+ const reopened = await screen.findByRole('dialog');
+ expect((within(reopened).getByRole('textbox') as HTMLTextAreaElement).value).toBe('');
+ });
+
+ it.each([false, true])(
+ 'does not open a local creation dialog from remote-only Make with device grouping %s',
+ (groupDevice) => {
+ const p = makeProps(groupDevice, false);
+ p.projects = [];
+ p.unclassified = p.unclassified
+ .filter((session) => session.source === 'cindy-make')
+ .map((session) => ({ ...session, deviceLinkDeviceId: 'remote' }));
+ render(<ProjectsSection {...p} />);
+ expect(screen.getByText('settings.cindyMake.title')).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'settings.cindyMake.create.title' })).toBeNull();
+ },
+ );
+});
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx
index b828c3c1fa..ea8a1c7981 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx
@@ -123,7 +123,7 @@ export function CindyMakeCreateDialog({ onOpenChange }: { onOpenChange: (open: b
rows={5}
maxLength={MAX_REQUEST_LENGTH}
disabled={starting}
- className="min-h-[120px] resize-y"
+ className="min-h-[120px] resize-y placeholder:opacity-55"
onKeyDown={(event) => {
if (
event.key === 'Enter' &&
diff --git a/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx b/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
index 18bba51f4d..bc6ddd4521 100644
--- a/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
@@ -370,6 +370,9 @@ export function CindyMakeSection() {
hidden={activeTab !== 'versions'}
>
<div className="flex flex-col gap-[18px]">
+ <Button className="self-start" onClick={() => setCreateOpen(true)}>
+ {t('settings.cindyMake.create.title')}
+ </Button>
<div className="flex items-start justify-between gap-4 rounded-xl border border-[var(--settings-theme-card-border)] bg-[var(--settings-theme-card-bg)] p-5">
<div className="min-w-0">
<p className="text-13 font-medium text-[var(--settings-section-sublabel)]">
@@ -401,9 +404,6 @@ export function CindyMakeSection() {
aria-label={t('settings.cindyMake.syncBeforeBuild.ariaLabel')}
/>
</div>
- <Button className="self-start" onClick={() => setCreateOpen(true)}>
- {t('settings.cindyMake.create.title')}
- </Button>
<CindyMakeVersionsPanel
active={activeTab === 'versions'}
busy={historyState?.activeWork ?? historyState?.busy}
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index 4ab8b2a420..9146c1d8f5 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -69,6 +69,8 @@ import {
getCindyMakePreparation,
} from '@/lib/cindyMakeComposer';
import { CindyMakeTestCard } from '@/components/cindy-make/CindyMakeTestCard';
+import { SessionResourceCards } from '@/features/device-link/SessionResourceCards';
+import { useSessionResourceCards } from '@/features/device-link/useSessionResourceCards';
import { CindyMakeEditingActions } from '@/components/cindy-make/CindyMakeEditingActions';
import { useCindyMakeEditing } from '@/components/cindy-make/useCindyMakeEditing';
import { useCindyMakeState } from '@/lib/cindyMakeState';
@@ -1781,6 +1783,16 @@ export function CCAgentSessionView({
updateQueueItem,
chatDisplaySnapshot,
} = useCCAgentChat(sessionId, handleTitleUpdate, { chatRealtime });
+ const remoteMakeCards = useSessionResourceCards({
+ deviceId: session?.source === 'cindy-make' && session.status === 'active' && !session.clearedAt
+ ? remoteDeviceId : undefined,
+ sessionId,
+ source: session?.source,
+ connected: remoteConn === 'connected',
+ active: chatRealtime,
+ readOnly,
+ running: isAgentBusy,
+ });
const makeState = useCindyMakeState();
const cindyMakePreparation = useMemo(
() =>
@@ -1797,7 +1809,7 @@ export function CCAgentSessionView({
);
const cindyMakeComposerPhase = useMemo(
() =>
- getCindyMakeComposerPhase({
+ remoteMakeCards.handlesSession ? null : getCindyMakeComposerPhase({
session,
report: cindyMakePreparation?.report,
messages,
@@ -1805,7 +1817,7 @@ export function CCAgentSessionView({
busy: isAgentBusy,
error,
}),
- [session, cindyMakePreparation, messages, historyLoaded, isAgentBusy, error],
+ [session, cindyMakePreparation, messages, historyLoaded, isAgentBusy, error, remoteMakeCards.handlesSession],
);
const cindyMakePendingTest = useMemo(
() => !remoteDeviceId && !readOnly && typeof window.electronAPI.cindyMakeTest === 'function'
@@ -1826,7 +1838,7 @@ export function CCAgentSessionView({
})
: null;
const cindyMakeInputLocked = Boolean(
- cindyMakeComposerPhase || cindyMakePendingTest,
+ cindyMakeComposerPhase || cindyMakePendingTest || remoteMakeCards.blocked,
);
useEffect(() => {
if (!sessionId || !isOrcaLeadSessionView || !historyLoaded) return;
@@ -3447,7 +3459,7 @@ export function CCAgentSessionView({
},
) => {
if (readOnly) return false;
- if (cindyMakeComposerPhase || cindyMakePendingTest) return false;
+ if (cindyMakeInputLocked) return false;
const deliveryMode = opts?.deliveryMode ?? 'queue';
const originalMessage = message;
const navigationRequestVersion =
@@ -3730,8 +3742,7 @@ export function CCAgentSessionView({
vendorAuthGate,
remoteDeviceId,
sessionHandoffPreparing,
- cindyMakeComposerPhase,
- cindyMakePendingTest,
+ cindyMakeInputLocked,
],
);
@@ -4547,7 +4558,7 @@ export function CCAgentSessionView({
botUnreadBoundaryAt={botChatIdentity ? botUnreadBoundaryAt : null}
messages={messages}
cindyMakeSessionId={session?.source === 'cindy-make' ? sessionId : undefined}
- cindyMakeCompletionInComposer={session?.source === 'cindy-make' && !remoteDeviceId && !readOnly && typeof window.electronAPI.cindyMakeTest === 'function'}
+ cindyMakeCompletionInComposer={session?.source === 'cindy-make' && (remoteMakeCards.supported || (!remoteDeviceId && !readOnly && typeof window.electronAPI.cindyMakeTest === 'function'))}
historyLoaded={historyLoaded}
historyCleared={Boolean(session?.clearedAt)}
taskUpdates={taskUpdates}
@@ -5244,6 +5255,8 @@ export function CCAgentSessionView({
userId={sessionBinding.identity?.userId ?? null}
displayName={sessionBinding.displayName}
/>
+ ) : remoteMakeCards.blocked ? (
+ <SessionResourceCards state={remoteMakeCards} />
) : cindyMakeComposerPhase ? (
<CindyMakeComposerMask
phase={cindyMakeComposerPhase}
@@ -5277,7 +5290,7 @@ export function CCAgentSessionView({
sessionId={session.id}
messageId={cindyMakeRecoveryId}
/>
- ) : undefined}
+ ) : remoteMakeCards.handlesSession ? <SessionResourceCards state={remoteMakeCards} /> : undefined}
onSend={handleSend}
onBeforeVoiceInputStart={handleBeforeVoiceInputStart}
sessionId={sessionId}
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts b/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
index 7886bb82ed..8dd455bce1 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
@@ -248,7 +248,9 @@ export function sortSessionsForMainList(
.map((session, index) => ({ session, index, createdAt: sessionCreatedMs(session) }))
.sort(
(a, b) =>
- b.createdAt - a.createdAt || a.session.id.localeCompare(b.session.id) || a.index - b.index,
+ b.createdAt - a.createdAt ||
+ a.session.id.localeCompare(b.session.id) ||
+ a.index - b.index,
)
.map(({ session }) => session);
}
@@ -455,6 +457,9 @@ function sortMainListEntries(
manualProjectOrder: readonly string[],
ctx: MainListPriorityContext,
): MainListEntry[] {
+ // Cindy Make stays above ordinary entries in every sort mode and device section.
+ const makeGroups = entries.filter((entry) => entry.kind === 'cindy-make-group');
+ entries = entries.filter((entry) => entry.kind !== 'cindy-make-group');
if (projectOrder === 'custom') {
// 自定义项目序:项目行按 manualProjectOrder;不在序的新项目由 normalize
// 追加到已排序列之后。非项目条目排在项目之后,仍按当前任务排序。
@@ -465,7 +470,7 @@ function sortMainListEntries(
.map((entry) => entry.project.projectKey);
const normalized = normalizeManualProjectOrder(manualProjectOrder, projectKeys);
const rank = new Map(normalized.map((key, index) => [key, index]));
- return entries.slice().sort((a, b) => {
+ const sorted = entries.slice().sort((a, b) => {
const aProject = a.kind === 'project';
const bProject = b.kind === 'project';
if (aProject !== bProject) return aProject ? -1 : 1;
@@ -479,9 +484,13 @@ function sortMainListEntries(
}
return compareEntriesBySortBy(a, b, sortBy, ctx);
});
+ return [...makeGroups, ...sorted];
}
- return entries.slice().sort((a, b) => compareEntriesBySortBy(a, b, sortBy, ctx));
+ return [
+ ...makeGroups,
+ ...entries.slice().sort((a, b) => compareEntriesBySortBy(a, b, sortBy, ctx)),
+ ];
}
/* ============================== 设备分组(E 期) ============================== */
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index b6d9f388ca..60e08dda58 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -24,7 +24,16 @@ import { isCindyMakeFamilySource } from '../../../../../shared/cindyMakeMerge';
* manualProjectOrder。
*/
-import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';
+import {
+ lazy,
+ Suspense,
+ useCallback,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ type ReactNode,
+} from 'react';
import {
ChevronDown,
ChevronRight,
@@ -116,6 +125,12 @@ import type { FolderPickerOption } from '@/components/new-chat/FolderPickerPopov
import type { SessionMoveTarget } from '../sessionMoveTarget';
import { resolveCollapsedProjectAttentionTone } from '../projectCollapsedAttention';
+const CindyMakeCreateDialog = lazy(() =>
+ import('@/components/cindy-make/CindyMakeCreateDialog').then((module) => ({
+ default: module.CindyMakeCreateDialog,
+ })),
+);
+
/** 手动排序只从项目标题行起手。点击折叠仍走标题行;SortableJS 的
* fallbackTolerance + ignoreNextClick 把点击和拖拽分开。 */
const MANUAL_PROJECT_SORT_HANDLE = '[data-project-header]';
@@ -338,6 +353,7 @@ export function ProjectsSection({
// 段级收起已随「全部任务 = 范围下拉」取消(2026-08-13 用户定稿):标题的点击
// 语义让给机器范围切换;「想要紧凑」由右侧「收起所有分组」承接。
const [showAllProjects, setShowAllProjects] = useCollapsibleShowAll(false);
+ const [makeCreateOpen, setMakeCreateOpen] = useState(false);
// 设备段各自的「显示全部」(2026-08-13 复核 P2:共用一个标志会让点任一段的
// 段内按钮把所有段一起展开——按钮看起来是段内操作,作用域也必须是段内)。
const [expandedDeviceSections, setExpandedDeviceSections] = useState<ReadonlySet<string>>(
@@ -776,9 +792,7 @@ export function ProjectsSection({
(entry) => entry.kind !== 'project' || collapsed.has(entry.project.projectKey),
);
const allGroupsCollapsed =
- allVisibleProjectGroupsCollapsed &&
- allSessionGroupsCollapsed &&
- allAutomationGroupsCollapsed;
+ allVisibleProjectGroupsCollapsed && allSessionGroupsCollapsed && allAutomationGroupsCollapsed;
const hasDeviceLayer = deviceGroupingActive && deviceSections.length > 0;
const allDevicesCollapsed =
hasDeviceLayer &&
@@ -1003,6 +1017,8 @@ export function ProjectsSection({
const createDisabled =
(dialogueDeviceTarget === undefined ? isCreateDialogueDisabled : false) ||
targetDeviceOffline;
+ // The settings dialog creates on this computer; never expose it on a remote-only group.
+ const canCreateMake = entry.sessions.some((session) => !session.deviceLinkDeviceId);
return (
<SessionGroupNode
key={`${entry.kind}:${dialogueGroupKey}`}
@@ -1011,12 +1027,21 @@ export function ProjectsSection({
foldExemptSessionIds={lampFoldExemptIds}
groupTitle={isMake ? t('settings.cindyMake.title') : undefined}
groupIcon={
- isMake ? <Hammer size={15} strokeWidth={1.8} className="shrink-0" aria-hidden /> : undefined
+ isMake ? (
+ <Hammer size={15} strokeWidth={1.8} className="shrink-0" aria-hidden />
+ ) : undefined
}
collapsed={isCollapsed}
onToggle={() => setDialogueCollapsed([groupKey], !isCollapsed)}
- onCreateDialogue={isMake ? undefined : () => onCreateDialogue(dialogueDeviceTarget)}
- isCreateDisabled={createDisabled}
+ onCreateDialogue={
+ isMake
+ ? canCreateMake
+ ? () => setMakeCreateOpen(true)
+ : undefined
+ : () => onCreateDialogue(dialogueDeviceTarget)
+ }
+ createLabel={isMake ? t('settings.cindyMake.create.title') : undefined}
+ isCreateDisabled={isMake ? false : createDisabled}
createDisabledReason={
targetDeviceOffline ? t('ccAgent.remoteSession.actionsUnavailable') : undefined
}
@@ -1044,6 +1069,11 @@ export function ProjectsSection({
return (
<div className="flex flex-col gap-0.5 w-full">
+ {makeCreateOpen && (
+ <Suspense fallback={null}>
+ <CindyMakeCreateDialog onOpenChange={setMakeCreateOpen} />
+ </Suspense>
+ )}
{/* 范围标题恒在:无列表内容时仍画这一行,不把设置入口一起摘掉。 */}
<MainListScopeHeader
filter={filter}
@@ -1063,6 +1093,10 @@ export function ProjectsSection({
/>
{hasMainListContent ? (
<div className="relative flex flex-col gap-1 pt-1 pr-0 pl-3">
+ {!deviceGroupingActive &&
+ visibleMixedEntries
+ .filter((entry) => entry.kind === 'cindy-make-group')
+ .map((entry) => renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY))}
{!deviceGroupingActive ? (
<UnclassifiedSection
sessions={unclassified.filter((session) => !isCindyMakeFamilySource(session.source))}
@@ -1084,7 +1118,7 @@ export function ProjectsSection({
/>
) : null}
{/* 混排渲染(D / E 期):
- - 自定义项目顺序:模型保证项目行连续在前 → 项目段走 SortableList,
+ - 自定义项目顺序:Cindy Make 固定在前,项目段走 SortableList,
其后是散排对话 / 对话组。折叠+溢出时禁用拖拽,点「显示全部」后再拖。
可与设备分组叠加:每段各自拖本段项目。
- 按最近活动:按 deviceSections 切段(设备分组开启时),段内项目行与
@@ -1103,7 +1137,7 @@ export function ProjectsSection({
renderItem={(project) => renderProjectNode(project)}
/>
{visibleMixedEntries
- .filter((entry) => entry.kind !== 'project')
+ .filter((entry) => entry.kind !== 'project' && entry.kind !== 'cindy-make-group')
.map((entry) => renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY))}
</>
) : deviceGroupingActive ? (
@@ -1200,6 +1234,11 @@ export function ProjectsSection({
<>
{customProjectOrder ? (
<>
+ {sectionView.visibleEntries
+ .filter((entry) => entry.kind === 'cindy-make-group')
+ .map((entry) =>
+ renderNonProjectEntry(entry, key, sectionDialogueTarget),
+ )}
<SortableList
items={sectionProjects}
getId={getProjectId}
@@ -1216,7 +1255,11 @@ export function ProjectsSection({
renderItem={(project) => renderProjectNode(project)}
/>
{sectionView.visibleEntries
- .filter((entry) => entry.kind !== 'project')
+ .filter(
+ (entry) =>
+ entry.kind !== 'project' &&
+ entry.kind !== 'cindy-make-group',
+ )
.map((entry) =>
renderNonProjectEntry(entry, key, sectionDialogueTarget),
)}
@@ -1247,11 +1290,13 @@ export function ProjectsSection({
</div>
) : (
<div className="flex flex-col gap-1">
- {visibleMixedEntries.map((entry) =>
- entry.kind === 'project'
- ? renderProjectNode(entry.project)
- : renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY),
- )}
+ {visibleMixedEntries
+ .filter((entry) => entry.kind !== 'cindy-make-group')
+ .map((entry) =>
+ entry.kind === 'project'
+ ? renderProjectNode(entry.project)
+ : renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY),
+ )}
</div>
)}
{/* 全局「显示全部」只属于未按设备分组的单段路径;设备分组下折叠与 footer 都在段内。 */}
@@ -1433,9 +1478,9 @@ export function SessionGroupNode({
onPointerDown={(e) => e.stopPropagation()}
onKeyDown={(e) => e.stopPropagation()}
className={cn(
- 'flex size-5 shrink-0 items-center justify-center rounded-md',
+ 'flex size-6 shrink-0 items-center justify-center rounded-full',
'text-sidebar-action-icon hover:text-foreground',
- 'hover:bg-sidebar-item-hover focus:outline-none',
+ 'hover:bg-sidebar-item-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
'disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent',
)}
>
diff --git a/apps/desktop/src/renderer/features/device-link/SessionResourceCards.tsx b/apps/desktop/src/renderer/features/device-link/SessionResourceCards.tsx
new file mode 100644
index 0000000000..0ecd9e878d
--- /dev/null
+++ b/apps/desktop/src/renderer/features/device-link/SessionResourceCards.tsx
@@ -0,0 +1,86 @@
+import { useTranslation } from 'react-i18next';
+import { resolveRemoteText } from '@cindy/device-link';
+import { Button } from '@/components/ui/button';
+import { Spinner } from '@/components/ui/spinner';
+import type { useSessionResourceCards } from './useSessionResourceCards';
+
+/** Host text is rendered as text, including fallback content from newer primitives. */
+export function SessionResourceCards({
+ state,
+}: {
+ state: ReturnType<typeof useSessionResourceCards>;
+}) {
+ const { t, i18n } = useTranslation();
+ const cards = state.resources.filter(
+ (resource) => resource.blocks.length || resource.actions.length,
+ );
+ if (!cards.length && !state.blocked && !state.failed) return null;
+ const status = !state.connected
+ ? t('cindyMake.remote.offline')
+ : state.failed
+ ? t('cindyMake.remote.failed')
+ : t('cindyMake.remote.syncing');
+ return (
+ <div className="max-h-[40vh] w-full space-y-3 overflow-y-auto rounded-xl border border-[var(--chat-input-border)] bg-[var(--chat-input-bg)] p-4 text-14 text-[var(--text-primary)]">
+ {cards.map((resource) => {
+ const title = resolveRemoteText(resource.display.title, i18n.language);
+ const body =
+ resource.blocks.map((block) => block.fallbackMarkdown).join('\n\n') ||
+ resolveRemoteText(resource.display.subtitle ?? '', i18n.language);
+ const detail =
+ body === title
+ ? ''
+ : body.startsWith(title + '\n\n')
+ ? body.slice(title.length + 2)
+ : body;
+ const busy = resource.blocks.some(
+ (block) => block.primitive === 'session-controls' && block.data?.busy,
+ );
+ return (
+ <section key={JSON.stringify(resource.ref)} aria-label={title} className="space-y-3">
+ <div className="flex items-center gap-2" role="status">
+ {busy && state.fresh ? <Spinner size={16} /> : null}
+ <p className="min-w-0 break-words font-medium">{title}</p>
+ </div>
+ {detail ? (
+ <p className="whitespace-pre-wrap break-words text-13 text-[var(--text-secondary)]">
+ {detail}
+ </p>
+ ) : null}
+ {resource.actions.length ? (
+ <div className="flex flex-wrap gap-2">
+ {resource.actions.map((action) => (
+ <Button
+ key={action.id}
+ variant="secondary"
+ className="h-auto min-h-8 max-w-full whitespace-normal py-1"
+ disabled={state.readOnly || !state.fresh || !!state.pending || action.disabled}
+ loading={state.pending === action.id}
+ onClick={() => void state.act(resource, action.id)}
+ >
+ {resolveRemoteText(action.label, i18n.language)}
+ </Button>
+ ))}
+ </div>
+ ) : null}
+ </section>
+ );
+ })}
+ {!state.fresh || state.failed ? (
+ <div className="flex flex-wrap items-center gap-3" role="status">
+ {state.connected && !state.failed ? <Spinner size={16} /> : null}
+ <p className="text-13 text-[var(--text-secondary)]">{status}</p>
+ {state.failed ? (
+ <Button
+ variant="secondary"
+ disabled={!state.connected || !!state.pending}
+ onClick={state.refresh}
+ >
+ {t('cindyMake.remote.refresh')}
+ </Button>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ );
+}
diff --git a/apps/desktop/src/renderer/features/device-link/__tests__/SessionResourceCards.test.tsx b/apps/desktop/src/renderer/features/device-link/__tests__/SessionResourceCards.test.tsx
new file mode 100644
index 0000000000..87cb29e0ae
--- /dev/null
+++ b/apps/desktop/src/renderer/features/device-link/__tests__/SessionResourceCards.test.tsx
@@ -0,0 +1,219 @@
+// @vitest-environment jsdom
+import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import { afterEach, expect, it, vi } from 'vitest';
+import { createInstance } from 'i18next';
+import { I18nextProvider } from 'react-i18next';
+import {
+ projectMakeRemoteCard,
+ type MakeRemoteSnapshot,
+} from '../../../../main/cindy-make/remoteProjection';
+import type { MakeDoctorReport } from '../../../../shared/cindyMakeDoctor';
+import { SessionResourceCards } from '../SessionResourceCards';
+import {
+ parseSessionResource,
+ sessionResourceCollections,
+ sessionResourceInputBlocked,
+} from '../sessionResources';
+import type { useSessionResourceCards } from '../useSessionResourceCards';
+import en from '@/i18n/locales/en/common.json';
+import zhCN from '@/i18n/locales/zh-CN/common.json';
+import zhTW from '@/i18n/locales/zh-TW/common.json';
+import ja from '@/i18n/locales/ja/common.json';
+import ko from '@/i18n/locales/ko/common.json';
+
+afterEach(cleanup);
+const base: MakeRemoteSnapshot = {
+ sessionId: 'remote-task',
+ revision: '1',
+ busy: false,
+ recoverable: false,
+};
+const completion = { id: 'completion', meta: { reportedAt: 100, commit: 'abc' } };
+const prep: MakeDoctorReport = {
+ runId: 'preparation',
+ status: 'running',
+ checks: [],
+ platform: 'win32',
+ arch: 'x64',
+ task: { sessionId: base.sessionId, phase: 'dependencies' },
+};
+const locales = [
+ ['en', en],
+ ['zh-CN', zhCN],
+ ['zh-TW', zhTW],
+ ['ja', ja],
+ ['ko', ko],
+] as const;
+const phases = [
+ {
+ name: 'preparing',
+ snapshot: { preparation: prep },
+ blocked: true,
+ action: 'cindyMake.history.stop',
+ },
+ {
+ name: 'preparation failure',
+ snapshot: { preparation: { ...prep, status: 'failed' as const } },
+ blocked: true,
+ action: 'cindyMake.history.actions.retry-prepare',
+ },
+ { name: 'test handoff', snapshot: { completion }, blocked: true, action: 'cindyMake.test.start' },
+ {
+ name: 'test startup',
+ snapshot: {
+ completion: {
+ ...completion,
+ meta: {
+ ...completion.meta,
+ test: { status: 'starting' as const, step: 'dependencies' as const },
+ },
+ },
+ },
+ blocked: true,
+ action: 'cindyMake.test.continue',
+ disabled: true,
+ },
+ {
+ name: 'personal build',
+ snapshot: {
+ completion: {
+ ...completion,
+ meta: {
+ ...completion.meta,
+ personal: { buildId: 'build', status: 'packaging' as const },
+ lastAction: 'build' as const,
+ },
+ },
+ },
+ blocked: true,
+ action: 'cindyMake.history.stop',
+ },
+ {
+ name: 'editing recovery',
+ snapshot: { recoverable: true },
+ blocked: false,
+ action: 'cindyMake.test.start',
+ },
+];
+
+it.each(locales)(
+ 'renders host workflow phases and recovery controls in %s',
+ async (locale, strings) => {
+ const i18n = createInstance();
+ await i18n.init({
+ lng: locale,
+ fallbackLng: false,
+ resources: { [locale]: { translation: strings } },
+ });
+ for (const phase of phases) {
+ const wire = projectMakeRemoteCard(
+ { ...base, ...phase.snapshot } as MakeRemoteSnapshot,
+ (key, values) => String(i18n.t(key, values)),
+ );
+ const resource = parseSessionResource(wire, wire.ref);
+ const act = vi.fn();
+ const state: ReturnType<typeof useSessionResourceCards> = {
+ resources: [resource],
+ supported: true,
+ handlesSession: true,
+ fresh: true,
+ readOnly: false,
+ connected: true,
+ pending: null,
+ failed: false,
+ blocked: sessionResourceInputBlocked([resource]),
+ refresh: vi.fn(),
+ act,
+ };
+ expect(state.blocked, phase.name).toBe(phase.blocked);
+ const view = render(
+ <I18nextProvider i18n={i18n}>
+ <SessionResourceCards state={state} />
+ </I18nextProvider>,
+ );
+ const button = screen.getByRole('button', {
+ name: String(i18n.t(phase.action)),
+ }) as HTMLButtonElement;
+ expect(button.disabled).toBe(phase.disabled ?? false);
+ fireEvent.click(button);
+ expect(act).toHaveBeenCalledTimes(phase.disabled ? 0 : 1);
+ expect(view.container.textContent).not.toMatch(/cindyMake[.]|cindyMakeDoctor[.]|�/);
+ view.unmount();
+ }
+ },
+);
+
+it('shows unknown primitives as inert readable text and disables stale actions', async () => {
+ const i18n = createInstance();
+ await i18n.init({ lng: 'en', resources: { en: { translation: en } } });
+ const wire = projectMakeRemoteCard({ ...base, completion }, (key) => key);
+ wire.blocks = [
+ {
+ id: 'future',
+ primitive: 'future-progress',
+ fallbackMarkdown: '<script>do not execute</script>',
+ data: { private: 'not needed' },
+ },
+ ];
+ const resource = parseSessionResource(wire, wire.ref);
+ const state: ReturnType<typeof useSessionResourceCards> = {
+ resources: [resource],
+ supported: true,
+ handlesSession: true,
+ fresh: false,
+ readOnly: false,
+ connected: false,
+ pending: null,
+ failed: false,
+ blocked: true,
+ act: vi.fn(),
+ refresh: vi.fn(),
+ };
+ const view = render(
+ <I18nextProvider i18n={i18n}>
+ <SessionResourceCards state={state} />
+ </I18nextProvider>,
+ );
+ expect(screen.getByText('<script>do not execute</script>')).toBeTruthy();
+ expect(view.container.querySelector('script')).toBeNull();
+ expect(screen.getByText(en.cindyMake.remote.offline)).toBeTruthy();
+ for (const button of screen.getAllByRole('button'))
+ expect((button as HTMLButtonElement).disabled).toBe(true);
+});
+
+it('validates resource identity, preserves unknown block fallback, and never drops required action inputs or confirmation', () => {
+ const wire = projectMakeRemoteCard({ ...base, completion }, (key) => key);
+ expect(() => parseSessionResource(wire, { ...wire.ref, id: 'other-task' })).toThrow();
+ const raw = {
+ ...wire,
+ actions: [
+ { id: 'form', label: 'Form', fields: [{ id: 'required', required: true }] },
+ { id: 'broken-confirmation', label: 'Stop', confirmation: {} },
+ { id: 'disabled', label: 'Disabled', disabled: true },
+ ],
+ blocks: [
+ {
+ id: 'controls',
+ primitive: 'session-controls',
+ fallbackMarkdown: 'Unknown input state',
+ data: {},
+ },
+ ],
+ };
+ const parsed = parseSessionResource(raw, wire.ref);
+ expect(parsed.actions.map((action) => action.id)).toEqual(['disabled']);
+ expect(sessionResourceInputBlocked([parsed])).toBe(true);
+ expect(
+ sessionResourceCollections(
+ {
+ protocolVersion: 1,
+ collections: [
+ { id: 'other', resourceKind: 'bot', placement: 'home-scope' },
+ { unrecognized: true },
+ { id: 'make', resourceKind: 'session', placement: 'session:cindy-make' },
+ ],
+ },
+ 'cindy-make',
+ ),
+ ).toEqual([{ id: 'make', resourceKind: 'session', placement: 'session:cindy-make' }]);
+});
diff --git a/apps/desktop/src/renderer/features/device-link/__tests__/useSessionResourceCards.test.tsx b/apps/desktop/src/renderer/features/device-link/__tests__/useSessionResourceCards.test.tsx
new file mode 100644
index 0000000000..229f5c13a1
--- /dev/null
+++ b/apps/desktop/src/renderer/features/device-link/__tests__/useSessionResourceCards.test.tsx
@@ -0,0 +1,338 @@
+// @vitest-environment jsdom
+import { act, cleanup, renderHook } from '@testing-library/react';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import {
+ REMOTE_RESOURCE_CHANGED_CHANNEL as CHANGED,
+ REMOTE_RESOURCE_MANIFEST_CHANNEL as MANIFEST,
+ REMOTE_RESOURCE_GET_CHANNEL as GET,
+ REMOTE_RESOURCE_INVOKE_CHANNEL as INVOKE,
+ sharedTaskHostPeer,
+} from '@cindy/device-link';
+import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import { resetRemoteDataOwnerPushFence } from '@/lib/remoteDataOwnerPushFence';
+import { useSessionResourceCards } from '../useSessionResourceCards';
+
+const { confirm } = vi.hoisted(() => ({ confirm: vi.fn() }));
+vi.mock('@/components/ui/confirm-dialog-provider', () => ({
+ useConfirmDialog: () => ({ confirm }),
+}));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ i18n: { language: 'en' } }) }));
+const options = {
+ deviceId: 'computer-a',
+ sessionId: 'make-a',
+ source: 'cindy-make',
+ connected: true,
+ running: false,
+};
+type Options = Parameters<typeof useSessionResourceCards>[0];
+type Push = Parameters<Parameters<Window['electronAPI']['deviceLink']['onRemotePush']>[0]>[0];
+const callbacks = new Set<(push: Push) => void>();
+const manifest = {
+ protocolVersion: 1,
+ collections: [{ id: 'cindy-make', resourceKind: 'session', placement: 'session:cindy-make' }],
+};
+function card(sessionId = 'make-a', input = 'blocked') {
+ return {
+ ref: { collectionId: 'cindy-make', kind: 'session', id: sessionId },
+ revision: 'one',
+ display: { title: 'Ready to test' },
+ blocks: [
+ {
+ id: 'workflow',
+ primitive: 'session-controls',
+ fallbackMarkdown: 'Ready to test',
+ data: { input, busy: false },
+ },
+ ],
+ actions: [
+ { id: 'opaque:continue', label: 'Continue editing' },
+ { id: 'opaque:test', label: 'Start test' },
+ { id: 'opaque:build', label: 'Generate personal version' },
+ ],
+ };
+}
+let host = card();
+const invoke = vi.fn();
+function deferred<T>() {
+ let resolve!: (value: T) => void;
+ let reject!: (reason: unknown) => void;
+ const promise = new Promise<T>((yes, no) => {
+ resolve = yes;
+ reject = no;
+ });
+ return { promise, resolve, reject };
+}
+async function tick(ms = 200) {
+ await act(async () => {
+ await vi.advanceTimersByTimeAsync(ms);
+ });
+}
+function push(deviceId = 'computer-a', sessionId = 'make-a', owner = 'account') {
+ act(() => {
+ for (const callback of callbacks)
+ callback({
+ deviceId,
+ channel: CHANGED,
+ ownerStamp: { dataOwnerId: owner, ownerGeneration: 1 },
+ payload: {
+ collectionId: 'cindy-make',
+ resourceRefs: [{ collectionId: 'cindy-make', kind: 'session', id: sessionId }],
+ },
+ });
+ });
+}
+function mount(props: Options = options) {
+ return renderHook((input: Options) => useSessionResourceCards(input), { initialProps: props });
+}
+beforeEach(() => {
+ vi.useFakeTimers();
+ callbacks.clear();
+ setDataOwnerGeneration('account', 1);
+ resetRemoteDataOwnerPushFence();
+ Object.defineProperty(document, 'visibilityState', { configurable: true, value: 'visible' });
+ host = card();
+ invoke.mockReset().mockImplementation(async (_device, channel) => {
+ if (channel === MANIFEST) return manifest;
+ if (channel === GET) return host;
+ return { effects: [] };
+ });
+ confirm.mockReset().mockResolvedValue(true);
+ vi.stubGlobal('electronAPI', {
+ deviceLink: {
+ invoke,
+ onRemotePush: (callback: (push: Push) => void) => {
+ callbacks.add(callback);
+ return () => callbacks.delete(callback);
+ },
+ },
+ });
+});
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ vi.unstubAllGlobals();
+});
+
+it.each(['opaque:continue', 'opaque:test', 'opaque:build'])(
+ 'routes %s to the owning computer once and refreshes host facts',
+ async (actionId) => {
+ const view = mount();
+ expect(view.result.current.blocked).toBe(true);
+ await tick();
+ expect(view.result.current.fresh).toBe(true);
+ const resource = view.result.current.resources[0];
+ const response = deferred<unknown>();
+ invoke.mockImplementation(async (_device, channel) =>
+ channel === INVOKE ? response.promise : channel === MANIFEST ? manifest : host,
+ );
+ let action!: Promise<void>;
+ act(() => {
+ action = view.result.current.act(resource, actionId);
+ void view.result.current.act(resource, actionId);
+ });
+ expect(invoke.mock.calls.filter((call) => call[1] === INVOKE)).toEqual([
+ [
+ 'computer-a',
+ INVOKE,
+ [
+ {
+ client: { protocolVersion: 1, primitives: ['session-controls'], locale: 'en' },
+ collectionId: 'cindy-make',
+ resourceRef: resource.ref,
+ actionId,
+ },
+ ],
+ ],
+ ]);
+ host = card('make-a', 'available');
+ await act(async () => {
+ response.resolve({ effects: [] });
+ await action;
+ });
+ expect(view.result.current.blocked).toBe(true);
+ await tick();
+ expect(view.result.current.blocked).toBe(false);
+ },
+);
+
+it('ignores other computers, tasks and accounts, and refreshes matching changes', async () => {
+ const view = mount();
+ await tick();
+ host = card('make-a', 'available');
+ push('computer-b');
+ push('computer-a', 'make-b');
+ push('computer-a', 'make-a', 'other');
+ await tick();
+ expect(invoke.mock.calls.filter((call) => call[1] === GET)).toHaveLength(1);
+ expect(view.result.current.blocked).toBe(true);
+ push();
+ await tick();
+ expect(view.result.current.blocked).toBe(false);
+});
+
+it('coalesces invalidations and does not publish a read begun before the change', async () => {
+ const response = deferred<unknown>();
+ invoke.mockImplementation(async (_device, channel) =>
+ channel === MANIFEST ? manifest : response.promise,
+ );
+ const view = mount();
+ await tick();
+ push();
+ push();
+ push();
+ await tick(16_000);
+ expect(invoke.mock.calls.filter((call) => call[1] === GET)).toHaveLength(1);
+ invoke.mockImplementation(async () => card());
+ await act(async () => response.resolve(card('make-a', 'available')));
+ expect(view.result.current.fresh).toBe(false);
+ await tick();
+ expect(invoke.mock.calls.filter((call) => call[1] === GET)).toHaveLength(2);
+ expect(view.result.current.blocked).toBe(true);
+});
+
+it.each(['task', 'computer', 'account'])(
+ 'discards late reads and old actions after switching %s',
+ async (change) => {
+ const response = deferred<unknown>();
+ invoke.mockImplementation(async (_device, channel) =>
+ channel === MANIFEST ? manifest : response.promise,
+ );
+ const view = mount();
+ await tick();
+ const next = { ...options };
+ if (change === 'task') next.sessionId = 'make-b';
+ if (change === 'computer') next.deviceId = 'computer-b';
+ if (change === 'account') setDataOwnerGeneration('other', 2);
+ invoke.mockImplementation(async (_device, channel) =>
+ channel === MANIFEST ? manifest : card(next.sessionId, 'available'),
+ );
+ view.rerender(next);
+ await tick();
+ await act(async () => response.resolve(card()));
+ expect(view.result.current.blocked).toBe(false);
+ expect(view.result.current.resources[0].ref.id).toBe(next.sessionId);
+ },
+);
+
+it('keeps the last card offline and reconnects without replaying a failed write', async () => {
+ const view = mount();
+ await tick();
+ const resource = view.result.current.resources[0];
+ invoke.mockRejectedValueOnce(new Error('Reply lost'));
+ await act(async () => view.result.current.act(resource, 'opaque:build'));
+ view.rerender({ ...options, connected: false });
+ expect(view.result.current.resources[0]).toBe(resource);
+ expect(view.result.current.fresh).toBe(false);
+ await act(async () => view.result.current.act(resource, 'opaque:build'));
+ view.rerender(options);
+ expect(view.result.current.fresh).toBe(false);
+ await tick();
+ expect(view.result.current.fresh).toBe(true);
+ expect(view.result.current.failed).toBe(false);
+ expect(invoke.mock.calls.filter((call) => call[1] === INVOKE)).toHaveLength(1);
+});
+
+it('pauses hidden/disabled views and refreshes before enabling actions on return', async () => {
+ const view = mount();
+ await tick();
+ Object.defineProperty(document, 'visibilityState', { configurable: true, value: 'hidden' });
+ act(() => document.dispatchEvent(new Event('visibilitychange')));
+ await tick(20_000);
+ expect(view.result.current.fresh).toBe(false);
+ expect(invoke.mock.calls.filter((call) => call[1] === GET)).toHaveLength(1);
+ Object.defineProperty(document, 'visibilityState', { configurable: true, value: 'visible' });
+ act(() => document.dispatchEvent(new Event('visibilitychange')));
+ await tick();
+ expect(view.result.current.fresh).toBe(true);
+ view.rerender({ ...options, active: false });
+ await tick(20_000);
+ expect(invoke.mock.calls.filter((call) => call[1] === GET)).toHaveLength(2);
+});
+
+it.each(['no-placement', 'old-host'])(
+ 'keeps read-only history when the host has %s',
+ async (kind) => {
+ if (kind === 'old-host')
+ invoke.mockRejectedValue(new Error('[DEVICE_LINK_CHANNEL_NOT_ALLOWED] unavailable'));
+ else invoke.mockResolvedValue({ protocolVersion: 1, collections: [] });
+ const view = mount();
+ await tick();
+ expect(view.result.current.handlesSession).toBe(false);
+ expect(view.result.current.blocked).toBe(false);
+ expect(view.result.current.failed).toBe(false);
+ await tick(20_000);
+ expect(invoke).toHaveBeenCalledTimes(1);
+ },
+);
+
+it('blocks on read errors and supports explicit retry without local fallback', async () => {
+ invoke.mockRejectedValueOnce(new Error('[DEVICE_LINK_TIMEOUT] timeout'));
+ const view = mount();
+ await tick();
+ expect(view.result.current.failed).toBe(true);
+ expect(view.result.current.blocked).toBe(true);
+ act(() => view.result.current.refresh());
+ await tick();
+ expect(view.result.current.failed).toBe(false);
+ expect(view.result.current.fresh).toBe(true);
+});
+
+it.each([undefined, sharedTaskHostPeer('membership', 'computer')])(
+ 'does not discover device-wide resources for local or shared guest tasks (%s)',
+ async (deviceId) => {
+ const view = mount({ ...options, deviceId });
+ await tick();
+ expect(invoke).not.toHaveBeenCalled();
+ expect(view.result.current.blocked).toBe(false);
+ },
+);
+
+it('allows read-only projection but rejects its actions', async () => {
+ const view = mount({ ...options, readOnly: true });
+ await tick();
+ await act(async () => view.result.current.act(view.result.current.resources[0], 'opaque:build'));
+ expect(invoke.mock.calls.some((call) => call[1] === INVOKE)).toBe(false);
+});
+
+it.each(['accept', 'cancel', 'changed', 'disconnect', 'account', 'unmount'])(
+ 'rechecks a stop confirmation on %s',
+ async (change) => {
+ const stop = {
+ id: 'opaque:stop',
+ label: 'Stop',
+ tone: 'destructive',
+ confirmation: { title: 'Stop this build?', body: 'Prepared files are kept.' },
+ };
+ host.actions = [stop];
+ const approval = deferred<boolean>();
+ confirm.mockReturnValue(approval.promise);
+ const view = mount();
+ await tick();
+ let operation!: Promise<void>;
+ act(() => {
+ operation = view.result.current.act(view.result.current.resources[0], stop.id);
+ });
+ expect(confirm).toHaveBeenCalledWith(
+ expect.objectContaining({ title: 'Stop this build?', confirmVariant: 'destructive' }),
+ expect.any(AbortSignal),
+ );
+ if (change === 'changed') {
+ host = card();
+ push();
+ await tick();
+ }
+ if (change === 'disconnect') view.rerender({ ...options, connected: false });
+ if (change === 'account') {
+ setDataOwnerGeneration('other', 2);
+ view.rerender(options);
+ }
+ if (change === 'unmount') view.unmount();
+ await act(async () => {
+ approval.resolve(change !== 'cancel');
+ await operation;
+ });
+ expect(invoke.mock.calls.filter((call) => call[1] === INVOKE)).toHaveLength(
+ change === 'accept' ? 1 : 0,
+ );
+ },
+);
diff --git a/apps/desktop/src/renderer/features/device-link/sessionResources.ts b/apps/desktop/src/renderer/features/device-link/sessionResources.ts
new file mode 100644
index 0000000000..d6c79af0dc
--- /dev/null
+++ b/apps/desktop/src/renderer/features/device-link/sessionResources.ts
@@ -0,0 +1,107 @@
+import { z } from 'zod';
+import { REMOTE_RESOURCE_PROTOCOL_VERSION, type RemoteResourceRef } from '@cindy/device-link';
+
+const id = z.string().min(1).max(160);
+const text = z.union([
+ z.string().max(20_000),
+ z.object({
+ fallback: z.string().max(20_000),
+ translations: z.record(z.string().max(64), z.string().max(20_000)).optional(),
+ }),
+]);
+const ref = z.object({ collectionId: id, kind: id, id });
+const collection = z.object({ id, resourceKind: id, placement: z.string().max(256).optional() });
+const manifest = z.object({
+ protocolVersion: z.number().int().positive(),
+ collections: z.array(z.unknown()).max(256),
+});
+const action = z.object({
+ id,
+ label: text,
+ disabled: z.boolean().optional(),
+ tone: z.string().max(64).optional(),
+ confirmation: z
+ .object({ title: text, body: text.optional(), confirmLabel: text.optional() })
+ .optional(),
+ // This surface does not advertise forms. Never submit an action with omitted fields.
+ fields: z.array(z.unknown()).max(0).optional(),
+});
+const block = z
+ .object({
+ id,
+ primitive: id,
+ fallbackMarkdown: z.string().max(100_000),
+ data: z.unknown().optional(),
+ })
+ .transform((value) => {
+ const controls = z
+ .object({ input: z.string(), busy: z.boolean().optional() })
+ .safeParse(value.data);
+ return {
+ ...value,
+ data: value.primitive === 'session-controls' && controls.success ? controls.data : undefined,
+ };
+ });
+const resource = z.object({
+ ref,
+ revision: z.string().max(1024),
+ display: z.object({
+ title: text,
+ subtitle: text.optional(),
+ status: z.object({ label: text, tone: z.string().max(64).optional() }).optional(),
+ }),
+ blocks: z.array(block).max(256).optional().default([]),
+ actions: z.array(z.unknown()).max(256).optional().default([]),
+});
+
+export type SessionResource = Omit<z.infer<typeof resource>, 'actions'> & {
+ actions: z.infer<typeof action>[];
+};
+export type SessionResourceCollection = z.infer<typeof collection>;
+
+export function sessionResourceClient(locale: string) {
+ return {
+ protocolVersion: REMOTE_RESOURCE_PROTOCOL_VERSION,
+ primitives: ['session-controls'],
+ locale,
+ };
+}
+
+export function sessionResourceCollections(
+ raw: unknown,
+ source: string,
+): SessionResourceCollection[] {
+ return manifest
+ .parse(raw)
+ .collections.flatMap((item) => {
+ const parsed = collection.safeParse(item);
+ return parsed.success && parsed.data.placement === 'session:' + source ? [parsed.data] : [];
+ })
+ .filter((item, index, all) => all.findIndex((other) => other.id === item.id) === index)
+ .slice(0, 4);
+}
+
+export function parseSessionResource(raw: unknown, expected: RemoteResourceRef): SessionResource {
+ const parsed = resource.parse(raw);
+ if (
+ parsed.ref.collectionId !== expected.collectionId ||
+ parsed.ref.kind !== expected.kind ||
+ parsed.ref.id !== expected.id
+ )
+ throw new Error('Unexpected session resource');
+ return {
+ ...parsed,
+ actions: parsed.actions.flatMap((item) => {
+ const parsedAction = action.safeParse(item);
+ return parsedAction.success ? [parsedAction.data] : [];
+ }),
+ };
+}
+
+export function sessionResourceInputBlocked(resources: readonly SessionResource[]): boolean {
+ return resources.some((item) =>
+ item.blocks.some(
+ (block) => block.primitive === 'session-controls' && block.data?.input !== 'available',
+ ),
+ );
+}
diff --git a/apps/desktop/src/renderer/features/device-link/useSessionResourceCards.ts b/apps/desktop/src/renderer/features/device-link/useSessionResourceCards.ts
new file mode 100644
index 0000000000..7b074d79fc
--- /dev/null
+++ b/apps/desktop/src/renderer/features/device-link/useSessionResourceCards.ts
@@ -0,0 +1,334 @@
+import { useEffect, useMemo, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import {
+ isSharedTaskPeer,
+ parseRemoteResourceChangedPayload,
+ REMOTE_RESOURCE_CHANGED_CHANNEL,
+ REMOTE_RESOURCE_GET_CHANNEL,
+ REMOTE_RESOURCE_INVOKE_CHANNEL,
+ REMOTE_RESOURCE_MANIFEST_CHANNEL,
+ resolveRemoteText,
+} from '@cindy/device-link';
+import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';
+import {
+ getDataOwnerGeneration,
+ isDataOwnerGenerationCurrent,
+} from '@/contexts/dataOwnerGeneration';
+import { isDeviceLinkRemotePushCurrent } from '@/lib/remoteDataOwnerPushFence';
+import { extractIpcError } from '@/utils/ipcError';
+import {
+ parseSessionResource,
+ sessionResourceClient,
+ sessionResourceCollections,
+ sessionResourceInputBlocked,
+ type SessionResource,
+ type SessionResourceCollection,
+} from './sessionResources';
+
+interface Snapshot {
+ binding: string;
+ scope: object | undefined;
+ resources: SessionResource[];
+ supported: boolean;
+ failed: boolean;
+ stale?: boolean;
+}
+
+/** A projection of host-owned state; reconnect only reads and never replays writes. */
+export function useSessionResourceCards({
+ deviceId,
+ sessionId,
+ source,
+ connected,
+ active = true,
+ readOnly = false,
+ running,
+}: {
+ deviceId?: string;
+ sessionId?: string;
+ source?: string;
+ connected: boolean;
+ active?: boolean;
+ readOnly?: boolean;
+ running: boolean;
+}) {
+ const { i18n } = useTranslation();
+ const { confirm } = useConfirmDialog();
+ const owner = getDataOwnerGeneration();
+ const enabled = !!deviceId && !isSharedTaskPeer(deviceId) && !!sessionId && !!source;
+ const binding = JSON.stringify([owner, deviceId, sessionId, source, i18n.language]);
+ // Identity must not repeat after disconnect -> reconnect with the same inputs.
+ const scope = useMemo(
+ () => ({ binding, connected, active, readOnly, running }),
+ [binding, connected, active, readOnly, running],
+ );
+ const current = useRef(scope);
+ current.current = scope;
+ const [state, setState] = useState<Snapshot>();
+ const [pending, setPending] = useState<{ binding: string; id: string }>();
+ const [actionError, setActionError] = useState<string>();
+ const request = useRef<{ binding: string } | null>(null);
+ const refresh = useRef<() => void>(() => undefined);
+ const lifetime = useRef<AbortController | undefined>(undefined);
+ // Mutable freshness closes the push -> React render window for action handlers.
+ const ready = useRef(false);
+
+ useEffect(() => {
+ const controller = new AbortController();
+ lifetime.current = controller;
+ ready.current = false;
+ if (!enabled || !connected || !active) return () => controller.abort();
+ const api = window.electronAPI.deviceLink;
+ const client = sessionResourceClient(i18n.language);
+ let collections: SessionResourceCollection[] | undefined;
+ let reading = false;
+ let dirty = false;
+ let generation = 0;
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ const valid = () =>
+ !controller.signal.aborted &&
+ current.current === scope &&
+ isDataOwnerGenerationCurrent(owner) &&
+ document.visibilityState !== 'hidden';
+ const load = async () => {
+ if (!valid() || reading) return;
+ reading = true;
+ dirty = false;
+ const expected = generation;
+ try {
+ if (!collections) {
+ try {
+ const raw = await api.invoke(deviceId!, REMOTE_RESOURCE_MANIFEST_CHANNEL, [{ client }]);
+ if (!valid()) return;
+ collections = sessionResourceCollections(raw, source!);
+ } catch (error) {
+ // Old hosts lack the allowlisted channel. Preserve their read-only history.
+ const code = extractIpcError(error)?.code ?? (error as { code?: string } | null)?.code;
+ if (code === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED' || code === 'CHANNEL_NOT_ALLOWED')
+ collections = [];
+ else throw error;
+ }
+ }
+ if (!valid()) return;
+ const results = await Promise.allSettled(
+ collections.map(async (item) => {
+ const ref = { collectionId: item.id, kind: item.resourceKind, id: sessionId! };
+ return parseSessionResource(
+ await api.invoke(deviceId!, REMOTE_RESOURCE_GET_CHANNEL, [{ client, ref }]),
+ ref,
+ );
+ }),
+ );
+ const failure = results.find((result) => result.status === 'rejected');
+ if (failure?.status === 'rejected') throw failure.reason;
+ if (valid() && generation === expected) {
+ ready.current = true;
+ setActionError(undefined);
+ setState({
+ binding,
+ scope,
+ supported: collections.length > 0,
+ failed: false,
+ resources: results.flatMap((result) =>
+ result.status === 'fulfilled' ? [result.value] : [],
+ ),
+ });
+ }
+ } catch {
+ if (valid() && generation === expected) {
+ ready.current = false;
+ setState((previous) => ({
+ binding,
+ scope,
+ supported: true,
+ failed: true,
+ resources: previous?.binding === binding ? previous.resources : [],
+ }));
+ }
+ } finally {
+ reading = false;
+ if (valid() && dirty) schedule(false);
+ }
+ };
+ const schedule = (invalidate = true, blockInput = false) => {
+ if (!valid()) return;
+ if (invalidate) {
+ generation += 1;
+ ready.current = false;
+ setState((previous) =>
+ previous?.binding === binding
+ ? {
+ ...previous,
+ stale: true,
+ scope: blockInput ? undefined : previous.scope,
+ }
+ : previous,
+ );
+ }
+ if (reading) {
+ if (invalidate) dirty = true;
+ return;
+ }
+ if (timer) clearTimeout(timer);
+ timer = setTimeout(() => {
+ timer = undefined;
+ void load();
+ }, 150);
+ };
+ refresh.current = () => schedule(true, true);
+ // The desktop remote-session synchronizer already owns the sessions topic.
+ const off = api.onRemotePush((push, stamp) => {
+ if (
+ !valid() ||
+ push.deviceId !== deviceId ||
+ push.channel !== REMOTE_RESOURCE_CHANGED_CHANNEL ||
+ !isDeviceLinkRemotePushCurrent(push, stamp)
+ )
+ return;
+ const changed = parseRemoteResourceChangedPayload(push.payload);
+ if (
+ changed &&
+ (!collections || collections.some((item) => item.id === changed.collectionId)) &&
+ (!changed.resourceRefs?.length ||
+ changed.resourceRefs.some(
+ (ref) =>
+ ref.id === sessionId &&
+ (!collections ||
+ collections.some(
+ (item) => item.id === ref.collectionId && item.resourceKind === ref.kind,
+ )),
+ ))
+ )
+ schedule();
+ });
+ const visibility = () => {
+ generation += 1;
+ ready.current = false;
+ if (document.visibilityState !== 'hidden') schedule();
+ else
+ setState((previous) =>
+ previous?.binding === binding ? { ...previous, stale: true } : previous,
+ );
+ };
+ document.addEventListener('visibilitychange', visibility);
+ void load();
+ // Bound foreground recovery for missed pushes. Slow reads are never overlapped.
+ const poll = setInterval(() => {
+ if (collections?.length) schedule(false);
+ }, 5000);
+ return () => {
+ controller.abort();
+ ready.current = false;
+ refresh.current = () => undefined;
+ if (timer) clearTimeout(timer);
+ clearInterval(poll);
+ off();
+ document.removeEventListener('visibilitychange', visibility);
+ };
+ }, [enabled, scope, binding, connected, active, deviceId, sessionId, source, i18n.language]);
+
+ const visible = enabled && state?.binding === binding ? state : undefined;
+ const fresh =
+ !!visible &&
+ visible.scope === scope &&
+ !visible.failed &&
+ !visible.stale &&
+ connected &&
+ active;
+ const latest = useRef({ visible, fresh });
+ latest.current = { visible, fresh };
+ const pendingId = pending?.binding === binding ? pending.id : null;
+ const act = async (resource: SessionResource, actionId: string) => {
+ const action = resource.actions.find((item) => item.id === actionId && !item.disabled);
+ const signal = lifetime.current?.signal;
+ const valid = () =>
+ !signal?.aborted &&
+ current.current === scope &&
+ isDataOwnerGenerationCurrent(owner) &&
+ document.visibilityState !== 'hidden' &&
+ ready.current &&
+ latest.current.fresh;
+ if (
+ !signal ||
+ !enabled ||
+ readOnly ||
+ !valid() ||
+ request.current?.binding === binding ||
+ !action ||
+ !latest.current.visible?.resources.includes(resource)
+ )
+ return;
+ const token = { binding };
+ request.current = token;
+ setPending({ binding, id: actionId });
+ setActionError(undefined);
+ let invoked = false;
+ try {
+ if (action.confirmation) {
+ const resolve = (value: Parameters<typeof resolveRemoteText>[0]) =>
+ resolveRemoteText(value, i18n.language);
+ const accepted = await confirm(
+ {
+ presentation: 'standard',
+ title: resolve(action.confirmation.title),
+ description: action.confirmation.body ? resolve(action.confirmation.body) : undefined,
+ confirmText: resolve(action.confirmation.confirmLabel ?? action.label),
+ confirmVariant: action.tone === 'destructive' ? 'destructive' : 'default',
+ },
+ signal,
+ );
+ if (!accepted || !valid()) return;
+ const next = latest.current.visible?.resources.find(
+ (item) =>
+ item.ref.collectionId === resource.ref.collectionId &&
+ item.ref.kind === resource.ref.kind &&
+ item.ref.id === resource.ref.id,
+ );
+ const nextAction = next?.actions.find((item) => item.id === actionId && !item.disabled);
+ if (!nextAction || JSON.stringify(nextAction) !== JSON.stringify(action)) return;
+ }
+ invoked = true;
+ await window.electronAPI.deviceLink.invoke(deviceId!, REMOTE_RESOURCE_INVOKE_CHANNEL, [
+ {
+ client: sessionResourceClient(i18n.language),
+ collectionId: resource.ref.collectionId,
+ resourceRef: resource.ref,
+ actionId,
+ },
+ ]);
+ } catch {
+ if (!signal.aborted && current.current === scope && isDataOwnerGenerationCurrent(owner))
+ setActionError(binding);
+ } finally {
+ if (request.current === token) {
+ request.current = null;
+ setPending(undefined);
+ }
+ if (invoked && !signal.aborted && current.current === scope) refresh.current();
+ }
+ };
+ return {
+ resources: visible?.resources ?? [],
+ supported: visible?.supported === true,
+ handlesSession: enabled && visible?.supported !== false,
+ fresh,
+ readOnly,
+ connected,
+ pending: pendingId,
+ act,
+ failed: visible?.failed === true || actionError === binding,
+ blocked:
+ enabled &&
+ visible?.supported !== false &&
+ (!visible ||
+ visible.scope !== scope ||
+ !connected ||
+ visible.failed ||
+ sessionResourceInputBlocked(visible.resources) ||
+ !!pendingId),
+ refresh: () => {
+ setActionError(undefined);
+ refresh.current();
+ },
+ };
+}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 4bba514b9a..9e5021db87 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -12959,6 +12959,12 @@
}
},
"cindyMake": {
+ "remote": {
+ "refresh": "Refresh status",
+ "syncing": "Syncing Cindy Make status…",
+ "offline": "Reconnect to the remote computer to continue.",
+ "failed": "Unable to update Cindy Make status. Refresh before continuing."
+ },
"beta": "Beta",
"preflight": {
"closeTitle": "Close Cindy Make?",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 8a456715f6..8365c769ec 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -12942,6 +12942,12 @@
}
},
"cindyMake": {
+ "remote": {
+ "refresh": "状態を再読み込み",
+ "syncing": "Cindy Make の状態を同期中…",
+ "offline": "続行するにはリモートコンピューターに再接続してください。",
+ "failed": "Cindy Make の状態を更新できませんでした。再読み込みしてから続行してください。"
+ },
"beta": "Beta",
"preflight": {
"closeTitle": "Cindy Make を閉じますか?",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index cd22406958..0d7d79cfa0 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -12942,6 +12942,12 @@
}
},
"cindyMake": {
+ "remote": {
+ "refresh": "상태 새로고침",
+ "syncing": "Cindy Make 상태 동기화 중…",
+ "offline": "계속하려면 원격 컴퓨터에 다시 연결하세요.",
+ "failed": "Cindy Make 상태를 업데이트하지 못했습니다. 새로고침한 후 계속하세요."
+ },
"beta": "Beta",
"preflight": {
"closeTitle": "Cindy Make를 닫을까요?",
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 b1875fe27f..84b380fec7 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -12942,6 +12942,12 @@
}
},
"cindyMake": {
+ "remote": {
+ "refresh": "刷新状态",
+ "syncing": "正在同步 Cindy Make 状态…",
+ "offline": "重新连接远程电脑后即可继续。",
+ "failed": "未能更新 Cindy Make 状态,请刷新后继续。"
+ },
"beta": "Beta",
"preflight": {
"closeTitle": "关闭 Cindy Make?",
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 96d465be9d..792cd6f9d6 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -12942,6 +12942,12 @@
}
},
"cindyMake": {
+ "remote": {
+ "refresh": "重新整理狀態",
+ "syncing": "正在同步 Cindy Make 狀態…",
+ "offline": "重新連線遠端電腦後即可繼續。",
+ "failed": "無法更新 Cindy Make 狀態,請重新整理後繼續。"
+ },
"beta": "Beta",
"preflight": {
"closeTitle": "關閉 Cindy Make?",
diff --git a/docs/dev-rules/remote-and-mobile-adaptation.md b/docs/dev-rules/remote-and-mobile-adaptation.md
index a23c880ff0..b2af67bf09 100644
--- a/docs/dev-rules/remote-and-mobile-adaptation.md
+++ b/docs/dev-rules/remote-and-mobile-adaptation.md
@@ -120,6 +120,13 @@ Mobile 根据 manifest 发现卡片,不写死具体业务状态;`session-con
动作的 disabled 是呈现提示,主机仍须按最新状态、账号与任务身份复核。重连只重读,
不得重放写操作;旧客户端不识别此 placement 时继续原有消息流程。
+Desktop 的同账号远程 Cindy Make 任务同样消费该投影:准备与测试交接卡接管输入区,
+继续修改后的恢复动作放在输入区顶部,实时状态与动作均来自任务所属电脑。控制端沿用
+既有 sessions topic,不新增业务 IPC 或本地构建回退;离线、切账号和切任务后禁用旧卡片
+动作,重连与操作超时后只重读状态。旧主机不提供该 placement 时保留只读历史卡片。
+实现与回归见 Desktop Renderer 的 `features/device-link/useSessionResourceCards.ts`、
+`SessionResourceCards.tsx` 及同目录测试;SSH 工作区不由此获得 Make 执行能力。
+
## 本机与远程共用查询策略
本机独立使用、远程操作、两端同时使用应共享数据语义与通用查询策略;远程连接状态
diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.md
index 0dfcd1f805..543bfeb3c5 100644
--- a/docs/product-rules/sidebar-redesign-plan.md
+++ b/docs/product-rules/sidebar-redesign-plan.md
@@ -131,6 +131,12 @@
### 3.2 任务排序 —— 单选
+Cindy Make 分组固定在主列表顶部,不参与普通条目的优先级、最近活动、创建时间或自定义
+项目顺序竞争;按设备分组时固定在所属设备段顶部。组内任务仍遵循当前任务排序。
+本机 Cindy Make 组头在悬停或键盘聚焦时显示创建按钮,直接复用设置页的创建弹窗;
+远程设备专属分组不显示本机创建入口。实现见
+`mainListModel.ts` 与 `ProjectsSection.tsx`,排序回归见 `mainListModel.test.ts`。
+
2026-09-14 文案精简:分组选项显示「项目 / 对话 / 设备」,任务排序选项显示
「优先级 / 最近活动 / 创建时间」,去掉重复的「按」。下表保留排序语义说明;
分组与排序行为不变。「任务状态」入口使用 `ListChecks`,其「活跃」选项保留 `CircleDot`。