@genesislcap/ai-assistant 15.77.0 → 15.78.0

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.
Files changed (74) hide show
  1. package/dist/ai-assistant.api.json +753 -24
  2. package/dist/ai-assistant.d.ts +273 -3
  3. package/dist/chat-driver.cjs +28 -1
  4. package/dist/chat-driver.cjs.map +2 -2
  5. package/dist/chat-driver.mjs +28 -1
  6. package/dist/chat-driver.mjs.map +2 -2
  7. package/dist/custom-elements.json +636 -2
  8. package/dist/dts/autopilot/autopilot-driver.d.ts +28 -0
  9. package/dist/dts/autopilot/autopilot-driver.d.ts.map +1 -1
  10. package/dist/dts/channel/ai-activity-channel.d.ts +20 -2
  11. package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
  12. package/dist/dts/components/chat-bubble/chat-bubble.d.ts +2 -0
  13. package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -1
  14. package/dist/dts/components/chat-driver/interaction-controller.d.ts.map +1 -1
  15. package/dist/dts/components/notification-level/index.d.ts +2 -0
  16. package/dist/dts/components/notification-level/index.d.ts.map +1 -0
  17. package/dist/dts/components/notification-level/notification-level.d.ts +51 -0
  18. package/dist/dts/components/notification-level/notification-level.d.ts.map +1 -0
  19. package/dist/dts/components/notification-level/notification-level.styles.d.ts +3 -0
  20. package/dist/dts/components/notification-level/notification-level.styles.d.ts.map +1 -0
  21. package/dist/dts/components/notification-level/notification-level.template.d.ts +5 -0
  22. package/dist/dts/components/notification-level/notification-level.template.d.ts.map +1 -0
  23. package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
  24. package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
  25. package/dist/dts/index.d.ts +2 -0
  26. package/dist/dts/index.d.ts.map +1 -1
  27. package/dist/dts/main/main.d.ts +56 -1
  28. package/dist/dts/main/main.d.ts.map +1 -1
  29. package/dist/dts/notifications/agent-notifications.d.ts +139 -0
  30. package/dist/dts/notifications/agent-notifications.d.ts.map +1 -0
  31. package/dist/dts/notifications/agent-notifier.d.ts +58 -0
  32. package/dist/dts/notifications/agent-notifier.d.ts.map +1 -0
  33. package/dist/dts/notifications/index.d.ts +2 -0
  34. package/dist/dts/notifications/index.d.ts.map +1 -0
  35. package/dist/dts/notifications/notification-level-picker.template.d.ts +31 -0
  36. package/dist/dts/notifications/notification-level-picker.template.d.ts.map +1 -0
  37. package/dist/dts/notifications/notification-settings.d.ts +42 -0
  38. package/dist/dts/notifications/notification-settings.d.ts.map +1 -0
  39. package/dist/dts/react.d.ts +10 -0
  40. package/dist/dts/state/ai-assistant-slice.d.ts +8 -0
  41. package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
  42. package/dist/dts/state/interaction-context.d.ts +13 -0
  43. package/dist/dts/state/interaction-context.d.ts.map +1 -1
  44. package/dist/dts/state/persistence/session-persistence-provider.d.ts +5 -0
  45. package/dist/dts/state/persistence/session-persistence-provider.d.ts.map +1 -1
  46. package/dist/dts/state/session-store.d.ts +1 -0
  47. package/dist/dts/state/session-store.d.ts.map +1 -1
  48. package/dist/dts/types/interaction-context.d.ts +23 -0
  49. package/dist/dts/types/interaction-context.d.ts.map +1 -1
  50. package/dist/dts/utils/resolve-preference-baseline.d.ts +3 -0
  51. package/dist/dts/utils/resolve-preference-baseline.d.ts.map +1 -1
  52. package/dist/esm/autopilot/autopilot-driver.js +66 -3
  53. package/dist/esm/components/chat-bubble/chat-bubble.js +17 -3
  54. package/dist/esm/components/chat-driver/interaction-controller.js +5 -0
  55. package/dist/esm/components/notification-level/index.js +1 -0
  56. package/dist/esm/components/notification-level/notification-level.js +124 -0
  57. package/dist/esm/components/notification-level/notification-level.styles.js +20 -0
  58. package/dist/esm/components/notification-level/notification-level.template.js +11 -0
  59. package/dist/esm/components/settings-modal/settings-modal.styles.js +6 -0
  60. package/dist/esm/components/settings-modal/settings-modal.template.js +10 -1
  61. package/dist/esm/index.js +2 -0
  62. package/dist/esm/main/main.js +159 -12
  63. package/dist/esm/notifications/agent-notifications.js +172 -0
  64. package/dist/esm/notifications/agent-notifier.js +86 -0
  65. package/dist/esm/notifications/index.js +1 -0
  66. package/dist/esm/notifications/notification-level-picker.template.js +49 -0
  67. package/dist/esm/notifications/notification-settings.js +42 -0
  68. package/dist/esm/state/ai-assistant-slice.js +5 -0
  69. package/dist/esm/state/interaction-context.js +27 -0
  70. package/dist/esm/utils/resolve-preference-baseline.js +9 -0
  71. package/dist/react.cjs +7 -0
  72. package/dist/react.mjs +6 -0
  73. package/docs/notifications.md +169 -0
  74. package/package.json +17 -17
