claude-discover 1.10.15 → 1.10.17
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/README.md +1 -1
- package/out/main/main.js +159 -89
- package/out/preload/preload.cjs +3 -1
- package/out/renderer/assets/{index-B0GbqX3Q.css → index-DkK-CcW5.css} +35 -129
- package/out/renderer/assets/{index-DBvvvzOo.js → index-DwoKHxnT.js} +1295 -1522
- package/out/renderer/assets/{vendors-CstdHEvv.js → vendors-CLjIyzGq.js} +814 -752
- package/out/renderer/index.html +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Ever wondered what Claude Code is **actually** doing all day?
|
|
5
5
|
|
|
6
|
-
<img width="
|
|
6
|
+
<img width="1100" height="663" alt="Demo: zooming into a day on the timeline with a run that spawned 140 agents, the sessions list's warning badges, one session's system prompt and tool definitions, its API request, and the AI session analysis (sample data)" src="https://github.com/user-attachments/assets/2a3cf94e-eeb7-43ec-9c00-f75aec378580" />
|
|
7
7
|
<br><br>
|
|
8
8
|
|
|
9
9
|
**Claude Discover** is a desktop app for exploring your local Claude Code data. Every session - from the CLI, Desktop, or SDK - lands on one timeline, where you can:
|
package/out/main/main.js
CHANGED
|
@@ -454,8 +454,6 @@ 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");
|
|
459
457
|
var STATUSLINE_PATH = join(import.meta.dirname, "../../bin/claude/statusline.mjs");
|
|
460
458
|
var PROXY_PATH = join(import.meta.dirname, "../../bin/proxy.mjs");
|
|
461
459
|
var LAUNCH_MODE = launchMode(import.meta.dirname, { dev: false });
|
|
@@ -1463,7 +1461,7 @@ var RequestFile = class {
|
|
|
1463
1461
|
}
|
|
1464
1462
|
};
|
|
1465
1463
|
// src/main/requests/TranscriptInstructions.js
|
|
1466
|
-
var TranscriptInstructions = class {
|
|
1464
|
+
var TranscriptInstructions = class TranscriptInstructions {
|
|
1467
1465
|
constructor() {
|
|
1468
1466
|
this.parser = new RequestParser();
|
|
1469
1467
|
this.shape = null;
|
|
@@ -1471,15 +1469,18 @@ var TranscriptInstructions = class {
|
|
|
1471
1469
|
}
|
|
1472
1470
|
static listed(obj, keys) {
|
|
1473
1471
|
if (obj.attachment?.type === "prompt_snapshot") return keys.size > 0;
|
|
1472
|
+
const found = TranscriptInstructions.injected(obj);
|
|
1473
|
+
return found.length > 0 && found.every((f) => keys.has(f.hash));
|
|
1474
|
+
}
|
|
1475
|
+
static injected(obj) {
|
|
1474
1476
|
const texts = (obj.rendered ?? []).map((r) => r.content).filter((t) => typeof t === "string");
|
|
1475
|
-
|
|
1477
|
+
return new RequestParser().strips({ request: { messages: [{
|
|
1476
1478
|
role: "user",
|
|
1477
1479
|
content: texts.map((text) => ({
|
|
1478
1480
|
type: "text",
|
|
1479
1481
|
text
|
|
1480
1482
|
}))
|
|
1481
1483
|
}] } });
|
|
1482
|
-
return found.length > 0 && found.every((f) => keys.has(f.hash));
|
|
1483
1484
|
}
|
|
1484
1485
|
feed(obj) {
|
|
1485
1486
|
if (obj.type === "api-request-shape") this.shape = obj.shape;
|
|
@@ -1498,6 +1499,14 @@ var TranscriptInstructions = class {
|
|
|
1498
1499
|
}));
|
|
1499
1500
|
}
|
|
1500
1501
|
};
|
|
1502
|
+
// src/shared/attachments.js
|
|
1503
|
+
var USER_ATTACHMENTS = /* @__PURE__ */ new Set([
|
|
1504
|
+
"opened_file_in_ide",
|
|
1505
|
+
"selected_lines_in_ide",
|
|
1506
|
+
"selected_lines_in_diff",
|
|
1507
|
+
"file",
|
|
1508
|
+
"already_read_file"
|
|
1509
|
+
]);
|
|
1501
1510
|
// src/main/sessions/McpTools.js
|
|
1502
1511
|
var server = (name) => /^mcp__(.+?)__/.exec(name)?.[1] ?? null;
|
|
1503
1512
|
var toolOf = (key, name) => name.slice(`mcp__${key}__`.length);
|
|
@@ -1789,8 +1798,13 @@ function parseMcpLog(text) {
|
|
|
1789
1798
|
}
|
|
1790
1799
|
return processes;
|
|
1791
1800
|
}
|
|
1792
|
-
// src/
|
|
1793
|
-
var
|
|
1801
|
+
// src/shared/usage.js
|
|
1802
|
+
var advisorIterations = (u) => (u.iterations ?? []).filter((i) => i?.type === "advisor_message");
|
|
1803
|
+
function contextSize(u) {
|
|
1804
|
+
const last = u.iterations?.findLast((i) => i.type !== "advisor_message") ?? u;
|
|
1805
|
+
return (last.input_tokens || 0) + (last.cache_read_input_tokens || 0) + (last.cache_creation_input_tokens || 0);
|
|
1806
|
+
}
|
|
1807
|
+
// src/main/sessions/usage/buckets.js
|
|
1794
1808
|
var TOKEN_FIELDS = [
|
|
1795
1809
|
"input",
|
|
1796
1810
|
"output",
|
|
@@ -1799,9 +1813,69 @@ var TOKEN_FIELDS = [
|
|
|
1799
1813
|
"cacheCreation5m",
|
|
1800
1814
|
"cacheCreation1h"
|
|
1801
1815
|
];
|
|
1802
|
-
|
|
1803
|
-
|
|
1816
|
+
var emptyBucket = () => Object.fromEntries(TOKEN_FIELDS.map((k) => [k, 0]));
|
|
1817
|
+
var isEmpty = (bucket) => TOKEN_FIELDS.every((k) => !bucket[k]);
|
|
1818
|
+
var tokenCount = (b) => b.input + b.output + b.cacheRead + b.cacheCreation;
|
|
1819
|
+
function addUsage(target, delta) {
|
|
1820
|
+
for (const k of TOKEN_FIELDS) target[k] += delta[k];
|
|
1804
1821
|
}
|
|
1822
|
+
function usageOf(u) {
|
|
1823
|
+
const cc = u.cache_creation || {};
|
|
1824
|
+
return {
|
|
1825
|
+
input: u.input_tokens || 0,
|
|
1826
|
+
output: u.output_tokens || 0,
|
|
1827
|
+
cacheRead: u.cache_read_input_tokens || 0,
|
|
1828
|
+
cacheCreation: u.cache_creation_input_tokens || 0,
|
|
1829
|
+
cacheCreation5m: cc.ephemeral_5m_input_tokens || 0,
|
|
1830
|
+
cacheCreation1h: cc.ephemeral_1h_input_tokens || 0
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
// src/main/sessions/usage/AdvisorUsage.js
|
|
1834
|
+
var AdvisorUsage = class {
|
|
1835
|
+
calls = 0;
|
|
1836
|
+
byModel = {};
|
|
1837
|
+
byModelFast = {};
|
|
1838
|
+
static inReply(msgId, u) {
|
|
1839
|
+
return advisorIterations(u).map((it, i) => ({
|
|
1840
|
+
key: `${msgId}#${i}`,
|
|
1841
|
+
model: it.model || "unknown",
|
|
1842
|
+
fast: it.speed === "fast",
|
|
1843
|
+
usage: usageOf(it)
|
|
1844
|
+
}));
|
|
1845
|
+
}
|
|
1846
|
+
add(call, growth, firstSeen) {
|
|
1847
|
+
if (firstSeen) this.calls += 1;
|
|
1848
|
+
if (!isEmpty(growth)) addUsage((call.fast ? this.byModelFast : this.byModel)[call.model] ??= emptyBucket(), growth);
|
|
1849
|
+
}
|
|
1850
|
+
summary(pricing) {
|
|
1851
|
+
const { calls, byModel, byModelFast } = this;
|
|
1852
|
+
const totalTokens = [...Object.values(byModel), ...Object.values(byModelFast)].reduce((sum, b) => sum + tokenCount(b), 0);
|
|
1853
|
+
return {
|
|
1854
|
+
calls,
|
|
1855
|
+
byModel,
|
|
1856
|
+
byModelFast,
|
|
1857
|
+
models: Object.keys({
|
|
1858
|
+
...byModel,
|
|
1859
|
+
...byModelFast
|
|
1860
|
+
}),
|
|
1861
|
+
cost: this._cost(pricing),
|
|
1862
|
+
totalTokens
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
promptCost(pricing) {
|
|
1866
|
+
return this._cost(pricing, (b) => ({
|
|
1867
|
+
...b,
|
|
1868
|
+
output: 0
|
|
1869
|
+
}));
|
|
1870
|
+
}
|
|
1871
|
+
_cost(pricing, part = (b) => b) {
|
|
1872
|
+
if (!pricing) return 0;
|
|
1873
|
+
const priced = (byModel, opts) => pricing.costUSD(Object.fromEntries(Object.entries(byModel).map(([m, b]) => [m, part(b)])), opts) || 0;
|
|
1874
|
+
return priced(this.byModel) + priced(this.byModelFast, { fast: true });
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
// src/main/sessions/SessionParser.js
|
|
1878
|
+
var ACTIVITY_GAP_MS = 3e5;
|
|
1805
1879
|
var COST_PARTS = {
|
|
1806
1880
|
input: (b) => ({ input: b.input }),
|
|
1807
1881
|
output: (b) => ({ output: b.output }),
|
|
@@ -1816,20 +1890,6 @@ var COST_PARTS = {
|
|
|
1816
1890
|
})
|
|
1817
1891
|
};
|
|
1818
1892
|
var pickParts = (byModel, part) => Object.fromEntries(Object.entries(byModel).map(([m, b]) => [m, part(b)]));
|
|
1819
|
-
function addUsage(target, delta) {
|
|
1820
|
-
for (const k of TOKEN_FIELDS) target[k] += delta[k];
|
|
1821
|
-
}
|
|
1822
|
-
function usageOf(u) {
|
|
1823
|
-
const cc = u.cache_creation || {};
|
|
1824
|
-
return {
|
|
1825
|
-
input: u.input_tokens || 0,
|
|
1826
|
-
output: u.output_tokens || 0,
|
|
1827
|
-
cacheRead: u.cache_read_input_tokens || 0,
|
|
1828
|
-
cacheCreation: u.cache_creation_input_tokens || 0,
|
|
1829
|
-
cacheCreation5m: cc.ephemeral_5m_input_tokens || 0,
|
|
1830
|
-
cacheCreation1h: cc.ephemeral_1h_input_tokens || 0
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1833
1893
|
var CACHE_TTL_MS = {
|
|
1834
1894
|
"5m": 3e5,
|
|
1835
1895
|
"1h": 36e5
|
|
@@ -1960,11 +2020,13 @@ var SessionParser = class {
|
|
|
1960
2020
|
this.tokenTotal = 0;
|
|
1961
2021
|
this.lastSeenTs = null;
|
|
1962
2022
|
this.modelId = null;
|
|
2023
|
+
this.caveat = null;
|
|
1963
2024
|
this.commandUuids = /* @__PURE__ */ new Set();
|
|
1964
2025
|
this.seenUuids = /* @__PURE__ */ new Set();
|
|
1965
2026
|
this.typedCommands = /* @__PURE__ */ new Map();
|
|
1966
2027
|
this.appliedById = /* @__PURE__ */ new Map();
|
|
1967
2028
|
this.calls = [];
|
|
2029
|
+
this.advisor = new AdvisorUsage();
|
|
1968
2030
|
this.branchStarted = false;
|
|
1969
2031
|
}
|
|
1970
2032
|
feed(obj) {
|
|
@@ -1998,10 +2060,14 @@ var SessionParser = class {
|
|
|
1998
2060
|
if (inherited != null && ts < this.range.start && ts > meta.continuesFrom) meta.continuesFrom = ts;
|
|
1999
2061
|
if (inherited != null && ts > this.range.end && (meta.continuesTo == null || ts < meta.continuesTo)) meta.continuesTo = ts;
|
|
2000
2062
|
const msg = obj.message;
|
|
2001
|
-
if (ts < this.range.start && msg?.usage && msg.id)
|
|
2063
|
+
if (ts < this.range.start && msg?.usage && msg.id) {
|
|
2064
|
+
this._growth(msg.id, usageOf(msg.usage));
|
|
2065
|
+
for (const call of AdvisorUsage.inReply(msg.id, msg.usage)) this._growth(call.key, call.usage);
|
|
2066
|
+
}
|
|
2002
2067
|
return false;
|
|
2003
2068
|
}
|
|
2004
2069
|
obj._ts = ts;
|
|
2070
|
+
if (obj.parentUuid && obj.parentUuid === this.caveat?.uuid && ts < this.caveat._ts) this.caveat._ts = ts;
|
|
2005
2071
|
if (inherited != null) {
|
|
2006
2072
|
if (meta.startedAt == null || inherited < meta.startedAt) meta.startedAt = inherited;
|
|
2007
2073
|
if (inherited > meta.lastActivityAt) meta.lastActivityAt = inherited;
|
|
@@ -2058,6 +2124,7 @@ var SessionParser = class {
|
|
|
2058
2124
|
this.lastSeenTs = null;
|
|
2059
2125
|
this.appliedById.clear();
|
|
2060
2126
|
this.calls = [];
|
|
2127
|
+
this.advisor = new AdvisorUsage();
|
|
2061
2128
|
}
|
|
2062
2129
|
_feedUser(obj) {
|
|
2063
2130
|
const meta = this.meta;
|
|
@@ -2074,8 +2141,10 @@ var SessionParser = class {
|
|
|
2074
2141
|
} else if (text.startsWith("<local-command-stdout>")) {
|
|
2075
2142
|
if (meta.firstUserCommand) meta.firstUserCommand += "\n" + text;
|
|
2076
2143
|
obj.isMeta = true;
|
|
2077
|
-
} else if (text.startsWith("<local-command-caveat>"))
|
|
2078
|
-
|
|
2144
|
+
} else if (text.startsWith("<local-command-caveat>")) {
|
|
2145
|
+
obj.isMeta = true;
|
|
2146
|
+
this.caveat = obj;
|
|
2147
|
+
} else if (text.startsWith("<scheduled-task")) meta.hasScheduledTask = true;
|
|
2079
2148
|
else if (text && !obj.isMeta && !obj.isCompactSummary) {
|
|
2080
2149
|
if (obj.promptId && text.startsWith("/")) this.typedCommands.set(`${obj.promptId} ${text.split(/\s/)[0]}`, obj);
|
|
2081
2150
|
if (!meta.firstUserPrompt) meta.firstUserPrompt = text.slice(0, 300);
|
|
@@ -2099,10 +2168,9 @@ var SessionParser = class {
|
|
|
2099
2168
|
const usage = usageOf(u);
|
|
2100
2169
|
const model = msg.model || "unknown";
|
|
2101
2170
|
const fast = u.speed === "fast";
|
|
2102
|
-
const contextSize = usage.input + usage.cacheRead + usage.cacheCreation;
|
|
2103
2171
|
if (!meta.seenMessageIds.has(msgId)) {
|
|
2104
2172
|
meta.seenMessageIds.add(msgId);
|
|
2105
|
-
this._stampRunningTotals(obj,
|
|
2173
|
+
this._stampRunningTotals(obj, usage.input + usage.cacheRead + usage.cacheCreation, usage.output);
|
|
2106
2174
|
}
|
|
2107
2175
|
if (this.excludeIds?.has(msgId)) return;
|
|
2108
2176
|
if (!this.appliedById.has(msgId)) {
|
|
@@ -2113,7 +2181,7 @@ var SessionParser = class {
|
|
|
2113
2181
|
fast,
|
|
2114
2182
|
usage
|
|
2115
2183
|
});
|
|
2116
|
-
meta.lastContextTokens = contextSize;
|
|
2184
|
+
meta.lastContextTokens = contextSize(u);
|
|
2117
2185
|
meta.contextCompacted = false;
|
|
2118
2186
|
if (u.service_tier) meta.serviceTier = u.service_tier;
|
|
2119
2187
|
if (this.pricing && this.pricing.priceFor(model) == null) meta.priceUnknown = true;
|
|
@@ -2126,7 +2194,17 @@ var SessionParser = class {
|
|
|
2126
2194
|
meta.serverToolUse.webFetch += u.server_tool_use.web_fetch_requests || 0;
|
|
2127
2195
|
}
|
|
2128
2196
|
}
|
|
2129
|
-
|
|
2197
|
+
this._addGrowth(obj, model, fast, this._growth(msgId, usage));
|
|
2198
|
+
for (const call of AdvisorUsage.inReply(msgId, u)) {
|
|
2199
|
+
const firstSeen = !this.appliedById.has(call.key);
|
|
2200
|
+
if (firstSeen && this.pricing && this.pricing.priceFor(call.model) == null) meta.priceUnknown = true;
|
|
2201
|
+
const growth = this._growth(call.key, call.usage);
|
|
2202
|
+
this.advisor.add(call, growth, firstSeen);
|
|
2203
|
+
this._addGrowth(obj, call.model, call.fast, growth);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
_addGrowth(obj, model, fast, growth) {
|
|
2207
|
+
const meta = this.meta;
|
|
2130
2208
|
if (TOKEN_FIELDS.every((k) => !growth[k])) return;
|
|
2131
2209
|
const byModel = fast ? meta.tokensByModelFast : meta.tokensByModel;
|
|
2132
2210
|
addUsage(meta.tokens, growth);
|
|
@@ -2174,7 +2252,9 @@ var SessionParser = class {
|
|
|
2174
2252
|
meta.cost = costOf({});
|
|
2175
2253
|
meta.costByType = Object.fromEntries(Object.entries(COST_PARTS).map(([type, part]) => [type, costOf({}, part)]));
|
|
2176
2254
|
const prompt = this.pricing ? promptCosts(this.calls, this.pricing) : null;
|
|
2177
|
-
|
|
2255
|
+
const fixed = meta.costByType.output + this.advisor.promptCost(this.pricing);
|
|
2256
|
+
meta.cacheCosts = prompt && Object.fromEntries(Object.entries(prompt).map(([p, c]) => [p, fixed + c]));
|
|
2257
|
+
meta.advisor = this.advisor.summary(this.pricing);
|
|
2178
2258
|
return meta;
|
|
2179
2259
|
}
|
|
2180
2260
|
};
|
|
@@ -2452,55 +2532,6 @@ var MetaCache = class {
|
|
|
2452
2532
|
return this.periodMetas.delete(filePath);
|
|
2453
2533
|
}
|
|
2454
2534
|
};
|
|
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)}`;
|
|
2504
2535
|
// src/main/sessions/ProjectResolver.js
|
|
2505
2536
|
var WORKTREE = /\/\.claude\/worktrees\/([^/]+)/;
|
|
2506
2537
|
var TEMP_ROOT = /^(.*?\/AppData\/Local\/Temp|\/(?:private\/)?(?:tmp|var\/folders\/[^/]+\/[^/]+\/T))\/(.+)/i;
|
|
@@ -2567,6 +2598,14 @@ var prices_seed_default = {
|
|
|
2567
2598
|
"cacheWrite1h": 10,
|
|
2568
2599
|
"fastModeMplr": 2
|
|
2569
2600
|
},
|
|
2601
|
+
"claude-fable-5-2": {
|
|
2602
|
+
"input": 8,
|
|
2603
|
+
"output": 40,
|
|
2604
|
+
"cacheRead": .2,
|
|
2605
|
+
"cacheWrite": 10,
|
|
2606
|
+
"cacheWrite1h": 16,
|
|
2607
|
+
"fastModeMplr": 2
|
|
2608
|
+
},
|
|
2570
2609
|
"claude-fable-5-1": {
|
|
2571
2610
|
"input": 10,
|
|
2572
2611
|
"output": 50,
|
|
@@ -2864,6 +2903,7 @@ var isSafeId = (id) => /^[\w-]+$/.test(id);
|
|
|
2864
2903
|
var debugLogOf = (reader) => reader.parentSessionId || !isSafeId(reader.sessionId) ? null : new McpDebugLog(reader.sessionId);
|
|
2865
2904
|
var SessionsService = class extends EventEmitter {
|
|
2866
2905
|
#branch = null;
|
|
2906
|
+
#opened = null;
|
|
2867
2907
|
constructor({ root, throttleMs = 100, scanner = null } = {}) {
|
|
2868
2908
|
super();
|
|
2869
2909
|
this.scanner = scanner ?? new SessionsScanner(root ? { root } : {});
|
|
@@ -2871,7 +2911,6 @@ var SessionsService = class extends EventEmitter {
|
|
|
2871
2911
|
this.throttleMs = throttleMs;
|
|
2872
2912
|
this.metaCache = new MetaCache();
|
|
2873
2913
|
this.projects = new ProjectResolver();
|
|
2874
|
-
this.experiments = new Experiments();
|
|
2875
2914
|
this.activeDay = null;
|
|
2876
2915
|
this.scanAbort = null;
|
|
2877
2916
|
this.updateTimer = null;
|
|
@@ -2880,7 +2919,7 @@ var SessionsService = class extends EventEmitter {
|
|
|
2880
2919
|
this.emittedSeq = 0;
|
|
2881
2920
|
}
|
|
2882
2921
|
async readSession(filePath, date = null, granularity = "day") {
|
|
2883
|
-
const meta = this
|
|
2922
|
+
const meta = this.#meta(filePath);
|
|
2884
2923
|
if (!meta) return null;
|
|
2885
2924
|
const range = date ? periodBounds(date, granularity) : null;
|
|
2886
2925
|
const reader = new SessionFile(meta.filePath);
|
|
@@ -2917,16 +2956,19 @@ var SessionsService = class extends EventEmitter {
|
|
|
2917
2956
|
if (start?.length && !loop.includes(start[0])) loop.unshift(...start);
|
|
2918
2957
|
items.sort((a, b) => a._ts - b._ts);
|
|
2919
2958
|
const keys = new Set(loop.map((s) => s.hash));
|
|
2959
|
+
const isBrought = (o) => USER_ATTACHMENTS.has(o.attachment?.type);
|
|
2960
|
+
const brought = new Set(items.filter(isBrought).flatMap((o) => TranscriptInstructions.injected(o)).map((f) => f.hash));
|
|
2961
|
+
const loopStrips = loop.filter((s) => !brought.has(s.hash));
|
|
2920
2962
|
for (const o of items) {
|
|
2921
2963
|
delete o._ts;
|
|
2922
|
-
if (o.type === "attachment" && TranscriptInstructions.listed(o, keys)) o._listed = true;
|
|
2964
|
+
if (o.type === "attachment" && !isBrought(o) && TranscriptInstructions.listed(o, keys)) o._listed = true;
|
|
2923
2965
|
}
|
|
2924
2966
|
const mcp = mcpTools.turns(range);
|
|
2925
2967
|
const debugLog = await debugLogOf(reader)?.fillIn(mcp, mcpTools.processStarts()) ?? null;
|
|
2926
2968
|
return {
|
|
2927
2969
|
items,
|
|
2928
2970
|
instructions: {
|
|
2929
|
-
loop,
|
|
2971
|
+
loop: loopStrips,
|
|
2930
2972
|
side,
|
|
2931
2973
|
compacts,
|
|
2932
2974
|
mcp
|
|
@@ -2963,7 +3005,7 @@ var SessionsService = class extends EventEmitter {
|
|
|
2963
3005
|
};
|
|
2964
3006
|
}
|
|
2965
3007
|
async readRequests(filePath, date = null, granularity = "day") {
|
|
2966
|
-
const meta = this
|
|
3008
|
+
const meta = this.#meta(filePath);
|
|
2967
3009
|
if (!meta || !isSafeId(meta.sessionId)) return [];
|
|
2968
3010
|
const range = date ? periodBounds(date, granularity) : null;
|
|
2969
3011
|
const own = await this.#requestFile(meta.sessionId, meta.parentSessionId).read(range);
|
|
@@ -2978,7 +3020,19 @@ var SessionsService = class extends EventEmitter {
|
|
|
2978
3020
|
return [...own, ...unattributed].sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
|
|
2979
3021
|
}
|
|
2980
3022
|
avatarPath(filePath) {
|
|
2981
|
-
return this
|
|
3023
|
+
return this.#meta(filePath)?.avatar ?? null;
|
|
3024
|
+
}
|
|
3025
|
+
async openFile(filePath) {
|
|
3026
|
+
if (!filePath?.endsWith(".jsonl")) throw new Error(`Not a .jsonl transcript: ${filePath}`);
|
|
3027
|
+
const meta = await this._scanSession(new SessionFile(filePath));
|
|
3028
|
+
if (!meta) throw new Error(`Can't read ${filePath}`);
|
|
3029
|
+
if (!meta.messageCount) throw new Error(`No Claude Code messages in ${filePath}`);
|
|
3030
|
+
meta.projectShort = suffixLabels([meta.project]).get(meta.project);
|
|
3031
|
+
this.#opened = stripInternal(meta);
|
|
3032
|
+
return this.#opened;
|
|
3033
|
+
}
|
|
3034
|
+
#meta(filePath) {
|
|
3035
|
+
return this.metaCache.get(filePath) ?? (this.#opened?.filePath === filePath ? this.#opened : null);
|
|
2982
3036
|
}
|
|
2983
3037
|
#requestFile(sessionId, parentSessionId) {
|
|
2984
3038
|
const agentId = parentSessionId && sessionId.startsWith("agent-") ? sessionId.slice(6) : null;
|
|
@@ -3092,7 +3146,6 @@ var SessionsService = class extends EventEmitter {
|
|
|
3092
3146
|
}));
|
|
3093
3147
|
const labels = suffixLabels(sessions.map((m) => m.project));
|
|
3094
3148
|
for (const m of sessions) m.projectShort = m.tempPath ? "Temp" : labels.get(m.project);
|
|
3095
|
-
await this.experiments.name(sessions);
|
|
3096
3149
|
return sessions;
|
|
3097
3150
|
}
|
|
3098
3151
|
_dedupedDay(day) {
|
|
@@ -14139,7 +14192,7 @@ var MainWindow = class {
|
|
|
14139
14192
|
// src/main/updater.js
|
|
14140
14193
|
var updater = new NpmUpdater({
|
|
14141
14194
|
name: "claude-discover",
|
|
14142
|
-
version: "1.10.
|
|
14195
|
+
version: "1.10.17",
|
|
14143
14196
|
bin: { "claude-discover": "bin/claude-discover.mjs" }
|
|
14144
14197
|
}, { dev: false });
|
|
14145
14198
|
// src/main/Application.js
|
|
@@ -14165,8 +14218,8 @@ var Application = class {
|
|
|
14165
14218
|
});
|
|
14166
14219
|
ipcMain.handle("sessions:list", (_e, date, granularity) => sessionsService.list(date, granularity));
|
|
14167
14220
|
ipcMain.handle("sessions:read", (_e, filePath, date, granularity) => sessionsService.readSession(filePath, date, granularity));
|
|
14168
|
-
ipcMain.handle("experiments:read", () => sessionsService.experiments.read());
|
|
14169
14221
|
ipcMain.handle("sessions:read-requests", (_e, filePath, date, granularity) => sessionsService.readRequests(filePath, date, granularity));
|
|
14222
|
+
ipcMain.handle("sessions:open-file", (_e, filePath) => sessionsService.openFile(filePath));
|
|
14170
14223
|
ipcMain.handle("sessions:read-avatar", (_e, filePath) => webpDataUrl(sessionsService.avatarPath(filePath)));
|
|
14171
14224
|
ipcMain.handle("switch:status", (_e, name) => switchers.status(name));
|
|
14172
14225
|
ipcMain.handle("switch:activate", (_e, name) => switchers.activate(name));
|
|
@@ -14196,6 +14249,17 @@ var Application = class {
|
|
|
14196
14249
|
BrowserWindow.getAllWindows().forEach((w) => w.close());
|
|
14197
14250
|
app.exit(0);
|
|
14198
14251
|
}
|
|
14252
|
+
async #pickSessionFile() {
|
|
14253
|
+
const { canceled, filePaths } = await dialog.showOpenDialog({
|
|
14254
|
+
title: "Open session file",
|
|
14255
|
+
properties: ["openFile"],
|
|
14256
|
+
filters: [{
|
|
14257
|
+
name: "Session transcripts",
|
|
14258
|
+
extensions: ["jsonl"]
|
|
14259
|
+
}]
|
|
14260
|
+
});
|
|
14261
|
+
if (!canceled && filePaths[0]) this.win.send("sessions:open-file", filePaths[0]);
|
|
14262
|
+
}
|
|
14199
14263
|
#buildMenu() {
|
|
14200
14264
|
const { win, switchers } = this;
|
|
14201
14265
|
const changeDir = (dir) => switchers.activate("claudedir", dir);
|
|
@@ -14204,6 +14268,12 @@ var Application = class {
|
|
|
14204
14268
|
{
|
|
14205
14269
|
label: "File",
|
|
14206
14270
|
submenu: [
|
|
14271
|
+
{
|
|
14272
|
+
label: "Open session file…",
|
|
14273
|
+
accelerator: "CmdOrCtrl+O",
|
|
14274
|
+
click: () => this.#pickSessionFile()
|
|
14275
|
+
},
|
|
14276
|
+
{ type: "separator" },
|
|
14207
14277
|
{
|
|
14208
14278
|
label: "Change directory…",
|
|
14209
14279
|
click: () => changeDir()
|
package/out/preload/preload.cjs
CHANGED
|
@@ -15,9 +15,11 @@ 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"),
|
|
19
18
|
readRequests: (filePath, date = null, granularity = "day") => electron.ipcRenderer.invoke("sessions:read-requests", filePath, date, granularity),
|
|
20
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),
|
|
21
23
|
onSessionsUpdate: subscribe("sessions:update"),
|
|
22
24
|
onScanProgress: subscribe("sessions:scan-progress"),
|
|
23
25
|
getWorkHours: () => electron.ipcRenderer.invoke("work-hours:get"),
|