@rulvar/cli 1.238.0 → 1.240.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { r as runCli, t as processIo } from "./io-Bz-HvxWC.js";
2
+ import { r as runCli, t as processIo } from "./io-CMAEYzZR.js";
3
3
  import { sanitizeTerminalText } from "@rulvar/core";
4
4
  import { inspect } from "node:util";
5
5
  //#region src/cli.ts
package/dist/index.d.ts CHANGED
@@ -62,6 +62,19 @@ declare function invoiceCommand(argv: string[], context: CommandContext): Promis
62
62
  * one summary row each, exit 1 when any run diverges: the parity
63
63
  * sessions audited seven journals one invocation at a time, and a
64
64
  * catalog posture check should cost one command.
65
+ *
66
+ * The orphaned receipt lane (RV3501): when the invoice carries
67
+ * `orphanedReceipts` (RV3405, paid wires the settled terminal's record
68
+ * set does not cover), every output form surfaces it: the single run
69
+ * text prints the lane totals plus one line per receipt, the JSON
70
+ * shapes carry the lane verbatim under `invoice`, and the catalog
71
+ * sweep appends an orphaned suffix to the run's row and a carrying
72
+ * count to its header. The lane never moves the verdict or the exit
73
+ * code: an orphaned receipt is the honest double payment window of a
74
+ * resume, not a divergence, and before this surface a journal in that
75
+ * shape passed all six checks while the money stayed invisible in
76
+ * every printed figure. Journals without the lane render byte for
77
+ * byte as before.
65
78
  */
66
79
  declare function costAuditCommand(argv: string[], context: CommandContext): Promise<number>;
67
80
  /**
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-Bz-HvxWC.js";
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-CMAEYzZR.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
  /**
@@ -1494,7 +1494,8 @@ function costAuditRunJson(runId, audit) {
1494
1494
  invoice: {
1495
1495
  totalUsd: audit.invoice.totalUsd,
1496
1496
  rows: audit.invoice.rows.length,
1497
- wireRequests: audit.invoice.cardinality.wireRequests
1497
+ wireRequests: audit.invoice.cardinality.wireRequests,
1498
+ ...audit.invoice.orphanedReceipts === void 0 ? {} : { orphanedReceipts: audit.invoice.orphanedReceipts }
1498
1499
  },
1499
1500
  checks: audit.checks
1500
1501
  };
@@ -1513,6 +1514,19 @@ function costAuditRunJson(runId, audit) {
1513
1514
  * one summary row each, exit 1 when any run diverges: the parity
1514
1515
  * sessions audited seven journals one invocation at a time, and a
1515
1516
  * catalog posture check should cost one command.
1517
+ *
1518
+ * The orphaned receipt lane (RV3501): when the invoice carries
1519
+ * `orphanedReceipts` (RV3405, paid wires the settled terminal's record
1520
+ * set does not cover), every output form surfaces it: the single run
1521
+ * text prints the lane totals plus one line per receipt, the JSON
1522
+ * shapes carry the lane verbatim under `invoice`, and the catalog
1523
+ * sweep appends an orphaned suffix to the run's row and a carrying
1524
+ * count to its header. The lane never moves the verdict or the exit
1525
+ * code: an orphaned receipt is the honest double payment window of a
1526
+ * resume, not a divergence, and before this surface a journal in that
1527
+ * shape passed all six checks while the money stayed invisible in
1528
+ * every printed figure. Journals without the lane render byte for
1529
+ * byte as before.
1516
1530
  */
1517
1531
  async function costAuditCommand(argv, context) {
1518
1532
  const parsed = parseCommand(GRAMMAR["cost-audit"], argv);
@@ -1537,6 +1551,11 @@ async function costAuditCommand(argv, context) {
1537
1551
  context.io.out(`run ${runId}: cost audit (${audit.failed.length === 0 ? "one denominator" : "DIVERGENT"})`);
1538
1552
  context.io.out(`settled: gross $${audit.report.grossUsd.toFixed(4)} | net $${audit.report.totalUsd.toFixed(4)} | wires ${String(audit.report.wireRequests ?? "absent")}`);
1539
1553
  context.io.out(`invoice: total $${audit.invoice.totalUsd.toFixed(4)} | rows ${String(audit.invoice.rows.length)} | wires ${String(audit.invoice.cardinality.wireRequests)}`);
1554
+ const orphaned = audit.invoice.orphanedReceipts;
1555
+ if (orphaned !== void 0) {
1556
+ context.io.out(`orphaned receipts: $${orphaned.usd.toFixed(4)} | wires ${String(orphaned.wireRequests)} | paid wires the settled terminal does not cover (RV3405), outside the settled totals`);
1557
+ for (const row of orphaned.rows) context.io.out(` agent ${String(row.agentRef)} (${row.scope}) | ordinal ${String(row.ordinal)} attempt ${String(row.attempt)} ${row.outcome} | role ${row.role} | ${row.servedBy} | ${usdOf(row.usd)} | ${row.responseId === void 0 ? "no response id" : `id ${row.responseId}`}`);
1558
+ }
1540
1559
  for (const check of audit.checks) context.io.out(` [${check.pass ? "pass" : "FAIL"}] ${check.name}: ${check.detail}`);
1541
1560
  return audit.failed.length === 0 ? 0 : 1;
1542
1561
  }
@@ -1558,10 +1577,12 @@ async function costAuditCommand(argv, context) {
1558
1577
  }, null, 2));
