Skip to content

Commit de76c1f

Browse files
ralyodioclaude
andauthored
fix(tui): stop styling the agent-view notice as an error (#134)
`/agents <engine>` printed its notice through err(), so opening an engine's agent view rendered a red ✗ for what is purely informational — it reads as a failure when nothing failed. Split the two cases the message already covered: an agentsView engine is just opening a listing (info), while everything else really does bypass the engine's native approval prompts (new warn helper, amber ⚠). bin/moshcode.mjs printed ⚠ for both branches; it now matches. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a4cf5c5 commit de76c1f

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

bin/moshcode.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ function printEngineStatus(json = false) {
102102

103103
async function launchEngine(key, engine, args, { agentMode = false } = {}) {
104104
if (agentMode) {
105-
console.error(`⚠ agent mode: ${key} ${agentLaunchArgs(engine).join(" ")}${engine.agentsView ? " — opening its agent view" : " — native approvals/permissions are bypassed or auto-approved"}.`);
105+
const note = `agent mode: ${key} ${agentLaunchArgs(engine).join(" ")}`;
106+
console.error(engine.agentsView
107+
? ${note} — opening its agent view.`
108+
: `⚠ ${note} — native approvals/permissions are bypassed or auto-approved.`);
106109
}
107110
const result = await openSession(engine, agentMode ? agentLaunchArgs(engine, args) : args);
108111
if (!result.ok) {

src/tui.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { fetchMotdAd } from "./ads.mjs";
1818
import { runScript } from "./runtime.mjs";
1919
import { moshVocabulary } from "./commands.mjs";
2020
import { mcpCommand, skillCommand } from "./integrations.mjs";
21-
import { banner, hr, acid, ash, bone, dim, ok, err, info, moshcodeVersion } from "./ui.mjs";
21+
import { banner, hr, acid, ash, bone, dim, ok, err, warn, info, moshcodeVersion } from "./ui.mjs";
2222

2323
const PROMPT = () => acid("mosh ") + dim("▸ ");
2424

@@ -219,7 +219,12 @@ async function openEngine(key, engine, args, { agentMode = false } = {}) {
219219
console.log(info(`${key} isn't installed — try ${acid("/install " + key)} first.`));
220220
}
221221
if (agentMode) {
222-
console.log(err(`agent mode: ${key} ${agentLaunchArgs(engine).join(" ")}${engine.agentsView ? " — opening its agent view" : " — native approvals/permissions are bypassed or auto-approved"}.`));
222+
// An agent view is just a listing — plain info. Anything else means the
223+
// engine's own approval prompts are gone, which is worth a warning.
224+
const note = `agent mode: ${key} ${agentLaunchArgs(engine).join(" ")}`;
225+
console.log(engine.agentsView
226+
? info(`${note} — opening its agent view.`)
227+
: warn(`${note} — native approvals/permissions are bypassed or auto-approved.`));
223228
}
224229
console.log(info(`opening ${bone(key)}${agentMode ? " autonomously" : " raw"} — hand-off to its CLI, exit it to come back…`));
225230
console.log(hr());

src/ui.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ export const acid = rgb(158, 240, 26);
1919
export const bone = rgb(238, 242, 232);
2020
export const ash = rgb(139, 147, 138);
2121
export const danger = rgb(255, 77, 61);
22+
export const amber = rgb(255, 213, 61);
2223
export const spotify = rgb(29, 185, 84);
2324
export const dim = wrap(2, 22);
2425

2526
export const ok = (s) => acid("✓ ") + s;
2627
export const err = (s) => danger("✗ ") + s;
28+
export const warn = (s) => amber("⚠ ") + s;
2729
export const info = (s) => ash("· ") + s;
2830

2931
export function banner() {

0 commit comments

Comments
 (0)