claude-token-saver 3.25.0 → 3.26.0
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 +48 -0
- package/bin/cli.js +30 -0
- package/package.json +8 -3
- package/presets/doc2md/convert.py +188 -0
- package/src/advice.js +34 -2
- package/src/commands/doc2md.js +100 -0
- package/src/commands/mode.js +1 -0
- package/src/commands/route-scan.js +15 -1
- package/src/config.js +15 -0
- package/src/cost.js +6 -0
- package/src/doc2md.cjs +378 -0
- package/src/formatters/statusline.js +37 -7
- package/src/formatters/table.js +8 -1
- package/src/installer.js +69 -0
- package/src/korean-style.js +11 -1
- package/src/model-alias.js +15 -3
- package/src/parser.js +24 -1
- package/src/session-cache.js +4 -1
- package/src/stats.js +22 -1
package/src/stats.js
CHANGED
|
@@ -59,10 +59,12 @@ export function dailyTrend(sessions) {
|
|
|
59
59
|
export function ttlBreakdown(sessions) {
|
|
60
60
|
let total5m = 0;
|
|
61
61
|
let total1h = 0;
|
|
62
|
+
let gatewayObserved = false;
|
|
62
63
|
|
|
63
64
|
for (const s of sessions) {
|
|
64
65
|
total5m += s.totals.ephemeral5m;
|
|
65
66
|
total1h += s.totals.ephemeral1h;
|
|
67
|
+
if (s.gatewayObserved) gatewayObserved = true;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
const total = total5m + total1h;
|
|
@@ -72,6 +74,12 @@ export function ttlBreakdown(sessions) {
|
|
|
72
74
|
total,
|
|
73
75
|
pct5m: total > 0 ? total5m / total : 0,
|
|
74
76
|
pct1h: total > 0 ? total1h / total : 0,
|
|
77
|
+
// Bedrock and Vertex fill only the `cache_creation_input_tokens` sum and
|
|
78
|
+
// leave the per-bucket split at zero, so `total === 0` there means "cannot
|
|
79
|
+
// tell" rather than "no cache writes happened". Carrying the observation
|
|
80
|
+
// alongside the numbers lets the display layer tell those two apart
|
|
81
|
+
// without going back to the environment.
|
|
82
|
+
gatewayObserved,
|
|
75
83
|
};
|
|
76
84
|
}
|
|
77
85
|
|
|
@@ -135,6 +143,7 @@ export function sessionMetrics(session) {
|
|
|
135
143
|
outputRatio,
|
|
136
144
|
writeToReadRatio,
|
|
137
145
|
maxContextPerRequest: session.maxContextPerRequest || 0,
|
|
146
|
+
gatewayObserved: !!session.gatewayObserved,
|
|
138
147
|
totals: t,
|
|
139
148
|
};
|
|
140
149
|
}
|
|
@@ -217,11 +226,23 @@ export function diagnoseSession(metrics, baseline) {
|
|
|
217
226
|
});
|
|
218
227
|
}
|
|
219
228
|
|
|
220
|
-
|
|
229
|
+
// The split is only knowable when the provider reports it. Requiring that
|
|
230
|
+
// sum outright meant gateway users — who are on a 5m-only backend and so
|
|
231
|
+
// need this warning most — never saw it at all.
|
|
232
|
+
const ttlSplitKnown = (metrics.totals.ephemeral5m + metrics.totals.ephemeral1h) > 0;
|
|
233
|
+
if (ttlSplitKnown && metrics.pct5m > 0.7) {
|
|
221
234
|
issues.push({
|
|
222
235
|
code: 'BUCKET_5M_DOMINANT',
|
|
223
236
|
pct5m: metrics.pct5m,
|
|
224
237
|
});
|
|
238
|
+
} else if (!ttlSplitKnown && metrics.gatewayObserved && metrics.totals.cacheCreation > 0) {
|
|
239
|
+
// Bedrock and Vertex offer no 1h bucket, so every write is a 5m write.
|
|
240
|
+
// The advice differs from the subscription case: no plan change fixes it.
|
|
241
|
+
issues.push({
|
|
242
|
+
code: 'BUCKET_5M_DOMINANT_GATEWAY',
|
|
243
|
+
pct5m: 1.0,
|
|
244
|
+
inferred: true,
|
|
245
|
+
});
|
|
225
246
|
}
|
|
226
247
|
|
|
227
248
|
if (metrics.outputRatio > 0.15) {
|