1559
1578
  return divergent.length === 0 ? 0 : 1;
1560
1579
  }
1561
- context.io.out(`cost audit: ${String(rows.length)} run${rows.length === 1 ? "" : "s"}, ${String(divergent.length)} divergent`);
1580
+ const carryingOrphans = rows.filter((row) => row.audit.invoice.orphanedReceipts !== void 0).length;
1581
+ context.io.out(`cost audit: ${String(rows.length)} run${rows.length === 1 ? "" : "s"}, ${String(divergent.length)} divergent${carryingOrphans === 0 ? "" : `, ${String(carryingOrphans)} carrying orphaned receipts`}`);
1562
1582
  for (const row of rows) {
1563
1583
  const failedNames = row.audit.failed.map((check) => check.name).join(", ");
1564
- context.io.out(` ${row.runId}: ${row.audit.failed.length === 0 ? "one denominator" : "DIVERGENT"} | checks ${String(row.audit.checks.length - row.audit.failed.length)}/${String(row.audit.checks.length)}${failedNames === "" ? "" : ` (failed ${failedNames})`} | gross $${row.audit.report.grossUsd.toFixed(4)} | wires ${String(row.audit.report.wireRequests ?? "absent")}`);
1584
+ const orphanedLane = row.audit.invoice.orphanedReceipts;
1585
+ context.io.out(` ${row.runId}: ${row.audit.failed.length === 0 ? "one denominator" : "DIVERGENT"} | checks ${String(row.audit.checks.length - row.audit.failed.length)}/${String(row.audit.checks.length)}${failedNames === "" ? "" : ` (failed ${failedNames})`} | gross $${row.audit.report.grossUsd.toFixed(4)} | wires ${String(row.audit.report.wireRequests ?? "absent")}${orphanedLane === void 0 ? "" : ` | orphaned $${orphanedLane.usd.toFixed(4)} (${String(orphanedLane.wireRequests)})`}`);
1565
1586
  }
1566
1587
  return divergent.length === 0 ? 0 : 1;
1567
1588
  }
@@ -2180,7 +2201,10 @@ what the provider bills); --json emits the machine-readable form.
2180
2201
  cost-audit verifies the one-denominator contract on a stored run: the
2181
2202
  roster is closed, the settle is the billing boundary, and the settled
2182
2203
  fold, the invoice totals and the wire cardinality agree; exit 1 with
2183
- the failing checks named when any diverge.
2204
+ the failing checks named when any diverge. When the invoice carries
2205
+ orphaned receipts (paid wires the settled terminal does not cover),
2206
+ every output form surfaces the lane; it never moves the verdict or
2207
+ the exit code.
2184
2208
  preflight is the effective-config linter and dry-run estimator: it
2185
2209
  assembles the SAME options rulvar run would (config, module exports,
2186
2210
  --profile, --budget-usd) but constructs no engine and dispatches
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/cli",
3
- "version": "1.238.0",
3
+ "version": "1.240.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.238.0"
25
+ "@rulvar/core": "1.240.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/testing": "1.238.0",
32
- "@rulvar/store-sqlite": "1.238.0",
33
- "@rulvar/plan": "1.238.0",
34
- "@rulvar/evals": "1.238.0",
35
- "@rulvar/planner": "1.238.0"
31
+ "@rulvar/testing": "1.240.0",
32
+ "@rulvar/store-sqlite": "1.240.0",
33
+ "@rulvar/plan": "1.240.0",
34
+ "@rulvar/planner": "1.240.0",
35
+ "@rulvar/evals": "1.240.0"
36
36
  },
37
37
  "bin": {
38
38
  "rulvar": "./dist/cli.js"