| 1 | |
| 2 | /** |
| 3 | * History-backed items carry ids derived from their backend entry |
| 4 | * (`he:<entryId>`, tool calls `he:<entryId>:tc<index>`, or a bare toolCallId). |
| 5 | * Returns the entryId for rows that may carry unresolved lazy-content refs. |
| 6 | */ |
| 7 | export function historyEntryIdForItemId(id: string | undefined): string | undefined { |
| 8 | if (id?.startsWith("m:") || id?.startsWith("record:")) return id; |
| 9 | if (!id || !id.startsWith("he:")) return undefined; |
| 10 | return id.slice(3).replace(/:tc\d+$/, ""); |
| 11 | } |
| 12 |