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 +6 -5
- package/dist/env.js +5 -1
- package/dist/interactive.js +10 -5
- package/dist/viewer.js +8 -1
- package/package.json +1 -1
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:
|
|
61
|
-
max_depth:
|
|
62
|
-
max_sub_queries:
|
|
63
|
-
truncate_len:
|
|
64
|
-
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
|
-
|
|
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
|
}
|
package/dist/interactive.js
CHANGED
|
@@ -1399,11 +1399,16 @@ async function interactive() {
|
|
|
1399
1399
|
if (!contextText) {
|
|
1400
1400
|
const { filePath, query: extractedQuery } = extractFilePath(query);
|
|
1401
1401
|
if (filePath) {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
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
|
-
|
|
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);
|