claude-discover 1.10.13 → 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/README.md +2 -1
- package/out/main/main.js +372 -9
- package/out/preload/preload.cjs +1 -0
- package/out/renderer/assets/{index-3_oCekw8.css → index-B0GbqX3Q.css} +234 -45
- package/out/renderer/assets/{index-DvnJGM5F.js → index-DBvvvzOo.js} +2437 -1165
- package/out/renderer/assets/{vendors-C1ZLrYHz.js → vendors-CstdHEvv.js} +752 -616
- package/out/renderer/index.html +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,8 @@ claude-discover
|
|
|
38
38
|
|
|
39
39
|
- **Session preview**
|
|
40
40
|
- **Conversation view**\
|
|
41
|
-
The full transcript rendered like a chat: your prompts, Claude's replies, and every tool call expanded. Everything the terminal scrolled past, now readable at human pace
|
|
41
|
+
The full transcript rendered like a chat: your prompts, Claude's replies, and every tool call expanded. Everything the terminal scrolled past, now readable at human pace.\
|
|
42
|
+
The MCP servers each turn had, how many tools each offered, the calls to them (time and errors), and which failed (and why), needed a login or were still connecting - and for sessions run with `--debug`, which ones it started (stdio), connected to (http) or ran in-process (Agent SDK), how long each took, and a failed one's stderr.
|
|
42
43
|
|
|
43
44
|
- **Raw logs**\
|
|
44
45
|
The same session exactly as Claude Code stores it on disk, one JSON line at a time. For when you don't want the story, you want the evidence.
|
package/out/main/main.js
CHANGED
|
@@ -453,6 +453,9 @@ var CLAUDE_DIR = local.claudeDir || process.env.CLAUDE_CONFIG_DIR || join(homedi
|
|
|
453
453
|
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
|
+
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");
|
|
456
459
|
var STATUSLINE_PATH = join(import.meta.dirname, "../../bin/claude/statusline.mjs");
|
|
457
460
|
var PROXY_PATH = join(import.meta.dirname, "../../bin/proxy.mjs");
|
|
458
461
|
var LAUNCH_MODE = launchMode(import.meta.dirname, { dev: false });
|
|
@@ -1346,7 +1349,8 @@ var RequestParser = class {
|
|
|
1346
1349
|
}));
|
|
1347
1350
|
return this.deferredRoster = {
|
|
1348
1351
|
...toStrip(rec, "message", "Deferred Tools", label, fence(names)),
|
|
1349
|
-
items
|
|
1352
|
+
items,
|
|
1353
|
+
count: names.length
|
|
1350
1354
|
};
|
|
1351
1355
|
}
|
|
1352
1356
|
systemTools(rec) {
|
|
@@ -1366,7 +1370,8 @@ var RequestParser = class {
|
|
|
1366
1370
|
const content = list.map((t) => [`## ${t.name}`, t.content].filter(Boolean).join("\n\n")).join("\n\n");
|
|
1367
1371
|
return {
|
|
1368
1372
|
...toStrip(rec, "tools", file_path, plural(list.length, "tool"), content),
|
|
1369
|
-
items: list
|
|
1373
|
+
items: list,
|
|
1374
|
+
count: list.length
|
|
1370
1375
|
};
|
|
1371
1376
|
};
|
|
1372
1377
|
return [strip("System Tools", (n) => !isMcp(n)), strip("MCP Tools", isMcp)].filter(Boolean);
|
|
@@ -1493,6 +1498,297 @@ var TranscriptInstructions = class {
|
|
|
1493
1498
|
}));
|
|
1494
1499
|
}
|
|
1495
1500
|
};
|
|
1501
|
+
// src/main/sessions/McpTools.js
|
|
1502
|
+
var server = (name) => /^mcp__(.+?)__/.exec(name)?.[1] ?? null;
|
|
1503
|
+
var toolOf = (key, name) => name.slice(`mcp__${key}__`.length);
|
|
1504
|
+
var toolPrefix = (name) => name.replace(/[^\w-]/g, "_");
|
|
1505
|
+
var connected = (s) => s.status === "connected";
|
|
1506
|
+
var serverRow = (fields) => ({
|
|
1507
|
+
transport: null,
|
|
1508
|
+
version: null,
|
|
1509
|
+
cached: false,
|
|
1510
|
+
ms: null,
|
|
1511
|
+
readyWithin: null,
|
|
1512
|
+
error: null,
|
|
1513
|
+
stderr: [],
|
|
1514
|
+
toolCount: null,
|
|
1515
|
+
groups: [],
|
|
1516
|
+
tools: [],
|
|
1517
|
+
...fields
|
|
1518
|
+
});
|
|
1519
|
+
var mounted = (key, names) => {
|
|
1520
|
+
const groups = Object.entries(Object.groupBy(names, (n) => toolOf(key, n).split("_")[0])).map(([name, list]) => ({
|
|
1521
|
+
name,
|
|
1522
|
+
toolCount: list.length
|
|
1523
|
+
}));
|
|
1524
|
+
return groups.length >= 2 && groups.length ** 2 <= names.length ? groups.sort((a, b) => a.name.localeCompare(b.name)) : [];
|
|
1525
|
+
};
|
|
1526
|
+
var McpTools = class {
|
|
1527
|
+
#shapes = /* @__PURE__ */ new Map();
|
|
1528
|
+
#deferred = /* @__PURE__ */ new Set();
|
|
1529
|
+
#status = [];
|
|
1530
|
+
#names = /* @__PURE__ */ new Map();
|
|
1531
|
+
#requests = [];
|
|
1532
|
+
#calls = /* @__PURE__ */ new Map();
|
|
1533
|
+
feed(obj) {
|
|
1534
|
+
const att = obj.type === "attachment" ? obj.attachment : null;
|
|
1535
|
+
const content = Array.isArray(obj.message?.content) ? obj.message.content : [];
|
|
1536
|
+
if (obj.type === "api-request-shape") this.#shapes.set(obj.shapeHash, (obj.shape?.tools ?? []).map((t) => t.name).filter(server));
|
|
1537
|
+
else if (att?.type === "deferred_tools_delta") {
|
|
1538
|
+
for (const name of att.addedNames ?? []) if (server(name)) this.#deferred.add(name);
|
|
1539
|
+
for (const name of att.removedNames ?? []) this.#deferred.delete(name);
|
|
1540
|
+
this.#status = [
|
|
1541
|
+
...(att.failedMcpServers ?? []).map((f) => this.#named(f.name, "failed", f.errorCode ? `${f.errorCode}: ${f.error}` : f.error ?? null)),
|
|
1542
|
+
...(att.needsAuthMcpServers ?? []).map((name) => this.#named(name, "needs-auth")),
|
|
1543
|
+
...(att.pendingMcpServers ?? []).map((name) => this.#named(name, "pending"))
|
|
1544
|
+
];
|
|
1545
|
+
} else if (att?.type === "mcp_instructions_delta") for (const name of att.addedNames ?? []) this.#names.set(toolPrefix(name), name);
|
|
1546
|
+
else if (obj.type === "api-request") {
|
|
1547
|
+
const tools = Object.groupBy(/* @__PURE__ */ new Set([...this.#shapes.get(obj.shapeHash) ?? [], ...this.#deferred]), server);
|
|
1548
|
+
const servers = [...Object.entries(tools).map(([key, names]) => ({
|
|
1549
|
+
key,
|
|
1550
|
+
status: "connected",
|
|
1551
|
+
error: null,
|
|
1552
|
+
names
|
|
1553
|
+
})), ...this.#status.filter((s) => !tools[s.key])];
|
|
1554
|
+
this.#requests.push({
|
|
1555
|
+
ts: Date.parse(obj.timestamp),
|
|
1556
|
+
servers: servers.sort((a, b) => a.key.localeCompare(b.key)),
|
|
1557
|
+
fresh: !obj.base
|
|
1558
|
+
});
|
|
1559
|
+
} else if (obj.type === "assistant") for (const c of content) {
|
|
1560
|
+
const key = c.type === "tool_use" && server(c.name);
|
|
1561
|
+
if (key) this.#calls.set(c.id, {
|
|
1562
|
+
key,
|
|
1563
|
+
name: toolOf(key, c.name),
|
|
1564
|
+
ts: Date.parse(obj.timestamp),
|
|
1565
|
+
ms: null,
|
|
1566
|
+
error: null
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
else if (obj.type === "user") for (const c of content) {
|
|
1570
|
+
const call = c.type === "tool_result" && this.#calls.get(c.tool_use_id);
|
|
1571
|
+
if (call) Object.assign(call, {
|
|
1572
|
+
ms: Date.parse(obj.timestamp) - call.ts,
|
|
1573
|
+
error: c.is_error ? texts(c.content).join("\n") || "failed" : null
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
#named(name, status, error = null) {
|
|
1578
|
+
this.#names.set(toolPrefix(name), name);
|
|
1579
|
+
return {
|
|
1580
|
+
key: toolPrefix(name),
|
|
1581
|
+
status,
|
|
1582
|
+
error
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
processStarts() {
|
|
1586
|
+
return this.#requests.filter((r) => r.fresh).map((r) => r.ts);
|
|
1587
|
+
}
|
|
1588
|
+
turns(range = null) {
|
|
1589
|
+
const turns = [];
|
|
1590
|
+
const pending = /* @__PURE__ */ new Map();
|
|
1591
|
+
let last = [];
|
|
1592
|
+
for (const r of this.#requests) {
|
|
1593
|
+
if (!r.servers.length || !inRange(new Date(r.ts).toISOString(), range)) continue;
|
|
1594
|
+
if (r.fresh) {
|
|
1595
|
+
last = [];
|
|
1596
|
+
pending.clear();
|
|
1597
|
+
}
|
|
1598
|
+
if (last.some(connected) && !r.servers.some(connected)) continue;
|
|
1599
|
+
const before = new Map(last.map((s) => [s.key, s]));
|
|
1600
|
+
const changed = r.servers.filter((s) => before.get(s.key)?.status !== s.status || before.get(s.key).error !== s.error);
|
|
1601
|
+
const removed = last.filter((s) => !r.servers.some((n) => n.key === s.key));
|
|
1602
|
+
if (!changed.length && !removed.length) continue;
|
|
1603
|
+
const row = (s) => {
|
|
1604
|
+
const readyWithin = connected(s) && pending.has(s.key) ? r.ts - pending.get(s.key) : null;
|
|
1605
|
+
if (s.status === "pending") pending.set(s.key, r.ts);
|
|
1606
|
+
else pending.delete(s.key);
|
|
1607
|
+
return serverRow({
|
|
1608
|
+
name: this.#names.get(s.key) ?? s.key,
|
|
1609
|
+
status: s.status,
|
|
1610
|
+
readyWithin,
|
|
1611
|
+
error: s.error,
|
|
1612
|
+
toolCount: s.names?.length ?? null,
|
|
1613
|
+
groups: s.names ? mounted(s.key, s.names) : []
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1616
|
+
turns.push({
|
|
1617
|
+
startedAt: new Date(r.ts).toISOString(),
|
|
1618
|
+
debug: false,
|
|
1619
|
+
change: last.length > 0,
|
|
1620
|
+
servers: [...changed.map(row), ...removed.map((s) => row({
|
|
1621
|
+
...s,
|
|
1622
|
+
status: "removed",
|
|
1623
|
+
error: null,
|
|
1624
|
+
names: null
|
|
1625
|
+
}))]
|
|
1626
|
+
});
|
|
1627
|
+
last = r.servers;
|
|
1628
|
+
}
|
|
1629
|
+
for (const call of this.#calls.values()) {
|
|
1630
|
+
if (!inRange(new Date(call.ts).toISOString(), range)) continue;
|
|
1631
|
+
const owner = (s) => toolPrefix(s.name) === call.key && connected(s);
|
|
1632
|
+
turns.findLast((t) => Date.parse(t.startedAt) <= call.ts && t.servers.some(owner))?.servers.find(owner).tools.push({
|
|
1633
|
+
name: call.name,
|
|
1634
|
+
ms: call.ms,
|
|
1635
|
+
error: call.error
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
return turns;
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
// src/main/sessions/McpDebugLog.js
|
|
1642
|
+
var LINE = /^(\S+) \[\w+\] (.*)$/;
|
|
1643
|
+
var SERVER = /^MCP server "([^"]+)":? ([\s\S]*)$/;
|
|
1644
|
+
var PROCESS = /^mcp runtime arm\b/;
|
|
1645
|
+
var TIMESTAMP = /^\d{4}-\d\d-\d\dT/;
|
|
1646
|
+
var unquote = (text) => {
|
|
1647
|
+
if (!text.startsWith("\"")) return text;
|
|
1648
|
+
try {
|
|
1649
|
+
return JSON.parse(text);
|
|
1650
|
+
} catch {
|
|
1651
|
+
return text;
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
var McpDebugLog = class {
|
|
1655
|
+
constructor(sessionId, { dir = CLAUDE_DEBUG_DIR } = {}) {
|
|
1656
|
+
this.filePath = join(dir, `${sessionId}.txt`);
|
|
1657
|
+
}
|
|
1658
|
+
exists() {
|
|
1659
|
+
return fsp.access(this.filePath).then(() => true, () => false);
|
|
1660
|
+
}
|
|
1661
|
+
async fillIn(turns, processStarts) {
|
|
1662
|
+
const text = await fsp.readFile(this.filePath, "utf8").catch(() => null);
|
|
1663
|
+
if (text === null) return null;
|
|
1664
|
+
fillTurns(turns, parseMcpLog(text), processStarts);
|
|
1665
|
+
return this.filePath;
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
function fillTurns(turns, processes, starts) {
|
|
1669
|
+
const processOf = (turn) => starts.findLast((ts) => ts <= Date.parse(turn.startedAt));
|
|
1670
|
+
processes.forEach((p, i) => {
|
|
1671
|
+
const end = processes[i + 1] ? Date.parse(processes[i + 1].startedAt) : Infinity;
|
|
1672
|
+
const first = starts.find((ts) => ts >= Date.parse(p.startedAt) && ts < end);
|
|
1673
|
+
const own = first === void 0 ? [] : turns.filter((t) => processOf(t) === first);
|
|
1674
|
+
if (own.length) fillProcess(own, p.servers);
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
function fillProcess(turns, logged) {
|
|
1678
|
+
const rows = turns.flatMap((t) => t.servers);
|
|
1679
|
+
for (const t of turns) t.debug = true;
|
|
1680
|
+
for (const log of logged) {
|
|
1681
|
+
const own = rows.filter((s) => toolPrefix(s.name) === toolPrefix(log.name));
|
|
1682
|
+
if (!own.length) {
|
|
1683
|
+
if (!turns[0].change) turns[0].servers.push(log);
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1686
|
+
for (const row of own) {
|
|
1687
|
+
Object.assign(row, {
|
|
1688
|
+
name: log.name,
|
|
1689
|
+
transport: log.transport,
|
|
1690
|
+
version: log.version,
|
|
1691
|
+
cached: log.cached
|
|
1692
|
+
});
|
|
1693
|
+
if (row.status === log.status) Object.assign(row, {
|
|
1694
|
+
ms: log.ms,
|
|
1695
|
+
readyWithin: null,
|
|
1696
|
+
error: row.error ?? log.error,
|
|
1697
|
+
stderr: log.stderr
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
const calls = own.flatMap((row) => row.tools);
|
|
1701
|
+
for (const call of log.tools) {
|
|
1702
|
+
const i = calls.findIndex((c) => c.name === call.name);
|
|
1703
|
+
if (i === -1) own.find((row) => row.status === "connected")?.tools.push({ ...call });
|
|
1704
|
+
else {
|
|
1705
|
+
const matched = calls.splice(i, 1)[0];
|
|
1706
|
+
Object.assign(matched, {
|
|
1707
|
+
ms: call.ms ?? matched.ms,
|
|
1708
|
+
error: call.error ?? matched.error
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
for (const row of rows) if (row.status === "connected" && row.transport === null) row.transport = "sdk";
|
|
1714
|
+
}
|
|
1715
|
+
function parseMcpLog(text) {
|
|
1716
|
+
const processes = [];
|
|
1717
|
+
const open = (startedAt) => processes.push({
|
|
1718
|
+
startedAt,
|
|
1719
|
+
servers: []
|
|
1720
|
+
});
|
|
1721
|
+
const latest = /* @__PURE__ */ new Map();
|
|
1722
|
+
const transports = /* @__PURE__ */ new Map();
|
|
1723
|
+
let stderr = null;
|
|
1724
|
+
for (const line of text.split(/\r?\n/)) {
|
|
1725
|
+
if (stderr && line && !TIMESTAMP.test(line)) {
|
|
1726
|
+
stderr.push(line);
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
stderr = null;
|
|
1730
|
+
const l = LINE.exec(line);
|
|
1731
|
+
if (!l) continue;
|
|
1732
|
+
const [, timestamp, text] = l;
|
|
1733
|
+
if (PROCESS.test(text)) {
|
|
1734
|
+
open(timestamp);
|
|
1735
|
+
continue;
|
|
1736
|
+
}
|
|
1737
|
+
const m = SERVER.exec(unquote(text));
|
|
1738
|
+
if (!m) continue;
|
|
1739
|
+
const [, name, msg] = m;
|
|
1740
|
+
let r;
|
|
1741
|
+
if (msg.startsWith("Starting connection")) {
|
|
1742
|
+
if (!processes.length || processes.at(-1).servers.some((s) => s.name === name)) open(timestamp);
|
|
1743
|
+
const conn = serverRow({
|
|
1744
|
+
name,
|
|
1745
|
+
transport: transports.get(name) ?? null,
|
|
1746
|
+
status: "connecting"
|
|
1747
|
+
});
|
|
1748
|
+
transports.delete(name);
|
|
1749
|
+
processes.at(-1).servers.push(conn);
|
|
1750
|
+
latest.set(name, conn);
|
|
1751
|
+
continue;
|
|
1752
|
+
}
|
|
1753
|
+
if (r = /^Initializing (\w+) transport/.exec(msg)) {
|
|
1754
|
+
transports.set(name, r[1].toLowerCase());
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
const conn = latest.get(name);
|
|
1758
|
+
if (!conn) continue;
|
|
1759
|
+
if (r = /^Successfully connected \(transport: ([\w-]+)\) in (\d+)ms/.exec(msg)) Object.assign(conn, {
|
|
1760
|
+
status: "connected",
|
|
1761
|
+
transport: r[1],
|
|
1762
|
+
ms: +r[2]
|
|
1763
|
+
});
|
|
1764
|
+
else if (r = /^Connection established with capabilities: .*"serverVersion":\{.*?"version":"([^"]*?)(\+cached)?"/.exec(msg)) Object.assign(conn, {
|
|
1765
|
+
version: r[1],
|
|
1766
|
+
cached: !!r[2]
|
|
1767
|
+
});
|
|
1768
|
+
else if (r = /^Connection failed after (\d+)ms[^(:]*(?:\(([^)]+)\))?:?\s*(.*)/.exec(msg)) Object.assign(conn, {
|
|
1769
|
+
status: "failed",
|
|
1770
|
+
ms: +r[1],
|
|
1771
|
+
error: [r[2], r[3]].filter(Boolean).join(": ")
|
|
1772
|
+
});
|
|
1773
|
+
else if (r = /^Server stderr: (.*)/.exec(msg)) {
|
|
1774
|
+
conn.transport ??= "stdio";
|
|
1775
|
+
conn.stderr.push(r[1]);
|
|
1776
|
+
stderr = conn.stderr;
|
|
1777
|
+
} else if (r = /^Calling MCP tool: (.+)/.exec(msg)) conn.tools.push({
|
|
1778
|
+
name: r[1],
|
|
1779
|
+
ms: null,
|
|
1780
|
+
error: null
|
|
1781
|
+
});
|
|
1782
|
+
else if (r = /^Tool '(.+)' (?:completed successfully in|failed after) ([\d.]+)(ms|s)(?:: ([\s\S]*))?/.exec(msg)) {
|
|
1783
|
+
const call = conn.tools.find((t) => t.name === r[1] && t.ms === null);
|
|
1784
|
+
if (call) Object.assign(call, {
|
|
1785
|
+
ms: r[3] === "s" ? Math.round(r[2] * 1e3) : +r[2],
|
|
1786
|
+
error: msg.includes(" failed ") ? r[4] ?? "failed" : null
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
return processes;
|
|
1791
|
+
}
|
|
1496
1792
|
// src/main/sessions/SessionParser.js
|
|
1497
1793
|
var ACTIVITY_GAP_MS = 3e5;
|
|
1498
1794
|
var TOKEN_FIELDS = [
|
|
@@ -1589,6 +1885,7 @@ function classifySource(meta) {
|
|
|
1589
1885
|
if (meta.hasScheduledTask) return "scheduled";
|
|
1590
1886
|
return (meta.entrypoint || "").toLowerCase() || "other";
|
|
1591
1887
|
}
|
|
1888
|
+
var experimentId = (atis) => atis.match(/^v1\.([0-9a-f]+)\./)?.[1] ?? atis;
|
|
1592
1889
|
function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileSize, mtime }) {
|
|
1593
1890
|
return {
|
|
1594
1891
|
sessionId,
|
|
@@ -1606,6 +1903,7 @@ function freshMeta({ sessionId, parentSessionId, filePath, parentFilePath, fileS
|
|
|
1606
1903
|
customTitle: null,
|
|
1607
1904
|
agentName: null,
|
|
1608
1905
|
tag: null,
|
|
1906
|
+
experiment: null,
|
|
1609
1907
|
forkedFrom: null,
|
|
1610
1908
|
forkedAt: null,
|
|
1611
1909
|
...freshMetrics()
|
|
@@ -1684,6 +1982,7 @@ var SessionParser = class {
|
|
|
1684
1982
|
if (t === "custom-title" && obj.customTitle) meta.customTitle = obj.customTitle;
|
|
1685
1983
|
if (t === "agent-name" && obj.agentName) meta.agentName = obj.agentName;
|
|
1686
1984
|
if (t === "tag") meta.tag = obj.tag || null;
|
|
1985
|
+
if (t === "atis-latch" && obj.atis) meta.experiment = experimentId(obj.atis);
|
|
1687
1986
|
if (t === "queue-operation" && obj.content?.includes("<scheduled-task")) meta.hasScheduledTask = true;
|
|
1688
1987
|
if (t === "started" && obj.key && obj.agentId) meta.workflowAgents += 1;
|
|
1689
1988
|
if (t === "attachment" && obj.attachment?.type === "model") this.modelId = obj.attachment.identity?.modelId;
|
|
@@ -2153,6 +2452,55 @@ var MetaCache = class {
|
|
|
2153
2452
|
return this.periodMetas.delete(filePath);
|
|
2154
2453
|
}
|
|
2155
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)}`;
|
|
2156
2504
|
// src/main/sessions/ProjectResolver.js
|
|
2157
2505
|
var WORKTREE = /\/\.claude\/worktrees\/([^/]+)/;
|
|
2158
2506
|
var TEMP_ROOT = /^(.*?\/AppData\/Local\/Temp|\/(?:private\/)?(?:tmp|var\/folders\/[^/]+\/[^/]+\/T))\/(.+)/i;
|
|
@@ -2512,6 +2860,8 @@ function intersectsDay(meta, day) {
|
|
|
2512
2860
|
function stripInternal({ seenMessageIds, ...meta }) {
|
|
2513
2861
|
return meta;
|
|
2514
2862
|
}
|
|
2863
|
+
var isSafeId = (id) => /^[\w-]+$/.test(id);
|
|
2864
|
+
var debugLogOf = (reader) => reader.parentSessionId || !isSafeId(reader.sessionId) ? null : new McpDebugLog(reader.sessionId);
|
|
2515
2865
|
var SessionsService = class extends EventEmitter {
|
|
2516
2866
|
#branch = null;
|
|
2517
2867
|
constructor({ root, throttleMs = 100, scanner = null } = {}) {
|
|
@@ -2521,6 +2871,7 @@ var SessionsService = class extends EventEmitter {
|
|
|
2521
2871
|
this.throttleMs = throttleMs;
|
|
2522
2872
|
this.metaCache = new MetaCache();
|
|
2523
2873
|
this.projects = new ProjectResolver();
|
|
2874
|
+
this.experiments = new Experiments();
|
|
2524
2875
|
this.activeDay = null;
|
|
2525
2876
|
this.scanAbort = null;
|
|
2526
2877
|
this.updateTimer = null;
|
|
@@ -2545,9 +2896,11 @@ var SessionsService = class extends EventEmitter {
|
|
|
2545
2896
|
const source = await this.#branchSource(meta);
|
|
2546
2897
|
const items = [];
|
|
2547
2898
|
const transcript = new TranscriptInstructions();
|
|
2899
|
+
const mcpTools = new McpTools();
|
|
2548
2900
|
const loop = [];
|
|
2549
2901
|
let start = null;
|
|
2550
2902
|
const feed = (obj, shown) => {
|
|
2903
|
+
mcpTools.feed(obj);
|
|
2551
2904
|
const strips = transcript.feed(obj);
|
|
2552
2905
|
if (obj.type === "api-request") start ??= strips;
|
|
2553
2906
|
if (shown) loop.push(...strips);
|
|
@@ -2568,14 +2921,18 @@ var SessionsService = class extends EventEmitter {
|
|
|
2568
2921
|
delete o._ts;
|
|
2569
2922
|
if (o.type === "attachment" && TranscriptInstructions.listed(o, keys)) o._listed = true;
|
|
2570
2923
|
}
|
|
2924
|
+
const mcp = mcpTools.turns(range);
|
|
2925
|
+
const debugLog = await debugLogOf(reader)?.fillIn(mcp, mcpTools.processStarts()) ?? null;
|
|
2571
2926
|
return {
|
|
2572
2927
|
items,
|
|
2573
2928
|
instructions: {
|
|
2574
2929
|
loop,
|
|
2575
2930
|
side,
|
|
2576
|
-
compacts
|
|
2931
|
+
compacts,
|
|
2932
|
+
mcp
|
|
2577
2933
|
},
|
|
2578
|
-
requestLog: await requests.exists() ? requests.filePath : null
|
|
2934
|
+
requestLog: await requests.exists() ? requests.filePath : null,
|
|
2935
|
+
debugLog
|
|
2579
2936
|
};
|
|
2580
2937
|
}
|
|
2581
2938
|
#branchSource({ filePath, forkedFrom, forkedAt }) {
|
|
@@ -2607,7 +2964,7 @@ var SessionsService = class extends EventEmitter {
|
|
|
2607
2964
|
}
|
|
2608
2965
|
async readRequests(filePath, date = null, granularity = "day") {
|
|
2609
2966
|
const meta = this.metaCache.get(filePath);
|
|
2610
|
-
if (!meta ||
|
|
2967
|
+
if (!meta || !isSafeId(meta.sessionId)) return [];
|
|
2611
2968
|
const range = date ? periodBounds(date, granularity) : null;
|
|
2612
2969
|
const own = await this.#requestFile(meta.sessionId, meta.parentSessionId).read(range);
|
|
2613
2970
|
const span = {
|
|
@@ -2698,14 +3055,18 @@ var SessionsService = class extends EventEmitter {
|
|
|
2698
3055
|
});
|
|
2699
3056
|
await reader.stream((obj) => parser.feed(obj));
|
|
2700
3057
|
const meta = parser.finalize(stat.mtimeMs);
|
|
2701
|
-
const [project, avatar, agent] = await Promise.all([
|
|
3058
|
+
const [project, avatar, agent, debug = false] = await Promise.all([
|
|
2702
3059
|
this.projects.resolve(meta.project),
|
|
2703
3060
|
this.projects.avatar(meta.project),
|
|
2704
|
-
reader.agentMeta()
|
|
3061
|
+
reader.agentMeta(),
|
|
3062
|
+
debugLogOf(reader)?.exists()
|
|
2705
3063
|
]);
|
|
2706
3064
|
meta.agentName ??= agent?.name ?? agent?.agentType ?? null;
|
|
2707
3065
|
meta.agentDescription = agent?.description ?? null;
|
|
2708
|
-
return Object.assign(meta, project, {
|
|
3066
|
+
return Object.assign(meta, project, {
|
|
3067
|
+
avatar,
|
|
3068
|
+
debug
|
|
3069
|
+
});
|
|
2709
3070
|
}
|
|
2710
3071
|
async _dedupSessions(metas, range) {
|
|
2711
3072
|
const sorted = [...metas].sort((a, b) => a.startedAt - b.startedAt);
|
|
@@ -2731,6 +3092,7 @@ var SessionsService = class extends EventEmitter {
|
|
|
2731
3092
|
}));
|
|
2732
3093
|
const labels = suffixLabels(sessions.map((m) => m.project));
|
|
2733
3094
|
for (const m of sessions) m.projectShort = m.tempPath ? "Temp" : labels.get(m.project);
|
|
3095
|
+
await this.experiments.name(sessions);
|
|
2734
3096
|
return sessions;
|
|
2735
3097
|
}
|
|
2736
3098
|
_dedupedDay(day) {
|
|
@@ -13777,7 +14139,7 @@ var MainWindow = class {
|
|
|
13777
14139
|
// src/main/updater.js
|
|
13778
14140
|
var updater = new NpmUpdater({
|
|
13779
14141
|
name: "claude-discover",
|
|
13780
|
-
version: "1.10.
|
|
14142
|
+
version: "1.10.15",
|
|
13781
14143
|
bin: { "claude-discover": "bin/claude-discover.mjs" }
|
|
13782
14144
|
}, { dev: false });
|
|
13783
14145
|
// src/main/Application.js
|
|
@@ -13803,6 +14165,7 @@ var Application = class {
|
|
|
13803
14165
|
});
|
|
13804
14166
|
ipcMain.handle("sessions:list", (_e, date, granularity) => sessionsService.list(date, granularity));
|
|
13805
14167
|
ipcMain.handle("sessions:read", (_e, filePath, date, granularity) => sessionsService.readSession(filePath, date, granularity));
|
|
14168
|
+
ipcMain.handle("experiments:read", () => sessionsService.experiments.read());
|
|
13806
14169
|
ipcMain.handle("sessions:read-requests", (_e, filePath, date, granularity) => sessionsService.readRequests(filePath, date, granularity));
|
|
13807
14170
|
ipcMain.handle("sessions:read-avatar", (_e, filePath) => webpDataUrl(sessionsService.avatarPath(filePath)));
|
|
13808
14171
|
ipcMain.handle("switch:status", (_e, name) => switchers.status(name));
|
package/out/preload/preload.cjs
CHANGED
|
@@ -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"),
|