mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-15 20:05:16 +02:00
feat: add user-configurable notification settings (#601)
This commit is contained in:
parent
faaefe936f
commit
0d21abcc7d
12 changed files with 330 additions and 5 deletions
|
|
@ -17,4 +17,5 @@ export * as frontmatter from './frontmatter.js';
|
|||
export * as bases from './bases.js';
|
||||
export * as browserControl from './browser-control.js';
|
||||
export * as billing from './billing.js';
|
||||
export * as notificationSettings from './notification-settings.js';
|
||||
export { PrefixLogger };
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { BrowserStateSchema } from './browser-control.js';
|
|||
import { BillingInfoSchema } from './billing.js';
|
||||
import { EmailBlockSchema, GmailThreadSchema } from './blocks.js';
|
||||
import { PermissionDecision, ApprovalPolicy } from './code-mode.js';
|
||||
import { NotificationSettingsSchema } from './notification-settings.js';
|
||||
|
||||
// ============================================================================
|
||||
// Runtime Validation Schemas (Single Source of Truth)
|
||||
|
|
@ -1028,6 +1029,17 @@ const ipcSchemas = {
|
|||
req: z.null(),
|
||||
res: BillingInfoSchema,
|
||||
},
|
||||
// Notification settings channels
|
||||
'notifications:getSettings': {
|
||||
req: z.null(),
|
||||
res: NotificationSettingsSchema,
|
||||
},
|
||||
'notifications:setSettings': {
|
||||
req: NotificationSettingsSchema,
|
||||
res: z.object({
|
||||
success: z.literal(true),
|
||||
}),
|
||||
},
|
||||
} as const;
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
36
apps/x/packages/shared/src/notification-settings.ts
Normal file
36
apps/x/packages/shared/src/notification-settings.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* Notification categories the user can independently toggle.
|
||||
*
|
||||
* - chat_completion: an agent finished generating a response
|
||||
* - new_email: a new email arrived during incremental Gmail sync
|
||||
* - agent_permission: an agent is requesting permission to run a tool
|
||||
*/
|
||||
export const NotificationCategorySchema = z.enum([
|
||||
'chat_completion',
|
||||
'new_email',
|
||||
'agent_permission',
|
||||
]);
|
||||
|
||||
export const NotificationCategoriesSchema = z.object({
|
||||
chat_completion: z.boolean(),
|
||||
new_email: z.boolean(),
|
||||
agent_permission: z.boolean(),
|
||||
});
|
||||
|
||||
export const NotificationSettingsSchema = z.object({
|
||||
categories: NotificationCategoriesSchema,
|
||||
});
|
||||
|
||||
export const DEFAULT_NOTIFICATION_SETTINGS: NotificationSettings = {
|
||||
categories: {
|
||||
chat_completion: true,
|
||||
new_email: true,
|
||||
agent_permission: true,
|
||||
},
|
||||
};
|
||||
|
||||
export type NotificationCategory = z.infer<typeof NotificationCategorySchema>;
|
||||
export type NotificationCategories = z.infer<typeof NotificationCategoriesSchema>;
|
||||
export type NotificationSettings = z.infer<typeof NotificationSettingsSchema>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue