diff --git a/apps/server/src/lib/email-verification.ts b/apps/server/src/lib/email-verification.ts index d98ff6e0b6..1528d44bd2 100644 --- a/apps/server/src/lib/email-verification.ts +++ b/apps/server/src/lib/email-verification.ts @@ -148,7 +148,7 @@ async function validateSPF(domain: string, ip: string): Promise { if (await checkMechanism(includeMech, includeDomain)) return true; } } - } catch (e) { + } catch { // Include domain lookup failed } } @@ -161,7 +161,7 @@ async function validateSPF(domain: string, ip: string): Promise { } return false; - } catch (error) { + } catch { return false; } } @@ -216,7 +216,7 @@ async function validateDKIM(rawEmail: string): Promise { const pemKey = `-----BEGIN PUBLIC KEY-----\n${pubKey}\n-----END PUBLIC KEY-----`; return verifier.verify(pemKey, signature, 'base64'); - } catch (error) { + } catch { return false; } } @@ -235,7 +235,7 @@ async function validateDMARC(domain: string): Promise { // Require strict policy (quarantine or reject) return policy === 'quarantine' || policy === 'reject'; - } catch (error) { + } catch { return false; } } @@ -432,7 +432,7 @@ async function getBIMILogo(domain: string): Promise { return undefined; - } catch (error) { + } catch { return undefined; } } @@ -454,18 +454,10 @@ export async function verify(rawEmail: string): Promise<{isVerified: boolean; lo // Run validations in parallel const [spfValid, dkimValid, dmarcValid, bimiValid] = await Promise.all([ - senderIP ? validateSPF(domain, senderIP).catch(error => { - return false; - }) : Promise.resolve(false), - validateDKIM(rawEmail).catch(error => { - return false; - }), - validateDMARC(domain).catch(error => { - return false; - }), - validateBIMI(domain).catch(error => { - return false; - }), + senderIP ? validateSPF(domain, senderIP).catch(() => false) : Promise.resolve(false), + validateDKIM(rawEmail).catch(() => false), + validateDMARC(domain).catch(() => false), + validateBIMI(domain).catch(() => false), ]); const authValid = dkimValid || spfValid || dmarcValid; @@ -488,4 +480,4 @@ export async function verify(rawEmail: string): Promise<{isVerified: boolean; lo console.error('Email verification error:', error); return { isVerified: false }; } -} \ No newline at end of file +} diff --git a/apps/server/src/routes/chat.ts b/apps/server/src/routes/chat.ts index 73741fe8f2..e9105a6192 100644 --- a/apps/server/src/routes/chat.ts +++ b/apps/server/src/routes/chat.ts @@ -12,14 +12,13 @@ import { GmailSearchAssistantSystemPrompt, AiChatPrompt, } from '../lib/prompts'; -import { type Connection, type ConnectionContext, type WSMessage } from 'agents'; +import { type Connection, type WSMessage } from 'agents'; import { EPrompts, type IOutgoingMessage, type ParsedMessage } from '../types'; import type { IGetThreadResponse, MailManager } from '../lib/driver/types'; import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; -import { createSimpleAuth, type SimpleAuth } from '../lib/auth'; import { connectionToDriver } from '../lib/server-utils'; import type { CreateDraftData } from '../lib/schemas'; -import { FOLDERS, parseHeaders } from '../lib/utils'; +import { FOLDERS } from '../lib/utils'; import { env, RpcTarget } from 'cloudflare:workers'; import { AIChatAgent } from 'agents/ai-chat-agent'; import { tools as authTools } from './agent/tools'; @@ -31,25 +30,11 @@ import { getPrompt } from '../lib/brain'; import { openai } from '@ai-sdk/openai'; import { and, eq } from 'drizzle-orm'; import { McpAgent } from 'agents/mcp'; -import { groq } from '@ai-sdk/groq'; import { createDb } from '../db'; import { z } from 'zod'; const decoder = new TextDecoder(); -interface ThreadRow { - id: string; - thread_id: string; - provider_id: string; - messages: string; - latest_sender: string; - latest_received_on: string; - latest_subject: string; - latest_label_ids: string; - created_at: string; - updated_at: string; -} - export enum IncomingMessageType { UseChatRequest = 'cf_agent_use_chat_request', ChatClear = 'cf_agent_chat_clear', @@ -341,7 +326,7 @@ export class ZeroAgent extends AIChatAgent { private getDataStreamResponse( onFinish: StreamTextOnFinishCallback<{}>, - options?: { + _options?: { abortSignal: AbortSignal | undefined; }, ) { @@ -443,7 +428,7 @@ export class ZeroAgent extends AIChatAgent { let data: IncomingMessage; try { data = JSON.parse(message) as IncomingMessage; - } catch (error) { + } catch { // silently ignore invalid messages for now // TODO: log errors with log levels return; @@ -919,11 +904,8 @@ export class ZeroAgent extends AIChatAgent { let totalSynced = 0; let pageToken: string | null = null; let hasMore = true; - let pageCount = 0; while (hasMore) { - pageCount++; - const result = await this.driver.list({ folder, maxResults: maxCount, @@ -960,7 +942,7 @@ export class ZeroAgent extends AIChatAgent { max?: number; cursor?: string; }) { - const { labelIds = [], folder, q, max = 50, cursor } = params; + const { labelIds = [], folder, max = 50, cursor } = params; try { // Build WHERE conditions @@ -1511,7 +1493,7 @@ export class ZeroMCP extends McpAgent { }, ], }; - } catch (e) { + } catch { return { content: [ { @@ -1543,7 +1525,7 @@ export class ZeroMCP extends McpAgent { }, ], }; - } catch (e) { + } catch { return { content: [ { @@ -1575,7 +1557,7 @@ export class ZeroMCP extends McpAgent { }, ], }; - } catch (e) { + } catch { return { content: [ { diff --git a/docker-compose.db.yaml b/docker-compose.db.yaml index 4fa7c80fd5..c16fb8a86b 100644 --- a/docker-compose.db.yaml +++ b/docker-compose.db.yaml @@ -15,7 +15,7 @@ services: valkey: container_name: zerodotemail-redis - image: docker.io/bitnami/valkey:8.0 + image: bitnami/valkey:latest environment: - ALLOW_EMPTY_PASSWORD=yes - VALKEY_DISABLE_COMMANDS=FLUSHDB,FLUSHALL @@ -36,4 +36,4 @@ services: volumes: valkey-data: - postgres-data: + postgres-data: \ No newline at end of file