@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
@@ -51,6 +51,35 @@ export declare interface ActivityBus {
51
51
  /** Sentinel value representing "Auto" where a menu row needs a string value. */
52
52
  export declare const AGENT_PICKER_AUTO_VALUE = "__auto__";
53
53
 
54
+ /**
55
+ * The detail of the `agent-attention` activity-bus event: something in a session needs the person.
56
+ * Published whatever the person's level is; the assistant for that session decides whether to
57
+ * notify.
58
+ *
59
+ * @beta
60
+ */
61
+ export declare interface AgentAttentionDetail {
62
+ /** The session it happened in. A sub-agent's session is `<parent>::sub:<id>`. */
63
+ readonly sessionKey: string;
64
+ readonly kind: AgentAttentionKind;
65
+ /** The interaction it is about, when there is one. */
66
+ readonly interactionId?: string;
67
+ /** Text that replaces the default message for this one notification. */
68
+ readonly message?: string;
69
+ }
70
+
71
+ /**
72
+ * What an agent notification is about.
73
+ *
74
+ * - `'widget-needs-input'` — a widget asked for the person's attention.
75
+ * - `'autopilot-handed-back'` — the autopilot handed something to the person.
76
+ * - `'autopilot-stopped'` — the autopilot stopped working: the flow ended, the turn ended with
77
+ * nothing left for it to answer, or it hit a wall such as the budget.
78
+ *
79
+ * @beta
80
+ */
81
+ export declare type AgentAttentionKind = 'widget-needs-input' | 'autopilot-handed-back' | 'autopilot-stopped';
82
+
54
83
  /**
55
84
  * Configuration for an agent passed to `FoundationAiAssistant`.
56
85
  *
@@ -198,8 +227,9 @@ export declare interface AgenticActivityEvents {
198
227
  needsUser: boolean;
199
228
  };
200
229
  /**
201
- * The person opened the collapsed assistant from its "needs you" badge: the assistant for
202
- * `sessionKey` (any, when absent) brings what waits on them into view.
230
+ * The person opened the collapsed assistant from its "needs you" badge, or clicked an agent
231
+ * notification (GENC-1676): the assistant for `sessionKey` (any, when absent) brings what waits
232
+ * on them into view, and a closed bubble holding it opens.
203
233
  */
204
234
  'autopilot-show-waiting': {
205
235
  sessionKey?: string;
@@ -322,6 +352,22 @@ export declare interface AgenticActivityEvents {
322
352
  * computing again (until `tool-loop-end`). Tab-local.
323
353
  */
324
354
  'interaction-resolved': undefined;
355
+ /**
356
+ * Something in a session needs the person (GENC-1676): a widget asked for their attention, or
357
+ * the autopilot handed back or stopped working. Published whatever the person's notification
358
+ * level is; the assistant for that session decides whether to show a browser notification, and
359
+ * an app can listen to drive its own UI. Tab-local: the window that owns the session's driver
360
+ * publishes it.
361
+ */
362
+ 'agent-attention': AgentAttentionDetail;
363
+ /**
364
+ * A session's agent notification settings may have changed (GENC-1676): the person's level, what
365
+ * the app offers, or which assistant on the page holds the session. A notification level picker
366
+ * for that session re-reads them. Tab-local.
367
+ */
368
+ 'notification-settings-changed': {
369
+ sessionKey: string;
370
+ };
325
371
  }
326
372
 
327
373
  /**
@@ -348,6 +394,36 @@ export declare interface AgentLifecycleContext {
348
394
  restored?: unknown;
349
395
  }
350
396
 
397
+ /**
398
+ * How often the person wants a browser notification when the assistant needs them (GENC-1676).
399
+ * Each level includes the one before it.
400
+ *
401
+ * - `'off'` — never. The default, always: the browser makes the person grant permission, so
402
+ * nothing can switch it on for them.
403
+ * - `'autopilot'` — only when the autopilot hands back to the person or stops working. Offered
404
+ * only when the app sets `chatConfig.ui.notifications.autopilot`.
405
+ * - `'needs-input'` — every `'autopilot'` case, plus any widget that asks for the person's
406
+ * attention (`InteractionContext.requestAttention`).
407
+ *
408
+ * @beta
409
+ */
410
+ export declare type AgentNotificationLevel = 'off' | 'autopilot' | 'needs-input';
411
+
412
+ /**
413
+ * Whether this page may show notifications: the browser's own `NotificationPermission`, or
414
+ * `'unsupported'` where there is no Notification API (an old browser, an insecure context, Node).
415
+ *
416
+ * @beta
417
+ */
418
+ export declare type AgentNotificationPermission = NotificationPermission | 'unsupported';
419
+
420
+ /**
421
+ * Whether this page may show notifications. Safe to call anywhere, including Node.
422
+ *
423
+ * @beta
424
+ */
425
+ export declare function agentNotificationPermission(): AgentNotificationPermission;
426
+
351
427
  /**
352
428
  * Context passed to an agent's `resumable` predicate (GENC-1351 §5.9), evaluated
353
429
  * at session-save time on the active agent (which, for a locked guided flow, is
@@ -1218,6 +1294,54 @@ export declare interface AiDriverEventMap {
1218
1294
  'orchestrating-stop': CustomEvent<undefined>;
1219
1295
  }
1220
1296
 
1297
+ /**
1298
+ * The agent notification level picker on its own (GENC-1676), for an app or a widget's view to
1299
+ * place wherever it invites the person to switch notifications on. The same control as the
1300
+ * assistant's settings row, and the same behaviour: picking a level asks the browser for
1301
+ * permission inside the click and snaps back if refused, the hint says when the browser blocks
1302
+ * notifications, and the Autopilot level shows only when the app offers it.
1303
+ *
1304
+ * It works on the session in `session-key`, through the connected assistant that holds it, so
1305
+ * the level is checked and saved as a settings change is. It renders nothing while no connected
1306
+ * assistant holds that session, while the app turns notifications off, or where the browser has
1307
+ * no notifications.
1308
+ *
1309
+ * In a widget, pass the interaction's session:
1310
+ *
1311
+ * ```html
1312
+ * <foundation-ai-notification-level session-key="${(x) => x.interactionContext.sessionKey}">
1313
+ * </foundation-ai-notification-level>
1314
+ * ```
1315
+ *
1316
+ * @beta
1317
+ */
1318
+ export declare class AiNotificationLevel extends GenesisElement implements NotificationLevelPickerSource {
1319
+ /** The session whose level this picks: the assistant's `session-key` (or state key). */
1320
+ sessionKey?: string;
1321
+ designSystemPrefix: string;
1322
+ /** The browser's notification permission, followed while connected. @internal */
1323
+ notificationPermission: AgentNotificationPermission;
1324
+ /** See `NotificationLevelPickerSource`. @internal */
1325
+ notificationPickerRevision: number;
1326
+ /** Bumped whenever the session's settings may have changed, so the getters re-read. @internal */
1327
+ settingsRevision: number;
1328
+ private unwire?;
1329
+ connectedCallback(): void;
1330
+ disconnectedCallback(): void;
1331
+ sessionKeyChanged(): void;
1332
+ private get host();
1333
+ /** Whether to render: a connected assistant holds the session, offers it, and the browser can. @internal */
1334
+ get offered(): boolean;
1335
+ /** See `NotificationLevelPickerSource`. @internal */
1336
+ get effectiveNotificationLevel(): AgentNotificationLevel;
1337
+ /** See `NotificationLevelPickerSource`. @internal */
1338
+ get notificationAutopilotOffered(): boolean;
1339
+ /** The hint under the picker when the browser will not show notifications. @internal */
1340
+ get permissionHint(): string;
1341
+ /** See `NotificationLevelPickerSource`. @internal */
1342
+ chooseNotificationLevel(level: AgentNotificationLevel): Promise<void>;
1343
+ }
1344
+
1221
1345
  /**
1222
1346
  * Optional app-registered policy for which cloud vendor backs the tier-shaped
1223
1347
  * provider registry slots (`low` / `high` / …). Apps inject a concrete
@@ -1636,6 +1760,7 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
1636
1760
  private readonly agents;
1637
1761
  private readonly providerRegistry;
1638
1762
  private readonly sessionKey;
1763
+ private readonly activityBus;
1639
1764
  private readonly listeners;
1640
1765
  private readonly sessions;
1641
1766
  /** The flow the mode applies to: set when it is first switched, cleared when that flow ends. */
@@ -1665,6 +1790,14 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
1665
1790
  private turnsInFlight;
1666
1791
  /** Written questions being answered right now; see `working`. */
1667
1792
  private answersInFlight;
1793
+ /**
1794
+ * Whether the autopilot has been running, and working, since it last stopped or was paused: so
1795
+ * going idle now is a stop to report. Outlives its flow ending, so a turn still running then is
1796
+ * waited out. See `watchForStop`.
1797
+ */
1798
+ private ranSinceStop;
1799
+ /** The check that confirms the autopilot stopped, once it looked like it had. */
1800
+ private stopCheck?;
1668
1801
  constructor(inner: AiDriver, options: AutopilotDriverOptions);
1669
1802
  get state(): AutopilotHostState;
1670
1803
  get copy(): AutopilotCopy;
@@ -1776,6 +1909,19 @@ export declare class AutopilotDriver extends BaseDriverDecorator implements Auto
1776
1909
  private copyFor;
1777
1910
  private sessionFor;
1778
1911
  private record;
1912
+ /** Report that something needs the person, for the assistant to notify them (GENC-1676). */
1913
+ private attention;
1914
+ /**
1915
+ * Report the autopilot stopping work on its own (GENC-1676): after running and working, nothing
1916
+ * is happening and nothing waits on the person — the turn ended with nothing for it to answer,
1917
+ * hit a wall such as the budget, or its flow ended. A flow that ends mid-turn is reported once
1918
+ * the turn ends, not while the assistant is still writing. A pause by the person is not a stop,
1919
+ * and a hand-back reports itself.
1920
+ *
1921
+ * Confirmed a task later, because one state change can briefly look like a stop on the way to
1922
+ * something else (a turn ending just before the next starts).
1923
+ */
1924
+ private watchForStop;
1779
1925
  private notify;
1780
1926
  }
1781
1927
 
@@ -1791,6 +1937,11 @@ export declare interface AutopilotDriverOptions {
1791
1937
  readonly providerRegistry: AIProviderRegistry;
1792
1938
  /** The working session's debug-log key. */
1793
1939
  readonly sessionKey?: string;
1940
+ /**
1941
+ * Where the driver reports that it handed back to the person or stopped working, as
1942
+ * `agent-attention` (GENC-1676). Defaults to {@link NOOP_ACTIVITY_BUS}.
1943
+ */
1944
+ readonly activityBus?: ActivityBus;
1794
1945
  }
1795
1946
 
1796
1947
  /**
@@ -4002,6 +4153,13 @@ export declare interface DecisionSpec {
4002
4153
  choose(answer: DecisionAnswer): void | Promise<void>;
4003
4154
  }
4004
4155
 
4156
+ /**
4157
+ * The notification's text when neither the app nor the widget gives one.
4158
+ *
4159
+ * @beta
4160
+ */
4161
+ export declare const DEFAULT_AGENT_NOTIFICATION_MESSAGE = "The assistant is ready for your next input";
4162
+
4005
4163
  /**
4006
4164
  * Animations enabled by default when a consumer opts into the animations
4007
4165
  * feature without specifying an explicit `enabled` list. Keeps the dots loading
@@ -4522,6 +4680,55 @@ export declare class FoundationAiAssistant extends GenesisElement {
4522
4680
  */
4523
4681
  get timestampDisplay(): TimestampDisplay;
4524
4682
  set timestampDisplay(value: TimestampDisplay);
4683
+ /**
4684
+ * The person's agent notification level (GENC-1676): `'off'` (always the default),
4685
+ * `'autopilot'` or `'needs-input'`. Saved with the other settings.
4686
+ *
4687
+ * An app may set it, e.g. after its own "Notify me" invitation, once the person granted
4688
+ * permission through `requestAgentNotificationPermission`. Ignored when the app does not offer
4689
+ * the level (`chatConfig.ui.notifications`), and before the assistant has a session.
4690
+ */
4691
+ get notificationLevel(): AgentNotificationLevel;
4692
+ set notificationLevel(value: AgentNotificationLevel);
4693
+ /**
4694
+ * The level that applies: the person's choice, as `'off'` when the app no longer offers it.
4695
+ * What the settings picker shows. @internal
4696
+ */
4697
+ get effectiveNotificationLevel(): AgentNotificationLevel;
4698
+ /** The browser's notification permission, followed while connected. @internal */
4699
+ notificationPermission: AgentNotificationPermission;
4700
+ /**
4701
+ * Bumped to make the settings picker re-read its value when a choice did not take (permission
4702
+ * refused), since the stored level, and so its binding, did not change. @internal
4703
+ */
4704
+ notificationPickerRevision: number;
4705
+ /** Whether the settings row shows: offered by the app, and possible in this browser. @internal */
4706
+ get notificationSettingVisible(): boolean;
4707
+ /** Whether the settings picker offers the `'autopilot'` level. @internal */
4708
+ get notificationAutopilotOffered(): boolean;
4709
+ /**
4710
+ * The hint under the settings row when the browser will not show notifications. A block shows
4711
+ * even at Off: otherwise a person picking a level would see it snap back with no reason given,
4712
+ * since a browser that has blocked them never asks again. @internal
4713
+ */
4714
+ get notificationPermissionHint(): string;
4715
+ /**
4716
+ * The person chose a level in settings (GENC-1676). Turning notifications on asks the browser for
4717
+ * permission first — this runs inside their click, which the browser requires — and keeps the
4718
+ * old level if they refuse. @internal
4719
+ */
4720
+ chooseNotificationLevel(level: AgentNotificationLevel): Promise<void>;
4721
+ /**
4722
+ * Notifications, for this connect (GENC-1676): turn this session's `agent-attention` into
4723
+ * browser notifications, follow the browser's permission, and lend this session's settings to
4724
+ * pickers outside this element (`foundation-ai-notification-level`).
4725
+ */
4726
+ private wireNotifications;
4727
+ /**
4728
+ * Turn an `agent-attention` event for this session into a browser notification, if the
4729
+ * person's level covers it and they are not looking (GENC-1676).
4730
+ */
4731
+ private onAgentAttention;
4525
4732
  /**
4526
4733
  * Epoch ms the transcript's relative timestamps are measured against.
4527
4734
  *
@@ -5159,6 +5366,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
5159
5366
  private unsubBus?;
5160
5367
  /** Unsubscribe handle for the `tool-loop-end` budget latch (GENC-1464). */
5161
5368
  private _unsubBudgetLatch?;
5369
+ /** Undoes `wireNotifications`; balanced like `_unsubBudgetLatch`, re-wired per connect. */
5370
+ private _unwireNotifications?;
5162
5371
  /** Unsubscribe handle for the provider-registry change listener (observable registries only). */
5163
5372
  private unsubProviderRegistry?;
5164
5373
  private _handlePageHide;
@@ -5328,7 +5537,10 @@ export declare class FoundationAiAssistant extends GenesisElement {
5328
5537
  */
5329
5538
  get composerAutopilotVisible(): boolean;
5330
5539
  autopilotHostOverrideChanged(): void;
5331
- /** Follow the autopilot host's state, publishing the "needs you" signal for the bubble. */
5540
+ /**
5541
+ * Follow the autopilot host's state, publishing the "needs you" signal for the bubble, and bring
5542
+ * what waits on the person into view when asked.
5543
+ */
5332
5544
  private wireAutopilot;
5333
5545
  /**
5334
5546
  * Scroll to the pending interaction that waits on the person, and pulse it, so opening the chat
@@ -6513,6 +6725,13 @@ export declare type InteractionCompletedEventDetail = ChatInteractionEventsMap['
6513
6725
  export declare interface InteractionContext<TState extends object = Record<string, unknown>, TCheckpoint = unknown> {
6514
6726
  /** Stable id of the interaction this context belongs to. */
6515
6727
  readonly interactionId: string;
6728
+ /**
6729
+ * The session the interaction belongs to (GENC-1676) — plain data, the same in Node. A view
6730
+ * passes it to anything that works per session, such as
6731
+ * `<foundation-ai-notification-level session-key="...">`. Empty for a context made outside a
6732
+ * session (an inert fallback, a test).
6733
+ */
6734
+ readonly sessionKey: string;
6516
6735
  /**
6517
6736
  * Who holds this pending interaction right now: `'user'`, or the id of the interceptor that
6518
6737
  * claimed it, e.g. `'autopilot'` (GENC-1660). `'user'` unless something claimed it.
@@ -6606,6 +6825,22 @@ export declare interface InteractionContext<TState extends object = Record<strin
6606
6825
  claimantOwns(action: string): boolean;
6607
6826
  /** When the controller last called `notify()` (or the interaction opened), in epoch ms. A heartbeat. */
6608
6827
  readonly lastActivityAt: number;
6828
+ /**
6829
+ * Say this interaction needs the person to act (GENC-1676). If their notification level covers
6830
+ * it and they are not looking at the page, they get a browser notification. Call it at the
6831
+ * moment the widget starts waiting on the person — not before, if it has work to do first. A
6832
+ * widget that only shows information never calls it.
6833
+ *
6834
+ * Safe to call from anywhere, the controller's constructor included: the platform reports it
6835
+ * only once it has decided who holds the interaction, and drops it if a claimant (the autopilot)
6836
+ * holds it then or when it is called — the claimant's own hand-back notifies instead. Only the
6837
+ * first call counts, whatever happened to it; later ones do nothing, as do calls after the
6838
+ * interaction ends.
6839
+ *
6840
+ * @param message - The notification's text for this case. Defaults to the app's
6841
+ * `chatConfig.ui.notifications.message`, then to "The assistant is ready for your next input".
6842
+ */
6843
+ requestAttention(message?: string): void;
6609
6844
  /**
6610
6845
  * What is already done, for long work that should survive a reload: the last checkpoint saved,
6611
6846
  * or the one the platform handed over — after a restore, the first request for the same widget
@@ -6964,6 +7199,26 @@ export { ModelTagAppearance }
6964
7199
  */
6965
7200
  export declare const NOOP_ACTIVITY_BUS: ActivityBus;
6966
7201
 
7202
+ /**
7203
+ * What a notification level picker reads and calls (GENC-1676): the assistant, in its own
7204
+ * settings, and `foundation-ai-notification-level` anywhere else.
7205
+ *
7206
+ * @internal
7207
+ */
7208
+ declare interface NotificationLevelPickerSource {
7209
+ /** The level that applies: what the picker shows. */
7210
+ readonly effectiveNotificationLevel: AgentNotificationLevel;
7211
+ /** Whether to offer the `'autopilot'` level. */
7212
+ readonly notificationAutopilotOffered: boolean;
7213
+ /**
7214
+ * Bumped to make the picker re-read its value when a choice did not take (permission refused),
7215
+ * since the level, and so its binding, did not change.
7216
+ */
7217
+ readonly notificationPickerRevision: number;
7218
+ /** The person picked a level. Called straight from their click, for the permission request. */
7219
+ chooseNotificationLevel(level: AgentNotificationLevel): Promise<void>;
7220
+ }
7221
+
6967
7222
  /**
6968
7223
  * Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
6969
7224
  * and `ChatDriver`, classifying each user message and routing it to the right
@@ -7366,6 +7621,16 @@ export declare function registerTieredAIProviders(container: Container, options:
7366
7621
  */
7367
7622
  export declare const REQUEST_CONTINUATION_TOOL = "request_continuation";
7368
7623
 
7624
+ /**
7625
+ * Ask the person for permission to show notifications, and resolve to the result. Call it from a
7626
+ * click or key handler: browsers ignore or refuse a request that does not come from the person.
7627
+ * Resolves straight away when permission is already decided or unsupported, since a browser only
7628
+ * ever asks once.
7629
+ *
7630
+ * @beta
7631
+ */
7632
+ export declare function requestAgentNotificationPermission(): Promise<AgentNotificationPermission>;
7633
+
7369
7634
  /** Resolved context-headroom thresholds for the active model. */
7370
7635
  declare interface ResolvedContextBudget {
7371
7636
  /**
@@ -7717,6 +7982,11 @@ export declare interface SessionPreferences {
7717
7982
  * Absent keeps the `chatConfig.ui.showTimestamps` default, which is `'always'`.
7718
7983
  */
7719
7984
  timestampDisplay?: string;
7985
+ /**
7986
+ * The agent notification level (`AgentNotificationLevel` values, as plain strings). Absent
7987
+ * means `'off'`: unlike the other preferences, no config default can switch it on.
7988
+ */
7989
+ notificationLevel?: string;
7720
7990
  /** Enabled loading-animation ids (`AiAssistantAnimation` values, as plain strings). */
7721
7991
  animations?: string[];
7722
7992
  }
@@ -5530,6 +5530,15 @@ function createInteractionContext(interactionId, deps = {}) {
5530
5530
  let surface;
5531
5531
  let lastActivityAt = Date.now();
5532
5532
  let checkpoint = deps.checkpoint;
5533
+ let offered = false;
5534
+ let attention;
5535
+ let attentionDone = false;
5536
+ const reportAttention = () => {
5537
+ if (!offered || !attention || attentionDone || disposed || settled) return;
5538
+ attentionDone = true;
5539
+ if (heldBy !== "user") return;
5540
+ deps.requestAttention?.(attention.message);
5541
+ };
5533
5542
  const checkReady = () => {
5534
5543
  if (disposed || !surface || readyListeners.size === 0 || !surface.isReady()) return;
5535
5544
  const waiting = [...readyListeners];
@@ -5544,6 +5553,7 @@ function createInteractionContext(interactionId, deps = {}) {
5544
5553
  };
5545
5554
  const context = {
5546
5555
  interactionId,
5556
+ sessionKey: deps.sessionKey ?? "",
5547
5557
  get heldBy() {
5548
5558
  return heldBy;
5549
5559
  },
@@ -5627,6 +5637,11 @@ function createInteractionContext(interactionId, deps = {}) {
5627
5637
  readyListeners.delete(fn);
5628
5638
  };
5629
5639
  },
5640
+ requestAttention(message) {
5641
+ if (disposed || settled || attention) return;
5642
+ attention = { message };
5643
+ reportAttention();
5644
+ },
5630
5645
  claimantOwns(action) {
5631
5646
  if (heldBy === "user" || !surface) return false;
5632
5647
  return surface.actions().some((a) => a.name === action && a.enabled);
@@ -5658,6 +5673,10 @@ function createInteractionContext(interactionId, deps = {}) {
5658
5673
  setController(value) {
5659
5674
  controller = value;
5660
5675
  },
5676
+ markOffered() {
5677
+ offered = true;
5678
+ reportAttention();
5679
+ },
5661
5680
  get surface() {
5662
5681
  return surface;
5663
5682
  }
@@ -6017,9 +6036,16 @@ var InteractionController = class {
6017
6036
  }, timeoutMs) : void 0
6018
6037
  });
6019
6038
  const handle = createInteractionContext(interactionId, {
6039
+ sessionKey: this.deps.sessionKey,
6020
6040
  resolve: (result) => this.resolve(interactionId, result),
6021
6041
  checkpoint: this.takeOverCheckpoint(componentName, data, interactionId),
6022
- saveCheckpoint: (value) => this.saveCheckpoint(interactionId, componentName, value)
6042
+ saveCheckpoint: (value) => this.saveCheckpoint(interactionId, componentName, value),
6043
+ requestAttention: (message) => this.deps.activityBus.publish("agent-attention", {
6044
+ sessionKey: this.deps.sessionKey,
6045
+ kind: "widget-needs-input",
6046
+ interactionId,
6047
+ ...message ? { message } : {}
6048
+ })
6023
6049
  });
6024
6050
  this.contexts.set(interactionId, handle);
6025
6051
  bindStepRecorder(
@@ -6053,6 +6079,7 @@ var InteractionController = class {
6053
6079
  ownerPath,
6054
6080
  userOnly: options?.userOnly === true
6055
6081
  });
6082
+ handle.markOffered();
6056
6083
  recordMetaEvent(this.deps.sessionKey, "interaction.requested", {
6057
6084
  interactionId,
6058
6085
  component: componentName,