( messages: Message[], teamInfo: TeamInfo | undefined, startingParentUuidHint: UUID | undefined, allMessages: readonly Message[] | undefined, )
| 1488 | // messagesToKeep → not a prefix → not tracked → CB gets parentUuid=null |
| 1489 | // (correct: truncates --continue chain at compact boundary). |
| 1490 | async function recordTranscriptFull( |
| 1491 | messages: Message[], |
| 1492 | teamInfo: TeamInfo | undefined, |
| 1493 | startingParentUuidHint: UUID | undefined, |
| 1494 | allMessages: readonly Message[] | undefined, |
| 1495 | ): Promise<UUID | null> { |
| 1496 | const cleanedMessages = cleanMessagesForLogging(messages, allMessages) |
| 1497 | const sessionId = getSessionId() as UUID |
| 1498 | const messageSet = await getSessionMessages(sessionId) |
| 1499 | const newMessages: typeof cleanedMessages = [] |
| 1500 | let startingParentUuid: UUID | undefined = startingParentUuidHint |
| 1501 | let seenNewMessage = false |
| 1502 | for (const m of cleanedMessages) { |
| 1503 | if (messageSet.has(m.uuid as UUID)) { |
| 1504 | if (!seenNewMessage && isChainParticipant(m)) { |
| 1505 | startingParentUuid = m.uuid as UUID |
| 1506 | } |
| 1507 | } else { |
| 1508 | newMessages.push(m) |
| 1509 | seenNewMessage = true |
| 1510 | } |
| 1511 | } |
| 1512 | if (newMessages.length > 0) { |
| 1513 | await getProject().insertMessageChain( |
| 1514 | newMessages, |
| 1515 | false, |
| 1516 | undefined, |
| 1517 | startingParentUuid, |
| 1518 | teamInfo, |
| 1519 | ) |
| 1520 | clearSessionMessagesCache() |
| 1521 | } |
| 1522 | const lastRecorded = newMessages.findLast(isChainParticipant) |
| 1523 | return (lastRecorded?.uuid as UUID | undefined) ?? startingParentUuid ?? null |
| 1524 | } |
| 1525 | |
| 1526 | export async function recordTranscript( |
| 1527 | messages: Message[], |
no test coverage detected