oc-flight-deck 0.2.0 → 0.2.1
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 +11 -3
- package/package.json +1 -1
- package/src/tui/stats.ts +36 -15
package/README.md
CHANGED
|
@@ -93,13 +93,21 @@ them. On the session this was built against, the parent reported `$0.2246` while
|
|
|
93
93
|
the true spend was `$0.2447` - **9% low on money, and 54% low on input tokens**.
|
|
94
94
|
|
|
95
95
|
Rather than spend two rows on a number and its own superset, `cost` shows the
|
|
96
|
-
family total and the
|
|
96
|
+
family total and the count that explains it:
|
|
97
97
|
|
|
98
98
|
```
|
|
99
|
-
cost $0.245 ·
|
|
99
|
+
cost $0.245 · 2 subagents
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
`total`
|
|
102
|
+
**Add `total` to `sidebar.rows` and `cost` goes back to the session figure
|
|
103
|
+
alone** — the merge only happens when nothing else on the rail already shows it.
|
|
104
|
+
So "one money row or two" is decided by your rows list, not by another setting to
|
|
105
|
+
find.
|
|
106
|
+
|
|
107
|
+
The row is deliberately short. An earlier version also printed the delta
|
|
108
|
+
(`+ $0.020`), which pushed the row to 40 columns and made it **wrap** in a normal
|
|
109
|
+
sidebar. It was true information that did not earn its width, and a row that
|
|
110
|
+
wraps costs more than a row that says less.
|
|
103
111
|
|
|
104
112
|
### `cache` is the row that surprises people
|
|
105
113
|
|
package/package.json
CHANGED
package/src/tui/stats.ts
CHANGED
|
@@ -109,6 +109,14 @@ export interface LayoutHint {
|
|
|
109
109
|
readonly labelWidth?: number;
|
|
110
110
|
readonly barWidth?: number;
|
|
111
111
|
readonly sparkWidth?: number;
|
|
112
|
+
/**
|
|
113
|
+
* True when the rail already draws a `total` row.
|
|
114
|
+
*
|
|
115
|
+
* The `cost` row merges the subagent total into itself only when nothing else
|
|
116
|
+
* on the rail already shows it — which makes "do I want one money row or two"
|
|
117
|
+
* a property of `sidebar.rows`, not a separate setting to find.
|
|
118
|
+
*/
|
|
119
|
+
readonly hasTotalRow?: boolean;
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
const DEFAULT_LABEL_WIDTH = 10;
|
|
@@ -260,23 +268,30 @@ export function statLine(
|
|
|
260
268
|
const tree = asRecord(source.tree);
|
|
261
269
|
const treeCost = asCount(tree?.cost);
|
|
262
270
|
const count = asCount(tree?.count);
|
|
271
|
+
const family = count !== undefined && count > 0 ? count : 0;
|
|
263
272
|
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
|
|
273
|
+
// Merge only when subagents actually ran, and only when the rail is not
|
|
274
|
+
// already showing a `total` row. Two rows holding a number and its own
|
|
275
|
+
// superset was the thing worth fixing; a setting to choose between them
|
|
276
|
+
// would just be that duplication with extra steps.
|
|
277
|
+
const merge =
|
|
278
|
+
layout.hasTotalRow !== true &&
|
|
269
279
|
cost !== undefined &&
|
|
270
280
|
treeCost !== undefined &&
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
) {
|
|
275
|
-
const
|
|
276
|
-
return row("cost",
|
|
281
|
+
family > 0 &&
|
|
282
|
+
treeCost > cost;
|
|
283
|
+
|
|
284
|
+
if (!merge) {
|
|
285
|
+
const value = layout.hasTotalRow === true ? (cost ?? treeCost) : (treeCost ?? cost);
|
|
286
|
+
return value === undefined ? undefined : row("cost", formatCost(value));
|
|
277
287
|
}
|
|
278
|
-
|
|
279
|
-
|
|
288
|
+
|
|
289
|
+
// The delta (`+$0.020`) used to be here and pushed the row to 40 columns,
|
|
290
|
+
// wide enough to wrap in a normal sidebar. It was real information that
|
|
291
|
+
// did not earn its width: the count already explains why the figure is
|
|
292
|
+
// higher, and this form is the same width as the old `total` row.
|
|
293
|
+
const plural = family === 1 ? "subagent" : "subagents";
|
|
294
|
+
return row("cost", `${formatCost(treeCost as number)} · ${family} ${plural}`);
|
|
280
295
|
}
|
|
281
296
|
case "total": {
|
|
282
297
|
// Only worth a row once a subagent has actually run: subagent sessions are
|
|
@@ -342,7 +357,9 @@ export function statLine(
|
|
|
342
357
|
return row("perms", action === undefined ? `${count} waiting` : `${count} waiting · ${action}`);
|
|
343
358
|
}
|
|
344
359
|
if (action === undefined) return row("perms", "1 waiting");
|
|
345
|
-
|
|
360
|
+
// Clipped hard: a row that wraps costs the reader more than a row that
|
|
361
|
+
// shortens a path, and there is no way to ask the host how wide it is.
|
|
362
|
+
return row("perms", resource === undefined ? action : `${action} · ${clip(resource, 18)}`);
|
|
346
363
|
}
|
|
347
364
|
case "elapsed": {
|
|
348
365
|
const ms = asCount(source.elapsedMs);
|
|
@@ -383,9 +400,13 @@ export function statRows(
|
|
|
383
400
|
source: StatSource,
|
|
384
401
|
layout: LayoutHint = {},
|
|
385
402
|
): readonly string[] {
|
|
403
|
+
// The rows list decides whether `cost` merges the subagent total into itself.
|
|
404
|
+
// Passing that down means the choice lives in `sidebar.rows`, where someone
|
|
405
|
+
// is already deciding what the rail shows.
|
|
406
|
+
const hint: LayoutHint = { ...layout, hasTotalRow: fields.includes("total") };
|
|
386
407
|
const rows: string[] = [];
|
|
387
408
|
for (const field of fields) {
|
|
388
|
-
const line = statLine(field, source,
|
|
409
|
+
const line = statLine(field, source, hint);
|
|
389
410
|
if (line !== undefined) rows.push(line);
|
|
390
411
|
}
|
|
391
412
|
return rows;
|