@open-workspace/email 0.4.0 → 0.4.2
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.
- package/drizzle/mailbox/0002_good_komodo.sql +2 -0
- package/drizzle/mailbox/meta/0002_snapshot.json +1017 -0
- package/drizzle/mailbox/meta/_journal.json +7 -0
- package/drizzle/mailbox/migrations.js +3 -1
- package/migrations/0001_overrated_ricochet.sql +2 -0
- package/migrations/meta/0001_snapshot.json +564 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/src/mail/conversation-view.tsx +6 -1
- package/src/mail/reader-pane.tsx +1 -0
- package/src/mail/sanitize-email-html.ts +4 -1
- package/src/mail/sender-actions.tsx +11 -3
- package/worker/db/schema.ts +13 -1
- package/worker/mail/push-notifications.ts +63 -10
- package/worker/mail/quote-parser.ts +92 -22
- package/worker/mail/r2-presigned-urls.ts +7 -0
- package/worker/mail/safety-routes.ts +7 -1
- package/worker/mail/uploads.ts +1 -0
- package/worker/mailbox/email-index.ts +49 -0
- package/worker/mailbox/index.ts +445 -45
- package/worker/mailbox/schema.ts +11 -0
- package/worker/mcp/mail-compose-tools.ts +1 -1
- package/worker/mcp/mail-safety-tools.ts +1 -1
- package/worker/module.ts +2 -0
package/worker/mailbox/schema.ts
CHANGED
|
@@ -64,6 +64,12 @@ export const pendingInbound = sqliteTable(
|
|
|
64
64
|
receivedAt: integer("received_at", { mode: "timestamp_ms" }).notNull(),
|
|
65
65
|
attempts: integer("attempts").notNull().default(0),
|
|
66
66
|
aiAttempts: integer("ai_attempts").notNull().default(0),
|
|
67
|
+
/**
|
|
68
|
+
* Attempts that ended without an outcome: counted before parsing and
|
|
69
|
+
* given back when the attempt stores the message or records a failure,
|
|
70
|
+
* so only attempts whose alarm was killed (CPU, memory) remain.
|
|
71
|
+
*/
|
|
72
|
+
unfinishedAttempts: integer("unfinished_attempts").notNull().default(0),
|
|
67
73
|
nextAttemptAt: integer("next_attempt_at", {
|
|
68
74
|
mode: "timestamp_ms",
|
|
69
75
|
}).notNull(),
|
|
@@ -186,6 +192,11 @@ export const emails = sqliteTable(
|
|
|
186
192
|
}).$type<EmailScreening>(),
|
|
187
193
|
/** Set to "spam" when someone in this mailbox reported the message; only its presence is read. */
|
|
188
194
|
reportLabel: text("report_label", { enum: ["spam"] }),
|
|
195
|
+
/**
|
|
196
|
+
* The conversation this spam message named but was kept out of (#25).
|
|
197
|
+
* It rejoins that conversation when it leaves Spam; cleared then.
|
|
198
|
+
*/
|
|
199
|
+
splitFromConversationId: text("split_from_conversation_id"),
|
|
189
200
|
attachmentsJson: text("attachments_json", { mode: "json" })
|
|
190
201
|
.$type<StoredAttachment[]>()
|
|
191
202
|
.notNull()
|
|
@@ -72,7 +72,7 @@ export function registerMailComposeTools(
|
|
|
72
72
|
{
|
|
73
73
|
title: "Create attachment upload",
|
|
74
74
|
description:
|
|
75
|
-
"Create a 15-minute presigned R2 PUT URL.
|
|
75
|
+
"Create a 15-minute presigned R2 PUT URL. PUT exactly the declared size to upload.uploadUrl with upload.headers and a Content-Length header (the URL signs it; a chunked body without a length is refused with 403), then call complete_attachment_upload with upload.id.",
|
|
76
76
|
inputSchema: z.object({
|
|
77
77
|
mailboxId: mailboxIdSchema,
|
|
78
78
|
filename: z.string().trim().min(1).max(255),
|
|
@@ -370,7 +370,7 @@ export function registerMailSafetyTools(
|
|
|
370
370
|
{
|
|
371
371
|
title: "Mark message not spam",
|
|
372
372
|
description:
|
|
373
|
-
"Move an incoming message's conversation from Spam back to Inbox, clear its spam label, record the feedback, and mark the sender as trusted in this mailbox.",
|
|
373
|
+
"Move an incoming message's conversation from Spam back to Inbox, clear its spam label, record the feedback, and mark the sender as trusted in this mailbox. A reply that was kept out of its conversation as spam rejoins it (rejoined: true), conversationId names the conversation it is in now, and folder the folder that conversation is in (inbox, archive or a custom folder id).",
|
|
374
374
|
inputSchema: messageInputSchema,
|
|
375
375
|
annotations: write,
|
|
376
376
|
},
|
package/worker/module.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { deleteMailboxStorage } from "./mail/mailbox-deletion";
|
|
|
20
20
|
import { consumeOfficePreviews } from "./mail/office-preview-queue";
|
|
21
21
|
import {
|
|
22
22
|
consumePushNotifications,
|
|
23
|
+
deleteSessionPushSubscriptions,
|
|
23
24
|
deleteUserPushSubscriptions,
|
|
24
25
|
pushNotificationRoutes,
|
|
25
26
|
} from "./mail/push-notifications";
|
|
@@ -79,6 +80,7 @@ export function email(): WorkspaceModule {
|
|
|
79
80
|
webhookSources: { [EMAIL_WEBHOOK_SOURCE]: emailWebhookData },
|
|
80
81
|
hooks: {
|
|
81
82
|
mailboxDeleted: deleteMailboxStorage,
|
|
83
|
+
sessionRevoked: deleteSessionPushSubscriptions,
|
|
82
84
|
sessionsRevoked: deleteUserPushSubscriptions,
|
|
83
85
|
seedDemo: (env) => seedEmailDemo(env),
|
|
84
86
|
},
|