@livx.cc/agentx 0.99.4 → 0.99.5
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/dist/{Agent-BPEXD7n7.d.ts → Agent-DYMSg21f.d.ts} +1 -1
- package/dist/cli.d.ts +8 -3
- package/dist/cli.js +59 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{mcp-DyeLLday.d.ts → mcp-DopVRDLx.d.ts} +1 -1
- package/dist/mcp.client.d.ts +2 -2
- package/dist/{tools-CrsRHvvl.d.ts → tools-DKf3hN4M.d.ts} +10 -0
- package/dist/tools.shell.d.ts +1 -1
- package/dist/tools.shell.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IFilesystem } from '@livx.cc/wcli/core';
|
|
2
|
-
import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, e as MessageContent } from './tools-
|
|
2
|
+
import { M as Message, H as HostBridge, A as AgentTool, C as ChatLike, e as MessageContent } from './tools-DKf3hN4M.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Hooks — deterministic interception points around tool execution, run by the
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-
|
|
2
|
+
import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-DYMSg21f.js';
|
|
3
3
|
import { IFilesystem } from '@livx.cc/wcli/core';
|
|
4
|
-
import { M as Message, c as ContentPart, e as MessageContent } from './tools-
|
|
4
|
+
import { M as Message, H as HostBridge, c as ContentPart, e as MessageContent } from './tools-DKf3hN4M.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* On-disk session store for the CLI: each conversation is one JSON file at
|
|
@@ -146,6 +146,11 @@ interface Args {
|
|
|
146
146
|
update?: boolean;
|
|
147
147
|
}
|
|
148
148
|
declare function parseArgs(argv: string[]): Args;
|
|
149
|
+
declare function makeHost(format?: 'text' | 'json' | 'stream-json', opts?: {
|
|
150
|
+
stream?: boolean;
|
|
151
|
+
}): HostBridge & {
|
|
152
|
+
flushText: () => void;
|
|
153
|
+
};
|
|
149
154
|
/** Hooks that render tool activity to stderr: a preToolUse header, and for edits a colorized diff.
|
|
150
155
|
* `opts.background` marks the agent as a BACKGROUND one (duplex workers): its chrome lands async on
|
|
151
156
|
* top of a live prompt, so it must never drive the foreground spinner (the 'agentx › '/'⠹ thinking…'
|
|
@@ -293,4 +298,4 @@ declare function runTurn(agent: Agent, store: SessionStore, session: SessionData
|
|
|
293
298
|
res?: RunResult;
|
|
294
299
|
}>;
|
|
295
300
|
|
|
296
|
-
export { type PermMode, abortActiveTurn, appendMemoryNote, cacheMultipliers, condenseReplay, costOf, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, mcpMentionResolver, mentionRefs, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, runShellLine, runTurn, setMcpMentionResolver, summarizeResult };
|
|
301
|
+
export { type PermMode, abortActiveTurn, appendMemoryNote, cacheMultipliers, condenseReplay, costOf, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, makeHost, mcpMentionResolver, mentionRefs, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, runShellLine, runTurn, setMcpMentionResolver, summarizeResult };
|
package/dist/cli.js
CHANGED
|
@@ -3684,7 +3684,7 @@ var Agent = class _Agent {
|
|
|
3684
3684
|
if (chunk.toolActivity) {
|
|
3685
3685
|
const a = chunk.toolActivity;
|
|
3686
3686
|
const verb = a.status === "error" ? "\u2717" : a.status === "completed" ? "\u2713" : "\u2192";
|
|
3687
|
-
this.options.host.notify({ kind: "tool_activity", id: a.id, name: a.name, input: a.input, status: a.status, message: `${verb} ${a.name}` });
|
|
3687
|
+
this.options.host.notify({ kind: "tool_activity", id: a.id, name: a.name, input: a.input, output: a.output, status: a.status, truncated: a.truncated, message: `${verb} ${a.name}` });
|
|
3688
3688
|
}
|
|
3689
3689
|
if (chunk.content) {
|
|
3690
3690
|
content += chunk.content;
|
|
@@ -9056,6 +9056,17 @@ function renderMdLine(line, inFence, p, cols = 80, fenceLang) {
|
|
|
9056
9056
|
if (b) return { out: b[1] + p.cyan("\u2022") + " " + mdInline(vis(b[2]), p), inFence };
|
|
9057
9057
|
return { out: mdInline(vis(line), p), inFence };
|
|
9058
9058
|
}
|
|
9059
|
+
function renderMdBlock(text, p, cols = 80) {
|
|
9060
|
+
let inFence = false, fenceLang;
|
|
9061
|
+
const out = [];
|
|
9062
|
+
for (const line of text.split("\n")) {
|
|
9063
|
+
const r = renderMdLine(line, inFence, p, cols, fenceLang);
|
|
9064
|
+
inFence = r.inFence;
|
|
9065
|
+
fenceLang = r.fenceLang;
|
|
9066
|
+
out.push(r.inFence || /^\s*```/.test(line) ? r.out : wrapAnsi(r.out, cols, hangIndent(line)));
|
|
9067
|
+
}
|
|
9068
|
+
return out.join("\n");
|
|
9069
|
+
}
|
|
9059
9070
|
function isTableRow(line) {
|
|
9060
9071
|
return /^\s*\|.*\|\s*$/.test(line);
|
|
9061
9072
|
}
|
|
@@ -10702,6 +10713,7 @@ var yellow = C("33");
|
|
|
10702
10713
|
var italic = C("3");
|
|
10703
10714
|
var strike = C("9");
|
|
10704
10715
|
var link = (text, url) => useColor ? `\x1B]8;;${url}\x1B\\${cyan(text)}\x1B]8;;\x1B\\` : `${text} (${url})`;
|
|
10716
|
+
var mdPalette = { bold, dim, cyan, italic, strike, green, link };
|
|
10705
10717
|
var err = (s) => process.stderr.write(s);
|
|
10706
10718
|
var log23 = forComponent("cli");
|
|
10707
10719
|
var VERSION = (() => {
|
|
@@ -11005,7 +11017,7 @@ function apiKeysFromEnv() {
|
|
|
11005
11017
|
function makeHost(format = "text", opts) {
|
|
11006
11018
|
const streamJson = format === "stream-json";
|
|
11007
11019
|
const cleanStdout = format === "json";
|
|
11008
|
-
const md = format === "text" && useColor && opts?.stream ? new MarkdownStream(
|
|
11020
|
+
const md = format === "text" && useColor && opts?.stream ? new MarkdownStream(mdPalette, process.stdout.columns ?? 80) : null;
|
|
11009
11021
|
if (md) process.on("SIGWINCH", () => md.resize(process.stdout.columns ?? 80));
|
|
11010
11022
|
const flushText = () => {
|
|
11011
11023
|
if (md && md.pending()) process.stdout.write(md.commit());
|
|
@@ -11017,10 +11029,14 @@ function makeHost(format = "text", opts) {
|
|
|
11017
11029
|
openReasonLine = false;
|
|
11018
11030
|
}
|
|
11019
11031
|
};
|
|
11032
|
+
const activitySeen = /* @__PURE__ */ new Set();
|
|
11020
11033
|
return {
|
|
11021
11034
|
flushText,
|
|
11022
11035
|
notify(e) {
|
|
11023
|
-
if (e.kind === "turn_start")
|
|
11036
|
+
if (e.kind === "turn_start") {
|
|
11037
|
+
activitySeen.clear();
|
|
11038
|
+
return;
|
|
11039
|
+
}
|
|
11024
11040
|
spinner.stop();
|
|
11025
11041
|
if (e.kind === "text_delta") {
|
|
11026
11042
|
flushLookupGroup();
|
|
@@ -11044,6 +11060,43 @@ function makeHost(format = "text", opts) {
|
|
|
11044
11060
|
}
|
|
11045
11061
|
return;
|
|
11046
11062
|
}
|
|
11063
|
+
if (e.kind === "tool_activity") {
|
|
11064
|
+
const a = e;
|
|
11065
|
+
flushLookupGroup();
|
|
11066
|
+
closeReasonLine();
|
|
11067
|
+
flushText();
|
|
11068
|
+
if (streamJson) {
|
|
11069
|
+
process.stdout.write(JSON.stringify({ type: "tool_activity", id: a.id, name: a.name, input: a.input, output: a.output, status: a.status }) + "\n");
|
|
11070
|
+
return;
|
|
11071
|
+
}
|
|
11072
|
+
const clip = (s) => s.length > 200 ? s.slice(0, 200) + "\u2026" : s;
|
|
11073
|
+
const terminal = a.status === "completed" || a.status === "error";
|
|
11074
|
+
if (!terminal || !a.id || !activitySeen.has(a.id)) {
|
|
11075
|
+
if (a.id) activitySeen.add(a.id);
|
|
11076
|
+
const argHint = summarizeCall(a.name, a.input) + (a.truncated?.args ? " \u2026" : "");
|
|
11077
|
+
err(cyan(` \u2699 ${a.name}`) + (argHint ? dim(" " + argHint) : "") + "\n");
|
|
11078
|
+
}
|
|
11079
|
+
if (terminal) {
|
|
11080
|
+
if (a.id) activitySeen.delete(a.id);
|
|
11081
|
+
const raw = a.output == null ? "" : typeof a.output === "string" ? a.output : JSON.stringify(a.output);
|
|
11082
|
+
const text = raw.replace(/\s+$/, "");
|
|
11083
|
+
const paint = a.status === "error" ? red : dim;
|
|
11084
|
+
if (!text) {
|
|
11085
|
+
if (a.status === "error") err(paint(" \u23BF (error)\n"));
|
|
11086
|
+
spinner.start();
|
|
11087
|
+
return;
|
|
11088
|
+
}
|
|
11089
|
+
const lines = text.split("\n");
|
|
11090
|
+
const shown = lines.slice(0, previewLines());
|
|
11091
|
+
err(paint(" \u23BF " + clip(shown[0])) + "\n");
|
|
11092
|
+
for (const ln of shown.slice(1)) err(dim(" " + clip(ln)) + "\n");
|
|
11093
|
+
const more = lines.length - shown.length;
|
|
11094
|
+
if (more > 0 || a.truncated?.result) err(dim(` \u2026 (${more > 0 ? `+${more} more line${more > 1 ? "s" : ""}` : "truncated by backend"}${a.truncated?.result && more > 0 ? ", truncated" : ""} \xB7 ctrl+o expands)
|
|
11095
|
+
`));
|
|
11096
|
+
}
|
|
11097
|
+
spinner.start();
|
|
11098
|
+
return;
|
|
11099
|
+
}
|
|
11047
11100
|
if (!("message" in e)) return;
|
|
11048
11101
|
flushLookupGroup();
|
|
11049
11102
|
closeReasonLine();
|
|
@@ -11224,7 +11277,7 @@ function formatHistory(messages) {
|
|
|
11224
11277
|
if (t) out.push("\n" + bold(cyan(" \u203A ")) + (t.length > 1500 ? clipReplay(t, 1500) + dim(" \u2026") : t) + "\n");
|
|
11225
11278
|
} else if (m.role === "assistant") {
|
|
11226
11279
|
const at = contentText(m.content);
|
|
11227
|
-
if (at.trim()) out.push(
|
|
11280
|
+
if (at.trim()) out.push(renderMdBlock(at.trim(), mdPalette, (process.stderr.columns ?? 80) - 2).replace(/^/gm, " ") + "\n");
|
|
11228
11281
|
for (const tc of m.tool_calls ?? []) {
|
|
11229
11282
|
let args = {};
|
|
11230
11283
|
try {
|
|
@@ -11260,7 +11313,7 @@ function formatTranscriptFull(messages, opts) {
|
|
|
11260
11313
|
if (t) out.push("\n" + bold(cyan(" \u203A ")) + t.replace(/\n/g, "\n ") + "\n");
|
|
11261
11314
|
} else if (m.role === "assistant") {
|
|
11262
11315
|
const at = contentText(m.content).trim();
|
|
11263
|
-
if (at) out.push(
|
|
11316
|
+
if (at) out.push(renderMdBlock(at, mdPalette, (process.stderr.columns ?? 80) - 2).replace(/^/gm, " ") + "\n");
|
|
11264
11317
|
for (const tc of m.tool_calls ?? []) {
|
|
11265
11318
|
let args = {};
|
|
11266
11319
|
try {
|
|
@@ -14140,6 +14193,7 @@ export {
|
|
|
14140
14193
|
formatStatus,
|
|
14141
14194
|
formatTranscriptFull,
|
|
14142
14195
|
jsonResult,
|
|
14196
|
+
makeHost,
|
|
14143
14197
|
mcpMentionResolver,
|
|
14144
14198
|
mentionRefs,
|
|
14145
14199
|
parseArgs,
|