rlm-cli 0.2.22 → 0.2.23
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/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
|
|