rlm-cli 0.2.19 → 0.2.20

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/config.js CHANGED
@@ -56,12 +56,13 @@ export function loadConfig() {
56
56
  try {
57
57
  const raw = fs.readFileSync(configPath, "utf-8");
58
58
  const parsed = parseYaml(raw);
59
+ const clamp = (v, min, max, def) => typeof v === "number" && isFinite(v) ? Math.max(min, Math.min(max, Math.round(v))) : def;
59
60
  return {
60
- max_iterations: typeof parsed.max_iterations === "number" ? parsed.max_iterations : DEFAULTS.max_iterations,
61
- max_depth: typeof parsed.max_depth === "number" ? parsed.max_depth : DEFAULTS.max_depth,
62
- max_sub_queries: typeof parsed.max_sub_queries === "number" ? parsed.max_sub_queries : DEFAULTS.max_sub_queries,
63
- truncate_len: typeof parsed.truncate_len === "number" ? parsed.truncate_len : DEFAULTS.truncate_len,
64
- metadata_preview_lines: typeof parsed.metadata_preview_lines === "number" ? parsed.metadata_preview_lines : DEFAULTS.metadata_preview_lines,
61
+ max_iterations: clamp(parsed.max_iterations, 1, 100, DEFAULTS.max_iterations),
62
+ max_depth: clamp(parsed.max_depth, 1, 10, DEFAULTS.max_depth),
63
+ max_sub_queries: clamp(parsed.max_sub_queries, 1, 500, DEFAULTS.max_sub_queries),
64
+ truncate_len: clamp(parsed.truncate_len, 500, 50000, DEFAULTS.truncate_len),
65
+ metadata_preview_lines: clamp(parsed.metadata_preview_lines, 5, 100, DEFAULTS.metadata_preview_lines),
65
66
  };
66
67
  }
67
68
  catch {
package/dist/env.js CHANGED
@@ -22,7 +22,11 @@ function loadEnvFile(filePath) {
22
22
  if (eqIndex === -1)
23
23
  continue;
24
24
  const key = trimmed.slice(0, eqIndex).trim();
25
- const value = trimmed.slice(eqIndex + 1).trim();
25
+ let value = trimmed.slice(eqIndex + 1).trim();
26
+ // Strip matching surrounding quotes ("..." or '...')
27
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
28
+ value = value.slice(1, -1);
29
+ }
26
30
  if (key && !process.env[key]) {
27
31
  process.env[key] = value;
28
32
  }
@@ -1399,11 +1399,16 @@ async function interactive() {
1399
1399
  if (!contextText) {
1400
1400
  const { filePath, query: extractedQuery } = extractFilePath(query);
1401
1401
  if (filePath) {
1402
- contextText = fs.readFileSync(filePath, "utf-8");
1403
- contextSource = path.basename(filePath);
1404
- const lines = contextText.split("\n").length;
1405
- console.log(` ${c.green}✓${c.reset} Loaded ${c.bold}${contextText.length.toLocaleString()}${c.reset} chars (${lines} lines) from ${c.underline}${filePath}${c.reset}`);
1406
- query = extractedQuery || query;
1402
+ try {
1403
+ contextText = fs.readFileSync(filePath, "utf-8");
1404
+ contextSource = path.basename(filePath);
1405
+ const lines = contextText.split("\n").length;
1406
+ console.log(` ${c.green}✓${c.reset} Loaded ${c.bold}${contextText.length.toLocaleString()}${c.reset} chars (${lines} lines) from ${c.underline}${filePath}${c.reset}`);
1407
+ query = extractedQuery || query;
1408
+ }
1409
+ catch (err) {
1410
+ console.log(` ${c.red}Could not read file: ${err.message}${c.reset}`);
1411
+ }
1407
1412
  }
1408
1413
  }
1409
1414
  // Run query
package/dist/viewer.js CHANGED
@@ -639,7 +639,14 @@ async function main() {
639
639
  console.error(`${c.red}File not found: ${filePath}${c.reset}`);
640
640
  process.exit(1);
641
641
  }
642
- const traj = JSON.parse(fs.readFileSync(filePath, "utf-8"));
642
+ let traj;
643
+ try {
644
+ traj = JSON.parse(fs.readFileSync(filePath, "utf-8"));
645
+ }
646
+ catch (err) {
647
+ console.error(`${c.red}Could not parse trajectory file: ${err.message}${c.reset}`);
648
+ process.exit(1);
649
+ }
643
650
  if (!traj.iterations || traj.iterations.length === 0) {
644
651
  console.error(`${c.red}Trajectory has no iterations (empty run).${c.reset}`);
645
652
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rlm-cli",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Standalone CLI for Recursive Language Models (RLMs) — implements Algorithm 1 from arXiv:2512.24601",
5
5
  "type": "module",
6
6
  "bin": {