claude-deck 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/dashboard/assets/index-Cux_zpcb.js +244 -0
  3. package/dashboard/assets/index-Dg_mccmz.css +1 -0
  4. package/dashboard/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  5. package/dashboard/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
  6. package/dashboard/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
  7. package/dashboard/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  8. package/dashboard/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  9. package/dashboard/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
  10. package/dashboard/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
  11. package/dashboard/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
  12. package/dashboard/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
  13. package/dashboard/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  14. package/dashboard/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
  15. package/dashboard/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  16. package/dashboard/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  17. package/dashboard/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
  18. package/dashboard/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
  19. package/dashboard/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
  20. package/dashboard/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
  21. package/dashboard/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  22. package/dashboard/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
  23. package/dashboard/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  24. package/dashboard/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  25. package/dashboard/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
  26. package/dashboard/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
  27. package/dashboard/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
  28. package/dashboard/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
  29. package/dashboard/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  30. package/dashboard/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  31. package/dashboard/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
  32. package/dashboard/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  33. package/dashboard/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
  34. package/dashboard/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
  35. package/dashboard/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
  36. package/dashboard/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
  37. package/dashboard/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  38. package/dashboard/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  39. package/dashboard/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
  40. package/dashboard/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  41. package/dashboard/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
  42. package/dashboard/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
  43. package/dashboard/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
  44. package/dashboard/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  45. package/dashboard/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
  46. package/dashboard/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  47. package/dashboard/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
  48. package/dashboard/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  49. package/dashboard/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
  50. package/dashboard/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
  51. package/dashboard/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
  52. package/dashboard/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  53. package/dashboard/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
  54. package/dashboard/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  55. package/dashboard/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  56. package/dashboard/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  57. package/dashboard/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
  58. package/dashboard/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
  59. package/dashboard/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
  60. package/dashboard/index.html +13 -0
  61. package/dist/cli.d.ts +2 -0
  62. package/dist/cli.js +101 -0
  63. package/dist/db/index.d.ts +3 -0
  64. package/dist/db/index.js +24 -0
  65. package/dist/db/queries.d.ts +29 -0
  66. package/dist/db/queries.js +388 -0
  67. package/dist/db/schema.d.ts +1 -0
  68. package/dist/db/schema.js +90 -0
  69. package/dist/parser/cost.d.ts +3 -0
  70. package/dist/parser/cost.js +88 -0
  71. package/dist/parser/index.d.ts +9 -0
  72. package/dist/parser/index.js +89 -0
  73. package/dist/parser/session-parser.d.ts +2 -0
  74. package/dist/parser/session-parser.js +229 -0
  75. package/dist/parser/subagent-parser.d.ts +5 -0
  76. package/dist/parser/subagent-parser.js +150 -0
  77. package/dist/server/index.d.ts +2 -0
  78. package/dist/server/index.js +52 -0
  79. package/dist/server/routes/sessions.d.ts +3 -0
  80. package/dist/server/routes/sessions.js +31 -0
  81. package/dist/server/routes/stats.d.ts +3 -0
  82. package/dist/server/routes/stats.js +11 -0
  83. package/dist/server/routes/sync.d.ts +3 -0
  84. package/dist/server/routes/sync.js +11 -0
  85. package/dist/types.d.ts +292 -0
  86. package/dist/types.js +2 -0
  87. package/package.json +56 -0
