cloudaxe-opencode/packages/plugin/src/example.ts

23 lines
486 B
TypeScript
Raw Normal View History

2025-08-02 22:50:19 +00:00
import { Plugin } from "./index"
2025-09-18 07:58:21 +00:00
import { tool } from "./tool"
2025-08-02 22:50:19 +00:00
2025-09-18 07:58:21 +00:00
export const ExamplePlugin: Plugin = async (ctx) => {
2025-08-02 22:50:19 +00:00
return {
permission: {},
2025-09-18 07:58:21 +00:00
tool: {
2025-09-18 09:42:59 +00:00
mytool: tool({
2025-09-18 07:58:21 +00:00
description: "This is a custom tool tool",
args: {
2025-09-18 09:42:59 +00:00
foo: tool.schema.string().describe("foo"),
2025-09-18 07:58:21 +00:00
},
2025-09-18 09:42:59 +00:00
async execute(args) {
2025-09-18 07:58:21 +00:00
return `Hello ${args.foo}!`
},
2025-09-18 09:42:59 +00:00
}),
2025-09-18 07:58:21 +00:00
},
2025-09-01 21:35:48 +00:00
async "chat.params"(_input, output) {
2025-08-04 01:42:45 +00:00
output.topP = 1
2025-08-04 01:19:03 +00:00
},
2025-08-02 22:50:19 +00:00
}
}