@artooi/ag-ui-web-component 0.42.0 → 0.44.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 (39) hide show
  1. package/CHANGELOG.md +161 -1
  2. package/README.md +88 -22
  3. package/dist/ag-ui-web-component.bundle.js +74 -74
  4. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  5. package/dist/constants.d.ts +12 -4
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/core/ag_ui_chat.d.ts +36 -8
  8. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  9. package/dist/core/agui_client.d.ts +27 -2
  10. package/dist/core/agui_client.d.ts.map +1 -1
  11. package/dist/core/events/feedback_detail.d.ts +21 -0
  12. package/dist/core/events/feedback_detail.d.ts.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +317 -139
  16. package/dist/index.js.map +4 -4
  17. package/dist/tools/tool_dispatch.d.ts +11 -1
  18. package/dist/tools/tool_dispatch.d.ts.map +1 -1
  19. package/dist/ui/composer/voice_input.d.ts +2 -2
  20. package/dist/ui/composer/voice_input.d.ts.map +1 -1
  21. package/dist/ui/history/conversation_history.d.ts +40 -24
  22. package/dist/ui/history/conversation_history.d.ts.map +1 -1
  23. package/dist/ui/transcript/answer_actions.d.ts +12 -3
  24. package/dist/ui/transcript/answer_actions.d.ts.map +1 -1
  25. package/dist/ui/ui_strings.d.ts +5 -0
  26. package/dist/ui/ui_strings.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/constants.ts +12 -4
  29. package/src/core/ag_ui_chat.ts +127 -35
  30. package/src/core/agui_client.ts +43 -3
  31. package/src/core/events/feedback_detail.ts +21 -0
  32. package/src/core/run_handlers.ts +2 -2
  33. package/src/index.ts +1 -0
  34. package/src/tools/tool_dispatch.ts +40 -4
  35. package/src/ui/composer/voice_input.ts +57 -23
  36. package/src/ui/history/conversation_history.ts +117 -35
  37. package/src/ui/transcript/answer_actions.ts +31 -3
  38. package/src/ui/ui_strings.ts +6 -0
  39. package/src/version.ts +1 -1
@@ -46,6 +46,13 @@ export interface ToolDispatchHost {
46
46
  * one the element serves.
47
47
  */
48
48
  readonly tenure: () => object;
49
+ /**
50
+ * The conversation on screen: an identity the element replaces every time it
51
+ * clears the transcript for another conversation, a handover included. Only
52
+ * ever compared, so a call can tell whether the conversation it was
53
+ * dispatched in is still the one it would draw into.
54
+ */
55
+ readonly conversation: () => object;
49
56
  }
50
57
  /**
51
58
  * Running the frontend tool calls a round produced, and answering the server's
@@ -87,7 +94,10 @@ export declare class ToolDispatch {
87
94
  * check that it has not. A Stop while the host's predicate is pending ends
88
95
  * the call there, and one while the card is open declines it. A handover
89
96
  * during any of the three leaves the call with no transcript to draw in and
90
- * no store to write to, so it does neither.
97
+ * no store to write to, so it does neither. Any other reset of the
98
+ * conversation -- New chat, a drawer switch, `reload()` -- leaves the call
99
+ * its store and its result but not the transcript, so it still settles and
100
+ * returns, and does not show the run waiting in a conversation it is not in.
91
101
  */
92
102
  execute(call: AgUiToolCall): Promise<ToolExecution | null>;
