ai-wrapped 1.8.2 → 1.9.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.
@@ -1,5 +1,16 @@
1
1
  import type { SessionSource } from "../../shared/schema";
2
2
  import type { FileCandidate } from "../discovery";
3
+ import {
4
+ parseAmp,
5
+ parseCodebuff,
6
+ parseGoose,
7
+ parseHermes,
8
+ parseKilo,
9
+ parseKimi,
10
+ parseOpenclaw,
11
+ parsePi,
12
+ parseQwen,
13
+ } from "./additional";
3
14
  import { claudeParser } from "./claude";
4
15
  import { codexParser } from "./codex";
5
16
  import { parseCopilot } from "./copilot";
@@ -9,27 +20,40 @@ import { parseGeneric } from "./generic";
9
20
  import { parseOpencode } from "./opencode";
10
21
  import type { RawParsedSession, SessionParser } from "./types";
11
22
 
12
- const PARSERS: Record<SessionSource, SessionParser["parse"]> = {
23
+ type FileParser = (candidate: FileCandidate) => Promise<RawParsedSession | RawParsedSession[] | null>;
24
+
25
+ const PARSERS: Record<SessionSource, FileParser> = {
13
26
  claude: claudeParser.parse,
14
27
  codex: codexParser.parse,
15
28
  gemini: parseGemini,
16
29
  opencode: parseOpencode,
17
30
  droid: parseDroid,
18
31
  copilot: parseCopilot,
32
+ amp: parseAmp,
33
+ codebuff: parseCodebuff,
34
+ goose: parseGoose,
35
+ hermes: parseHermes,
36
+ kilo: parseKilo,
37
+ kimi: parseKimi,
38
+ openclaw: parseOpenclaw,
39
+ pi: parsePi,
40
+ qwen: parseQwen,
19
41
  };
20
42
 
21
- export const parseFile = async (candidate: FileCandidate): Promise<RawParsedSession | null> => {
43
+ export const parseFile = async (candidate: FileCandidate): Promise<RawParsedSession[]> => {
22
44
  try {
23
45
  const parser = PARSERS[candidate.source];
24
46
  const parsed = await parser(candidate);
25
- if (parsed) return parsed;
26
- return await parseGeneric(candidate, candidate.source);
47
+ if (parsed) return Array.isArray(parsed) ? parsed : [parsed];
48
+ const generic = await parseGeneric(candidate, candidate.source);
49
+ return generic ? [generic] : [];
27
50
  } catch (error) {
28
51
  console.error(`[parse] Failed ${candidate.source} ${candidate.path}`, error);
29
52
  try {
30
- return await parseGeneric(candidate, candidate.source);
53
+ const generic = await parseGeneric(candidate, candidate.source);
54
+ return generic ? [generic] : [];
31
55
  } catch {
32
- return null;
56
+ return [];
33
57
  }
34
58
  }
35
59
  };
package/src/bun/scan.ts CHANGED
@@ -50,9 +50,9 @@ export const runScan = async (options: ScanOptions = {}): Promise<ScanResult> =>
50
50
  const sessions: Session[] = [];
51
51
 
52
52
  for (const candidate of changed) {
53
- const parsed = await parseFile(candidate);
53
+ const parsedSessions = await parseFile(candidate);
54
54
 
55
- if (!parsed) {
55
+ if (parsedSessions.length === 0) {
56
56
  errors += 1;
57
57
  scanState[candidate.path] = {
58
58
  source: candidate.source,
@@ -63,14 +63,16 @@ export const runScan = async (options: ScanOptions = {}): Promise<ScanResult> =>
63
63
  continue;
64
64
  }
65
65
 
66
- const { session } = normalizeSession(parsed);
67
- sessions.push(session);
66
+ for (const parsed of parsedSessions) {
67
+ const { session } = normalizeSession(parsed);
68
+ sessions.push(session);
69
+ }
68
70
 
69
71
  scanState[candidate.path] = {
70
72
  source: candidate.source,
71
73
  fileSize: candidate.size,
72
74
  mtimeMs: candidate.mtime,
73
- parsedAt: session.parsedAt,
75
+ parsedAt: new Date().toISOString(),
74
76
  };
75
77
 
76
78
  scanned += 1;
@@ -135,7 +135,7 @@ describe("rawAggregationMetaNeedsTimeZoneBackfill", () => {
135
135
  test("returns false for matching version and timezone", () => {
136
136
  expect(
137
137
  rawAggregationMetaNeedsTimeZoneBackfill(
138
- { version: 2, timeZone: "America/Los_Angeles" },
138
+ { version: 3, timeZone: "America/Los_Angeles" },
139
139
  "America/Los_Angeles",
140
140
  ),
141
141
  ).toBe(false);
package/src/bun/store.ts CHANGED
@@ -47,7 +47,7 @@ const SCAN_STATE_PATH = join(DATA_DIR, "scan-state.json");
47
47
  const DAILY_PATH = join(DATA_DIR, "daily.json");
48
48
  const AGGREGATION_META_PATH = join(DATA_DIR, "aggregation-meta.json");
49
49
  const SETTINGS_PATH = join(DATA_DIR, "settings.json");
50
- const AGGREGATION_META_VERSION = 2;
50
+ const AGGREGATION_META_VERSION = 3;
51
51
 
52
52
  const DEFAULT_SETTINGS: AppSettings = {
53
53
  scanOnLaunch: true,
@@ -1,6 +1,37 @@
1
- export type SessionSource = "claude" | "codex" | "gemini" | "opencode" | "droid" | "copilot";
1
+ export type SessionSource =
2
+ | "claude"
3
+ | "codex"
4
+ | "gemini"
5
+ | "opencode"
6
+ | "droid"
7
+ | "copilot"
8
+ | "amp"
9
+ | "codebuff"
10
+ | "goose"
11
+ | "hermes"
12
+ | "kilo"
13
+ | "kimi"
14
+ | "openclaw"
15
+ | "pi"
16
+ | "qwen";
2
17
 
3
- export const SESSION_SOURCES: SessionSource[] = ["claude", "codex", "gemini", "opencode", "droid", "copilot"];
18
+ export const SESSION_SOURCES: SessionSource[] = [
19
+ "claude",
20
+ "codex",
21
+ "gemini",
22
+ "opencode",
23
+ "droid",
24
+ "copilot",
25
+ "amp",
26
+ "codebuff",
27
+ "goose",
28
+ "hermes",
29
+ "kilo",
30
+ "kimi",
31
+ "openclaw",
32
+ "pi",
33
+ "qwen",
34
+ ];
4
35
 
5
36
  export interface TokenUsage {
6
37
  inputTokens: number;
@@ -40,10 +40,10 @@ const payloadFixture: SharePayload = {
40
40
  },
41
41
  ],
42
42
  dailyAgentTokensByDate: {
43
- "2025-12-31": { claude: 0, codex: 2000, gemini: 0, opencode: 0, droid: 0, copilot: 0 },
43
+ "2025-12-31": { claude: 0, codex: 2000, gemini: 0, opencode: 0, droid: 0, copilot: 0, amp: 0, codebuff: 0, goose: 0, hermes: 0, kilo: 0, kimi: 0, openclaw: 0, pi: 0, qwen: 0 },
44
44
  },
45
45
  dailyAgentCostsByDate: {
46
- "2025-12-31": { claude: 0, codex: 1.23, gemini: 0, opencode: 0, droid: 0, copilot: 0 },
46
+ "2025-12-31": { claude: 0, codex: 1.23, gemini: 0, opencode: 0, droid: 0, copilot: 0, amp: 0, codebuff: 0, goose: 0, hermes: 0, kilo: 0, kimi: 0, openclaw: 0, pi: 0, qwen: 0 },
47
47
  },
48
48
  dailyModelCostsByDate: {
49
49
  "2025-12-31": { "gpt-4.1": 1.23 },
@@ -277,16 +277,19 @@ const DEFAULT_SOURCE_LABELS: Record<SessionSource, string> = {
277
277
  opencode: "OpenCode",
278
278
  droid: "Droid",
279
279
  copilot: "Copilot",
280
+ amp: "Amp",
281
+ codebuff: "Codebuff",
282
+ goose: "Goose",
283
+ hermes: "Hermes",
284
+ kilo: "Kilo",
285
+ kimi: "Kimi",
286
+ openclaw: "OpenClaw",
287
+ pi: "pi",
288
+ qwen: "Qwen Code",
280
289
  };
281
290
 
282
- const emptySessionSourceMap = (): Record<SessionSource, number> => ({
283
- claude: 0,
284
- codex: 0,
285
- gemini: 0,
286
- opencode: 0,
287
- droid: 0,
288
- copilot: 0,
289
- });
291
+ const emptySessionSourceMap = (): Record<SessionSource, number> =>
292
+ Object.fromEntries(SESSION_SOURCES.map((source) => [source, 0])) as Record<SessionSource, number>;
290
293
 
291
294
  const defaultSourceLabel = (source: SessionSource): string =>
292
295
  DEFAULT_SOURCE_LABELS[source] ?? source;