claude-discover 1.10.14 → 1.10.16

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.
package/out/main/main.js CHANGED
@@ -1883,6 +1883,7 @@ function classifySource(meta) {
1883
1883
  if (meta.hasScheduledTask) return "scheduled";
1884
1884
  return (meta.entrypoint || "").toLowerCase() || "other";
1885
1885
  }
1886
+ var experimentId = (atis) => atis.match(/^v1\.([0-9a-f]+)\./)?.[1] ?? atis;
1886
1887
  function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileSize, mtime }) {
1887
1888
  return {
1888
1889
  sessionId,
@@ -1900,6 +1901,7 @@ function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileS
1900
1901
  customTitle: null,
1901
1902
  agentName: null,
1902
1903
  tag: null,
1904
+ experiment: null,
1903
1905
  forkedFrom: null,
1904
1906
  forkedAt: null,
1905
1907
  ...freshMetrics()
@@ -1956,6 +1958,7 @@ var SessionParser = class {
1956
1958
  this.tokenTotal = 0;
1957
1959
  this.lastSeenTs = null;
1958
1960
  this.modelId = null;
1961
+ this.caveat = null;
1959
1962
  this.commandUuids = /* @__PURE__ */ new Set();
1960
1963
  this.seenUuids = /* @__PURE__ */ new Set();
1961
1964
  this.typedCommands = /* @__PURE__ */ new Map();
@@ -1978,6 +1981,7 @@ var SessionParser = class {
1978
1981
  if (t === "custom-title" && obj.customTitle) meta.customTitle = obj.customTitle;
1979
1982
  if (t === "agent-name" && obj.agentName) meta.agentName = obj.agentName;
1980
1983
  if (t === "tag") meta.tag = obj.tag || null;
1984
+ if (t === "atis-latch" && obj.atis) meta.experiment = experimentId(obj.atis);
1981
1985
  if (t === "queue-operation" && obj.content?.includes("<scheduled-task")) meta.hasScheduledTask = true;
1982
1986
  if (t === "started" && obj.key && obj.agentId) meta.workflowAgents += 1;
1983
1987
  if (t === "attachment" && obj.attachment?.type === "model") this.modelId = obj.attachment.identity?.modelId;
@@ -1997,6 +2001,7 @@ var SessionParser = class {
1997
2001
  return false;
1998
2002
  }
1999
2003
  obj._ts = ts;
2004
+ if (obj.parentUuid && obj.parentUuid === this.caveat?.uuid && ts < this.caveat._ts) this.caveat._ts = ts;
2000
2005
  if (inherited != null) {
2001
2006
  if (meta.startedAt == null || inherited < meta.startedAt) meta.startedAt = inherited;
2002
2007
  if (inherited > meta.lastActivityAt) meta.lastActivityAt = inherited;
@@ -2069,8 +2074,10 @@ var SessionParser = class {
2069
2074
  } else if (text.startsWith("<local-command-stdout>")) {
2070
2075
  if (meta.firstUserCommand) meta.firstUserCommand += "\n" + text;
2071
2076
  obj.isMeta = true;
2072
- } else if (text.startsWith("<local-command-caveat>")) obj.isMeta = true;
2073
- else if (text.startsWith("<scheduled-task")) meta.hasScheduledTask = true;
2077
+ } else if (text.startsWith("<local-command-caveat>")) {
2078
+ obj.isMeta = true;
2079
+ this.caveat = obj;
2080
+ } else if (text.startsWith("<scheduled-task")) meta.hasScheduledTask = true;
2074
2081
  else if (text && !obj.isMeta && !obj.isCompactSummary) {
2075
2082
  if (obj.promptId && text.startsWith("/")) this.typedCommands.set(`${obj.promptId} ${text.split(/\s/)[0]}`, obj);
2076
2083
  if (!meta.firstUserPrompt) meta.firstUserPrompt = text.slice(0, 300);
@@ -2810,6 +2817,7 @@ var isSafeId = (id) => /^[\w-]+$/.test(id);
2810
2817
  var debugLogOf = (reader) => reader.parentSessionId || !isSafeId(reader.sessionId) ? null : new McpDebugLog(reader.sessionId);
2811
2818
  var SessionsService = class extends EventEmitter {
2812
2819
  #branch = null;
2820
+ #opened = null;
2813
2821
  constructor({ root, throttleMs = 100, scanner = null } = {}) {
2814
2822
  super();
2815
2823
  this.scanner = scanner ?? new SessionsScanner(root ? { root } : {});
@@ -2825,7 +2833,7 @@ var SessionsService = class extends EventEmitter {
2825
2833
  this.emittedSeq = 0;
2826
2834
  }
2827
2835
  async readSession(filePath, date = null, granularity = "day") {
2828
- const meta = this.metaCache.get(filePath);
2836
+ const meta = this.#meta(filePath);
2829
2837
  if (!meta) return null;
2830
2838
  const range = date ? periodBounds(date, granularity) : null;
2831
2839
  const reader = new SessionFile(meta.filePath);
@@ -2908,7 +2916,7 @@ var SessionsService = class extends EventEmitter {
2908
2916
  };
2909
2917
  }
2910
2918
  async readRequests(filePath, date = null, granularity = "day") {
2911
- const meta = this.metaCache.get(filePath);
2919
+ const meta = this.#meta(filePath);
2912
2920
  if (!meta || !isSafeId(meta.sessionId)) return [];
2913
2921
  const range = date ? periodBounds(date, granularity) : null;
2914
2922
  const own = await this.#requestFile(meta.sessionId, meta.parentSessionId).read(range);
@@ -2923,7 +2931,19 @@ var SessionsService = class extends EventEmitter {
2923
2931
  return [...own, ...unattributed].sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
2924
2932
  }
2925
2933
  avatarPath(filePath) {
2926
- return this.metaCache.get(filePath)?.avatar ?? null;
2934
+ return this.#meta(filePath)?.avatar ?? null;
2935
+ }
2936
+ async openFile(filePath) {
2937
+ if (!filePath?.endsWith(".jsonl")) throw new Error(`Not a .jsonl transcript: ${filePath}`);
2938
+ const meta = await this._scanSession(new SessionFile(filePath));
2939
+ if (!meta) throw new Error(`Can't read ${filePath}`);
2940
+ if (!meta.messageCount) throw new Error(`No Claude Code messages in ${filePath}`);
2941
+ meta.projectShort = suffixLabels([meta.project]).get(meta.project);
2942
+ this.#opened = stripInternal(meta);
2943
+ return this.#opened;
2944
+ }
2945
+ #meta(filePath) {
2946
+ return this.metaCache.get(filePath) ?? (this.#opened?.filePath === filePath ? this.#opened : null);
2927
2947
  }
2928
2948
  #requestFile(sessionId, parentSessionId) {
2929
2949
  const agentId = parentSessionId && sessionId.startsWith("agent-") ? sessionId.slice(6) : null;
@@ -14083,7 +14103,7 @@ var MainWindow = class {
14083
14103
  // src/main/updater.js
14084
14104
  var updater = new NpmUpdater({
14085
14105
  name: "claude-discover",
14086
- version: "1.10.14",
14106
+ version: "1.10.16",
14087
14107
  bin: { "claude-discover": "bin/claude-discover.mjs" }
14088
14108
  }, { dev: false });
14089
14109
  // src/main/Application.js
@@ -14110,6 +14130,7 @@ var Application = class {
14110
14130
  ipcMain.handle("sessions:list", (_e, date, granularity) => sessionsService.list(date, granularity));
14111
14131
  ipcMain.handle("sessions:read", (_e, filePath, date, granularity) => sessionsService.readSession(filePath, date, granularity));
14112
14132
  ipcMain.handle("sessions:read-requests", (_e, filePath, date, granularity) => sessionsService.readRequests(filePath, date, granularity));
14133
+ ipcMain.handle("sessions:open-file", (_e, filePath) => sessionsService.openFile(filePath));
14113
14134
  ipcMain.handle("sessions:read-avatar", (_e, filePath) => webpDataUrl(sessionsService.avatarPath(filePath)));
14114
14135
  ipcMain.handle("switch:status", (_e, name) => switchers.status(name));
14115
14136
  ipcMain.handle("switch:activate", (_e, name) => switchers.activate(name));
@@ -14139,6 +14160,17 @@ var Application = class {
14139
14160
  BrowserWindow.getAllWindows().forEach((w) => w.close());
14140
14161
  app.exit(0);
14141
14162
  }
14163
+ async #pickSessionFile() {
14164
+ const { canceled, filePaths } = await dialog.showOpenDialog({
14165
+ title: "Open session file",
14166
+ properties: ["openFile"],
14167
+ filters: [{
14168
+ name: "Session transcripts",
14169
+ extensions: ["jsonl"]
14170
+ }]
14171
+ });
14172
+ if (!canceled && filePaths[0]) this.win.send("sessions:open-file", filePaths[0]);
14173
+ }
14142
14174
  #buildMenu() {
14143
14175
  const { win, switchers } = this;
14144
14176
  const changeDir = (dir) => switchers.activate("claudedir", dir);
@@ -14147,6 +14179,12 @@ var Application = class {
14147
14179
  {
14148
14180
  label: "File",
14149
14181
  submenu: [
14182
+ {
14183
+ label: "Open session file…",
14184
+ accelerator: "CmdOrCtrl+O",
14185
+ click: () => this.#pickSessionFile()
14186
+ },
14187
+ { type: "separator" },
14150
14188
  {
14151
14189
  label: "Change directory…",
14152
14190
  click: () => changeDir()
@@ -17,6 +17,9 @@ electron.contextBridge.exposeInMainWorld("api", {
17
17
  readSession: (filePath, date = null, granularity = "day") => electron.ipcRenderer.invoke("sessions:read", filePath, date, granularity),
18
18
  readRequests: (filePath, date = null, granularity = "day") => electron.ipcRenderer.invoke("sessions:read-requests", filePath, date, granularity),
19
19
  readAvatar: (filePath) => electron.ipcRenderer.invoke("sessions:read-avatar", filePath),
20
+ openSessionFile: (filePath) => electron.ipcRenderer.invoke("sessions:open-file", filePath),
21
+ onOpenSessionFile: subscribe("sessions:open-file"),
22
+ pathForFile: (file) => electron.webUtils.getPathForFile(file),
20
23
  onSessionsUpdate: subscribe("sessions:update"),
21
24
  onScanProgress: subscribe("sessions:scan-progress"),
22
25
  getWorkHours: () => electron.ipcRenderer.invoke("work-hours:get"),
@@ -225,16 +225,6 @@
225
225
  background: var(--bg);
226
226
  }
227
227
 
228
- .heat-strip {
229
- display: block;
230
- box-sizing: content-box; /* its width attribute is the canvas's inner width; the border goes outside, as on .gantt-canvas */
231
- background: var(--bg-elev);
232
- border: 1px solid var(--border);
233
- border-bottom: none;
234
- border-top-left-radius: 4px;
235
- border-top-right-radius: 4px;
236
- }
237
-
238
228
  .gantt-canvas {
239
229
  width: 100%;
240
230
  flex: 1;
@@ -249,12 +239,6 @@
249
239
  & svg { display: block; }
250
240
  }
251
241
 
252
- .heat-strip + .gantt-canvas {
253
- border-top-left-radius: 0;
254
- border-top-right-radius: 0;
255
- border-top: none;
256
- }
257
-
258
242
  /* Pinned over the chart svg's own header rows; overflow lets the work-hours overlay run down the chart */
259
243
  .gantt-header {
260
244
  position: sticky;
@@ -881,12 +865,15 @@
881
865
  }
882
866
 
883
867
  /* the MCP blocks' color: the debug log fills them in */
884
- .debug-badge {
868
+ .debug-badge,
869
+ .experiment-badge {
885
870
  display: inline-flex; align-items: center; justify-content: center;
886
871
  width: 18px; height: 18px;
887
872
  color: var(--mcp);
888
873
  }
889
874
 
875
+ .experiment-badge { color: #c084fc; }
876
+
890
877
  /* 18px line height keeps it on the label's line */
891
878
  .session-row-time {
892
879
  grid-area: time;
@@ -2372,6 +2359,37 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2372
2359
  }
2373
2360
 
2374
2361
  .view-tab-pane-row > .session-summary { min-height: 0; }
2362
+ /* A transcript opened from a file isn't part of the timeline — its own accent says so */
2363
+ .opened-file {
2364
+ --section-accent: var(--warn);
2365
+ gap: 10px;
2366
+
2367
+ & .opened-file-icon { flex: none; color: var(--section-accent); }
2368
+ & .opened-file-path {
2369
+ flex: 1;
2370
+ min-width: 0;
2371
+ overflow: hidden;
2372
+ text-overflow: ellipsis;
2373
+ white-space: nowrap;
2374
+ direction: rtl; /* ellipsis at the start, so the file name stays visible (the <bdi> keeps the path itself LTR) */
2375
+ text-align: left;
2376
+ font-family: var(--font-mono);
2377
+ font-size: 12px;
2378
+ color: var(--text-dim);
2379
+ user-select: text;
2380
+ }
2381
+ & .opened-file-close {
2382
+ flex: none;
2383
+ display: flex;
2384
+ padding: 4px;
2385
+ border: none;
2386
+ border-radius: 4px;
2387
+ background: none;
2388
+ color: var(--text-dim);
2389
+ cursor: pointer;
2390
+ &:hover { background: var(--selected); color: var(--text); }
2391
+ }
2392
+ }
2375
2393
  .statusbar-group { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
2376
2394
 
2377
2395
  .statusbar-seg {
@@ -2531,6 +2549,7 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2531
2549
  border-top: 1px solid var(--border);
2532
2550
  font-size: 12px;
2533
2551
  color: var(--text-faint);
2552
+ white-space: nowrap; /* segments keep one line; only the Claude dir path gives way, ellipsized */
2534
2553
  }
2535
2554
 
2536
2555
  .statusbar > * + * { padding-left: 8px; border-left: 1px solid rgb(255 255 255 / 0.17); }
@@ -2545,7 +2564,6 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2545
2564
  min-width: 0;
2546
2565
  overflow: hidden;
2547
2566
  text-overflow: ellipsis;
2548
- white-space: nowrap;
2549
2567
  }
2550
2568
 
2551
2569
  /* The daily and weekly bars as one segment under one tooltip, hover-tinted like the switches */
@@ -2560,7 +2578,6 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2560
2578
  }
2561
2579
  .statusbar-limit {
2562
2580
  gap: 6px;
2563
- white-space: nowrap;
2564
2581
  & .progress-bar { width: 48px; }
2565
2582
  & .statusbar-num { min-width: 3.5ch; color: var(--text-dim); }
2566
2583
  &.warn .statusbar-num { color: var(--warn); }
@@ -2608,7 +2625,6 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2608
2625
  gap: 4px;
2609
2626
  color: var(--accent);
2610
2627
  font-weight: 700;
2611
- white-space: nowrap;
2612
2628
  }
2613
2629
 
2614
2630
  /* Session-loading indicator */
@@ -2621,7 +2637,6 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2621
2637
  width: 220px;
2622
2638
  margin-right: auto;
2623
2639
  }
2624
- .statusbar-loading-text { white-space: nowrap; }
2625
2640
  /* Fixed width: a growing count or "100%" never shifts its neighbours */
2626
2641
  .statusbar-num {
2627
2642
  display: inline-block;
@@ -2680,7 +2695,7 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2680
2695
  & > .gantt-wrap {
2681
2696
  flex: 1;
2682
2697
  padding-right: 0;
2683
- & .heat-strip, & .gantt-canvas { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
2698
+ & .gantt-canvas { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
2684
2699
  }
2685
2700
  & > .gantt-side { flex: 0 0 var(--gantt-side-width); }
2686
2701
  }