@@ -0,0 +1,172 @@
1
+ import { __awaiter } from "tslib";
2
+ /**
3
+ * The notification's text when neither the app nor the widget gives one.
4
+ *
5
+ * @beta
6
+ */
7
+ export const DEFAULT_AGENT_NOTIFICATION_MESSAGE = 'The assistant is ready for your next input';
8
+ /**
9
+ * Every valid level, for narrowing untrusted input. Keyed by the union, so adding a level is a
10
+ * compile error here rather than a value silently rejected at runtime.
11
+ */
12
+ const LEVELS = {
13
+ off: true,
14
+ autopilot: true,
15
+ 'needs-input': true,
16
+ };
17
+ /**
18
+ * Narrow an untrusted value (a stored preference, a plain-JS app) to a level, or `undefined`.
19
+ * `hasOwnProperty`, not `in`, so `'constructor'` and friends are rejected.
20
+ *
21
+ * @internal
22
+ */
23
+ export const asAgentNotificationLevel = (value) => typeof value === 'string' && Object.prototype.hasOwnProperty.call(LEVELS, value)
24
+ ? value
25
+ : undefined;
26
+ /**
27
+ * Whether the app offers notifications at all (`chatConfig.ui.notifications.enabled`).
28
+ *
29
+ * @internal
30
+ */
31
+ export const notificationsOffered = (config) => (config === null || config === void 0 ? void 0 : config.enabled) !== false;
32
+ /**
33
+ * Whether `level` is one the app offers: anything when notifications are offered, except
34
+ * `'autopilot'` without the `autopilot` option.
35
+ *
36
+ * @internal
37
+ */
38
+ export const levelOffered = (level, config) => notificationsOffered(config) && (level !== 'autopilot' || (config === null || config === void 0 ? void 0 : config.autopilot) === true);
39
+ /**
40
+ * The level that applies, given the stored one and what the app offers. A stored level the app
41
+ * no longer offers counts as `'off'`; the stored value itself is left alone, so offering it again
42
+ * restores the person's choice.
43
+ *
44
+ * @internal
45
+ */
46
+ export const effectiveNotificationLevel = (stored, config) => (levelOffered(stored, config) ? stored : 'off');
47
+ /**
48
+ * Whether a level notifies for a kind of event.
49
+ *
50
+ * @internal
51
+ */
52
+ export const levelAllows = (level, kind) => level === 'needs-input' || (level === 'autopilot' && kind !== 'widget-needs-input');
53
+ /**
54
+ * Whether an event's session is `sessionKey` or one of its sub-agents' sessions.
55
+ *
56
+ * @internal
57
+ */
58
+ export const belongsToSession = (eventSessionKey, sessionKey) => eventSessionKey === sessionKey || eventSessionKey.startsWith(`${sessionKey}::sub:`);
59
+ /**
60
+ * Whether this page may show notifications. Safe to call anywhere, including Node.
61
+ *
62
+ * @beta
63
+ */
64
+ export function agentNotificationPermission() {
65
+ if (typeof Notification === 'undefined')
66
+ return 'unsupported';
67
+ if (typeof window !== 'undefined' && window.isSecureContext === false)
68
+ return 'unsupported';
69
+ return Notification.permission;
70
+ }
71
+ /** Everything watching permission on this page; see `watchAgentNotificationPermission`. */
72
+ const permissionWatchers = new Set();
73
+ const announcePermission = () => {
74
+ const permission = agentNotificationPermission();
75
+ for (const watcher of permissionWatchers)
76
+ watcher(permission);
77
+ };
78
+ /**
79
+ * Ask the person for permission to show notifications, and resolve to the result. Call it from a
80
+ * click or key handler: browsers ignore or refuse a request that does not come from the person.
81
+ * Resolves straight away when permission is already decided or unsupported, since a browser only
82
+ * ever asks once.
83
+ *
84
+ * @beta
85
+ */
86
+ export function requestAgentNotificationPermission() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const current = agentNotificationPermission();
89
+ if (current !== 'default')
90
+ return current;
91
+ try {
92
+ return yield Notification.requestPermission();
93
+ }
94
+ catch (_a) {
95
+ return agentNotificationPermission();
96
+ }
97
+ finally {
98
+ // Every picker and settings row on the page shows the answer, not only the one that asked.
99
+ announcePermission();
100
+ }
101
+ });
102
+ }
103
+ /**
104
+ * Follow this page's notification permission (GENC-1676): `listener` runs whenever it changes —
105
+ * answered here, or changed by the person in the browser's own site settings while the page is
106
+ * open. Returns an unsubscribe. Safe where there is no Permissions API: only answers given here
107
+ * are seen then.
108
+ *
109
+ * @internal
110
+ */
111
+ export function watchAgentNotificationPermission(listener) {
112
+ var _a;
113
+ permissionWatchers.add(listener);
114
+ let status;
115
+ let stopped = false;
116
+ const onChange = () => listener(agentNotificationPermission());
117
+ if (typeof navigator !== 'undefined' && ((_a = navigator.permissions) === null || _a === void 0 ? void 0 : _a.query)) {
118
+ navigator.permissions
119
+ .query({ name: 'notifications' })
120
+ .then((result) => {
121
+ if (stopped)
122
+ return;
123
+ status = result;
124
+ status.addEventListener('change', onChange);
125
+ })
126
+ .catch(() => undefined);
127
+ }
128
+ return () => {
129
+ stopped = true;
130
+ permissionWatchers.delete(listener);
131
+ status === null || status === void 0 ? void 0 : status.removeEventListener('change', onChange);
132
+ };
133
+ }
134
+ /**
135
+ * The hint under a notification level picker when the browser will not show notifications. A
136
+ * block shows even at Off: otherwise picking a level would snap back with no reason given, since
137
+ * a browser that has blocked them never asks again.
138
+ *
139
+ * @internal
140
+ */
141
+ export function notificationPermissionHint(level, permission) {
142
+ if (permission === 'denied') {
143
+ return 'Your browser is blocking notifications for this site. Allow them in its site settings.';
144
+ }
145
+ if (level === 'off')
146
+ return '';
147
+ if (permission === 'default') {
148
+ return "Your browser hasn't allowed notifications yet. Choose Off, then this option again, to be asked.";
149
+ }
150
+ return '';
151
+ }
152
+ /**
153
+ * A person picked a level in a notification picker (GENC-1676). Turning notifications on asks the
154
+ * browser for permission first, and leaves the level alone if they refuse. Call it straight from
155
+ * the click: the request is made before anything is awaited, which the browser requires.
156
+ *
157
+ * Resolves to what happened: `'applied'`; `'refused'`, so the picker can snap back to the level
158
+ * that still applies; or `'same'`, for a picker re-reporting the level it already shows.
159
+ *
160
+ * @internal
161
+ */
162
+ export function chooseAgentNotificationLevel(level, current, apply) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ if (level === current)
165
+ return 'same';
166
+ if (level !== 'off' && (yield requestAgentNotificationPermission()) !== 'granted') {
167
+ return 'refused';
168
+ }
169
+ apply(level);
170
+ return 'applied';
171
+ });
172
+ }
@@ -0,0 +1,86 @@
1
+ import { logger } from '../utils/logger';
2
+ import { agentNotificationPermission, DEFAULT_AGENT_NOTIFICATION_MESSAGE, levelAllows, } from './agent-notifications';
3
+ /**
4
+ * How long a notification with a given tag holds off another with the same tag. Two sources can
5
+ * report one moment — the autopilot declining a widget it may not answer, and that widget asking
6
+ * for attention — and the second should not alert again. It may still improve the text: see
7
+ * `AgentNotifier.notify`.
8
+ */
9
+ const REPEAT_WINDOW_MS = 5000;
10
+ const browserEnv = {
11
+ permission: agentNotificationPermission,
12
+ tabActive: () => typeof document !== 'undefined' &&
13
+ document.visibilityState === 'visible' &&
14
+ document.hasFocus(),
15
+ show(title, options, onClick) {
16
+ const notification = new Notification(title, options);
17
+ notification.onclick = () => {
18
+ window.focus();
19
+ notification.close();
20
+ onClick();
21
+ };
22
+ },
23
+ now: () => Date.now(),
24
+ };
25
+ /**
26
+ * The tag a notification carries. The browser replaces a notification that has the same tag, so
27
+ * windows that share a session never stack copies. Interaction ids are unique, so one interaction
28
+ * gets one notification whichever session reported it (a sub-agent's or its parent's); everything
29
+ * else the autopilot reports shares one per session.
30
+ *
31
+ * @internal
32
+ */
33
+ export const agentNotificationTag = (detail) => detail.interactionId
34
+ ? `ai-assistant:${detail.interactionId}`
35
+ : `ai-assistant:${detail.sessionKey}:autopilot`;
36
+ /**
37
+ * Decides whether an `agent-attention` event becomes a browser notification, and shows it
38
+ * (GENC-1676). One per page, shared by every assistant on it.
39
+ *
40
+ * Shows nothing when the level does not cover the event, when permission is not granted, while
41
+ * the person is looking at the page (the in-page UI covers that), or when the same tag was just
42
+ * shown — unless the repeat brings a widget's own message the first lacked. That one replaces the
43
+ * notification under the same tag, silently: the autopilot reports a widget it declines before
44
+ * the widget's own request is reported, and the widget's words are the better ones.
45
+ *
46
+ * @internal
47
+ */
48
+ export class AgentNotifier {
49
+ constructor(env = browserEnv) {
50
+ this.env = env;
51
+ /** Each tag shown within the repeat window: when, and whether it carried a widget's message. */
52
+ this.shown = new Map();
53
+ }
54
+ /** Show a notification for `detail` if it should be shown. Returns whether it was. */
55
+ notify(detail, context) {
56
+ var _a;
57
+ if (!levelAllows(context.level, detail.kind))
58
+ return false;
59
+ if (this.env.permission() !== 'granted')
60
+ return false;
61
+ if (this.env.tabActive())
62
+ return false;
63
+ const tag = agentNotificationTag(detail);
64
+ const now = this.env.now();
65
+ for (const [key, entry] of this.shown) {
66
+ if (now - entry.at >= REPEAT_WINDOW_MS)
67
+ this.shown.delete(key);
68
+ }
69
+ const previous = this.shown.get(tag);
70
+ // A repeat alerts no one; it only replaces the text, when it brings a message that was missing.
71
+ const replacing = !!previous && !previous.message && !!detail.message;
72
+ if (previous && !replacing)
73
+ return false;
74
+ try {
75
+ this.env.show(context.title, Object.assign({ body: detail.message || context.message || DEFAULT_AGENT_NOTIFICATION_MESSAGE, tag }, (replacing ? { silent: true } : {})), context.onClick);
76
+ }
77
+ catch (e) {
78
+ // Some browsers (Chrome on Android) only allow notifications from a service worker, and
79
+ // throw from the constructor.
80
+ logger.warn('AgentNotifier: could not show a notification', e);
81
+ return false;
82
+ }
83
+ this.shown.set(tag, { at: (_a = previous === null || previous === void 0 ? void 0 : previous.at) !== null && _a !== void 0 ? _a : now, message: !!detail.message });
84
+ return true;
85
+ }
86
+ }
@@ -0,0 +1 @@
1
+ export { agentNotificationPermission, DEFAULT_AGENT_NOTIFICATION_MESSAGE, requestAgentNotificationPermission, } from './agent-notifications';
@@ -0,0 +1,49 @@
1
+ import { html, repeat } from '@genesislcap/web-core';
2
+ import { asAgentNotificationLevel } from './agent-notifications';
3
+ /**
4
+ * The notification levels with the autopilot level offered. Keyed by the level, as the timestamp
5
+ * modes are, so a new level is a compile error here rather than one the picker cannot reach.
6
+ */
7
+ const NOTIFICATION_LEVEL_LABELS = {
8
+ off: 'Off',
9
+ autopilot: 'Autopilot',
10
+ 'needs-input': 'Always',
11
+ };
12
+ const NOTIFICATION_LEVEL_OPTIONS = Object.keys(NOTIFICATION_LEVEL_LABELS).map((value) => ({ value, label: NOTIFICATION_LEVEL_LABELS[value] }));
13
+ /** Without the autopilot level there is nothing between the two, so it reads as a plain on/off. */
14
+ const NOTIFICATION_ON_OFF_OPTIONS = [
15
+ { value: 'off', label: 'Off' },
16
+ { value: 'needs-input', label: 'On' },
17
+ ];
18
+ /**
19
+ * Picker for the agent notification level (GENC-1676): the design system's segmented control, as
20
+ * the timestamps picker uses, with the same guard against the items' own `change` echoes — only
21
+ * the group's own `change` is a choice. The value binding also reads `notificationPickerRevision`,
22
+ * so a refused choice snaps back to the level that still applies.
23
+ *
24
+ * @internal
25
+ */
26
+ export const notificationLevelPickerTemplate = (segmentedControlTag, segmentedItemTag) => html `
27
+ <${segmentedControlTag}
28
+ part="toggle-notifications"
29
+ aria-label="Notifications"
30
+ :value=${(x) => {
31
+ void x.notificationPickerRevision;
32
+ return x.effectiveNotificationLevel;
33
+ }}
34
+ @change=${(x, c) => {
35
+ if (c.event.target !== c.event.currentTarget)
36
+ return true;
37
+ const next = asAgentNotificationLevel(c.event.target.value);
38
+ if (next)
39
+ void x.chooseNotificationLevel(next);
40
+ return true;
41
+ }}
42
+ >
43
+ ${repeat((x) => x.notificationAutopilotOffered ? NOTIFICATION_LEVEL_OPTIONS : NOTIFICATION_ON_OFF_OPTIONS, html `
44
+ <${segmentedItemTag} part="notification-level-option" value="${(option) => option.value}"
45
+ >${(option) => option.label}</${segmentedItemTag}
46
+ >
47
+ `)}
48
+ </${segmentedControlTag}>
49
+ `;
@@ -0,0 +1,42 @@
1
+ import { agenticActivityBus } from '../channel/ai-activity-bus';
2
+ /** Every connected assistant on this page. Two views of one session (docked, popped out) share it. */
3
+ const hosts = new Set();
4
+ /**
5
+ * Make an assistant's notification settings reachable by session. Returns the undo, for its
6
+ * disconnect.
7
+ *
8
+ * @internal
9
+ */
10
+ export function addNotificationSettingsHost(host) {
11
+ hosts.add(host);
12
+ announceNotificationSettings(host.sessionKey());
13
+ return () => {
14
+ hosts.delete(host);
15
+ announceNotificationSettings(host.sessionKey());
16
+ };
17
+ }
18
+ /**
19
+ * The notification settings for a session, from the assistant that holds it; `undefined` while no
20
+ * connected assistant does. The latest to connect wins: its views share one store anyway.
21
+ *
22
+ * @internal
23
+ */
24
+ export function notificationSettingsFor(sessionKey) {
25
+ if (!sessionKey)
26
+ return undefined;
27
+ let found;
28
+ for (const host of hosts)
29
+ if (host.sessionKey() === sessionKey)
30
+ found = host;
31
+ return found;
32
+ }
33
+ /**
34
+ * Tell pickers that a session's notification settings may have changed: the level, what the app
35
+ * offers, or which assistant holds the session.
36
+ *
37
+ * @internal
38
+ */
39
+ export function announceNotificationSettings(sessionKey) {
40
+ if (sessionKey)
41
+ agenticActivityBus.publish('notification-settings-changed', { sessionKey });
42
+ }
@@ -15,6 +15,7 @@ export function createDefaultSessionState() {
15
15
  showNarration: false,
16
16
  showAgentSwitchIndicator: false,
17
17
  timestampDisplay: DEFAULT_TIMESTAMP_DISPLAY,
18
+ notificationLevel: 'off',
18
19
  enabledAnimations: [],
19
20
  suggestionsState: { status: 'idle' },
20
21
  contextTokens: undefined,
@@ -82,6 +83,9 @@ export const aiAssistantSlice = createSlice({
82
83
  setTimestampDisplay(state, action) {
83
84
  state.timestampDisplay = action.payload;
84
85
  },
86
+ setNotificationLevel(state, action) {
87
+ state.notificationLevel = action.payload;
88
+ },
85
89
  setEnabledAnimations(state, action) {
86
90
  state.enabledAnimations = action.payload;
87
91
  },
@@ -351,6 +355,7 @@ export const aiAssistantSlice = createSlice({
351
355
  showNarration: state.showNarration,
352
356
  showAgentSwitchIndicator: state.showAgentSwitchIndicator,
353
357
  timestampDisplay: state.timestampDisplay,
358
+ notificationLevel: state.notificationLevel,
354
359
  enabledAnimations: state.enabledAnimations,
355
360
  providerStatuses: state.providerStatuses,
356
361
  blocked: state.blocked,
@@ -8,6 +8,7 @@ import { buildDecisionSurface, buildFullSurface } from './decision-surface';
8
8
  * @internal
9
9
  */
10
10
  export function createInteractionContext(interactionId, deps = {}) {
11
+ var _a;
11
12
  const state = {};
12
13
  const onceCache = new Map();
13
14
  const listeners = new Set();
@@ -20,6 +21,21 @@ export function createInteractionContext(interactionId, deps = {}) {
20
21
  let surface;
21
22
  let lastActivityAt = Date.now();
22
23
  let checkpoint = deps.checkpoint;
24
+ // GENC-1676: the widget's first `requestAttention`, held until who holds the interaction is
25
+ // decided (`markOffered`), then reported once — or dropped, if a claimant holds it.
26
+ let offered = false;
27
+ let attention;
28
+ let attentionDone = false;
29
+ const reportAttention = () => {
30
+ var _a;
31
+ if (!offered || !attention || attentionDone || disposed || settled)
32
+ return;
33
+ attentionDone = true;
34
+ // A claimant's: its own hand-back reports, if it gives the interaction back.
35
+ if (heldBy !== 'user')
36
+ return;
37
+ (_a = deps.requestAttention) === null || _a === void 0 ? void 0 : _a.call(deps, attention.message);
38
+ };
23
39
  /** Fire every waiting `onSurfaceReady` once the surface has something a claimant could do. */
24
40
  const checkReady = () => {
25
41
  if (disposed || !surface || readyListeners.size === 0 || !surface.isReady())
@@ -37,6 +53,7 @@ export function createInteractionContext(interactionId, deps = {}) {
37
53
  };
38
54
  const context = {
39
55
  interactionId,
56
+ sessionKey: (_a = deps.sessionKey) !== null && _a !== void 0 ? _a : '',
40
57
  get heldBy() {
41
58
  return heldBy;
42
59
  },
@@ -137,6 +154,12 @@ export function createInteractionContext(interactionId, deps = {}) {
137
154
  readyListeners.delete(fn);
138
155
  };
139
156
  },
157
+ requestAttention(message) {
158
+ if (disposed || settled || attention)
159
+ return;
160
+ attention = { message };
161
+ reportAttention();
162
+ },
140
163
  claimantOwns(action) {
141
164
  if (heldBy === 'user' || !surface)
142
165
  return false;
@@ -174,6 +197,10 @@ export function createInteractionContext(interactionId, deps = {}) {
174
197
  setController(value) {
175
198
  controller = value;
176
199
  },
200
+ markOffered() {
201
+ offered = true;
202
+ reportAttention();
203
+ },
177
204
  get surface() {
178
205
  return surface;
179
206
  },
@@ -1,4 +1,5 @@
1
1
  import { DEFAULT_ANIMATIONS } from '../main/main.types';
2
+ import { asAgentNotificationLevel, } from '../notifications/agent-notifications';
2
3
  import { resolveExclusiveLoadingStyle } from './animation-exclusivity';
3
4
  /**
4
5
  * Whether a preference write is a no-op, so a setter can bail before touching the store.
@@ -78,6 +79,9 @@ export function resolvePreferenceBaseline(ui, stored) {
78
79
  // Defaults ON, unlike the booleans above — so this reads the config value when it is
79
80
  // a valid mode and falls back to `'hover'`, rather than testing `=== true`.
80
81
  timestampDisplay: (_a = asTimestampDisplay(u.showTimestamps)) !== null && _a !== void 0 ? _a : DEFAULT_TIMESTAMP_DISPLAY,
82
+ // No config layer, on purpose: the browser makes the person opt in, so nothing in
83
+ // `chatConfig` can switch it on (GENC-1676).
84
+ notificationLevel: 'off',
81
85
  enabledAnimations: resolveExclusiveLoadingStyle((_c = (_b = u.animations) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : (u.animations ? [...DEFAULT_ANIMATIONS] : [])),
82
86
  };
83
87
  // Layer 2 — stored user preferences override the fields they carry.
@@ -99,6 +103,11 @@ export function resolvePreferenceBaseline(ui, stored) {
99
103
  const storedMode = asTimestampDisplay(stored.timestampDisplay);
100
104
  if (storedMode)
101
105
  baseline.timestampDisplay = storedMode;
106
+ // Kept even when the app no longer offers it: what applies is narrowed later, so offering
107
+ // it again restores the choice.
108
+ const storedLevel = asAgentNotificationLevel(stored.notificationLevel);
109
+ if (storedLevel)
110
+ baseline.notificationLevel = storedLevel;
102
111
  if (Array.isArray(stored.animations)) {
103
112
  // De-dupe defensively — historical blobs may hold duplicates from the old
104
113
  // settings-modal append bug (now fixed at the `setEnabledAnimations` source).
package/dist/react.cjs CHANGED
@@ -15,6 +15,7 @@ const { AiChatMarkdown: AiChatMarkdownWC } = require('./esm/components/chat-mark
15
15
  const { AiFlowingWavesIndicator: AiFlowingWavesIndicatorWC } = require('./esm/components/flowing-waves-indicator.js');
16
16
  const { AiHaloOverlay: AiHaloOverlayWC } = require('./esm/components/halo-overlay.js');
17
17
  const { MessageFeedback: MessageFeedbackWC } = require('./esm/components/message-feedback/message-feedback.js');
18
+ const { AiNotificationLevel: AiNotificationLevelWC } = require('./esm/components/notification-level/notification-level.js');
18
19
  const { AiPlasmaOrbIndicator: AiPlasmaOrbIndicatorWC } = require('./esm/components/plasma-orb-indicator.js');
19
20
  const { FoundationAiPopoutManager: FoundationAiPopoutManagerWC } = require('./esm/components/popout-manager/popout-manager.js');
20
21
  const { AiWavesIndicator: AiWavesIndicatorWC } = require('./esm/components/waves-indicator.js');
@@ -152,6 +153,11 @@ const MessageFeedback = React.forwardRef(function MessageFeedback(props, ref) {
152
153
  return React.createElement(customElements.getName(MessageFeedbackWC) ?? 'foundation-ai-message-feedback', { ...rest, ref }, children);
153
154
  });
154
155
 
156
+ const AiNotificationLevel = React.forwardRef(function AiNotificationLevel(props, ref) {
157
+ const { children, ...rest } = props;
158
+ return React.createElement(customElements.getName(AiNotificationLevelWC) ?? 'foundation-ai-notification-level', { ...rest, ref }, children);
159
+ });
160
+
155
161
  const FoundationAiPopoutManager = React.forwardRef(function FoundationAiPopoutManager(props, ref) {
156
162
  const { children, ...rest } = props;
157
163
  return React.createElement(customElements.getName(FoundationAiPopoutManagerWC) ?? 'foundation-ai-popout-manager', { ...rest, ref }, children);
@@ -188,6 +194,7 @@ module.exports = {
188
194
  AiChatInteractionWrapper,
189
195
  AiChatMarkdown,
190
196
  MessageFeedback,
197
+ AiNotificationLevel,
191
198
  FoundationAiPopoutManager,
192
199
  GenesisWriteReview,
193
200
  };
package/dist/react.mjs CHANGED
@@ -13,6 +13,7 @@ import { AiChatMarkdown as AiChatMarkdownWC } from './esm/components/chat-markdo
13
13
  import { AiFlowingWavesIndicator as AiFlowingWavesIndicatorWC } from './esm/components/flowing-waves-indicator.js';
14
14
  import { AiHaloOverlay as AiHaloOverlayWC } from './esm/components/halo-overlay.js';
15
15
  import { MessageFeedback as MessageFeedbackWC } from './esm/components/message-feedback/message-feedback.js';
16
+ import { AiNotificationLevel as AiNotificationLevelWC } from './esm/components/notification-level/notification-level.js';
16
17
  import { AiPlasmaOrbIndicator as AiPlasmaOrbIndicatorWC } from './esm/components/plasma-orb-indicator.js';
17
18
  import { FoundationAiPopoutManager as FoundationAiPopoutManagerWC } from './esm/components/popout-manager/popout-manager.js';
18
19
  import { AiWavesIndicator as AiWavesIndicatorWC } from './esm/components/waves-indicator.js';
@@ -150,6 +151,11 @@ export const MessageFeedback = React.forwardRef(function MessageFeedback(props,
150
151
  return React.createElement(customElements.getName(MessageFeedbackWC) ?? 'foundation-ai-message-feedback', { ...rest, ref }, children);
151
152
  });
152
153
 
154
+ export const AiNotificationLevel = React.forwardRef(function AiNotificationLevel(props, ref) {
155
+ const { children, ...rest } = props;
156
+ return React.createElement(customElements.getName(AiNotificationLevelWC) ?? 'foundation-ai-notification-level', { ...rest, ref }, children);
157
+ });
158
+
153
159
  export const FoundationAiPopoutManager = React.forwardRef(function FoundationAiPopoutManager(props, ref) {
154
160
  const { children, ...rest } = props;
155
161
  return React.createElement(customElements.getName(FoundationAiPopoutManagerWC) ?? 'foundation-ai-popout-manager', { ...rest, ref }, children);