File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ export const ReadTool = Tool.define("read", {
5959 throw new Error ( `File not found: ${ filepath } ` )
6060 }
6161
62- const isImage = file . type . startsWith ( "image/" ) && file . type !== "image/svg+xml"
62+ // Exclude SVG (XML-based) and vnd.fastbidsheet (.fbs extension, commonly FlatBuffers schema files)
63+ const isImage =
64+ file . type . startsWith ( "image/" ) && file . type !== "image/svg+xml" && file . type !== "image/vnd.fastbidsheet"
6365 const isPdf = file . type === "application/pdf"
6466 if ( isImage || isPdf ) {
6567 const mime = file . type
Original file line number Diff line number Diff line change @@ -300,4 +300,33 @@ describe("tool.read truncation", () => {
300300 } ,
301301 } )
302302 } )
303+
304+ test ( ".fbs files (FlatBuffers schema) are read as text, not images" , async ( ) => {
305+ await using tmp = await tmpdir ( {
306+ init : async ( dir ) => {
307+ // FlatBuffers schema content
308+ const fbsContent = `namespace MyGame;
309+
310+ table Monster {
311+ pos:Vec3;
312+ name:string;
313+ inventory:[ubyte];
314+ }
315+
316+ root_type Monster;`
317+ await Bun . write ( path . join ( dir , "schema.fbs" ) , fbsContent )
318+ } ,
319+ } )
320+ await Instance . provide ( {
321+ directory : tmp . path ,
322+ fn : async ( ) => {
323+ const read = await ReadTool . init ( )
324+ const result = await read . execute ( { filePath : path . join ( tmp . path , "schema.fbs" ) } , ctx )
325+ // Should be read as text, not as image
326+ expect ( result . attachments ) . toBeUndefined ( )
327+ expect ( result . output ) . toContain ( "namespace MyGame" )
328+ expect ( result . output ) . toContain ( "table Monster" )
329+ } ,
330+ } )
331+ } )
303332} )
You can’t perform that action at this time.
0 commit comments