Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"type": "module",
"cloudflare": {
"label": "Agentic Inbox",
"products": ["Workers", "Durable Objects", "R2", "Workers AI"],
"products": [
"Workers",
"Durable Objects",
"R2",
"Workers AI"
],
"bindings": {
"DOMAINS": {
"description": "Your domain with [Email Routing](https://developers.cloudflare.com/email-routing/) enabled (e.g. `example.com`). For multiple domains, pass a comma-separated list (e.g. `example.com,another.com`). After deploying, create a catch-all Email Routing rule pointing to this Worker for each domain."
Expand Down Expand Up @@ -50,13 +55,10 @@
"react-router": "^7.18.0",
"remark-gfm": "^4.0.1",
"workers-ai-provider": "^3.2.0",
"zod": "^3.25.76",
"zod": "^4.4.3",
"zustand": "^5.0.14"
},
"overrides": {
"@cloudflare/kumo": {
"zod": "$zod"
},
"@tiptap/core": "3.27.0",
"@tiptap/pm": "3.27.0",
"@tiptap/extensions": "3.27.0",
Expand Down
4 changes: 2 additions & 2 deletions workers/agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function createEmailTools(env: Env, mailboxId: string) {
description:
"Draft a new email (not a reply) and save it to the Drafts folder. This does NOT send — it saves a draft for the operator to review. Use this for composing new outbound emails. Write the body as plain text — no HTML tags.",
parameters: z.object({
to: z.string().email().describe("Recipient email address"),
to: z.email().describe("Recipient email address"),
subject: z
.string()
.describe("Subject line"),
Expand All @@ -207,7 +207,7 @@ function createEmailTools(env: Env, mailboxId: string) {
originalEmailId: z
.string()
.describe("The ID of the email being replied to"),
to: z.string().email().describe("Recipient email address"),
to: z.email().describe("Recipient email address"),
subject: z
.string()
.describe("Subject line (usually 'Re: ...')"),
Expand Down
2 changes: 1 addition & 1 deletion workers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type AppContext = Context<MailboxContext>;
// -- Request body schemas (kept for validation) ---------------------

const CreateMailboxBody = z.object({
email: z.string().email(),
email: z.email(),
name: z.string().min(1),
settings: z.record(z.any()).optional(), // unvalidated — agentSystemPrompt goes straight to AI
});
Expand Down
8 changes: 4 additions & 4 deletions workers/lib/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export interface AttachmentInfo {
// ── Zod Schemas ────────────────────────────────────────────────────

const RecipientFieldSchema = z.union([
z.string().email(),
z.array(z.string().email()).min(1),
z.email(),
z.array(z.email()).min(1),
]);

export const ErrorResponseSchema = z.object({
Expand All @@ -64,8 +64,8 @@ export const SendEmailRequestSchema = z
cc: RecipientFieldSchema.optional(),
bcc: RecipientFieldSchema.optional(),
from: z.union([
z.string().email(),
z.object({ email: z.string().email(), name: z.string() }),
z.email(),
z.object({ email: z.email(), name: z.string() }),
]),
subject: z.string(),
html: z.string().optional(),
Expand Down
6 changes: 3 additions & 3 deletions workers/mcp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class EmailMCP extends McpAgent<Env> {
originalEmailId: z
.string()
.describe("The ID of the email being replied to"),
to: z.string().email().describe("Recipient email address"),
to: z.email().describe("Recipient email address"),
subject: z.string().describe("Subject line (usually 'Re: ...')"),
bodyHtml: z
.string()
Expand Down Expand Up @@ -319,7 +319,7 @@ export class EmailMCP extends McpAgent<Env> {
originalEmailId: z
.string()
.describe("The ID of the email being replied to"),
to: z.string().email().describe("Recipient email address"),
to: z.email().describe("Recipient email address"),
subject: z.string().describe("Subject line"),
bodyHtml: z.string().describe("The HTML body of the reply"),
},
Expand Down Expand Up @@ -358,7 +358,7 @@ export class EmailMCP extends McpAgent<Env> {
"Send a new email (not a reply). Only call after getting confirmation.",
{
mailboxId: z.string().describe("The mailbox email address to send from"),
to: z.string().email().describe("Recipient email address"),
to: z.email().describe("Recipient email address"),
subject: z.string().describe("Subject line"),
bodyHtml: z.string().describe("The HTML body of the email"),
},
Expand Down