aether-code 0.22.0 → 0.23.0
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/aether-code.js +1 -1
- package/package.json +1 -1
- package/src/box-input.js +132 -0
- package/src/repl.js +8 -66
package/bin/aether-code.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import readline from "node:readline";
|
|
27
27
|
import { c, errorLine, divider, setTerminalTitle } from "../src/render.js";
|
|
28
28
|
|
|
29
|
-
const VERSION = "0.
|
|
29
|
+
const VERSION = "0.23.0";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Try to start MCP servers from ~/.aether/mcp.json. Returns a started
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aether-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Uncensored AI coding agent for your terminal — Claude Code alternative with MCP support. Reads code, writes files, runs commands. Drives IDA Pro, Roblox Studio, Wireshark, Blender, and any MCP server. No refusal layer.",
|
|
5
5
|
"homepage": "https://trynoguard.com",
|
|
6
6
|
"repository": {
|
package/src/box-input.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Bordered single-line text input — raw-mode, cmd.exe-safe.
|
|
2
|
+
//
|
|
3
|
+
// Like the ask_user menu, this is NOT Ink (which ghosts in the legacy Windows
|
|
4
|
+
// console). It draws a 3-line box + hint, and on every keystroke moves the
|
|
5
|
+
// cursor back up (ESC[nA), clears (ESC[J), and reprints. The caret is a FAKE
|
|
6
|
+
// cursor (inverse-video cell) and the real terminal cursor is hidden, so there
|
|
7
|
+
// is no cursor-column math to get wrong. Long input scrolls horizontally under
|
|
8
|
+
// a fixed right border.
|
|
9
|
+
//
|
|
10
|
+
// Returns the typed string, or EXIT_SIGNAL on Ctrl+C / Ctrl+D.
|
|
11
|
+
|
|
12
|
+
import readline from "node:readline";
|
|
13
|
+
import { c } from "./render.js";
|
|
14
|
+
|
|
15
|
+
export const EXIT_SIGNAL = "<<aether-exit>>";
|
|
16
|
+
|
|
17
|
+
const HIDE = "\x1b[?25l";
|
|
18
|
+
const SHOW = "\x1b[?25h";
|
|
19
|
+
const INV = (s) => `\x1b[7m${s}\x1b[27m`;
|
|
20
|
+
|
|
21
|
+
export function promptBox({ history = [], placeholder = "type a message… /help for commands" } = {}) {
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
// Non-interactive (piped / tests): plain readline, no box.
|
|
24
|
+
if (!process.stdin.isTTY) {
|
|
25
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
26
|
+
rl.question(c.magenta("› "), (a) => { rl.close(); resolve(a); });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let buf = "";
|
|
31
|
+
let pos = 0; // caret index within buf
|
|
32
|
+
const hist = history.slice();
|
|
33
|
+
let histIdx = hist.length; // points one past the end (current draft)
|
|
34
|
+
let draft = "";
|
|
35
|
+
let drawn = 0;
|
|
36
|
+
let lastSigint = 0;
|
|
37
|
+
|
|
38
|
+
const innerW = () => Math.max(24, Math.min(process.stdout.columns || 80, 100) - 6);
|
|
39
|
+
|
|
40
|
+
const draw = (first) => {
|
|
41
|
+
const W = innerW();
|
|
42
|
+
if (!first) process.stdout.write(`\x1b[${drawn}A`);
|
|
43
|
+
process.stdout.write("\x1b[J");
|
|
44
|
+
|
|
45
|
+
// Horizontal scroll: keep the caret within the visible window.
|
|
46
|
+
const maxVisible = W - 1;
|
|
47
|
+
const start = pos > maxVisible ? pos - maxVisible : 0;
|
|
48
|
+
const view = buf.slice(start, start + W);
|
|
49
|
+
const rel = pos - start;
|
|
50
|
+
|
|
51
|
+
let content;
|
|
52
|
+
if (buf.length === 0) {
|
|
53
|
+
const ph = placeholder.slice(0, W - 1);
|
|
54
|
+
content = INV(" ") + c.dim(ph) + " ".repeat(Math.max(0, W - 1 - ph.length));
|
|
55
|
+
} else {
|
|
56
|
+
let s = "";
|
|
57
|
+
for (let i = 0; i < W; i++) {
|
|
58
|
+
const ch = view[i] ?? " ";
|
|
59
|
+
s += i === rel ? INV(ch) : ch;
|
|
60
|
+
}
|
|
61
|
+
content = s;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const top = c.magenta("╭" + "─".repeat(W + 4) + "╮");
|
|
65
|
+
const mid = c.magenta("│") + " " + c.magenta("›") + " " + content + " " + c.magenta("│");
|
|
66
|
+
const bot = c.magenta("╰" + "─".repeat(W + 4) + "╯");
|
|
67
|
+
const hint = c.dim(" Enter send · ↑↓ history · /help · /exit");
|
|
68
|
+
|
|
69
|
+
process.stdout.write(top + "\n" + mid + "\n" + bot + "\n" + hint + "\n");
|
|
70
|
+
drawn = 4;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const finish = (result) => {
|
|
74
|
+
process.stdin.removeListener("keypress", onKey);
|
|
75
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(false);
|
|
76
|
+
process.stdin.pause();
|
|
77
|
+
process.stdout.write(`\x1b[${drawn}A\x1b[J` + SHOW);
|
|
78
|
+
// Echo the submitted line so it persists in scrollback.
|
|
79
|
+
if (result && result !== EXIT_SIGNAL && result.trim()) {
|
|
80
|
+
process.stdout.write(c.magenta("› ") + result + "\n");
|
|
81
|
+
}
|
|
82
|
+
resolve(result);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const onKey = (str, key) => {
|
|
86
|
+
if (!key) return;
|
|
87
|
+
const k = key.name;
|
|
88
|
+
|
|
89
|
+
if (k === "return" || k === "enter") return finish(buf);
|
|
90
|
+
if (key.ctrl && k === "c") {
|
|
91
|
+
const now = Date.now();
|
|
92
|
+
if (now - lastSigint < 1500 || buf.length === 0) return finish(EXIT_SIGNAL);
|
|
93
|
+
lastSigint = now;
|
|
94
|
+
buf = ""; pos = 0; draw(false);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (key.ctrl && k === "d") return finish(buf.length === 0 ? EXIT_SIGNAL : buf);
|
|
98
|
+
|
|
99
|
+
if (k === "backspace") { if (pos > 0) { buf = buf.slice(0, pos - 1) + buf.slice(pos); pos--; } }
|
|
100
|
+
else if (k === "delete") { buf = buf.slice(0, pos) + buf.slice(pos + 1); }
|
|
101
|
+
else if (k === "left") { if (pos > 0) pos--; }
|
|
102
|
+
else if (k === "right") { if (pos < buf.length) pos++; }
|
|
103
|
+
else if (k === "home" || (key.ctrl && k === "a")) pos = 0;
|
|
104
|
+
else if (k === "end" || (key.ctrl && k === "e")) pos = buf.length;
|
|
105
|
+
else if (key.ctrl && k === "u") { buf = ""; pos = 0; }
|
|
106
|
+
else if (k === "up") {
|
|
107
|
+
if (histIdx === hist.length) draft = buf;
|
|
108
|
+
if (histIdx > 0) { histIdx--; buf = hist[histIdx] ?? ""; pos = buf.length; }
|
|
109
|
+
}
|
|
110
|
+
else if (k === "down") {
|
|
111
|
+
if (histIdx < hist.length) {
|
|
112
|
+
histIdx++;
|
|
113
|
+
buf = histIdx === hist.length ? draft : (hist[histIdx] ?? "");
|
|
114
|
+
pos = buf.length;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (str && !key.ctrl && !key.meta && str >= " " && str !== "\x7f") {
|
|
118
|
+
buf = buf.slice(0, pos) + str + buf.slice(pos);
|
|
119
|
+
pos += str.length;
|
|
120
|
+
}
|
|
121
|
+
else return; // ignore unhandled keys without a redraw
|
|
122
|
+
draw(false);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
process.stdout.write(HIDE);
|
|
126
|
+
readline.emitKeypressEvents(process.stdin);
|
|
127
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
128
|
+
process.stdin.resume();
|
|
129
|
+
process.stdin.on("keypress", onKey);
|
|
130
|
+
draw(true);
|
|
131
|
+
});
|
|
132
|
+
}
|
package/src/repl.js
CHANGED
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
// - Bottom status line is rendered after each turn
|
|
9
9
|
// - Ctrl+C: first press cancels in-progress turn, second press exits
|
|
10
10
|
|
|
11
|
-
import readline from "node:readline";
|
|
12
11
|
import path from "node:path";
|
|
13
12
|
import { runAgent } from "./agent.js";
|
|
14
13
|
import { fetchBalance, AetherError } from "./api.js";
|
|
15
14
|
import { runSetup } from "./setup.js";
|
|
16
15
|
import { c, errorLine, box } from "./render.js";
|
|
17
16
|
import { checkForUpdate } from "./update-check.js";
|
|
18
|
-
import {
|
|
17
|
+
import { promptBox, EXIT_SIGNAL } from "./box-input.js";
|
|
19
18
|
|
|
20
|
-
const VERSION = "0.
|
|
19
|
+
const VERSION = "0.23.0";
|
|
21
20
|
const MODEL_NAME = "Aether Core";
|
|
22
21
|
|
|
23
22
|
const SHORTCUTS = `
|
|
@@ -85,76 +84,19 @@ export async function runRepl({ cwd: initialCwd, autoYes: initialAutoYes, unsafe
|
|
|
85
84
|
const updateNudge = await updatePromise;
|
|
86
85
|
if (updateNudge) console.log(updateNudge + "\n");
|
|
87
86
|
|
|
88
|
-
// Input:
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
// redraw + raw-mode: typed characters ghost (the console echoes what Ink
|
|
93
|
-
// already drew) and the box border tears on each keystroke. Windows Terminal
|
|
94
|
-
// (sets WT_SESSION) and non-Windows render Ink correctly. So we default to
|
|
95
|
-
// the clean prompt on legacy Windows console; AETHER_INK=1 forces Ink there
|
|
96
|
-
// for anyone who wants to try it, AETHER_NO_INK=1 forces the plain prompt.
|
|
87
|
+
// Input: a bordered raw-mode box (box-input.js) — cmd.exe-safe and identical
|
|
88
|
+
// everywhere. (Ink's live redraw ghosts in the legacy Windows console, so we
|
|
89
|
+
// don't use it.) Each prompt is independent; the tool y/N prompts and the
|
|
90
|
+
// ask_user menu run BETWEEN prompts in raw mode too, so nothing overlaps.
|
|
97
91
|
const inputHistory = [];
|
|
98
|
-
const legacyWinConsole = process.platform === "win32" && !process.env.WT_SESSION;
|
|
99
|
-
const useInk =
|
|
100
|
-
!!process.stdin.isTTY &&
|
|
101
|
-
process.env.AETHER_NO_INK !== "1" &&
|
|
102
|
-
(process.env.AETHER_INK === "1" || !legacyWinConsole);
|
|
103
|
-
let inkBroken = false;
|
|
104
|
-
|
|
105
|
-
// The Ink box carries its own status bar; the plain prompt doesn't, so show a
|
|
106
|
-
// one-line hint up front when we won't be using Ink.
|
|
107
|
-
if (!useInk) console.log(` ${c.cyan("/help")}${c.dim(" shortcuts")} ${c.cyan("/exit")}${c.dim(" quit")}\n`);
|
|
108
|
-
|
|
109
|
-
// Fresh readline interface PER PROMPT. A single persistent interface
|
|
110
|
-
// conflicted with the per-confirmation readline interfaces the tools open
|
|
111
|
-
// during a turn (each [y/N] prompt). When a tool's interface closed it left
|
|
112
|
-
// the REPL's stdin dead — so after finishing a request aether printed the
|
|
113
|
-
// prompt and immediately EXITED instead of waiting for the next message.
|
|
114
|
-
// Opening a fresh one each prompt guarantees only one interface exists at a
|
|
115
|
-
// time, so the REPL keeps running until the user /exits. Returns EXIT_SIGNAL
|
|
116
|
-
// on a double Ctrl+C.
|
|
117
|
-
function readlineQuestion() {
|
|
118
|
-
return new Promise((resolve) => {
|
|
119
|
-
const r = readline.createInterface({ input: process.stdin, output: process.stdout, historySize: 200 });
|
|
120
|
-
let lastSigint = 0;
|
|
121
|
-
r.on("SIGINT", () => {
|
|
122
|
-
const now = Date.now();
|
|
123
|
-
if (now - lastSigint < 1500) { r.close(); resolve(EXIT_SIGNAL); return; }
|
|
124
|
-
lastSigint = now;
|
|
125
|
-
process.stdout.write(c.gray(`\n(Press Ctrl+C again within 1.5s to exit, or type ${c.cyan("/exit")})\n`));
|
|
126
|
-
r.prompt();
|
|
127
|
-
});
|
|
128
|
-
r.question(c.magenta("> "), (ans) => { r.close(); resolve(ans); });
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Returns the next raw input line, or EXIT_SIGNAL to quit.
|
|
133
|
-
async function nextLine() {
|
|
134
|
-
if (useInk && !inkBroken) {
|
|
135
|
-
try {
|
|
136
|
-
return await promptBoxed({
|
|
137
|
-
statusLeft: ` ${c.cyan("/help")}${c.dim(" shortcuts")} ${c.cyan("/exit")}${c.dim(" quit")}`,
|
|
138
|
-
statusRight: `${state.autoYes ? "auto-yes" : "review"} · ${MODEL_NAME}`,
|
|
139
|
-
history: inputHistory,
|
|
140
|
-
});
|
|
141
|
-
} catch {
|
|
142
|
-
inkBroken = true;
|
|
143
|
-
console.log(c.gray("(rich input unavailable here — using the basic prompt)"));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return readlineQuestion();
|
|
147
|
-
}
|
|
148
92
|
|
|
149
93
|
while (true) {
|
|
150
|
-
const raw = await
|
|
94
|
+
const raw = await promptBox({ history: inputHistory });
|
|
151
95
|
if (raw === EXIT_SIGNAL) { console.log(c.gray("bye.")); return; }
|
|
152
96
|
const line = (raw ?? "").trim();
|
|
153
97
|
if (!line) continue;
|
|
154
98
|
|
|
155
|
-
//
|
|
156
|
-
// region on unmount). Skip in readline mode — the terminal already echoed it.
|
|
157
|
-
if (useInk && !inkBroken) console.log(c.magenta("> ") + line);
|
|
99
|
+
// promptBox already echoes "› <line>" on submit, so no echo needed here.
|
|
158
100
|
inputHistory.push(line);
|
|
159
101
|
|
|
160
102
|
// Slash command?
|