aether-code 0.20.0 → 0.22.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.20.0";
29
+ const VERSION = "0.22.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.20.0",
3
+ "version": "0.22.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");
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/menu.js ADDED
@@ -0,0 +1,83 @@
1
+ // Interactive multiple-choice menu — arrow/number selectable, cmd.exe-safe.
2
+ //
3
+ // Deliberately NOT Ink (which ghosts in the legacy Windows console). Uses a
4
+ // simple manual redraw: print the list, and on each keypress move the cursor
5
+ // back up to the top of the menu (ESC[nA) and clear-to-end (ESC[J), then
6
+ // reprint. That's the same VT layer that already renders our ANSI colours, so
7
+ // it works in cmd.exe, Windows Terminal, and POSIX terminals alike.
8
+ //
9
+ // Returns the chosen option object ({label, description}), or null if cancelled.
10
+
11
+ import readline from "node:readline";
12
+ import { c } from "./render.js";
13
+
14
+ const ellip = (s, n) => (s && s.length > n ? s.slice(0, n - 1) + "…" : s || "");
15
+
16
+ export function promptChoice({ question, options }) {
17
+ const opts = (options || [])
18
+ .map((o) => (typeof o === "string" ? { label: o } : o))
19
+ .filter((o) => o && o.label);
20
+
21
+ return new Promise((resolve) => {
22
+ // Non-interactive (piped / CI): pick the first option so automation never
23
+ // hangs waiting on a keypress that can't come. Print a note so it's visible.
24
+ if (!process.stdin.isTTY || opts.length === 0) {
25
+ const pick = opts[0] ?? null;
26
+ if (pick) process.stdout.write(c.cyan("● ") + c.bold(question) + c.gray(` → ${pick.label} (auto)\n`));
27
+ resolve(pick);
28
+ return;
29
+ }
30
+
31
+ let sel = 0;
32
+ const total = opts.length + 3; // question line + options + blank + hint line
33
+
34
+ const draw = (first) => {
35
+ if (!first) process.stdout.write(`\x1b[${total}A`); // cursor up to menu top
36
+ process.stdout.write("\x1b[J"); // clear from cursor to end of screen
37
+ process.stdout.write(c.cyan("● ") + c.bold(question) + "\n");
38
+ opts.forEach((o, i) => {
39
+ const active = i === sel;
40
+ const pointer = active ? c.cyan("→") : " ";
41
+ const num = active ? c.cyan(c.bold(`${i + 1}.`)) : c.gray(`${i + 1}.`);
42
+ const label = active ? c.bold(o.label) : o.label;
43
+ const desc = o.description ? c.gray(" " + ellip(o.description, 60)) : "";
44
+ process.stdout.write(` ${pointer} ${num} ${label}${desc}\n`);
45
+ });
46
+ process.stdout.write("\n" + c.gray(" ↑/↓ move · 1-9 pick · Enter select · Esc cancel") + "\n");
47
+ };
48
+
49
+ const cleanup = () => {
50
+ process.stdin.removeListener("keypress", onKey);
51
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
52
+ process.stdin.pause();
53
+ };
54
+
55
+ const finish = (result) => {
56
+ cleanup();
57
+ // Collapse the menu to a compact answer line so the transcript stays clean.
58
+ process.stdout.write(`\x1b[${total}A\x1b[J`);
59
+ process.stdout.write(c.cyan("● ") + c.bold(question) + "\n");
60
+ if (result) process.stdout.write(" " + c.cyan("→") + " " + c.green(result.label) + "\n\n");
61
+ else process.stdout.write(" " + c.gray("(cancelled — proceeding with best judgment)") + "\n\n");
62
+ resolve(result);
63
+ };
64
+
65
+ const onKey = (str, key) => {
66
+ if (!key) return;
67
+ if (key.name === "up" || key.name === "k") { sel = (sel - 1 + opts.length) % opts.length; draw(false); }
68
+ else if (key.name === "down" || key.name === "j" || key.name === "tab") { sel = (sel + 1) % opts.length; draw(false); }
69
+ else if (str && /^[1-9]$/.test(str)) {
70
+ const i = parseInt(str, 10) - 1;
71
+ if (i < opts.length) finish(opts[i]);
72
+ }
73
+ else if (key.name === "return") finish(opts[sel]);
74
+ else if (key.name === "escape" || (key.ctrl && key.name === "c")) finish(null);
75
+ };
76
+
77
+ readline.emitKeypressEvents(process.stdin);
78
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
79
+ process.stdin.resume();
80
+ process.stdin.on("keypress", onKey);
81
+ draw(true);
82
+ });
83
+ }
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
  }
@@ -54,6 +69,7 @@ export function toolLabel(name, args) {
54
69
  case "web_search": return `${verb("search web")} ${arg(JSON.stringify(a.query ?? ""))}`;
55
70
  case "web_fetch": return `${verb("fetch")} ${arg(a.url)}`;
56
71
  case "todo_write": return ""; // its Plan box is the label
72
+ case "ask_user": return ""; // the interactive menu is its display
57
73
  default: return `${verb(name)} ${arg(JSON.stringify(a))}`;
58
74
  }
