support custom tools (#2668)

This commit is contained in:
Dax
2025-09-18 03:58:21 -04:00
committed by GitHub
parent e9d902d844
commit 3b6c0ec0b3
12 changed files with 140 additions and 488 deletions

View File

@@ -1,14 +1,20 @@
import { Plugin } from "./index"
import { tool } from "./tool"
export const ExamplePlugin: Plugin = async ({
client: _client,
$: _shell,
project: _project,
directory: _directory,
worktree: _worktree,
}) => {
export const ExamplePlugin: Plugin = async (ctx) => {
return {
permission: {},
tool: {
mytool: tool((zod) => ({
description: "This is a custom tool tool",
args: {
foo: zod.string(),
},
async execute(args, ctx) {
return `Hello ${args.foo}!`
},
})),
},
async "chat.params"(_input, output) {
output.topP = 1
},