MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / convertToLogOption

Function convertToLogOption

source code/utils/sessionStorage.ts:2481–2526  ·  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

2479}
2480
2481function convertToLogOption(
2482 transcript: TranscriptMessage[],
2483 value: number = 0,
2484 summary?: string,
2485 customTitle?: string,
2486 fileHistorySnapshots?: FileHistorySnapshot[],
2487 tag?: string,
2488 fullPath?: string,
2489 attributionSnapshots?: AttributionSnapshotMessage[],
2490 agentSetting?: string,
2491 contentReplacements?: ContentReplacementRecord[],
2492): LogOption {
2493 const lastMessage = transcript.at(-1)!
2494 const firstMessage = transcript[0]!
2495
2496 // Get the first user message for the prompt
2497 const firstPrompt = extractFirstPrompt(transcript)
2498
2499 // Create timestamps from message timestamps
2500 const created = new Date(firstMessage.timestamp)
2501 const modified = new Date(lastMessage.timestamp)
2502
2503 return {
2504 date: lastMessage.timestamp,
2505 messages: removeExtraFields(transcript),
2506 fullPath,
2507 value,
2508 created,
2509 modified,
2510 firstPrompt,
2511 messageCount: countVisibleMessages(transcript),
2512 isSidechain: firstMessage.isSidechain,
2513 teamName: firstMessage.teamName,
2514 agentName: firstMessage.agentName,
2515 agentSetting,
2516 leafUuid: lastMessage.uuid,
2517 summary,
2518 customTitle,
2519 tag,
2520 fileHistorySnapshots: fileHistorySnapshots,
2521 attributionSnapshots: attributionSnapshots,
2522 contentReplacements,
2523 gitBranch: lastMessage.gitBranch,
2524 projectPath: firstMessage.cwd,
2525 }
2526}
2527
2528async function trackSessionBranchingAnalytics(
2529 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