rlm-cli 0.2.11 → 0.2.13
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/LICENSE +21 -0
- package/bin/rlm.mjs +5 -5
- package/dist/config.js +2 -1
- package/dist/env.js +2 -1
- package/dist/repl.js +6 -3
- package/package.json +8 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vipul Maheshwari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/rlm.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* then falls back to tsx for development.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
13
13
|
|
|
@@ -15,8 +15,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
15
15
|
const distEntry = join(__dirname, "..", "dist", "main.js");
|
|
16
16
|
|
|
17
17
|
if (existsSync(distEntry)) {
|
|
18
|
-
// Production: use compiled JS
|
|
19
|
-
await import(distEntry);
|
|
18
|
+
// Production: use compiled JS (pathToFileURL needed for Windows)
|
|
19
|
+
await import(pathToFileURL(distEntry).href);
|
|
20
20
|
} else {
|
|
21
21
|
// Development: use tsx to run TypeScript directly
|
|
22
22
|
const srcEntry = join(__dirname, "..", "src", "main.ts");
|
|
@@ -26,9 +26,9 @@ if (existsSync(distEntry)) {
|
|
|
26
26
|
try {
|
|
27
27
|
const tsxPath = join(__dirname, "..", "node_modules", "tsx", "dist", "esm", "index.mjs");
|
|
28
28
|
if (existsSync(tsxPath)) {
|
|
29
|
-
register(tsxPath);
|
|
29
|
+
register(pathToFileURL(tsxPath).href);
|
|
30
30
|
}
|
|
31
|
-
await import(srcEntry);
|
|
31
|
+
await import(pathToFileURL(srcEntry).href);
|
|
32
32
|
} catch {
|
|
33
33
|
// Fallback: spawn tsx as a child process
|
|
34
34
|
const { spawn } = await import("node:child_process");
|
package/dist/config.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
8
9
|
const DEFAULTS = {
|
|
9
10
|
max_iterations: 20,
|
|
10
11
|
max_depth: 3,
|
|
@@ -48,7 +49,7 @@ export function loadConfig() {
|
|
|
48
49
|
// Search order: cwd, then package root
|
|
49
50
|
const candidates = [
|
|
50
51
|
path.resolve(process.cwd(), "rlm_config.yaml"),
|
|
51
|
-
path.resolve(
|
|
52
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "rlm_config.yaml"),
|
|
52
53
|
];
|
|
53
54
|
for (const configPath of candidates) {
|
|
54
55
|
if (fs.existsSync(configPath)) {
|
package/dist/env.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import * as fs from "node:fs";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import * as os from "node:os";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
12
13
|
function loadEnvFile(filePath) {
|
|
13
14
|
if (!fs.existsSync(filePath))
|
|
14
15
|
return;
|
|
@@ -30,7 +31,7 @@ function loadEnvFile(filePath) {
|
|
|
30
31
|
// 1. Load persistent credentials (~/.rlm/credentials)
|
|
31
32
|
loadEnvFile(path.join(os.homedir(), ".rlm", "credentials"));
|
|
32
33
|
// 2. Load .env from package root (local overrides)
|
|
33
|
-
const __dir = path.dirname(
|
|
34
|
+
const __dir = path.dirname(fileURLToPath(import.meta.url));
|
|
34
35
|
loadEnvFile(path.resolve(__dir, "..", ".env"));
|
|
35
36
|
// Default model
|
|
36
37
|
if (!process.env.RLM_MODEL) {
|
package/dist/repl.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
import * as path from "node:path";
|
|
10
|
+
import * as os from "node:os";
|
|
10
11
|
import * as readline from "node:readline";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
11
13
|
// ── REPL class ──────────────────────────────────────────────────────────────
|
|
12
14
|
export class PythonRepl {
|
|
13
15
|
proc = null;
|
|
@@ -28,13 +30,14 @@ export class PythonRepl {
|
|
|
28
30
|
async start(signal) {
|
|
29
31
|
if (this.isAlive)
|
|
30
32
|
return;
|
|
31
|
-
const runtimePath = path.join(path.dirname(
|
|
32
|
-
|
|
33
|
+
const runtimePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "runtime.py");
|
|
34
|
+
const pythonCmd = process.platform === "win32" ? "python" : "python3";
|
|
35
|
+
this.proc = spawn(pythonCmd, [runtimePath], {
|
|
33
36
|
stdio: ["pipe", "pipe", "pipe"],
|
|
34
37
|
env: {
|
|
35
38
|
// Only pass what Python actually needs — not API keys or secrets
|
|
36
39
|
PATH: process.env.PATH,
|
|
37
|
-
HOME:
|
|
40
|
+
HOME: os.homedir(),
|
|
38
41
|
PYTHONUNBUFFERED: "1",
|
|
39
42
|
},
|
|
40
43
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rlm-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Standalone CLI for Recursive Language Models (RLMs) — implements Algorithm 1 from arXiv:2512.24601",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,14 @@
|
|
|
30
30
|
"cli",
|
|
31
31
|
"agent"
|
|
32
32
|
],
|
|
33
|
+
"author": "Vipul Maheshwari <vim.code.level@gmail.com>",
|
|
33
34
|
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/viplismism/rlm-cli.git"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/viplismism/rlm-cli",
|
|
40
|
+
"bugs": "https://github.com/viplismism/rlm-cli/issues",
|
|
34
41
|
"dependencies": {
|
|
35
42
|
"@mariozechner/pi-ai": "^0.55.1"
|
|
36
43
|
},
|