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(sidebar): fold teammate routine runs into automation folders

zqchris037981830be2
diff --git a/apps/desktop/src/main/device-link/mirrorCacheStore.ts b/apps/desktop/src/main/device-link/mirrorCacheStore.ts
index cde9a37ef1..a24bdb5b1b 100644
--- a/apps/desktop/src/main/device-link/mirrorCacheStore.ts
+++ b/apps/desktop/src/main/device-link/mirrorCacheStore.ts
@@ -278,7 +278,8 @@ export function coerceCachedSession(input: unknown): Record<string, unknown> | n
const companion = input.companion;
if (isRecord(companion) && typeof companion.id === 'string' && typeof companion.role === 'string') {
out.companion = { id: companion.id, role: companion.role,
- ...(typeof companion.channel === 'string' ? { channel: companion.channel } : {}) };
+ ...(typeof companion.channel === 'string' ? { channel: companion.channel } : {}),
+ ...(typeof companion.routineId === 'string' ? { routineId: companion.routineId } : {}) };
}
return out;
}
diff --git a/apps/desktop/src/main/localDb/__tests__/sessionListPagination.test.ts b/apps/desktop/src/main/localDb/__tests__/sessionListPagination.test.ts
index b17783516b..4e3331398f 100644
--- a/apps/desktop/src/main/localDb/__tests__/sessionListPagination.test.ts
+++ b/apps/desktop/src/main/localDb/__tests__/sessionListPagination.test.ts
@@ -63,8 +63,12 @@ it('lists linked teammate routine/channel tasks, keeping private lanes and hidde
const link = sqlite.prepare('INSERT INTO bot_session_links(bot_id,session_id,role,route_key) VALUES (?,?,?,?)');
for (const role of ['routine', 'channel', 'canonical', 'group', 'thread']) {
insert.run(role, 'bot', role === 'routine' ? 'archived' : 'active');
- link.run('owner', role, role, role === 'channel' ? 'im:feishu:chat' : null);
+ link.run('owner', role, role, role === 'channel' ? 'im:feishu:chat'
+ // 「每次新建任务」的例行任务专线在规则 id 后追加 `:<uuid>`。
+ : role === 'routine' ? 'routine:daily-1:3f2b8c1e-9a4d-4e7f-8b6a-1c2d3e4f5a6b' : null);
}
+ insert.run('routine-persistent', 'bot', 'active');
+ link.run('owner', 'routine-persistent', 'routine', 'routine:daily-1');
for (const id of ['unlinked', 'removed', 'hidden']) insert.run(id, 'bot', 'active');
link.run('removed', 'removed', 'routine', null);
link.run('owner', 'hidden', 'channel', null);
@@ -72,10 +76,13 @@ it('lists linked teammate routine/channel tasks, keeping private lanes and hidde
insert.run('ordinary', 'desktop', 'active');
const db = drizzle(sqlite) as unknown as DbClient['drizzle'];
const rows = await selectSessionListRows(db, ordinaryTaskListFilter(), 100);
- expect(rows.map(row => row.session.id).sort()).toEqual(['channel', 'ordinary', 'routine']);
+ expect(rows.map(row => row.session.id).sort()).toEqual(['channel', 'ordinary', 'routine', 'routine-persistent']);
expect(flattenSessionReadRow(rows.find(row => row.session.id === 'channel')!).companion)
.toEqual({ id: 'owner', role: 'channel', channel: 'feishu' });
- expect(flattenSessionReadRow(rows.find(row => row.session.id === 'routine')!).companion)
- .toEqual({ id: 'owner', role: 'routine' });
+ // 两种运行方式都投影出同一条规则 id,侧栏据此把同规则的运行收进一个文件夹。
+ for (const id of ['routine', 'routine-persistent']) {
+ expect(flattenSessionReadRow(rows.find(row => row.session.id === id)!).companion)
+ .toEqual({ id: 'owner', role: 'routine', routineId: 'daily-1' });
+ }
} finally { sqlite.close(); }
});
diff --git a/apps/desktop/src/main/localDb/historyCompanion.ts b/apps/desktop/src/main/localDb/historyCompanion.ts
index 7e0e54c1b2..36f53c1fdf 100644
--- a/apps/desktop/src/main/localDb/historyCompanion.ts
+++ b/apps/desktop/src/main/localDb/historyCompanion.ts
@@ -7,11 +7,15 @@ export function historyCompanionJson(sessionId: SQL): SQL<string | null> {
FROM bot_session_links hcl WHERE hcl.session_id = ${sessionId} LIMIT 1)`;
}
+// `routine:<routineId>` (persistent) or `routine:<routineId>:<uuid>` (one Session per trigger).
+const ROUTINE_ROUTE_KEY = /^routine:(.+?)(?::[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?$/i;
+
export function parseHistoryCompanion(value: string | null | undefined): HistoryCompanion | null {
if (!value) return null;
const row = JSON.parse(value) as { id: string; role: string; routeKey: string | null };
const channel = row.routeKey?.match(/^im:([^:]+):/)?.[1];
- return { id: row.id, role: row.role, ...(channel ? { channel } : {}) };
+ const routineId = row.role === 'routine' ? row.routeKey?.match(ROUTINE_ROUTE_KEY)?.[1] : undefined;
+ return { id: row.id, role: row.role, ...(channel ? { channel } : {}), ...(routineId ? { routineId } : {}) };
}
/** A query filter only: callers' existing authorization/remote visibility still applies. */
diff --git a/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts b/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
index 1357756627..46c5370504 100644
--- a/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
+++ b/apps/desktop/src/renderer/__tests__/automationGeneratedSessions.test.ts
@@ -440,6 +440,46 @@ describe('automation-generated sessions', () => {
});
});
+ it('folds runs of one teammate routine together and leaves older-host routine rows flat', () => {
+ // 伙伴例行任务不是 schedule:按「伙伴 + 规则」成组,不同规则 / 伙伴各自成组;
+ // 旧主机不投影 routineId 时保持平铺,不误并。
+ const routineRun = (id: string, botId: string, routineId?: string) =>
+ makeSession({
+ id,
+ title: 'Morning brief',
+ source: 'bot',
+ workspaceKind: 'dialogue',
+ companion: { id: botId, role: 'routine', ...(routineId ? { routineId } : {}) },
+ });
+ const sessions = [
+ routineRun('brief-2', 'bot-a', 'brief'),
+ routineRun('brief-1', 'bot-a', 'brief'),
+ routineRun('other-bot', 'bot-b', 'brief'),
+ routineRun('legacy-1', 'bot-a'),
+ routineRun('legacy-2', 'bot-a'),
+ ];
+
+ const entries = groupAutomationSidebarEntries(sessions, { notifications: new Set() });
+
+ expect(entries.map((entry) => entry.kind)).toEqual([
+ 'automation-group',
+ 'session',
+ 'session',
+ 'session',
+ ]);
+ expect(entries[0]).toMatchObject({
+ kind: 'automation-group',
+ group: {
+ id: 'routine:bot-a:brief',
+ title: 'Morning brief',
+ teammateRoutine: { botId: 'bot-a', routineId: 'brief' },
+ },
+ });
+ if (entries[0].kind !== 'automation-group') throw new Error('expected automation group');
+ expect(entries[0].group.scheduleId).toBeUndefined();
+ expect(entries[0].group.sessions.map((session) => session.id)).toEqual(['brief-2', 'brief-1']);
+ });
+
it('shows every recent run as its own row when expanded (primary not hidden into header)', () => {
const group = {
id: 'schedule:sched-jira',
@@ -1031,7 +1071,7 @@ describe('automation-generated sessions', () => {
expect(source).toContain("group.scheduleStatus === 'active'");
// 用正则容忍 prettier 折行(条件在一行还是拆三行都算通过)。
expect(source).toMatch(
- /scheduleId &&\s*!menuOpen &&\s*'group-hover:opacity-0 group-focus-within\/slot:opacity-0'/,
+ /hasHoverActions &&\s*!menuOpen &&\s*'group-hover:opacity-0 group-focus-within\/slot:opacity-0'/,
);
expect(source).toContain("menuOpen && 'opacity-0'");
expect(source).toContain('disabled={!latestSession}');
diff --git a/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx b/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
index 5141a5088d..740c48e331 100644
--- a/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
@@ -46,9 +46,10 @@ export function BotSettingsDrawer() {
const requestedPage = searchParams.get('settingsPage');
const initialPage = requestedPage === 'memory' || requestedPage === 'capabilities' ? requestedPage : 'home';
- // 「模型」「语音」「消息平台」可直接深链;远程伙伴同样,所在电脑不支持的页会回到设置首页。
+ // 「模型」「语音」「消息平台」「例行任务」可直接深链;远程伙伴同样,所在电脑不支持的页会回到设置首页。
const localInitialPage =
requestedPage === 'model' || requestedPage === 'voice' || requestedPage === 'channels'
+ || requestedPage === 'routines'
? requestedPage
: initialPage;
const allowNavigation = useRef(false);
diff --git a/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx b/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx
index 6beac79ebe..2ca2521493 100644
--- a/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx
@@ -102,7 +102,7 @@ export function BotSettings({
beforeCloseRef,
initialPage = 'home',
}: {
- initialPage?: 'home' | 'memory' | 'capabilities' | 'model' | 'voice' | 'channels';
+ initialPage?: 'home' | 'memory' | 'capabilities' | 'model' | 'voice' | 'channels' | 'routines';
bot: BotProfile;
beforeCloseRef?: { current: (() => Promise<boolean>) | null };
onBack: () => void;
diff --git a/apps/desktop/src/renderer/features/bots/RemoteTeammateSettings.tsx b/apps/desktop/src/renderer/features/bots/RemoteTeammateSettings.tsx
index f5cdeebd3e..5e9331caf9 100644
--- a/apps/desktop/src/renderer/features/bots/RemoteTeammateSettings.tsx
+++ b/apps/desktop/src/renderer/features/bots/RemoteTeammateSettings.tsx
@@ -22,7 +22,7 @@ import type { BotProfile } from './botStore';
interface Props {
bot: RemoteBot;
- initialPage?: 'home' | 'memory' | 'capabilities' | 'model' | 'voice' | 'channels';
+ initialPage?: 'home' | 'memory' | 'capabilities' | 'model' | 'voice' | 'channels' | 'routines';
beforeCloseRef: MutableRefObject<(() => Promise<boolean>) | null>;
onBack: () => void;
onDeleted: () => void;
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/automationSidebarGrouping.ts b/apps/desktop/src/renderer/features/cc-agent/lib/automationSidebarGrouping.ts
index afc0f94434..f3bc5f3724 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/automationSidebarGrouping.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/automationSidebarGrouping.ts
@@ -7,6 +7,7 @@ import {
isAutomationGeneratedSession,
} from './scheduledSessionGrouping';
import { normalizeWorkingDir } from './projectGrouping';
+import { isTeammateTaskSession } from '../../../../shared/sessionSource';
import { sessionActivityMs } from './dateSessionGrouping';
import {
getSessionListCollapseView,
@@ -60,6 +61,11 @@ export interface AutomationSessionGroup {
projectConfigId?: string;
/** 远程设备上的自动化分组(组键已按设备作用域隔离,组内会话同属这台设备)。 */
deviceLinkDeviceId?: string;
+ /**
+ * 伙伴例行任务分组(同一伙伴同一条规则)。规则由伙伴例行任务引擎管理,不是 schedule:
+ * 组头只提供标为已读,运行与编辑去伙伴设置的「例行任务」页。
+ */
+ teammateRoutine?: { botId: string; routineId: string };
title: string;
sessions: Session[];
attentionSessionIds: string[];
@@ -98,6 +104,14 @@ function scopeAutomationGroupKey(key: string, session: Session): ScopedAutomatio
return deviceId ? { key: `${key}:device:${deviceId}`, legacyKey: key } : { key };
}
+/** 伙伴例行任务 Session 的规则归属;旧主机不带 routineId 时为 null(维持平铺)。 */
+function teammateRoutineOf(session: Session): { botId: string; routineId: string } | null {
+ if (!isTeammateTaskSession(session) || session.orcaRole === 'worker') return null;
+ const companion = session.companion;
+ if (companion?.role !== 'routine' || !companion.routineId) return null;
+ return { botId: companion.id, routineId: companion.routineId };
+}
+
export function getAutomationSidebarGroupInfo(
session: Session,
scheduleSessionIndex?: ReadonlyMap<string, AutomationScheduleSessionInfo>,
@@ -111,7 +125,20 @@ export function getAutomationSidebarGroupInfo(
nextFireAt?: number;
workingDir?: string;
projectConfigId?: string;
+ teammateRoutine?: { botId: string; routineId: string };
} | null {
+ const teammateRoutine = teammateRoutineOf(session);
+ if (teammateRoutine) {
+ return {
+ ...scopeAutomationGroupKey(
+ `routine:${teammateRoutine.botId}:${teammateRoutine.routineId}`,
+ session,
+ ),
+ // 例行任务 Session 以规则名为标题(「每次新建任务」时各次同名)。
+ title: session.title,
+ teammateRoutine,
+ };
+ }
if (!isAutomationGeneratedSession(session)) return null;
const indexed = scheduleSessionIndex?.get(session.id);
@@ -168,6 +195,7 @@ export function groupAutomationSidebarEntries(
workingDir: groupInfo.workingDir,
projectConfigId: groupInfo.projectConfigId,
...(session.deviceLinkDeviceId ? { deviceLinkDeviceId: session.deviceLinkDeviceId } : {}),
+ ...(groupInfo.teammateRoutine ? { teammateRoutine: groupInfo.teammateRoutine } : {}),
title: groupInfo.title,
sessions: [session],
attentionSessionIds: options.notifications.has(session.id) ? [session.id] : [],
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
index 41fe3c0090..a429be853b 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/AutomationSessionGroupItem.tsx
@@ -27,6 +27,7 @@ import {
import { useAutomationGroupCollapsed } from '../hooks/useAutomationGroupCollapsed';
import { formatSidebarFutureTime, formatSidebarTime } from '../lib/formatSidebarTime';
import { scheduleFocusPath } from '@/features/scheduler/lib/scheduleSessionBinding';
+import { BotFollowMark, useSessionFollowers } from '@/features/bots/BotFollowMark';
import { hasSessionSelectionModifier, SessionItem } from './SessionItem';
import type { SessionClickHandler } from './SessionItem';
import { MENU_ITEM_CLASS } from './menuStyles';
@@ -94,6 +95,19 @@ interface FrozenGroupState {
visibleSessionIds: string[];
}
+/** 伙伴设置的「例行任务」页(本机或远程伙伴)。 */
+function teammateRoutinesPath(botId: string, deviceId?: string): string {
+ const base = deviceId
+ ? `/bots/remote/${encodeURIComponent(deviceId)}/${encodeURIComponent(botId)}`
+ : `/bots/${encodeURIComponent(botId)}`;
+ return `${base}?settings=1&settingsPage=routines`;
+}
+
+/** 单独成组件:伙伴归属订阅只在例行任务分组上挂载,普通自动化组头不付这份成本。 */
+function TeammateRoutineOwnerMark({ session }: { session: Session }) {
+ return <BotFollowMark followers={useSessionFollowers(session)} />;
+}
+
const AUTOMATION_GROUP_INLINE_ACTION_SELECTOR = '[data-automation-group-inline-action="true"]';
function isAutomationGroupInlineAction(target: EventTarget | null): boolean {
@@ -213,8 +227,13 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
// 远程分组只提供在对方电脑上执行的操作(运行、暂停 / 恢复、标为已读);编辑页与删除
// 确认只管本机任务,查看入口也不能拿远程 id 去聚焦本机自动化页。
const isRemoteGroup = !!group.deviceLinkDeviceId;
+ // 伙伴例行任务分组没有 schedule:只提供标为已读,运行与编辑在伙伴设置「例行任务」页。
+ // 伙伴任务的归档归伙伴生命周期管理,主进程拒绝通用归档,所以这里也不提供「全部归档」。
+ const teammateRoutine = group.teammateRoutine;
// 远程且已结束、又没有未读时,菜单里没有可执行项,不显示「更多」。
- const hasMoreMenuItems = !isRemoteGroup || canMarkRead || group.scheduleStatus !== 'expired';
+ const hasMoreMenuItems = teammateRoutine
+ ? canMarkRead
+ : !isRemoteGroup || canMarkRead || group.scheduleStatus !== 'expired';
// childView 的 24h 豁免依赖实时 now,必须每次渲染直接算,不能进 useMemo —— 否则依赖项
// 不变时时间窗口会被冻结,跨过 24h 阈值的运行不会及时移出豁免。与普通对话列表
// SessionEntryList 一致(它也是 render 内直接算 getSessionListCollapseView、不 memo);
@@ -257,6 +276,8 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
? latestRemoteActivity
: latestLocalActivity;
const scheduleId = group.scheduleId;
+ // 组头右侧悬停操作槽:schedule 分组恒有(运行 + 更多),例行任务分组仅在有菜单项时有。
+ const hasHoverActions = !!scheduleId || (!!teammateRoutine && hasMoreMenuItems);
// 「已停止」= paused(用户主动暂停)+ expired(计划到期不再触发);两者对用户体验
// 而言都是「不会再自动跑」,视觉上都在 Timer chip 上叠 Pause 徽标,并在 tooltip
// 里显示「已停止」文案,避免用户误判为普通空闲态。
@@ -486,7 +507,7 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
// 整行右键 = 打开「更多操作」同一份菜单(不再另做一份隐形锚点菜单)。
event.preventDefault();
event.stopPropagation();
- if (!scheduleId) return;
+ if (!hasHoverActions || !hasMoreMenuItems) return;
setRowTooltipOpen(false);
setMenuOpen(true);
}}
@@ -548,9 +569,11 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
onClick={(event) => {
event.stopPropagation();
navigate(
- group.scheduleId && !isRemoteGroup
- ? scheduleFocusPath(group.scheduleId)
- : '/cc-agent/scheduled',
+ teammateRoutine
+ ? teammateRoutinesPath(teammateRoutine.botId, group.deviceLinkDeviceId)
+ : group.scheduleId && !isRemoteGroup
+ ? scheduleFocusPath(group.scheduleId)
+ : '/cc-agent/scheduled',
);
}}
onPointerDown={(event) => event.stopPropagation()}
@@ -580,6 +603,10 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
>
<span className="min-w-0 truncate">{group.title}</span>
</button>
+ {/* 例行任务分组:标题后显示所属伙伴头像,与组内各行的伙伴标记同源。 */}
+ {teammateRoutine && latestSession && (
+ <TeammateRoutineOwnerMark session={latestSession} />
+ )}
</span>
{/* 展开箭头挪到标题后,视觉上属于「标题右侧的次要控件」,和右侧 meta/操作
槽用 ml-auto 分开;shrink-0 保证长标题挤压时不会先把 chevron 挤没。 */}
@@ -633,7 +660,7 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
hasActiveHidden
? 'text-[var(--sidebar-item-active-foreground)]'
: 'text-sidebar-action-icon',
- scheduleId &&
+ hasHoverActions &&
!menuOpen &&
'group-hover:opacity-0 group-focus-within/slot:opacity-0',
menuOpen && 'opacity-0',
@@ -713,12 +740,13 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
<span className="min-w-0 truncate text-right">{meta}</span>
)}
</div>
- {scheduleId && (
+ {hasHoverActions && (
<>
<div
aria-hidden
className={cn(
- 'invisible col-start-1 row-start-1 h-6 w-[42px]',
+ 'invisible col-start-1 row-start-1 h-6',
+ scheduleId ? 'w-[42px]' : 'w-5',
!menuOpen && 'hidden group-hover:block group-focus-within/slot:block',
)}
/>
@@ -733,28 +761,30 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
>
{/* 高频 Run 继续直点;Edit/Pause/Resume/Delete 收进 More 菜单,避免 Edit
和左侧 Timer chip 形成重复入口,同时保留原来菜单里的低频操作空间。 */}
- <Tip text={t('ccAgent.sidebar.automationGroup.menu.runNow')} side="bottom">
- <button
- type="button"
- data-automation-group-inline-action="true"
- onClick={(event) => {
- event.stopPropagation();
- // 点击后主动 blur:group/slot 的 focus-within 会让操作按钮
- // 常驻可见 + meta 常隐,鼠标移开也不恢复;显式失焦让 hover 语义
- // 重新接管。
- event.currentTarget.blur();
- onScheduleAction(group, 'run');
- }}
- aria-label={t('ccAgent.sidebar.automationGroup.menu.runNow')}
- className={cn(
- 'flex size-5 shrink-0 items-center justify-center rounded-md',
- 'transition-colors',
- actionButtonToneClassName,
- )}
- >
- <Play size={14} strokeWidth={2} />
- </button>
- </Tip>
+ {scheduleId && (
+ <Tip text={t('ccAgent.sidebar.automationGroup.menu.runNow')} side="bottom">
+ <button
+ type="button"
+ data-automation-group-inline-action="true"
+ onClick={(event) => {
+ event.stopPropagation();
+ // 点击后主动 blur:group/slot 的 focus-within 会让操作按钮
+ // 常驻可见 + meta 常隐,鼠标移开也不恢复;显式失焦让 hover 语义
+ // 重新接管。
+ event.currentTarget.blur();
+ onScheduleAction(group, 'run');
+ }}
+ aria-label={t('ccAgent.sidebar.automationGroup.menu.runNow')}
+ className={cn(
+ 'flex size-5 shrink-0 items-center justify-center rounded-md',
+ 'transition-colors',
+ actionButtonToneClassName,
+ )}
+ >
+ <Play size={14} strokeWidth={2} />
+ </button>
+ </Tip>
+ )}
{hasMoreMenuItems && (
<DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}>
<DropdownMenuTrigger asChild>
@@ -798,7 +828,7 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
{t('ccAgent.sidebar.automationGroup.menu.markAllAsRead')}
</DropdownMenuItem>
)}
- {!isRemoteGroup && (
+ {scheduleId && !isRemoteGroup && (
<DropdownMenuItem
onSelect={() => onScheduleAction(group, 'edit')}
className={MENU_ITEM_CLASS}
@@ -806,7 +836,7 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
{t('ccAgent.sidebar.automationGroup.menu.edit')}
</DropdownMenuItem>
)}
- {group.scheduleStatus !== 'expired' && (
+ {scheduleId && group.scheduleStatus !== 'expired' && (
<DropdownMenuItem
onSelect={() => onScheduleAction(group, 'toggle-pause')}
className={MENU_ITEM_CLASS}
@@ -816,7 +846,7 @@ export const AutomationSessionGroupItem = withSidebarNavigation<AutomationSessio
: t('ccAgent.sidebar.automationGroup.menu.pause')}
</DropdownMenuItem>
)}
- {!isRemoteGroup && (
+ {scheduleId && !isRemoteGroup && (
<>
<DropdownMenuSeparator />
<DropdownMenuItem
diff --git a/apps/desktop/src/renderer/lib/ccAgent.types.ts b/apps/desktop/src/renderer/lib/ccAgent.types.ts
index b0045cb89a..25d1441617 100644
--- a/apps/desktop/src/renderer/lib/ccAgent.types.ts
+++ b/apps/desktop/src/renderer/lib/ccAgent.types.ts
@@ -401,7 +401,7 @@ export interface Session {
/** 会话来源。scheduler 表示由自动化任务创建;缺失时按 desktop 兼容旧 payload。 */
source?: SessionSource;
/** Host-owned teammate link, also used by the existing history API. Display only. */
- companion?: { id: string; role: string; channel?: string } | null;
+ companion?: { id: string; role: string; channel?: string; routineId?: string } | null;
/** Orca split-session role marker. null/undefined means a regular Maker session. */
orcaRole?: OrcaRole | null;
/** fork-session:派生来源会话 id(self-FK,源被删 → SET NULL)。null = 顶层会话。 */
diff --git a/docs/product-rules/bot-routines.md b/docs/product-rules/bot-routines.md
index 3930de18f1..513730fefb 100644
--- a/docs/product-rules/bot-routines.md
+++ b/docs/product-rules/bot-routines.md
@@ -6,7 +6,7 @@
一条例行任务属于一个伙伴,包含名称、常驻指令、启用状态和多个触发条件。条件之间是 OR:同一事件命中多个条件只入队一次。时间条件与事件条件可以共存,适合「PR 更新时检查,每小时兜底」。条件编辑不授予模型额外权限。
-桌面入口在伙伴设置「例行任务」及伙伴任务的标准右侧栏。已创建的例行任务 Session 也进入桌面和手机任务列表,按真实伙伴归属显示头像、参与伙伴来源筛选;仅有自动化规则、尚未创建 Session 时不凭空生成列表任务。列表里的普通规则和内置规则都用右侧开关直接启停,文字明确显示启用/暂停,排队/运行中单独显示,不以时钟或暂停图标代替状态。点普通规则名称进入详情,仍可修改指令、立即运行、增删触发条件、删除规则和查看历史;历史的失败/中断结果在展开前可读。立即运行先保存当前编辑,再运行,避免执行屏幕上看不到的旧指令。
+桌面入口在伙伴设置「例行任务」及伙伴任务的标准右侧栏。已创建的例行任务 Session 也进入桌面和手机任务列表,按真实伙伴归属显示头像、参与伙伴来源筛选;仅有自动化规则、尚未创建 Session 时不凭空生成列表任务。桌面侧栏把同一伙伴同一条规则的多条运行(「每次新建任务」)收进与普通自动化同款的文件夹(2026-10-29),组头显示规则名与伙伴头像,计时图标打开该伙伴的「例行任务」页,更多菜单只提供标为已读;依据是列表投影的 `companion.routineId`(由 `route_key` 解析),旧主机不提供时维持平铺。列表里的普通规则和内置规则都用右侧开关直接启停,文字明确显示启用/暂停,排队/运行中单独显示,不以时钟或暂停图标代替状态。点普通规则名称进入详情,仍可修改指令、立即运行、增删触发条件、删除规则和查看历史;历史的失败/中断结果在展开前可读。立即运行先保存当前编辑,再运行,避免执行屏幕上看不到的旧指令。
时间描述跟随界面语言,复用调度器的 Cron 解析规则,保留全部小时、分钟、日期与 IANA 时区;复杂条件可展开,多个条件明确为满足任一项即运行。不依据前端时钟推测下次执行,也不把配置更新时间当作最近结果。定时菜单提供每小时、每天、工作日、每周、每月、间隔和高级 Cron。事件菜单来自实际插件声明,不显示未接入平台的假入口。
diff --git a/packages/lizi-mcps/src/xdt-helper/_history_types.ts b/packages/lizi-mcps/src/xdt-helper/_history_types.ts
index 8cc1b0f59e..6515440402 100644
--- a/packages/lizi-mcps/src/xdt-helper/_history_types.ts
+++ b/packages/lizi-mcps/src/xdt-helper/_history_types.ts
@@ -60,6 +60,8 @@ export interface HistoryCompanion {
id: string;
role: string;
channel?: string;
+ /** Routine lanes (`role = 'routine'`): the standing rule this Session runs. Absent on older hosts. */
+ routineId?: string;
}
export interface HistorySession {