File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,9 +144,10 @@ function evaluateCondition(
144144 if ( lc . includes ( 'arguments containing' ) ) {
145145 const argsStr = JSON . stringify ( event . toolArgs ?? { } ) . toLowerCase ( ) ;
146146 // Extract keywords from parenthetical list
147- const parenMatch = condition . match ( / \( ( [ ^ ) ] + ) \) / ) ;
148- if ( parenMatch ) {
149- const keywords = parenMatch [ 1 ] . split ( ',' ) . map ( ( k ) => k . trim ( ) . toLowerCase ( ) ) ;
147+ const openIdx = condition . indexOf ( '(' ) ;
148+ const closeIdx = openIdx >= 0 ? condition . indexOf ( ')' , openIdx + 1 ) : - 1 ;
149+ if ( openIdx >= 0 && closeIdx > openIdx ) {
150+ const keywords = condition . slice ( openIdx + 1 , closeIdx ) . split ( ',' ) . map ( ( k ) => k . trim ( ) . toLowerCase ( ) ) ;
150151 for ( const keyword of keywords ) {
151152 if ( keyword && argsStr . includes ( keyword ) ) {
152153 return { matchedOn : 'tool.args' , matchValue : keyword } ;
@@ -204,7 +205,7 @@ function evaluateCondition(
204205
205206 // Handle OR operator
206207 if ( expected . includes ( ' or ' ) ) {
207- const alternatives = expected . split ( / \s + o r \s + / i ) ;
208+ const alternatives = expected . split ( ' or ' ) ;
208209 for ( const alt of alternatives ) {
209210 const trimmed = alt . trim ( ) ;
210211 if ( eventDomain === trimmed || eventDomain . endsWith ( `.${ trimmed } ` ) ) {
You can’t perform that action at this time.
0 commit comments