refactor(plugin): include name in promise tools
This commit is contained in:
parent
efeff63749
commit
2a4b298108
5 changed files with 16 additions and 10 deletions
|
|
@ -91,7 +91,8 @@ Promise tools use plain object declarations with async executors:
|
|||
import { Schema } from "effect"
|
||||
|
||||
await ctx.tool.transform((tools) => {
|
||||
tools.add("echo", {
|
||||
tools.add({
|
||||
name: "echo",
|
||||
description: "Echo text",
|
||||
input: Schema.Struct({ text: Schema.String }),
|
||||
output: Schema.Struct({ text: Schema.String }),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ export type Definition<
|
|||
Output extends SchemaType<any>,
|
||||
Structured extends SchemaType<any> = Output,
|
||||
> = {
|
||||
readonly name: string
|
||||
readonly options?: RegisterOptions
|
||||
readonly description: string
|
||||
readonly input: Input
|
||||
readonly output: Output
|
||||
|
|
@ -34,6 +36,8 @@ export type Definition<
|
|||
}
|
||||
|
||||
export type DynamicDefinition = {
|
||||
readonly name: string
|
||||
readonly options?: RegisterOptions
|
||||
readonly description: string
|
||||
readonly jsonSchema: JsonSchema.JsonSchema
|
||||
readonly outputSchema?: JsonSchema.JsonSchema
|
||||
|
|
@ -73,8 +77,8 @@ export interface ToolDraft {
|
|||
Input extends SchemaType<any>,
|
||||
Output extends SchemaType<any>,
|
||||
Structured extends SchemaType<any> = Output,
|
||||
>(name: string, tool: Definition<Input, Output, Structured>, options?: RegisterOptions): void
|
||||
add(name: string, tool: DynamicDefinition, options?: RegisterOptions): void
|
||||
>(tool: Definition<Input, Output, Structured>): void
|
||||
add(tool: DynamicDefinition): void
|
||||
}
|
||||
|
||||
export interface ToolHooks {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue