loom-agent 1.2.21 → 1.2.25
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/package.json +15 -9
- package/src/core/cli.js +14 -11
- package/src/tui-preload.js +0 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loom-agent",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/toshalkumbhar8979-design/loomcode.git"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@anthropic-ai/sdk": "^0.120.0",
|
|
37
|
-
"@opentui/core": "
|
|
38
|
-
"@opentui/solid": "
|
|
37
|
+
"@opentui/core": "0.5.3",
|
|
38
|
+
"@opentui/solid": "0.5.3",
|
|
39
39
|
"@shikijs/themes": "4.4.3",
|
|
40
40
|
"bonjour-service": "^1.4.4",
|
|
41
41
|
"boxen": "^8.0.0",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"wrap-ansi": "^9.0.0"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@opentui/core-darwin-arm64": "
|
|
61
|
-
"@opentui/core-darwin-x64": "
|
|
62
|
-
"@opentui/core-linux-arm64": "
|
|
63
|
-
"@opentui/core-linux-x64": "
|
|
64
|
-
"@opentui/core-win32-x64": "
|
|
60
|
+
"@opentui/core-darwin-arm64": "0.5.3",
|
|
61
|
+
"@opentui/core-darwin-x64": "0.5.3",
|
|
62
|
+
"@opentui/core-linux-arm64": "0.5.3",
|
|
63
|
+
"@opentui/core-linux-x64": "0.5.3",
|
|
64
|
+
"@opentui/core-win32-x64": "0.5.3"
|
|
65
65
|
},
|
|
66
66
|
"overrides": {
|
|
67
67
|
"glob": "^13.0.6"
|
|
@@ -108,5 +108,11 @@
|
|
|
108
108
|
"engines": {
|
|
109
109
|
"node": ">=18.0.0",
|
|
110
110
|
"bun": ">=1.0.0"
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
|
+
"directories": {
|
|
113
|
+
"doc": "docs"
|
|
114
|
+
},
|
|
115
|
+
"author": "",
|
|
116
|
+
"license": "ISC",
|
|
117
|
+
"type": "commonjs"
|
|
112
118
|
}
|
package/src/core/cli.js
CHANGED
|
@@ -18,14 +18,8 @@ const LOOM_BASE = `
|
|
|
18
18
|
╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚═════╝ ╚═════╝ ╚══════╝`;
|
|
19
19
|
|
|
20
20
|
class LoomCLI {
|
|
21
|
-
/** @type {import('readline').Interface} */
|
|
22
|
-
rl =
|
|
23
|
-
input: process.stdin,
|
|
24
|
-
output: process.stdout,
|
|
25
|
-
prompt: '\x1b[36m> \x1b[0m',
|
|
26
|
-
completer: (line) => this.completer(line),
|
|
27
|
-
terminal: true,
|
|
28
|
-
});
|
|
21
|
+
/** @type {import('readline').Interface | null} */
|
|
22
|
+
rl = null;
|
|
29
23
|
/** @type {import('./session').Session} */
|
|
30
24
|
session = new Session();
|
|
31
25
|
constructor() {
|
|
@@ -36,8 +30,15 @@ class LoomCLI {
|
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
async start() {
|
|
33
|
+
this.rl = readline.createInterface({
|
|
34
|
+
input: process.stdin,
|
|
35
|
+
output: process.stdout,
|
|
36
|
+
prompt: '\x1b[36m> \x1b[0m',
|
|
37
|
+
completer: (line) => this.completer(line),
|
|
38
|
+
terminal: true,
|
|
39
|
+
});
|
|
39
40
|
console.log(LOOM_BASE);
|
|
40
|
-
console.log(`\n Loom Code v1.2.
|
|
41
|
+
console.log(`\n Loom Code v1.2.25 — AI Coding Agent for the terminal`);
|
|
41
42
|
console.log(` Press Ctrl+C or ESC to interrupt | /help for commands\n`);
|
|
42
43
|
|
|
43
44
|
process.stdin.on('keypress', (str, key) => {
|
|
@@ -56,7 +57,8 @@ class LoomCLI {
|
|
|
56
57
|
if (this.initialPrompt) {
|
|
57
58
|
const prompt = this.initialPrompt;
|
|
58
59
|
this.initialPrompt = null;
|
|
59
|
-
|
|
60
|
+
const rl = this.rl;
|
|
61
|
+
setImmediate(() => rl?.emit('line', prompt));
|
|
60
62
|
}
|
|
61
63
|
return this.runLoop();
|
|
62
64
|
}
|
|
@@ -72,7 +74,8 @@ class LoomCLI {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
async runLoop() {
|
|
75
|
-
return new Promise((resolve) => {
|
|
77
|
+
return new Promise((resolve /** @type {() => void} */) => {
|
|
78
|
+
if (!this.rl) return resolve(undefined);
|
|
76
79
|
this.rl.on('line', async (line) => {
|
|
77
80
|
try {
|
|
78
81
|
const trimmed = line.trim();
|
package/src/tui-preload.js
CHANGED
|
@@ -21,53 +21,6 @@ if (process.platform === "win32") {
|
|
|
21
21
|
} catch {}
|
|
22
22
|
}
|
|
23
23
|
|
|
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") {
|
|
28
|
-
try {
|
|
29
|
-
const { dlopen } = require("bun:ffi");
|
|
30
|
-
const k32 = dlopen("kernel32.dll", {
|
|
31
|
-
GetStdHandle: { args: ["int"], returns: "ptr" },
|
|
32
|
-
GetConsoleMode: { args: ["ptr", "ptr"], returns: "int" },
|
|
33
|
-
SetConsoleMode: { args: ["ptr", "uint"], returns: "int" },
|
|
34
|
-
});
|
|
35
|
-
const STD_INPUT_HANDLE = -10;
|
|
36
|
-
const STD_OUTPUT_HANDLE = -11;
|
|
37
|
-
|
|
38
|
-
// Output: processed + wrap-at-EOL + VT processing (so ANSI repaints work).
|
|
39
|
-
const ENABLE_PROCESSED_OUTPUT = 0x0001;
|
|
40
|
-
const ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002;
|
|
41
|
-
const ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
|
|
42
|
-
// Input: raw-ish mode for OpenTUI — VT input + processed + mouse + window,
|
|
43
|
-
// with line/echo/quick-edit cleared so keys stream and don't echo.
|
|
44
|
-
const ENABLE_PROCESSED_INPUT = 0x0001;
|
|
45
|
-
const ENABLE_MOUSE_INPUT = 0x0010;
|
|
46
|
-
const ENABLE_WINDOW_INPUT = 0x0008;
|
|
47
|
-
const ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200;
|
|
48
|
-
const ENABLE_QUICK_EDIT_MODE = 0x0040;
|
|
49
|
-
const ENABLE_LINE_INPUT = 0x0002;
|
|
50
|
-
const ENABLE_ECHO_INPUT = 0x0004;
|
|
51
|
-
|
|
52
|
-
const outH = k32.symbols.GetStdHandle(STD_OUTPUT_HANDLE);
|
|
53
|
-
const inH = k32.symbols.GetStdHandle(STD_INPUT_HANDLE);
|
|
54
|
-
const modeBuf = new Uint32Array(1);
|
|
55
|
-
const modePtr = Bun.ptr(modeBuf);
|
|
56
|
-
|
|
57
|
-
if (outH && !outH.isNull() && k32.symbols.GetConsoleMode(outH, modePtr)) {
|
|
58
|
-
const cur = modeBuf[0];
|
|
59
|
-
const next = cur | ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
|
60
|
-
if (next !== cur) k32.symbols.SetConsoleMode(outH, next);
|
|
61
|
-
}
|
|
62
|
-
if (inH && !inH.isNull() && k32.symbols.GetConsoleMode(inH, modePtr)) {
|
|
63
|
-
const cur = modeBuf[0];
|
|
64
|
-
const next = (cur | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT | ENABLE_VIRTUAL_TERMINAL_INPUT)
|
|
65
|
-
& ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_QUICK_EDIT_MODE);
|
|
66
|
-
if (next !== cur) k32.symbols.SetConsoleMode(inH, next);
|
|
67
|
-
}
|
|
68
|
-
} catch {}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
24
|
// NOTE: LOOM_START_CWD is deliberately NOT applied here. Changing the working
|
|
72
25
|
// directory before the app's module graph loads breaks how Bun resolves the
|
|
73
26
|
// Solid JSX transform (proven: identical entry paints 19KB from repo cwd,
|