feat(bridle): extract text from uploaded documents so the agent can read them (CLEAN-63) - #60
Merged
Merged
Conversation
…ead them (CLEAN-63) A document handed to the agent as a URL was usable (its own tools fetch and parse it), but the same file uploaded directly arrived as a named reference the model cannot open — a direct upload was strictly worse than a link. expand() now extracts text server-side and inlines it the way txt/csv already are: xlsx/xlsm sheets render as CSV under per-sheet headers (exceljs), docx paragraphs via mammoth, pdf text layer via pdf-parse. Legacy .doc/.xls and PowerPoint stay named references, and a broken or text-less file (a scanned PDF) degrades to the unreadable-file notice rather than failing the message. readableByAgent is now decided by kind + MIME — the wire kind stays `binary` because the released runtime's transcript sanitizer accepts only image/text/binary. Chips in both consoles use the same rule, so an xlsx no longer claims "the agent sees the name, not the contents". Jest needs --experimental-vm-modules because pdf.js loads its worker via dynamic import, which the jest VM otherwise forbids; production node is unaffected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… (CLEAN-63) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expand()now extracts text server-side and inlines it the way txt/csv already are:== Sheet: name ==headers (exceljs; formulas contribute cached results).doc/.xlsand PowerPoint stay named references; a broken or text-less file (scanned PDF) degrades to the CLEAN-57 unreadable-file notice instead of failing the message.MAX_EXTRACTED_TEXT_CHARStruncation applies as for text files.readableByAgentis now kind + MIME (wire kind staysbinary— the released runtime's transcript sanitizer accepts only image/text/binary). Chips in both consoles use the same rule, so an xlsx no longer says "the agent sees the name, not the contents".NODE_OPTIONS=--experimental-vm-modules: pdf.js loads its worker via dynamic import, which the jest VM otherwise forbids. Production node is unaffected.Jira: CLEAN-63
Test plan
nuxt typechecktotals.xlsx→readableByAgent: true;deck.pptx→false🤖 Generated with Claude Code