@genesislcap/ai-assistant 15.77.0 → 15.78.1

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 (87) hide show
  1. package/dist/ai-assistant.api.json +796 -7
  2. package/dist/ai-assistant.d.ts +305 -12
  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 +1230 -468
  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/config/config.d.ts +2 -2
  26. package/dist/dts/config/define-stateful-agent.d.ts +1 -1
  27. package/dist/dts/index.d.ts +2 -0
  28. package/dist/dts/index.d.ts.map +1 -1
  29. package/dist/dts/main/main.d.ts +79 -6
  30. package/dist/dts/main/main.d.ts.map +1 -1
  31. package/dist/dts/notifications/agent-notifications.d.ts +139 -0
  32. package/dist/dts/notifications/agent-notifications.d.ts.map +1 -0
  33. package/dist/dts/notifications/agent-notifier.d.ts +58 -0
  34. package/dist/dts/notifications/agent-notifier.d.ts.map +1 -0
  35. package/dist/dts/notifications/index.d.ts +2 -0
  36. package/dist/dts/notifications/index.d.ts.map +1 -0
  37. package/dist/dts/notifications/notification-level-picker.template.d.ts +31 -0
  38. package/dist/dts/notifications/notification-level-picker.template.d.ts.map +1 -0
  39. package/dist/dts/notifications/notification-settings.d.ts +42 -0
  40. package/dist/dts/notifications/notification-settings.d.ts.map +1 -0
  41. package/dist/dts/react.d.ts +10 -0
  42. package/dist/dts/state/ai-assistant-slice.d.ts +12 -5
  43. package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
  44. package/dist/dts/state/interaction-context.d.ts +13 -0
  45. package/dist/dts/state/interaction-context.d.ts.map +1 -1
  46. package/dist/dts/state/persistence/session-persistence-provider.d.ts +5 -0
  47. package/dist/dts/state/persistence/session-persistence-provider.d.ts.map +1 -1
  48. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  49. package/dist/dts/state/persistence/session-snapshot.d.ts +19 -6
  50. package/dist/dts/state/persistence/session-snapshot.d.ts.map +1 -1
  51. package/dist/dts/state/session-store.d.ts +1 -0
  52. package/dist/dts/state/session-store.d.ts.map +1 -1
  53. package/dist/dts/types/interaction-context.d.ts +23 -0
  54. package/dist/dts/types/interaction-context.d.ts.map +1 -1
  55. package/dist/dts/utils/attachment-note.d.ts +18 -0
  56. package/dist/dts/utils/attachment-note.d.ts.map +1 -0
  57. package/dist/dts/utils/resolve-preference-baseline.d.ts +3 -0
  58. package/dist/dts/utils/resolve-preference-baseline.d.ts.map +1 -1
  59. package/dist/esm/autopilot/autopilot-driver.js +66 -3
  60. package/dist/esm/components/chat-bubble/chat-bubble.js +17 -3
  61. package/dist/esm/components/chat-driver/interaction-controller.js +5 -0
  62. package/dist/esm/components/notification-level/index.js +1 -0
  63. package/dist/esm/components/notification-level/notification-level.js +124 -0
  64. package/dist/esm/components/notification-level/notification-level.styles.js +20 -0
  65. package/dist/esm/components/notification-level/notification-level.template.js +11 -0
  66. package/dist/esm/components/settings-modal/settings-modal.styles.js +6 -0
  67. package/dist/esm/components/settings-modal/settings-modal.template.js +10 -1
  68. package/dist/esm/index.js +2 -0
  69. package/dist/esm/main/main.js +217 -27
  70. package/dist/esm/main/main.template.js +2 -2
  71. package/dist/esm/notifications/agent-notifications.js +172 -0
  72. package/dist/esm/notifications/agent-notifier.js +86 -0
  73. package/dist/esm/notifications/index.js +1 -0
  74. package/dist/esm/notifications/notification-level-picker.template.js +49 -0
  75. package/dist/esm/notifications/notification-settings.js +42 -0
  76. package/dist/esm/state/ai-assistant-slice.js +5 -0
  77. package/dist/esm/state/interaction-context.js +27 -0
  78. package/dist/esm/state/persistence/session-persister.js +24 -21
  79. package/dist/esm/state/persistence/session-snapshot.js +20 -7
  80. package/dist/esm/utils/attachment-note.js +19 -0
  81. package/dist/esm/utils/resolve-preference-baseline.js +9 -0
  82. package/dist/react.cjs +7 -0
  83. package/dist/react.mjs +6 -0
  84. package/docs/notifications.md +169 -0
  85. package/docs/styling.md +1 -1
  86. package/package.json +17 -17
  87. package/sandbox/fixtures.ts +3 -3
@@ -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
  /**
@@ -2101,8 +2252,8 @@ declare interface BaseAgentConfig {
2101
2252
  * (or leave the field absent) to persist and resume normally; return `false`
2102
2253
  * for a point that shouldn't be resumed — the session is not persisted, and on
2103
2254
  * return the assistant shows {@link AgentConfig.notResumableMessage} (or a
2104
- * default) and pre-fills the composer with the prompt that started the flow so
2105
- * the user can re-run it.
2255
+ * default) and pre-fills the composer with the user's last message so they can
2256
+ * re-run it.
2106
2257
  *
2107
2258
  * Only consulted when the user has persistence enabled. Must be a **pure
2108
2259
  * function of `ctx.state`** — it may be re-evaluated on a restored snapshot, so
@@ -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
@@ -5904,21 +6116,37 @@ export declare class FoundationAiAssistant extends GenesisElement {
5904
6116
  * user might change their mind and unpin without anything to clean up.
5905
6117
  */
5906
6118
  get pinLocked(): boolean;
6119
+ /**
6120
+ * The agent holding the flow lock, by its `displayName` when that is a plain string (the
6121
+ * function form needs the agent's state, so it falls back to `name`, as the driver does).
6122
+ */
6123
+ private get flowOwnerLabel();
5907
6124
  /** Tooltip shown on the picker toggle button. */
5908
6125
  get agentToggleTitle(): string;
6126
+ /** The agent the chip shows: the flow owner while it holds the picker, else the pin. */
6127
+ private get chipAgentName();
5909
6128
  /**
5910
- * Tint applied to the pin icon when an agent is pinned. Picked from the
5911
- * brand palette by agent position (modulo the palette length), so each agent
5912
- * gets a consistent colour across renders. `undefined` when nothing is
5913
- * pinned, the agent isn't in the current array, or the host has opted out
5914
- * via `chatConfig.picker.disablePinColours`.
6129
+ * The pinned agent's colour. Picked from the brand palette by agent position
6130
+ * (modulo the palette length), so each agent gets a consistent colour across
6131
+ * renders. `undefined` when nothing is pinned, the agent isn't in the current
6132
+ * array, or the host has opted out via `chatConfig.picker.disablePinColours`.
6133
+ * Kept for hosts; the chip's glyph uses
6134
+ * {@link FoundationAiAssistant.agentButtonColour}, which follows the flow
6135
+ * owner while it holds the picker.
5915
6136
  */
5916
6137
  get pinnedAgentColour(): string | undefined;
6138
+ /** The chip's glyph colour: the pin's tint, for the agent the chip shows. */
6139
+ get agentButtonColour(): string | undefined;
6140
+ private agentColour;
6141
+ /** The chip's icon: orchestration's, or the pin for one agent getting every message. */
6142
+ get agentButtonGlyph(): 'sitemap' | 'thumbtack';
5917
6143
  /**
5918
6144
  * Label beside the composer's agent glyph: the orchestration label (`Orchestration` unless the
5919
6145
  * host renames it) while the orchestrator is routing, otherwise the pinned agent's name. The name is NOT shortened here —
5920
6146
  * the button truncates with an ellipsis in CSS, so the full name stays
5921
6147
  * available to a screen reader and to the `title` tooltip.
6148
+ *
6149
+ * While a flow holds the picker, the flow owner is named instead: it gets every message.
5922
6150
  */
