this repo has no description
1// Raw JSONL entry from Claude Code session files
2export interface RawSessionEntry {
3 type: 'user' | 'assistant';
4 timestamp: string;
5 uuid: string;
6 parentUuid: string | null;
7 sessionId: string;
8 cwd?: string;
9 gitBranch?: string;
10 slug?: string;
11 version?: string;
12 message: {
13 role: 'user' | 'assistant';
14 content: MessageContent[];
15 model?: string;
16 id?: string;
17 usage?: TokenUsage;
18 };
19 requestId?: string;
20}
21
22export interface TokenUsage {
23 input_tokens: number;
24 output_tokens: number;
25 cache_creation_input_tokens?: number;
26 cache_read_input_tokens?: number;
27}
28
29export type MessageContent =
30 | { type: 'text'; text: string }
31 | { type: 'text'; content: string }
32 | { type: 'tool_use'; id: string; name: string; input: Record<string, unknown> }
33 | { type: 'tool_result'; tool_use_id: string; content: string; is_error?: boolean };
34
35// Parsed session with extracted info
36export interface ParsedSession {
37 sessionId: string;
38 filePath: string;
39 projectPath: string;
40 projectName: string;
41 gitBranch: string;
42 startTime: string;
43 endTime: string;
44 date: string; // YYYY-MM-DD
45 messages: ParsedMessage[];
46 stats: SessionStats;
47}
48
49export interface ParsedMessage {
50 type: 'user' | 'assistant';
51 timestamp: string;
52 text: string;
53 toolUses: ToolUse[];
54}
55
56export interface ToolUse {
57 name: string;
58 input: string; // Truncated/summarized
59 rawInput?: Record<string, unknown>; // Full input for file path extraction
60}
61
62export interface SessionStats {
63 userMessages: number;
64 assistantMessages: number;
65 toolCalls: Record<string, number>;
66 totalInputTokens: number;
67 totalOutputTokens: number;
68}
69
70// LLM-generated summary
71export interface SessionSummary {
72 shortSummary: string;
73 accomplishments: string[];
74 filesChanged: string[];
75 toolsUsed: string[];
76}
77
78// Database models
79export interface DBSessionSummary {
80 id: number;
81 session_id: string;
82 project_path: string;
83 project_name: string;
84 git_branch: string;
85 start_time: string;
86 end_time: string;
87 date: string;
88 short_summary: string;
89 accomplishments: string; // JSON array
90 tools_used: string; // JSON array
91 files_changed: string; // JSON array
92 stats: string; // JSON object
93 processed_at: string;
94}
95
96export interface DBDailySummary {
97 date: string;
98 brag_summary: string;
99 projects_worked: string; // JSON array
100 total_sessions: number;
101 generated_at: string;
102}
103
104export interface DBProcessedFile {
105 file_path: string;
106 file_hash: string;
107 processed_at: string;
108}
109
110// API response types
111export interface DayListItem {
112 date: string;
113 projectCount: number;
114 sessionCount: number;
115 bragSummary?: string;
116}
117
118export interface DayDetail {
119 date: string;
120 bragSummary?: string;
121 projects: ProjectDetail[];
122 stats: {
123 totalSessions: number;
124 totalTokens: number;
125 };
126}
127
128export interface ProjectDetail {
129 name: string;
130 path: string;
131 sessions: SessionDetail[];
132}
133
134export interface SessionDetail {
135 sessionId: string;
136 startTime: string;
137 endTime: string;
138 shortSummary: string;
139 accomplishments: string[];
140 filesChanged: string[];
141 toolsUsed: string[];
142 stats: SessionStats;
143}