MCPcopy Create free account
hub / github.com/Noumena-Network/code / recordTranscriptFull

Function recordTranscriptFull

src/utils/sessionStorage.ts:1490–1524  ·  view source on GitHub ↗
(
  messages: Message[],
  teamInfo: TeamInfo | undefined,
  startingParentUuidHint: UUID | undefined,
  allMessages: readonly Message[] | undefined,
)

Source from the content-addressed store, hash-verified

1488// messagesToKeep → not a prefix → not tracked → CB gets parentUuid=null
1489// (correct: truncates --continue chain at compact boundary).
1490async 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
1526export async function recordTranscript(
1527 messages: Message[],

Callers 1

recordTranscriptFunction · 0.85

Calls 8

cleanMessagesForLoggingFunction · 0.85
getSessionIdFunction · 0.85
getSessionMessagesFunction · 0.85
isChainParticipantFunction · 0.85
getProjectFunction · 0.85
insertMessageChainMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected