claude-discover 1.10.16 → 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 +119 -30
- package/out/renderer/assets/{index-BT23D4e7.css → index-DkK-CcW5.css} +2 -2
- package/out/renderer/assets/{index-CqJoMYk1.js → index-DwoKHxnT.js} +569 -293
- package/out/renderer/assets/{vendors-DVmtvyac.js → vendors-CLjIyzGq.js} +69 -42
- package/out/renderer/index.html +3 -3
- package/package.json +2 -2
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
|
@@ -1461,7 +1461,7 @@ var RequestFile = class {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
};
|
|
1463
1463
|
// src/main/requests/TranscriptInstructions.js
|
|
1464
|
-
var TranscriptInstructions = class {
|
|
1464
|
+
var TranscriptInstructions = class TranscriptInstructions {
|
|
1465
1465
|
constructor() {
|
|
1466
1466
|
this.parser = new RequestParser();
|
|
1467
1467
|
this.shape = null;
|
|
@@ -1469,15 +1469,18 @@ var TranscriptInstructions = class {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
static listed(obj, keys) {
|
|
1471
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) {
|
|
1472
1476
|
const texts = (obj.rendered ?? []).map((r) => r.content).filter((t) => typeof t === "string");
|
|
1473
|
-
|
|
1477
|
+
return new RequestParser().strips({ request: { messages: [{
|
|
1474
1478
|
role: "user",
|
|
1475
1479
|
content: texts.map((text) => ({
|
|
1476
1480
|
type: "text",
|
|
1477
1481
|
text
|
|
1478
1482
|
}))
|
|
1479
1483
|
}] } });
|
|
1480
|
-
return found.length > 0 && found.every((f) => keys.has(f.hash));
|
|
1481
1484
|
}
|
|
1482
1485
|
feed(obj) {
|
|
1483
1486
|
if (obj.type === "api-request-shape") this.shape = obj.shape;
|
|
@@ -1496,6 +1499,14 @@ var TranscriptInstructions = class {
|
|
|
1496
1499
|
}));
|
|
1497
1500
|
}
|
|
1498
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
|
+
]);
|
|
1499
1510
|
// src/main/sessions/McpTools.js
|
|
1500
1511
|
var server = (name) => /^mcp__(.+?)__/.exec(name)?.[1] ?? null;
|
|
1501
1512
|
var toolOf = (key, name) => name.slice(`mcp__${key}__`.length);
|
|
@@ -1787,8 +1798,13 @@ function parseMcpLog(text) {
|
|
|
1787
1798
|
}
|
|
1788
1799
|
return processes;
|
|
1789
1800
|
}
|
|
1790
|
-
// src/
|
|
1791
|
-
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
|
|
1792
1808
|
var TOKEN_FIELDS = [
|
|
1793
1809
|
"input",
|
|
1794
1810
|
"output",
|
|
@@ -1797,9 +1813,69 @@ var TOKEN_FIELDS = [
|
|
|
1797
1813
|
"cacheCreation5m",
|
|
1798
1814
|
"cacheCreation1h"
|
|
1799
1815
|
];
|
|
1800
|
-
|
|
1801
|
-
|
|
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];
|
|
1802
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;
|
|
1803
1879
|
var COST_PARTS = {
|
|
1804
1880
|
input: (b) => ({ input: b.input }),
|
|
1805
1881
|
output: (b) => ({ output: b.output }),
|
|
@@ -1814,20 +1890,6 @@ var COST_PARTS = {
|
|
|
1814
1890
|
})
|
|
1815
1891
|
};
|
|
1816
1892
|
var pickParts = (byModel, part) => Object.fromEntries(Object.entries(byModel).map(([m, b]) => [m, part(b)]));
|
|
1817
|
-
function addUsage(target, delta) {
|
|
1818
|
-
for (const k of TOKEN_FIELDS) target[k] += delta[k];
|
|
1819
|
-
}
|
|
1820
|
-
function usageOf(u) {
|
|
1821
|
-
const cc = u.cache_creation || {};
|
|
1822
|
-
return {
|
|
1823
|
-
input: u.input_tokens || 0,
|
|
1824
|
-
output: u.output_tokens || 0,
|
|
1825
|
-
cacheRead: u.cache_read_input_tokens || 0,
|
|
1826
|
-
cacheCreation: u.cache_creation_input_tokens || 0,
|
|
1827
|
-
cacheCreation5m: cc.ephemeral_5m_input_tokens || 0,
|
|
1828
|
-
cacheCreation1h: cc.ephemeral_1h_input_tokens || 0
|
|
1829
|
-
};
|
|
1830
|
-
}
|
|
1831
1893
|
var CACHE_TTL_MS = {
|
|
1832
1894
|
"5m": 3e5,
|
|
1833
1895
|
"1h": 36e5
|
|
@@ -1964,6 +2026,7 @@ var SessionParser = class {
|
|
|
1964
2026
|
this.typedCommands = /* @__PURE__ */ new Map();
|
|
1965
2027
|
this.appliedById = /* @__PURE__ */ new Map();
|
|
1966
2028
|
this.calls = [];
|
|
2029
|
+
this.advisor = new AdvisorUsage();
|
|
1967
2030
|
this.branchStarted = false;
|
|
1968
2031
|
}
|
|
1969
2032
|
feed(obj) {
|
|
@@ -1997,7 +2060,10 @@ var SessionParser = class {
|
|
|
1997
2060
|
if (inherited != null && ts < this.range.start && ts > meta.continuesFrom) meta.continuesFrom = ts;
|
|
1998
2061
|
if (inherited != null && ts > this.range.end && (meta.continuesTo == null || ts < meta.continuesTo)) meta.continuesTo = ts;
|
|
1999
2062
|
const msg = obj.message;
|
|
2000
|
-
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
|
+
}
|
|
2001
2067
|
return false;
|
|
2002
2068
|
}
|
|
2003
2069
|
obj._ts = ts;
|
|
@@ -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;
|
|
@@ -2101,10 +2168,9 @@ var SessionParser = class {
|
|
|
2101
2168
|
const usage = usageOf(u);
|
|
2102
2169
|
const model = msg.model || "unknown";
|
|
2103
2170
|
const fast = u.speed === "fast";
|
|
2104
|
-
const contextSize = usage.input + usage.cacheRead + usage.cacheCreation;
|
|
2105
2171
|
if (!meta.seenMessageIds.has(msgId)) {
|
|
2106
2172
|
meta.seenMessageIds.add(msgId);
|
|
2107
|
-
this._stampRunningTotals(obj,
|
|
2173
|
+
this._stampRunningTotals(obj, usage.input + usage.cacheRead + usage.cacheCreation, usage.output);
|
|
2108
2174
|
}
|
|
2109
2175
|
if (this.excludeIds?.has(msgId)) return;
|
|
2110
2176
|
if (!this.appliedById.has(msgId)) {
|
|
@@ -2115,7 +2181,7 @@ var SessionParser = class {
|
|
|
2115
2181
|
fast,
|
|
2116
2182
|
usage
|
|
2117
2183
|
});
|
|
2118
|
-
meta.lastContextTokens = contextSize;
|
|
2184
|
+
meta.lastContextTokens = contextSize(u);
|
|
2119
2185
|
meta.contextCompacted = false;
|
|
2120
2186
|
if (u.service_tier) meta.serviceTier = u.service_tier;
|
|
2121
2187
|
if (this.pricing && this.pricing.priceFor(model) == null) meta.priceUnknown = true;
|
|
@@ -2128,7 +2194,17 @@ var SessionParser = class {
|
|
|
2128
2194
|
meta.serverToolUse.webFetch += u.server_tool_use.web_fetch_requests || 0;
|
|
2129
2195
|
}
|
|
2130
2196
|
}
|
|
2131
|
-
|
|
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;
|
|
2132
2208
|
if (TOKEN_FIELDS.every((k) => !growth[k])) return;
|
|
2133
2209
|
const byModel = fast ? meta.tokensByModelFast : meta.tokensByModel;
|
|
2134
2210
|
addUsage(meta.tokens, growth);
|
|
@@ -2176,7 +2252,9 @@ var SessionParser = class {
|
|
|
2176
2252
|
meta.cost = costOf({});
|
|
2177
2253
|
meta.costByType = Object.fromEntries(Object.entries(COST_PARTS).map(([type, part]) => [type, costOf({}, part)]));
|
|
2178
2254
|
const prompt = this.pricing ? promptCosts(this.calls, this.pricing) : null;
|
|
2179
|
-
|
|
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);
|
|
2180
2258
|
return meta;
|
|
2181
2259
|
}
|
|
2182
2260
|
};
|
|
@@ -2520,6 +2598,14 @@ var prices_seed_default = {
|
|
|
2520
2598
|
"cacheWrite1h": 10,
|
|
2521
2599
|
"fastModeMplr": 2
|
|
2522
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
|
+
},
|
|
2523
2609
|
"claude-fable-5-1": {
|
|
2524
2610
|
"input": 10,
|
|
2525
2611
|
"output": 50,
|
|
@@ -2870,16 +2956,19 @@ var SessionsService = class extends EventEmitter {
|
|
|
2870
2956
|
if (start?.length && !loop.includes(start[0])) loop.unshift(...start);
|
|
2871
2957
|
items.sort((a, b) => a._ts - b._ts);
|
|
2872
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));
|
|
2873
2962
|
for (const o of items) {
|
|
2874
2963
|
delete o._ts;
|
|
2875
|
-
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;
|
|
2876
2965
|
}
|
|
2877
2966
|
const mcp = mcpTools.turns(range);
|
|
2878
2967
|
const debugLog = await debugLogOf(reader)?.fillIn(mcp, mcpTools.processStarts()) ?? null;
|
|
2879
2968
|
return {
|
|
2880
2969
|
items,
|
|
2881
2970
|
instructions: {
|
|
2882
|
-
loop,
|
|
2971
|
+
loop: loopStrips,
|
|
2883
2972
|
side,
|
|
2884
2973
|
compacts,
|
|
2885
2974
|
mcp
|
|
@@ -14103,7 +14192,7 @@ var MainWindow = class {
|
|
|
14103
14192
|
// src/main/updater.js
|
|
14104
14193
|
var updater = new NpmUpdater({
|
|
14105
14194
|
name: "claude-discover",
|
|
14106
|
-
version: "1.10.
|
|
14195
|
+
version: "1.10.17",
|
|
14107
14196
|
bin: { "claude-discover": "bin/claude-discover.mjs" }
|
|
14108
14197
|
}, { dev: false });
|
|
14109
14198
|
// src/main/Application.js
|
|
@@ -1497,7 +1497,7 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
|
|
|
1497
1497
|
}
|
|
1498
1498
|
|
|
1499
1499
|
/* What System tells Claude itself: open by default, tinted apart from the folded bookkeeping */
|
|
1500
|
-
.directive {
|
|
1500
|
+
.directive, .advisor {
|
|
1501
1501
|
& :is(.aux-toggle, .aux-label) { color: var(--accent); }
|
|
1502
1502
|
& > .aux-body { border-left-color: var(--accent); }
|
|
1503
1503
|
}
|
|
@@ -1570,7 +1570,7 @@ button.msg-summary:hover { color: var(--text); background: var(--bg-elev-2); bor
|
|
|
1570
1570
|
/* Nested tool rows cancel the aux-body's right padding so their counts line up with the strips'. */
|
|
1571
1571
|
.instruction-file .instruction-file { border-left: none; padding-left: 0; margin-left: 0; margin-right: -8px; }
|
|
1572
1572
|
.aux-body:has(> .instruction-file:first-child) { padding-top: 0; }
|
|
1573
|
-
.instruction-file .aux-toggle, .aux-toggle:has(> .instruction-tokens, > .aux-duration) { display: flex; width: 100%; align-items:
|
|
1573
|
+
.instruction-file .aux-toggle, .aux-toggle:has(> .instruction-tokens, > .aux-duration) { display: flex; width: 100%; align-items: baseline; }
|
|
1574
1574
|
.instruction-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1575
1575
|
.instruction-tokens { margin-left: auto; color: var(--text-faint); white-space: nowrap; }
|
|
1576
1576
|
.aux-duration { margin-left: auto; padding-left: 10px; color: var(--text-faint); white-space: nowrap; }
|