fix(deepagents): return application/octet-stream for unknown MIME types (#541)
Fixes #542.
`getMimeType()` falls back to `"text/plain"` for any extension not in
the `MIME_TYPES` lookup table. Since `isTextMimeType("text/plain")`
returns `true`, this means binary files (.zip, .exe, .wasm, .sqlite,
.pyc, .class, .jar, etc.) get treated as text everywhere downstream —
grep searches through them and returns garbage, read_file splits their
content on newlines and paginates it, and StateBackend can silently
corrupt binary data stored via createFileData().
The fix is straightforward: change the default to
`"application/octet-stream"`, which is what unknown binary data should
be. `isTextMimeType()` already returns `false` for it, so binary files
stop getting mangled.
To avoid breaking existing behavior for actual text files that were
previously relying on the fallback (like .txt, .ts, .py, .json, .js —
none of which had explicit entries), this also adds those to the
MIME_TYPES map directly. Covers ~67 common text/code extensions.
All 386 backend tests pass (10 files). The updated test expectations in
utils.test.ts verify both sides: known text extensions still resolve
correctly, and unknown/binary extensions now get
`application/octet-stream` instead of being misidentified as text.
---------
Co-authored-by: Hunter Lovell <40191806+hntrl@users.noreply.github.com> A
Aman Pandey committed
1ca6dc92fd40a6d845d24b95ba14b8f2643db394
Parent: 5d266a2
Committed by GitHub <noreply@github.com>
on 6/2/2026, 8:44:48 PM