aether-code 0.23.0 → 0.25.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.
@@ -9,6 +9,8 @@
9
9
 
10
10
  import process from "node:process";
11
11
  import path from "node:path";
12
+ import os from "node:os";
13
+ import fs from "node:fs";
12
14
  import { runAgent } from "../src/agent.js";
13
15
  import { runRepl } from "../src/repl.js";
14
16
  import { runSetup } from "../src/setup.js";
@@ -26,7 +28,7 @@ import {
26
28
  import readline from "node:readline";
27
29
  import { c, errorLine, divider, setTerminalTitle } from "../src/render.js";
28
30
 
29
- const VERSION = "0.23.0";
31
+ const VERSION = "0.25.0";
30
32
 
31
33
  /**
32
34
  * Try to start MCP servers from ~/.aether/mcp.json. Returns a started
@@ -132,6 +134,18 @@ function die(msg, code = 1) {
132
134
  process.exit(code);
133
135
  }
134
136
 
137
+ // True for Windows system folders we should never write a user's project into.
138
+ function isSystemDir(p) {
139
+ const low = p.toLowerCase().replace(/[\\/]+$/, "").replace(/\//g, "\\");
140
+ return (
141
+ low.endsWith("\\windows\\system32") ||
142
+ low.endsWith("\\windows\\syswow64") ||
143
+ low.endsWith("\\windows") ||
144
+ low.endsWith("\\system32") ||
145
+ /\\program files( \(x86\))?$/.test(low)
146
+ );
147
+ }
148
+
135
149
  async function main() {
136
150
  const args = parseArgs(process.argv.slice(2));
137
151
  setTerminalTitle("Aether");
@@ -145,7 +159,16 @@ async function main() {
145
159
  return;
146
160
  }
147
161
 
148
- const cwd = args.flags.cwd ? path.resolve(args.flags.cwd) : process.cwd();
162
+ // Where files land. If the user didn't pass --cwd and we were launched from a
163
+ // Windows system folder (admin cmd opens in C:\WINDOWS\system32), don't dump
164
+ // their project there — they'd never find it. Work in the Desktop instead.
165
+ let cwd = args.flags.cwd ? path.resolve(args.flags.cwd) : process.cwd();
166
+ let redirectedFrom = null;
167
+ if (!args.flags.cwd && isSystemDir(cwd)) {
168
+ const desktop = path.join(os.homedir(), "Desktop");
169
+ const target = fs.existsSync(desktop) ? desktop : os.homedir();
170
+ if (target.toLowerCase() !== cwd.toLowerCase()) { redirectedFrom = cwd; cwd = target; }
171
+ }
149
172
  // Skip-permissions by DEFAULT (like `claude --dangerously-skip-permissions`):
150
173
  // auto-approve writes/shell and don't sandbox file paths, so the agent can
151
174
  // just build. Opt back in with --review (y/N before each action) and
@@ -184,6 +207,10 @@ async function main() {
184
207
  if (!prompt) {
185
208
  if (cwd !== process.cwd()) process.chdir(cwd);
186
209
  const mcpManager = await bootMcp();
210
+ if (redirectedFrom) {
211
+ console.log(c.gray(`Note: launched from a system folder (${redirectedFrom}).`));
212
+ console.log(c.gray(`Your files will be saved to ${c.cyan(cwd)} so you can find them. Use ${c.cyan("--cwd <path>")} or ${c.cyan("/cwd")} to change.`));
213
+ }
187
214
  await runRepl({ cwd, autoYes, unsafePaths, maxTurns, mcpManager });
188
215
  return;
189
216
  }
@@ -198,6 +225,7 @@ async function main() {
198
225
  console.log(divider());
199
226
  const modeLabel = autoYes && unsafePaths ? " · skip-permissions" : `${autoYes ? " · auto-yes" : " · review"}${unsafePaths ? "" : " · sandboxed"}`;
200
227
  console.log(c.magenta(c.bold("aether-code")) + c.gray(` · cwd ${cwd}${modeLabel}`));
228
+ if (redirectedFrom) console.log(c.gray(`(launched from ${redirectedFrom} — saving to ${cwd} instead)`));
201
229
  console.log(c.gray(`task: `) + prompt);
202
230
  console.log(divider());
203
231
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aether-code",
3
- "version": "0.23.0",
3
+ "version": "0.25.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
@@ -8,7 +8,7 @@ import { agentTurnStream, AetherError } from "./api.js";
8
8
  import { TOOL_DEFINITIONS, executeTool } from "./tools.js";
9
9
  import { unnamespaceToolName } from "./mcp.js";
10
10
  import { loadAllSkills, selectSkills, renderSkillsBlock } from "./skills.js";
11
- import { c, divider, turn, toolLabel, toolSummary, makeTokenStripper, errorLine } from "./render.js";
11
+ import { c, divider, turn, toolLabel, toolSummary, makeTokenStripper, errorLine, startSpinner } from "./render.js";
12
12
 
13
13
  const DEFAULT_MAX_TURNS = 25;
14
14
 
@@ -77,6 +77,12 @@ export async function runAgent({
77
77
  let totalIn = 0;
78
78
  let totalOut = 0;
79
79
  let lastBalance = null;
80
+ // Loop guard: count identical (name+args) tool calls across the whole run so a
81
+ // confused model can't burn turns re-running the same call (e.g. glob *.md x9).
82
+ const callCounts = new Map();
83
+ // Files the run created/edited, shown in a summary at the end so the user
84
+ // knows exactly what was produced and where to find it.
85
+ const filesTouched = new Map();
80
86
 
81
87
  for (let i = 0; i < maxTurns; i++) {
82
88
  // No turn header and no leading blank here — each step (assistant text and
@@ -98,6 +104,11 @@ export async function runAgent({
98
104
  const turnMessages = buildTurnMessages(messages, allSkills, referencedPaths);
99
105
 
100
106
  let res;
107
+ // "Thinking" spinner: shown from request-send until the first token or tool
108
+ // call arrives, so the wait doesn't look dead. Stopped exactly once.
109
+ const spinner = startSpinner("thinking");
110
+ let spinStopped = false;
111
+ const stopSpin = () => { if (!spinStopped) { spinStopped = true; spinner.stop(); } };
101
112
  try {
102
113
  res = await agentTurnStream({
103
114
  messages: turnMessages,
@@ -107,6 +118,7 @@ export async function runAgent({
107
118
  // be split across stream chunks) before display.
108
119
  const clean = stripper.push(text);
109
120
  if (!clean) return;
121
+ stopSpin();
110
122
  if (!lastWasText) {
111
123
  process.stdout.write("\n" + c.cyan("● "));
112
124
  lastWasText = true;
@@ -118,6 +130,7 @@ export async function runAgent({
118
130
  // call — the clean label is printed at execution time, so no noisy
119
131
  // "preparing args" placeholder here.
120
132
  if (delta.name && !announced.has(delta.index)) {
133
+ stopSpin();
121
134
  announced.add(delta.index);
122
135
  if (lastWasText) process.stdout.write("\n");
123
136
  lastWasText = false;
@@ -125,11 +138,13 @@ export async function runAgent({
125
138
  },
126
139
  });
127
140
  } catch (err) {
141
+ stopSpin();
128
142
  if (err instanceof AetherError) {
129
143
  return { ok: false, error: err, totalCredits, totalIn, totalOut, balance: lastBalance, messages };
130
144
  }
131
145
  throw err;
132
146
  }
147
+ stopSpin(); // ensure it's cleared even if the turn produced no output
133
148
 
134
149
  // Flush any held-back partial token, then close the line.
135
150
  const tail = stripper.flush();
@@ -155,6 +170,12 @@ export async function runAgent({
155
170
 
156
171
  const toolCalls = res.message.tool_calls ?? [];
157
172
  if (toolCalls.length === 0) {
173
+ if (filesTouched.size) {
174
+ console.log("\n" + c.bold("Files") + c.gray(` in ${cwd}`));
175
+ for (const [p, action] of filesTouched) {
176
+ console.log(" " + c.green("●") + " " + p + c.gray(` — ${action}`));
177
+ }
178
+ }
158
179
  return { ok: true, totalCredits, totalIn, totalOut, turns: i + 1, balance: lastBalance, messages };
159
180
  }
160
181
 
@@ -167,14 +188,37 @@ export async function runAgent({
167
188
  const label = toolLabel(call.function.name, args);
168
189
  if (label) console.log("\n" + c.cyan("●") + " " + label);
169
190
 
191
+ // Loop guard — short-circuit a tool call we've already run 3+ times with
192
+ // the same args, and tell the model to change approach instead of looping.
193
+ const sig = `${call.function.name}:${call.function.arguments || ""}`;
194
+ const seen = (callCounts.get(sig) || 0) + 1;
195
+ callCounts.set(sig, seen);
196
+ if (seen > 3) {
197
+ console.log(" " + c.red("└─") + " " + c.gray("skipped (repeated call)"));
198
+ messages.push({
199
+ role: "tool",
200
+ tool_call_id: call.id,
201
+ content:
202
+ "STOP: you have already run this exact tool call 3 times and the result will not change. Do NOT call it again. " +
203
+ "If you were looking for a file that doesn't exist, create it with write_file. Otherwise change approach or finish and summarize.",
204
+ });
205
+ continue;
206
+ }
207
+
170
208
  // Route to MCP if the tool name is namespaced (mcp__server__tool);
171
209
  // otherwise execute the built-in tool. unnamespaceToolName returns
172
210
  // null for non-MCP names, which is our cheap dispatch test.
211
+ const slow = call.function.name === "web_search" || call.function.name === "web_fetch";
212
+ const tspin = slow ? startSpinner(call.function.name === "web_search" ? "searching the web" : "fetching page") : null;
173
213
  let result;
174
- if (mcpManager && unnamespaceToolName(call.function.name)) {
175
- result = await mcpManager.callTool(call.function.name, args);
176
- } else {
177
- result = await executeTool(call, { cwd, autoYes, unsafePaths });
214
+ try {
215
+ if (mcpManager && unnamespaceToolName(call.function.name)) {
216
+ result = await mcpManager.callTool(call.function.name, args);
217
+ } else {
218
+ result = await executeTool(call, { cwd, autoYes, unsafePaths });
219
+ }
220
+ } finally {
221
+ if (tspin) tspin.stop();
178
222
  }
179
223
 
180
224
  // Track paths the model has touched. Skills with path-pattern triggers
@@ -183,6 +227,10 @@ export async function runAgent({
183
227
  if (call.function.name === "read_file" || call.function.name === "edit_file" || call.function.name === "write_file") {
184
228
  if (typeof args.path === "string") referencedPaths.push(args.path);
185
229
  }
230
+ if (result.ok && typeof args.path === "string" && (call.function.name === "write_file" || call.function.name === "edit_file")) {
231
+ const rel = path.relative(cwd, path.resolve(cwd, args.path)) || args.path;
232
+ filesTouched.set(rel, call.function.name === "write_file" ? "created" : "edited");
233
+ }
186
234
  const summary = toolSummary(call.function.name, result);
187
235
  if (summary) console.log(summary);
188
236
 
package/src/render.js CHANGED
@@ -63,7 +63,7 @@ export function toolLabel(name, args) {
63
63
  case "write_file": return `${verb("write")} ${arg(a.path)}`;
64
64
  case "edit_file": return `${verb("edit")} ${arg(a.path)}`;
65
65
  case "list_dir": return `${verb("list")} ${arg(a.path)}`;
66
- case "glob_files": return `${verb("glob")} ${arg(a.pattern)}`;
66
+ case "glob_files": return `${verb("find")} ${arg(a.pattern)}`;
67
67
  case "search_files": return `${verb("search")} ${arg(`/${a.pattern}/ in ${a.path ?? "."}`)}`;
68
68
  case "run_shell": return `${verb("run")} ${arg(a.command)}`;
69
69
  case "web_search": return `${verb("search web")} ${arg(JSON.stringify(a.query ?? ""))}`;
@@ -80,6 +80,33 @@ export function setTerminalTitle(title) {
80
80
  if (process.stdout.isTTY) process.stdout.write(`\x1b]0;${title}\x07`);
81
81
  }
82
82
 
83
+ // Live "working…" spinner. Rewrites a single line in place (\r) with a rotating
84
+ // half-circle (Geometric Shapes — same block as ●, so cmd.exe-safe) + elapsed
85
+ // seconds, so the user sees the agent is alive while the model thinks or a slow
86
+ // tool runs. stop() clears the line and restores the cursor. No-op in non-TTY.
87
+ export function startSpinner(label) {
88
+ if (!process.stdout.isTTY) return { stop: () => {} };
89
+ const frames = ["◐", "◓", "◑", "◒"];
90
+ const t0 = Date.now();
91
+ let i = 0;
92
+ process.stdout.write("\x1b[?25l"); // hide cursor
93
+ const render = () => {
94
+ const s = Math.floor((Date.now() - t0) / 1000);
95
+ const tail = s > 0 ? c.gray(` ${s}s`) : "";
96
+ process.stdout.write(`\r\x1b[K${c.cyan(frames[i % frames.length])} ${c.gray(label + "…")}${tail}`);
97
+ i++;
98
+ };
99
+ render();
100
+ const timer = setInterval(render, 120);
101
+ if (typeof timer.unref === "function") timer.unref(); // don't keep the process alive
102
+ return {
103
+ stop: () => {
104
+ clearInterval(timer);
105
+ process.stdout.write("\r\x1b[K\x1b[?25h"); // clear line + show cursor
106
+ },
107
+ };
108
+ }
109
+
83
110
  // Terse one-line result summary instead of dumping raw JSON / file contents.
84
111
  // Tools whose handlers already render rich output (diffs, the shell stream, the
85
112
  // plan) just get a check — the detail was already printed.
package/src/repl.js CHANGED
@@ -16,7 +16,7 @@ import { c, errorLine, box } from "./render.js";
16
16
  import { checkForUpdate } from "./update-check.js";
17
17
  import { promptBox, EXIT_SIGNAL } from "./box-input.js";
18
18
 
19
- const VERSION = "0.23.0";
19
+ const VERSION = "0.25.0";
20
20
  const MODEL_NAME = "Aether Core";
21
21
 
22
22
  const SHORTCUTS = `
package/src/tools.js CHANGED
@@ -574,7 +574,12 @@ async function editFile(args, opts) {
574
574
  return { ok: false, output: "path, find, replace are required" };
575
575
  }
576
576
  const abs = resolveSafe(args.path, opts);
577
- if (!fs.existsSync(abs)) return { ok: false, output: `File not found: ${args.path}` };
577
+ if (!fs.existsSync(abs)) {
578
+ return {
579
+ ok: false,
580
+ output: `File not found: ${args.path}. It doesn't exist yet — use write_file to CREATE it (edit_file only modifies existing files). Do not retry edit_file on this path.`,
581
+ };
582
+ }
578
583
  const oldContent = fs.readFileSync(abs, "utf8");
579
584
  const occurrences = oldContent.split(args.find).length - 1;
580
585
  if (occurrences === 0) {