@@ -107,30 +107,35 @@ describe('structured field rendering', () => {
107107 expect ( toDiffText ( [ 1 ] ) ) . not . toBe ( toDiffText ( [ '1' ] ) )
108108 } )
109109
110- it ( 'masks declared tool password fields without projecting away other tool data' , ( ) => {
111- declareSubBlocks ( {
112- convex : [
113- { id : 'deployKey' , type : 'short-input' , password : true } ,
114- { id : 'secretAccess' , type : 'dropdown' } ,
115- ] ,
116- } )
117- const tools = [
118- {
119- type : 'convex' ,
120- customToolId : 'tool-a' ,
121- params : { deployKey : 'private' , secretAccess : 'none' , query : 'ok' } ,
122- } ,
123- ]
124- const rendered = toDiffText ( tools , 'agent' , 'tools' )
125- expect ( rendered ) . not . toContain ( 'private' )
126- expect ( JSON . parse ( rendered ) ) . toEqual ( [
127- {
128- type : 'convex' ,
129- customToolId : 'tool-a' ,
130- params : { deployKey : '•••' , secretAccess : 'none' , query : 'ok' } ,
131- } ,
132- ] )
133- } )
110+ it . each ( [ false , true ] ) (
111+ 'masks declared tool passwords without discarding other params (encoded: %s)' ,
112+ ( encoded ) => {
113+ declareSubBlocks ( {
114+ convex : [
115+ { id : 'deployKey' , type : 'short-input' , password : true } ,
116+ { id : 'secretAccess' , type : 'dropdown' } ,
117+ ] ,
118+ } )
119+ const stored = ( params : Record < string , unknown > ) =>
120+ encoded ? JSON . stringify ( params ) : params
121+ const tools = [
122+ {
123+ type : 'convex' ,
124+ customToolId : 'tool-a' ,
125+ params : stored ( { deployKey : 'private' , secretAccess : 'none' , query : 'ok' } ) ,
126+ } ,
127+ ]
128+ const rendered = toDiffText ( tools , 'agent' , 'tools' )
129+ expect ( rendered ) . not . toContain ( 'private' )
130+ expect ( JSON . parse ( rendered ) ) . toEqual ( [
131+ {
132+ type : 'convex' ,
133+ customToolId : 'tool-a' ,
134+ params : stored ( { deployKey : '•••' , secretAccess : 'none' , query : 'ok' } ) ,
135+ } ,
136+ ] )
137+ }
138+ )
134139
135140 it ( 'masks nested secrets in objects, encoded JSON and table cells' , ( ) => {
136141 const value = {
0 commit comments