@genesislcap/ai-assistant 15.81.0 → 15.83.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 (110) hide show
  1. package/dist/ai-assistant.api.json +2800 -116
  2. package/dist/ai-assistant.d.ts +887 -109
  3. package/dist/chat-driver.cjs +468 -107
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +468 -107
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +1108 -61
  8. package/dist/dts/autopilot/autopilot-driver.d.ts +117 -11
  9. package/dist/dts/autopilot/autopilot-driver.d.ts.map +1 -1
  10. package/dist/dts/autopilot/autopilot-session.d.ts +55 -7
  11. package/dist/dts/autopilot/autopilot-session.d.ts.map +1 -1
  12. package/dist/dts/autopilot/autopilot-tools.d.ts +3 -2
  13. package/dist/dts/autopilot/autopilot-tools.d.ts.map +1 -1
  14. package/dist/dts/autopilot/decision-message.d.ts +35 -3
  15. package/dist/dts/autopilot/decision-message.d.ts.map +1 -1
  16. package/dist/dts/autopilot/hand-back/hand-back.controller.d.ts +2 -2
  17. package/dist/dts/autopilot/hand-back/hand-back.controller.d.ts.map +1 -1
  18. package/dist/dts/autopilot/hand-back/hand-back.d.ts +2 -2
  19. package/dist/dts/autopilot/hand-back/hand-back.d.ts.map +1 -1
  20. package/dist/dts/autopilot/index.d.ts +1 -0
  21. package/dist/dts/autopilot/index.d.ts.map +1 -1
  22. package/dist/dts/autopilot/widget-tools.d.ts +95 -0
  23. package/dist/dts/autopilot/widget-tools.d.ts.map +1 -0
  24. package/dist/dts/channel/ai-activity-channel.d.ts +10 -0
  25. package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
  26. package/dist/dts/components/agent-session/agent-session.d.ts +2 -1
  27. package/dist/dts/components/agent-session/agent-session.d.ts.map +1 -1
  28. package/dist/dts/components/ai-driver/ai-driver.d.ts +25 -6
  29. package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
  30. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts +2 -0
  31. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts.map +1 -1
  32. package/dist/dts/components/chat-driver/chat-driver.d.ts +14 -2
  33. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  34. package/dist/dts/components/chat-driver/interaction-controller.d.ts +61 -17
  35. package/dist/dts/components/chat-driver/interaction-controller.d.ts.map +1 -1
  36. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +6 -0
  37. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  38. package/dist/dts/config/config.d.ts +31 -6
  39. package/dist/dts/config/config.d.ts.map +1 -1
  40. package/dist/dts/config/define-stateful-agent.d.ts +5 -1
  41. package/dist/dts/config/define-stateful-agent.d.ts.map +1 -1
  42. package/dist/dts/index.d.ts +4 -2
  43. package/dist/dts/index.d.ts.map +1 -1
  44. package/dist/dts/main/main.d.ts +33 -16
  45. package/dist/dts/main/main.d.ts.map +1 -1
  46. package/dist/dts/main/main.template.d.ts.map +1 -1
  47. package/dist/dts/main/main.types.d.ts +15 -0
  48. package/dist/dts/main/main.types.d.ts.map +1 -1
  49. package/dist/dts/notifications/agent-notifications.d.ts +6 -2
  50. package/dist/dts/notifications/agent-notifications.d.ts.map +1 -1
  51. package/dist/dts/notifications/agent-notifier.d.ts +26 -4
  52. package/dist/dts/notifications/agent-notifier.d.ts.map +1 -1
  53. package/dist/dts/state/decision-surface.d.ts +22 -4
  54. package/dist/dts/state/decision-surface.d.ts.map +1 -1
  55. package/dist/dts/state/interaction-context.d.ts +23 -4
  56. package/dist/dts/state/interaction-context.d.ts.map +1 -1
  57. package/dist/dts/state/interaction-registry.d.ts +55 -6
  58. package/dist/dts/state/interaction-registry.d.ts.map +1 -1
  59. package/dist/dts/state/live-interactions.d.ts +28 -0
  60. package/dist/dts/state/live-interactions.d.ts.map +1 -0
  61. package/dist/dts/state/persistence/session-persister.d.ts +6 -0
  62. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  63. package/dist/dts/state/persistence/session-snapshot.d.ts +16 -5
  64. package/dist/dts/state/persistence/session-snapshot.d.ts.map +1 -1
  65. package/dist/dts/state/test-interaction-context.d.ts +93 -0
  66. package/dist/dts/state/test-interaction-context.d.ts.map +1 -0
  67. package/dist/dts/types/ai-chat-widget.d.ts +7 -6
  68. package/dist/dts/types/ai-chat-widget.d.ts.map +1 -1
  69. package/dist/dts/types/interaction-context.d.ts +128 -17
  70. package/dist/dts/types/interaction-context.d.ts.map +1 -1
  71. package/dist/dts/types/interaction-interceptor.d.ts +48 -6
  72. package/dist/dts/types/interaction-interceptor.d.ts.map +1 -1
  73. package/dist/dts/types/interaction-surface.d.ts +145 -23
  74. package/dist/dts/types/interaction-surface.d.ts.map +1 -1
  75. package/dist/dts/utils/delegated-message.d.ts +7 -0
  76. package/dist/dts/utils/delegated-message.d.ts.map +1 -1
  77. package/dist/esm/autopilot/autopilot-driver.js +313 -60
  78. package/dist/esm/autopilot/autopilot-session.js +219 -40
  79. package/dist/esm/autopilot/autopilot-tools.js +11 -7
  80. package/dist/esm/autopilot/decision-message.js +105 -26
  81. package/dist/esm/autopilot/hand-back/hand-back.controller.js +2 -1
  82. package/dist/esm/autopilot/index.js +1 -0
  83. package/dist/esm/autopilot/widget-tools.js +39 -0
  84. package/dist/esm/components/agent-session/agent-session.js +3 -2
  85. package/dist/esm/components/ai-driver/base-driver-decorator.js +17 -0
  86. package/dist/esm/components/chat-driver/chat-driver.js +18 -2
  87. package/dist/esm/components/chat-driver/interaction-controller.js +232 -71
  88. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +14 -6
  89. package/dist/esm/components/settings-modal/settings-modal.template.js +2 -2
  90. package/dist/esm/config/define-stateful-agent.js +22 -1
  91. package/dist/esm/index.js +2 -0
  92. package/dist/esm/main/main.js +88 -35
  93. package/dist/esm/main/main.template.js +4 -1
  94. package/dist/esm/notifications/agent-notifications.js +11 -1
  95. package/dist/esm/notifications/agent-notifier.js +41 -7
  96. package/dist/esm/state/debug-event-log.js +6 -6
  97. package/dist/esm/state/decision-surface.js +137 -54
  98. package/dist/esm/state/interaction-context.js +41 -8
  99. package/dist/esm/state/interaction-registry.js +11 -0
  100. package/dist/esm/state/live-interactions.js +36 -0
  101. package/dist/esm/state/persistence/session-persister.js +55 -18
  102. package/dist/esm/state/persistence/session-snapshot.js +2 -2
  103. package/dist/esm/state/test-interaction-context.js +99 -0
  104. package/docs/notifications.md +55 -5
  105. package/docs/styling.md +33 -0
  106. package/package.json +19 -19
  107. package/sandbox/README.md +3 -2
  108. package/sandbox/autopilot.ts +26 -6
  109. package/sandbox/sandbox.ts +2 -0
  110. /package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +0 -0
