File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -52,13 +52,13 @@ export namespace Agent {
5252 const cfg = await Config . get ( )
5353
5454 const skillDirs = await Skill . dirs ( )
55+ const whitelistedDirs = [ Truncate . GLOB , ...skillDirs . map ( ( dir ) => path . join ( dir , "*" ) ) ]
5556 const defaults = PermissionNext . fromConfig ( {
5657 "*" : "allow" ,
5758 doom_loop : "ask" ,
5859 external_directory : {
5960 "*" : "ask" ,
60- [ Truncate . GLOB ] : "allow" ,
61- ...Object . fromEntries ( skillDirs . map ( ( dir ) => [ path . join ( dir , "*" ) , "allow" ] ) ) ,
61+ ...Object . fromEntries ( whitelistedDirs . map ( ( dir ) => [ dir , "allow" ] ) ) ,
6262 } ,
6363 question : "deny" ,
6464 plan_enter : "deny" ,
@@ -142,7 +142,8 @@ export namespace Agent {
142142 codesearch : "allow" ,
143143 read : "allow" ,
144144 external_directory : {
145- [ Truncate . GLOB ] : "allow" ,
145+ "*" : "ask" ,
146+ ...Object . fromEntries ( whitelistedDirs . map ( ( dir ) => [ dir , "allow" ] ) ) ,
146147 } ,
147148 } ) ,
148149 user ,
Original file line number Diff line number Diff line change @@ -75,6 +75,20 @@ test("explore agent denies edit and write", async () => {
7575 } )
7676} )
7777
78+ test ( "explore agent asks for external directories and allows Truncate.GLOB" , async ( ) => {
79+ const { Truncate } = await import ( "../../src/tool/truncation" )
80+ await using tmp = await tmpdir ( )
81+ await Instance . provide ( {
82+ directory : tmp . path ,
83+ fn : async ( ) => {
84+ const explore = await Agent . get ( "explore" )
85+ expect ( explore ) . toBeDefined ( )
86+ expect ( PermissionNext . evaluate ( "external_directory" , "/some/other/path" , explore ! . permission ) . action ) . toBe ( "ask" )
87+ expect ( PermissionNext . evaluate ( "external_directory" , Truncate . GLOB , explore ! . permission ) . action ) . toBe ( "allow" )
88+ } ,
89+ } )
90+ } )
91+
7892test ( "general agent denies todo tools" , async ( ) => {
7993 await using tmp = await tmpdir ( )
8094 await Instance . provide ( {
You can’t perform that action at this time.
0 commit comments