agent.libx.js 0.94.10 → 0.94.12
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/README.md +2 -0
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +175 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.js +21 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,6 +109,8 @@ agentx --resume <id> "…" # resume a specific session
|
|
|
109
109
|
- **Slash commands** — `/help /tools /model /compact /memory /clear /sessions /resume /commands /init`; `/compact <focus>` preserves matching lines from the folded span; `/memory` opens the memory index in `$EDITOR`; user-defined `./.agent/commands/<name>.md` are invokable directly as `/<name>` (the same registry the model's `SlashCommand` tool uses).
|
|
110
110
|
- **Live chrome** — the thinking spinner shows elapsed seconds + `esc to interrupt`; the terminal tab title tracks the session topic; a bell rings when a long (>10s) turn finishes in a backgrounded tab; the footer warns at 80%/90% context pressure and auto-trims announce themselves.
|
|
111
111
|
- **`/transcript [n]`** — the full session transcript including complete tool-result bodies (the past-turn equivalent of Ctrl-O live verbose), paged through `less`; **`/doctor`** — one-shot environment sanity check (keys, model pricing, config, session-store writability, memory, MCP mounts).
|
|
112
|
+
- **Syntax-highlighted code fences** — ```` ```ts ```` (and js/py/sh/go/rust/…) blocks render with keywords bold, strings green, numbers cyan, comments dim; unknown languages keep the plain cyan body. **TodoWrite plans** pin a compact `☑ 2/5 · current step` line into the idle footer.
|
|
113
|
+
- **`/agents`** — list subagent types from `./.agent/agents` (description, model, tool scope); `/agents new <name>` scaffolds a frontmatter'd definition for the `Task` tool's `agentType`. **`!<partial>` + menu** completes from past `!` shell commands. **`@server:uri`** mentions inline an MCP resource body into the prompt. Transient network drops mid-step retry automatically (2 attempts, backoff) instead of failing the turn.
|
|
112
114
|
- **Project instructions** — `./AGENTS.md` (or `CLAUDE.md`) auto-loads into every run; `/init` scaffolds one.
|
|
113
115
|
- **Any provider** — set `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` / `GOOGLE_API_KEY` / `GROQ_API_KEY`; choose with `-m provider/model`.
|
|
114
116
|
- **@-file mentions & headless JSON** — reference files inline in a prompt with `@path` (e.g. `explain @src/Agent.ts`); script with `-p --output-format json` to get one machine-readable result object on stdout (activity stays on stderr).
|
package/dist/cli.d.ts
CHANGED
|
@@ -183,6 +183,10 @@ declare function readImageParts(cwd: string, line: string): ContentPart[];
|
|
|
183
183
|
* path (so ordinary text pastes are unaffected). Paths with spaces are skipped — the `@\S+` pipeline can't carry them. */
|
|
184
184
|
declare function pastePathClassifier(cwd: string): PasteClassifier;
|
|
185
185
|
/** Inline `@path` file mentions: append referenced files' contents so the model sees them (missing → warn, leave as-is). */
|
|
186
|
+
/** Resolves an `@server:uri` MCP-resource mention to its text body; null = not an MCP ref (fall through
|
|
187
|
+
* to file resolution). Set by the REPL once servers are mounted; headless runs leave it unset. */
|
|
188
|
+
declare let mcpMentionResolver: ((ref: string) => Promise<string | null>) | undefined;
|
|
189
|
+
declare function setMcpMentionResolver(fn: typeof mcpMentionResolver): void;
|
|
186
190
|
declare function expandMentions(fs: IFilesystem, line: string): Promise<{
|
|
187
191
|
text: string;
|
|
188
192
|
loaded: string[];
|
|
@@ -212,4 +216,4 @@ declare function jsonResult(res: RunResult, session: SessionData): {
|
|
|
212
216
|
*/
|
|
213
217
|
declare function readMultiline(readLine: (continuing: boolean) => Promise<string | null>): Promise<string | null>;
|
|
214
218
|
|
|
215
|
-
export { type PermMode, appendMemoryNote, cacheMultipliers, condenseReplay, costOf, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, runShellLine };
|
|
219
|
+
export { type PermMode, appendMemoryNote, cacheMultipliers, condenseReplay, costOf, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, mcpMentionResolver, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, runShellLine, setMcpMentionResolver };
|
package/dist/cli.js
CHANGED
|
@@ -2985,12 +2985,27 @@ var Agent = class _Agent {
|
|
|
2985
2985
|
...o.providerOptions || cursorPo ? { providerOptions: { ...frag.providerOptions, ...o.providerOptions, ...cursorPo } } : {}
|
|
2986
2986
|
};
|
|
2987
2987
|
try {
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2988
|
+
for (let attempt = 0; ; attempt++) {
|
|
2989
|
+
try {
|
|
2990
|
+
if (useStream) {
|
|
2991
|
+
const r = await o.ai.chat({ model: o.model, messages: sent, tools: wireTools, stream: true, signal: o.signal, ...o.toolChoice ? { toolChoice: o.toolChoice } : {}, ...reasonOpts });
|
|
2992
|
+
res = await this.consumeStream(r);
|
|
2993
|
+
} else {
|
|
2994
|
+
const r = await o.ai.chat({ model: o.model, messages: sent, tools: wireTools, stream: false, signal: o.signal, ...o.toolChoice ? { toolChoice: o.toolChoice } : {}, ...reasonOpts });
|
|
2995
|
+
res = r;
|
|
2996
|
+
}
|
|
2997
|
+
break;
|
|
2998
|
+
} catch (err2) {
|
|
2999
|
+
const sc = err2?.statusCode;
|
|
3000
|
+
const serverSide = sc >= 500 || sc === 408 || /Service Unavailable|overloaded|Internal server error|Bad gateway|Gateway time/i.test(String(err2?.message ?? ""));
|
|
3001
|
+
const network = !sc && /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EPIPE|socket hang up|fetch failed|network|terminated|UND_ERR/i.test(String(err2?.message ?? err2?.code ?? err2));
|
|
3002
|
+
const transient = !o.signal?.aborted && !isAbortError(err2) && attempt < 2 && (network || serverSide);
|
|
3003
|
+
if (!transient) throw err2;
|
|
3004
|
+
const waitMs = 1e3 * (attempt + 1);
|
|
3005
|
+
log3.warn(`network drop mid-step (${err2?.message ?? err2}) \u2014 retrying in ${waitMs}ms`);
|
|
3006
|
+
o.host?.notify?.({ kind: "retry", message: `connection dropped \u2014 retrying step (#${attempt + 1})` });
|
|
3007
|
+
await new Promise((r) => setTimeout(r, waitMs));
|
|
3008
|
+
}
|
|
2994
3009
|
}
|
|
2995
3010
|
} catch (err2) {
|
|
2996
3011
|
if (err2?.code === "budget") return kill("budget");
|
|
@@ -7135,6 +7150,12 @@ function completeLine(line, ctx) {
|
|
|
7135
7150
|
const hits = rank(ctx.commands.filter((c) => fuzzy(want, c)), want).map((c) => "/" + c);
|
|
7136
7151
|
return [hits, token];
|
|
7137
7152
|
}
|
|
7153
|
+
if (line.startsWith("!") && line.length > 1 && ctx.bangHistory?.length) {
|
|
7154
|
+
const want = line.slice(1);
|
|
7155
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7156
|
+
const hits = ctx.bangHistory.filter((h) => h.startsWith("!") && h.length > 1 && fuzzy(want, h.slice(1)) && !seen.has(h) && !!seen.add(h));
|
|
7157
|
+
return [rank(hits, line), line];
|
|
7158
|
+
}
|
|
7138
7159
|
if (token.startsWith("@")) return [completePath(ctx.listDir, token.slice(1)), token];
|
|
7139
7160
|
return [[], line];
|
|
7140
7161
|
}
|
|
@@ -8307,6 +8328,39 @@ function readPlainLine() {
|
|
|
8307
8328
|
|
|
8308
8329
|
// cli/markdown.ts
|
|
8309
8330
|
var vis = (s) => needsBidi(s) ? bidiLine(s).visual : s;
|
|
8331
|
+
var C_KW = new Set("const let var function return if else for while do switch case break continue class new async await try catch finally throw import export from default type interface extends implements public private protected readonly static void null undefined true false this super yield typeof instanceof in of enum namespace struct fn pub mut match impl use go defer chan func package var range nil".split(" "));
|
|
8332
|
+
var PY_KW = new Set("def return if elif else for while class import from as with try except finally raise lambda pass break continue global nonlocal yield async await None True False not and or in is del assert print self".split(" "));
|
|
8333
|
+
var SH_KW = new Set("if then else elif fi for while do done case esac function local export return echo exit set source in".split(" "));
|
|
8334
|
+
var HASH_COMMENT = /^(sh|bash|zsh|shell|py|python|rb|ruby|yaml|yml|toml|ini|make|makefile|dockerfile|r)$/;
|
|
8335
|
+
function kwFor(lang) {
|
|
8336
|
+
if (!lang) return null;
|
|
8337
|
+
const l = lang.toLowerCase();
|
|
8338
|
+
if (/^(js|jsx|ts|tsx|javascript|typescript|java|c|h|cpp|cc|cs|go|rust|rs|swift|kotlin|kt|php|scala|dart)$/.test(l)) return C_KW;
|
|
8339
|
+
if (/^(py|python)$/.test(l)) return PY_KW;
|
|
8340
|
+
if (/^(sh|bash|zsh|shell|console)$/.test(l)) return SH_KW;
|
|
8341
|
+
if (/^(json|yaml|yml|toml|sql|html|xml|css)$/.test(l)) return /* @__PURE__ */ new Set();
|
|
8342
|
+
return null;
|
|
8343
|
+
}
|
|
8344
|
+
function highlightCode(line, lang, p) {
|
|
8345
|
+
const kws = kwFor(lang);
|
|
8346
|
+
if (!kws) return p.cyan(line);
|
|
8347
|
+
const cm = (HASH_COMMENT.test(lang.toLowerCase()) ? /(^|\s)#.*$/ : /\/\/.*$|\/\*.*$/).exec(line);
|
|
8348
|
+
let code = line, comment = "";
|
|
8349
|
+
if (cm) {
|
|
8350
|
+
const at = cm.index + (cm[1]?.length ?? 0);
|
|
8351
|
+
comment = line.slice(at);
|
|
8352
|
+
code = line.slice(0, at);
|
|
8353
|
+
}
|
|
8354
|
+
const str = p.green ?? p.cyan;
|
|
8355
|
+
const re = /("(?:[^"\\]|\\.)*"?|'(?:[^'\\]|\\.)*'?|`[^`]*`?)|\b(\d+(?:\.\d+)?)\b|\b([A-Za-z_]\w*)\b/g;
|
|
8356
|
+
const out = code.replace(re, (m, s, num, word) => {
|
|
8357
|
+
if (s) return str(s);
|
|
8358
|
+
if (num) return p.cyan(num);
|
|
8359
|
+
if (word && kws.has(word)) return p.bold(word);
|
|
8360
|
+
return m;
|
|
8361
|
+
});
|
|
8362
|
+
return out + (comment ? p.dim(comment) : "");
|
|
8363
|
+
}
|
|
8310
8364
|
function displayText(s) {
|
|
8311
8365
|
return s.replace(/`([^`]+)`/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/~~([^~]+)~~/g, "$1").replace(/(?<![\w*])[*_]([^*_\s][^*_]*?)[*_](?![\w*])/g, "$1");
|
|
8312
8366
|
}
|
|
@@ -8326,9 +8380,12 @@ function mdInline(line, p) {
|
|
|
8326
8380
|
return (p.italic ?? ((s) => s))(italic2.slice(1, -1));
|
|
8327
8381
|
});
|
|
8328
8382
|
}
|
|
8329
|
-
function renderMdLine(line, inFence, p, cols = 80) {
|
|
8330
|
-
if (/^\s*```/.test(line))
|
|
8331
|
-
|
|
8383
|
+
function renderMdLine(line, inFence, p, cols = 80, fenceLang) {
|
|
8384
|
+
if (/^\s*```/.test(line)) {
|
|
8385
|
+
const lang = inFence ? void 0 : /^\s*```\s*(\w+)/.exec(line)?.[1];
|
|
8386
|
+
return { out: p.dim(line), inFence: !inFence, fenceLang: lang };
|
|
8387
|
+
}
|
|
8388
|
+
if (inFence) return { out: highlightCode(line, fenceLang, p), inFence, fenceLang };
|
|
8332
8389
|
if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) return { out: p.dim("\u2500".repeat(cols)), inFence };
|
|
8333
8390
|
const h = line.match(/^(#{1,6})\s+(.*)$/);
|
|
8334
8391
|
if (h) return { out: p.bold(vis(h[2])), inFence };
|
|
@@ -8352,6 +8409,8 @@ var MarkdownStream = class {
|
|
|
8352
8409
|
buf = "";
|
|
8353
8410
|
// the current (uncommitted) logical line's text
|
|
8354
8411
|
inFence = false;
|
|
8412
|
+
fenceLang;
|
|
8413
|
+
// language tag of the open fence (drives syntax highlighting)
|
|
8355
8414
|
lineRows = 0;
|
|
8356
8415
|
// physical rows the in-progress line occupied last draw (for the next clear)
|
|
8357
8416
|
tableBuf = [];
|
|
@@ -8400,14 +8459,15 @@ var MarkdownStream = class {
|
|
|
8400
8459
|
continue;
|
|
8401
8460
|
}
|
|
8402
8461
|
if (this.tableBuf.length) out += this.flushTable();
|
|
8403
|
-
const r = renderMdLine(line, this.inFence, this.p, this.cols);
|
|
8462
|
+
const r = renderMdLine(line, this.inFence, this.p, this.cols, this.fenceLang);
|
|
8404
8463
|
this.inFence = r.inFence;
|
|
8464
|
+
this.fenceLang = r.fenceLang;
|
|
8405
8465
|
out += r.out + "\r\n";
|
|
8406
8466
|
}
|
|
8407
8467
|
const tailIsTableRow = this.tableBuf.length > 0 && !this.inFence && /^\s*\|/.test(this.buf);
|
|
8408
8468
|
if (this.buf && !tailIsTableRow) {
|
|
8409
8469
|
if (this.tableBuf.length) out += this.flushTable();
|
|
8410
|
-
out += renderMdLine(this.buf, this.inFence, this.p, this.cols).out;
|
|
8470
|
+
out += renderMdLine(this.buf, this.inFence, this.p, this.cols, this.fenceLang).out;
|
|
8411
8471
|
this.lineRows = Math.max(1, Math.ceil(this.buf.length / Math.max(1, this.cols)));
|
|
8412
8472
|
}
|
|
8413
8473
|
return out;
|
|
@@ -8422,6 +8482,7 @@ var MarkdownStream = class {
|
|
|
8422
8482
|
out += this.tableBuf.length ? this.flushTable() : "";
|
|
8423
8483
|
this.buf = "";
|
|
8424
8484
|
this.inFence = false;
|
|
8485
|
+
this.fenceLang = void 0;
|
|
8425
8486
|
this.lineRows = 0;
|
|
8426
8487
|
return out;
|
|
8427
8488
|
}
|
|
@@ -8485,6 +8546,7 @@ var activeTurn = null;
|
|
|
8485
8546
|
var exitRequested = false;
|
|
8486
8547
|
var inputStash = [];
|
|
8487
8548
|
var stashBuf = "";
|
|
8549
|
+
var latestTodos = [];
|
|
8488
8550
|
function numFlag(raw, flag) {
|
|
8489
8551
|
const n = Number(raw);
|
|
8490
8552
|
if (!Number.isFinite(n) || n < 0) throw new Error(`invalid ${flag}: ${raw ?? "(missing value)"}`);
|
|
@@ -8679,7 +8741,7 @@ function apiKeysFromEnv() {
|
|
|
8679
8741
|
function makeHost(format = "text", opts) {
|
|
8680
8742
|
const streamJson = format === "stream-json";
|
|
8681
8743
|
const cleanStdout = format === "json";
|
|
8682
|
-
const md = format === "text" && useColor && opts?.stream ? new MarkdownStream({ bold, dim, cyan, italic, strike, link }, process.stdout.columns ?? 80) : null;
|
|
8744
|
+
const md = format === "text" && useColor && opts?.stream ? new MarkdownStream({ bold, dim, cyan, italic, strike, green, link }, process.stdout.columns ?? 80) : null;
|
|
8683
8745
|
if (md) process.on("SIGWINCH", () => md.resize(process.stdout.columns ?? 80));
|
|
8684
8746
|
const flushText = () => {
|
|
8685
8747
|
if (md && md.pending()) process.stdout.write(md.flush());
|
|
@@ -8774,6 +8836,7 @@ function displayHooks(fs, opts) {
|
|
|
8774
8836
|
};
|
|
8775
8837
|
return {
|
|
8776
8838
|
async preToolUse(call) {
|
|
8839
|
+
if (call.name === "TodoWrite" && Array.isArray(call.args?.todos)) latestTodos = call.args.todos;
|
|
8777
8840
|
if (!on()) return;
|
|
8778
8841
|
if (bg) err("\r\x1B[0J");
|
|
8779
8842
|
else spinner.stop();
|
|
@@ -9201,6 +9264,10 @@ function pastePathClassifier(cwd) {
|
|
|
9201
9264
|
return { display: isImg ? "Image" : `File ${basename2(abs)}`, ref: "@" + abs };
|
|
9202
9265
|
};
|
|
9203
9266
|
}
|
|
9267
|
+
var mcpMentionResolver;
|
|
9268
|
+
function setMcpMentionResolver(fn) {
|
|
9269
|
+
mcpMentionResolver = fn;
|
|
9270
|
+
}
|
|
9204
9271
|
async function expandMentions(fs, line) {
|
|
9205
9272
|
const refs = [...line.matchAll(/(?:^|\s)@(\S+)/g)].map((m) => m[1].replace(/[?!.,;:)\]}'">]+$/, "")).filter(Boolean);
|
|
9206
9273
|
if (!refs.length) return { text: line, loaded: [], missing: [] };
|
|
@@ -9208,6 +9275,18 @@ async function expandMentions(fs, line) {
|
|
|
9208
9275
|
for (const ref of refs) {
|
|
9209
9276
|
if (IMG_EXT[extname(ref).toLowerCase()]) continue;
|
|
9210
9277
|
if (loaded.includes(ref) || missing.includes(ref)) continue;
|
|
9278
|
+
if (ref.includes(":") && mcpMentionResolver) {
|
|
9279
|
+
const body = await mcpMentionResolver(ref).catch((e) => {
|
|
9280
|
+
log17.debug("mcp mention resolve failed", e);
|
|
9281
|
+
return null;
|
|
9282
|
+
});
|
|
9283
|
+
if (body != null) {
|
|
9284
|
+
blocks.push(`--- @${ref} ---
|
|
9285
|
+
${body}`);
|
|
9286
|
+
loaded.push(ref);
|
|
9287
|
+
continue;
|
|
9288
|
+
}
|
|
9289
|
+
}
|
|
9211
9290
|
try {
|
|
9212
9291
|
if (await fs.exists(ref)) {
|
|
9213
9292
|
blocks.push(`--- @${ref} ---
|
|
@@ -9762,6 +9841,16 @@ async function repl(args, ai, cfg, cwd) {
|
|
|
9762
9841
|
forceQuit();
|
|
9763
9842
|
});
|
|
9764
9843
|
installCancelGuards(mounted);
|
|
9844
|
+
setMcpMentionResolver(async (ref) => {
|
|
9845
|
+
const i = ref.indexOf(":");
|
|
9846
|
+
if (i <= 0) return null;
|
|
9847
|
+
const m = mounted.find((x) => x.name === ref.slice(0, i));
|
|
9848
|
+
if (!m) return null;
|
|
9849
|
+
const r = await m.client.readResource(ref.slice(i + 1));
|
|
9850
|
+
const parts = Array.isArray(r?.contents) ? r.contents : [];
|
|
9851
|
+
const texts = parts.map((c) => c?.text ?? (c?.blob ? `[binary ${c.mimeType ?? "blob"}]` : "")).filter(Boolean);
|
|
9852
|
+
return texts.length ? texts.join("\n") : JSON.stringify(r);
|
|
9853
|
+
});
|
|
9765
9854
|
const store = new SessionStore(cwd);
|
|
9766
9855
|
let session = startSession(args, store, face, cwd);
|
|
9767
9856
|
setTermTitle(`agentx \xB7 ${session.meta.title || cwd.split("/").pop() || "session"}`);
|
|
@@ -10497,6 +10586,71 @@ ${extra}` : body);
|
|
|
10497
10586
|
const data = store.load(a[0]) ?? globalSessionLoad(a[0]);
|
|
10498
10587
|
if (data) resumeInto(data);
|
|
10499
10588
|
else err(red(` no such session
|
|
10589
|
+
`));
|
|
10590
|
+
}
|
|
10591
|
+
},
|
|
10592
|
+
agents: {
|
|
10593
|
+
desc: "list subagent types (./.agent/agents) \u2014 /agents new <name> scaffolds one",
|
|
10594
|
+
run: async (a) => {
|
|
10595
|
+
const fs2 = face.options.fs;
|
|
10596
|
+
if (a[0] === "new") {
|
|
10597
|
+
let name = a[1];
|
|
10598
|
+
if (!name) {
|
|
10599
|
+
const io = createInterface({ input: process.stdin, output: process.stderr });
|
|
10600
|
+
try {
|
|
10601
|
+
name = (await io.question(yellow(" agent name: "))).trim();
|
|
10602
|
+
} finally {
|
|
10603
|
+
io.close();
|
|
10604
|
+
}
|
|
10605
|
+
}
|
|
10606
|
+
name = (name ?? "").replace(/[^A-Za-z0-9_-]/g, "-").replace(/^-+|-+$/g, "");
|
|
10607
|
+
if (!name) {
|
|
10608
|
+
err(yellow(" usage: /agents new <name>\n"));
|
|
10609
|
+
return;
|
|
10610
|
+
}
|
|
10611
|
+
const dir = adot("agents");
|
|
10612
|
+
const p = `${dir}/${name}.md`;
|
|
10613
|
+
if (await fs2.exists(p)) {
|
|
10614
|
+
err(yellow(` ${p} already exists
|
|
10615
|
+
`));
|
|
10616
|
+
return;
|
|
10617
|
+
}
|
|
10618
|
+
await mkdirp(fs2, dir);
|
|
10619
|
+
await fs2.writeFile(p, [
|
|
10620
|
+
"---",
|
|
10621
|
+
`description: What "${name}" is for \u2014 the Task tool picks agents by this line`,
|
|
10622
|
+
"# model: anthropic/claude-haiku-4-5 # optional per-agent model override",
|
|
10623
|
+
"# tools: Read, Grep, Glob # optional tool allowlist (omit = all tools)",
|
|
10624
|
+
"---",
|
|
10625
|
+
"",
|
|
10626
|
+
`You are the "${name}" subagent.`,
|
|
10627
|
+
"",
|
|
10628
|
+
"Describe the persona, scope, and output contract here \u2014 this body becomes the",
|
|
10629
|
+
`child agent's system prompt when a Task is delegated with agentType: "` + name + '".',
|
|
10630
|
+
""
|
|
10631
|
+
].join("\n"));
|
|
10632
|
+
err(green(` \u2713 ${p}`) + dim(` \u2014 used via Task(agentType:"${name}")${args.subagents ? "" : " (enable with --subagents)"}
|
|
10633
|
+
`));
|
|
10634
|
+
return;
|
|
10635
|
+
}
|
|
10636
|
+
const seen = /* @__PURE__ */ new Map();
|
|
10637
|
+
for (const d of adots("agents")) {
|
|
10638
|
+
try {
|
|
10639
|
+
for (const def of (await loadAgents(fs2, d)).agents) if (!seen.has(def.name)) seen.set(def.name, { def, from: d });
|
|
10640
|
+
} catch (e) {
|
|
10641
|
+
log17.debug(`loadAgents(${d}) failed`, e);
|
|
10642
|
+
}
|
|
10643
|
+
}
|
|
10644
|
+
if (!seen.size) {
|
|
10645
|
+
err(dim(" (no subagents defined \u2014 scaffold one with /agents new <name>)\n"));
|
|
10646
|
+
return;
|
|
10647
|
+
}
|
|
10648
|
+
for (const { def, from } of seen.values()) {
|
|
10649
|
+
const extras = [def.model, def.tools?.length ? `tools: ${def.tools.join(",")}` : ""].filter(Boolean).join(" \xB7 ");
|
|
10650
|
+
err(` ${cyan(def.name)} ${dim(`\u2014 ${def.description || "(no description)"}${extras ? ` (${extras})` : ""} \xB7 ${from}`)}
|
|
10651
|
+
`);
|
|
10652
|
+
}
|
|
10653
|
+
err(dim(` delegated via the Task tool (agentType)${args.subagents ? "" : " \u2014 enable with --subagents"} \xB7 /agents new <name> to scaffold
|
|
10500
10654
|
`));
|
|
10501
10655
|
}
|
|
10502
10656
|
},
|
|
@@ -10812,7 +10966,7 @@ ${extra}` : body);
|
|
|
10812
10966
|
const commandNames = () => [...Object.keys(builtins).filter((k) => k !== "quit"), ...cmds.map((c) => c.name), ...skills.map((s) => s.name)];
|
|
10813
10967
|
const describe = (hit) => hit.startsWith("/") ? builtins[hit.slice(1)]?.desc ?? cmds.find((c) => c.name === hit.slice(1))?.description ?? skills.find((s) => s.name === hit.slice(1))?.description : void 0;
|
|
10814
10968
|
const suggest = (lineToCursor) => {
|
|
10815
|
-
const [hits, token] = completeLine(lineToCursor, { commands: commandNames(), listDir });
|
|
10969
|
+
const [hits, token] = completeLine(lineToCursor, { commands: commandNames(), listDir, bangHistory: history });
|
|
10816
10970
|
return { hits, token, describe };
|
|
10817
10971
|
};
|
|
10818
10972
|
const editor = createLineEditor(process.stderr);
|
|
@@ -11079,6 +11233,11 @@ ${extra}` : body);
|
|
|
11079
11233
|
if (r && r !== "off") parts.push(`reasoning:${r}`);
|
|
11080
11234
|
if (verboseOutput) parts.push("verbose");
|
|
11081
11235
|
if (goalCondition) parts.push(`\u25CE goal (${goalTurns} turns)`);
|
|
11236
|
+
if (latestTodos.length) {
|
|
11237
|
+
const done = latestTodos.filter((t) => t.status === "completed").length;
|
|
11238
|
+
const cur = latestTodos.find((t) => t.status === "in_progress")?.content;
|
|
11239
|
+
if (done < latestTodos.length) parts.push(`\u2611 ${done}/${latestTodos.length}${cur ? ` \xB7 ${cur.slice(0, 48)}` : ""}`);
|
|
11240
|
+
}
|
|
11082
11241
|
if (scheduler.size) parts.push(`\u23F0 ${scheduler.size} scheduled`);
|
|
11083
11242
|
if (inputStash.length) parts.push(`${inputStash.length} stashed (\u2303S to pop)`);
|
|
11084
11243
|
const taskLines = [];
|
|
@@ -11321,11 +11480,13 @@ export {
|
|
|
11321
11480
|
formatStatus,
|
|
11322
11481
|
formatTranscriptFull,
|
|
11323
11482
|
jsonResult,
|
|
11483
|
+
mcpMentionResolver,
|
|
11324
11484
|
parseArgs,
|
|
11325
11485
|
pastePathClassifier,
|
|
11326
11486
|
readImageParts,
|
|
11327
11487
|
readMultiline,
|
|
11328
11488
|
resolvePermMode,
|
|
11329
|
-
runShellLine
|
|
11489
|
+
runShellLine,
|
|
11490
|
+
setMcpMentionResolver
|
|
11330
11491
|
};
|
|
11331
11492
|
//# sourceMappingURL=cli.js.map
|