@bli-cockpit/cli 0.2.87 → 0.2.88
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.
|
@@ -96,11 +96,14 @@ export function renderMemoryHooks(hooks, dim) {
|
|
|
96
96
|
const rightKnown = typeof right.runs === "number" ? 0 : 1;
|
|
97
97
|
if (leftKnown !== rightKnown)
|
|
98
98
|
return leftKnown - rightKnown;
|
|
99
|
-
|
|
99
|
+
// BLI-3891: a billing refusal ranks beside a missed deadline. Both are a
|
|
100
|
+
// recall the person did not get; only the fix differs.
|
|
101
|
+
return ((right.timeouts ?? 0) + (right.billingExhausted ?? 0)
|
|
102
|
+
- ((left.timeouts ?? 0) + (left.billingExhausted ?? 0)));
|
|
100
103
|
});
|
|
101
104
|
for (const device of ranked) {
|
|
102
105
|
const line = ` ${device.line ?? `${device.displayName ?? "?"}: (no line)`}`;
|
|
103
|
-
lines.push((device.timeouts ?? 0) > 0 ? line : dim(line));
|
|
106
|
+
lines.push((device.timeouts ?? 0) > 0 || (device.billingExhausted ?? 0) > 0 ? line : dim(line));
|
|
104
107
|
if (device.performanceLine)
|
|
105
108
|
lines.push(` ${device.performanceLine}`);
|
|
106
109
|
// BLI-3884. Written on the server (`lib/ops/memory-hook-misses.ts`) and
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cockpit ops` — WHAT TODAY COST, by model (BLI-3909).
|
|
3
|
+
*
|
|
4
|
+
* Split out of `ops-render.ts` the way `ops-render-memory.ts` and
|
|
5
|
+
* `ops-render-coverage.ts` were, when that file crossed the repo's 500-line
|
|
6
|
+
* readability floor.
|
|
7
|
+
*
|
|
8
|
+
* Same rule as the rest of that family: every sentence here was written on the
|
|
9
|
+
* SERVER (`lib/ops/model-spend-today.ts`) and is printed VERBATIM. This module
|
|
10
|
+
* decides order, indentation and column widths and nothing else — a terminal
|
|
11
|
+
* that composed its own total from the same fields would eventually disagree
|
|
12
|
+
* with the page about what a $25 day means, and the one that is wrong is
|
|
13
|
+
* always the one somebody is reading.
|
|
14
|
+
*
|
|
15
|
+
* A CLI too old to know this section simply does not print it. Nothing is lost
|
|
16
|
+
* by that: the section rides the ordinary `/api/ops/status` response, so
|
|
17
|
+
* `cockpit ops --json` carries it on every version.
|
|
18
|
+
*/
|
|
19
|
+
/** `$18.65`, `$0.0031`, `—` when the server sent no number at all. */
|
|
20
|
+
function usdColumn(usd) {
|
|
21
|
+
if (typeof usd !== "number")
|
|
22
|
+
return "—";
|
|
23
|
+
return `$${usd.toFixed(usd < 0.01 ? 4 : 2)}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The SPEND block: the server's one line, then one row per model. `$314 of a
|
|
27
|
+
* $357 month on one model` is the thing this exists to make visible before the
|
|
28
|
+
* invoice does.
|
|
29
|
+
*/
|
|
30
|
+
export function renderSpend(spend, dim) {
|
|
31
|
+
const lines = ["", `SPEND ${spend.summary ?? "(no summary)"}`];
|
|
32
|
+
for (const row of spend.models ?? []) {
|
|
33
|
+
lines.push(dim(` ${usdColumn(row.usd).padStart(9)} ${row.model ?? "?"} · ${row.calls ?? 0} call(s) · ${(row.bases ?? []).join("+") || "?"} · ${(row.sources ?? []).join(",") || "?"}`));
|
|
34
|
+
}
|
|
35
|
+
return lines;
|
|
36
|
+
}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* somebody is about to conclude something from it.
|
|
14
14
|
*/
|
|
15
15
|
import { renderCoverageBuckets, } from "./ops-render-coverage.js";
|
|
16
|
+
// BLI-3909: today's spend by model, its own renderer for the same reason the
|
|
17
|
+
// coverage table has one — this file is at the repo's readability floor.
|
|
18
|
+
import { renderSpend } from "./ops-render-spend.js";
|
|
19
|
+
export { renderSpend } from "./ops-render-spend.js";
|
|
16
20
|
export { renderMemoryHooks, renderMemoryUsage } from "./ops-render-memory.js";
|
|
17
21
|
export { renderCoverageBuckets };
|
|
18
22
|
/** The word a person reads. Short, fixed width, and never a bare colour. */
|
|
@@ -124,6 +128,8 @@ options = {}) {
|
|
|
124
128
|
lines.push(...renderCoverageBuckets(payload.coverage.buckets, dim));
|
|
125
129
|
}
|
|
126
130
|
}
|
|
131
|
+
if (payload.spend)
|
|
132
|
+
lines.push(...renderSpend(payload.spend, dim));
|
|
127
133
|
const slack = payload.skips?.slack;
|
|
128
134
|
const external = payload.skips?.external;
|
|
129
135
|
if (slack || external) {
|
package/dist/commands/ops.js
CHANGED
|
@@ -152,6 +152,9 @@ async function runOpsStatus(command, io, tower) {
|
|
|
152
152
|
// BLI-3881: runs the hook declined to search for. A SUBSET of runs, so
|
|
153
153
|
// `runs - skipped_trivial` is how many turns actually asked the door.
|
|
154
154
|
memory_hook_skipped_trivial_24h: memory?.hooks?.totals?.skippedTrivial ?? null,
|
|
155
|
+
// BLI-3891: null means the fleet reported none of these at all, which is
|
|
156
|
+
// "not measured" on a machine older than the count — never "no refusals".
|
|
157
|
+
memory_hook_billing_exhausted_24h: memory?.hooks?.totals?.billingExhausted ?? null,
|
|
155
158
|
memory_hook_devices_reporting: memory?.hooks?.reporting ?? null,
|
|
156
159
|
// BLI-3884: which route answered them, fleet-wide. Null while no machine
|
|
157
160
|
// names one — a rollout fact, not a count of zero.
|
|
@@ -15,7 +15,7 @@ export async function runCockpitCli(argv, io) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (command === "--version" || command === "-V" || command === "version") {
|
|
18
|
-
writeLine(io?.stdout ?? process.stdout, "0.2.
|
|
18
|
+
writeLine(io?.stdout ?? process.stdout, "0.2.88");
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bli-cockpit/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.88",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test": "node dist/cli.js --help && node ../../scripts/assert-public-cli-routing.mjs && node ../../scripts/assert-public-cli-verb-help.mjs && node ../../scripts/assert-public-cli-runtime-files.mjs && node ../../scripts/assert-public-cli-no-fleet-posts.mjs && node ../../scripts/assert-public-package-pack.mjs --workspace=@bli-cockpit/cli"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@bli-cockpit/memory-mcp": "0.1.
|
|
31
|
-
"@bli-cockpit/mcp": "0.1.
|
|
32
|
-
"@bli-cockpit/telemetry-core": "0.1.
|
|
30
|
+
"@bli-cockpit/memory-mcp": "0.1.20",
|
|
31
|
+
"@bli-cockpit/mcp": "0.1.21",
|
|
32
|
+
"@bli-cockpit/telemetry-core": "0.1.37"
|
|
33
33
|
}
|
|
34
34
|
}
|