( entry: StoredCodexSessionIndexEntry, meta: StoredCodexSessionMeta | null, metadata: StoredThreadMetadata | null, folderMetadata: StoredFolderMetadata | null, linkedSessions: WebSessionSummary[], )
| 566 | } |
| 567 | |
| 568 | function buildCodexThreadSummary( |
| 569 | entry: StoredCodexSessionIndexEntry, |
| 570 | meta: StoredCodexSessionMeta | null, |
| 571 | metadata: StoredThreadMetadata | null, |
| 572 | folderMetadata: StoredFolderMetadata | null, |
| 573 | linkedSessions: WebSessionSummary[], |
| 574 | ): WebCodexThreadSummary { |
| 575 | const primaryLinkedSession = linkedSessions[0] ?? null; |
| 576 | const resolvedCwd = meta?.cwd ?? primaryLinkedSession?.cwd ?? null; |
| 577 | return { |
| 578 | threadId: entry.id, |
| 579 | title: formatMaybeText(entry.thread_name, primaryLinkedSession?.title ?? '未命名会话'), |
| 580 | cwd: resolvedCwd, |
| 581 | folderKey: resolvedCwd, |
| 582 | folderLabel: folderMetadata?.alias?.trim() || null, |
| 583 | folderPinned: typeof folderMetadata?.pinnedAt === 'number', |
| 584 | folderRemoved: typeof folderMetadata?.removedAt === 'number', |
| 585 | updatedAt: parseMaybeDate(entry.updated_at), |
| 586 | updatedAtLabel: formatDateTime(parseMaybeDate(entry.updated_at)), |
| 587 | alias: metadata?.alias ?? null, |
| 588 | isPinned: Boolean(metadata?.pinnedAt), |
| 589 | isArchived: Boolean(metadata?.archivedAt), |
| 590 | href: `/sessions/codex/${entry.id}`, |
| 591 | linkedBridgeSessionId: primaryLinkedSession?.id ?? null, |
| 592 | linkedBridgeSessionCount: linkedSessions.length, |
| 593 | }; |
| 594 | } |
| 595 | |
| 596 | function parseMaybeDate(value: string | null | undefined): number { |
| 597 | if (!value) { |
no test coverage detected