Skip to content

fix(chat-bridge): add updatedInput to canUseTool responses to satisfy…#17

Open
eduardomrj wants to merge 1 commit intoEvolutionAPI:mainfrom
eduardomrj:fix/chat-bridge-updated-input-zod
Open

fix(chat-bridge): add updatedInput to canUseTool responses to satisfy…#17
eduardomrj wants to merge 1 commit intoEvolutionAPI:mainfrom
eduardomrj:fix/chat-bridge-updated-input-zod

Conversation

@eduardomrj
Copy link
Copy Markdown

… SDK Zod schema

The @anthropic-ai/claude-agent-sdk requires updatedInput: Record in every canUseTool allow response. Without it the SDK throws a ZodError before the permission card ever renders, breaking Write/Edit tool approvals.

Four points corrected:

  1. pendingApprovals map now stores { resolve, toolInput } instead of bare resolve
  2. AUTO_APPROVE / trust-mode fast-path returns { behavior: 'allow', updatedInput: input ?? {} }
  3. stopSession iterates entry and calls entry.resolve(...)
  4. respondToApproval uses entry.resolve and passes updatedInput: entry.toolInput ?? {}

… SDK Zod schema

The @anthropic-ai/claude-agent-sdk requires `updatedInput: Record` in every
`canUseTool` allow response. Without it the SDK throws a ZodError before the
permission card ever renders, breaking Write/Edit tool approvals.

Four points corrected:
1. pendingApprovals map now stores `{ resolve, toolInput }` instead of bare resolve
2. AUTO_APPROVE / trust-mode fast-path returns `{ behavior: 'allow', updatedInput: input ?? {} }`
3. stopSession iterates `entry` and calls `entry.resolve(...)`
4. respondToApproval uses `entry.resolve` and passes `updatedInput: entry.toolInput ?? {}`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @eduardomrj, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant