@letterstory/cli 0.33.3 → 0.33.4
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/lib/cli.mjs +1 -1
- package/lib/commands/kernel.mjs +37 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
} from "./commands.mjs";
|
|
46
46
|
|
|
47
47
|
// Keep in sync with cli/package.json.
|
|
48
|
-
export const VERSION = "0.33.
|
|
48
|
+
export const VERSION = "0.33.4";
|
|
49
49
|
|
|
50
50
|
// Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
|
|
51
51
|
// can't accidentally swallow the id as --json's value.
|
package/lib/commands/kernel.mjs
CHANGED
|
@@ -246,10 +246,46 @@ async function kernelStatus(ctx) {
|
|
|
246
246
|
const { client, positionals, flags, io } = ctx;
|
|
247
247
|
const jobId = requirePositional(positionals, 0, "kernel-job-id");
|
|
248
248
|
const result = await client.callTool("get_kernel_run_status", { kernel_job_id: jobId });
|
|
249
|
+
printRecordLine(ctx, result);
|
|
249
250
|
printResult(io, flags, result);
|
|
250
251
|
return 0;
|
|
251
252
|
}
|
|
252
253
|
|
|
254
|
+
/**
|
|
255
|
+
* THE RECORD'S HEADLINE, one line, on a done run — the same `verification.service` both poll
|
|
256
|
+
* tools return (get_kernel_run_status for an article-bound run, get_kernel_endpoint_run for a
|
|
257
|
+
* standalone one), so a reader at a terminal sees "invented 0" before the JSON. Quiet under
|
|
258
|
+
* --json / --quiet like every other `ok` line. The full record is in the JSON below it.
|
|
259
|
+
*/
|
|
260
|
+
export function recordSummaryLine(result) {
|
|
261
|
+
const service = toolField(result, "verification")?.service;
|
|
262
|
+
if (!service || typeof service !== "object") return null;
|
|
263
|
+
const parts = [];
|
|
264
|
+
const s = service.sentences;
|
|
265
|
+
if (s && typeof s === "object") {
|
|
266
|
+
if (typeof s.supported === "number") parts.push(`${s.supported} supported`);
|
|
267
|
+
if (typeof s.contradicted === "number" || typeof s.unreferenced === "number")
|
|
268
|
+
parts.push(`${(s.contradicted ?? 0) + (s.unreferenced ?? 0)} invented`);
|
|
269
|
+
if (typeof s.dropped === "number") parts.push(`${s.dropped} dropped`);
|
|
270
|
+
}
|
|
271
|
+
const h = service.held;
|
|
272
|
+
if (h && typeof h.blocks === "number") parts.push(`held ${h.restored ?? 0}/${h.blocks}`);
|
|
273
|
+
const c = service.attachments?.citations;
|
|
274
|
+
if (c && typeof c.expected === "number") parts.push(`citations ${c.carried ?? 0}/${c.expected}`);
|
|
275
|
+
if (typeof service.shape?.title_held === "boolean")
|
|
276
|
+
parts.push(service.shape.title_held ? "title held" : "title not held");
|
|
277
|
+
if (typeof service.length?.delta === "number") {
|
|
278
|
+
const pct = Math.round(service.length.delta * 100);
|
|
279
|
+
parts.push(`length ${pct >= 0 ? "+" : ""}${pct}%`);
|
|
280
|
+
}
|
|
281
|
+
return parts.length ? `Record: ${parts.join(" \u00B7 ")}` : null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function printRecordLine(ctx, result) {
|
|
285
|
+
const line = recordSummaryLine(result);
|
|
286
|
+
if (line) ok(ctx, line);
|
|
287
|
+
}
|
|
288
|
+
|
|
253
289
|
/* ------------------------------------------------------------------ */
|
|
254
290
|
/* The standalone endpoint: prose back, nothing written into an article */
|
|
255
291
|
/* ------------------------------------------------------------------ */
|
|
@@ -424,6 +460,7 @@ async function kernelRunStatus(ctx) {
|
|
|
424
460
|
const { client, positionals, flags, io } = ctx;
|
|
425
461
|
const runId = requirePositional(positionals, 0, "run-id");
|
|
426
462
|
const result = await client.callTool("get_kernel_endpoint_run", { run_id: runId });
|
|
463
|
+
printRecordLine(ctx, result);
|
|
427
464
|
printResult(io, flags, result);
|
|
428
465
|
return 0;
|
|
429
466
|
}
|