5923
6151
  get agentButtonLabel(): string;
5924
6152
  /**
@@ -5934,6 +6162,8 @@ export declare class FoundationAiAssistant extends GenesisElement {
5934
6162
  * Placeholder shown in the chat input. Substitutes the pinned agent's name
5935
6163
  * when one is selected so the user has a clearer signal of where their
5936
6164
  * message will go; otherwise falls back to the host-provided placeholder.
6165
+ * While a flow holds the picker and the chip is shown, it names the flow
6166
+ * owner, as the chip does.
5937
6167
  */
5938
6168
  get effectivePlaceholder(): string;
5939
6169
  toggleShowToolCalls(): void;
@@ -6513,6 +6743,13 @@ export declare type InteractionCompletedEventDetail = ChatInteractionEventsMap['
6513
6743
  export declare interface InteractionContext<TState extends object = Record<string, unknown>, TCheckpoint = unknown> {
6514
6744
  /** Stable id of the interaction this context belongs to. */
6515
6745
  readonly interactionId: string;
6746
+ /**
6747
+ * The session the interaction belongs to (GENC-1676) — plain data, the same in Node. A view
6748
+ * passes it to anything that works per session, such as
6749
+ * `<foundation-ai-notification-level session-key="...">`. Empty for a context made outside a
6750
+ * session (an inert fallback, a test).
6751
+ */
6752
+ readonly sessionKey: string;
6516
6753
  /**
6517
6754
  * Who holds this pending interaction right now: `'user'`, or the id of the interceptor that
6518
6755
  * claimed it, e.g. `'autopilot'` (GENC-1660). `'user'` unless something claimed it.
@@ -6606,6 +6843,22 @@ export declare interface InteractionContext<TState extends object = Record<strin
6606
6843
  claimantOwns(action: string): boolean;
6607
6844
  /** When the controller last called `notify()` (or the interaction opened), in epoch ms. A heartbeat. */
6608
6845
  readonly lastActivityAt: number;
6846
+ /**
6847
+ * Say this interaction needs the person to act (GENC-1676). If their notification level covers
6848
+ * it and they are not looking at the page, they get a browser notification. Call it at the
6849
+ * moment the widget starts waiting on the person — not before, if it has work to do first. A
6850
+ * widget that only shows information never calls it.
6851
+ *
6852
+ * Safe to call from anywhere, the controller's constructor included: the platform reports it
6853
+ * only once it has decided who holds the interaction, and drops it if a claimant (the autopilot)
6854
+ * holds it then or when it is called — the claimant's own hand-back notifies instead. Only the
6855
+ * first call counts, whatever happened to it; later ones do nothing, as do calls after the
6856
+ * interaction ends.
6857
+ *
6858
+ * @param message - The notification's text for this case. Defaults to the app's
6859
+ * `chatConfig.ui.notifications.message`, then to "The assistant is ready for your next input".
6860
+ */
6861
+ requestAttention(message?: string): void;
6609
6862
  /**
6610
6863
  * What is already done, for long work that should survive a reload: the last checkpoint saved,
6611
6864
  * or the one the platform handed over — after a restore, the first request for the same widget
@@ -6964,6 +7217,26 @@ export { ModelTagAppearance }
6964
7217
  */
6965
7218
  export declare const NOOP_ACTIVITY_BUS: ActivityBus;
6966
7219
 
7220
+ /**
7221
+ * What a notification level picker reads and calls (GENC-1676): the assistant, in its own
7222
+ * settings, and `foundation-ai-notification-level` anywhere else.
7223
+ *
7224
+ * @internal
7225
+ */
7226
+ declare interface NotificationLevelPickerSource {
7227
+ /** The level that applies: what the picker shows. */
7228
+ readonly effectiveNotificationLevel: AgentNotificationLevel;
7229
+ /** Whether to offer the `'autopilot'` level. */
7230
+ readonly notificationAutopilotOffered: boolean;
7231
+ /**
7232
+ * Bumped to make the picker re-read its value when a choice did not take (permission refused),
7233
+ * since the level, and so its binding, did not change.
7234
+ */
7235
+ readonly notificationPickerRevision: number;
7236
+ /** The person picked a level. Called straight from their click, for the permission request. */
7237
+ chooseNotificationLevel(level: AgentNotificationLevel): Promise<void>;
7238
+ }
7239
+
6967
7240
  /**
6968
7241
  * Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
6969
7242
  * and `ChatDriver`, classifying each user message and routing it to the right
@@ -7299,7 +7572,12 @@ export declare interface PersistedSession {
7299
7572
  interrupted?: {
7300
7573
  /** Shown as an assistant message on return. */
7301
7574
  message: string;
7302
- /** The prompt that started the flow, pre-filled into the composer on return. */
7575
+ /**
7576
+ * The user's last message before the save, as the transcript holds it, or the prompt
7577
+ * captured when the flow took the lock if the transcript has no user message. Pre-filled
7578
+ * into the composer on return without the line naming any files: the files stay on the
7579
+ * transcript message and are not put back in the composer.
7580
+ */
7303
7581
  prompt?: string;
7304
7582
  };
7305
7583
  }
