loom-agent 1.2.17 → 1.2.18

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,21 +4,20 @@
4
4
  const path = require("path");
5
5
  const { spawnSync } = require("child_process");
6
6
 
7
- // Bun discovers bunfig.toml ONLY from its starting cwd. npm's cmd-shim runs
8
- // this file under bun directly with the USER's cwd, so unless we are already
9
- // sitting in the package root we must respawn from there — otherwise the
10
- // Solid JSX preload never loads and the TUI dies on react/jsx-dev-runtime.
11
- const pkgRoot = path.join(__dirname, "..");
12
- const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
13
- const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
14
- if (!underBun || !inPkgRoot) {
7
+ // Node-shim path: bun is required for plugins/JSX, so hand off ONCE.
8
+ // We deliberately do NOT respawn when already under bun respawning 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)) {
15
14
  const result = spawnSync(
16
15
  process.platform === "win32" ? "bun.exe" : "bun",
17
16
  [__filename, ...process.argv.slice(2)],
18
17
  {
19
18
  stdio: "inherit",
20
- cwd: pkgRoot,
21
- env: { ...process.env, LOOM_START_CWD: process.env.LOOM_START_CWD || process.cwd() },
19
+ cwd: process.cwd(),
20
+ env: process.env,
22
21
  windowsHide: false,
23
22
  }
24
23
  );
@@ -28,6 +27,20 @@ if (!underBun || !inPkgRoot) {
28
27
  }
29
28
  process.exit(result.status == null ? 1 : result.status);
30
29
  }
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
+
31
44
  process.title = "loom-code";
32
45
  (async () => {
33
46
  try {
@@ -37,4 +50,4 @@ process.title = "loom-code";
37
50
  console.error(err && err.message ? err.message : String(err));
38
51
  process.exit(1);
39
52
  }
40
- })();
53
+ })();
package/bin/loom-tui.js CHANGED
@@ -1,30 +1,37 @@
1
- #!/usr/bin/env bun
2
- // npm invokes bin targets through Node on Windows, so re-launch under Bun
3
- // when this file was not started by Bun itself.
4
- const path = require("path");
5
- const { spawnSync } = require("child_process");
6
-
7
- // Bun discovers bunfig.toml ONLY from its starting cwd (see bin/loom-bun.js).
8
- const pkgRoot = path.join(__dirname, "..");
9
- const underBun = typeof Bun !== "undefined" && !!process.versions.bun;
10
- const inPkgRoot = path.resolve(process.cwd()) === path.resolve(pkgRoot);
11
- if (!underBun || !inPkgRoot) {
12
- const result = spawnSync(
13
- process.platform === "win32" ? "bun.exe" : "bun",
14
- [__filename, ...process.argv.slice(2)],
15
- {
16
- stdio: "inherit",
17
- cwd: pkgRoot,
18
- env: { ...process.env, LOOM_START_CWD: process.env.LOOM_START_CWD || process.cwd() },
19
- windowsHide: false,
20
- }
21
- );
22
- if (result.error) {
23
- console.error("[loom] Bun is required for the TUI. Install it from https://bun.sh/");
24
- process.exit(1);
25
- }
26
- process.exit(result.status == null ? 1 : result.status);
27
- }
28
-
29
- require("../src/tui-preload.js");
30
- (async () => { await import("../src/tui-open.tsx"); })();
1
+ #!/usr/bin/env bun
2
+ // npm invokes bin targets through Node on Windows, so re-launch under Bun
3
+ // when this file was not started by Bun itself.
4
+ const path = require("path");
5
+ const { spawnSync } = require("child_process");
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)) {
11
+ const result = spawnSync(
12
+ process.platform === "win32" ? "bun.exe" : "bun",
13
+ [__filename, ...process.argv.slice(2)],
14
+ {
15
+ stdio: "inherit",
16
+ cwd: process.cwd(),
17
+ env: process.env,
18
+ windowsHide: false,
19
+ }
20
+ );
21
+ if (result.error) {
22
+ console.error("[loom] Bun is required for the TUI. Install it from https://bun.sh/");
23
+ process.exit(1);
24
+ }
25
+ process.exit(result.status == null ? 1 : result.status);
26
+ }
27
+
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
+ (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.17",
3
+ "version": "1.2.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/toshalkumbhar8979-design/loomcode.git"