93
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tool_dispatch.d.ts","sourceRoot":"","sources":["../../src/tools/tool_dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM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AC;IACrC,uDAAuD;IACvD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;IAC1D,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,MAAM,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,qBAAa,YAAY;;IAiBvB,YAAY,IAAI,EAAE,gBAAgB,EAEjC;IAED;;;;;;;;OAQG;IACH,aAAa,IAAI,IAAI,CAEpB;IAED;;;;;;;;OAQG;IACH,YAAY,IAAI,OAAO,EAAE,CAGxB;IAED;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA8P/D;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,iBAAiB,CACrB,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CA+F5C;CAqHF"}
@@ -37,8 +37,8 @@ export declare class VoiceInput {
37
37
  * a detached element.
38
38
  *
39
39
  * Disposal is final: nothing un-disposes an instance, and the host's next
40
- * wiring builds a new one. So the disposed flag alone tells a stale
41
- * continuation from a live one, and a clip already posted when this runs is
40
+ * wiring builds a new one. So the disposed flag alone tells a continuation
41
+ * that outlived the control from a live one, and a clip already posted when this runs is
42
42
  * dropped whenever its answer arrives.
43
43
  */
44
44
  dispose(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"voice_input.d.ts","sourceRoot":"","sources":["../../../src/ui/composer/voice_input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAoBt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O,IAAI,IAAI,CAQd;CAiFF"}
@@ -88,16 +88,21 @@ export interface ConversationHistoryHost {
88
88
  readonly releaseClient: () => void;
89
89
  /**
90
90
  * Whether an interaction is in flight, which the composer owns: from the
91
- * moment a send or a retry is taken, or a restore that will resume a run
92
- * starts loading, not only once its run has started.
91
+ * moment a send or a retry is taken, or a restore starts loading, not only
92
+ * once its run has started.
93
93
  */
94
94
  readonly running: () => boolean;
95
95
  /**
96
- * Hold the composer as a send holds it from the moment it is taken: a send
97
- * refuses, the built-in Send parks its turn, a Retry and a pick refuse. Let
98
- * go of when the run starts, by a Stop, or by {@link RunHold.release}.
96
+ * Hold the composer as a send holds it from the moment it is taken: the
97
+ * built-in Send parks its turn, a Retry and a pick refuse. Let go of when the
98
+ * run starts, by a Stop, or by {@link RunHold.release}.
99
+ *
100
+ * A host's send refuses too, unless `restored` is given: then the hold is a
101
+ * restore's with no run to resume, and a host's send waits for `restored` to
102
+ * settle and sends after it, with the conversation drawn. `restored` settles
103
+ * once that restore has ended, or has been stopped, and never rejects.
99
104
  */
100
- readonly holdRun: () => RunHold;
105
+ readonly holdRun: (restored: Promise<void> | null) => RunHold;
101
106
  /** Stop the in-flight run. */
102
107
  readonly cancelRun: () => void;
103
108
  /** Drop the in-memory run and transcript, leaving the thread untouched. */
@@ -109,8 +114,9 @@ export interface ConversationHistoryHost {
109
114
  * A hold {@link ConversationHistoryHost.holdRun} took.
110
115
  *
111
116
  * It says nothing about whether the restore that took it was stopped. A
112
- * restore asks its generation that, because a restore with no run to resume
113
- * holds nothing and can be stopped all the same -- see
117
+ * restore asks its generation that, because a host's send that waited on a
118
+ * restore with no run to resume takes the hold over from it, and a restore
119
+ * stopped by a newer one finds that one's hold in its place -- see
114
120
  * {@link ConversationHistory.rehydrate}.
115
121
  */
116
122
  interface RunHold {
@@ -226,16 +232,30 @@ export declare class ConversationHistory {
226
232
  * exclusion is held by "resumes with the landed page's result, and its card says
227
233
  * so" in `ag_ui_chat_reload_mid_run.test.ts`.
228
234
  *
229
- * **A restore that resumes holds the composer from before the load.** The
230
- * resume is a run, and it starts only once the store has answered. With a
231
- * remote store that is a real request, and a send, a Retry or a pick in it
232
- * was refused by nothing: each built the conversation's client before the
233
- * conversation had loaded, so a send went out carrying none of it and its
234
- * first save replaced the stored one, and the resume then ran on that same
235
- * client as a second run, answering a call the request no longer held. So
236
- * the composer is held as a send holds it, and the resume gives way to
237
- * nothing: what was typed parks behind the resumed run and goes out after its
238
- * answer, and a host's send or Retry is refused as it is behind any run.
235
+ * **Every restore holds the composer from before the load.** Until the
236
+ * store answers, the conversation's client can only be seeded from nothing.
237
+ * With a remote store that is a real request, and a send, a Retry or a pick
238
+ * in it was refused by nothing: each built the conversation's client before
239
+ * the conversation had loaded, so a send went out carrying none of it, its
240
+ * first save replaced the stored one, and the replay then drew the stored
241
+ * conversation under the new turn. The client stayed cached without it, so
242
+ * every later turn went out without it too. So the composer is held as a
243
+ * send holds it: what was typed parks and goes out after the replay, and a
244
+ * Retry and a pick are refused -- a Retry has nothing on screen to retry, and
245
+ * after the load it would re-ask the previous visit's last question.
246
+ *
247
+ * **A host's send waits for a restore with no run to resume.** It is
248
+ * usually a prompt fired as the element mounts, which no host could time
249
+ * against a load nothing announces, and refusing it would lose the turn.
250
+ * So it waits for this restore to end, taking the hold over as it does,
251
+ * and then sends with the conversation drawn above it; what the built-in
252
+ * Send parked goes out after its run. Stopped while it waits, it is dropped,
253
+ * as a send stopped by its own submit listener is.
254
+ *
255
+ * **A restore that resumes refuses a host's send instead.** The resume is a
256
+ * run, and the restore ends by starting it, so a send that waited would only
257
+ * reach that run and be refused there. The resume gives way to nothing: what
258
+ * was typed parks behind the resumed run and goes out after its answer.
239
259
  *
240
260
  * The other way round, the resume standing down for the send, was rejected.
241
261
  * The send that got in first had already gone out without the conversation,
@@ -248,8 +268,8 @@ export declare class ConversationHistory {
248
268
  * page can each come while the store answers, and from host code the restore
249
269
  * runs itself: the activity and tool renderers each replayed message draws
250
270
  * through, and `navigationResult`. From then on it draws nothing more and
251
- * resumes nothing. The hold cannot say so, because a restore with no run to
252
- * resume holds nothing. So the restore asks its generation, which clearing
271
+ * resumes nothing. The hold cannot say so, because a host's send that
272
+ * waited may hold it by then. So the restore asks its generation, which clearing
253
273
  * the conversation moves on as a newer restore does, and asks it after the
254
274
  * load, after each replayed message -- as a Retry asks after each one -- and
255
275
  * once more before the resume. Stopped by anything but the element leaving
@@ -257,10 +277,6 @@ export declare class ConversationHistory {
257
277
  * for the run it would have resumed -- unless what replaced it is a restore
258
278
  * of the same conversation, still current, which answers for that run
259
279
  * instead; see `#forgetStopped`.
260
- *
261
- * What a restore with no run to resume still does not do is refuse a send
262
- * made while it loads. That send goes out without the stored conversation,
263
- * and its save replaces it.
264
280
  */
265
281
  rehydrate(): Promise<void>;
266
282
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_history.d.ts","sourceRoot":"","sources":["../../../src/ui/history/conversation_history.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB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AAgB,IAAI,IAAI,CAGvB;IAED,6EAA6E;IAC7E,cAAc,IAAI,IAAI,CAgBrB;IASD,+DAA+D;IAC/D,UAAU,IAAI,IAAI,CAOjB;IAED,yEAAyE;IACzE,IAAI,IAAI,QAAQ,GAAG,IAAI,CAatB;IAED,mEAAmE;IACnE,WAAW,IAAI,IAAI,CAQlB;IAED,mEAAmE;IACnE,eAAe,IAAI,IAAI,CAKtB;IAED,0EAA0E;IACpE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlD;IAED,kEAAkE;IAClE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGlD;IAED,4EAA4E;IAC5E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAYnC;IAED,kEAAkE;IAC5D,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAMnC;IAWD;;;;;;;;;;;;;;;;;;OAkBG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAiJpE;IAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2EG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CA8H/B;IAsID;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsG7B;CA2DF"}
@@ -1,3 +1,4 @@
1
+ import type { AgUiMessageIds } from "../../core/agui_client.js";
1
2
  import type { UiStrings } from "../ui_strings.js";
2
3
  /** What the answer actions need from the element that owns them. */
3
4
  export interface AnswerActionsHost {
@@ -7,6 +8,12 @@ export interface AnswerActionsHost {
7
8
  readonly strings: () => UiStrings;
8
9
  /** Retry the last turn, as the element's public `retryLastTurn` does. */
9
10
  readonly retry: () => void;
11
+ /** The element's current conversation thread. */
12
+ readonly threadId: () => string;
13
+ }
14
+ /** A finished bubble that is not an answer, and so carries no rating. */
15
+ interface Unrateable {
16
+ readonly rateable: false;
10
17
  }
11
18
  /**
12
19
  * The action row under a finished answer -- copy, retry, feedback -- and the
@@ -31,9 +38,11 @@ export declare class AnswerActions {
31
38
  * something survives to go in it: an empty row still takes its margin, still
32
39
  * answers to the `message-actions` part, and still reads to a screen reader
33
40
  * as a group of actions with none in it.
41
+ *
42
+ * `message` names the answer, which is what a rating is filed under; a bubble
43
+ * that is not an answer says so instead, and has no id to give.
34
44
  */
35
- attach(bubble: HTMLDivElement, options?: {
36
- rateable?: boolean;
37
- }): void;
45
+ attach(bubble: HTMLDivElement, message: AgUiMessageIds | Unrateable): void;
38
46
  }
47
+ export {};
39
48
  //# sourceMappingURL=answer_actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"answer_actions.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/answer_actions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,qBAAa,aAAa;;IAaxB,YAAY,IAAI,EAAE,iBAAiB,EAElC;IAED,mEAAmE;IACnE,MAAM,IAAI,IAAI,CAEb;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI,CAwCzE;CAwCF"}
1
+ {"version":3,"file":"answer_actions.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/answer_actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;CACjC;AAED,yEAAyE;AACzE,UAAU,UAAU;IAClB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,qBAAa,aAAa;;IAaxB,YAAY,IAAI,EAAE,iBAAiB,EAElC;IAED,mEAAmE;IACnE,MAAM,IAAI,IAAI,CAEb;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,GAAG,UAAU,GAAG,IAAI,CAyDzE;CAwCF"}
@@ -117,6 +117,11 @@ export interface UiStrings {
117
117
  continueNeedsTurn: string;
118
118
  /** Composer hint when a run continuation was picked while a run is in flight. */
119
119
  continueWhileRunning: string;
120
+ /**
121
+ * Composer hint when a run continuation was picked while the stored
122
+ * conversation is still loading.
123
+ */
124
+ continueWhileLoading: string;
120
125
  /** `aria-label` of the message textarea. */
121
126
  message: string;
122
127
  /** Placeholder of the message textarea. */
@@ -1 +1 @@
1
- {"version":3,"file":"ui_strings.d.ts","sourceRoot":"","sources":["../../src/ui/ui_strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IAExB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,WAAW,EAAE,MAA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AAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IAGnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAGlB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,SA6IhC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CASvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artooi/ag-ui-web-component",
3
- "version": "0.42.0",
3
+ "version": "0.44.0",
4
4
  "description": "Framework-free <ag-ui-chat> Web Component over the AG-UI protocol. Drop-in chat sidebar with a pluggable client-side tool registry, DOM driver primitives, animations, and destructive-action confirmation modal.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/constants.ts CHANGED
@@ -102,10 +102,18 @@ export const INVALIDATE_EVENT = "ag-ui-invalidate";
102
102
  /**
103
103
  * Fired when the user rates an assistant message from its action row.
104
104
  *
105
- * `detail` is a {@link FeedbackDetail}: the rated message's text and the
106
- * rating. **Nothing is stored** -- a rating belongs to whatever the host
107
- * already uses to hold product signals, and a write-only table inside a chat
108
- * widget is a schema nobody reads.
105
+ * `detail` is a {@link FeedbackDetail}: which message was rated -- its AG-UI
106
+ * `messageId` and the `threadId` it belongs to, plus the `runId` that streamed
107
+ * it when it arrived live (absent on a restored message, which carries no run
108
+ * id) -- with its text and the rating. A host stores the rating against
109
+ * `messageId`, not `content`: two answers can read the same. A restored
110
+ * message is named by the id its store returns, so with a server-backed store
111
+ * the id holds across a reload only where the server persists the ids it
112
+ * streamed; the built-in browser store keeps them as they streamed.
113
+ *
114
+ * **Nothing is stored** -- a rating belongs to whatever the host already uses
115
+ * to hold product signals, and a write-only table inside a chat widget is a
116
+ * schema nobody reads.
109
117
  */
110
118
  export const FEEDBACK_EVENT = "ag-ui-feedback";
111
119
 
@@ -445,6 +445,8 @@ export class AgUiChat extends HTMLElement {
445
445
  retry: () => {
446
446
  void this.retryLastTurn();
447
447
  },
448
+ // Late-bound: the history is built in the constructor, after this field.
449
+ threadId: () => this.#history.threadId,
448
450
  });
449
451
 
450
452
  readonly #root: ShadowRoot;
@@ -645,6 +647,26 @@ export class AgUiChat extends HTMLElement {
645
647
  * conversation the handover purged.
646
648
  */
647
649
  #tenure: object = {};
650
+ /**
651
+ * The conversation on screen: replaced every time the transcript is cleared
652
+ * for another one -- New chat, a drawer switch, deleting the active thread,
653
+ * `reload()`, re-insertion and a handover all pass through
654
+ * {@link #resetConversation} -- and captured by each frontend tool call as it
655
+ * is dispatched, so the call can tell whether the conversation it was drawn
656
+ * in is still the one showing.
657
+ *
658
+ * A call outlives the reset that stops its run. A handler cannot be aborted,
659
+ * and a card open at the time is declined, so the call resumes once the new
660
+ * conversation is showing; drawing the run's pending indicator then put it
661
+ * in a conversation with no run to take it down.
662
+ *
663
+ * Not {@link #tenure}, which only a handover replaces. A reset is not a
664
+ * change of principal: the call still belongs to someone this element
665
+ * serves, so it still settles its card, clears its checkpoint and returns
666
+ * its result, and only the drawing is skipped. The tenure checks end the
667
+ * call before any of that.
668
+ */
669
+ #conversation: object = {};
648
670
  /**
649
671
  * The remote store `data-threads-url` wrapped around the conversation store,
650
672
  * and the store inside it, so connecting again can wrap that store rather
@@ -676,9 +698,9 @@ export class AgUiChat extends HTMLElement {
676
698
  * requests, and the listener's turn drawn between the user's turn and its
677
699
  * answer. It is the gap a picked checkpoint closes by counting from the pick,
678
700
  * closed the same way for a send. A retry asks for its run the same way, so
679
- * it takes the same hold, and so does a restore that will resume a run, from
680
- * before it asks the store for the conversation, through the history host's
681
- * `holdRun`.
701
+ * it takes the same hold, and so does every restore, from before it asks the
702
+ * store for the conversation, through the history host's `holdRun`: until
703
+ * the store answers, the client can only be built from nothing.
682
704
  *
683
705
  * Let go of once the run starts, because `running` holds from then until the
684
706
  * run settles, and a send held past that would refuse a host's follow-up from
@@ -688,9 +710,18 @@ export class AgUiChat extends HTMLElement {
688
710
  * An object rather than a flag, so a send or a retry ending releases only
689
711
  * what it took. By the time either ends, the turn queued behind it has
690
712
  * usually taken the field for itself, and a Stop lets go of it for the next
691
- * send to take; the earlier one ending must release neither.
713
+ * send to take; the earlier one ending must release neither. It is also how
714
+ * {@link sendMessage} tells the one hold it waits on from all the others it
715
+ * refuses behind: see {@link #restoreHold}.
692
716
  */
693
717
  #sending: object | null = null;
718
+ /**
719
+ * The hold the latest restore with no run to resume took, and what settles
720
+ * once that restore has ended or been stopped; `null` when the latest
721
+ * restore will resume a run. Only meaningful while `#sending` is that hold:
722
+ * then a host's {@link sendMessage} waits for it rather than refusing.
723
+ */
724
+ #restoreHold: { readonly hold: object; readonly restored: Promise<void> } | null = null;
694
725
  /** The decision a run is suspended on, which a Stop abandons. */
695
726
  readonly #decision = new PendingDecision();
696
727
  /**
@@ -785,6 +816,8 @@ export class AgUiChat extends HTMLElement {
785
816
  // Read live and compared, the way each client compares the one it was
786
817
  // built with: see #tenure.
787
818
  tenure: () => this.#tenure,
819
+ // The same, for the conversation on screen: see #conversation.
820
+ conversation: () => this.#conversation,
788
821
  });
789
822
  this.#runHandlers = new RunHandlers({
790
823
  element: this,
@@ -945,25 +978,29 @@ export class AgUiChat extends HTMLElement {
945
978
  // A held send or retry is as much in flight to a pick as a run is: it has
946
979
  // asked this element's client for a run that has not started, and a
947
980
  // continuation started beside it was a second run in one conversation.
948
- // So is a restore that will resume a run, which holds through the same
949
- // field from before the store answers.
981
+ // So is a restore, which holds through the same field from before the
982
+ // store answers.
950
983
  running: () => this.#running || this.#sending !== null,
951
- // The hold a send takes, taken for a restore that will resume a run, so
952
- // what refuses a send held short of its run refuses one made while the
953
- // store is still answering: `sendMessage` returns, Send parks the turn,
954
- // a Retry and a pick refuse. The same field rather than a flag beside it,
955
- // because what lets go of a send's hold is right for this one too. The
956
- // resumed run starting lets go, in `#setRunning`, so there is no gap
957
- // after the resume is asked for, and a Stop does, in `#cancelRun`. A flag
958
- // the restore cleared itself would still be set when the resumed run
959
- // settles and sends the parked turn, so that send would be refused after
960
- // the turn had left the queue, and lost.
984
+ // The hold a send takes, taken for every restore, so what refuses a send
985
+ // held short of its run holds one made while the store is still
986
+ // answering: Send parks the turn, a Retry and a pick refuse, and
987
+ // `sendMessage` refuses behind a restore that will resume a run and waits
988
+ // for one that will not -- `restored` is what it waits on, given only for
989
+ // that kind. The same field rather than a flag beside it, because what
990
+ // lets go of a send's hold is right for this one too. The resumed run
991
+ // starting lets go, in `#setRunning`, so there is no gap after the resume
992
+ // is asked for, and a Stop does, in `#cancelRun`. A flag the restore
993
+ // cleared itself would still be set when the resumed run settles and
994
+ // sends the parked turn, so that send would be refused after the turn had
995
+ // left the queue, and lost.
961
996
  //
962
- // Whether the restore was stopped is not read off this hold, because one
963
- // with nothing to resume takes none; the restore asks its own generation.
964
- holdRun: () => {
997
+ // Whether the restore was stopped is not read off this hold, because a
998
+ // host's send that waited takes it over; the restore asks its own
999
+ // generation.
1000
+ holdRun: (restored) => {
965
1001
  const hold = {};
966
1002
  this.#sending = hold;
1003
+ this.#restoreHold = restored === null ? null : { hold, restored };
967
1004
  return {
968
1005
  release: () => {
969
1006
  if (this.#sending === hold) {
@@ -2047,6 +2084,9 @@ export class AgUiChat extends HTMLElement {
2047
2084
  // not draw into this one, put a new run's Stop back to Send, or report the
2048
2085
  // new conversation's tools as its own.
2049
2086
  this.#runHandlers.detach();
2087
+ // A frontend tool call of that run can resume later still, for the same
2088
+ // reason, and must not draw into this one either: see #conversation.
2089
+ this.#conversation = {};
2050
2090
  this.#clearTranscript();
2051
2091
  this.#history.forgetRestored();
2052
2092
  }
@@ -2086,9 +2126,12 @@ export class AgUiChat extends HTMLElement {
2086
2126
  * History is truncated to the most recent user message inclusive and the run
2087
2127
  * repeats, so the agent answers what it was asked rather than being told its
2088
2128
  * last answer was wrong. Returns `false` when there is nothing to retry, or
2089
- * while anything that refuses a send is in flight: a run, a send or another
2129
+ * while anything that holds a send is in flight: a run, a send or another
2090
2130
  * retry whose run has not started yet, a checkpoint continuation, or a
2091
- * reload's restore that will resume a run. Also `false` when host code it
2131
+ * restore of the stored conversation that is still loading. It does not wait
2132
+ * for a restore as a send does: nothing is on screen to retry yet, and after
2133
+ * the load it would re-ask the previous visit's last question. Also `false`
2134
+ * when host code it
2092
2135
  * runs before its run starts -- the store's save, or an activity or tool
2093
2136
  * renderer the replay draws through -- has stopped it by starting a new chat
2094
2137
  * or changing `user-key`. A tool or context provider that stops it does so
@@ -2866,23 +2909,68 @@ export class AgUiChat extends HTMLElement {
2866
2909
  * `attachments` are durable {@link AttachmentRef}s — what {@link attachFile}
2867
2910
  * resolves to and what {@link ATTACHMENT_EVENT} reports.
2868
2911
  *
2869
- * No-ops on an empty message, and while a run or a picked checkpoint's
2870
- * continuation is in flight, since a second concurrent run would orphan the
2871
- * first. A send is in flight from the moment it is taken rather than from
2872
- * its run's start, so this no-ops from a {@link SUBMIT_EVENT} listener and
2873
- * for a second call in the same task too.
2912
+ * Resolves `true` once the turn has been handed to the client for its run,
2913
+ * which is when the interaction settles, frontend-tool rounds included; a
2914
+ * run a tool or context provider then stops still counts, as it does for
2915
+ * {@link retryLastTurn}. Resolves `false` when nothing was sent.
2916
+ *
2917
+ * Nothing is sent for an empty message, nor while a run or a picked
2918
+ * checkpoint's continuation is in flight, since a second concurrent run
2919
+ * would orphan the first. A send is in flight from the moment it is taken
2920
+ * rather than from its run's start, so nothing is sent from a
2921
+ * {@link SUBMIT_EVENT} listener or for a second call in the same task
2922
+ * either. Nor with no `endpoint`, which says so in the transcript. Nor
2923
+ * behind a reload's restore that will resume a run a navigating tool
2924
+ * interrupted, since that restore ends by starting the run.
2925
+ *
2926
+ * **While the element restores a stored conversation with no run to resume
2927
+ * -- on connect, {@link reload}, a thread picked from the drawer, a change
2928
+ * from one `user-key` to another -- it waits, then sends.** The turn has to follow the
2929
+ * conversation it is part of: sent at once, it went out without it, the
2930
+ * conversation was then drawn under it, and its save replaced the stored
2931
+ * one. So the bubble, the {@link SUBMIT_EVENT} and the request all come after
2932
+ * the replay, by the length of the store's load. A New chat, a thread
2933
+ * switch, a change from one `user-key` to another, a reload or the element
2934
+ * leaving the page while it waits drops it, resolving `false`: the
2935
+ * conversation it was addressed to is no longer on screen. Leaving the page
2936
+ * resolves it only once the load answers or the element is back, since
2937
+ * that is when the restore learns it was stopped. A first `user-key` on an
2938
+ * anonymous conversation adopts it rather than replacing it, and stops
2939
+ * nothing. A second call while one waits is
2940
+ * refused, as a second call in the same task is.
2941
+ *
2874
2942
  * Unlike the built-in Send it does not queue: it returns, and the caller
2875
2943
  * keeps what it tried to send. Nor does it consult the tray -- what you pass
2876
2944
  * is what is sent.
2877
2945
  */
2878
- async sendMessage(content: string, attachments: readonly AttachmentRef[] = []): Promise<void> {
2879
- if (
2880
- this.#running ||
2881
- this.#sending !== null ||
2882
- this.#history.continuation !== null ||
2883
- (content === "" && attachments.length === 0)
2884
- ) {
2885
- return;
2946
+ async sendMessage(content: string, attachments: readonly AttachmentRef[] = []): Promise<boolean> {
2947
+ if (content === "" && attachments.length === 0) {
2948
+ return false;
2949
+ }
2950
+ const restore = this.#restoreHold;
2951
+ if (restore !== null && this.#sending === restore.hold) {
2952
+ // Taken over from the restore, so a second host call is refused, the
2953
+ // built-in Send parks behind this one rather than going first, and the
2954
+ // restore's own release when it ends lets go of nothing -- this send's
2955
+ // run settling, or its end, is what sends the parked turn.
2956
+ const waiting = {};
2957
+ this.#sending = waiting;
2958
+ await restore.restored;
2959
+ // Anything that stopped the restore let go of this too, by the Stop
2960
+ // that New chat, a thread switch, a principal handover, a reload and the
2961
+ // element leaving all reach. Otherwise let go of here and the guards
2962
+ // asked again from the top, as for a call made now.
2963
+ //
2964
+ // Removing this check fails "drops the waiting send and the queued turn
2965
+ // when New chat is pressed", among the other drop tests.
2966
+ if (this.#sending !== waiting) {
2967
+ return false;
2968
+ }
2969
+ this.#sending = null;
2970
+ return this.sendMessage(content, attachments);
2971
+ }
2972
+ if (this.#running || this.#sending !== null || this.#history.continuation !== null) {
2973
+ return false;
2886
2974
  }
2887
2975
  const send = {};
2888
2976
  this.#sending = send;
@@ -2905,9 +2993,13 @@ export class AgUiChat extends HTMLElement {
2905
2993
  // which let go of this send, and the turn would otherwise go out into the
2906
2994
  // conversation that replaced it, or from an element nothing can stop.
2907
2995
  if (this.#sending !== send) {
2908
- return;
2996
+ return false;
2909
2997
  }
2998
+ // Read where the request is made, which says why nothing was sent when
2999
+ // there is no endpoint to send to.
3000
+ const connected = this.endpoint !== "";
2910
3001
  await this.#client_send(content, attachments);
3002
+ return connected;
2911
3003
  } finally {
2912
3004
  // Still held here only if its run never started: no endpoint, or a
2913
3005
  // client or store that threw before asking for one. No run settles
@@ -25,6 +25,29 @@ export interface AgUiToolCall {
25
25
  readonly args: Record<string, unknown>;
26
26
  }
27
27
 
28
+ /**
29
+ * Which message an answer surfaced by {@link AgUiClient} is, as the stream
30
+ * named it.
31
+ */
32
+ export interface AgUiMessageIds {
33
+ /** The id the message streamed under, on its `TEXT_MESSAGE_START`/`END`. */
34
+ readonly messageId: string;
35
+ /**
36
+ * The run that streamed it, as that run's `RUN_STARTED` declared it.
37
+ *
38
+ * Absent when no `RUN_STARTED` was seen. `@ag-ui/client` 1.0 rejects a
39
+ * stream whose first event is anything else, so over a real agent this is
40
+ * always present; nothing else names the run the server recorded, so
41
+ * nothing is substituted when it is not.
42
+ *
43
+ * Text a sub-agent streams through the parent run carries the parent's run
44
+ * id: that is the stream it arrived on, and the delegation's
45
+ * `subagentRunId` names the child's work rather than a run the answer is
46
+ * recorded under.
47
+ */
48
+ readonly runId?: string;
49
+ }
50
+
28
51
  /** The result of executing a frontend tool, destined for a tool-result message. */
29
52
  export interface ToolExecution {
30
53
  /** String content for the AG-UI tool-result message. */
@@ -92,8 +115,11 @@ export interface AgUiClientHandlers {
92
115
  onRunStart(): void;
93
116
  /** Fired on every streamed token; `buffer` is the full text so far. */
94
117
  onTextDelta(buffer: string): void;
95
- /** Fired when the assistant message completes; `buffer` is the final text. */
96
- onTextEnd(buffer: string): void;
118
+ /**
119
+ * Fired when the assistant message completes; `buffer` is the final text,
120
+ * and `message` names it as the stream did.
121
+ */
122
+ onTextEnd(buffer: string, message: AgUiMessageIds): void;
97
123
  /** Fired when the agent finishes calling a tool (server- or frontend-side). */
98
124
  onToolCall(call: AgUiToolCall): void;
99
125
  /**
@@ -786,10 +812,21 @@ export class AgUiClient {
786
812
  // Charts whose patch has been dispatched but not yet applied. Scoped to the
787
813
  // subscriber, so it cannot outlive the run that created it.
788
814
  const pendingDeltas = new Set<string>();
815
+ // The run this round's stream declared. Per subscriber, so per round: a
816
+ // turn that calls a tool is two runs, and its answer belongs to the second.
817
+ //
818
+ // Taken from `RUN_STARTED` rather than the `runId` the request carried.
819
+ // The client mints that one, and a server is free to record the run under
820
+ // the id it streams back; the event is the server's own statement of
821
+ // which run this is, so it is the id a host can find again.
822
+ let runId: string | undefined;
789
823
  return {
790
824
  onRunInitialized() {
791
825
  h.onRunStart();
792
826
  },
827
+ onRunStartedEvent({ event }) {
828
+ runId = event.runId;
829
+ },
793
830
  onTextMessageStartEvent({ event }) {
794
831
  // A reused message id merges two answers into one persisted transcript
795
832
  // entry. The protocol has no rule to enforce and refusing the event
@@ -809,7 +846,10 @@ export class AgUiClient {
809
846
  },
810
847
  onTextMessageEndEvent({ event, textMessageBuffer }) {
811
848
  closed.add(event.messageId);
812
- h.onTextEnd(textMessageBuffer);
849
+ h.onTextEnd(textMessageBuffer, {
850
+ messageId: event.messageId,
851
+ ...(runId === undefined ? {} : { runId }),
852
+ });
813
853
  },
814
854
  onToolCallEndEvent({ event, toolCallName, toolCallArgs }) {
815
855
  const call: AgUiToolCall = {