@@ -7366,6 +7644,16 @@ export declare function registerTieredAIProviders(container: Container, options:
7366
7644
  */
7367
7645
  export declare const REQUEST_CONTINUATION_TOOL = "request_continuation";
7368
7646
 
7647
+ /**
7648
+ * Ask the person for permission to show notifications, and resolve to the result. Call it from a
7649
+ * click or key handler: browsers ignore or refuse a request that does not come from the person.
7650
+ * Resolves straight away when permission is already decided or unsupported, since a browser only
7651
+ * ever asks once.
7652
+ *
7653
+ * @beta
7654
+ */
7655
+ export declare function requestAgentNotificationPermission(): Promise<AgentNotificationPermission>;
7656
+
7369
7657
  /** Resolved context-headroom thresholds for the active model. */
7370
7658
  declare interface ResolvedContextBudget {
7371
7659
  /**
@@ -7717,6 +8005,11 @@ export declare interface SessionPreferences {
7717
8005
  * Absent keeps the `chatConfig.ui.showTimestamps` default, which is `'always'`.
7718
8006
  */
7719
8007
  timestampDisplay?: string;
8008
+ /**
8009
+ * The agent notification level (`AgentNotificationLevel` values, as plain strings). Absent
8010
+ * means `'off'`: unlike the other preferences, no config default can switch it on.
8011
+ */
8012
+ notificationLevel?: string;
7720
8013
  /** Enabled loading-animation ids (`AiAssistantAnimation` values, as plain strings). */
7721
8014
  animations?: string[];
7722
8015
  }
@@ -8054,7 +8347,7 @@ export declare interface StatefulAgentInit<S> {
8054
8347
  * directly: `resumable: ({ state }) => state.machine.state !== 'confirm'`.
8055
8348
  * Return `false` for a point that shouldn't resume — the session isn't persisted,
8056
8349
  * and on return the assistant shows {@link StatefulAgentInit.notResumableMessage}
8057
- * (or a default) and pre-fills the composer with the prompt that started the flow.
8350
+ * (or a default) and pre-fills the composer with the user's last message.
8058
8351
  * Only consulted with persistence enabled; a thrown error is treated as `true`
8059
8352
  * (fail-safe — never drop a resumable chat on a predicate bug).
8060
8353
  */
@@ -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,