loom-agent 1.2.16 → 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 +25 -12
- package/bin/loom-tui.js +37 -30
- package/package.json +1 -1
- package/src/core/cli.js +1 -4
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
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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:
|
|
21
|
-
env:
|
|
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
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
process.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(
|
|
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
package/src/core/cli.js
CHANGED
|
@@ -579,10 +579,7 @@ if (args.includes('--help') || args.includes('-h')) {
|
|
|
579
579
|
process.env.LOOM_START_CWD = process.cwd();
|
|
580
580
|
process.env.LOOM_BIN_NAME = "loom";
|
|
581
581
|
process.env.BUN_CONFIG = path.join(pkgRoot, "bunfig.toml");
|
|
582
|
-
|
|
583
|
-
// bin/loom-tui.js) — without it the SSR build loads and the TUI
|
|
584
|
-
// renders one static frame then never updates.
|
|
585
|
-
const tuiArgs = ["--conditions=browser", tuiEntry];
|
|
582
|
+
const tuiArgs = [tuiEntry];
|
|
586
583
|
if (sessionId) tuiArgs.push('-s', sessionId);
|
|
587
584
|
if (autoMode) tuiArgs.push('--auto');
|
|
588
585
|
const prompt = promptArgs.join(' ');
|