fleetlens 0.12.0 → 0.12.2
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/app/apps/web/.next/BUILD_ID +1 -1
- package/app/apps/web/.next/build-manifest.json +3 -3
- package/app/apps/web/.next/prerender-manifest.json +3 -3
- package/app/apps/web/.next/server/app/_global-error.html +1 -1
- package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/apps/web/.next/server/app/_not-found/page.js +2 -1
- package/app/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/api/ask/route.js +1 -1
- package/app/apps/web/.next/server/app/api/ask/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js +1 -1
- package/app/apps/web/.next/server/app/api/digest/day/[date]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js +1 -1
- package/app/apps/web/.next/server/app/api/digest/month/[yearMonth]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/month-index/route.js +1 -1
- package/app/apps/web/.next/server/app/api/digest/month-index/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js +1 -1
- package/app/apps/web/.next/server/app/api/digest/week/[startDate]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/digest/week-index/route.js +1 -1
- package/app/apps/web/.next/server/app/api/digest/week-index/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/events/route.js +1 -1
- package/app/apps/web/.next/server/app/api/events/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/jobs/route.js +1 -1
- package/app/apps/web/.next/server/app/api/jobs/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/pdf/[key]/route.js +1 -1
- package/app/apps/web/.next/server/app/api/pdf/[key]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/route.js +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js +1 -1
- package/app/apps/web/.next/server/app/api/runs/[runId]/stream/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/runs/route.js +1 -1
- package/app/apps/web/.next/server/app/api/runs/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/settings/route.js +1 -1
- package/app/apps/web/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/team-config/route.js +1 -1
- package/app/apps/web/.next/server/app/api/team-config/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/api/workflow-agent/route.js +1 -1
- package/app/apps/web/.next/server/app/api/workflow-agent/route.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/changelog/page.js +2 -1
- package/app/apps/web/.next/server/app/changelog/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page.js +2 -1
- package/app/apps/web/.next/server/app/day/[date]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/day/page.js +2 -1
- package/app/apps/web/.next/server/app/day/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page.js +2 -1
- package/app/apps/web/.next/server/app/digest/[date]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/digest/page.js +2 -1
- package/app/apps/web/.next/server/app/digest/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page.js +2 -1
- package/app/apps/web/.next/server/app/insights/[key]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/insights/page.js +2 -1
- package/app/apps/web/.next/server/app/insights/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/page.js +2 -1
- package/app/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/parallelism/page.js +2 -1
- package/app/apps/web/.next/server/app/parallelism/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page.js +2 -1
- package/app/apps/web/.next/server/app/print/[key]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page.js +2 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/projects/page.js +2 -1
- package/app/apps/web/.next/server/app/projects/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/runs/page.js +2 -1
- package/app/apps/web/.next/server/app/runs/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page.js +2 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/sessions/page.js +2 -1
- package/app/apps/web/.next/server/app/sessions/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/settings/page.js +2 -1
- package/app/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/team/page.js +2 -1
- package/app/apps/web/.next/server/app/team/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/app/usage/page.js +2 -1
- package/app/apps/web/.next/server/app/usage/page.js.nft.json +1 -1
- package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +3 -0
- package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0n-ax-5._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/_0xu2pvc._.js +1 -1
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0k0tl52._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +3 -0
- package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_12.endt._.js +1 -1
- package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/app/apps/web/.next/server/middleware-manifest.json +5 -5
- package/app/apps/web/.next/server/pages/500.html +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/app/apps/web/.next/static/chunks/0a~ro-n30brjy.js +1 -0
- package/app/apps/web/app/projects/[slug]/page.tsx +3 -4
- package/app/apps/web/lib/changelog-data.generated.ts +1 -1
- package/app/apps/web/package.json +1 -1
- package/app/apps/web/tsconfig.tsbuildinfo +1 -1
- package/dist/daemon-worker.js +127 -32
- package/dist/index.js +205 -77
- package/package.json +1 -1
- package/app/apps/web/.next/server/chunks/packages_parser_dist_04rh1zd._.js +0 -3
- package/app/apps/web/.next/server/chunks/packages_parser_dist_0ndsxe6._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__03y~03u._.js +0 -3
- package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_0af94gl._.js +0 -3
- package/app/apps/web/.next/static/chunks/0ck03i0l4zeun.js +0 -1
- /package/app/apps/web/.next/static/{WH20Ct_NdpZTKsqI_yquG → NVjCMw2mlLqMATkilYzT7}/_buildManifest.js +0 -0
- /package/app/apps/web/.next/static/{WH20Ct_NdpZTKsqI_yquG → NVjCMw2mlLqMATkilYzT7}/_clientMiddlewareManifest.js +0 -0
- /package/app/apps/web/.next/static/{WH20Ct_NdpZTKsqI_yquG → NVjCMw2mlLqMATkilYzT7}/_ssgManifest.js +0 -0
package/dist/daemon-worker.js
CHANGED
|
@@ -159,7 +159,19 @@ function dailyActivity(sessions) {
|
|
|
159
159
|
};
|
|
160
160
|
for (const s of sessions) {
|
|
161
161
|
const startDay = sessionDay(s);
|
|
162
|
-
if (
|
|
162
|
+
if (s.dailyBreakdown && s.dailyBreakdown.length > 0) {
|
|
163
|
+
for (const d of s.dailyBreakdown) {
|
|
164
|
+
const bucket = touchBucket(d.day);
|
|
165
|
+
bucket.toolCalls += d.toolCalls;
|
|
166
|
+
bucket.turns += d.turns;
|
|
167
|
+
bucket.tokens.input += d.tokens.input;
|
|
168
|
+
bucket.tokens.output += d.tokens.output;
|
|
169
|
+
bucket.tokens.cacheRead += d.tokens.cacheRead;
|
|
170
|
+
bucket.tokens.cacheWrite += d.tokens.cacheWrite;
|
|
171
|
+
}
|
|
172
|
+
if (startDay)
|
|
173
|
+
touchBucket(startDay).durationMs += s.durationMs ?? 0;
|
|
174
|
+
} else if (startDay) {
|
|
163
175
|
const bucket = touchBucket(startDay);
|
|
164
176
|
bucket.toolCalls += s.toolCallCount ?? 0;
|
|
165
177
|
bucket.turns += s.turnCount ?? 0;
|
|
@@ -169,31 +181,30 @@ function dailyActivity(sessions) {
|
|
|
169
181
|
bucket.tokens.cacheWrite += s.totalUsage.cacheWrite;
|
|
170
182
|
bucket.durationMs += s.durationMs ?? 0;
|
|
171
183
|
}
|
|
184
|
+
const presenceDays = /* @__PURE__ */ new Set();
|
|
172
185
|
const segments = s.activeSegments;
|
|
173
186
|
if (segments && segments.length > 0) {
|
|
174
|
-
const touchedDays = /* @__PURE__ */ new Set();
|
|
175
187
|
for (const seg of segments) {
|
|
176
188
|
let cur = seg.startMs;
|
|
177
189
|
while (cur < seg.endMs) {
|
|
178
190
|
const day = toLocalDay(cur);
|
|
179
|
-
|
|
191
|
+
presenceDays.add(day);
|
|
180
192
|
const d = new Date(cur);
|
|
181
193
|
d.setHours(24, 0, 0, 0);
|
|
182
194
|
const dayEndMs = Math.min(d.getTime(), seg.endMs);
|
|
183
|
-
|
|
184
|
-
bucket.airTimeMs += dayEndMs - cur;
|
|
195
|
+
touchBucket(day).airTimeMs += dayEndMs - cur;
|
|
185
196
|
cur = dayEndMs;
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
|
-
for (const day of touchedDays) {
|
|
189
|
-
const bucket = touchBucket(day);
|
|
190
|
-
bucket.sessions++;
|
|
191
|
-
}
|
|
192
199
|
} else if (startDay) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
bucket.airTimeMs += s.airTimeMs ?? 0;
|
|
200
|
+
presenceDays.add(startDay);
|
|
201
|
+
touchBucket(startDay).airTimeMs += s.airTimeMs ?? 0;
|
|
196
202
|
}
|
|
203
|
+
if (s.dailyBreakdown)
|
|
204
|
+
for (const d of s.dailyBreakdown)
|
|
205
|
+
presenceDays.add(d.day);
|
|
206
|
+
for (const day of presenceDays)
|
|
207
|
+
touchBucket(day).sessions++;
|
|
197
208
|
}
|
|
198
209
|
const range = minDay && maxDay ? daysBetween(minDay, maxDay) : [];
|
|
199
210
|
const out = [];
|
|
@@ -1238,9 +1249,31 @@ function parseTranscript(rawLines) {
|
|
|
1238
1249
|
let linesAdded = 0;
|
|
1239
1250
|
let linesRemoved = 0;
|
|
1240
1251
|
const filesEdited = /* @__PURE__ */ new Set();
|
|
1252
|
+
const perDay = /* @__PURE__ */ new Map();
|
|
1253
|
+
const fallbackDay = startMs !== void 0 ? toLocalDay(startMs) : void 0;
|
|
1254
|
+
const dayBucket = (ts) => {
|
|
1255
|
+
let day;
|
|
1256
|
+
if (ts) {
|
|
1257
|
+
const ms = Date.parse(ts);
|
|
1258
|
+
if (!Number.isNaN(ms))
|
|
1259
|
+
day = toLocalDay(ms);
|
|
1260
|
+
}
|
|
1261
|
+
day = day ?? fallbackDay;
|
|
1262
|
+
if (!day)
|
|
1263
|
+
return void 0;
|
|
1264
|
+
let b = perDay.get(day);
|
|
1265
|
+
if (!b) {
|
|
1266
|
+
b = { toolCalls: 0, turns: 0, tokens: { ...BLANK_USAGE2 } };
|
|
1267
|
+
perDay.set(day, b);
|
|
1268
|
+
}
|
|
1269
|
+
return b;
|
|
1270
|
+
};
|
|
1241
1271
|
for (const e of events) {
|
|
1242
1272
|
if (e.role === "tool-call") {
|
|
1243
1273
|
toolCallCount++;
|
|
1274
|
+
const tcDay = dayBucket(e.timestamp);
|
|
1275
|
+
if (tcDay)
|
|
1276
|
+
tcDay.toolCalls++;
|
|
1244
1277
|
const toolBlock = e.blocks.find((b) => b && b.type === "tool_use");
|
|
1245
1278
|
if (toolBlock) {
|
|
1246
1279
|
const input = toolBlock.input ?? {};
|
|
@@ -1277,6 +1310,9 @@ function parseTranscript(rawLines) {
|
|
|
1277
1310
|
firstUserPreview = e.teammateMessage ? e.teammateMessage.body : e.preview;
|
|
1278
1311
|
}
|
|
1279
1312
|
turnCount++;
|
|
1313
|
+
const turnDay = dayBucket(e.timestamp);
|
|
1314
|
+
if (turnDay)
|
|
1315
|
+
turnDay.turns++;
|
|
1280
1316
|
lastUserPreview = e.preview;
|
|
1281
1317
|
}
|
|
1282
1318
|
}
|
|
@@ -1318,6 +1354,14 @@ function parseTranscript(rawLines) {
|
|
|
1318
1354
|
totalUsage.output += u.output;
|
|
1319
1355
|
totalUsage.cacheRead += u.cacheRead;
|
|
1320
1356
|
totalUsage.cacheWrite += u.cacheWrite;
|
|
1357
|
+
const ts = typeof o.timestamp === "string" ? o.timestamp : void 0;
|
|
1358
|
+
const b = dayBucket(ts);
|
|
1359
|
+
if (b) {
|
|
1360
|
+
b.tokens.input += u.input;
|
|
1361
|
+
b.tokens.output += u.output;
|
|
1362
|
+
b.tokens.cacheRead += u.cacheRead;
|
|
1363
|
+
b.tokens.cacheWrite += u.cacheWrite;
|
|
1364
|
+
}
|
|
1321
1365
|
}
|
|
1322
1366
|
}
|
|
1323
1367
|
}
|
|
@@ -1341,6 +1385,7 @@ function parseTranscript(rawLines) {
|
|
|
1341
1385
|
lastAgentPreview,
|
|
1342
1386
|
toolCallCount,
|
|
1343
1387
|
turnCount,
|
|
1388
|
+
dailyBreakdown: Array.from(perDay.entries()).map(([day, v]) => ({ day, toolCalls: v.toolCalls, turns: v.turns, tokens: v.tokens })).sort((a, b) => a.day.localeCompare(b.day)),
|
|
1344
1389
|
airTimeMs,
|
|
1345
1390
|
activeSegments,
|
|
1346
1391
|
linesAdded,
|
|
@@ -1359,6 +1404,7 @@ var init_parser = __esm({
|
|
|
1359
1404
|
"../parser/dist/parser.js"() {
|
|
1360
1405
|
"use strict";
|
|
1361
1406
|
init_user_input();
|
|
1407
|
+
init_analytics();
|
|
1362
1408
|
BLANK_USAGE2 = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
1363
1409
|
TEAMMATE_MSG_RE = /^\s*<teammate-message\s+teammate_id="([^"]+)"[^>]*>([\s\S]*?)<\/teammate-message>/;
|
|
1364
1410
|
}
|
|
@@ -1632,7 +1678,7 @@ async function loadCalibrationEvents(root = DEFAULT_ROOT) {
|
|
|
1632
1678
|
out.sort((a, b) => a.ts.localeCompare(b.ts));
|
|
1633
1679
|
return out;
|
|
1634
1680
|
}
|
|
1635
|
-
function aggregateUsageFromLines(lines, seenKeys, usage) {
|
|
1681
|
+
function aggregateUsageFromLines(lines, seenKeys, usage, perDay, fallbackDay) {
|
|
1636
1682
|
for (const raw of lines) {
|
|
1637
1683
|
if (!raw || typeof raw !== "object")
|
|
1638
1684
|
continue;
|
|
@@ -1652,35 +1698,85 @@ function aggregateUsageFromLines(lines, seenKeys, usage) {
|
|
|
1652
1698
|
const u = m.usage;
|
|
1653
1699
|
if (u) {
|
|
1654
1700
|
const toNum = (v) => typeof v === "number" ? v : 0;
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1701
|
+
const inp = toNum(u.input_tokens);
|
|
1702
|
+
const out = toNum(u.output_tokens);
|
|
1703
|
+
const cr = toNum(u.cache_read_input_tokens);
|
|
1704
|
+
const cw = toNum(u.cache_creation_input_tokens);
|
|
1705
|
+
usage.input += inp;
|
|
1706
|
+
usage.output += out;
|
|
1707
|
+
usage.cacheRead += cr;
|
|
1708
|
+
usage.cacheWrite += cw;
|
|
1709
|
+
if (perDay) {
|
|
1710
|
+
let day;
|
|
1711
|
+
const ts = typeof r.timestamp === "string" ? r.timestamp : void 0;
|
|
1712
|
+
if (ts) {
|
|
1713
|
+
const ms = Date.parse(ts);
|
|
1714
|
+
if (!Number.isNaN(ms))
|
|
1715
|
+
day = toLocalDay(ms);
|
|
1716
|
+
}
|
|
1717
|
+
day = day ?? fallbackDay;
|
|
1718
|
+
if (day) {
|
|
1719
|
+
let d = perDay.get(day);
|
|
1720
|
+
if (!d) {
|
|
1721
|
+
d = { ...BLANK_USAGE3 };
|
|
1722
|
+
perDay.set(day, d);
|
|
1723
|
+
}
|
|
1724
|
+
d.input += inp;
|
|
1725
|
+
d.output += out;
|
|
1726
|
+
d.cacheRead += cr;
|
|
1727
|
+
d.cacheWrite += cw;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1659
1730
|
}
|
|
1660
1731
|
}
|
|
1661
1732
|
}
|
|
1662
|
-
async function computeSessionUsageWithSubagents(parentLines, projectDirPath, sessionId) {
|
|
1733
|
+
async function computeSessionUsageWithSubagents(parentLines, projectDirPath, sessionId, fallbackDay) {
|
|
1663
1734
|
const usage = { ...BLANK_USAGE3 };
|
|
1664
1735
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
1665
|
-
|
|
1736
|
+
const perDay = /* @__PURE__ */ new Map();
|
|
1737
|
+
aggregateUsageFromLines(parentLines, seenKeys, usage, perDay, fallbackDay);
|
|
1666
1738
|
const subagentsDir = path.join(projectDirPath, sessionId, "subagents");
|
|
1667
1739
|
let entries;
|
|
1668
1740
|
try {
|
|
1669
1741
|
entries = await fs.readdir(subagentsDir);
|
|
1670
1742
|
} catch {
|
|
1671
|
-
return usage;
|
|
1743
|
+
return { usage, perDay };
|
|
1672
1744
|
}
|
|
1673
1745
|
const jsonlFiles = entries.filter((f) => f.endsWith(".jsonl"));
|
|
1674
1746
|
if (jsonlFiles.length === 0)
|
|
1675
|
-
return usage;
|
|
1747
|
+
return { usage, perDay };
|
|
1676
1748
|
await Promise.all(jsonlFiles.map(async (f) => {
|
|
1677
1749
|
try {
|
|
1678
1750
|
const lines = await readJsonlFile(path.join(subagentsDir, f));
|
|
1679
|
-
aggregateUsageFromLines(lines, seenKeys, usage);
|
|
1751
|
+
aggregateUsageFromLines(lines, seenKeys, usage, perDay, fallbackDay);
|
|
1680
1752
|
} catch {
|
|
1681
1753
|
}
|
|
1682
1754
|
}));
|
|
1683
|
-
return usage;
|
|
1755
|
+
return { usage, perDay };
|
|
1756
|
+
}
|
|
1757
|
+
function mergeDailyTokens(base, perDayTokens, totalUsage) {
|
|
1758
|
+
const counts = new Map((base ?? []).map((d) => [d.day, d]));
|
|
1759
|
+
const days = /* @__PURE__ */ new Set([...counts.keys(), ...perDayTokens.keys()]);
|
|
1760
|
+
const out = [...days].sort((a, b) => a.localeCompare(b)).map((day) => ({
|
|
1761
|
+
day,
|
|
1762
|
+
toolCalls: counts.get(day)?.toolCalls ?? 0,
|
|
1763
|
+
turns: counts.get(day)?.turns ?? 0,
|
|
1764
|
+
tokens: { ...perDayTokens.get(day) ?? BLANK_USAGE3 }
|
|
1765
|
+
}));
|
|
1766
|
+
if (out.length > 0) {
|
|
1767
|
+
const summed = out.reduce((a, r) => ({
|
|
1768
|
+
input: a.input + r.tokens.input,
|
|
1769
|
+
output: a.output + r.tokens.output,
|
|
1770
|
+
cacheRead: a.cacheRead + r.tokens.cacheRead,
|
|
1771
|
+
cacheWrite: a.cacheWrite + r.tokens.cacheWrite
|
|
1772
|
+
}), { ...BLANK_USAGE3 });
|
|
1773
|
+
const first = out[0].tokens;
|
|
1774
|
+
first.input += totalUsage.input - summed.input;
|
|
1775
|
+
first.output += totalUsage.output - summed.output;
|
|
1776
|
+
first.cacheRead += totalUsage.cacheRead - summed.cacheRead;
|
|
1777
|
+
first.cacheWrite += totalUsage.cacheWrite - summed.cacheWrite;
|
|
1778
|
+
}
|
|
1779
|
+
return out;
|
|
1684
1780
|
}
|
|
1685
1781
|
async function scanWorkflowAggregate(projectDirPath, sessionId) {
|
|
1686
1782
|
const dir = path.join(projectDirPath, sessionId, "workflows");
|
|
@@ -1738,7 +1834,10 @@ async function getCachedMeta(f) {
|
|
|
1738
1834
|
const { meta } = parseTranscript(rawLines);
|
|
1739
1835
|
const sessionId = sessionIdFromFileName(f.fileName);
|
|
1740
1836
|
const projectDirPath = path.dirname(f.fullPath);
|
|
1741
|
-
meta.
|
|
1837
|
+
const fallbackDay = meta.firstTimestamp ? toLocalDay(Date.parse(meta.firstTimestamp)) : void 0;
|
|
1838
|
+
const { usage, perDay: perDayTokens } = await computeSessionUsageWithSubagents(rawLines, projectDirPath, sessionId, fallbackDay);
|
|
1839
|
+
meta.totalUsage = usage;
|
|
1840
|
+
meta.dailyBreakdown = mergeDailyTokens(meta.dailyBreakdown, perDayTokens, usage);
|
|
1742
1841
|
const wf = await scanWorkflowAggregate(projectDirPath, sessionId);
|
|
1743
1842
|
const full = {
|
|
1744
1843
|
...meta,
|
|
@@ -5471,16 +5570,12 @@ function bucketToRollup(b) {
|
|
|
5471
5570
|
};
|
|
5472
5571
|
}
|
|
5473
5572
|
function buildRollupsForRange(sessions, sinceDay) {
|
|
5474
|
-
const buckets = dailyActivity(sessions);
|
|
5475
5573
|
const startCounts = /* @__PURE__ */ new Map();
|
|
5476
5574
|
for (const s of sessions) {
|
|
5477
5575
|
const d = sessionDay(s);
|
|
5478
5576
|
if (d) startCounts.set(d, (startCounts.get(d) ?? 0) + 1);
|
|
5479
5577
|
}
|
|
5480
|
-
return
|
|
5481
|
-
...bucketToRollup(b),
|
|
5482
|
-
sessions: startCounts.get(b.date) ?? 0
|
|
5483
|
-
}));
|
|
5578
|
+
return dailyActivity(sessions).filter((b) => !sinceDay || b.date >= sinceDay).map((b) => ({ ...bucketToRollup(b), uniqueSessions: startCounts.get(b.date) ?? 0 }));
|
|
5484
5579
|
}
|
|
5485
5580
|
function dayBoundsMs(day) {
|
|
5486
5581
|
const [y, m, d] = day.split("-").map(Number);
|
|
@@ -15051,14 +15146,14 @@ async function getUpdateAvailability() {
|
|
|
15051
15146
|
if (isDevMode()) return null;
|
|
15052
15147
|
const latest = await fetchLatestVersion();
|
|
15053
15148
|
if (latest === null) return {
|
|
15054
|
-
current: "0.12.
|
|
15149
|
+
current: "0.12.2",
|
|
15055
15150
|
latest: null,
|
|
15056
15151
|
updateAvailable: false
|
|
15057
15152
|
};
|
|
15058
15153
|
return {
|
|
15059
|
-
current: "0.12.
|
|
15154
|
+
current: "0.12.2",
|
|
15060
15155
|
latest,
|
|
15061
|
-
updateAvailable: shouldUpdate("0.12.
|
|
15156
|
+
updateAvailable: shouldUpdate("0.12.2", latest)
|
|
15062
15157
|
};
|
|
15063
15158
|
}
|
|
15064
15159
|
|