claude-discover 1.10.14 → 1.10.15

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
@@ -454,6 +454,8 @@ var RECENT_CLAUDE_DIRS = local.recents || [CLAUDE_DIR];
454
454
  var CLAUDE_PROJECTS_DIR = join(CLAUDE_DIR, "projects");
455
455
  var CLAUDE_SETTINGS = join(CLAUDE_DIR, "settings.json");
456
456
  var CLAUDE_DEBUG_DIR = join(CLAUDE_DIR, "debug");
457
+ var insideDir = CLAUDE_DIR === process.env.CLAUDE_CONFIG_DIR || basename(CLAUDE_DIR) !== ".claude";
458
+ var CLAUDE_CONFIG = join(insideDir ? CLAUDE_DIR : dirname(CLAUDE_DIR), ".claude.json");
457
459
  var STATUSLINE_PATH = join(import.meta.dirname, "../../bin/claude/statusline.mjs");
458
460
  var PROXY_PATH = join(import.meta.dirname, "../../bin/proxy.mjs");
459
461
  var LAUNCH_MODE = launchMode(import.meta.dirname, { dev: false });
@@ -1883,6 +1885,7 @@ function classifySource(meta) {
1883
1885
  if (meta.hasScheduledTask) return "scheduled";
1884
1886
  return (meta.entrypoint || "").toLowerCase() || "other";
1885
1887
  }
