SIGN IN SIGN UP

fix(deepagents): handle non-string content blocks in tool result sizechecking (#288)

Fixes #277

The tool result eviction logic in `processToolMessage` only checked
`content` when it was a plain string (`typeof msg.content ===
"string"`), which meant array-based content blocks (e.g. `[{ type:
"text", text: "..." }]`) bypassed the size limit entirely and were sent
back to the agent untruncated.

The fix uses the existing `BaseMessage.text` getter from
`@langchain/core`, which already handles both content formats:
- **String content**: returned as-is
- **Array content blocks**: joins all blocks with `type === "text"` into
a single string

This avoids introducing any new utility functions — the upstream API
already solves this.

## Changes

- Updated `processToolMessage()` in `fs.ts` to use `msg.text` instead of
directly checking `msg.content`
- Added 2 unit tests covering array-based content block eviction (large
and small)
C
Christian Bromann committed
9c666ba44adc1f8b428546c2191ea71d88b03998
Parent: e8744a2
Committed by GitHub <noreply@github.com> on 6/1/2026, 6:32:05 PM