aether-code 0.20.0 → 0.21.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/menu.js +83 -0
- package/src/render.js +2 -0
- package/src/repl.js +1 -1
- package/src/tools.js +46 -0
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.21.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.21.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/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
|
@@ -54,6 +54,7 @@ export function toolLabel(name, args) {
|
|
|
54
54
|
case "web_search": return `${verb("search web")} ${arg(JSON.stringify(a.query ?? ""))}`;
|
|
55
55
|
case "web_fetch": return `${verb("fetch")} ${arg(a.url)}`;
|
|
56
56
|
case "todo_write": return ""; // its Plan box is the label
|
|
57
|
+
case "ask_user": return ""; // the interactive menu is its display
|
|
57
58
|
default: return `${verb(name)} ${arg(JSON.stringify(a))}`;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -79,6 +80,7 @@ export function toolSummary(name, result) {
|
|
|
79
80
|
return ` ${mark} ${c.gray(code === null ? (ok ? "done" : "failed") : `exit ${code}`)}`;
|
|
80
81
|
}
|
|
81
82
|
if (name === "todo_write") return ""; // the Plan box is its own feedback
|
|
83
|
+
if (name === "ask_user") return ""; // the menu already showed the answer
|
|
82
84
|
if (name === "write_file" || name === "edit_file") {
|
|
83
85
|
// Handler already printed the diff; echo its short status line.
|
|
84
86
|
return ` ${mark} ${c.gray(ellip(firstLine, 100))}`;
|
package/src/repl.js
CHANGED
|
@@ -17,7 +17,7 @@ import { c, errorLine } 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
|
+
const VERSION = "0.21.0";
|
|
21
21
|
const MODEL_NAME = "Aether Core";
|
|
22
22
|
|
|
23
23
|
const SHORTCUTS = `
|
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);
|