Skip to content

Commit 71b18f8

Browse files
masonwyatt23claude
andcommitted
style: biome auto-format 5 files
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b7eb2c3 commit 71b18f8

5 files changed

Lines changed: 195 additions & 97 deletions

File tree

src/repl.tsx

Lines changed: 172 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { render } from "ink";
1212
import { join } from "path";
1313
import React from "react";
1414
import { type AgentContext, runWithAgentContext } from "./agent/async-context.ts";
15+
import { type AutopilotLoop, createAutopilotLoop } from "./agent/autopilot-loop.ts";
1516
import {
1617
autoCompact,
1718
contextCollapse,
@@ -28,11 +29,10 @@ import { detectTerminalFocus, KairosLoop } from "./agent/kairos.ts";
2829
import { runAgentLoop } from "./agent/loop.ts";
2930
import { SpeculationCache } from "./agent/speculation.ts";
3031
import { setSpeculationCache } from "./agent/tool-executor.ts";
32+
import { createVision, loadVision, saveVision, type Vision } from "./agent/vision.ts";
3133
import { WorkQueue } from "./autopilot/queue.ts";
3234
import { scanCodebase } from "./autopilot/scanner.ts";
3335
import { DEFAULT_CONFIG } from "./autopilot/types.ts";
34-
import { createAutopilotLoop, AutopilotLoop } from "./agent/autopilot-loop.ts";
35-
import { createVision, loadVision, saveVision, type Vision } from "./agent/vision.ts";
3636
import { getBridgePort, startBridgeServer, stopBridgeServer } from "./bridge/bridge-server.ts";
3737
import { feature, listFeatures } from "./config/features.ts";
3838
import {
@@ -440,11 +440,11 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
440440
"/transcript",
441441
"/transcript last",
442442
"/search",
443-
...state.skillRegistry.getAll().map((s) => s.trigger.startsWith("/") ? s.trigger : `/${s.trigger}`),
443+
...state.skillRegistry.getAll().map((s) => (s.trigger.startsWith("/") ? s.trigger : `/${s.trigger}`)),
444444
].filter((cmd, i, arr) => arr.indexOf(cmd) === i),
445445
cwd: state.toolContext.cwd,
446446
pendingQuestionOptionCount: hasPendingQuestion() ? getPendingOptions().length : 0,
447-
pendingQuestionLabels: hasPendingQuestion() ? getPendingOptions().map(o => o.label) : [],
447+
pendingQuestionLabels: hasPendingQuestion() ? getPendingOptions().map((o) => o.label) : [],
448448
};
449449
}
450450

