@rulvar/cli 1.24.0 → 1.24.1

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-CL4wldEQ.js";
2
+ import { r as runCli, t as processIo } from "./io-CV_G44A2.js";
3
3
  import { inspect } from "node:util";
4
4
  //#region src/cli.ts
5
5
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-CL4wldEQ.js";
1
+ import { a as resumeCommand, c as driveRun, d as renderEventLine, f as DEFAULT_STORE_DIR, g as looksLikeFile, h as loadWorkflowModule, i as inspectCommand, l as reportOutcome, m as loadCliConfig, n as HELP, o as runCommand, p as assembleEngine, r as runCli, s as runsLsCommand, t as processIo, u as attachProgress } from "./io-CV_G44A2.js";
2
2
  import { ConfigError, InvalidResolutionError, JournalCompatibilityError, LeaseHeldError, Replayer, RulvarError, buildDeriverRegistry, costReportFromJournal, maskSecrets, normalizeEntry, scanJournalCompatibility, validateSchemaSpec } from "@rulvar/core";
3
3
  //#region src/server.ts
4
4
  /**
@@ -641,14 +641,35 @@ async function loadCompanion(loading, specifier, command, missingMessage) {
641
641
  throw new Error(`${command}: ${specifier} is installed but failed to load; the cause below is a defect in the installed package or its dependencies, not a missing install`, { cause: error });
642
642
  }
643
643
  }
644
- /** Parses --args JSON into workflow arguments; undefined when absent. */
644
+ /**
645
+ * Parses --args JSON into workflow arguments; undefined when absent.
646
+ *
647
+ * CLI args must be representable in canonical JCS, i.e. finite JSON. A
648
+ * numeric literal that overflows JavaScript's finite range parses to
649
+ * Infinity, which `hashRunArgs` cannot canonicalize, so genesis would
650
+ * record `argsProvided` WITHOUT a hash and the resume gate would soften
651
+ * to an unverifiable warning that lets changed args through (v1.24.0
652
+ * review P2-1). A CLI value always arrives as JSON text, so it can
653
+ * always be canonicalized; reject the non-finite case here, before any
654
+ * config, store, or adapter loads, instead of letting it defeat the gate
655
+ * later. In-process hosts keep the wider engine contract (functions,
656
+ * BigInt, cycles record presence without a hash); the CLI does not need
657
+ * it.
658
+ */
645
659
  function parseArgsJson(raw) {
646
660
  if (raw === void 0) return;
661
+ let parsed;
647
662
  try {
648
- return JSON.parse(raw);
663
+ parsed = JSON.parse(raw);
649
664
  } catch {
650
665
  throw new ConfigError(`--args is not valid JSON: ${raw}`);
651
666
  }
667
+ try {
668
+ hashRunArgs(parsed);
669
+ } catch {
670
+ throw new ConfigError(`--args is not representable as canonical JSON: a numeric value overflows JavaScript's finite range (e.g. 1e400 parses to Infinity). Supply finite JSON so the run's args binding can be hashed and later verified on resume: ${raw}`);
671
+ }
672
+ return parsed;
652
673
  }
653
674
  async function runCommand(argv, context) {
654
675
  const parsed = parseCommand(GRAMMAR.run, argv);
@@ -702,10 +723,16 @@ function enforceArgsBinding(input) {
702
723
  return;
703
724
  }
704
725
  if (meta.argsHash === void 0) {
705
- io.err(`warning: run '${meta.runId}' recorded args presence but no hash (the genesis args were not JCS-serializable); the supplied --args cannot be verified`);
726
+ if (!allowChange) throw new ConfigError(`run '${meta.runId}' started WITH args but recorded no verifiable hash (the genesis args were not JCS-serializable), so the CLI cannot confirm the supplied --args match the original; resuming risks silently changing the logical run and re-paying every args-dependent call. Force deliberately with --allow-args-change; ${usageOf(GRAMMAR.resume)}`);
727
+ io.err(`warning: run '${meta.runId}' recorded args presence but no hash (genesis args not JCS-serializable); the supplied --args cannot be verified (--allow-args-change)`);
706
728
  return;
707
729
  }
708
- const supplied = hashRunArgs(args);
730
+ let supplied;
731
+ try {
732
+ supplied = hashRunArgs(args);
733
+ } catch {
734
+ throw new ConfigError(`--args cannot be canonicalized to compare against run '${meta.runId}' (a numeric value overflows the finite range, or the value is otherwise not canonical JSON); supply finite JSON, or force the resume with --allow-args-change; ${usageOf(GRAMMAR.resume)}`);
735
+ }
709
736
  if (supplied !== meta.argsHash) {
710
737
  if (!allowChange) throw new ConfigError(`--args does not match the args run '${meta.runId}' was started with (recorded hash ${meta.argsHash.slice(0, 12)}, supplied ${supplied?.slice(0, 12) ?? "none"}); changed args silently change the logical run and re-pay every args-dependent call. Force deliberately with --allow-args-change; ${usageOf(GRAMMAR.resume)}`);
711
738
  io.err(`warning: resuming '${meta.runId}' with changed args (--allow-args-change)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/cli",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
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.24.0"
25
+ "@rulvar/core": "1.24.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.20.0",
29
29
  "tsdown": "^0.22.3",
30
30
  "typescript": "~6.0.3",
31
- "@rulvar/testing": "1.24.0",
32
- "@rulvar/store-sqlite": "1.24.0",
33
- "@rulvar/planner": "1.24.0",
34
- "@rulvar/evals": "1.24.0",
35
- "@rulvar/plan": "1.24.0"
31
+ "@rulvar/store-sqlite": "1.24.1",
32
+ "@rulvar/testing": "1.24.1",
33
+ "@rulvar/planner": "1.24.1",
34
+ "@rulvar/plan": "1.24.1",
35
+ "@rulvar/evals": "1.24.1"
36
36
  },
37
37
  "bin": {
38
38
  "rulvar": "./dist/cli.js"