@@ -0,0 +1,99 @@
1
+ import { __awaiter } from "tslib";
2
+ import { createInteractionContext } from './interaction-context';
3
+ /**
4
+ * Build a real interaction context for a controller test (GENC-1660), so the test exercises the
5
+ * platform's own context — its `state`, `once`, `notify`, surfaces and their checks — rather than a
6
+ * hand-built fake that can drift from it. Nothing renders, nothing is persisted, and no driver is
7
+ * involved: resolving records the result, and the interaction is disposed as it would be.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const t = createTestInteractionContext<ReviewController, ReviewResult>({
12
+ * data: { round: 1 },
13
+ * controller: (data, ctx) => new ReviewController(data as ReviewData, ctx),
14
+ * });
15
+ * t.setHeldBy('autopilot');
16
+ * await t.act('regenerate', { text: 'amounts in EUR' });
17
+ * assert.equal(t.result?.payload, { action: 'regenerate', instructions: 'amounts in EUR' });
18
+ * ```
19
+ *
20
+ * @beta
21
+ */
22
+ export function createTestInteractionContext(options = {}) {
23
+ var _a;
24
+ let result;
25
+ let resolvedItself = false;
26
+ let notifications = 0;
27
+ const attention = [];
28
+ // Settled through the platform's own `resolve`, which settles once; disposed as the driver would.
29
+ const live = createInteractionContext((_a = options.interactionId) !== null && _a !== void 0 ? _a : 'test-interaction', {
30
+ resolve: (value, how) => {
31
+ result = value;
32
+ resolvedItself = (how === null || how === void 0 ? void 0 : how.resolvedItself) === true;
33
+ live.dispose();
34
+ },
35
+ checkpoint: options.checkpoint,
36
+ saveCheckpoint: () => undefined,
37
+ requestAttention: (message) => {
38
+ attention.push(message === undefined ? {} : { message });
39
+ },
40
+ });
41
+ const context = live.context;
42
+ live.context.subscribe(() => {
43
+ notifications += 1;
44
+ });
45
+ let controller;
46
+ if (options.controller) {
47
+ controller = options.controller(options.data, context);
48
+ live.setController(controller);
49
+ }
50
+ // Offered to nobody: the person holds it, as with no claimant, so attention can report.
51
+ live.markOffered();
52
+ return {
53
+ context,
54
+ get controller() {
55
+ return controller;
56
+ },
57
+ get result() {
58
+ return result;
59
+ },
60
+ get resolvedItself() {
61
+ return resolvedItself;
62
+ },
63
+ get notifications() {
64
+ return notifications;
65
+ },
66
+ get attention() {
67
+ return attention;
68
+ },
69
+ get surface() {
70
+ return live.surface;
71
+ },
72
+ setHeldBy(holder) {
73
+ live.setHeldBy(holder);
74
+ },
75
+ act(action, args) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const surface = live.surface;
78
+ if (!surface)
79
+ return { ok: false, error: 'no-surface', message: 'Nothing exposed yet.' };
80
+ const prepared = surface.prepare(action, args);
81
+ if ('error' in prepared)
82
+ return Object.assign({ ok: false }, prepared);
83
+ const before = result;
84
+ let output;
85
+ try {
86
+ output = yield prepared.run();
87
+ }
88
+ catch (e) {
89
+ return { ok: false, error: 'threw', message: e instanceof Error ? e.message : String(e) };
90
+ }
91
+ const finished = before === undefined && result !== undefined;
92
+ return Object.assign({ ok: true, finished }, (output !== undefined && !finished ? { output } : {}));
93
+ });
94
+ },
95
+ dispose() {
96
+ live.dispose();
97
+ },
98
+ };
99
+ }
@@ -18,12 +18,40 @@ The person picks one level. Each includes the one before it.
18
18
  |---|---|---|
