rlm-cli 0.2.22 → 0.2.24
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/main.js +3 -2
- package/dist/repl.js +28 -5
- package/dist/runtime.py +4 -0
- package/dist/viewer.js +15 -14
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -31,7 +31,7 @@ const HELP = `
|
|
|
31
31
|
\x1b[1mCONFIGURATION\x1b[0m
|
|
32
32
|
.env file:
|
|
33
33
|
ANTHROPIC_API_KEY=sk-ant-...
|
|
34
|
-
RLM_MODEL=claude-sonnet-4-
|
|
34
|
+
RLM_MODEL=claude-sonnet-4-6
|
|
35
35
|
|
|
36
36
|
rlm_config.yaml:
|
|
37
37
|
max_iterations: 20
|
|
@@ -125,7 +125,8 @@ async function main() {
|
|
|
125
125
|
}
|
|
126
126
|
default: {
|
|
127
127
|
if (command.startsWith("--")) {
|
|
128
|
-
// Flags without subcommand → assume "run"
|
|
128
|
+
// Flags without subcommand → assume "run", pass all args through
|
|
129
|
+
process.argv = [process.argv[0], process.argv[1], ...args];
|
|
129
130
|
await import("./cli.js");
|
|
130
131
|
}
|
|
131
132
|
else {
|
package/dist/repl.js
CHANGED
|
@@ -92,17 +92,35 @@ export class PythonRepl {
|
|
|
92
92
|
/** Gracefully shut down the Python subprocess. */
|
|
93
93
|
shutdown() {
|
|
94
94
|
if (this.proc && this.proc.exitCode === null) {
|
|
95
|
+
const proc = this.proc;
|
|
95
96
|
try {
|
|
96
97
|
this.send({ type: "shutdown" });
|
|
97
98
|
}
|
|
98
99
|
catch {
|
|
99
100
|
// stdin may already be closed
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
if (process.platform === "win32") {
|
|
103
|
+
// Windows: SIGTERM is ignored, kill immediately
|
|
104
|
+
try {
|
|
105
|
+
proc.kill("SIGKILL");
|
|
106
|
+
}
|
|
107
|
+
catch { /* already dead */ }
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// Unix: give Python 500ms to exit gracefully, then force kill
|
|
111
|
+
const killTimer = setTimeout(() => {
|
|
112
|
+
try {
|
|
113
|
+
if (proc.exitCode === null)
|
|
114
|
+
proc.kill("SIGKILL");
|
|
115
|
+
}
|
|
116
|
+
catch { }
|
|
117
|
+
}, 500);
|
|
118
|
+
proc.on("exit", () => clearTimeout(killTimer));
|
|
119
|
+
try {
|
|
120
|
+
proc.kill("SIGTERM");
|
|
121
|
+
}
|
|
122
|
+
catch { /* already dead */ }
|
|
104
123
|
}
|
|
105
|
-
catch { /* already dead */ }
|
|
106
124
|
}
|
|
107
125
|
this.cleanup();
|
|
108
126
|
}
|
|
@@ -111,7 +129,12 @@ export class PythonRepl {
|
|
|
111
129
|
if (!this.proc || !this.proc.stdin || this.proc.stdin.destroyed) {
|
|
112
130
|
throw new Error("REPL subprocess is not running");
|
|
113
131
|
}
|
|
114
|
-
|
|
132
|
+
try {
|
|
133
|
+
this.proc.stdin.write(`${JSON.stringify(msg)}\n`);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
throw new Error("REPL subprocess stdin write failed");
|
|
137
|
+
}
|
|
115
138
|
}
|
|
116
139
|
handleLine(line) {
|
|
117
140
|
const trimmed = line.trim();
|
package/dist/runtime.py
CHANGED
|
@@ -37,12 +37,16 @@ __final_result__ = None
|
|
|
37
37
|
def FINAL(x):
|
|
38
38
|
"""Set the final answer as a string and terminate the RLM loop."""
|
|
39
39
|
global __final_result__
|
|
40
|
+
if __final_result__ is not None:
|
|
41
|
+
print(f"[Warning] FINAL() called again — overwriting previous answer", file=sys.stderr)
|
|
40
42
|
__final_result__ = str(x)
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
def FINAL_VAR(x):
|
|
44
46
|
"""Set the final answer from a variable and terminate the RLM loop."""
|
|
45
47
|
global __final_result__
|
|
48
|
+
if __final_result__ is not None and x is not None:
|
|
49
|
+
print(f"[Warning] FINAL_VAR() called again — overwriting previous answer", file=sys.stderr)
|
|
46
50
|
__final_result__ = str(x) if x is not None else None
|
|
47
51
|
|
|
48
52
|
|
package/dist/viewer.js
CHANGED
|
@@ -336,16 +336,18 @@ function renderIteration(state) {
|
|
|
336
336
|
if (state.scrollY < 0)
|
|
337
337
|
state.scrollY = 0;
|
|
338
338
|
const from = state.scrollY;
|
|
339
|
-
|
|
339
|
+
// Reserve lines for scroll indicators when needed
|
|
340
|
+
const hasScrollUp = from > 0;
|
|
341
|
+
const hasScrollDown = (from + viewable) < allLines.length;
|
|
342
|
+
const contentLines = viewable - (hasScrollUp ? 1 : 0) - (hasScrollDown ? 1 : 0);
|
|
343
|
+
const to = Math.min(allLines.length, from + contentLines);
|
|
340
344
|
W(c.cursorHome, c.clearScreen, c.hideCursor);
|
|
341
|
-
|
|
342
|
-
if (from > 0) {
|
|
345
|
+
if (hasScrollUp) {
|
|
343
346
|
W(` ${c.dim}^ scroll up (${from} lines above)${c.reset}\n`);
|
|
344
347
|
}
|
|
345
348
|
for (let i = from; i < to; i++)
|
|
346
349
|
W(allLines[i] + "\n");
|
|
347
|
-
if (
|
|
348
|
-
// Replace last visible line with scroll indicator
|
|
350
|
+
if (hasScrollDown) {
|
|
349
351
|
W(` ${c.dim}v scroll down (${allLines.length - to} lines below)${c.reset}\n`);
|
|
350
352
|
}
|
|
351
353
|
// Footer
|
|
@@ -517,18 +519,17 @@ function renderSubQueryDetail(state) {
|
|
|
517
519
|
if (state.scrollY < 0)
|
|
518
520
|
state.scrollY = 0;
|
|
519
521
|
const from = state.scrollY;
|
|
520
|
-
const
|
|
522
|
+
const hasScrollUp = from > 0;
|
|
523
|
+
const hasScrollDown = (from + viewable) < allLines.length;
|
|
524
|
+
const contentLines = viewable - (hasScrollUp ? 1 : 0) - (hasScrollDown ? 1 : 0);
|
|
525
|
+
const to = Math.min(allLines.length, from + contentLines);
|
|
521
526
|
W(c.cursorHome, c.clearScreen, c.hideCursor);
|
|
522
|
-
if (
|
|
527
|
+
if (hasScrollUp) {
|
|
523
528
|
W(` ${c.dim}^ scroll up (${from} lines above)${c.reset}\n`);
|
|
524
|
-
for (let i = from + 1; i < to; i++)
|
|
525
|
-
W(allLines[i] + "\n");
|
|
526
529
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
if (to < allLines.length) {
|
|
530
|
+
for (let i = from; i < to; i++)
|
|
531
|
+
W(allLines[i] + "\n");
|
|
532
|
+
if (hasScrollDown) {
|
|
532
533
|
W(` ${c.dim}v scroll down (${allLines.length - to} lines below)${c.reset}\n`);
|
|
533
534
|
}
|
|
534
535
|
// Footer
|