Utility functions for converting ACP content blocks to LangChain formats.
Convert an ACP text block to LangChain content blocks.
Convert an ACP image block to LangChain content blocks.
Convert an ACP audio block to LangChain content blocks.
Convert an ACP resource block to LangChain content blocks.
Convert an ACP embedded resource block to LangChain content blocks.
Check if a command contains dangerous shell patterns.
These patterns can be used to bypass allow-list validation by embedding arbitrary commands within seemingly safe commands.
Extract all command types from a shell command, handling && separators.
For security-sensitive commands (python, node, npm, uv, etc.), includes the full signature to avoid over-permissioning. Each sensitive command has a dedicated handler that extracts the appropriate signature.
Signature extraction strategy:
Truncate a command string to a maximum length for display.
Format execute tool result for better display.