Skip to content

Commit 715812d

Browse files
authored
Merge branch 'main' into 311-date-off-by-one
2 parents a229b54 + b16fa46 commit 715812d

4 files changed

Lines changed: 22 additions & 27 deletions

File tree

‎bun.lock‎

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"docs"
3737
],
3838
"engines": {
39-
"node": ">=20.19.3"
39+
"node": ">=20.19.4"
4040
},
4141
"scripts": {
4242
"build": "tsdown",
@@ -58,15 +58,15 @@
5858
"@antfu/utils": "^9.2.0",
5959
"@core/errorutil": "npm:@jsr/core__errorutil",
6060
"@hono/mcp": "^0.1.0",
61-
"@hono/node-server": "^1.15.0",
61+
"@hono/node-server": "^1.16.0",
6262
"@jsr/std__async": "1",
6363
"@modelcontextprotocol/sdk": "^1.15.1",
6464
"@oxc-project/runtime": "^0.77.0",
6565
"@praha/byethrow": "^0.6.2",
6666
"@praha/byethrow-mcp": "^0.0.14",
6767
"@ryoppippi/eslint-config": "^0.3.7",
6868
"@types/bun": "^1.2.18",
69-
"@typescript/native-preview": "^7.0.0-dev.20250712.1",
69+
"@typescript/native-preview": "^7.0.0-dev.20250716.1",
7070
"ansi-escapes": "^7.0.0",
7171
"bumpp": "^10.2.0",
7272
"clean-pkg-json": "^1.3.0",
@@ -78,7 +78,7 @@
7878
"fast-sort": "^3.4.1",
7979
"fs-fixture": "^2.8.1",
8080
"gunshi": "^0.26.3",
81-
"hono": "^4.8.4",
81+
"hono": "^4.8.5",
8282
"lint-staged": "^16.1.2",
8383
"path-type": "^6.0.0",
8484
"picocolors": "^1.1.1",

‎src/_live-rendering.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import stringWidth from 'string-width';
1717
import { BURN_RATE_THRESHOLDS } from './_consts.ts';
1818
import { calculateBurnRate, projectBlockUsage } from './_session-blocks.ts';
1919
import { centerText, createProgressBar } from './_terminal-utils.ts';
20+
import { getTotalTokens } from './_token-utils.ts';
2021
import { formatCurrency, formatModelsDisplay, formatNumber } from './_utils.ts';
2122

2223
/**
@@ -113,7 +114,7 @@ export function renderLiveDisplay(terminal: TerminalManager, block: SessionBlock
113114
const now = new Date();
114115

115116
// Calculate key metrics
116-
const totalTokens = block.tokenCounts.inputTokens + block.tokenCounts.outputTokens;
117+
const totalTokens = getTotalTokens(block.tokenCounts);
117118
const elapsed = (now.getTime() - block.startTime.getTime()) / (1000 * 60);
118119
const remaining = (block.endTime.getTime() - now.getTime()) / (1000 * 60);
119120

‎src/commands/blocks.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ function formatModels(models: string[]): string {
9494
* @returns Parsed token limit or undefined if invalid
9595
*/
9696
function parseTokenLimit(value: string | undefined, maxFromAll: number): number | undefined {
97-
if (value == null || value === '') {
98-
return undefined;
99-
}
100-
101-
if (value === 'max') {
97+
if (value == null || value === '' || value === 'max') {
10298
return maxFromAll > 0 ? maxFromAll : undefined;
10399
}
104100

@@ -178,7 +174,7 @@ export const blocksCommand = define({
178174

179175
// Calculate max tokens from ALL blocks before applying filters
180176
let maxTokensFromAll = 0;
181-
if (ctx.values.tokenLimit === 'max') {
177+
if (ctx.values.tokenLimit === 'max' || ctx.values.tokenLimit == null || ctx.values.tokenLimit === '') {
182178
for (const block of blocks) {
183179
if (!(block.isGap ?? false) && !block.isActive) {
184180
const blockTokens = getTotalTokens(block.tokenCounts);
@@ -266,9 +262,7 @@ export const blocksCommand = define({
266262
isGap: block.isGap ?? false,
267263
entries: block.entries.length,
268264
tokenCounts: block.tokenCounts,
269-
totalTokens:
270-
block.tokenCounts.inputTokens
271-
+ block.tokenCounts.outputTokens,
265+
totalTokens: getTotalTokens(block.tokenCounts),
272266
costUSD: block.costUSD,
273267
models: block.models,
274268
burnRate,

0 commit comments

Comments
 (0)