@@ -0,0 +1,292 @@
1
+ export interface Usage {
2
+ input_tokens: number;
3
+ output_tokens: number;
4
+ cache_read_input_tokens: number;
5
+ cache_creation_input_tokens: number;
6
+ cache_creation?: {
7
+ ephemeral_5m_input_tokens?: number;
8
+ ephemeral_1h_input_tokens?: number;
9
+ };
10
+ service_tier?: string;
11
+ }
12
+ export interface ToolUseBlock {
13
+ type: "tool_use";
14
+ id: string;
15
+ name: string;
16
+ input: Record<string, unknown>;
17
+ }
18
+ export interface TextBlock {
19
+ type: "text";
20
+ text: string;
21
+ }
22
+ export interface ToolResultBlock {
23
+ type: "tool_result";
24
+ tool_use_id: string;
25
+ content?: unknown;
26
+ }
27
+ export type ContentBlock = ToolUseBlock | TextBlock | ToolResultBlock;
28
+ export interface AssistantMessage {
29
+ id?: string;
30
+ role: "assistant";
31
+ content: ContentBlock[];
32
+ model: string;
33
+ usage: Usage;
34
+ }
35
+ export interface ToolUseResult {
36
+ type?: string;
37
+ stdout?: string;
38
+ stderr?: string;
39
+ exitCode?: number;
40
+ file?: string;
41
+ filePath?: string;
42
+ content?: string;
43
+ structuredPatch?: unknown;
44
+ originalFile?: string;
45
+ matches?: unknown[];
46
+ status?: string;
47
+ agentId?: string;
48
+ totalDurationMs?: number;
49
+ totalTokens?: number;
50
+ totalToolUseCount?: number;
51
+ usage?: Usage;
52
+ }
53
+ export interface UserMessage {
54
+ role: "user";
55
+ content: ContentBlock[] | string;
56
+ }
57
+ export interface AssistantRecord {
58
+ type: "assistant";
59
+ message: AssistantMessage;
60
+ timestamp: string;
61
+ }
62
+ export interface UserRecord {
63
+ type: "user";
64
+ message: UserMessage;
65
+ userType?: "external" | "internal";
66
+ toolUseResult?: ToolUseResult;
67
+ toolUseID?: string;
68
+ timestamp: string;
69
+ }
70
+ export interface SystemRecord {
71
+ type: "system";
72
+ subtype?: string;
73
+ compactMetadata?: unknown;
74
+ timestamp: string;
75
+ }
76
+ export type JsonlRecord = AssistantRecord | UserRecord | SystemRecord | {
77
+ type: string;
78
+ timestamp?: string;
79
+ };
80
+ export interface CompactBoundaryRecord {
81
+ type: "system";
82
+ subtype: "compact_boundary";
83
+ timestamp: string;
84
+ compactMetadata: {
85
+ trigger: string;
86
+ preTokens: number;
87
+ };
88
+ }
89
+ export interface ParsedSession {
90
+ id: string;
91
+ project: string;
92
+ projectHash: string;
93
+ firstPrompt: string | null;
94
+ model: string | null;
95
+ inputTokens: number;
96
+ outputTokens: number;
97
+ cacheReadTokens: number;
98
+ cacheCreateTokens: number;
99
+ estimatedCostUsd: number;
100
+ messageCount: number;
101
+ toolCallCount: number;
102
+ subagentCount: number;
103
+ turnCount: number;
104
+ peakContextTokens: number;
105
+ startedAt: string | null;
106
+ endedAt: string | null;
107
+ durationMs: number | null;
108
+ jsonlPath: string;
109
+ jsonlMtime: string;
110
+ toolCalls: ParsedToolCall[];
111
+ messages: ParsedMessage[];
112
+ subagents: ParsedSubagent[];
113
+ compactions: ParsedCompaction[];
114
+ }
115
+ export interface ParsedToolCall {
116
+ toolUseId: string | null;
117
+ toolName: string;
118
+ toolInput: string;
119
+ toolResponse: string | null;
120
+ status: string;
121
+ timestamp: string;
122
+ subagentId: string | null;
123
+ }
124
+ export interface ParsedMessage {
125
+ role: "user" | "assistant";
126
+ content: string;
127
+ timestamp: string;
128
+ model: string | null;
129
+ costUsd: number | null;
130
+ }
131
+ export interface ParsedCompaction {
132
+ timestamp: string;
133
+ trigger: string;
134
+ preTokens: number;
135
+ }
136
+ export interface ParsedSubagent {
137
+ id: string;
138
+ agentType: string | null;
139
+ model: string | null;
140
+ prompt: string | null;
141
+ inputTokens: number;
142
+ outputTokens: number;
143
+ cacheReadTokens: number;
144
+ cacheCreateTokens: number;
145
+ estimatedCostUsd: number;
146
+ toolCallCount: number;
147
+ durationMs: number | null;
148
+ resultSummary: string | null;
149
+ }
150
+ export interface SessionRow {
151
+ id: string;
152
+ project: string;
153
+ project_hash: string;
154
+ first_prompt: string | null;
155
+ model: string | null;
156
+ status: string;
157
+ input_tokens: number;
158
+ output_tokens: number;
159
+ cache_read_tokens: number;
160
+ cache_create_tokens: number;
161
+ estimated_cost_usd: number;
162
+ message_count: number;
163
+ tool_call_count: number;
164
+ subagent_count: number;
165
+ turn_count: number;
166
+ started_at: string | null;
167
+ ended_at: string | null;
168
+ duration_ms: number | null;
169
+ peak_context_tokens: number;
170
+ compaction_count: number;
171
+ peak_context_pct: number;
172
+ synced_at: string;
173
+ jsonl_path: string;
174
+ jsonl_mtime: string;
175
+ }
176
+ export interface ToolCallRow {
177
+ id: number;
178
+ session_id: string;
179
+ subagent_id: string | null;
180
+ tool_use_id: string | null;
181
+ tool_name: string;
182
+ tool_input: string | null;
183
+ tool_response: string | null;
184
+ status: string;
185
+ timestamp: string;
186
+ }
187
+ export interface MessageRow {
188
+ id: number;
189
+ session_id: string;
190
+ role: string;
191
+ content: string;
192
+ timestamp: string;
193
+ model: string | null;
194
+ cost_usd: number | null;
195
+ }
196
+ export interface SubagentRow {
197
+ id: string;
198
+ session_id: string;
199
+ agent_type: string | null;
200
+ model: string | null;
201
+ prompt: string | null;
202
+ input_tokens: number;
203
+ output_tokens: number;
204
+ cache_read_tokens: number;
205
+ cache_create_tokens: number;
206
+ estimated_cost_usd: number;
207
+ tool_call_count: number;
208
+ duration_ms: number | null;
209
+ result_summary: string | null;
210
+ }
211
+ export interface CompactionRow {
212
+ id: number;
213
+ session_id: string;
214
+ trigger: string;
215
+ pre_tokens: number;
216
+ timestamp: string;
217
+ }
218
+ export interface FileReadPattern {
219
+ file: string;
220
+ count: number;
221
+ }
222
+ export interface SessionPhase {
223
+ name: string;
224
+ category: "explore" | "research" | "write" | "execute" | "other";
225
+ toolCount: number;
226
+ durationMs: number;
227
+ }
228
+ export interface WebFetchDetail {
229
+ tool: string;
230
+ url: string;
231
+ timestamp: string;
232
+ isError: boolean;
233
+ errorDetail: string;
234
+ }
235
+ export interface WebFetchStats {
236
+ total: number;
237
+ errors: number;
238
+ successRate: number;
239
+ details: WebFetchDetail[];
240
+ }
241
+ export interface CompactionInfo {
242
+ count: number;
243
+ compactions: {
244
+ timestamp: string;
245
+ trigger: string;
246
+ preTokens: number;
247
+ }[];
248
+ }
249
+ export interface SessionInsights {
250
+ fileReads: FileReadPattern[];
251
+ phases: SessionPhase[];
252
+ webFetches: WebFetchStats;
253
+ toolDistribution: {
254
+ tool: string;
255
+ count: number;
256
+ }[];
257
+ totalToolCalls: number;
258
+ sessionDurationMs: number;
259
+ compaction: CompactionInfo;
260
+ }
261
+ export interface StatsResponse {
262
+ totalSessions: number;
263
+ totalCost: number;
264
+ totalTokens: number;
265
+ inputTokens: number;
266
+ outputTokens: number;
267
+ cacheReadTokens: number;
268
+ cacheCreateTokens: number;
269
+ avgCostPerSession: number;
270
+ byModel: {
271
+ model: string;
272
+ sessions: number;
273
+ cost: number;
274
+ tokens: number;
275
+ }[];
276
+ byProject: {
277
+ project: string;
278
+ sessions: number;
279
+ cost: number;
280
+ tokens: number;
281
+ }[];
282
+ byDay: {
283
+ date: string;
284
+ sessions: number;
285
+ cost: number;
286
+ tokens: number;
287
+ }[];
288
+ topTools: {
289
+ tool: string;
290
+ count: number;
291
+ }[];
292
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ // ─── JSONL record types (what we read from files) ───
2
+ export {};
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "claude-deck",
3
+ "version": "0.1.0",
4
+ "description": "Dashboard for browsing and searching Claude Code sessions",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "claude-deck": "./dist/cli.js"
9
+ },
10
+ "engines": {
11
+ "node": ">=18"
12
+ },
13
+ "keywords": [
14
+ "claude",
15
+ "claude-code",
16
+ "dashboard",
17
+ "sessions",
18
+ "anthropic"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/gypsum-org/claude-deck.git"
23
+ },
24
+ "scripts": {
25
+ "dev": "concurrently -n server,ui -c blue,magenta \"tsx watch src/cli.ts --no-open\" \"cd ui && npm run dev -- --open\"",
26
+ "dev:server": "tsx watch src/cli.ts",
27
+ "dev:ui": "cd ui && npm run dev",
28
+ "build": "tsc && cd ui && npm run build",
29
+ "postbuild": "chmod +x dist/cli.js",
30
+ "build:server": "tsc",
31
+ "build:ui": "cd ui && npm run build",
32
+ "prepublishOnly": "npm run build",
33
+ "format": "prettier --write \"src/**/*.ts\" \"ui/src/**/*.{ts,tsx,css}\"",
34
+ "format:check": "prettier --check \"src/**/*.ts\" \"ui/src/**/*.{ts,tsx,css}\""
35
+ },
36
+ "dependencies": {
37
+ "@fastify/cors": "^10.0.2",
38
+ "@fastify/static": "^8.1.0",
39
+ "better-sqlite3": "^11.7.0",
40
+ "commander": "^13.1.0",
41
+ "fastify": "^5.2.1",
42
+ "open": "^10.1.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/better-sqlite3": "^7.6.12",
46
+ "@types/node": "^22.10.10",
47
+ "concurrently": "^9.2.1",
48
+ "prettier": "^3.8.1",
49
+ "tsx": "^4.19.2",
50
+ "typescript": "^5.7.3"
51
+ },
52
+ "files": [
53
+ "dist/",
54
+ "dashboard/"
55
+ ]
56
+ }