@rulvar/cli 1.91.0 → 1.92.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-dDNXMGHN.js";
2
+ import { r as runCli, t as processIo } from "./io--eTUZmOn.js";
3
3
  import { sanitizeTerminalText } from "@rulvar/core";
4
4
  import { inspect } from "node:util";
5
5
  //#region src/cli.ts
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as loadCliConfig, a as invoiceCommand, c as runCommand, d as reportOutcome, f as strictExitCode, g as assembleEngine, h as DEFAULT_STORE_DIR, i as inspectCommand, l as runsLsCommand, m as renderEventLine, n as HELP, o as preflightCommand, p as attachProgress, r as runCli, s as resumeCommand, t as processIo, u as driveRun, v as loadWorkflowModule, y as looksLikeFile } from "./io-dDNXMGHN.js";
2
- import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, maskSecrets, normalizeEntry, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
1
+ import { _ as loadCliConfig, a as invoiceCommand, c as runCommand, d as reportOutcome, f as strictExitCode, g as assembleEngine, h as DEFAULT_STORE_DIR, i as inspectCommand, l as runsLsCommand, m as renderEventLine, n as HELP, o as preflightCommand, p as attachProgress, r as runCli, s as resumeCommand, t as processIo, u as driveRun, v as loadWorkflowModule, y as looksLikeFile } from "./io--eTUZmOn.js";
2
+ import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, compileSecretMasker, costReportFromJournal, journalPricingSnapshot, maskSecrets, normalizeEntry, readRunMeta, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
3
3
  //#region src/server.ts
4
4
  /**
5
5
  * createServer (M8-T01): the HTTP shell over the public engine API
@@ -513,7 +513,8 @@ function createServer(options) {
513
513
  code: "config",
514
514
  message: `run '${runId}' not found`
515
515
  } });
516
- return json(200, costReportFromJournal((await journal.load(runId)).map((raw) => normalizeEntry(raw)), options.priceUsd ?? (() => void 0)));
516
+ const entries = (await journal.load(runId)).map((raw) => normalizeEntry(raw));
517
+ return json(200, costReportFromJournal(entries, journalPricingSnapshot(entries)?.priceUsd ?? options.priceUsd ?? (() => void 0)));
517
518
  }
518
519
  async function route(req) {
519
520
  const path = new URL(req.url).pathname;
@@ -1,4 +1,4 @@
1
- import { ConfigError, FileModelKnowledgeStore, INBOX_PROPOSAL_TTL_DAYS, JsonlFileStore, LeaseHeldError, auditRuns, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, hashRunArgs, hashRunOutput, invoiceFromJournal, 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, claimExpired, claimExpiry, compilePermissionPreset, costReportFromJournal, createEngine, hashRunArgs, hashRunOutput, invoiceFromJournal, journalPricingSnapshot, lastRunSettle, 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";
@@ -1100,8 +1100,10 @@ async function inspectCommand(argv, context) {
1100
1100
  context.io.out(`entries: ${entries.length}`);
1101
1101
  for (const [kind, count] of [...byKind.entries()].sort((a, b) => a[0].localeCompare(b[0]))) context.io.out(` ${kind}: ${count}`);
1102
1102
  context.io.out(`open suspensions: ${openSuspensions}`);
1103
- const cost = costReportFromJournal(entries, assembled.priceUsd);
1103
+ const inspectSnapshot = journalPricingSnapshot(entries);
1104
+ const cost = costReportFromJournal(entries, inspectSnapshot?.priceUsd ?? assembled.priceUsd);
1104
1105
  context.io.out(`cost: $${cost.totalUsd.toFixed(4)}`);
1106
+ if (inspectSnapshot !== void 0) context.io.out("pricing: run-settle snapshot" + (inspectSnapshot.pricingVersion === void 0 ? "" : ` (${inspectSnapshot.pricingVersion})`));
1105
1107
  if (cost.abandoned.usd > 0) context.io.out(`gross: $${cost.grossUsd.toFixed(4)} (abandoned: $${cost.abandoned.usd.toFixed(4)}; see rulvar invoice)`);
1106
1108
  for (const [model, usd] of Object.entries(cost.byModel)) context.io.out(` ${model}: $${usd.toFixed(4)}`);
1107
1109
  for (const item of cost.unpriced) context.io.out(` unpriced: ${item.model} (${item.usage.inputTokens + item.usage.outputTokens} tok)`);
@@ -1137,7 +1139,13 @@ async function invoiceCommand(argv, context) {
1137
1139
  });
1138
1140
  const meta = await readRunMeta(assembled.store, runId);
1139
1141
  if (meta === void 0) throw new ConfigError(`run '${runId}' not found in the store`);
1140
- const invoice = invoiceFromJournal(await assembled.store.load(runId), assembled.priceUsd);
1142
+ const entries = await assembled.store.load(runId);
1143
+ const snapshot = journalPricingSnapshot(entries);
1144
+ const invoice = invoiceFromJournal(entries, snapshot?.priceUsd ?? assembled.priceUsd, { pricing: snapshot === void 0 ? { source: "current-table" } : {
1145
+ source: "snapshot",
1146
+ ...snapshot.pricingVersion === void 0 ? {} : { pricingVersion: snapshot.pricingVersion },
1147
+ rows: snapshot.rows
1148
+ } });
1141
1149
  if (json) {
1142
1150
  context.io.out(JSON.stringify(invoice, null, 2));
1143
1151
  return 0;
@@ -1146,6 +1154,7 @@ async function invoiceCommand(argv, context) {
1146
1154
  context.io.out(`gross: $${invoice.totalUsd.toFixed(4)} | net: $${invoice.netUsd.toFixed(4)} | abandoned: $${invoice.abandonedUsd.toFixed(4)}${invoice.usageApprox === true ? " (approx)" : ""}`);
1147
1155
  context.io.out(`rows: ${invoice.rows.length} (reconciliation failures: ${invoice.reconciliationFailures}${invoice.usageUnknownRows === void 0 ? "" : `; usage unknown: ${invoice.usageUnknownRows}`})`);
1148
1156
  context.io.out(`pricing basis: ${invoice.pricingBasis} (row usd is non-additive; allocatedUsd sums to gross)`);
1157
+ context.io.out(invoice.pricing?.source === "snapshot" ? "pricing rates: run-settle snapshot" + (invoice.pricing.pricingVersion === void 0 ? "" : ` (${invoice.pricing.pricingVersion})`) : "pricing rates: current table (no snapshot in the journal)");
1149
1158
  for (const row of invoice.rows) {
1150
1159
  const usd = row.usd === void 0 ? "unpriced" : `$${row.usd.toFixed(4)}`;
1151
1160
  const tokens = row.usage.inputTokens + row.usage.outputTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/cli",
3
- "version": "1.91.0",
3
+ "version": "1.92.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.91.0"
25
+ "@rulvar/core": "1.92.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.91.0",
32
- "@rulvar/planner": "1.91.0",
33
- "@rulvar/plan": "1.91.0",
34
- "@rulvar/store-sqlite": "1.91.0",
35
- "@rulvar/evals": "1.91.0"
31
+ "@rulvar/store-sqlite": "1.92.0",
32
+ "@rulvar/plan": "1.92.0",
33
+ "@rulvar/planner": "1.92.0",
34
+ "@rulvar/testing": "1.92.0",
35
+ "@rulvar/evals": "1.92.0"
36
36
  },
37
37
  "bin": {
38
38
  "rulvar": "./dist/cli.js"