@arki-moe/agent-ts 2.1.0 → 2.1.1
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 +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ When `apiKey` is not provided in config, adapters read from the corresponding en
|
|
|
62
62
|
| `system` | `string` | Optional system prompt |
|
|
63
63
|
| `endCondition` | `(context, last) => boolean` | Stop condition for `run`. Defaults to `last.role === Role.Ai` |
|
|
64
64
|
| `onToolCall` | `(message, args) => boolean \| void \| Promise<boolean \| void>` | Called before each tool execution; return `false` to skip tool execution and `onToolResult` |
|
|
65
|
-
| `onToolResult` | `(message) => void \| Promise<void>` | Called after each tool execution |
|
|
65
|
+
| `onToolResult` | `(message) => void \| Promise<void>` | Called after each tool execution (`message.role === Role.ToolResult`) |
|
|
66
66
|
|
|
67
67
|
`agent.run` always appends new messages to `agent.context`. Multiple tool calls in a single model response are executed in parallel.
|
|
68
68
|
|
package/dist/types.d.ts
CHANGED
|
@@ -37,7 +37,9 @@ export type AgentConfig = {
|
|
|
37
37
|
onToolCall?: (message: Extract<Message, {
|
|
38
38
|
role: Role.ToolCall;
|
|
39
39
|
}>, args: unknown) => boolean | void | Promise<boolean | void>;
|
|
40
|
-
onToolResult?: (message: Message
|
|
40
|
+
onToolResult?: (message: Extract<Message, {
|
|
41
|
+
role: Role.ToolResult;
|
|
42
|
+
}>) => void | Promise<void>;
|
|
41
43
|
[key: string]: unknown;
|
|
42
44
|
};
|
|
43
45
|
export type Adapter = (config: Record<string, unknown>, context: Message[], tools: Tool[]) => Promise<Message[]>;
|