diff --git a/packages/authenticated-user-storage/CHANGELOG.md b/packages/authenticated-user-storage/CHANGELOG.md index a1081ed800..d15146428b 100644 --- a/packages/authenticated-user-storage/CHANGELOG.md +++ b/packages/authenticated-user-storage/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `getAssetsWatchlist` returns the assets-watchlist blob or `null` on 404, mirroring `getNotificationPreferences`. - `setAssetsWatchlist` writes the full blob and enforces a maximum of `ASSETS_WATCHLIST_MAX_ASSETS` (100) assets before sending the request, via a superstruct `size` constraint on the write-side schema. +### Changed + +- **BREAKING:** Add required `agenticCli` field to `NotificationPreferences`, along with the `AgenticCliPreference` type and `NotificationPreferencesSchema` validation for Agentic CLI notification preferences ([#8933](https://github.com/MetaMask/core/pull/8933)) + ## [2.0.0] ### Changed diff --git a/packages/authenticated-user-storage/src/index.ts b/packages/authenticated-user-storage/src/index.ts index 74bc6d2624..ab8d341fe7 100644 --- a/packages/authenticated-user-storage/src/index.ts +++ b/packages/authenticated-user-storage/src/index.ts @@ -35,6 +35,7 @@ export type { PerpsWatchlistMarkets, PerpsPreference, SocialAIPreference, + AgenticCliPreference, NotificationPreferences, AssetsWatchlistBlob, ClientType, diff --git a/packages/authenticated-user-storage/src/types.ts b/packages/authenticated-user-storage/src/types.ts index b57c7e6aaa..b200da6b79 100644 --- a/packages/authenticated-user-storage/src/types.ts +++ b/packages/authenticated-user-storage/src/types.ts @@ -69,6 +69,11 @@ export type WalletActivityAccount = { enabled: boolean; }; +export type AgenticCliPreference = { + inAppNotificationsEnabled: boolean; + pushNotificationsEnabled: boolean; +}; + export type WalletActivityPreference = { inAppNotificationsEnabled: boolean; pushNotificationsEnabled: boolean; @@ -109,6 +114,7 @@ export type NotificationPreferences = { marketing: MarketingPreference; perps: PerpsPreference; socialAI: SocialAIPreference; + agenticCli: AgenticCliPreference; }; // --------------------------------------------------------------------------- diff --git a/packages/authenticated-user-storage/src/validators.ts b/packages/authenticated-user-storage/src/validators.ts index 0a9b406b9d..c3177792b1 100644 --- a/packages/authenticated-user-storage/src/validators.ts +++ b/packages/authenticated-user-storage/src/validators.ts @@ -91,11 +91,17 @@ const SocialAIPreferenceSchema = type({ mutedTraderProfileIds: array(string()), }); +const AgenticCliPreferenceSchema = type({ + inAppNotificationsEnabled: boolean(), + pushNotificationsEnabled: boolean(), +}); + const NotificationPreferencesSchema = type({ walletActivity: WalletActivityPreferenceSchema, marketing: MarketingPreferenceSchema, perps: PerpsPreferenceSchema, socialAI: SocialAIPreferenceSchema, + agenticCli: AgenticCliPreferenceSchema, }); /** diff --git a/packages/authenticated-user-storage/tests/mocks/authenticated-userstorage.ts b/packages/authenticated-user-storage/tests/mocks/authenticated-userstorage.ts index 871f5f5149..f819720d00 100644 --- a/packages/authenticated-user-storage/tests/mocks/authenticated-userstorage.ts +++ b/packages/authenticated-user-storage/tests/mocks/authenticated-userstorage.ts @@ -68,6 +68,10 @@ export const MOCK_NOTIFICATION_PREFERENCES: NotificationPreferences = { 'e8f2a1b3-5c4d-4e6f-8a9b-2c3d4e5f6a7b', ], }, + agenticCli: { + inAppNotificationsEnabled: true, + pushNotificationsEnabled: false, + }, }; export const MOCK_ASSETS_WATCHLIST_BLOB: AssetsWatchlistBlob = { diff --git a/packages/notification-services-controller/CHANGELOG.md b/packages/notification-services-controller/CHANGELOG.md index 5aa4c3f76c..3d77bdb3f5 100644 --- a/packages/notification-services-controller/CHANGELOG.md +++ b/packages/notification-services-controller/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add `DEFAULT_AGENTIC_CLI_PREFERENCES` and initialize `agenticCli` when building fresh notification preferences via `NotificationServicesController` ([#8933](https://github.com/MetaMask/core/pull/8933)) + ## [24.1.2] ### Changed diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts index 52514d76ce..47bc570282 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts @@ -44,6 +44,7 @@ import { } from './mocks/mock-feature-announcements'; import { createMockNotificationEthSent } from './mocks/mock-raw-notifications'; import { + DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PERPS_PREFERENCES, DEFAULT_SOCIAL_AI_PREFERENCES, NotificationServicesController, @@ -105,6 +106,10 @@ const prefsFromAddresses = ( pushNotificationsEnabled: true, mutedTraderProfileIds: [], }, + agenticCli: { + inAppNotificationsEnabled: true, + pushNotificationsEnabled: true, + }, }); const prefsFromAddressesWithMarketingInAppNotifications = ( @@ -565,6 +570,7 @@ describe('NotificationServicesController', () => { }, perps: { ...DEFAULT_PERPS_PREFERENCES }, socialAI: { ...DEFAULT_SOCIAL_AI_PREFERENCES }, + agenticCli: { ...DEFAULT_AGENTIC_CLI_PREFERENCES }, }); expect(mockEnablePushNotifications).toHaveBeenCalledWith([ ADDRESS_1.toLowerCase(), diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts index bbc558c4f3..ba6f7826b9 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts @@ -1,4 +1,5 @@ import type { + AgenticCliPreference, AuthenticatedUserStorageServiceGetNotificationPreferencesAction, AuthenticatedUserStorageServicePutNotificationPreferencesAction, NotificationPreferences, @@ -244,6 +245,15 @@ export const DEFAULT_SOCIAL_AI_PREFERENCES: Required = { mutedTraderProfileIds: [], }; +/** + * Hardcoded default Agentic CLI notification preferences. Applied when + * notification preferences are initialized for the first time. + */ +export const DEFAULT_AGENTIC_CLI_PREFERENCES: AgenticCliPreference = { + inAppNotificationsEnabled: true, + pushNotificationsEnabled: true, +}; + /** * Builds wallet-activity preferences from the keyring's current accounts. * @@ -325,6 +335,7 @@ const buildFreshPreferences = ( }, perps: { ...DEFAULT_PERPS_PREFERENCES }, socialAI: { ...DEFAULT_SOCIAL_AI_PREFERENCES }, + agenticCli: { ...DEFAULT_AGENTIC_CLI_PREFERENCES }, }); const MESSENGER_EXPOSED_METHODS = [ diff --git a/packages/notification-services-controller/src/index.ts b/packages/notification-services-controller/src/index.ts index f2985ab0fb..572012cb6b 100644 --- a/packages/notification-services-controller/src/index.ts +++ b/packages/notification-services-controller/src/index.ts @@ -1,6 +1,7 @@ export * as NotificationServicesController from './NotificationServicesController'; export * as NotificationServicesPushController from './NotificationServicesPushController'; export { + DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PERPS_PREFERENCES, DEFAULT_SOCIAL_AI_PREFERENCES, } from './NotificationServicesController';