@vietor/agent-core 0.7.2 → 0.7.3
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 -2
- package/dist/mcp/manager.js +2 -2
- package/dist/tools/ask-user.js +1 -1
- package/dist/tools/file-edit.js +1 -1
- package/dist/tools/file-read.js +1 -1
- package/dist/tools/file-write.js +1 -1
- package/dist/tools/glob.js +1 -1
- package/dist/tools/grep.js +1 -1
- package/dist/tools/registry.js +2 -2
- package/dist/tools/shell.js +1 -1
- package/dist/tools/skill.js +1 -1
- package/dist/tools/sub-agent.js +1 -1
- package/dist/tools/types.d.ts +1 -1
- package/dist/tools/web-fetch.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -425,7 +425,7 @@ interface Tool {
|
|
|
425
425
|
readOnly?: boolean;
|
|
426
426
|
description: string;
|
|
427
427
|
parameters: Record<string, unknown>; // JSON Schema object
|
|
428
|
-
|
|
428
|
+
argSummaryKeys?: string[]; // parameter keys used for display summary
|
|
429
429
|
summarizeArgs?: (args: Record<string, unknown>) => string; // custom summary function
|
|
430
430
|
summarizeResult?(result: TextResult): string; // result summary for timeline display
|
|
431
431
|
execute(args: Record<string, unknown>, ctx: ToolContext): Promise<TextResult>;
|
|
@@ -436,7 +436,7 @@ interface Tool {
|
|
|
436
436
|
- `parameters` is passed to the LLM as a JSON Schema to describe the tool's arguments.
|
|
437
437
|
- When the LLM calls a tool, `execute` receives the parsed arguments and a context object.
|
|
438
438
|
- `execute` returns a `TextResult` (`{ content, isError? }`). Expected failures return `toolError(...)` (exported from the package); unexpected errors may throw and are wrapped by the registry.
|
|
439
|
-
- `
|
|
439
|
+
- `argSummaryKeys` / `summarizeArgs` control what appears in the tool log entry's `argsSummary` field.
|
|
440
440
|
- `summarizeResult` (optional) returns a short result summary for timeline display. Called after execution with the result; the registry prefixes the wall-clock duration. Falls back to a default summary (byte/line count) when not defined.
|
|
441
441
|
|
|
442
442
|
### `ToolContext`
|
package/dist/mcp/manager.js
CHANGED
|
@@ -125,12 +125,12 @@ export class MCPServerManager {
|
|
|
125
125
|
this.markFailed(name, entry.type, error ?? "MCP server connection closed");
|
|
126
126
|
}
|
|
127
127
|
adapt(server, client, tool) {
|
|
128
|
-
const
|
|
128
|
+
const argSummaryKeys = summaryCandidates(tool.inputSchema);
|
|
129
129
|
return {
|
|
130
130
|
name: mcpToolName(server, tool.name),
|
|
131
131
|
description: tool.description ?? `${server} ${tool.name}`,
|
|
132
132
|
parameters: tool.inputSchema,
|
|
133
|
-
...(
|
|
133
|
+
...(argSummaryKeys.length ? { argSummaryKeys } : {}),
|
|
134
134
|
async execute(args, ctx) {
|
|
135
135
|
const result = await withTimeoutFn((signal) => client.callTool(tool.name, args, signal), CALL_TIMEOUT_MS, ctx.signal, `MCP tool call timed out (${CALL_TIMEOUT_MS / 1000}s)`);
|
|
136
136
|
const text = extractContent(result);
|
package/dist/tools/ask-user.js
CHANGED
package/dist/tools/file-edit.js
CHANGED
package/dist/tools/file-read.js
CHANGED
package/dist/tools/file-write.js
CHANGED
package/dist/tools/glob.js
CHANGED
package/dist/tools/grep.js
CHANGED
package/dist/tools/registry.js
CHANGED
|
@@ -76,10 +76,10 @@ export class ToolRegistry {
|
|
|
76
76
|
return "";
|
|
77
77
|
if (tool.summarizeArgs)
|
|
78
78
|
return tool.summarizeArgs(args);
|
|
79
|
-
if (!tool.
|
|
79
|
+
if (!tool.argSummaryKeys)
|
|
80
80
|
return "";
|
|
81
81
|
const parts = [];
|
|
82
|
-
for (const k of tool.
|
|
82
|
+
for (const k of tool.argSummaryKeys) {
|
|
83
83
|
const v = args[k];
|
|
84
84
|
if (typeof v === "string" && v) {
|
|
85
85
|
parts.push(v);
|
package/dist/tools/shell.js
CHANGED
package/dist/tools/skill.js
CHANGED
package/dist/tools/sub-agent.js
CHANGED
package/dist/tools/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface Tool {
|
|
|
25
25
|
readOnly?: boolean;
|
|
26
26
|
description: string;
|
|
27
27
|
parameters: Record<string, unknown>;
|
|
28
|
-
|
|
28
|
+
argSummaryKeys?: string[];
|
|
29
29
|
summarizeArgs?: (args: Record<string, unknown>) => string;
|
|
30
30
|
summarizeResult?(result: TextResult): string;
|
|
31
31
|
execute(args: Record<string, unknown>, ctx: ToolContext): Promise<TextResult>;
|
package/dist/tools/web-fetch.js
CHANGED