Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/renderer/components/cowork/CoworkActivitySidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ const ToolRow: React.FC<{ item: CoworkActivityToolItem }> = ({ item }) => (
<div className="min-w-0 flex-1">
<div className="flex min-w-0 items-center gap-2">
<span className="truncate text-xs font-medium text-foreground">{item.toolName}</span>
{item.skillName && (
<span className="shrink-0 rounded bg-violet-500/10 px-1.5 py-0.5 text-[10px] text-violet-600 dark:text-violet-300">
{item.skillName}
</span>
)}
<span className="shrink-0 text-[10px] text-muted">
{i18nService.t(statusLabelKey[item.status])}
</span>
Expand Down
20 changes: 18 additions & 2 deletions src/renderer/utils/coworkActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export interface CoworkActivityToolItem {
status: ActivityItemStatus;
timestamp: number;
filePath: string | null;
skillName: string | null;
}

export interface CoworkActivitySnapshot {
Expand Down Expand Up @@ -419,18 +420,33 @@ export function buildCoworkActivitySnapshot(
}

const filePath = extractPath(input);
const isSkillTool = normalized === 'skill';
const skillInputId = isSkillTool ? extractString(input, ['skill', 'skillId', 'skill_id', 'name']) : null;
const skillName = skillInputId
? (skillById.get(skillInputId)?.name ?? skillInputId)
: null;
toolTimeline.push({
id: entry.toolUse.id,
toolName,
summary: getToolSummary(toolName, input),
status,
timestamp: entry.toolUse.timestamp,
filePath,
skillName,
});
fileChanges.push(...buildFileChangeFromTool(entry));
}

const activeTool = [...toolTimeline].reverse().find((item) => item.status === ActivityItemStatus.Running) ?? null;
const sessionDone = session.status === 'completed' || session.status === 'error';
const finalizeTimeline = (items: CoworkActivityToolItem[]): CoworkActivityToolItem[] =>
sessionDone
? items.map((item) => item.status === ActivityItemStatus.Running
? { ...item, status: ActivityItemStatus.Completed }
: item)
: items;
const activeTool = sessionDone
? null
: ([...toolTimeline].reverse().find((item) => item.status === ActivityItemStatus.Running) ?? null);
const activitySkills = Array.from(activeSkillIds)
.map((id) => {
const skill = skillById.get(id);
Expand All @@ -447,6 +463,6 @@ export function buildCoworkActivitySnapshot(
fileChanges: fileChanges.sort((left, right) => right.timestamp - left.timestamp),
artifacts: Array.from(artifacts.values()).sort((left, right) => right.timestamp - left.timestamp),
activeTool,
toolTimeline: toolTimeline.slice(-12).reverse(),
toolTimeline: finalizeTimeline(toolTimeline.slice(-12).reverse()),
};
}
1 change: 1 addition & 0 deletions src/renderer/utils/coworkStudio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const makeActivity = (toolName?: string, summary?: string): CoworkActivitySnapsh
status: ActivityItemStatus.Running,
timestamp: 11,
filePath: null,
skillName: null,
}
: null,
toolTimeline: [],
Expand Down
Loading