mirror of
https://github.com/aljazceru/opencode.git
synced 2026-02-04 15:44:34 +01:00
tweak: move zod validation for tools to ensure it always runs (#3565)
This commit is contained in:
@@ -534,7 +534,6 @@ export namespace SessionPrompt {
|
||||
args,
|
||||
},
|
||||
)
|
||||
item.parameters.parse(args)
|
||||
const result = await item.execute(args, {
|
||||
sessionID: input.sessionID,
|
||||
abort: options.abortSignal!,
|
||||
|
||||
@@ -42,8 +42,13 @@ export namespace Tool {
|
||||
return {
|
||||
id,
|
||||
init: async () => {
|
||||
if (init instanceof Function) return init()
|
||||
return init
|
||||
const toolInfo = init instanceof Function ? await init() : init
|
||||
const execute = toolInfo.execute
|
||||
toolInfo.execute = (args, ctx) => {
|
||||
toolInfo.parameters.parse(args)
|
||||
return execute(args, ctx)
|
||||
}
|
||||
return toolInfo
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user