19
19
  | `'off'` | Off | Never. The default. |
20
20
  | `'autopilot'` | Autopilot | The autopilot hands something back to the person, or stops working. |
21
- | `'needs-input'` | Always (On, without the autopilot level) | Every `'autopilot'` case, plus any widget that asks for the person's attention. |
21
+ | `'needs-input'` | Always (On, without the autopilot level) | Every `'autopilot'` case, plus any widget that asks for the person's attention, and every turn that ends with the assistant waiting for the person to type. |
22
22
 
23
23
  "Stops working" means anything that leaves the autopilot idle without the person having paused it: its flow ending, a turn ending with nothing left for it to answer, or a wall such as the budget. A pause the person makes themselves never notifies.
24
24
 
25
+ "Waiting for the person to type" means a turn ended, and the composer is theirs again:
26
+
27
+ - The turn ran to its end, a failed turn included. A turn the person stopped themselves never notifies.
28
+ - Nothing else waits on them: no interaction is open. An open one reports itself, when its widget asks for attention or the autopilot hands it back, so one moment never notifies twice.
29
+ - No autopilot is running for the flow. A running one answers, hands back or reports its own stop. A paused or unavailable autopilot, or none, does not stop the report.
30
+
31
+ Sub-agents' turns never count: they run inside a turn of the agent that called them.
32
+
25
33
  The type is `AgentNotificationLevel`.
