aether-code 0.21.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.
@@ -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.21.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.21.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/agent.js CHANGED
@@ -79,8 +79,9 @@ export async function runAgent({
79
79
  let lastBalance = null;
80
80
 
81
81
  for (let i = 0; i < maxTurns; i++) {
82
- // A blank line separates steps (no noisy "turn N" headers).
83
- process.stdout.write("\n");
82
+ // No turn header and no leading blank here — each step (assistant text and
83
+ // each tool label) begins with its own "\n● ", so spacing stays exactly one
84
+ // blank line per step instead of stacking up.
84
85
 
85
86
  // Stream the assistant's response. Print text deltas as they arrive,
86
87
  // along with tool-call announcements as soon as the model commits to
@@ -107,7 +108,7 @@ export async function runAgent({
107
108
  const clean = stripper.push(text);
108
109
  if (!clean) return;
109
110
  if (!lastWasText) {
110
- process.stdout.write(c.cyan("● "));
111
+ process.stdout.write("\n" + c.cyan("● "));
111
112
  lastWasText = true;
112
113
  }
113
114
  process.stdout.write(clean);
@@ -133,7 +134,7 @@ export async function runAgent({
133
134
  // Flush any held-back partial token, then close the line.
134
135
  const tail = stripper.flush();
135
136
  if (tail) {
136
- if (!lastWasText) { process.stdout.write(c.cyan("● ")); lastWasText = true; }
137
+ if (!lastWasText) { process.stdout.write("\n" + c.cyan("● ")); lastWasText = true; }
137
138
  process.stdout.write(tail);
138
139
  }
139
140
  if (lastWasText) process.stdout.write("\n");
@@ -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/diff.js CHANGED
@@ -24,7 +24,7 @@ export function unifiedDiff(oldText, newText, filename) {
24
24
  const changedNew = newLines.slice(prefix, newLines.length - suffix);
25
25
 
26
26
  const lines = [];
27
- lines.push(c.bold(c.cyan(`@@ ${filename} @@`)));
27
+ // No "@@ file @@" header — the "● write <file>" label already names the file.
28
28
  if (prefix > 0) lines.push(c.gray(` …${prefix} unchanged line${prefix === 1 ? "" : "s"} above…`));
29
29
  for (const l of changedOld) lines.push(c.red(`- ${l}`));
30
30
  for (const l of changedNew) lines.push(c.green(`+ ${l}`));
package/src/render.js CHANGED
@@ -24,6 +24,21 @@ export function divider() {
24
24
  return c.gray("─".repeat(Math.min(60, w)));
25
25
  }
26
26
 
27
+ const stripAnsi = (s) => s.replace(/\x1b\[[0-9;]*m/g, "");
28
+
29
+ // Draw a bordered box around content lines. Light box-drawing chars — same
30
+ // Unicode block as the rules we already render, so it's safe in cmd.exe.
31
+ export function box(lines, { color = c.gray, padX = 2 } = {}) {
32
+ const inner = Math.max(0, ...lines.map((l) => stripAnsi(l).length));
33
+ const w = inner + padX * 2;
34
+ const top = color("╭" + "─".repeat(w) + "╮");
35
+ const bot = color("╰" + "─".repeat(w) + "╯");
36
+ const mid = lines.map(
37
+ (l) => color("│") + " ".repeat(padX) + l + " ".repeat(inner - stripAnsi(l).length + padX) + color("│"),
38
+ );
39
+ return [top, ...mid, bot].join("\n");
40
+ }
41
+
27
42
  export function turn(n) {
28
43
  return c.gray(`turn ${n}`);
29
44
  }
@@ -70,20 +85,21 @@ export function setTerminalTitle(title) {
70
85
  // plan) just get a check — the detail was already printed.
71
86
  export function toolSummary(name, result) {
72
87
  const ok = result.ok;
73
- const mark = ok ? c.green("●") : c.red("×");
88
+ // A tree branch links the result to the action above it (modern CLI style).
89
+ const branch = ok ? c.green("└─") : c.red("└─");
74
90
  const out = result.output ?? "";
75
91
  const firstLine = out.split("\n").find((l) => l.trim()) ?? "";
76
92
 
77
93
  if (name === "run_shell") {
78
94
  let code = null;
79
95
  try { code = JSON.parse(out).exit_code; } catch { /* ignore */ }
80
- return ` ${mark} ${c.gray(code === null ? (ok ? "done" : "failed") : `exit ${code}`)}`;
96
+ return ` ${branch} ${c.gray(code === null ? (ok ? "done" : "failed") : `exit ${code}`)}`;
81
97
  }
82
- if (name === "todo_write") return ""; // the Plan box is its own feedback
98
+ if (name === "todo_write") return ""; // the Plan is its own feedback
83
99
  if (name === "ask_user") return ""; // the menu already showed the answer
84
100
  if (name === "write_file" || name === "edit_file") {
85
101
  // Handler already printed the diff; echo its short status line.
86
- return ` ${mark} ${c.gray(ellip(firstLine, 100))}`;
102
+ return ` ${branch} ${c.gray(ellip(firstLine, 100))}`;
87
103
  }
88
104
  let summary = "";
89
105
  try {
@@ -95,7 +111,7 @@ export function toolSummary(name, result) {
95
111
  if (!summary) {
96
112
  summary = name === "read_file" ? `${out.split("\n").length} lines` : ellip(firstLine, 100);
97
113
  }
98
- return ` ${mark} ${c.gray(summary)}`;
114
+ return ` ${branch} ${c.gray(summary)}`;
99
115
  }
100
116
 
101
117
  // Strip model "harmony"/channel control tokens (<|channel|>, <|message|>,
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
- import { c, errorLine } from "./render.js";
15
+ import { c, errorLine, box } from "./render.js";
17
16
  import { checkForUpdate } from "./update-check.js";
18
- import { promptBoxed, EXIT_SIGNAL } from "./ink-input.js";
17
+ import { promptBox, EXIT_SIGNAL } from "./box-input.js";
19
18
 
20
- const VERSION = "0.21.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: the Ink boxed input (bordered, Claude-style) when the terminal
89
- // renders it cleanly, with a readline fallback otherwise.
90
- //
91
- // The legacy Windows console (cmd.exe / conhost) mishandles Ink's live
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 nextLine();
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
- // Echo the submitted line so it persists in scrollback (Ink clears its box
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?
@@ -272,24 +214,16 @@ const visLen = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
272
214
  const shortenPath = (p, max) => (p.length <= max ? p : "..." + p.slice(p.length - max + 3));
273
215
 
274
216
  function printBanner(state) {
275
- const cols = process.stdout.columns || 80;
276
- const W = Math.max(40, Math.min(cols - 1, 64));
277
- // Brand-coloured rules top + bottom; content is indented with no right
278
- // border, so nothing can misalign regardless of terminal font/width.
279
- const rule = c.magenta("─".repeat(W));
280
217
  const mode = state.autoYes ? (state.unsafePaths ? "skip-permissions" : "auto-yes") : "review mode";
281
-
218
+ const credits = state.balance != null ? `${state.balance.toLocaleString()} credits · ` : "";
219
+ const lines = [
220
+ c.bold(c.magenta("aether")) + c.gray(" · ") + c.bold(MODEL_NAME) + c.gray(" v" + VERSION),
221
+ c.gray("1M context · uncensored · " + mode),
222
+ c.gray(credits + shortenPath(state.cwd, 52)),
223
+ ];
282
224
  console.log("");
283
- console.log(rule);
284
- console.log(` ${c.bold(c.magenta("aether-code"))}${c.gray(" v" + VERSION)}`);
285
- console.log(` ${c.gray(`${MODEL_NAME} · 1M context · uncensored`)}`);
286
- console.log(` ${c.gray(mode)}${state.balance != null ? c.gray(` · ${state.balance.toLocaleString()} credits`) : ""}`);
287
- console.log(` ${c.gray(shortenPath(state.cwd, W - 2))}`);
288
- console.log(rule);
225
+ console.log(box(lines, { color: c.magenta, padX: 2 }));
289
226
  console.log("");
290
- // No bottom status bar here — the Ink input box renders its own persistent
291
- // status bar beneath it (one bar, Claude-style). The readline fallback prints
292
- // a one-line hint instead (see runRepl).
293
227
  }
294
228
 
295
229
  function printStatusLine(state) {
package/src/tools.js CHANGED
@@ -557,8 +557,7 @@ async function writeFile(args, opts) {
557
557
  if (exists && oldContent === args.content) {
558
558
  return { ok: true, output: `(no change — file already matches)` };
559
559
  }
560
- // Show diff + confirm
561
- console.log("");
560
+ // Show diff + confirm (the "● write <file>" label already spaced this block)
562
561
  console.log(summarizeWrite(oldContent, args.content, path.relative(opts.cwd, abs)));
563
562
  console.log(unifiedDiff(oldContent ?? "", args.content, path.relative(opts.cwd, abs)));
564
563
  const approved = await confirm(c.yellow("Apply this write?"), opts.autoYes);
@@ -593,7 +592,6 @@ async function editFile(args, opts) {
593
592
  ? oldContent.split(args.find).join(args.replace)
594
593
  : oldContent.replace(args.find, args.replace);
595
594
  const rel = path.relative(opts.cwd, abs);
596
- console.log("");
597
595
  console.log(c.dim(`edit ${rel}${args.replace_all ? ` (${occurrences} occurrences)` : ""}`));
598
596
  console.log(unifiedDiff(oldContent, newContent, rel));
599
597
  const approved = await confirm(c.yellow("Apply this edit?"), opts.autoYes);
@@ -722,7 +720,6 @@ export function htmlToText(html) {
722
720
  async function runShell(args, opts) {
723
721
  if (typeof args.command !== "string") return { ok: false, output: "command is required" };
724
722
  const cwd = args.cwd ? resolveSafe(args.cwd, opts) : opts.cwd;
725
- console.log("");
726
723
  console.log(c.yellow("$ ") + c.bold(args.command) + (args.cwd ? c.dim(` (cwd: ${args.cwd})`) : ""));
727
724
  const approved = await confirm(c.yellow("Run this command?"), opts.autoYes);
728
725
  if (!approved) return { ok: false, output: "User declined the command." };
@@ -829,7 +826,7 @@ function todoWrite(args, opts) {
829
826
  function renderTodos(todos) {
830
827
  if (!process.stdout.isTTY) return; // skip render in non-TTY (CI, piped, tests)
831
828
  console.log("");
832
- console.log(c.dim("─── Plan ───"));
829
+ console.log(c.cyan("●") + " " + c.bold("Plan"));
833
830
  for (const t of todos) {
834
831
  const icon =
835
832
  t.status === "completed"
@@ -842,7 +839,7 @@ function renderTodos(todos) {
842
839
  ? c.dim(t.content)
843
840
  : t.status === "in_progress"
844
841
  ? c.bold(t.content)
845
- : t.content;
842
+ : c.gray(t.content);
846
843
  console.log(` ${icon} ${text}`);
847
844
  }
848
845
  console.log("");