@@ -475,7 +475,9 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
475475
// Route messages to autopilot if running and not a slash command
476476
if (autopilotRunning && autopilotLoop && !input.startsWith("/")) {
477477
autopilotLoop.queueUserMessage(input);
478-
addOutput(chalk.dim(` ⏳ Message sent to autopilot: "${input.length > 60 ? input.slice(0, 57) + "..." : input}"`));
478+
addOutput(
479+
chalk.dim(` ⏳ Message sent to autopilot: "${input.length > 60 ? input.slice(0, 57) + "..." : input}"`),
480+
);
479481
update();
480482
return;
481483
}
@@ -1249,38 +1251,71 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
12491251
addOutput(theme.accent(`\n 🚀 Resuming autopilot: ${vision.goal}\n`));
12501252
autopilotLoop = createAutopilotLoop();
12511253
autopilotRunning = true;
1252-
autopilotLoop.start(vision, {
1253-
router: state.router,
1254-
toolRegistry: state.registry,
1255-
toolContext: state.toolContext,
1256-
systemPrompt: state.baseSystemPrompt,
1257-
onProgress: (event) => {
1258-
switch (event.type) {
1259-
case "started": addOutput(theme.accent(` 🚀 Started: ${event.goal}`)); break;
1260-
case "tick": addOutput(theme.tertiary(` ⏱ Tick ${event.tickNumber} [${event.phase}]`)); break;
1261-
case "scanning": addOutput(theme.secondary(` 🔍 ${event.message}`)); break;
1262-
case "scan_complete": addOutput(theme.success(` ✓ Scan: ${event.newItems} new, ${event.totalItems} total`)); break;
1263-
case "executing": addOutput(theme.accent(` ⚡ ${event.itemDescription}`)); break;
1264-
case "item_complete": addOutput(event.success ? theme.success(` ✓ ${event.description}`) : theme.error(` ✗ ${event.description}: ${event.summary}`)); break;
1265-
case "wrapping_up": addOutput(theme.warning(" 🎁 Wrapping up...")); break;
1266-
case "stopped": addOutput(theme.accent(` ═══ ${event.summary}`)); break;
1267-
case "user_message": addOutput(theme.tertiary(` 📩 ${event.message}${event.action}`)); break;
1268-
case "assessing": addOutput(theme.secondary(` 🔮 ${event.message}`)); break;
1269-
case "assessment": addOutput(theme.secondary(` 📊 ${event.assessment}`)); break;
1270-
case "committing": addOutput(theme.tertiary(` 📝 ${event.message}`)); break;
1271-
case "notification": addOutput(theme.warning(` 🔔 ${event.title}: ${event.body}`)); break;
1272-
}
1254+
autopilotLoop
1255+
.start(vision, {
1256+
router: state.router,
1257+
toolRegistry: state.registry,
1258+
toolContext: state.toolContext,
1259+
systemPrompt: state.baseSystemPrompt,
1260+
onProgress: (event) => {
1261+
switch (event.type) {
1262+
case "started":
1263+
addOutput(theme.accent(` 🚀 Started: ${event.goal}`));
1264+
break;
1265+
case "tick":
1266+
addOutput(theme.tertiary(` ⏱ Tick ${event.tickNumber} [${event.phase}]`));
1267+
break;
1268+
case "scanning":
1269+
addOutput(theme.secondary(` 🔍 ${event.message}`));
1270+
break;
1271+
case "scan_complete":
1272+
addOutput(theme.success(` ✓ Scan: ${event.newItems} new, ${event.totalItems} total`));
1273+
break;
1274+
case "executing":
1275+
addOutput(theme.accent(` ⚡ ${event.itemDescription}`));
1276+
break;
1277+
case "item_complete":
1278+
addOutput(
1279+
event.success
1280+
? theme.success(` ✓ ${event.description}`)
1281+
: theme.error(` ✗ ${event.description}: ${event.summary}`),
1282+
);
1283+
break;
1284+
case "wrapping_up":
1285+
addOutput(theme.warning(" 🎁 Wrapping up..."));
1286+
break;
1287+
case "stopped":
1288+
addOutput(theme.accent(` ═══ ${event.summary}`));
1289+
break;
1290+
case "user_message":
1291+
addOutput(theme.tertiary(` 📩 ${event.message}${event.action}`));
1292+
break;
1293+
case "assessing":
1294+
addOutput(theme.secondary(` 🔮 ${event.message}`));
1295+
break;
1296+
case "assessment":
1297+
addOutput(theme.secondary(` 📊 ${event.assessment}`));
1298+
break;
1299+
case "committing":
1300+
addOutput(theme.tertiary(` 📝 ${event.message}`));
1301+
break;
1302+
case "notification":
1303+
addOutput(theme.warning(` 🔔 ${event.title}: ${event.body}`));
1304+
break;
1305+
}
1306+
update();
1307+
},
1308+
})
1309+
.then(() => {
1310+
autopilotRunning = false;
1311+
addOutput(theme.success("\n Autopilot finished.\n"));
12731312
update();
1274-
},
1275-
}).then(() => {
1276-
autopilotRunning = false;
1277-
addOutput(theme.success("\n Autopilot finished.\n"));
1278-
update();
1279-
}).catch((err: unknown) => {
1280-
autopilotRunning = false;
1281-
addOutput(theme.error(`\n Autopilot error: ${err instanceof Error ? err.message : String(err)}\n`));
1282-
update();
1283-
});
1313+
})
1314+
.catch((err: unknown) => {
1315+
autopilotRunning = false;
1316+
addOutput(theme.error(`\n Autopilot error: ${err instanceof Error ? err.message : String(err)}\n`));
1317+
update();
1318+
});
12841319
return true;
12851320
}
12861321

