| |
| export function stripWorkspaceHeader(text: string | null | undefined): string { |
| if (!text) return ""; |
| return text |
| .replace(/^\s*\[Workspace(?: paths)?:[\s\S]*?\]\s*/i, "") |
| .replace(/\[Attached (?:image|file): [^\]]*\]\s*/g, "") |
| .trim(); |
| } |
|
|
| |
| export function deskDisplayTitle( |
| title: string | null | undefined, |
| titleSummary?: string | null, |
| taskContent?: string | null, |
| ): string { |
| if (titleSummary?.trim()) return titleSummary.trim(); |
| const cleaned = stripWorkspaceHeader(title); |
| if (cleaned) return cleaned.length > 80 ? `${cleaned.slice(0, 77)}…` : cleaned; |
| const task = taskContent?.trim(); |
| if (task) return task.length > 80 ? `${task.slice(0, 77)}…` : task; |
| return "Untitled task"; |
| } |
|
|