@@ -98,15 +98,14 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
98
98
} ) ;
99
99
}
100
100
Log ( `Prompt options change for tab <b>${ tabId } </b>:<br/>
101
- ${
102
- optionsValues
103
- ? `<br/>Options:<br/>${ Object . keys ( optionsValues )
104
- . map ( ( optionId ) => {
105
- return `<b>${ optionId } </b>: ${ ( optionsValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
106
- } )
107
- . join ( '<br/>' ) } `
108
- : ''
109
- }
101
+ ${ optionsValues
102
+ ? `<br/>Options:<br/>${ Object . keys ( optionsValues )
103
+ . map ( ( optionId ) => {
104
+ return `<b>${ optionId } </b>: ${ ( optionsValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
105
+ } )
106
+ . join ( '<br/>' ) } `
107
+ : ''
108
+ }
110
109
` ) ;
111
110
} ,
112
111
onPromptInputButtonClick : ( tabId , buttonId ) => {
@@ -146,6 +145,11 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
146
145
} ,
147
146
} ) ;
148
147
148
+ const argumentsItemId1 = generateUID ( ) ;
149
+
150
+ const envItemId1 = generateUID ( ) ;
151
+ const envItemId2 = generateUID ( ) ;
152
+
149
153
const mcpSheet = mynahUI . openDetailedList ( {
150
154
detailedList : sampleMCPList ,
151
155
events : {
@@ -175,6 +179,17 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
175
179
} ]
176
180
} ,
177
181
list : [ ] ,
182
+ filterActions : [
183
+ {
184
+ id : 'cancel-mcp' ,
185
+ text : 'Cancel' ,
186
+ } ,
187
+ {
188
+ id : 'save-mcp' ,
189
+ text : 'Save' ,
190
+ status : 'primary'
191
+ }
192
+ ] ,
178
193
filterOptions : [
179
194
{
180
195
type : 'select' ,
@@ -199,6 +214,77 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
199
214
description : 'Seconds' ,
200
215
id : generateUID ( )
201
216
} ,
217
+ {
218
+ id : generateUID ( ) ,
219
+ type : 'list' ,
220
+ title : 'Arguments' ,
221
+ mandatory : false ,
222
+ items : [
223
+ {
224
+ id : argumentsItemId1 ,
225
+ type : 'textinput' ,
226
+ } ,
227
+ ] ,
228
+ value : [
229
+ {
230
+ persistent : true ,
231
+ values : {
232
+ [ argumentsItemId1 ] : '-y' ,
233
+ }
234
+ } ,
235
+ {
236
+ persistent : false ,
237
+ values : {
238
+ [ argumentsItemId1 ] : '@modelcontextprotocol/server-filesystem' ,
239
+ }
240
+ } ,
241
+ {
242
+ persistent : false ,
243
+ values : {
244
+ [ argumentsItemId1 ] : '/Users/username/Desktop' ,
245
+ }
246
+ } ,
247
+ {
248
+ persistent : false ,
249
+ values : {
250
+ [ argumentsItemId1 ] : '/path/to/other/allowed/dir' ,
251
+ }
252
+ }
253
+ ]
254
+ } ,
255
+ {
256
+ id : generateUID ( ) ,
257
+ type : 'list' ,
258
+ title : 'Environment variables' ,
259
+ items : [
260
+ {
261
+ id : envItemId1 ,
262
+ title : 'Name' ,
263
+ type : 'textinput' ,
264
+ } ,
265
+ {
266
+ id : envItemId2 ,
267
+ title : 'Value' ,
268
+ type : 'textinput' ,
269
+ }
270
+ ] ,
271
+ value : [
272
+ {
273
+ persistent : true ,
274
+ values : {
275
+ [ envItemId1 ] : 'some_env' ,
276
+ [ envItemId2 ] : 'AJSKJLE!@)(UD'
277
+ }
278
+ } ,
279
+ {
280
+ persistent : false ,
281
+ values : {
282
+ [ envItemId1 ] : 'some_other_env' ,
283
+ [ envItemId2 ] : '12kjlkj!dddaa'
284
+ }
285
+ }
286
+ ]
287
+ } ,
202
288
] ,
203
289
} ) ;
204
290
}
@@ -207,8 +293,8 @@ export const createMynahUI = (initialData?: MynahUIDataModel): MynahUI => {
207
293
onClose : ( ) => {
208
294
Log ( 'Sheet closed' ) ;
209
295
} ,
210
- onTitleActionClick : ( button ) => {
211
- if ( button . id === 'back-to-mcp-list' ) {
296
+ onTitleActionClick : ( button ) => {
297
+ if ( button . id === 'back-to-mcp-list' ) {
212
298
mcpSheet . update ( sampleMCPList ) ;
213
299
}
214
300
}
@@ -1052,11 +1138,10 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
1052
1138
Log ( `New prompt on tab: <b>${ tabId } </b><br/>
1053
1139
prompt: <b>${ prompt . prompt !== undefined && prompt . prompt !== '' ? prompt . prompt : '{command only}' } </b><br/>
1054
1140
command: <b>${ prompt . command ?? '{none}' } </b><br/>
1055
- options: <b>{${
1056
- Object . keys ( prompt . options ?? { } )
1057
- . map ( ( op ) => `'${ op } ': '${ prompt . options ?. [ op ] as string } '` )
1058
- . join ( ',' ) ?? ''
1059
- } }</b><br/>
1141
+ options: <b>{${ Object . keys ( prompt . options ?? { } )
1142
+ . map ( ( op ) => `'${ op } ': '${ prompt . options ?. [ op ] as string } '` )
1143
+ . join ( ',' ) ?? ''
1144
+ } }</b><br/>
1060
1145
context: <b>[${ ( prompt . context ?? [ ] ) . map ( ( ctx ) => `${ JSON . stringify ( ctx ) } ` ) . join ( ']</b>, <b>[' ) } ]` ) ;
1061
1146
if ( tabId === 'tab-1' ) {
1062
1147
mynahUI . updateStore ( tabId , {
@@ -1220,15 +1305,14 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
1220
1305
Log ( `Body action clicked in message <b>${ messageId } </b>:<br/>
1221
1306
Action Id: <b>${ action . id } </b><br/>
1222
1307
Action Text: <b>${ action . text } </b><br/>
1223
- ${
1224
- action . formItemValues
1225
- ? `<br/>Options:<br/>${ Object . keys ( action . formItemValues )
1226
- . map ( ( optionId ) => {
1227
- return `<b>${ optionId } </b>: ${ ( action . formItemValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
1228
- } )
1229
- . join ( '<br/>' ) } `
1230
- : ''
1231
- }
1308
+ ${ action . formItemValues
1309
+ ? `<br/>Options:<br/>${ Object . keys ( action . formItemValues )
1310
+ . map ( ( optionId ) => {
1311
+ return `<b>${ optionId } </b>: ${ ( action . formItemValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
1312
+ } )
1313
+ . join ( '<br/>' ) } `
1314
+ : ''
1315
+ }
1232
1316
` ) ;
1233
1317
} ,
1234
1318
onQuickCommandGroupActionClick : ( tabId : string , action ) => {
@@ -1288,15 +1372,14 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
1288
1372
event . preventDefault ( ) ;
1289
1373
event . stopImmediatePropagation ( ) ;
1290
1374
Log ( `Form keypress Enter submit on tab <b>${ tabId } </b>:<br/>
1291
- ${
1292
- formData
1293
- ? `<br/>Options:<br/>${ Object . keys ( formData )
1294
- . map ( ( optionId ) => {
1295
- return `<b>${ optionId } </b>: ${ ( formData as Record < string , string > ) [ optionId ] ?? '' } ` ;
1296
- } )
1297
- . join ( '<br/>' ) } `
1298
- : ''
1299
- }
1375
+ ${ formData
1376
+ ? `<br/>Options:<br/>${ Object . keys ( formData )
1377
+ . map ( ( optionId ) => {
1378
+ return `<b>${ optionId } </b>: ${ ( formData as Record < string , string > ) [ optionId ] ?? '' } ` ;
1379
+ } )
1380
+ . join ( '<br/>' ) } `
1381
+ : ''
1382
+ }
1300
1383
` ) ;
1301
1384
return true ;
1302
1385
}
@@ -1306,15 +1389,14 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
1306
1389
Log ( `Custom form action clicked for tab <b>${ tabId } </b>:<br/>
1307
1390
Action Id: <b>${ action . id } </b><br/>
1308
1391
Action Text: <b>${ action . text } </b><br/>
1309
- ${
1310
- action . formItemValues
1311
- ? `<br/>Options:<br/>${ Object . keys ( action . formItemValues )
1312
- . map ( ( optionId ) => {
1313
- return `<b>${ optionId } </b>: ${ ( action . formItemValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
1314
- } )
1315
- . join ( '<br/>' ) } `
1316
- : ''
1317
- }
1392
+ ${ action . formItemValues
1393
+ ? `<br/>Options:<br/>${ Object . keys ( action . formItemValues )
1394
+ . map ( ( optionId ) => {
1395
+ return `<b>${ optionId } </b>: ${ ( action . formItemValues as Record < string , string > ) [ optionId ] ?? '' } ` ;
1396
+ } )
1397
+ . join ( '<br/>' ) } `
1398
+ : ''
1399
+ }
1318
1400
` ) ;
1319
1401
} ,
1320
1402
onChatItemEngagement : ( tabId , messageId , engagement ) => {
@@ -1361,6 +1443,11 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
1361
1443
chatItems : [ ] ,
1362
1444
} ) ;
1363
1445
break ;
1446
+ case Commands . CLEAR_CONTEXT_ITEMS :
1447
+ mynahUI . updateStore ( tabId , {
1448
+ contextCommands : [ ] ,
1449
+ } ) ;
1450
+ break ;
1364
1451
case Commands . CLEAR_LOGS :
1365
1452
LogClear ( ) ;
1366
1453
break ;
@@ -1671,13 +1758,13 @@ used as a context to generate this message.`,
1671
1758
mynahUI . updateStore ( tabId , {
1672
1759
...( optionalParts != null
1673
1760
? {
1674
- promptInputProgress : {
1675
- status : 'info' ,
1676
- ...( percentage > 50 ? { text : 'Almost done...' } : { } ) ,
1677
- valueText : `${ parseInt ( percentage . toString ( ) ) } %` ,
1678
- value : percentage ,
1679
- } ,
1680
- }
1761
+ promptInputProgress : {
1762
+ status : 'info' ,
1763
+ ...( percentage > 50 ? { text : 'Almost done...' } : { } ) ,
1764
+ valueText : `${ parseInt ( percentage . toString ( ) ) } %` ,
1765
+ value : percentage ,
1766
+ } ,
1767
+ }
1681
1768
: { } ) ,
1682
1769
} ) ;
1683
1770
return false ;
@@ -1710,8 +1797,8 @@ used as a context to generate this message.`,
1710
1797
}
1711
1798
Log ( `Stream ended with details: <br/>
1712
1799
${ Object . keys ( cardDetails )
1713
- . map ( ( key ) => `${ key } : <b>${ cardDetails [ key ] . toString ( ) } </b>` )
1714
- . join ( '<br/>' ) }
1800
+ . map ( ( key ) => `${ key } : <b>${ cardDetails [ key ] . toString ( ) } </b>` )
1801
+ . join ( '<br/>' ) }
1715
1802
` ) ;
1716
1803
mynahUI . addChatItem ( tabId , { ...defaultFollowUps , messageId : generateUID ( ) } ) ;
1717
1804
streamingMessageId = null ;
0 commit comments