Repository navigation
feat(tool): split media reading out of read into read_image/read_audio/read_video - #2828
Merged
Merged
Conversation
2 tasks done
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.
Issue / context (if applicable)
Spec:
docs/compose/spec/read-media-split.mdType of change
New feature / Refactor
What does this PR do?
readhandled text, directories, images, PDFs, audio and video in one tool, and it advertised media support through a description paragraph that changed with the model. A model without the right capability only found out after callingreadon a media file.This PR splits media into three dedicated tools:
read_image,read_audioandread_video, each taking a singlefile_path.unknownverdict and unresolvable models are excluded.read: now reads text and directories only. Media fails withCannot read binary file, anddescribeMediais removed.@-mentions: these arrive astext/plain, so their type is now sniffed:readpermission governs the new tools, and they are also wired into parallel-readonly gating, dream/distill allowlists, compaction, the system-prompt vision hint, TUI/run rendering and ACP kinds.Behavior change: audio and video behind an adapter with no capability declaration (e.g.
@ai-sdk/openai) are no longer offered. This fails closed.@ai-sdk/openai-compatibleis unaffected.How did you verify your code works?
bun run typecheck(packages/cli): pass.bun test --timeout 30000 test/tool/ test/permission/ test/session/system.test.ts test/session/compaction.test.ts test/session/prompt.test.ts test/agent/agent.test.ts test/acp: 1010 pass, 0 fail.test/tool/read-media.test.tsregistry-toolset.test.tsreadmedia refusals inread.test.ts@-mention routing inprompt.test.ts(this one fails on the pre-fix head)mainin this environment.Checklist