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 CHANGED
@@ -4,20 +4,23 @@
4
4
  const path = require("path");
5
5
  const { spawnSync } = require("child_process");
6
6
 
7
- // Node-shim path: bun is required for plugins/JSX, so hand off ONCE.
8
- // We deliberately do NOT respawn when already under bunrespawning hands
9
- // the console to a child and OpenTUI's terminal-capability handshake
10
- // (DA1/OSC/DECRQM queries) then gets echoed instead of consumed, leaving a
11
- // frozen splash. Instead we register the Solid JSX plugin programmatically
12
- // below, which is exactly what the bunfig preload would have done.
13
- if (!(typeof Bun !== "undefined" && process.versions.bun)) {
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: process.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
- // Node-shim path only never respawn when already under bun (see
8
- // bin/loom-bun.js for why: the console handoff breaks OpenTUI's terminal
9
- // capability handshake and freezes the splash).
10
- if (!(typeof Bun !== "undefined" && process.versions.bun)) {
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: process.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loom-agent",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/toshalkumbhar8979-design/loomcode.git"
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.0.0 — AI Coding Agent for the terminal`);
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) => {
@@ -21,11 +21,10 @@ if (process.platform === "win32") {
21
21
  } catch {}
22
22
  }
23
23
 
24
- // Windows VT-mode re-enable OPT-IN via LOOM_FORCE_VT=1.
25
- // Off by default: OpenTUI manages its own console modes, and forcing flags
26
- // underneath it can desync its input parsing. Only enable when debugging
27
- // console-mode issues on a specific terminal.
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", {