MCPcopy Create free account
hub / github.com/HELPMEEADICE/doge-code / convertToLogOption

Function convertToLogOption

src/utils/sessionStorage.ts:2525–2570  ·  view source on GitHub ↗
(
  transcript: TranscriptMessage[],
  value: number = 0,
  summary?: string,
  customTitle?: string,
  fileHistorySnapshots?: FileHistorySnapshot[],
  tag?: string,
  fullPath?: string,
  attributionSnapshots?: AttributionSnapshotMessage[],
  agentSetting?: string,
  contentReplacements?: ContentReplacementRecord[],
)

Source from the content-addressed store, hash-verified

2523}
2524
2525function convertToLogOption(
2526 transcript: TranscriptMessage[],
2527 value: number = 0,
2528 summary?: string,
2529 customTitle?: string,
2530 fileHistorySnapshots?: FileHistorySnapshot[],
2531 tag?: string,
2532 fullPath?: string,
2533 attributionSnapshots?: AttributionSnapshotMessage[],
2534 agentSetting?: string,
2535 contentReplacements?: ContentReplacementRecord[],
2536): LogOption {
2537 const lastMessage = transcript.at(-1)!
2538 const firstMessage = transcript[0]!
2539
2540 // Get the first user message for the prompt
2541 const firstPrompt = extractFirstPrompt(transcript)
2542
2543 // Create timestamps from message timestamps
2544 const created = new Date(firstMessage.timestamp)
2545 const modified = new Date(lastMessage.timestamp)
2546
2547 return {
2548 date: lastMessage.timestamp,
2549 messages: removeExtraFields(transcript),
2550 fullPath,
2551 value,
2552 created,
2553 modified,
2554 firstPrompt,
2555 messageCount: countVisibleMessages(transcript),
2556 isSidechain: firstMessage.isSidechain,
2557 teamName: firstMessage.teamName,
2558 agentName: firstMessage.agentName,
2559 agentSetting,
2560 leafUuid: lastMessage.uuid,
2561 summary,
2562 customTitle,
2563 tag,
2564 fileHistorySnapshots: fileHistorySnapshots,
2565 attributionSnapshots: attributionSnapshots,
2566 contentReplacements,
2567 gitBranch: lastMessage.gitBranch,
2568 projectPath: firstMessage.cwd,
2569 }
2570}
2571
2572async function trackSessionBranchingAnalytics(
2573 logs: LogOption[],

Callers 2

loadTranscriptFromFileFunction · 0.85
getLastSessionLogFunction · 0.85

Calls 3

removeExtraFieldsFunction · 0.85
countVisibleMessagesFunction · 0.85
extractFirstPromptFunction · 0.70

Tested by

no test coverage detected