59
75
  }
@@ -69,19 +85,21 @@ export function setTerminalTitle(title) {
69
85
  // plan) just get a check — the detail was already printed.
70
86
  export function toolSummary(name, result) {
71
87
  const ok = result.ok;
72
- 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("└─");
73
90
  const out = result.output ?? "";
74
91
  const firstLine = out.split("\n").find((l) => l.trim()) ?? "";
75
92
 
76
93
  if (name === "run_shell") {
77
94
  let code = null;
78
95
  try { code = JSON.parse(out).exit_code; } catch { /* ignore */ }
79
- return ` ${mark} ${c.gray(code === null ? (ok ? "done" : "failed") : `exit ${code}`)}`;
96
+ return ` ${branch} ${c.gray(code === null ? (ok ? "done" : "failed") : `exit ${code}`)}`;
80
97
  }
81
- if (name === "todo_write") return ""; // the Plan box is its own feedback
98
+ if (name === "todo_write") return ""; // the Plan is its own feedback
99
+ if (name === "ask_user") return ""; // the menu already showed the answer
82
100
  if (name === "write_file" || name === "edit_file") {
83
101
  // Handler already printed the diff; echo its short status line.
84
- return ` ${mark} ${c.gray(ellip(firstLine, 100))}`;
102
+ return ` ${branch} ${c.gray(ellip(firstLine, 100))}`;
85
103
  }
86
104
  let summary = "";
87
105
  try {
@@ -93,7 +111,7 @@ export function toolSummary(name, result) {
93
111
  if (!summary) {
94
112
  summary = name === "read_file" ? `${out.split("\n").length} lines` : ellip(firstLine, 100);
95
113
  }
96
- return ` ${mark} ${c.gray(summary)}`;
114
+ return ` ${branch} ${c.gray(summary)}`;
97
115
  }
98
116
 
99
117
  // Strip model "harmony"/channel control tokens (<|channel|>, <|message|>,
package/src/repl.js CHANGED
@@ -13,11 +13,11 @@ import path from "node:path";
13
13
  import { runAgent } from "./agent.js";
14
14
  import { fetchBalance, AetherError } from "./api.js";
15
15
  import { runSetup } from "./setup.js";
16
- import { c, errorLine } from "./render.js";
16
+ import { c, errorLine, box } from "./render.js";
17
17
  import { checkForUpdate } from "./update-check.js";
18
18
  import { promptBoxed, EXIT_SIGNAL } from "./ink-input.js";
19
19
 
20
- const VERSION = "0.20.0";
20
+ const VERSION = "0.22.0";
21
21
  const MODEL_NAME = "Aether Core";
22
22
 
23
23
  const SHORTCUTS = `
@@ -272,24 +272,16 @@ const visLen = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
272
272
  const shortenPath = (p, max) => (p.length <= max ? p : "..." + p.slice(p.length - max + 3));
273
273
 
274
274
  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
275
  const mode = state.autoYes ? (state.unsafePaths ? "skip-permissions" : "auto-yes") : "review mode";
281
-
276
+ const credits = state.balance != null ? `${state.balance.toLocaleString()} credits · ` : "";
277
+ const lines = [
278
+ c.bold(c.magenta("aether")) + c.gray(" · ") + c.bold(MODEL_NAME) + c.gray(" v" + VERSION),
279
+ c.gray("1M context · uncensored · " + mode),
280
+ c.gray(credits + shortenPath(state.cwd, 52)),
281
+ ];
282
282
  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);
283
+ console.log(box(lines, { color: c.magenta, padX: 2 }));
289
284
  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
285
  }
294
286
 
295
287
  function printStatusLine(state) {
package/src/tools.js CHANGED
@@ -13,6 +13,7 @@ import path from "node:path";
13
13
  import readline from "node:readline";
14
14
  import { spawn } from "node:child_process";
15
15
  import { c } from "./render.js";
16
+ import { promptChoice } from "./menu.js";
16
17
  import { unifiedDiff, summarizeWrite } from "./diff.js";
17
18
  import { getConfig } from "./config.js";
18
19
 
@@ -194,6 +195,33 @@ export const TOOL_DEFINITIONS = [
194
195
  },
195
196
  },
196
197
  },
198
+ {
199
+ type: "function",
200
+ function: {
201
+ name: "ask_user",
202
+ description:
203
+ "Ask the user a single multiple-choice question and wait for their answer. Use this ONLY when the request is genuinely ambiguous AND the answer materially changes what you build — e.g. which platform/framework/language, the scope, or an irreversible decision. Ask BEFORE building when a wrong assumption would waste real work. Give 2–5 concrete options, each with a short description; put the best default first. Do NOT use it for trivial choices, things you can infer, or to confirm permission to act — just build when the task is clear.",
204
+ parameters: {
205
+ type: "object",
206
+ properties: {
207
+ question: { type: "string", description: "The single, focused question to ask." },
208
+ options: {
209
+ type: "array",
210
+ description: "2–5 options. Each is {label, description}. Best default first.",
211
+ items: {
212
+ type: "object",
213
+ properties: {
214
+ label: { type: "string", description: "Short option label." },
215
+ description: { type: "string", description: "One-line explanation of this option." },
216
+ },
217
+ required: ["label"],
218
+ },
219
+ },
220
+ },
221
+ required: ["question", "options"],
222
+ },
223
+ },
224
+ },
197
225
  ];
198
226
 
199
227
  /* ─────────────────────── Argument validation ─────────────────────── */
@@ -362,6 +390,7 @@ export async function executeTool(call, opts) {
362
390
  web_search: () => webSearch(args, opts),
363
391
  web_fetch: () => webFetch(args, opts),
364
392
  todo_write: () => todoWrite(args, opts),
393
+ ask_user: () => askUser(args, opts),
365
394
  };
366
395
  const fn = handlers[name];
367
396
  if (!fn) {
@@ -374,6 +403,23 @@ export async function executeTool(call, opts) {
374
403
  }
375
404
  }
376
405
 
406
+ // Ask the user a multiple-choice question and block on their answer. Not a
407
+ // permission gate — it runs even in skip-permissions mode, because the model is
408
+ // explicitly requesting input. In a non-TTY the menu auto-picks the first
409
+ // option so scripted runs don't hang.
410
+ async function askUser(args, _opts) {
411
+ const options = Array.isArray(args.options) ? args.options : [];
412
+ if (options.length === 0) {
413
+ return { ok: false, output: "ask_user requires a non-empty options array" };
414
+ }
415
+ const choice = await promptChoice({ question: String(args.question || "Which option?"), options });
416
+ if (!choice) {
417
+ return { ok: true, output: "The user cancelled the question. Proceed with your best judgment." };
418
+ }
419
+ const extra = choice.description ? ` (${choice.description})` : "";
420
+ return { ok: true, output: `The user chose: ${choice.label}${extra}` };
421
+ }
422
+
377
423
  function readFile(args, opts) {
378
424
  if (typeof args.path !== "string") return { ok: false, output: "path is required" };
379
425
  const abs = resolveSafe(args.path, opts);
@@ -511,8 +557,7 @@ async function writeFile(args, opts) {
511
557
  if (exists && oldContent === args.content) {
512
558
  return { ok: true, output: `(no change — file already matches)` };
513
559
  }
514
- // Show diff + confirm
515
- console.log("");
560
+ // Show diff + confirm (the "● write <file>" label already spaced this block)
516
561
  console.log(summarizeWrite(oldContent, args.content, path.relative(opts.cwd, abs)));
517
562
  console.log(unifiedDiff(oldContent ?? "", args.content, path.relative(opts.cwd, abs)));
518
563
  const approved = await confirm(c.yellow("Apply this write?"), opts.autoYes);
@@ -547,7 +592,6 @@ async function editFile(args, opts) {
547
592
  ? oldContent.split(args.find).join(args.replace)
548
593
  : oldContent.replace(args.find, args.replace);
549
594
  const rel = path.relative(opts.cwd, abs);
550
- console.log("");
551
595
  console.log(c.dim(`edit ${rel}${args.replace_all ? ` (${occurrences} occurrences)` : ""}`));
552
596
  console.log(unifiedDiff(oldContent, newContent, rel));
553
597
  const approved = await confirm(c.yellow("Apply this edit?"), opts.autoYes);
@@ -676,7 +720,6 @@ export function htmlToText(html) {
676
720
  async function runShell(args, opts) {
677
721
  if (typeof args.command !== "string") return { ok: false, output: "command is required" };
678
722
  const cwd = args.cwd ? resolveSafe(args.cwd, opts) : opts.cwd;
679
- console.log("");
680
723
  console.log(c.yellow("$ ") + c.bold(args.command) + (args.cwd ? c.dim(` (cwd: ${args.cwd})`) : ""));
681
724
  const approved = await confirm(c.yellow("Run this command?"), opts.autoYes);
682
725
  if (!approved) return { ok: false, output: "User declined the command." };
@@ -783,7 +826,7 @@ function todoWrite(args, opts) {
783
826
  function renderTodos(todos) {
784
827
  if (!process.stdout.isTTY) return; // skip render in non-TTY (CI, piped, tests)
785
828
  console.log("");
786
- console.log(c.dim("─── Plan ───"));
829
+ console.log(c.cyan("●") + " " + c.bold("Plan"));
787
830
  for (const t of todos) {
788
831
  const icon =
789
832
  t.status === "completed"
@@ -796,7 +839,7 @@ function renderTodos(todos) {
796
839
  ? c.dim(t.content)
797
840
  : t.status === "in_progress"
798
841
  ? c.bold(t.content)
799
- : t.content;
842
+ : c.gray(t.content);
800
843
  console.log(` ${icon} ${text}`);
801
844
  }
802
845
  console.log("");