26
34
 
35
+ ### When a hand-back notifies
36
+
37
+ The autopilot hands a widget to the person in two ways: it may not answer the widget (its policy keeps it for the person, it is `userOnly`, or it has no controller), or it took the widget and then gave it back.
38
+
39
+ A widget it may not answer notifies only once the widget is waiting on the person. The first three rules are the ones the status line uses for "Waiting for your answer":
40
+
41
+ - A widget whose controller says it is working (`ctx.setWorking(true)`) is not waiting.
42
+ - A widget registered `resolvesItself` is not waiting, unless its controller says it is asking (`ctx.setWorking(false)`).
43
+ - Any other widget is waiting.
44
+ - A widget that asks for attention (`requestAttention`) is waiting, whatever the rules above say.
45
+
46
+ The notification comes a quarter of a second after the widget starts waiting, if it is still waiting then and the person still holds it. So:
47
+
48
+ - A widget that settles by itself as it mounts never notifies. Register such a widget `resolvesItself`, because a hidden tab does not render it until the person comes back.
49
+ - A widget that works first, such as a review that runs its steps and then asks, notifies when it starts asking, with its own message. It can call `setWorking(false)` and `requestAttention(message)` in either order.
50
+ - A widget that settles while it is still working never notifies. Neither does one that a claimant takes first.
51
+ - A widget that asked for attention while the autopilot was paused was reported then. When Resume leaves it with the person, it does not notify again.
52
+
53
+ A widget the autopilot took and then gave back notifies at once. The autopilot gave it back because it needs the person, so the "needs you" badge shows too.
54
+
27
55
  ---
28
56
 
29
57
  ## App configuration
@@ -67,16 +95,20 @@ registerInteraction('pick-template', {
67
95
  });
68
96
  ```
69
97
 
70
- Call it at the moment the widget starts waiting on the person. A widget that has work to do first (loading data, running steps) calls it when its question is ready, not when it opens.
98
+ Call it at the moment the widget starts waiting on the person. A widget that has work to do first (loading data, running steps) calls it when its question is ready, not when it opens. A controller typed against `ControllerHost` rather than the full `InteractionContext` calls it on its host, the same way: `host.requestAttention?.('Your functional tests are ready to review')`. It is optional there because a stand-in host has none.
71
99
 
72
100
  The widget never has to check who holds the interaction. The platform handles that:
73
101
 
74
102
  - The call is reported only once the platform has decided who holds the interaction, so calling it from the controller's constructor is safe, even though the autopilot has not been offered the interaction yet.
75
- - If the autopilot holds the interaction, at that point or when the widget calls, nothing is reported. If the autopilot hands it back, the hand-back notifies instead, so the person gets one notification.
103
+ - If the autopilot holds the interaction, at that point or when the widget calls, nothing is reported. If the autopilot hands it back, the hand-back notifies instead, with the widget's message, so the person gets one notification in the widget's words.
104
+ - If the autopilot may not answer the interaction, the hand-back is its only notification, whenever the widget calls. The call only tells the autopilot that the widget is asking, and gives the hand-back its message (see [When a hand-back notifies](#when-a-hand-back-notifies)). A widget that has said nothing about working counts as asking from the start, so a message it asks with later than a quarter of a second after it opens comes too late to be used. If it has work to do first, it calls `setWorking(true)` until its question is ready.
105
+ - If the widget calls only after the autopilot took it and then handed it back, its call is reported as usual. The hand-back's notification keeps its tag, and only its text changes to the widget's message (see [Duplicates](#duplicates)).
76
106
  - Only the first call counts, whatever happened to it. A widget gets at most one notification for its whole life.
77
107
 
78
108
  The text is the first of: the argument, `chatConfig.ui.notifications.message`, the default. Only the `'needs-input'` level shows these.
79
109
 
110
+ In a controller test, `createTestInteractionContext(...).attention` lists the calls that were reported, by the same rules: the first call only, and none while a claimant holds the interaction (`setHeldBy('autopilot')`). The test context has no claimant at the start, so a call made while the controller is built is reported as the person's.
111
+
80
112
  ---
81
113
 
82
114
  ## Inviting the person to switch notifications on
@@ -151,19 +183,37 @@ Every report is published as `agent-attention` on the activity bus, whatever the
151
183
  ```ts
