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

Function convertToLogOption

src/utils/sessionStorage.ts:2480–2525  ·  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

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