standout 0.5.37 → 0.5.38
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/dist/cli.js +55 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3274,6 +3274,35 @@ function withAllTime(recent, allTime, previous = null) {
|
|
|
3274
3274
|
if (previous) stats.previous_30d = summarizeUsage(previous);
|
|
3275
3275
|
return stats;
|
|
3276
3276
|
}
|
|
3277
|
+
function extractSessionRecords(raw, source) {
|
|
3278
|
+
const out = [];
|
|
3279
|
+
for (const [sessionId, s] of raw.sessions) {
|
|
3280
|
+
if (!sessionId) continue;
|
|
3281
|
+
const d = new Date(s.firstTs);
|
|
3282
|
+
if (isNaN(d.getTime())) continue;
|
|
3283
|
+
const month = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
|
|
3284
|
+
let primary = null;
|
|
3285
|
+
let best = 0;
|
|
3286
|
+
for (const [m, c] of s.modelTurnCounts) {
|
|
3287
|
+
if (c > best && m && !m.startsWith("<") && !m.includes("synthetic")) {
|
|
3288
|
+
best = c;
|
|
3289
|
+
primary = m;
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
out.push({
|
|
3293
|
+
source,
|
|
3294
|
+
session_id: sessionId,
|
|
3295
|
+
month,
|
|
3296
|
+
duration_hours: +(estimateActiveDurationMs2(s.eventTimestamps) / 36e5).toFixed(3),
|
|
3297
|
+
input_tokens: s.inputTokens,
|
|
3298
|
+
output_tokens: s.outputTokens,
|
|
3299
|
+
cache_read_tokens: s.cacheReadTokens,
|
|
3300
|
+
cache_write_tokens: s.cacheWriteTokens,
|
|
3301
|
+
primary_model: primary
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
return out;
|
|
3305
|
+
}
|
|
3277
3306
|
async function gatherAiUsage() {
|
|
3278
3307
|
const claudeFiles = listClaudeCodeFiles();
|
|
3279
3308
|
const codexFiles = listCodexFiles();
|
|
@@ -3378,7 +3407,12 @@ async function gatherAiUsage() {
|
|
|
3378
3407
|
finalize2(codexAllRaw),
|
|
3379
3408
|
finalize2(codexPreviousRaw)
|
|
3380
3409
|
),
|
|
3381
|
-
cursor
|
|
3410
|
+
cursor,
|
|
3411
|
+
sessions: [
|
|
3412
|
+
...extractSessionRecords(claudeAllRaw, "claude_code"),
|
|
3413
|
+
...extractSessionRecords(coworkAllRaw, "cowork"),
|
|
3414
|
+
...extractSessionRecords(codexAllRaw, "codex")
|
|
3415
|
+
]
|
|
3382
3416
|
};
|
|
3383
3417
|
}
|
|
3384
3418
|
|
|
@@ -3988,7 +4022,8 @@ function emptyGatheredProfile(readiness = {
|
|
|
3988
4022
|
claude_code: null,
|
|
3989
4023
|
cowork: null,
|
|
3990
4024
|
codex: null,
|
|
3991
|
-
cursor: null
|
|
4025
|
+
cursor: null,
|
|
4026
|
+
sessions: []
|
|
3992
4027
|
},
|
|
3993
4028
|
dev_environment: {
|
|
3994
4029
|
agents_md: [],
|
|
@@ -4030,7 +4065,8 @@ async function gatherUsageStats() {
|
|
|
4030
4065
|
claude_code: null,
|
|
4031
4066
|
cowork: null,
|
|
4032
4067
|
codex: null,
|
|
4033
|
-
cursor: null
|
|
4068
|
+
cursor: null,
|
|
4069
|
+
sessions: []
|
|
4034
4070
|
},
|
|
4035
4071
|
readiness: {
|
|
4036
4072
|
usage_stats_status: "error",
|
|
@@ -4472,7 +4508,8 @@ async function gather(options = {}) {
|
|
|
4472
4508
|
claude_code: null,
|
|
4473
4509
|
cowork: null,
|
|
4474
4510
|
codex: null,
|
|
4475
|
-
cursor: null
|
|
4511
|
+
cursor: null,
|
|
4512
|
+
sessions: []
|
|
4476
4513
|
}));
|
|
4477
4514
|
const devEnvPromise = gatherDevEnvironment().catch(
|
|
4478
4515
|
() => ({
|
|
@@ -6825,6 +6862,19 @@ async function renderWrappedAll(view) {
|
|
|
6825
6862
|
}
|
|
6826
6863
|
|
|
6827
6864
|
// src/wrapped-client.ts
|
|
6865
|
+
function applyLedgerMonthly(profile, ledgerMonthly) {
|
|
6866
|
+
if (!ledgerMonthly) return;
|
|
6867
|
+
const ai = profile?.ai_usage;
|
|
6868
|
+
if (!ai) return;
|
|
6869
|
+
for (const [src, buckets] of Object.entries(ledgerMonthly)) {
|
|
6870
|
+
if (!Array.isArray(buckets) || buckets.length === 0) continue;
|
|
6871
|
+
const stats = ai[src] ?? (ai[src] = {});
|
|
6872
|
+
const at = stats.all_time ?? (stats.all_time = {});
|
|
6873
|
+
at.monthly_buckets = buckets;
|
|
6874
|
+
at.total_duration_hours = +buckets.reduce((s, b) => s + (b.duration_hours ?? 0), 0).toFixed(1);
|
|
6875
|
+
at.total_sessions = buckets.reduce((s, b) => s + (b.sessions ?? 0), 0);
|
|
6876
|
+
}
|
|
6877
|
+
}
|
|
6828
6878
|
var HEADERS = {
|
|
6829
6879
|
"Content-Type": "application/json",
|
|
6830
6880
|
// Vercel BotID flagged Anthropic/JS as bot traffic; same goes for default
|
|
@@ -6953,6 +7003,7 @@ async function createWrapped(args) {
|
|
|
6953
7003
|
);
|
|
6954
7004
|
return null;
|
|
6955
7005
|
}
|
|
7006
|
+
applyLedgerMonthly(args.profile, created.ledger_monthly);
|
|
6956
7007
|
const view = aggregateView({
|
|
6957
7008
|
profile: args.profile,
|
|
6958
7009
|
computed,
|