152
184
  agenticActivityBus.subscribe('agent-attention', (detail) => {
153
185
  // detail: { sessionKey, kind, interactionId?, message? }
154
- // kind: 'widget-needs-input' | 'autopilot-handed-back' | 'autopilot-stopped'
186
+ // kind: 'widget-needs-input' | 'autopilot-handed-back' | 'autopilot-stopped' | 'turn-ended'
155
187
  });
156
188
  ```
157
189
 
190
+ | Kind | Reported when | Shown at |
191
+ |---|---|---|
192
+ | `'widget-needs-input'` | A widget asked for the person's attention, while the person holds it. | `'needs-input'` |
193
+ | `'autopilot-handed-back'` | The autopilot handed an interaction to the person, or a turn of its own. For a widget it may not answer, only once the widget waits on the person (see [When a hand-back notifies](#when-a-hand-back-notifies)). Carries the widget's message when it asked with one. | `'autopilot'` and above |
194
+ | `'autopilot-stopped'` | The autopilot stopped working without the person pausing it. | `'autopilot'` and above |
195
+ | `'turn-ended'` | A turn ended with the assistant waiting for the person to type (see [Levels](#levels)). | `'needs-input'` |
196
+
158
197
  The assistant for that session decides whether to show a notification. An app can listen to the same event to drive its own UI. The event is tab-local: it comes from the window that owns the session's driver.
159
198
 
160
199
  Clicking a notification focuses the window and publishes `autopilot-show-waiting` for the session: a closed chat bubble holding that assistant opens, and the assistant brings what waits on the person into view.
161
200
 
201
+ When an interaction stops waiting on the person, `agent-attention-ended` is published, whether a notification was shown for it or not:
202
+
203
+ ```ts
204
+ agenticActivityBus.subscribe('agent-attention-ended', ({ sessionKey, interactionId }) => {
205
+ // The interaction settled, or a claimant (such as the autopilot, on Resume) took it.
206
+ });
207
+ ```
208
+
209
+ The assistant for that session closes the interaction's notification, if it is still showing. The event is tab-local too.
210
+
162
211
  ---
163
212
 
164
213
  ## Duplicates
165
214
 
166
215
  - Each notification carries a tag. The browser replaces a notification with the same tag rather than stacking copies.
167
216
  - One interaction gets one tag, whichever report it came from: the autopilot handing it back, or the widget asking for attention.
168
- - The autopilot's other reports share one tag per session.
217
+ - Every report without an interaction shares one tag per session: the autopilot's stop, and a turn ending. The turn that ends a flow can make both at once, and the person gets one notification.
169
218
  - The same tag is not shown again within a few seconds.
219
+ - A notification for an interaction closes when the interaction stops waiting on the person: it settles, or a claimant takes it. Its tag is then forgotten, so if the claimant hands the interaction back, that notifies again. A notification without an interaction (a stop, or a turn ending) is not closed this way.
package/docs/styling.md CHANGED
@@ -292,6 +292,39 @@ Styling `::part(send-button)` alone will **not** achieve this: the design-system
292
292
  button paints its own background over any gradient set on it, so the gradient has
293
293
  to come from behind. The shell is that behind.
294
294
 
295
+ ### The autopilot
296
+
297
+ While an agent's autopilot is available (GENC-1660), the composer gains an
298
+ **Autopilot** pill, and while it runs and something is happening a slim bar takes
299
+ the composer's place. A widget the autopilot hands back carries a banner in its
300
+ own bubble.
301
+
302
+ | Part | Element |
303
+ | --- | --- |
304
+ | `autopilot-bar` | The slim bar that stands in for the composer |
305
+ | `autopilot-status` | Its one-line status, e.g. "Building from your plan…", or "Waiting for your answer" while the person holds an open question |
306
+ | `autopilot-bar-end` | The trailing cluster: the pill, and Stop while a turn runs |
307
+ | `autopilot-toggle` | The Autopilot pill, on or off, in the composer or the slim bar |
308
+ | `autopilot-toggle-on` | That pill, only while it is on (running, and not waiting on an answer it handed back) |
309
+ | `autopilot-banner` | The hand-back banner at the top of a handed-back widget's bubble |
310
+ | `autopilot-banner-text` | Its text: the lead and the reason |
311
+ | `autopilot-keep-paused` | Its **Keep paused** button |
312
+ | `autopilot-announcer` | The visually hidden status region that announces changes |
313
+ | `delegate-mark` | The autopilot mark beside the sender of anything done on the person's behalf |
314
+
315
+ **Use `autopilot-toggle-on` for the on state.** Its default fill is the accent
316
+ gradient, the same as the person's own bubble. `::part()` cannot select a class
317
+ or an attribute, so `autopilot-toggle` alone reaches the pill whether on or
318
+ off; the second name is how the on state is reached. To keep it matching a
319
+ restyled user bubble:
320
+
321
+ ```css
322
+ foundation-ai-assistant::part(message-user),
323
+ foundation-ai-assistant::part(autopilot-toggle-on) {
324
+ background: var(--user-msg-bubble);
325
+ }
326
+ ```
327
+
295
328
  ### The settings-modal budget meter
296
329
 
297
330
  The per-vendor AI budget meter (GENC-1464) renders in the settings modal's
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@genesislcap/ai-assistant",
3
3
  "description": "Genesis AI Assistant micro-frontend",
4
- "version": "15.81.0",
4
+ "version": "15.83.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
- "types": "dist/ai-assistant.d.ts",
7
+ "types": "dist/dts/index.d.ts",
8
8
  "config": {
9
9
  "PORT": 5099
10
10
  },
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "exports": {
22
22
  ".": {
23
- "types": "./dist/ai-assistant.d.ts",
23
+ "types": "./dist/dts/index.d.ts",
24
24
  "default": "./dist/esm/index.js"
25
25
  },
26
26
  "./config": {
@@ -92,31 +92,31 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@genesislcap/foundation-comms": "15.81.0",
96
- "@genesislcap/foundation-testing": "15.81.0",
97
- "@genesislcap/genx": "15.81.0",
98
- "@genesislcap/ts-builder": "15.81.0",
99
- "@genesislcap/uvu-playwright-builder": "15.81.0",
100
- "@genesislcap/vite-builder": "15.81.0",
101
- "@genesislcap/webpack-builder": "15.81.0",
95
+ "@genesislcap/foundation-comms": "15.83.0",
96
+ "@genesislcap/foundation-testing": "15.83.0",
97
+ "@genesislcap/genx": "15.83.0",
98
+ "@genesislcap/ts-builder": "15.83.0",
99
+ "@genesislcap/uvu-playwright-builder": "15.83.0",
100
+ "@genesislcap/vite-builder": "15.83.0",
101
+ "@genesislcap/webpack-builder": "15.83.0",
102
102
  "@types/dompurify": "^3.0.5",
103
103
  "@types/marked": "^5.0.2",
104
104
  "esbuild": "0.25.12"
105
105
  },
106
106
  "dependencies": {
107
- "@genesislcap/foundation-ai": "15.81.0",
108
- "@genesislcap/foundation-logger": "15.81.0",
109
- "@genesislcap/foundation-notifications": "15.81.0",
110
- "@genesislcap/foundation-redux": "15.81.0",
111
- "@genesislcap/foundation-ui": "15.81.0",
112
- "@genesislcap/foundation-utils": "15.81.0",
113
- "@genesislcap/rapid-design-system": "15.81.0",
114
- "@genesislcap/web-core": "15.81.0",
107
+ "@genesislcap/foundation-ai": "15.83.0",
108
+ "@genesislcap/foundation-logger": "15.83.0",
109
+ "@genesislcap/foundation-notifications": "15.83.0",
110
+ "@genesislcap/foundation-redux": "15.83.0",
111
+ "@genesislcap/foundation-ui": "15.83.0",
112
+ "@genesislcap/foundation-utils": "15.83.0",
113
+ "@genesislcap/rapid-design-system": "15.83.0",
114
+ "@genesislcap/web-core": "15.83.0",
115
115
  "dompurify": "^3.3.1",
116
116
  "marked": "^17.0.3"
117
117
  },
118
118
  "peerDependencies": {
119
- "@genesislcap/foundation-comms": "^15.81.0"
119
+ "@genesislcap/foundation-comms": "^15.83.0"
120
120
  },
121
121
  "peerDependenciesMeta": {
122
122
  "@genesislcap/foundation-comms": {
package/sandbox/README.md CHANGED
@@ -187,13 +187,14 @@ Two stand-ins, both in `autopilot.ts`, and both reaching the element through its
187
187
  | Control | What to look for |
188
188
  | --- | --- |
189
189
  | **Mode: Unavailable** | Today's UI, unchanged. Nothing autopilot-shaped anywhere. |
190
- | **Mode: Running** | While something is happening — **Simulated state: Busy**, or the demo widget open and held by the autopilot — the slim bar replaces the composer: the status, then the **Autopilot** pill on the right — filled like your own bubble while it is on, with the mark as its glyph and "Pause autopilot: …" as its tooltip — and **Stop** while busy. No text box, so nothing can be typed by accident. Idle (the state as it is after a wall such as the budget), the normal composer comes back with the pill filled among its pills, and no status. |
190
+ | **Mode: Running** | While something is happening — **Simulated state: Busy**, or the demo widget open and held by the autopilot — the slim bar replaces the composer: the status, then the **Autopilot** pill on the right — filled like your own bubble while it is on (and answering to the extra part name `autopilot-toggle-on`), with the mark as its glyph and "Pause autopilot: …" as its tooltip — and **Stop** while busy. No text box, so nothing can be typed by accident. Idle (the state as it is after a wall such as the budget), the normal composer comes back with the pill filled among its pills, and no status. |
191
191
  | **Mode: Paused** | With **Agent hides the composer while working** on and the state Busy, the slim bar again, reading "Paused" with the pill unfilled. Turn the toggle off (or go idle) and the normal composer comes back with the pill after the agent picker, among the other pills — the autopilot never forces the composer open. |
192
192
  | **Hide composer** + **Mode: Running** or **Paused** | A host with no composer has no pills to put the **Autopilot** pill among, so the slim bar stays up whenever the autopilot is available — idle or not, running or paused — with its status and the pill, so the person can always see it is on and pause or resume it. |
193
193
  | **Mode: Self-paused** | With the state Busy, the slim bar reads "Waiting for your answer…" with the pill unfilled; its tooltip leads with "Resume autopilot and force it to decide this one". Open the demo widget: its bubble carries the banner, "I need your input on this one: …", with **Keep paused**. |
194
194
  | **Open the demo widget**, held by the autopilot | **Hidden** registration: no bubble at all, just the working indicator. **Visible**: the bubble stays and only its button goes, with a line saying the claimant holds it. |
195
195
  | **Held by: The person** | The widget comes back with its button, exactly as today. Press it to see the answered state. |
196
- | **Seed: Autopilot: delegated messages** | Narration before an answered widget, the "I chose" echo, and a written answer given on the user's behalf — every one on the assistant's side, with the mark beside the sender. **Delegated mark: None** removes the mark and nothing else. |
196
+ | **Mode: Running** + **Simulated state: Busy** + the demo widget open, **Held by: The person** | The slim bar reads "Waiting for your answer" (`waitingForUser`) rather than the running status: the working agent is parked on a question the autopilot never took, so the person is the one being waited on. The pill stays on, since nothing paused, and no "needs you" badge, since the autopilot did not stop. Press the button, or hand it back to the autopilot, and the running status returns. |
197
+ | **Seed: Autopilot: delegated messages** | Narration before an answered widget (with no echo after it: the narration already said what was chosen), the "I chose" echo after a widget answered without narration, and a written answer given on the user's behalf — every one on the assistant's side, with the mark beside the sender. **Delegated mark: None** removes the mark and nothing else. |
197
198
  | **Needs you** + **Show the collapsed bubble** | A badge on the orb, bottom right. Self-paused raises it too. |
198
199
 
199
200
  The **Element** readout is read off the element, not the panel: who holds the trailing interaction,
@@ -29,6 +29,7 @@ const COPY: AutopilotCopy = {
29
29
  running: 'Building from your plan…',
30
30
  paused: 'Paused',
31
31
  selfPaused: "Waiting for your answer: I'll carry on after this",
32
+ waitingForUser: 'Waiting for your answer',
32
33
  handBackLead: 'I need your input on this one:',
33
34
  toggleLabel: 'Autopilot',
34
35
  description: "Answers the assistant's questions on your behalf, so the work keeps going.",
@@ -72,6 +73,11 @@ export class SandboxAutopilotHost implements AutopilotHost {
72
73
  * simulated state and the demo widget. Running and idle, the composer comes back.
73
74
  */
74
75
  private readonly working: () => boolean,
76
+ /**
77
+ * Whether the person holds an open question, as the real driver tracks it: the demo widget open
78
+ * and held by the person. Running, the status then says so.
79
+ */
80
+ private readonly waitingOnUser: () => boolean,
75
81
  ) {}
76
82
 
77
83
  get state(): AutopilotHostState {
@@ -85,9 +91,11 @@ export class SandboxAutopilotHost implements AutopilotHost {
85
91
  'self-paused': 'running',
86
92
  } as const
87
93
  )[this.mode];
88
- const status =
89
- this.status ||
90
- (selfPaused ? COPY.selfPaused : this.mode === 'running' ? COPY.running : COPY.paused);
94
+ let status = COPY.paused;
95
+ if (selfPaused) status = COPY.selfPaused;
96
+ else if (this.mode === 'running') {
97
+ status = this.waitingOnUser() ? COPY.waitingForUser : COPY.running;
98
+ }
91
99
  return {
92
100
  mode,
93
101
  ...(selfPaused
@@ -101,7 +109,7 @@ export class SandboxAutopilotHost implements AutopilotHost {
101
109
  : this.mode === 'paused'
102
110
  ? { pause: { scope: 'until-resumed' as const } }
103
111
  : {}),
104
- status: this.mode === 'off' ? '' : status,
112
+ status: this.mode === 'off' ? '' : this.status || status,
105
113
  needsUser: this.needsUser || selfPaused,
106
114
  working: this.mode !== 'off' && this.working(),
107
115
  };
@@ -319,8 +327,9 @@ export const openDemoWidget = (driver: AiDriver): void => {
319
327
 
320
328
  /**
321
329
  * Each kind of delegated message: narration before a widget the autopilot answered, the "I chose"
322
- * echo, and a written answer given on the user's behalf. All render as the assistant, with the mark.
323
- * Unstamped: the fixtures stamp it like every other seed.
330
+ * echo after one it answered without narration, and a written answer given on the user's behalf.
331
+ * All render as the assistant, with the mark. A widget answered with narration has no echo: the
332
+ * narration already said what was chosen. Unstamped: the fixtures stamp it like every other seed.
324
333
  */
325
334
  export const autopilotTranscript = (): ChatMessage[] => [
326
335
  { role: 'user', content: 'Build me a trade blotter from my plan.' },
@@ -341,6 +350,17 @@ export const autopilotTranscript = (): ChatMessage[] => [
341
350
  answeredBy: 'autopilot',
342
351
  },
343
352
  },
353
+ {
354
+ role: 'assistant',
355
+ content: '',
356
+ interaction: {
357
+ interactionId: 'sandbox-answered-quietly',
358
+ componentName: DEMO_WIDGET,
359
+ data: { question: 'Which actions should the blotter offer?', label: 'Approve, Reject' },
360
+ resolved: { status: 'approved', payload: { pressed: true } },
361
+ answeredBy: 'autopilot',
362
+ },
363
+ },
344
364
  {
345
365
  role: 'assistant',
346
366
  content: 'I chose: Approve trade, Reject trade',
@@ -611,6 +611,8 @@ const applyAutopilot = (s: SandboxState): void => {
611
611
  state.runtime === 'loading' ||
612
612
  state.runtime === 'cancelling' ||
613
613
  (state.demoHeldBy === 'autopilot' && !!demoClaimant?.pendingId()),
614
+ // Waiting on the person, as the real driver says it: the demo widget is open and they hold it.
615
+ () => state.demoHeldBy === 'user' && !!demoClaimant?.pendingId(),
614
616
  );
615
617
  autopilotHost.update(s.autopilotMode, s.autopilotStatus, s.autopilotNeedsUser);
616
618
  const host = s.autopilotMode === 'off' ? undefined : autopilotHost;