@a5c-ai/agent-core 5.0.1-staging.d7c7b44ac4e1 → 5.0.1-staging.e80a53359
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 +13 -0
- package/dist/agenticTools/index.d.ts.map +1 -1
- package/dist/agenticTools/index.js +8 -1
- package/dist/agenticTools/tools/programmaticToolCalling.d.ts +4 -0
- package/dist/agenticTools/tools/programmaticToolCalling.d.ts.map +1 -0
- package/dist/agenticTools/tools/programmaticToolCalling.js +137 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/tools.test.js +77 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ If you still need the PI-era controls above, use the PI wrapper exposed from `@a
|
|
|
118
118
|
- delegation tools: `AskUserQuestion`, `task`, `skill`
|
|
119
119
|
- code tools: `calc`, `ast_grep`, `ast_edit`, `render_mermaid`, `notebook`
|
|
120
120
|
- background/discovery/web tools: `background_status`, `background_list`, `tool_search`, `tool_fetch`, `web_search`, `fetch_process`
|
|
121
|
+
- optional programmatic tool calling: `code_executor` when `programmaticToolCalling` is enabled
|
|
121
122
|
|
|
122
123
|
`AgentCoreToolOptions` controls how those definitions are wired into a host runtime:
|
|
123
124
|
|
|
@@ -127,6 +128,18 @@ If you still need the PI-era controls above, use the PI wrapper exposed from `@a
|
|
|
127
128
|
- `onToolUse`: observer callback fired after tool wrapping.
|
|
128
129
|
- `onBackgroundComplete`, `maxBackgroundProcesses`, `backgroundRegistry`: background-process lifecycle hooks and limits.
|
|
129
130
|
- `deferredToolRegistry`: enables `tool_search` and `tool_fetch`.
|
|
131
|
+
- `programmaticToolCalling`: opt-in Code Mode / Programmatic Tool Calling surface. When enabled, `code_executor` runs a bounded JavaScript async body with `tools.<name>(params)` and `callTool(name, params)` helpers for batching existing agent-core tools behind one model-level tool call.
|
|
132
|
+
|
|
133
|
+
Example:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const tools = createAgentCoreToolDefinitions({
|
|
137
|
+
workspace: process.cwd(),
|
|
138
|
+
interactive: false,
|
|
139
|
+
deferredToolRegistry,
|
|
140
|
+
programmaticToolCalling: { maxToolCalls: 10, timeout: 60_000 },
|
|
141
|
+
});
|
|
142
|
+
```
|
|
130
143
|
|
|
131
144
|
### Interactive and cancellation contract
|
|
132
145
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agenticTools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agenticTools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAmBxE,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,kBAAkB,GAAG,oBAAoB,EAAE,CAsBlG;AAED,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAOzF;AAED,eAAO,MAAM,4BAA4B,uCAAiC,CAAC"}
|
|
@@ -14,9 +14,10 @@ const code_1 = require("./tools/code");
|
|
|
14
14
|
const delegation_1 = require("./tools/delegation");
|
|
15
15
|
const execution_1 = require("./tools/execution");
|
|
16
16
|
const fileSystem_1 = require("./tools/fileSystem");
|
|
17
|
+
const programmaticToolCalling_1 = require("./tools/programmaticToolCalling");
|
|
17
18
|
const toolDefinitionScopes = new WeakMap();
|
|
18
19
|
function createAgentCoreToolDefinitions(options) {
|
|
19
|
-
const
|
|
20
|
+
const baseTools = [
|
|
20
21
|
...(0, fileSystem_1.createFileSystemTools)(options),
|
|
21
22
|
...(0, execution_1.createExecutionTools)(options),
|
|
22
23
|
(0, tool_1.createBrowserTool)(),
|
|
@@ -27,6 +28,12 @@ function createAgentCoreToolDefinitions(options) {
|
|
|
27
28
|
...(0, tools_2.createDiscoveryTools)(options),
|
|
28
29
|
...(0, tools_3.createWebTools)(),
|
|
29
30
|
].map((tool) => (0, results_1.wrapToolDefinition)(tool, options.onToolUse));
|
|
31
|
+
const tools = (0, programmaticToolCalling_1.shouldEnableProgrammaticToolCalling)(options)
|
|
32
|
+
? [
|
|
33
|
+
...baseTools,
|
|
34
|
+
(0, results_1.wrapToolDefinition)((0, programmaticToolCalling_1.createProgrammaticToolCallingTool)(options, baseTools), options.onToolUse),
|
|
35
|
+
]
|
|
36
|
+
: baseTools;
|
|
30
37
|
toolDefinitionScopes.set(tools, options);
|
|
31
38
|
return tools;
|
|
32
39
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgenticToolOptions, CustomToolDefinition } from "../types";
|
|
2
|
+
export declare function shouldEnableProgrammaticToolCalling(options: AgenticToolOptions): boolean;
|
|
3
|
+
export declare function createProgrammaticToolCallingTool(options: AgenticToolOptions, availableTools: CustomToolDefinition[]): CustomToolDefinition;
|
|
4
|
+
//# sourceMappingURL=programmaticToolCalling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"programmaticToolCalling.d.ts","sourceRoot":"","sources":["../../../src/agenticTools/tools/programmaticToolCalling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAc,MAAM,UAAU,CAAC;AAgBrF,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAExF;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,oBAAoB,EAAE,GACrC,oBAAoB,CAwEtB"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.shouldEnableProgrammaticToolCalling = shouldEnableProgrammaticToolCalling;
|
|
7
|
+
exports.createProgrammaticToolCallingTool = createProgrammaticToolCallingTool;
|
|
8
|
+
const node_vm_1 = __importDefault(require("node:vm"));
|
|
9
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
10
|
+
const results_1 = require("../shared/results");
|
|
11
|
+
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
12
|
+
const DEFAULT_MAX_TOOL_CALLS = 25;
|
|
13
|
+
function shouldEnableProgrammaticToolCalling(options) {
|
|
14
|
+
return Boolean(options.programmaticToolCalling);
|
|
15
|
+
}
|
|
16
|
+
function createProgrammaticToolCallingTool(options, availableTools) {
|
|
17
|
+
const config = resolveExecutorConfig(options);
|
|
18
|
+
const callableTools = availableTools.filter((tool) => tool.name !== "code_executor");
|
|
19
|
+
return {
|
|
20
|
+
name: "code_executor",
|
|
21
|
+
label: "Programmatic Tool Calling",
|
|
22
|
+
description: [
|
|
23
|
+
"Execute a JavaScript tool chain against the agent-core tool surface.",
|
|
24
|
+
"Use tools.<name>(params) or callTool(name, params) to batch discovery,",
|
|
25
|
+
"fetch, filesystem, shell, web, and other enabled tools in one request.",
|
|
26
|
+
].join(" "),
|
|
27
|
+
promptSnippet: [
|
|
28
|
+
"Programmatic Tool Calling is available through code_executor.",
|
|
29
|
+
"Write JavaScript inside an async function body and return the final value.",
|
|
30
|
+
"Call agent-core tools with await tools.read({ path: 'README.md' }) or await callTool('tool_search', { query: 'git' }).",
|
|
31
|
+
].join("\n"),
|
|
32
|
+
parameters: typebox_1.Type.Object({
|
|
33
|
+
code: typebox_1.Type.String({
|
|
34
|
+
description: "JavaScript async function body. Use return <value> for the final result.",
|
|
35
|
+
}),
|
|
36
|
+
timeout: typebox_1.Type.Optional(typebox_1.Type.Number({ description: `Timeout in ms (default: ${config.timeout})` })),
|
|
37
|
+
max_tool_calls: typebox_1.Type.Optional(typebox_1.Type.Number({
|
|
38
|
+
description: `Maximum nested tool calls (default: ${config.maxToolCalls})`,
|
|
39
|
+
})),
|
|
40
|
+
}),
|
|
41
|
+
execute: async (_toolCallId, params) => {
|
|
42
|
+
const calls = [];
|
|
43
|
+
const timeout = resolveInvocationLimit(params.timeout, config.timeout);
|
|
44
|
+
const maxToolCalls = resolveInvocationLimit(params.max_tool_calls, config.maxToolCalls);
|
|
45
|
+
const logs = [];
|
|
46
|
+
const toolMap = new Map(callableTools.map((tool) => [tool.name, tool]));
|
|
47
|
+
const callTool = async (name, toolParams = {}) => {
|
|
48
|
+
if (calls.length >= maxToolCalls) {
|
|
49
|
+
throw new Error(`code_executor exceeded max_tool_calls (${maxToolCalls})`);
|
|
50
|
+
}
|
|
51
|
+
const tool = toolMap.get(name);
|
|
52
|
+
if (!tool) {
|
|
53
|
+
throw new Error(`Tool "${name}" is not available to code_executor.`);
|
|
54
|
+
}
|
|
55
|
+
calls.push({ tool: name, params: toolParams });
|
|
56
|
+
return unwrapToolResult(await tool.execute(`code-executor:${calls.length}:${name}`, toolParams));
|
|
57
|
+
};
|
|
58
|
+
const tools = Object.create(null);
|
|
59
|
+
for (const tool of callableTools) {
|
|
60
|
+
tools[tool.name] = (toolParams = {}) => callTool(tool.name, toolParams);
|
|
61
|
+
}
|
|
62
|
+
const context = node_vm_1.default.createContext({
|
|
63
|
+
callTool,
|
|
64
|
+
tools,
|
|
65
|
+
console: {
|
|
66
|
+
log: (...items) => logs.push(items.map(stringifyLogItem).join(" ")),
|
|
67
|
+
error: (...items) => logs.push(items.map(stringifyLogItem).join(" ")),
|
|
68
|
+
warn: (...items) => logs.push(items.map(stringifyLogItem).join(" ")),
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const script = new node_vm_1.default.Script(`(async () => {\n${String(params.code ?? "")}\n})()`);
|
|
72
|
+
const startedAt = Date.now();
|
|
73
|
+
const result = await withTimeout(Promise.resolve(script.runInContext(context, { timeout })), timeout);
|
|
74
|
+
return (0, results_1.jsonResult)({
|
|
75
|
+
result,
|
|
76
|
+
logs,
|
|
77
|
+
toolCalls: calls,
|
|
78
|
+
duration: Date.now() - startedAt,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function resolveInvocationLimit(value, configuredLimit) {
|
|
84
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
85
|
+
return configuredLimit;
|
|
86
|
+
}
|
|
87
|
+
return Math.min(Math.floor(value), configuredLimit);
|
|
88
|
+
}
|
|
89
|
+
function resolveExecutorConfig(options) {
|
|
90
|
+
const configured = options.programmaticToolCalling;
|
|
91
|
+
if (configured && typeof configured === "object") {
|
|
92
|
+
return {
|
|
93
|
+
timeout: configured.timeout ?? DEFAULT_TIMEOUT_MS,
|
|
94
|
+
maxToolCalls: configured.maxToolCalls ?? DEFAULT_MAX_TOOL_CALLS,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
timeout: DEFAULT_TIMEOUT_MS,
|
|
99
|
+
maxToolCalls: DEFAULT_MAX_TOOL_CALLS,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async function withTimeout(promise, timeout) {
|
|
103
|
+
let timer;
|
|
104
|
+
try {
|
|
105
|
+
return await Promise.race([
|
|
106
|
+
promise,
|
|
107
|
+
new Promise((_resolve, reject) => {
|
|
108
|
+
timer = setTimeout(() => reject(new Error(`code_executor timed out after ${timeout}ms`)), timeout);
|
|
109
|
+
}),
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
if (timer) {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function unwrapToolResult(result) {
|
|
119
|
+
const text = result.content.map((item) => item.text).join("\n");
|
|
120
|
+
try {
|
|
121
|
+
return JSON.parse(text);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return text;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function stringifyLogItem(item) {
|
|
128
|
+
if (typeof item === "string") {
|
|
129
|
+
return item;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
return JSON.stringify(item);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return String(item);
|
|
136
|
+
}
|
|
137
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AgentCorePromptResult, AgentCoreSessionEvent, AgentCoreSessionOptions, AgentCoreToolOptions, AgentCoreToolOptions as AgenticToolOptions, CustomToolDefinition, ToolResult, } from "./types";
|
|
1
|
+
export type { AgentCorePromptResult, AgentCoreSessionEvent, AgentCoreSessionOptions, AgentCoreToolOptions, AgentCoreToolOptions as AgenticToolOptions, CustomToolDefinition, ProgrammaticToolCallingOptions, ToolResult, } from "./types";
|
|
2
2
|
export { AGENT_CORE_TOOL_NAMES } from "./types";
|
|
3
3
|
export { AGENT_CORE_TOOL_NAMES as AGENTIC_TOOL_NAMES } from "./types";
|
|
4
4
|
export { AgentCoreSessionHandle, createAgentCoreSession, type AgentCoreEventListener, } from "./session";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,IAAI,kBAAkB,EAC1C,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,IAAI,kBAAkB,EAC1C,oBAAoB,EACpB,8BAA8B,EAC9B,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/tools.test.js
CHANGED
|
@@ -185,6 +185,83 @@ function mockSpawnExit(exitCode = 0, stdoutText = "") {
|
|
|
185
185
|
exitCode: 7,
|
|
186
186
|
});
|
|
187
187
|
});
|
|
188
|
+
(0, vitest_1.it)("exposes code_executor only when programmatic tool calling is enabled", () => {
|
|
189
|
+
const workspace = (0, node_fs_1.mkdtempSync)(path.join(os.tmpdir(), "agent-core-code-mode-toggle-"));
|
|
190
|
+
(0, vitest_1.expect)(getToolDefinitions(workspace).some((tool) => tool.name === "code_executor")).toBe(false);
|
|
191
|
+
(0, vitest_1.expect)(getToolDefinitions(workspace, { programmaticToolCalling: true }).some((tool) => tool.name === "code_executor"))
|
|
192
|
+
.toBe(true);
|
|
193
|
+
});
|
|
194
|
+
(0, vitest_1.it)("executes a programmatic tool chain against existing tools", async () => {
|
|
195
|
+
const workspace = (0, node_fs_1.mkdtempSync)(path.join(os.tmpdir(), "agent-core-code-mode-"));
|
|
196
|
+
(0, node_fs_1.writeFileSync)(path.join(workspace, "note.txt"), "alpha\nbeta\n", "utf8");
|
|
197
|
+
const onToolUse = vitest_1.vi.fn();
|
|
198
|
+
const definitions = getToolDefinitions(workspace, {
|
|
199
|
+
onToolUse,
|
|
200
|
+
programmaticToolCalling: true,
|
|
201
|
+
});
|
|
202
|
+
const codeExecutor = definitions.find((tool) => tool.name === "code_executor");
|
|
203
|
+
if (!codeExecutor) {
|
|
204
|
+
throw new Error("Expected code_executor to be registered");
|
|
205
|
+
}
|
|
206
|
+
const result = await codeExecutor.execute("code-mode", {
|
|
207
|
+
code: [
|
|
208
|
+
"const readResult = await tools.read({ path: 'note.txt' });",
|
|
209
|
+
"await callTool('write', { path: 'copy.txt', content: readResult });",
|
|
210
|
+
"console.log('read bytes', String(readResult).length);",
|
|
211
|
+
"return { readResult, copied: await tools.read({ path: 'copy.txt' }) };",
|
|
212
|
+
].join("\n"),
|
|
213
|
+
});
|
|
214
|
+
const resultText = getText(result);
|
|
215
|
+
if (resultText.startsWith("Error:")) {
|
|
216
|
+
throw new Error(resultText);
|
|
217
|
+
}
|
|
218
|
+
const payload = JSON.parse(resultText);
|
|
219
|
+
(0, vitest_1.expect)(payload.result.readResult).toContain("alpha");
|
|
220
|
+
(0, vitest_1.expect)(payload.result.copied).toContain("alpha");
|
|
221
|
+
(0, vitest_1.expect)(payload.logs).toEqual(["read bytes 17"]);
|
|
222
|
+
(0, vitest_1.expect)(payload.toolCalls.map((call) => call.tool)).toEqual(["read", "write", "read"]);
|
|
223
|
+
(0, vitest_1.expect)(onToolUse).toHaveBeenCalledWith("code_executor", vitest_1.expect.objectContaining({ code: vitest_1.expect.any(String) }));
|
|
224
|
+
(0, vitest_1.expect)(onToolUse).toHaveBeenCalledWith("read", { path: "note.txt" });
|
|
225
|
+
(0, vitest_1.expect)(onToolUse).toHaveBeenCalledWith("write", {
|
|
226
|
+
path: "copy.txt",
|
|
227
|
+
content: vitest_1.expect.stringContaining("alpha"),
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
(0, vitest_1.it)("enforces code_executor nested tool call limits", async () => {
|
|
231
|
+
const workspace = (0, node_fs_1.mkdtempSync)(path.join(os.tmpdir(), "agent-core-code-mode-limit-"));
|
|
232
|
+
const codeExecutor = getToolDefinitions(workspace, {
|
|
233
|
+
programmaticToolCalling: { maxToolCalls: 1 },
|
|
234
|
+
}).find((tool) => tool.name === "code_executor");
|
|
235
|
+
if (!codeExecutor) {
|
|
236
|
+
throw new Error("Expected code_executor to be registered");
|
|
237
|
+
}
|
|
238
|
+
const result = await codeExecutor.execute("code-mode-limit", {
|
|
239
|
+
code: [
|
|
240
|
+
"await tools.tool_search({ query: 'read' });",
|
|
241
|
+
"await tools.tool_search({ query: 'write' });",
|
|
242
|
+
"return 'unreachable';",
|
|
243
|
+
].join("\n"),
|
|
244
|
+
});
|
|
245
|
+
(0, vitest_1.expect)(getText(result)).toBe("Error: code_executor exceeded max_tool_calls (1)");
|
|
246
|
+
});
|
|
247
|
+
(0, vitest_1.it)("does not allow code_executor invocations to raise configured limits", async () => {
|
|
248
|
+
const workspace = (0, node_fs_1.mkdtempSync)(path.join(os.tmpdir(), "agent-core-code-mode-limit-cap-"));
|
|
249
|
+
const codeExecutor = getToolDefinitions(workspace, {
|
|
250
|
+
programmaticToolCalling: { maxToolCalls: 1 },
|
|
251
|
+
}).find((tool) => tool.name === "code_executor");
|
|
252
|
+
if (!codeExecutor) {
|
|
253
|
+
throw new Error("Expected code_executor to be registered");
|
|
254
|
+
}
|
|
255
|
+
const result = await codeExecutor.execute("code-mode-limit-cap", {
|
|
256
|
+
max_tool_calls: 10,
|
|
257
|
+
code: [
|
|
258
|
+
"await tools.tool_search({ query: 'read' });",
|
|
259
|
+
"await tools.tool_search({ query: 'write' });",
|
|
260
|
+
"return 'unreachable';",
|
|
261
|
+
].join("\n"),
|
|
262
|
+
});
|
|
263
|
+
(0, vitest_1.expect)(getText(result)).toBe("Error: code_executor exceeded max_tool_calls (1)");
|
|
264
|
+
});
|
|
188
265
|
(0, vitest_1.it)("processes fetched html content and exposes helper exports directly", async () => {
|
|
189
266
|
const workspace = (0, node_fs_1.mkdtempSync)(path.join(os.tmpdir(), "agent-core-web-"));
|
|
190
267
|
const fetchMock = vitest_1.vi.fn(async () => ({
|
package/dist/types.d.ts
CHANGED
|
@@ -105,6 +105,18 @@ export interface AgentCoreToolOptions {
|
|
|
105
105
|
/** Optional externally managed registry. When provided, the caller owns disposal. */
|
|
106
106
|
backgroundRegistry?: BackgroundProcessRegistry;
|
|
107
107
|
deferredToolRegistry?: DeferredToolRegistry;
|
|
108
|
+
/**
|
|
109
|
+
* Opt-in Programmatic Tool Calling / Code Mode surface. When enabled,
|
|
110
|
+
* agent-core exposes a single `code_executor` tool that can execute a
|
|
111
|
+
* JavaScript tool chain against the already configured agent-core tools.
|
|
112
|
+
*/
|
|
113
|
+
programmaticToolCalling?: boolean | ProgrammaticToolCallingOptions;
|
|
114
|
+
}
|
|
115
|
+
export interface ProgrammaticToolCallingOptions {
|
|
116
|
+
/** Maximum wall-clock time for one code_executor invocation. Default: 120000. */
|
|
117
|
+
timeout?: number;
|
|
118
|
+
/** Maximum nested tool calls allowed from one code_executor invocation. Default: 25. */
|
|
119
|
+
maxToolCalls?: number;
|
|
108
120
|
}
|
|
109
121
|
export declare const AGENT_CORE_TOOL_NAMES: string[];
|
|
110
122
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OA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AO,CAAC,CAAC;IACxD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,GAAG,8BAA8B,CAAC;CACpE;AAED,MAAM,WAAW,8BAA8B;IAC7C,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,EA2BzC,CAAC"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/agent-core",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.e80a53359",
|
|
4
4
|
"description": "Built-in agent-core runtime and tool surface for Babysitter.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test": "vitest run --config vitest.config.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@a5c-ai/agent-mux": "5.0.1-staging.
|
|
31
|
-
"@a5c-ai/babysitter-sdk": "5.0.1-staging.
|
|
30
|
+
"@a5c-ai/agent-mux": "5.0.1-staging.e80a53359",
|
|
31
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.e80a53359",
|
|
32
32
|
"@sinclair/typebox": "^0.34.48"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|