1888
+ var experimentId = (atis) => atis.match(/^v1\.([0-9a-f]+)\./)?.[1] ?? atis;
1886
1889
  function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileSize, mtime }) {
1887
1890
  return {
1888
1891
  sessionId,
@@ -1900,6 +1903,7 @@ function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileS
1900
1903
  customTitle: null,
1901
1904
  agentName: null,
1902
1905
  tag: null,
1906
+ experiment: null,
1903
1907
  forkedFrom: null,
1904
1908
  forkedAt: null,
1905
1909
  ...freshMetrics()
@@ -1978,6 +1982,7 @@ var SessionParser = class {
1978
1982
  if (t === "custom-title" && obj.customTitle) meta.customTitle = obj.customTitle;
1979
1983
  if (t === "agent-name" && obj.agentName) meta.agentName = obj.agentName;
1980
1984
  if (t === "tag") meta.tag = obj.tag || null;
1985
+ if (t === "atis-latch" && obj.atis) meta.experiment = experimentId(obj.atis);
1981
1986
  if (t === "queue-operation" && obj.content?.includes("<scheduled-task")) meta.hasScheduledTask = true;
1982
1987
  if (t === "started" && obj.key && obj.agentId) meta.workflowAgents += 1;
1983
1988
  if (t === "attachment" && obj.attachment?.type === "model") this.modelId = obj.attachment.identity?.modelId;
@@ -2447,6 +2452,55 @@ var MetaCache = class {
2447
2452
  return this.periodMetas.delete(filePath);
2448
2453
  }
2449
2454
  };
2455
+ // src/main/sessions/Experiments.js
2456
+ var Experiments = class {
2457
+ #mtime = null;
2458
+ #byId = /* @__PURE__ */ new Map();
2459
+ constructor(file = CLAUDE_CONFIG) {
2460
+ this.file = file;
2461
+ }
2462
+ async get() {
2463
+ try {
2464
+ const { mtimeMs } = await fsp.stat(this.file);
2465
+ if (mtimeMs === this.#mtime) return this.#byId;
2466
+ const slots = Object.values(JSON.parse(await fsp.readFile(this.file, "utf8")).clientDataCacheSlots ?? {}).filter((s) => s?.data);
2467
+ this.#byId = collect(slots);
2468
+ this.#mtime = mtimeMs;
2469
+ } catch {}
2470
+ return this.#byId;
2471
+ }
2472
+ async read() {
2473
+ return Object.fromEntries(await this.get());
2474
+ }
2475
+ async name(sessions) {
2476
+ const byId = await this.get();
2477
+ for (const m of sessions) m.experimentName = byId.get(m.experiment)?.name ?? null;
2478
+ }
2479
+ };
2480
+ function collect(slots) {
2481
+ const plain = new Set(slots.filter((s) => !s.data.atis).flatMap((s) => Object.entries(s.data).map(entryKey)));
2482
+ const byId = /* @__PURE__ */ new Map();
2483
+ for (const { data, model, at } of slots.filter((s) => s.data.atis).sort((a, b) => a.at - b.at)) {
2484
+ if (!byId.has(data.atis)) byId.set(data.atis, {
2485
+ name: null,
2486
+ models: [],
2487
+ cachedAt: null,
2488
+ settings: null
2489
+ });
2490
+ const e = byId.get(data.atis);
2491
+ e.settings = pick(data, (k, v) => k !== "atis" && k !== "experimentKey" && !plain.has(entryKey([k, v])));
2492
+ e.name = data.experimentKey ?? e.name;
2493
+ e.cachedAt = Number(at);
2494
+ if (!e.models.includes(model)) e.models.push(model);
2495
+ }
2496
+ const all = [...byId.values()];
2497
+ const inOthers = (e, k, v) => all.some((o) => o !== e && o.models.some((m) => e.models.includes(m)) && entryKey([k, o.settings[k]]) === entryKey([k, v]));
2498
+ const own = all.map((e) => pick(e.settings, (k, v) => !inOthers(e, k, v)));
2499
+ for (const [i, e] of all.entries()) e.settings = own[i];
2500
+ return byId;
2501
+ }
2502
+ var pick = (from, keep) => Object.fromEntries(Object.entries(from).filter(([k, v]) => keep(k, v)));
2503
+ var entryKey = ([k, v]) => `${k}=${JSON.stringify(v)}`;
2450
2504
  // src/main/sessions/ProjectResolver.js
2451
2505
  var WORKTREE = /\/\.claude\/worktrees\/([^/]+)/;
2452
2506
  var TEMP_ROOT = /^(.*?\/AppData\/Local\/Temp|\/(?:private\/)?(?:tmp|var\/folders\/[^/]+\/[^/]+\/T))\/(.+)/i;
@@ -2817,6 +2871,7 @@ var SessionsService = class extends EventEmitter {
2817
2871
  this.throttleMs = throttleMs;
2818
2872
  this.metaCache = new MetaCache();
2819
2873
  this.projects = new ProjectResolver();
2874
+ this.experiments = new Experiments();
2820
2875
  this.activeDay = null;
2821
2876
  this.scanAbort = null;
2822
2877
  this.updateTimer = null;
@@ -3037,6 +3092,7 @@ var SessionsService = class extends EventEmitter {
3037
3092
  }));
3038
3093
  const labels = suffixLabels(sessions.map((m) => m.project));
3039
3094
  for (const m of sessions) m.projectShort = m.tempPath ? "Temp" : labels.get(m.project);
3095
+ await this.experiments.name(sessions);
3040
3096
  return sessions;
3041
3097
  }
3042
3098
  _dedupedDay(day) {
@@ -14083,7 +14139,7 @@ var MainWindow = class {
14083
14139
  // src/main/updater.js
14084
14140
  var updater = new NpmUpdater({
14085
14141
  name: "claude-discover",
14086
- version: "1.10.14",
14142
+ version: "1.10.15",
14087
14143
  bin: { "claude-discover": "bin/claude-discover.mjs" }
14088
14144
  }, { dev: false });
14089
14145
  // src/main/Application.js
@@ -14109,6 +14165,7 @@ var Application = class {
14109
14165
  });
14110
14166
  ipcMain.handle("sessions:list", (_e, date, granularity) => sessionsService.list(date, granularity));
14111
14167
  ipcMain.handle("sessions:read", (_e, filePath, date, granularity) => sessionsService.readSession(filePath, date, granularity));
14168
+ ipcMain.handle("experiments:read", () => sessionsService.experiments.read());
14112
14169
  ipcMain.handle("sessions:read-requests", (_e, filePath, date, granularity) => sessionsService.readRequests(filePath, date, granularity));
14113
14170
  ipcMain.handle("sessions:read-avatar", (_e, filePath) => webpDataUrl(sessionsService.avatarPath(filePath)));
14114
14171
  ipcMain.handle("switch:status", (_e, name) => switchers.status(name));
@@ -15,6 +15,7 @@ electron.contextBridge.exposeInMainWorld("api", {
15
15
  setSwitchKeepActive: (name, value) => electron.ipcRenderer.invoke("switch:keep-active", name, value),
16
16
  listSessions: (date, granularity = "day") => electron.ipcRenderer.invoke("sessions:list", date, granularity),
17
17
  readSession: (filePath, date = null, granularity = "day") => electron.ipcRenderer.invoke("sessions:read", filePath, date, granularity),
18
+ readExperiments: () => electron.ipcRenderer.invoke("experiments:read"),
18
19
  readRequests: (filePath, date = null, granularity = "day") => electron.ipcRenderer.invoke("sessions:read-requests", filePath, date, granularity),
19
20
  readAvatar: (filePath) => electron.ipcRenderer.invoke("sessions:read-avatar", filePath),
20
21
  onSessionsUpdate: subscribe("sessions:update"),
@@ -118,6 +118,25 @@
118
118
  font-size: 11px;
119
119
  color: var(--text-dim);
120
120
  }
121
+ .experiment-band {
122
+ display: block;
123
+ box-sizing: content-box; /* its width attribute is the canvas's inner width; the border goes outside, as on .gantt-canvas */
124
+ background: var(--bg-elev);
125
+ border: 1px solid var(--border);
126
+ border-bottom: none;
127
+ border-top-left-radius: 4px;
128
+ border-top-right-radius: 4px;
129
+ }
130
+
131
+ .experiment-band-label { font: 10px var(--font-mono), monospace; fill: #8f97a8; }
132
+ .experiment-lane {
133
+ cursor: pointer;
134
+
135
+ & .experiment-lane-hit { fill: transparent; }
136
+ &:hover .experiment-lane-hit, &.open .experiment-lane-hit { fill: rgb(255 255 255 / 0.06); }
137
+ &:hover .experiment-band-label, &.open .experiment-band-label { fill: #cbd1dc; }
138
+ &.open .experiment-band-label { font-weight: 700; }
139
+ }
121
140
  /* Floats over the gantt canvas's bottom-right corner, outside its scroll area so it stays put; clears the 5px scrollbar */
122
141
  .source-legend {
123
142
  position: absolute;
@@ -225,16 +244,6 @@
225
244
  background: var(--bg);
226
245
  }
227
246
 
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
247
  .gantt-canvas {
239
248
  width: 100%;
240
249
  flex: 1;
@@ -249,7 +258,7 @@
249
258
  & svg { display: block; }
250
259
  }
251
260
 
252
- .heat-strip + .gantt-canvas {
261
+ .experiment-band + .gantt-canvas {
253
262
  border-top-left-radius: 0;
254
263
  border-top-right-radius: 0;
255
264
  border-top: none;
@@ -660,6 +669,13 @@
660
669
 
661
670
  & b { color: var(--text-dim); }
662
671
  }
672
+ /* first on the session row's second line, right of its timeline, so the icons line up down the list */
673
+ .experiment-tag {
674
+ display: flex;
675
+ align-items: center;
676
+ height: 14px;
677
+ cursor: pointer;
678
+ }
663
679
  .session-list {
664
680
  display: flex;
665
681
  flex-direction: column;
@@ -942,7 +958,7 @@
942
958
  & > * { flex: none; }
943
959
  & > :last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
944
960
  & > * + *::before { content: ', '; }
945
- & > .fork-tag + *::before { content: '\00a0'; }
961
+ & > :is(.fork-tag, .experiment-tag) + *::before { content: '\00a0'; }
946
962
  & .subagent-tag, & .worktree-tag { font-size: inherit; }
947
963
  }
948
964
  .session-model { color: var(--text-dim); }
@@ -2372,6 +2388,99 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2372
2388
  }
2373
2389
 
2374
2390
  .view-tab-pane-row > .session-summary { min-height: 0; }
2391
+ .experiment-details {
2392
+ --label: #9aa3b2; /* brighter than --text-dim, which is too faint for running text */
2393
+ display: flex;
2394
+ flex-direction: column;
2395
+ font-size: 14px;
2396
+ line-height: 1.55;
2397
+ color: var(--text);
2398
+
2399
+ & h4 {
2400
+ margin: 36px 0 14px;
2401
+ font-size: 12px;
2402
+ font-weight: 600;
2403
+ letter-spacing: 0.06em;
2404
+ text-transform: uppercase;
2405
+ color: var(--label);
2406
+ }
2407
+ & dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 20px; margin: 0; }
2408
+ & dt { color: var(--label); }
2409
+ & dd { margin: 0; overflow-wrap: anywhere; }
2410
+ & .mono { font-family: var(--font-mono), monospace; font-size: 13px; }
2411
+ & .selectable { user-select: text; }
2412
+
2413
+ /* stacked: a setting's value can be a whole prompt section */
2414
+ & .experiment-settings {
2415
+ display: block;
2416
+
2417
+ & dt { margin-top: 20px; color: var(--text); }
2418
+ & dt:first-child { margin-top: 0; }
2419
+ & dd { margin-top: 4px; color: #c3c9d4; }
2420
+ /* prose, so a reading face rather than code */
2421
+ & pre {
2422
+ margin: 6px 0 0;
2423
+ max-height: 420px;
2424
+ overflow: auto;
2425
+ padding: 12px 16px;
2426
+ background: var(--bg-elev);
2427
+ border-radius: 6px;
2428
+ font: 14px/1.65 var(--font-sans);
2429
+ color: #d4d9e1;
2430
+ white-space: pre-wrap;
2431
+ }
2432
+ }
2433
+ }
2434
+
2435
+ /* the session's tab bar height, so the panes line up */
2436
+ .experiment-details-header {
2437
+ flex: none;
2438
+ box-sizing: border-box;
2439
+ height: var(--pane-header-height);
2440
+ display: flex;
2441
+ align-items: center;
2442
+ padding: 0 24px; /* the body's, so its centered column lines up with the text's */
2443
+ border-bottom: 1px solid var(--border);
2444
+
2445
+ & .experiment-details-header-row { flex: 1; display: flex; align-items: center; justify-content: space-between; }
2446
+ & h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; }
2447
+ }
2448
+
2449
+ .experiment-details-close {
2450
+ display: flex;
2451
+ padding: 4px;
2452
+ background: none;
2453
+ border: none;
2454
+ border-radius: 4px;
2455
+ color: var(--text-dim);
2456
+ cursor: pointer;
2457
+
2458
+ &:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
2459
+ }
2460
+
2461
+ .experiment-details-body {
2462
+ flex: 1;
2463
+ min-height: 0;
2464
+ overflow-y: auto;
2465
+ padding: 28px 24px 48px;
2466
+ }
2467
+
2468
+ /* a readable line length for the prompt sections; the header's row shares it, so the title lines up with the text */
2469
+ .experiment-details-header-row, .experiment-details-content {
2470
+ max-width: 760px;
2471
+ margin: 0 auto;
2472
+ }
2473
+
2474
+ /* a markdown quote, as ui/Markdown.css draws them */
2475
+ .experiment-intro {
2476
+ margin: 0 0 32px;
2477
+ padding: 4px 0 4px 14px;
2478
+ border-left: 3px solid var(--border-strong);
2479
+ color: var(--label);
2480
+ line-height: 1.65;
2481
+ }
2482
+
2483
+ .experiment-note { margin: 0 0 20px; font-size: 13px; line-height: 1.6; color: var(--label); }
2375
2484
  .statusbar-group { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
2376
2485
 
2377
2486
  .statusbar-seg {
@@ -2680,7 +2789,7 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
2680
2789
  & > .gantt-wrap {
2681
2790
  flex: 1;
2682
2791
  padding-right: 0;
2683
- & .heat-strip, & .gantt-canvas { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
2792
+ & .experiment-band, & .gantt-canvas { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }
2684
2793
  }
2685
2794
  & > .gantt-side { flex: 0 0 var(--gantt-side-width); }
2686
2795
  }