@realtimex/email-automator 2.9.1 → 2.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,7 @@ export const ContextAwareAnalysisSchema = z.object({
52
52
  .describe('Actions to execute based on the matched rule'),
53
53
 
54
54
  // Intent-aware draft content (if draft action is included)
55
- draft_content: z.string().optional()
55
+ draft_content: z.string().nullable().optional()
56
56
  .describe('Generated draft reply if the action includes drafting'),
57
57
  });
58
58
 
@@ -689,8 +689,8 @@ export class EmailProcessorService {
689
689
  for (const action of analysis.actions_to_execute) {
690
690
  if (action === 'none') continue;
691
691
 
692
- // Use AI-generated draft content if available
693
- const draftContent = action === 'draft' ? analysis.draft_content : undefined;
692
+ // Use AI-generated draft content if available (handle null from AI)
693
+ const draftContent = action === 'draft' ? (analysis.draft_content || undefined) : undefined;
694
694
 
695
695
  await this.executeAction(
696
696
  account,
@@ -43,7 +43,7 @@ export const ContextAwareAnalysisSchema = z.object({
43
43
  actions_to_execute: z.array(z.enum(['none', 'delete', 'archive', 'draft', 'read', 'star']))
44
44
  .describe('Actions to execute based on the matched rule'),
45
45
  // Intent-aware draft content (if draft action is included)
46
- draft_content: z.string().optional()
46
+ draft_content: z.string().nullable().optional()
47
47
  .describe('Generated draft reply if the action includes drafting'),
48
48
  });
49
49
  export class IntelligenceService {
@@ -572,8 +572,8 @@ export class EmailProcessorService {
572
572
  for (const action of analysis.actions_to_execute) {
573
573
  if (action === 'none')
574
574
  continue;
575
- // Use AI-generated draft content if available
576
- const draftContent = action === 'draft' ? analysis.draft_content : undefined;
575
+ // Use AI-generated draft content if available (handle null from AI)
576
+ const draftContent = action === 'draft' ? (analysis.draft_content || undefined) : undefined;
577
577
  await this.executeAction(account, email, action, draftContent, eventLogger, `Rule: ${matchedRule?.name || analysis.matched_rule.rule_name}`, matchedRule?.attachments);
578
578
  }
579
579
  }