loom-agent 1.2.18 → 1.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/bin/loom-bun.js +12 -23
- package/bin/loom-tui.js +8 -15
- package/package.json +1 -1
- package/src/core/cli.js +1 -1
- package/src/tui-preload.js +4 -5
package/bin/loom-bun.js
CHANGED
|
@@ -4,20 +4,23 @@
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const { spawnSync } = require("child_process");
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
7
|
+
// Bun discovers bunfig.toml ONLY from its starting cwd, and the Solid JSX
|
|
8
|
+
// plugin ONLY works when loaded through that bunfig preload phase — runtime
|
|
9
|
+
// registration from another cwd silently no-ops (proven). So unless bun is
|
|
10
|
+
// ALREADY sitting in the package root, respawn it there once. The user's
|
|
11
|
+
// real directory rides along in LOOM_START_CWD and is restored by
|
|
12
|
+
// tui-open.tsx after its imports finish loading.
|
|
13
|
+
const pkgRoot = path.join(__dirname, "..");
|
|
14
|
+
const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
|
|
15
|
+
const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
|
|
16
|
+
if (!underBun || !inPkgRoot) {
|
|
14
17
|
const result = spawnSync(
|
|
15
18
|
process.platform === "win32" ? "bun.exe" : "bun",
|
|
16
19
|
[__filename, ...process.argv.slice(2)],
|
|
17
20
|
{
|
|
18
21
|
stdio: "inherit",
|
|
19
|
-
cwd:
|
|
20
|
-
env: process.env,
|
|
22
|
+
cwd: pkgRoot,
|
|
23
|
+
env: { ...process.env, LOOM_START_CWD: process.env.LOOM_START_CWD || process.cwd() },
|
|
21
24
|
windowsHide: false,
|
|
22
25
|
}
|
|
23
26
|
);
|
|
@@ -27,20 +30,6 @@ if (!(typeof Bun !== "undefined" && process.versions.bun)) {
|
|
|
27
30
|
}
|
|
28
31
|
process.exit(result.status == null ? 1 : result.status);
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
// Running under bun at the USER's cwd. bunfig.toml was therefore NOT loaded
|
|
32
|
-
// (bun only discovers it from its starting cwd), so register its preload
|
|
33
|
-
// chain manually, in the same order, before any app module loads:
|
|
34
|
-
// 1. our crash black-box / console fixes
|
|
35
|
-
// 2. @opentui/solid/preload — the Solid JSX transform plugin
|
|
36
|
-
require(path.join(__dirname, "..", "src", "tui-preload.js"));
|
|
37
|
-
require("@opentui/solid/preload");
|
|
38
|
-
|
|
39
|
-
// Restore the user's project directory before app modules evaluate.
|
|
40
|
-
if (process.env.LOOM_START_CWD) {
|
|
41
|
-
try { process.chdir(process.env.LOOM_START_CWD); } catch {}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
33
|
process.title = "loom-code";
|
|
45
34
|
(async () => {
|
|
46
35
|
try {
|
package/bin/loom-tui.js
CHANGED
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const { spawnSync } = require("child_process");
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// bin/loom-bun.js
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// Respawn from the package root so bunfig.toml's preload chain (Solid JSX
|
|
8
|
+
// transform) loads natively — see bin/loom-bun.js.
|
|
9
|
+
const pkgRoot = path.join(__dirname, "..");
|
|
10
|
+
const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
|
|
11
|
+
const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
|
|
12
|
+
if (!underBun || !inPkgRoot) {
|
|
11
13
|
const result = spawnSync(
|
|
12
14
|
process.platform === "win32" ? "bun.exe" : "bun",
|
|
13
15
|
[__filename, ...process.argv.slice(2)],
|
|
14
16
|
{
|
|
15
17
|
stdio: "inherit",
|
|
16
|
-
cwd:
|
|
17
|
-
env: process.env,
|
|
18
|
+
cwd: pkgRoot,
|
|
19
|
+
env: { ...process.env, LOOM_START_CWD: process.env.LOOM_START_CWD || process.cwd() },
|
|
18
20
|
windowsHide: false,
|
|
19
21
|
}
|
|
20
22
|
);
|
|
@@ -25,13 +27,4 @@ if (!(typeof Bun !== "undefined" && process.versions.bun)) {
|
|
|
25
27
|
process.exit(result.status == null ? 1 : result.status);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
// Under bun at the user's cwd — bunfig.toml wasn't discovered, so register
|
|
29
|
-
// the preload chain manually (same order as bunfig.toml).
|
|
30
|
-
require(path.join(__dirname, "..", "src", "tui-preload.js"));
|
|
31
|
-
require("@opentui/solid/preload");
|
|
32
|
-
|
|
33
|
-
if (process.env.LOOM_START_CWD) {
|
|
34
|
-
try { process.chdir(process.env.LOOM_START_CWD); } catch {}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
30
|
(async () => { await import("../src/tui-open.tsx"); })();
|
package/package.json
CHANGED
package/src/core/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ class LoomCLI {
|
|
|
37
37
|
|
|
38
38
|
async start() {
|
|
39
39
|
console.log(LOOM_BASE);
|
|
40
|
-
console.log(`\n Loom Code v1.
|
|
40
|
+
console.log(`\n Loom Code v1.2.20 — AI Coding Agent for the terminal`);
|
|
41
41
|
console.log(` Press Ctrl+C or ESC to interrupt | /help for commands\n`);
|
|
42
42
|
|
|
43
43
|
process.stdin.on('keypress', (str, key) => {
|
package/src/tui-preload.js
CHANGED
|
@@ -21,11 +21,10 @@ if (process.platform === "win32") {
|
|
|
21
21
|
} catch {}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
if (process.platform === "win32" && process.env.LOOM_FORCE_VT === "1") {
|
|
24
|
+
// OpenTUI writes VT escape sequences and expects key events instead of cooked
|
|
25
|
+
// console lines. Configure both handles before the renderer starts so this
|
|
26
|
+
// also works when the CLI is launched through npm's Windows shim.
|
|
27
|
+
if (process.platform === "win32") {
|
|
29
28
|
try {
|
|
30
29
|
const { dlopen } = require("bun:ffi");
|
|
31
30
|
const k32 = dlopen("kernel32.dll", {
|