@rulvar/cli 1.228.0 → 1.230.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/dist/cli.js +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/{io-BhEqrNZg.js → io-OKD0hUpc.js} +75 -1
- package/package.json +7 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -240,6 +240,14 @@ declare function reportOutcome(outcome: RunOutcome<unknown>, io: CliIo): number;
|
|
|
240
240
|
* pass through unchanged, so the flag never masks the ordinary status
|
|
241
241
|
* exit and never bites a plain workflow.
|
|
242
242
|
*
|
|
243
|
+
* Completion answers for the CHILDREN, never for the artifact, so
|
|
244
|
+
* strict also reads the deliverable verdict (RV2604): a
|
|
245
|
+
* `deliverableAccepted: false` exits nonzero even under a green
|
|
246
|
+
* completion, the row the twenty-fifth comparison run landed on when
|
|
247
|
+
* its child roster passed and its declared contract refused every
|
|
248
|
+
* synthesis. An ABSENT verdict is left alone, because nothing judged
|
|
249
|
+
* anything and a host that declares no contract is its own judge.
|
|
250
|
+
*
|
|
243
251
|
* Completion is a MECHANICAL verdict, and the eighteenth comparison
|
|
244
252
|
* benchmark showed how easily `completion: 'complete'` reads as
|
|
245
253
|
* semantic green while the claim judge saw 40 of 144 citing sentences.
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as assembleEngine, a as inspectCommand, b as looksLikeFile, c as resumeCommand, d as driveRun, f as reportOutcome, g as DEFAULT_STORE_DIR, h as renderEventLine, i as costAuditCommand, l as runCommand, m as attachProgress, n as HELP, o as invoiceCommand, p as strictExitCode, r as runCli, s as preflightCommand, t as processIo, u as runsLsCommand, v as loadCliConfig, y as loadWorkflowModule } from "./io-
|
|
1
|
+
import { _ as assembleEngine, a as inspectCommand, b as looksLikeFile, c as resumeCommand, d as driveRun, f as reportOutcome, g as DEFAULT_STORE_DIR, h as renderEventLine, i as costAuditCommand, l as runCommand, m as attachProgress, n as HELP, o as invoiceCommand, p as strictExitCode, r as runCli, s as preflightCommand, t as processIo, u as runsLsCommand, v as loadCliConfig, y as loadWorkflowModule } from "./io-OKD0hUpc.js";
|
|
2
2
|
import { ConfigError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, journalPricingSnapshot, maskSecrets, normalizeEntry, persistedTerminalEnvelope, readRunMeta, scanJournalCompatibility, validateDetachedResolution } from "@rulvar/core";
|
|
3
3
|
//#region src/server.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigError, FileModelKnowledgeStore, INBOX_PROPOSAL_TTL_DAYS, JsonlFileStore, LeaseHeldError, auditRuns, claimCoverageOf, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, hashRunArgs, hashRunOutput, invoiceFromJournal, journalPricingSnapshot, lastRunSettle, parseModelRef, preflightEstimate, priceUsdOf, proposalStatement, readRunMeta, reconcileRunMeta, remeasureQueue, resolvePricing, runProfile, sanitizeTerminalText } from "@rulvar/core";
|
|
1
|
+
import { ConfigError, FileModelKnowledgeStore, INBOX_PROPOSAL_TTL_DAYS, JsonlFileStore, LeaseHeldError, auditRuns, childRostersFromJournal, claimCoverageOf, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, hashRunArgs, hashRunOutput, invoiceFromJournal, journalPricingSnapshot, lastRunSettle, logicalRunTelemetry, parseModelRef, preflightEstimate, priceUsdOf, proposalStatement, readRunMeta, reconcileRunMeta, remeasureQueue, resolvePricing, runProfile, sanitizeTerminalText } from "@rulvar/core";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { existsSync, statSync } from "node:fs";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
@@ -373,6 +373,7 @@ function reportOutcome(outcome, io) {
|
|
|
373
373
|
io.err(`status: ${outcome.status}`);
|
|
374
374
|
if (outcome.value !== void 0) io.out(JSON.stringify(outcome.value, null, 2));
|
|
375
375
|
if (outcome.error !== void 0) io.err(`error: ${sanitizeTerminalText(outcome.error.message)}`);
|
|
376
|
+
reportSemanticTerminal(outcome, io);
|
|
376
377
|
if (outcome.dropped.length > 0) io.err(`dropped: ${outcome.dropped.length} item(s)`);
|
|
377
378
|
for (const pending of outcome.pending) io.err(`pending: ${sanitizeTerminalText(pending.key)} (entry ${pending.entryRef})`);
|
|
378
379
|
io.err(`cost: $${outcome.cost.totalUsd.toFixed(4)}${outcome.cost.usageApprox === true ? " (approximate: some usage was estimated, not reported by the provider)" : ""}`);
|
|
@@ -385,6 +386,42 @@ function reportOutcome(outcome, io) {
|
|
|
385
386
|
default: return 1;
|
|
386
387
|
}
|
|
387
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* What the terminal CLAIMS, printed beside what it transported
|
|
391
|
+
* (RV2703).
|
|
392
|
+
*
|
|
393
|
+
* `status` answers whether the run ran. It has never answered whether
|
|
394
|
+
* the work is done, whether the artifact passed the contract it
|
|
395
|
+
* declared, or what the children produced when nothing judged them,
|
|
396
|
+
* and until this shipped a human reading `rulvar run` saw `status: ok`
|
|
397
|
+
* for an accepted-with-degradation run, for a run whose declared
|
|
398
|
+
* finish contract refused every candidate it was handed, and for a
|
|
399
|
+
* clean one, with no line between them. `--strict` has read those
|
|
400
|
+
* fields since RV2604, but strict is the MACHINE gate: a person who
|
|
401
|
+
* does not pass the flag was left with exactly the blindness two
|
|
402
|
+
* releases went into curing.
|
|
403
|
+
*
|
|
404
|
+
* Absence prints nothing, in every line below (RV1209): no contract
|
|
405
|
+
* declared means nobody judged anything, which is not a verdict and
|
|
406
|
+
* must not be rendered as one.
|
|
407
|
+
*/
|
|
408
|
+
function reportSemanticTerminal(outcome, io) {
|
|
409
|
+
if (outcome.completion !== void 0) io.err(`completion: ${outcome.completion}` + (outcome.completion === "complete" ? "" : " (the work is NOT complete)"));
|
|
410
|
+
for (const reason of outcome.degradedReasons ?? []) io.err(` degraded: ${sanitizeTerminalText(reason)}`);
|
|
411
|
+
if (outcome.deliverableAccepted !== void 0) io.err(`deliverable: ${outcome.deliverableAccepted ? "accepted by the declared finish contract" : "REFUSED by the declared finish contract"}` + (outcome.resultAvailable === false ? "; the terminal carries no artifact" : ""));
|
|
412
|
+
const rejected = outcome.rejectedFinishCandidates ?? [];
|
|
413
|
+
if (rejected.length > 0) {
|
|
414
|
+
const distinct = new Set(rejected.map((row) => row.hash)).size;
|
|
415
|
+
io.err(`rejected finish candidates: ${rejected.length}` + (distinct === rejected.length ? "" : ` (${distinct} distinct document(s))`));
|
|
416
|
+
}
|
|
417
|
+
const roster = outcome.childrenAtFailure;
|
|
418
|
+
if (roster !== void 0) {
|
|
419
|
+
const statuses = Object.entries(roster.statusCounts).map(([status, count]) => `${sanitizeTerminalText(status)} ${count}`).join(", ");
|
|
420
|
+
io.err(`children at failure: ${roster.spawned} spawned, ${roster.settled} settled` + (statuses === "" ? "" : ` (${statuses})`) + "; no acceptance verdict was ever rendered");
|
|
421
|
+
if (roster.belowFloorOkChildren !== void 0) io.err(` settled ok below their declared evidence floor: ${roster.belowFloorOkChildren.length}`);
|
|
422
|
+
if (roster.unsettled !== void 0) io.err(` still running when the run gave up: ${roster.unsettled.length}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
388
425
|
/** The closed grade vocabulary strict accepts from a persisted meta. */
|
|
389
426
|
const COVERAGE_GRADES = [
|
|
390
427
|
"full",
|
|
@@ -427,6 +464,14 @@ function coverageGradeOf(value) {
|
|
|
427
464
|
* pass through unchanged, so the flag never masks the ordinary status
|
|
428
465
|
* exit and never bites a plain workflow.
|
|
429
466
|
*
|
|
467
|
+
* Completion answers for the CHILDREN, never for the artifact, so
|
|
468
|
+
* strict also reads the deliverable verdict (RV2604): a
|
|
469
|
+
* `deliverableAccepted: false` exits nonzero even under a green
|
|
470
|
+
* completion, the row the twenty-fifth comparison run landed on when
|
|
471
|
+
* its child roster passed and its declared contract refused every
|
|
472
|
+
* synthesis. An ABSENT verdict is left alone, because nothing judged
|
|
473
|
+
* anything and a host that declares no contract is its own judge.
|
|
474
|
+
*
|
|
430
475
|
* Completion is a MECHANICAL verdict, and the eighteenth comparison
|
|
431
476
|
* benchmark showed how easily `completion: 'complete'` reads as
|
|
432
477
|
* semantic green while the claim judge saw 40 of 144 citing sentences.
|
|
@@ -453,6 +498,10 @@ function strictExitCode(outcome, base, io) {
|
|
|
453
498
|
for (const reason of reasons.filter((entry) => typeof entry === "string")) io.err(` ${sanitizeTerminalText(reason)}`);
|
|
454
499
|
return 1;
|
|
455
500
|
}
|
|
501
|
+
if (outcome.deliverableAccepted === false) {
|
|
502
|
+
io.err("strict: the declared finish contract did not accept the artifact this run settled on" + (outcome.resultAvailable === false ? ", and the terminal carries no artifact at all" : ""));
|
|
503
|
+
return 1;
|
|
504
|
+
}
|
|
456
505
|
const grade = coverageGradeOf(value);
|
|
457
506
|
if (grade === "judge-failed" || grade === "judge-declined" || grade === "critical-uncovered") {
|
|
458
507
|
io.err(`strict: claim coverage '${grade}': ` + (grade === "judge-failed" ? "the claim-consistency judge did not settle ok, so nothing was judged" : grade === "judge-declined" ? "the claim-consistency judge was refused admission and never dispatched, so nothing was judged" : "declared critical anchors got no judged pair"));
|
|
@@ -1209,6 +1258,31 @@ async function inspectCommand(argv, context) {
|
|
|
1209
1258
|
context.io.out(`entries: ${entries.length}`);
|
|
1210
1259
|
for (const [kind, count] of [...byKind.entries()].sort((a, b) => a[0].localeCompare(b[0]))) context.io.out(` ${kind}: ${count}`);
|
|
1211
1260
|
context.io.out(`open suspensions: ${openSuspensions}`);
|
|
1261
|
+
const logical = logicalRunTelemetry(entries);
|
|
1262
|
+
if (logical.segments > 0) {
|
|
1263
|
+
context.io.out(`segments: ${logical.segments} (${logical.statuses.map((status, index) => `${sanitizeTerminalText(status)} after ${String(logical.entriesPerSegment[index] ?? 0)}`).join(", ")})`);
|
|
1264
|
+
if (logical.entriesAfterLastSettle > 0) context.io.out(` entries after the last settle: ${logical.entriesAfterLastSettle}`);
|
|
1265
|
+
}
|
|
1266
|
+
const settled = lastRunSettle(entries);
|
|
1267
|
+
if (settled?.completion !== void 0) context.io.out(`completion: ${settled.completion}` + (settled.completion === "complete" ? " (the last settle claims the work is complete)" : " (the last settle claims the work is NOT complete)"));
|
|
1268
|
+
for (const roster of childRostersFromJournal(entries)) {
|
|
1269
|
+
const statusCounts = /* @__PURE__ */ new Map();
|
|
1270
|
+
for (const child of roster.children) if (child.status !== void 0) statusCounts.set(child.status, (statusCounts.get(child.status) ?? 0) + 1);
|
|
1271
|
+
const settledChildren = roster.children.filter((child) => child.status !== void 0);
|
|
1272
|
+
const statuses = [...statusCounts.entries()].map(([status, count]) => `${sanitizeTerminalText(status)} ${String(count)}`).join(", ");
|
|
1273
|
+
context.io.out(`children under ${sanitizeTerminalText(roster.childScope)}: ${roster.admitted} admitted, ${settledChildren.length} settled` + (statuses === "" ? "" : ` (${statuses})`) + (roster.rejected === 0 ? "" : `; ${roster.rejected} refused admission`));
|
|
1274
|
+
if (roster.children.length < roster.admitted) context.io.out(` admitted with no dispatch entry: ${roster.admitted - roster.children.length}`);
|
|
1275
|
+
const belowFloor = roster.children.filter((child) => child.status === "ok" && child.evidence?.met === false);
|
|
1276
|
+
if (belowFloor.length > 0) context.io.out(` settled ok below their declared evidence floor: ${belowFloor.length} (handle${belowFloor.length === 1 ? "" : "s"} ${belowFloor.map((child) => String(child.handle)).join(", ")})`);
|
|
1277
|
+
const unsettled = roster.children.filter((child) => child.status === void 0);
|
|
1278
|
+
if (unsettled.length > 0) context.io.out(` dispatched with no terminal in the journal: ${unsettled.length} (handle${unsettled.length === 1 ? "" : "s"} ${unsettled.map((child) => String(child.handle)).join(", ")})`);
|
|
1279
|
+
}
|
|
1280
|
+
const rejected = settled?.rejectedFinishCandidates ?? [];
|
|
1281
|
+
if (rejected.length > 0) {
|
|
1282
|
+
const distinct = new Set(rejected.map((row) => row.hash)).size;
|
|
1283
|
+
context.io.out(`rejected finish candidates: ${rejected.length}` + (distinct === rejected.length ? "" : ` (${distinct} distinct document(s))`));
|
|
1284
|
+
for (const row of rejected) context.io.out(` ${sanitizeTerminalText(row.verdict)} ${sanitizeTerminalText(row.callId)}: ${row.chars} chars, sha256 ${row.hash.slice(0, 12)}, failed ${row.failed.map((entry) => sanitizeTerminalText(entry.name)).join(", ")}` + (row.ref === void 0 ? "" : ` (bytes at ${sanitizeTerminalText(row.ref)})`));
|
|
1285
|
+
}
|
|
1212
1286
|
const inspectSnapshot = journalPricingSnapshot(entries);
|
|
1213
1287
|
const cost = costReportFromJournal(entries, inspectSnapshot === void 0 ? assembled.priceUsd : inspectSnapshot.composedPriceUsd(assembled.priceUsd));
|
|
1214
1288
|
context.io.out(`cost: $${cost.totalUsd.toFixed(4)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230.0",
|
|
4
4
|
"description": "Rulvar shell: run/resume/runs/inspect/plan/kb commands, TUI progress, createServer, createWorker, OTel exporter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/core": "1.
|
|
25
|
+
"@rulvar/core": "1.230.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.1",
|
|
29
29
|
"tsdown": "^0.22.14",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"@rulvar/
|
|
32
|
-
"@rulvar/planner": "1.
|
|
33
|
-
"@rulvar/
|
|
34
|
-
"@rulvar/
|
|
35
|
-
"@rulvar/plan": "1.
|
|
31
|
+
"@rulvar/testing": "1.230.0",
|
|
32
|
+
"@rulvar/planner": "1.230.0",
|
|
33
|
+
"@rulvar/store-sqlite": "1.230.0",
|
|
34
|
+
"@rulvar/evals": "1.230.0",
|
|
35
|
+
"@rulvar/plan": "1.230.0"
|
|
36
36
|
},
|
|
37
37
|
"bin": {
|
|
38
38
|
"rulvar": "./dist/cli.js"
|