@@ -135,45 +135,50 @@ export const imapPollingTrigger: TriggerConfig = {
135135 {
136136 id : 'searchCriteria' ,
137137 title : 'Search Criteria' ,
138- type : 'short-input' ,
139- placeholder : 'UNSEEN' ,
140- description :
141- 'IMAP search criteria (e.g., UNSEEN, FROM "sender@example.com", SUBJECT "report"). Default: UNSEEN' ,
142- defaultValue : 'UNSEEN' ,
138+ type : 'code' ,
139+ placeholder : '{ "unseen": true }' ,
140+ description : 'ImapFlow search criteria as JSON object. Default: unseen messages only.' ,
141+ defaultValue : '{ "unseen": true }' ,
143142 required : false ,
144143 mode : 'trigger' ,
145144 wandConfig : {
146145 enabled : true ,
147146 maintainHistory : true ,
148- prompt : `You are an expert in IMAP search syntax (RFC 3501). Generate IMAP search criteria based on user descriptions.
147+ generationType : 'json-object' ,
148+ prompt : `Generate ImapFlow search criteria as a JSON object based on the user's description.
149149
150- IMAP search keys include:
151- - ALL - All messages
152- - UNSEEN / SEEN - Unread/read messages
153- - FLAGGED / UNFLAGGED - Starred/unstarred
154- - FROM "string" - Sender contains string
155- - TO "string" - Recipient contains string
156- - SUBJECT "string" - Subject contains string
157- - BODY "string" - Body contains string
158- - TEXT "string" - Headers or body contains string
159- - BEFORE date / SINCE date / ON date - Date filters (DD-Mon-YYYY, e.g., 01-Jan-2024)
160- - LARGER n / SMALLER n - Size in bytes
161- - HEADER field-name "string" - Custom header search
162- - NOT criteria - Negate
163- - OR criteria1 criteria2 - Either matches
164- - (criteria) - Grouping
150+ Available properties (all are optional, combine as needed):
151+ - "unseen": true - Unread messages
152+ - "seen": true - Read messages
153+ - "flagged": true - Starred/flagged messages
154+ - "answered": true - Replied messages
155+ - "deleted": true - Deleted messages
156+ - "draft": true - Draft messages
157+ - "from": "sender@example.com" - From address contains
158+ - "to": "recipient@example.com" - To address contains
159+ - "cc": "cc@example.com" - CC address contains
160+ - "subject": "keyword" - Subject contains
161+ - "body": "text" - Body contains
162+ - "text": "search" - Headers or body contains
163+ - "since": "2024-01-01" - Emails since date (ISO format)
164+ - "before": "2024-12-31" - Emails before date
165+ - "larger": 10240 - Larger than N bytes
166+ - "smaller": 1048576 - Smaller than N bytes
167+ - "header": { "X-Priority": "1" } - Custom header search
168+ - "or": [{ "from": "a@x.com" }, { "from": "b@x.com" }] - OR conditions
169+ - "not": { "from": "spam@x.com" } - Negate condition
165170
166- Multiple criteria are AND'd together by default .
171+ Multiple properties are combined with AND .
167172
168173Examples:
169- - UNSEEN FROM " boss@company.com"
170- - OR FROM " alice" FROM " bob"
171- - SINCE 01-Jan-2024 SUBJECT "report"
172- - NOT SEEN FLAGGED
174+ - Unread from boss: { "unseen": true, "from": " boss@company.com" }
175+ - From Alice or Bob: { "or": [{ "from": " alice@x.com" }, { "from": " bob@x.com" }] }
176+ - Recent with keyword: { "since": "2024- 01-01", "subject": "report" }
177+ - Exclude spam: { "unseen": true, "not": { "from": "newsletter@x.com" } }
173178
174179Current criteria: {context}
175180
176- Return ONLY the IMAP search criteria , no explanations or markdown.` ,
181+ Return ONLY valid JSON , no explanations or markdown.` ,
177182 placeholder : 'Describe what emails you want to filter...' ,
178183 } ,
179184 } ,
0 commit comments