@@ -1339,12 +1374,18 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
13391374
addOutput(theme.secondary(`\n Progress (${vision.progress.length} entries):`));
13401375
for (const entry of vision.progress.slice(-10)) {
13411376
const date = entry.timestamp.split("T")[0];
1342-
addOutput(theme.tertiary(` [${date}] ${entry.summary} (+${entry.itemsCompleted}, -${entry.itemsFailed})`));
1377+
addOutput(
1378+
theme.tertiary(` [${date}] ${entry.summary} (+${entry.itemsCompleted}, -${entry.itemsFailed})`),
1379+
);
13431380
}
13441381
}
13451382
if (autopilotRunning && autopilotLoop) {
13461383
const status = autopilotLoop.getStatus();
1347-
addOutput(theme.success(`\n Status: RUNNING (tick ${status.tickNumber}, ${status.itemsCompleted} done, ${status.itemsFailed} failed, ${status.duration})`));
1384+
addOutput(
1385+
theme.success(
1386+
`\n Status: RUNNING (tick ${status.tickNumber}, ${status.itemsCompleted} done, ${status.itemsFailed} failed, ${status.duration})`,
1387+
),
1388+
);
13481389
} else {
13491390
addOutput(theme.tertiary(`\n Status: Stopped. /autopilot resume to continue`));
13501391
}
@@ -1367,52 +1408,104 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
13671408
addOutput(theme.accent("\n 📜 Autopilot History\n"));
13681409
for (const entry of vision.progress) {
13691410
const date = entry.timestamp.split("T")[0];
1370-
addOutput(theme.secondary(` [${date}] ${entry.summary} (+${entry.itemsCompleted}, -${entry.itemsFailed})`));
1411+
addOutput(
1412+
theme.secondary(` [${date}] ${entry.summary} (+${entry.itemsCompleted}, -${entry.itemsFailed})`),
1413+
);
13711414
}
13721415
addOutput("");
13731416
return true;
13741417
}
13751418

