Merge pull request #1750 from ojh102/fix/guard-non-string-tool-output
fix(hooks): guard against non-string tool output in afterToolResult hooks
This commit is contained in:
commit
f876d60e87
@ -10,6 +10,7 @@ export function createDelegateTaskRetryHook(_ctx: PluginInput) {
|
|||||||
output: { title: string; output: string; metadata: unknown }
|
output: { title: string; output: string; metadata: unknown }
|
||||||
) => {
|
) => {
|
||||||
if (input.tool.toLowerCase() !== "task") return
|
if (input.tool.toLowerCase() !== "task") return
|
||||||
|
if (typeof output.output !== "string") return
|
||||||
|
|
||||||
const errorInfo = detectDelegateTaskError(output.output)
|
const errorInfo = detectDelegateTaskError(output.output)
|
||||||
if (errorInfo) {
|
if (errorInfo) {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ export function createEditErrorRecoveryHook(_ctx: PluginInput) {
|
|||||||
output: { title: string; output: string; metadata: unknown }
|
output: { title: string; output: string; metadata: unknown }
|
||||||
) => {
|
) => {
|
||||||
if (input.tool.toLowerCase() !== "edit") return
|
if (input.tool.toLowerCase() !== "edit") return
|
||||||
|
if (typeof output.output !== "string") return
|
||||||
|
|
||||||
const outputLower = (output.output ?? "").toLowerCase()
|
const outputLower = (output.output ?? "").toLowerCase()
|
||||||
const hasEditError = EDIT_ERROR_PATTERNS.some((pattern) =>
|
const hasEditError = EDIT_ERROR_PATTERNS.some((pattern) =>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user