add email improvements

This commit is contained in:
Arjun 2026-07-14 10:02:22 +05:30
parent 30def374af
commit b2158f320f
23 changed files with 1117 additions and 684 deletions

View file

@ -145,6 +145,10 @@ export const GmailThreadSchema = EmailBlockSchema.extend({
threadUrl: z.string().url(),
unread: z.boolean().optional(),
importance: z.enum(['important', 'other']).optional(),
// What kind of email this is (correspondence, meeting, notification,
// newsletter, promotion, cold_outreach, receipt). Loose string so the
// classifier's taxonomy can evolve without a lockstep schema change.
category: z.string().optional(),
gmail_draft: z.string().optional(),
// Gmail-side draft id, present on entries returned by the Drafts list so the
// composer can update/delete that exact draft.

View file

@ -167,16 +167,21 @@ const ipcSchemas = {
res: z.object({
threads: z.array(GmailThreadSchema),
nextCursor: z.string().nullable(),
categoryCounts: z.record(z.string(), z.number()).optional(),
}),
},
'gmail:getEverythingElse': {
req: z.object({
cursor: z.string().optional(),
limit: z.number().int().min(1).max(100).optional(),
// Restrict to one category (filter pills). Whole-section categoryCounts
// are returned regardless, so the pills stay populated while filtered.
category: z.string().optional(),
}),
res: z.object({
threads: z.array(GmailThreadSchema),
nextCursor: z.string().nullable(),
categoryCounts: z.record(z.string(), z.number()).optional(),
}),
},
'gmail:triggerSync': {
@ -294,6 +299,28 @@ const ipcSchemas = {
error: z.string().optional(),
}),
},
// User explicitly picks a thread's category. Sticky on the thread
// (re-classification never overrides) and recorded as a correction the
// classifier learns from. Never affects the knowledge-graph verdict.
'gmail:setCategory': {
req: z.object({
threadId: z.string().min(1),
category: z.enum(['correspondence', 'meeting', 'notification', 'newsletter', 'promotion', 'cold_outreach', 'receipt']),
}),
res: z.object({
ok: z.boolean(),
error: z.string().optional(),
}),
},
// Archive every "Everything else" thread of one category in a single sweep.
'gmail:archiveCategory': {
req: z.object({ category: z.string().min(1) }),
res: z.object({
archived: z.number(),
failed: z.number(),
error: z.string().optional(),
}),
},
'gmail:archiveThread': {
req: z.object({ threadId: z.string().min(1) }),
res: z.object({ ok: z.boolean(), error: z.string().optional() }),