13761419
// If arg doesn't match a known subcommand, treat it as a vision goal
1377-
if (subCmd && !["scan", "queue", "status", "approve", "run", "auto", "stop", "wrap", "resume", "reset", "focus", "vision", "history"].includes(subCmd)) {
1420+
if (
1421+
subCmd &&
1422+
![
1423+
"scan",
1424+
"queue",
1425+
"status",
1426+
"approve",
1427+
"run",
1428+
"auto",
1429+
"stop",
1430+
"wrap",
1431+
"resume",
1432+
"reset",
1433+
"focus",
1434+
"vision",
1435+
"history",
1436+
].includes(subCmd)
1437+
) {
13781438
const visionText = arg!;
13791439
const cwd = state.toolContext.cwd;
13801440
const vision = await createVision(cwd, visionText);
13811441
addOutput(theme.accent(`\n 🚀 Autopilot started: ${vision.goal}\n`));
13821442
autopilotLoop = createAutopilotLoop();
13831443
autopilotRunning = true;
1384-
autopilotLoop.start(vision, {
1385-
router: state.router,
1386-
toolRegistry: state.registry,
1387-
toolContext: state.toolContext,
1388-
systemPrompt: state.baseSystemPrompt,
1389-
onProgress: (event) => {
1390-
switch (event.type) {
1391-
case "started": addOutput(theme.accent(` 🚀 Started: ${event.goal}`)); break;
1392-
case "tick": addOutput(theme.tertiary(` ⏱ Tick ${event.tickNumber} [${event.phase}]`)); break;
1393-
case "scanning": addOutput(theme.secondary(` 🔍 ${event.message}`)); break;
1394-
case "scan_complete": addOutput(theme.success(` ✓ Scan: ${event.newItems} new, ${event.totalItems} total`)); break;
1395-
case "executing": addOutput(theme.accent(` ⚡ ${event.itemDescription}`)); break;
1396-
case "item_complete": addOutput(event.success ? theme.success(` ✓ ${event.description}`) : theme.error(` ✗ ${event.description}: ${event.summary}`)); break;
1397-
case "wrapping_up": addOutput(theme.warning(" 🎁 Wrapping up...")); break;
1398-
case "stopped": addOutput(theme.accent(` ═══ ${event.summary}`)); break;
1399-
case "user_message": addOutput(theme.tertiary(` 📩 ${event.message}${event.action}`)); break;
1400-
case "assessing": addOutput(theme.secondary(` 🔮 ${event.message}`)); break;
1401-
case "assessment": addOutput(theme.secondary(` 📊 ${event.assessment}`)); break;
1402-
case "committing": addOutput(theme.tertiary(` 📝 ${event.message}`)); break;
1403-
case "notification": addOutput(theme.warning(` 🔔 ${event.title}: ${event.body}`)); break;
1404-
}
1444+
autopilotLoop
1445+
.start(vision, {
1446+
router: state.router,
1447+
toolRegistry: state.registry,
1448+
toolContext: state.toolContext,
1449+
systemPrompt: state.baseSystemPrompt,
1450+
onProgress: (event) => {
1451+
switch (event.type) {
1452+
case "started":
1453+
addOutput(theme.accent(` 🚀 Started: ${event.goal}`));
1454+
break;
1455+
case "tick":
1456+
addOutput(theme.tertiary(` ⏱ Tick ${event.tickNumber} [${event.phase}]`));
1457+
break;
1458+
case "scanning":
1459+
addOutput(theme.secondary(` 🔍 ${event.message}`));
1460+
break;
1461+
case "scan_complete":
1462+
addOutput(theme.success(` ✓ Scan: ${event.newItems} new, ${event.totalItems} total`));
1463+
break;
1464+
case "executing":
1465+
addOutput(theme.accent(` ⚡ ${event.itemDescription}`));
1466+
break;
1467+
case "item_complete":
1468+
addOutput(
1469+
event.success
1470+
? theme.success(` ✓ ${event.description}`)
1471+
: theme.error(` ✗ ${event.description}: ${event.summary}`),
1472+
);
1473+
break;
1474+
case "wrapping_up":
1475+
addOutput(theme.warning(" 🎁 Wrapping up..."));
1476+
break;
1477+
case "stopped":
1478+
addOutput(theme.accent(` ═══ ${event.summary}`));
1479+
break;
1480+
case "user_message":
1481+
addOutput(theme.tertiary(` 📩 ${event.message}${event.action}`));
1482+
break;
1483+
case "assessing":
1484+
addOutput(theme.secondary(` 🔮 ${event.message}`));
1485+
break;
1486+
case "assessment":
1487+
addOutput(theme.secondary(` 📊 ${event.assessment}`));
1488+
break;
1489+
case "committing":
1490+
addOutput(theme.tertiary(` 📝 ${event.message}`));
1491+
break;
1492+
case "notification":
1493+
addOutput(theme.warning(` 🔔 ${event.title}: ${event.body}`));
1494+
break;
1495+
}
1496+
update();
1497+
},
1498+
})
1499+
.then(() => {
1500+
autopilotRunning = false;
1501+
addOutput(theme.success("\n Autopilot finished.\n"));
14051502
update();
1406-
},
1407-
}).then(() => {
1408-
autopilotRunning = false;
1409-
addOutput(theme.success("\n Autopilot finished.\n"));
1410-
update();
1411-
}).catch((err: unknown) => {
1412-
autopilotRunning = false;
1413-
addOutput(theme.error(`\n Autopilot error: ${err instanceof Error ? err.message : String(err)}\n`));
1414-
update();
1415-
});
1503+
})
1504+
.catch((err: unknown) => {
1505+
autopilotRunning = false;
1506+
addOutput(theme.error(`\n Autopilot error: ${err instanceof Error ? err.message : String(err)}\n`));
1507+
update();
1508+
});
14161509
return true;
14171510
}
14181511

@@ -1443,7 +1536,11 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
14431536
addOutput(theme.accent("\n 🤖 Autopilot Status\n"));
14441537
addOutput(theme.primary(` Running: ${status.running ? "yes" : "no"}`));
14451538
addOutput(theme.secondary(` Tick: ${status.tickNumber}`));
1446-
addOutput(theme.secondary(` Completed: ${status.itemsCompleted} | Failed: ${status.itemsFailed} | Pending: ${status.queuePending}`));
1539+
addOutput(
1540+
theme.secondary(
1541+
` Completed: ${status.itemsCompleted} | Failed: ${status.itemsFailed} | Pending: ${status.queuePending}`,
1542+
),
1543+
);
14471544
addOutput(theme.secondary(` Duration: ${status.duration}`));
14481545
addOutput(theme.secondary(` Focus: ${status.focusState}`));
14491546
if (status.wrapUpRequested) {
@@ -2248,7 +2345,9 @@ export function startInkRepl(state: ReplState, maxCostUSD: number): void {
22482345

22492346
// Ultrathink banner
22502347
if (isUltrathinkTurn) {
2251-
const banner = chalk.bold.magentaBright(" ⚡ ULTRATHINK ") + chalk.magenta("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
2348+
const banner =
2349+
chalk.bold.magentaBright(" ⚡ ULTRATHINK ") +
2350+
chalk.magenta("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
22522351
addOutput(banner);
22532352
addOutput(chalk.magentaBright(" Deep reasoning enabled — extended thinking budget\n"));
22542353
}

src/skills/loader.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import { existsSync } from "fs";
11-
import { readFile, readdir } from "fs/promises";
11+
import { readdir, readFile } from "fs/promises";
1212
import { join, resolve } from "path";
1313
import { getConfigDir } from "../config/settings.ts";
1414
import type { SkillDefinition } from "./types.ts";
@@ -32,11 +32,7 @@ export async function loadSkills(cwd: string): Promise<SkillDefinition[]> {
3232
const seen = new Set<string>();
3333

3434
// Load from all sources (project overrides user overrides built-in)
35-
const dirs = [
36-
BUILT_IN_DIR,
37-
join(getConfigDir(), "skills"),
38-
join(cwd, ".ashlrcode", "skills"),
39-
];
35+
const dirs = [BUILT_IN_DIR, join(getConfigDir(), "skills"), join(cwd, ".ashlrcode", "skills")];
4036

4137
for (const dir of dirs) {
4238
if (!existsSync(dir)) continue;

src/tools/agent.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@
66
*/
77

88
import chalk from "chalk";
9-
import type { Tool, ToolContext } from "./types.ts";
109
import { runSubAgent, type SubAgentConfig } from "../agent/sub-agent.ts";
1110
import type { ProviderRouter } from "../providers/router.ts";
1211
import type { ToolRegistry } from "../tools/registry.ts";
12+
import type { Tool, ToolContext } from "./types.ts";
1313

1414
// These get injected at registration time
1515
let _router: ProviderRouter | null = null;
1616
let _registry: ToolRegistry | null = null;
1717
let _systemPrompt: string = "";
1818

19-
export function initAgentTool(
20-
router: ProviderRouter,
21-
registry: ToolRegistry,
22-
systemPrompt: string
23-
) {
19+
export function initAgentTool(router: ProviderRouter, registry: ToolRegistry, systemPrompt: string) {
2420
_router = router;
2521
_registry = registry;
2622
_systemPrompt = systemPrompt;
@@ -103,7 +99,9 @@ The sub-agent's findings are returned as text. Provide a clear, specific prompt
10399
const result = await runSubAgent({
104100
name: description,
105101
prompt,
106-
systemPrompt: _systemPrompt + "\n\nYou are a sub-agent. Be thorough but concise. Report your findings clearly with file paths and line numbers.",
102+
systemPrompt:
103+
_systemPrompt +
104+
"\n\nYou are a sub-agent. Be thorough but concise. Report your findings clearly with file paths and line numbers.",
107105
router: _router!,
108106
toolRegistry: _registry!,
109107
toolContext: context,
@@ -123,7 +121,7 @@ The sub-agent's findings are returned as text. Provide a clear, specific prompt
123121
counts.set(t.name, (counts.get(t.name) ?? 0) + 1);
124122
}
125123
const collapsed = Array.from(counts.entries())
126-
.map(([name, count]) => count > 1 ? `${name} x${count}` : name)
124+
.map(([name, count]) => (count > 1 ? `${name} x${count}` : name))
127125
.join(", ");
128126
toolSummary = `\n\nTools used: ${collapsed}`;
129127
}

0 commit comments

Comments
 (0)