@artooi/ag-ui-web-component 0.28.0 → 0.29.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 (59) hide show
  1. package/CHANGELOG.md +417 -1
  2. package/README.md +371 -5
  3. package/dist/ag-ui-web-component.bundle.js +308 -50
  4. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  5. package/dist/constants.d.ts +69 -0
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/core/ag_ui_chat.d.ts +207 -0
  8. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  9. package/dist/core/agui_client.d.ts +38 -0
  10. package/dist/core/agui_client.d.ts.map +1 -1
  11. package/dist/index.d.ts +7 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1516 -76
  14. package/dist/index.js.map +4 -4
  15. package/dist/ui/approval_card.d.ts +18 -0
  16. package/dist/ui/approval_card.d.ts.map +1 -1
  17. package/dist/ui/checkpoint_menu.d.ts +10 -0
  18. package/dist/ui/checkpoint_menu.d.ts.map +1 -1
  19. package/dist/ui/confirmation_card.d.ts +16 -0
  20. package/dist/ui/confirmation_card.d.ts.map +1 -1
  21. package/dist/ui/message_actions.d.ts +46 -0
  22. package/dist/ui/message_actions.d.ts.map +1 -0
  23. package/dist/ui/page_quote_offer.d.ts +33 -0
  24. package/dist/ui/page_quote_offer.d.ts.map +1 -0
  25. package/dist/ui/quote_selection.d.ts +66 -0
  26. package/dist/ui/quote_selection.d.ts.map +1 -0
  27. package/dist/ui/relative_time.d.ts +10 -0
  28. package/dist/ui/relative_time.d.ts.map +1 -1
  29. package/dist/ui/stick_to_bottom.d.ts +55 -0
  30. package/dist/ui/stick_to_bottom.d.ts.map +1 -0
  31. package/dist/ui/styles.d.ts +1 -1
  32. package/dist/ui/styles.d.ts.map +1 -1
  33. package/dist/ui/suggestion_chips.d.ts +29 -0
  34. package/dist/ui/suggestion_chips.d.ts.map +1 -0
  35. package/dist/ui/thread_drawer.d.ts +10 -0
  36. package/dist/ui/thread_drawer.d.ts.map +1 -1
  37. package/dist/ui/tool_call_card.d.ts +8 -0
  38. package/dist/ui/tool_call_card.d.ts.map +1 -1
  39. package/dist/ui/ui_strings.d.ts +40 -0
  40. package/dist/ui/ui_strings.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/constants.ts +75 -0
  43. package/src/core/ag_ui_chat.ts +927 -73
  44. package/src/core/agui_client.ts +63 -0
  45. package/src/index.ts +39 -0
  46. package/src/ui/approval_card.ts +90 -2
  47. package/src/ui/checkpoint_menu.ts +22 -5
  48. package/src/ui/confirmation_card.ts +29 -1
  49. package/src/ui/message_actions.ts +158 -0
  50. package/src/ui/page_quote_offer.ts +215 -0
  51. package/src/ui/quote_selection.ts +345 -0
  52. package/src/ui/relative_time.ts +11 -0
  53. package/src/ui/stick_to_bottom.ts +126 -0
  54. package/src/ui/styles.ts +227 -0
  55. package/src/ui/suggestion_chips.ts +73 -0
  56. package/src/ui/thread_drawer.ts +22 -2
  57. package/src/ui/tool_call_card.ts +9 -0
  58. package/src/ui/ui_strings.ts +60 -0
  59. package/src/version.ts +1 -1
@@ -44,6 +44,66 @@ export declare const ATTACHMENT_EVENT = "ag-ui-attachments";
44
44
  * error and cancellation alike, since a partial write is still a write.
45
45
  */
46
46
  export declare const RUN_FINISHED_EVENT = "ag-ui-run-finished";
47
+ /**
48
+ * The agent sent an AG-UI `CUSTOM` event. `detail` is {@link CustomAgentDetail}.
49
+ *
50
+ * `CUSTOM` is one of exactly two carriers whose payload name the protocol leaves
51
+ * an open string, and it is the **imperative** one: something for the host page
52
+ * to *do*, with no place in the transcript. Its sibling `ACTIVITY_SNAPSHOT`
53
+ * carries transcript **content**, which is why that one is materialised into a
54
+ * message, persisted, and replayed on restore while this one is not.
55
+ *
56
+ * That asymmetry is the rule for choosing between them. Content has a place in
57
+ * the conversation and should replay; an imperative has no place and no meaning
58
+ * once acted on, so replaying it on a thread load would be a bug. Anything that
59
+ * must survive a reload belongs on the other carrier.
60
+ *
61
+ * The element takes no view of what a name means -- it forwards every one. A
62
+ * host that does not recognise a name ignores the event, which is the graceful
63
+ * outcome the open field exists for.
64
+ */
65
+ export declare const CUSTOM_AGENT_EVENT = "ag-ui-custom";
66
+ /**
67
+ * The agent named resources its write has moved. `detail` is
68
+ * {@link InvalidateDetail}.
69
+ *
70
+ * A convention on top of {@link CUSTOM_AGENT_EVENT}, not a second channel: the
71
+ * wire carries an ordinary AG-UI `CUSTOM` event whose `name` is
72
+ * {@link INVALIDATE_CUSTOM_NAME}, and this is that one name routed to its own
73
+ * DOM event so a host does not have to string-match. Every other name still
74
+ * arrives as `ag-ui-custom`.
75
+ *
76
+ * Fires **as each announcement arrives**, during the run, which is what makes a
77
+ * long multi-step run feel live: the list refreshes as the third of eight writes
78
+ * lands rather than when everything finishes. {@link RUN_FINISHED_EVENT} carries
79
+ * the same keys again at the end, de-duplicated, for a host that would rather
80
+ * refetch once.
81
+ */
82
+ export declare const INVALIDATE_EVENT = "ag-ui-invalidate";
83
+ /**
84
+ * Fired when the user rates an assistant message from its action row.
85
+ *
86
+ * `detail` is a {@link FeedbackDetail}: the rated message's text and the
87
+ * rating. **Nothing is stored** -- a rating belongs to whatever the host
88
+ * already uses to hold product signals, and a write-only table inside a chat
89
+ * widget is a schema nobody reads.
90
+ */
91
+ export declare const FEEDBACK_EVENT = "ag-ui-feedback";
92
+ /**
93
+ * The `activity_type` carrying server-pushed follow-up prompts.
94
+ *
95
+ * Matches django-ag-ui's `SUGGESTIONS_ACTIVITY_TYPE`. A convention inside the
96
+ * protocol's open `activity_type` field, not an extension of it -- so a client
97
+ * that has never heard of it ignores the event, and this one is not privileged.
98
+ */
99
+ export declare const SUGGESTIONS_ACTIVITY_TYPE = "suggestions";
100
+ /**
101
+ * The AG-UI `CUSTOM` event `name` that carries an invalidation.
102
+ *
103
+ * Matched exactly. Namespaced so it cannot collide with a host's own custom
104
+ * events, which share the field.
105
+ */
106
+ export declare const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
47
107
  /** Roles a chat message can take. */
48
108
  export declare const MESSAGE_ROLE: {
49
109
  readonly USER: "user";
@@ -189,4 +249,13 @@ export declare const ICON_FILE_TEXT = "<svg class=\"glyph\" viewBox=\"0 0 24 24\
189
249
  * event, which is the graceful outcome.
190
250
  */
191
251
  export declare const CHART_ACTIVITY_TYPE = "chart";
252
+ /**
253
+ * How long a screen-reader status stays in the announcer before it is emptied.
254
+ *
255
+ * Long enough for a reader to pick the change up, short enough that the region
256
+ * is empty again before the next status lands. Emptying is what makes an
257
+ * identical consecutive message announce at all -- a live region is read on
258
+ * *change*, and setting the same string twice is not one.
259
+ */
260
+ export declare const ANNOUNCE_CLEAR_MS = 150;
192
261
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,wEAAwE;AACxE,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,qCAAqC;AACrC,eAAO,MAAM,YAAY;aACvB,IAAI,EAAE,MAAM;aACZ,SAAS,EAAE,WAAW;CACd,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC;;;;GAIG;AACH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,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC"}
@@ -8,6 +8,7 @@ import { type PageState } from "../tools/page_state.js";
8
8
  import { type RouteMap } from "../tools/route_map.js";
9
9
  import { type ApprovalRenderer } from "../ui/approval_card.js";
10
10
  import { type QuestionRenderer } from "../ui/question_card.js";
11
+ import type { RelativeTimeFormatter } from "../ui/relative_time.js";
11
12
  import { type ToolDisplayMode } from "../ui/tool_call_card.js";
12
13
  import { type UiStrings } from "../ui/ui_strings.js";
13
14
  import { type AttachmentRef } from "./attachment.js";
@@ -31,6 +32,12 @@ export interface AttachmentsDetail {
31
32
  readonly pending: number;
32
33
  }
33
34
  /** `detail` shape of the {@link STATE_EVENT} CustomEvent. */
35
+ /** {@link FEEDBACK_EVENT} detail: what was rated, and how. */
36
+ export interface FeedbackDetail {
37
+ /** The rated message's text, as rendered. */
38
+ readonly content: string;
39
+ readonly rating: "up" | "down";
40
+ }
34
41
  export interface StateDetail {
35
42
  readonly state: Readonly<Record<string, unknown>>;
36
43
  }
@@ -48,6 +55,79 @@ export interface ToolRun {
48
55
  export interface RunFinishedDetail {
49
56
  /** In settle order. Empty when the interaction called no tools. */
50
57
  readonly tools: readonly ToolRun[];
58
+ /**
59
+ * Every key announced during the interaction, de-duplicated, first-seen order.
60
+ *
61
+ * **This is the field that makes adoption one line** for a host already
62
+ * listening here, and the `else` is the whole compatibility story:
63
+ *
64
+ * ```js
65
+ * if (detail.invalidated.length > 0) refetchOnly(detail.invalidated);
66
+ * else if (detail.tools.some((t) => t.side === "server")) refetchEverything();
67
+ * ```
68
+ *
69
+ * Empty against a server that announces nothing, so an old server and a new
70
+ * client fall through to the coarse refetch that shipped before either.
71
+ */
72
+ readonly invalidated: readonly string[];
73
+ }
74
+ /**
75
+ * Draw one activity, from its content alone.
76
+ *
77
+ * The contract is {@link ClientTool.render}'s, and for the same reason rather
78
+ * than by analogy. An activity is materialised into a `role: "activity"`
79
+ * message, persisted with the transcript, and re-fired on every restore -- so a
80
+ * renderer that writes to the page instead of returning DOM fires again on
81
+ * every thread load, which is exactly the bug the tool registry's purity rule
82
+ * was written to make unmakeable.
83
+ *
84
+ * - a pure function of `content` -- no host state, no network, no clock;
85
+ * - deterministic, so a reload reproduces what was there before;
86
+ * - free of effects outside the node it returns, which the component places.
87
+ *
88
+ * Return `null` for content that says nothing worth drawing. Anything already
89
+ * drawn under that message id is then removed: live and reload should agree,
90
+ * and the stored content is the version that could not be drawn.
91
+ */
92
+ export type ActivityRenderer = (content: unknown) => Node | null;
93
+ /** One `activity_type` a host can draw. See {@link AgUiChat.registerActivityRenderer}. */
94
+ export interface ActivityRegistration {
95
+ /**
96
+ * The AG-UI `activity_type` this draws, matched exactly.
97
+ *
98
+ * An open string the protocol does not enumerate -- which is the whole reason
99
+ * this is a registry rather than a branch.
100
+ */
101
+ readonly type: string;
102
+ readonly render: ActivityRenderer;
103
+ /**
104
+ * Shown in the transcript when something already drawn under this type stops
105
+ * being renderable. Omit for an activity whose disappearance needs no
106
+ * explanation.
107
+ */
108
+ readonly removedNotice?: string;
109
+ }
110
+ /** `detail` shape of the {@link CUSTOM_AGENT_EVENT} CustomEvent. */
111
+ export interface CustomAgentDetail {
112
+ /** The `CUSTOM` event's `name`, verbatim. An open string; never interpreted here. */
113
+ readonly name: string;
114
+ /** Its `value`, verbatim and unparsed. `unknown` because the protocol says nothing about it. */
115
+ readonly value: unknown;
116
+ }
117
+ /** `detail` shape of the {@link INVALIDATE_EVENT} CustomEvent. */
118
+ export interface InvalidateDetail {
119
+ /**
120
+ * The resources that moved, as the server named them.
121
+ *
122
+ * **Opaque strings, and matching is exact.** `orders/42` does not imply
123
+ * `orders` -- a prefix rule would be this component guessing at a scheme it
124
+ * does not own, and `orders/1` would match `orders/11`. A server that wants
125
+ * the collection refreshed names it. Your own matching may be hierarchical,
126
+ * because in your vocabulary the scheme is known.
127
+ */
128
+ readonly keys: readonly string[];
129
+ /** What caused the write -- usually the tool's name. `null` when unstated. */
130
+ readonly reason: string | null;
51
131
  }
52
132
  /** `detail` shape of the {@link TOGGLE_EVENT} CustomEvent. */
53
133
  export interface ToggleDetail {
@@ -115,6 +195,22 @@ export declare class AgUiChat extends HTMLElement {
115
195
  * data. Enable only when the content source is trusted.
116
196
  */
117
197
  allowImages: boolean;
198
+ /**
199
+ * Replace the relative timestamps in the thread drawer and the checkpoint
200
+ * panel -- `"5m ago"`, `"2d ago"` -- with the host's own formatting.
201
+ *
202
+ * The built-in is locale-neutral on purpose: there is no `Intl` anywhere in
203
+ * this component, so it never disagrees with the page it is embedded in by
204
+ * guessing a locale. That is a good default and a bad requirement, which is
205
+ * what this is for.
206
+ *
207
+ * ```js
208
+ * const rtf = new Intl.RelativeTimeFormat("de", { numeric: "auto" });
209
+ * chat.formatRelativeTime = (ts) =>
210
+ * rtf.format(Math.round((ts - Date.now()) / 60000), "minute");
211
+ * ```
212
+ */
213
+ formatRelativeTime: RelativeTimeFormatter | null;
118
214
  /** When true, destructive tools execute without a confirmation modal. */
119
215
  autoConfirm: boolean;
120
216
  /**
@@ -138,6 +234,22 @@ export declare class AgUiChat extends HTMLElement {
138
234
  * is enabled server-side; this only changes how the decision is collected.
139
235
  */
140
236
  approvalRenderer: ApprovalRenderer | null;
237
+ /**
238
+ * Let the user edit a gated call's arguments before approving it.
239
+ *
240
+ * Off by default and **an assertion about your server**, not a negotiation:
241
+ * AG-UI carries `editedArgs` in the resume payload and gates it on the
242
+ * agent's own `approveWithEdits` capability, which this component never sees
243
+ * -- capabilities are not on the wire it reads. So the host says whether its
244
+ * agent honours them. Turned on against a server that does not, the user
245
+ * would edit arguments it silently discards, which is worse than not
246
+ * offering.
247
+ *
248
+ * Only affects calls whose arguments are known here: an interrupt names a
249
+ * `toolCallId`, and the tool card for that call is where the arguments still
250
+ * are. An interrupt naming no card gets the plain approve/deny.
251
+ */
252
+ approveWithEdits: boolean;
141
253
  /**
142
254
  * Optional per-call confirmation predicate. When set it is authoritative,
143
255
  * deciding from the tool name and args whether this particular call needs
@@ -348,6 +460,42 @@ export declare class AgUiChat extends HTMLElement {
348
460
  * indicator clears. Without this a removed element leaks all three.
349
461
  */
350
462
  disconnectedCallback(): void;
463
+ /**
464
+ * Put `text` into the composer as a markdown quotation, and focus it.
465
+ *
466
+ * Deliberately **not** a send. Quoting is how a question narrows to one part
467
+ * of an answer, so the quotation is the preamble and the question is what
468
+ * comes next -- the caret is left after it, on its own line.
469
+ *
470
+ * This is also the seam for the half of this feature the component cannot
471
+ * build: selection in the **host page**. A widget mounted beside a table can
472
+ * be asked about a row, and nothing in a chat's own transcript can offer
473
+ * that. A host reads its own selection, however it likes, and calls this.
474
+ *
475
+ * No-ops on text that is empty or only whitespace.
476
+ */
477
+ quote(text: string): void;
478
+ /**
479
+ * Offer to quote what the user selects in the **host page**, not just in the
480
+ * transcript. Returns a function that stops offering.
481
+ *
482
+ * The same select-then-offer gesture, over a table, a diff, a report -- the
483
+ * surface the user actually works in, which is the half of quoting no hosted
484
+ * chat can reach. Opt-in, because it listens on the host's document and that
485
+ * is theirs to grant.
486
+ *
487
+ * Deliberately **not** a four-line recipe, which is how this shipped first
488
+ * and was wrong: a page listener that quotes every settled selection appends
489
+ * to the composer on every drag made to read, to copy or to fix a typo -- and
490
+ * it cannot tell a selection in the page's prose from one inside the user's
491
+ * own half-typed `<input>`, because Chrome reports a field's internal
492
+ * selection as an ordinary range over the field's *wrapper*. See
493
+ * {@link attachQuoteOffer} for the guards.
494
+ *
495
+ * Detached automatically when the element leaves the document; a host that
496
+ * re-mounts it calls this again.
497
+ */
498
+ offerQuoteInPage(within?: HTMLElement): () => void;
351
499
  /**
352
500
  * Replace the host-supplied (client) skill catalog. Merged after the embedded
353
501
  * and fetched skills (so a client skill overrides a same-named server one).
@@ -414,6 +562,23 @@ export declare class AgUiChat extends HTMLElement {
414
562
  * starts something new must not be the button that destroys what was there.
415
563
  */
416
564
  newChat(): void;
565
+ /**
566
+ * Ask the same question again and replace the answer.
567
+ *
568
+ * History is truncated to the most recent user message inclusive and the run
569
+ * repeats, so the agent answers what it was asked rather than being told its
570
+ * last answer was wrong. Returns `false` when there is nothing to retry or a
571
+ * run is already in flight.
572
+ *
573
+ * Public because a host with its own message UI wants the same button, and
574
+ * because the failed-run notice reaches it from outside the action row.
575
+ *
576
+ * **A retried turn re-runs its tools**, which for a page-driving agent is not
577
+ * neutral: the previous attempt already clicked what it clicked, and this
578
+ * does not undo it. Confirmation still applies, so a destructive tool asks
579
+ * again -- unless the user waived it for this session.
580
+ */
581
+ retryLastTurn(): Promise<boolean>;
417
582
  /**
418
583
  * Append a message bubble and return it.
419
584
  *
@@ -473,5 +638,47 @@ export declare class AgUiChat extends HTMLElement {
473
638
  * arrives is not something to switch on for everybody.
474
639
  */
475
640
  enableCharts(routes?: readonly ("tool" | "activity")[]): void;
641
+ /**
642
+ * Teach this element to draw one kind of AG-UI activity.
643
+ *
644
+ * `activity_type` is one of exactly two fields the protocol leaves an open
645
+ * string, and it is the **content** one: an activity is materialised into a
646
+ * message, persisted with the thread, and replayed on every restore. Its
647
+ * sibling `CUSTOM` carries an imperative and is dispatched to the page
648
+ * instead ({@link CUSTOM_AGENT_EVENT}).
649
+ *
650
+ * That asymmetry decides which carrier a server should use. Content has a
651
+ * place in the conversation and should come back; an imperative has no place
652
+ * and no meaning once acted on.
653
+ *
654
+ * ```js
655
+ * chat.registerActivityRenderer({
656
+ * type: "build_status",
657
+ * render: (content) => {
658
+ * const el = document.createElement("div");
659
+ * el.textContent = `Build ${content.status}`;
660
+ * return el;
661
+ * },
662
+ * });
663
+ * ```
664
+ *
665
+ * Registering a type twice replaces the earlier renderer, so a host can
666
+ * override a built-in -- `chart` and `compaction` are registrations like any
667
+ * other, not privileged branches.
668
+ *
669
+ * ⚠ `render` runs again on every thread load. See {@link ActivityRenderer}
670
+ * for what that requires of it.
671
+ */
672
+ registerActivityRenderer(registration: ActivityRegistration): void;
673
+ /**
674
+ * Activity types that arrived with nobody registered to draw them.
675
+ *
676
+ * Deliberately the only trace an unhandled activity leaves. Ignoring an
677
+ * unknown name is the protocol's own answer and the whole point of an open
678
+ * field, so warning would fire on every forward-compatible server -- but
679
+ * "nothing happened and nothing was said" is impossible to debug, so the set
680
+ * is readable. Accumulates for the element's lifetime, across threads.
681
+ */
682
+ get unhandledActivityTypes(): readonly string[];
476
683
  }
477
684
  //# sourceMappingURL=ag_ui_chat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ag_ui_chat.d.ts","sourceRoot":"","sources":["../../src/core/ag_ui_chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAsB,IAAI,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAUL,YAAY,EAWb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAUhC,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AASzF,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAG1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,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OAAO,CAAC,OAAO,CAAC,CAmBtC;IAqOD;;;;;;;;;OASG;IACH,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAyBhE;IAonBD;;;;;;;;;;;;;;OAcG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,aAAa,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB5F;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAM9B;IAoyBD;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,CAAC,MAAM,GAAE,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,EAAyB,GAAG,IAAI,CA2BlF;IAmCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,wBAAwB,CAAC,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAGjE;IAED;;;;;;;;OAQG;IACH,IAAI,sBAAsB,IAAI,SAAS,MAAM,EAAE,CAE9C;CA+GF"}
@@ -99,6 +99,24 @@ export interface AgUiClientHandlers {
99
99
  /** Fired when the reasoning block ends (before the answer text streams). */
100
100
  onReasoningEnd(): void;
101
101
  onRunEnd(): void;
102
+ /**
103
+ * The server replaced the whole conversation with `MESSAGES_SNAPSHOT`.
104
+ *
105
+ * `@ag-ui/client` applies the event before any subscriber sees it, so by the
106
+ * time this fires `agent.messages` **is** the server's list -- and the run
107
+ * loop persists `agent.messages`. The replacement therefore reaches the
108
+ * conversation store whatever the host does; this hook exists so the host can
109
+ * stop that being invisible.
110
+ */
111
+ onMessagesSnapshot(messages: readonly Message[]): void;
112
+ /**
113
+ * The agent sent a `CUSTOM` event.
114
+ *
115
+ * Forwarded whole and uninterpreted: `name` is an open string the protocol
116
+ * does not enumerate, so a client that decided which names were legal would
117
+ * be the thing the open field exists to avoid.
118
+ */
119
+ onCustomEvent(name: string, value: unknown): void;
102
120
  onError(message: string): void;
103
121
  /**
104
122
  * Fired when the user cancelled the run ({@link AgUiClient.cancel}) — the
@@ -192,6 +210,26 @@ export declare class AgUiClient {
192
210
  * {@link messageAttachments}.
193
211
  */
194
212
  send(content: string, attachments?: readonly AttachmentRef[]): Promise<void>;
213
+ /**
214
+ * Drop everything after the most recent user message, so the same question
215
+ * can be asked again.
216
+ *
217
+ * Returns the retained history, or `null` when there is nothing to retry (no
218
+ * user message has been sent yet). **Truncates only** -- the caller re-renders
219
+ * from the returned list and then calls {@link resume}, because the transcript
220
+ * belongs to the element and a client that reached into it would own two
221
+ * things. Running here instead would stream the new answer in underneath the
222
+ * old one.
223
+ *
224
+ * Re-running answers the question the agent was last asked, rather than
225
+ * telling it its answer was wrong, which is what makes the result a
226
+ * *different* answer instead of a conversation about the previous one.
227
+ *
228
+ * **A retried turn re-runs its tools.** For a page-driving agent that is not
229
+ * neutral: the previous attempt already clicked what it clicked, and this
230
+ * does not undo it.
231
+ */
232
+ truncateToLastUser(): readonly Message[] | null;
195
233
  /**
196
234
  * Resume the run loop after a navigating tool's result was supplied
197
235
  * post-reload (via {@link addToolResult}). Unlike {@link send}, adds no user
@@ -1 +1 @@
1
- {"version":3,"file":"agui_client.d.ts","sourceRoot":"","sources":["../../src/core/agui_client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,mFAAmF;AACnF,MAAM,WAAW,a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,oEAAoE;IACpE,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE7C;IAED,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAEvD;IAED,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,wEAAwE;IACxE,IAAI,QAAQ,IAAI,SAAS,OAAO,EAAE,CAEjC;IAED;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,aAAa,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,kBAAkB,IAAI,SAAS,OAAO,EAAE,GAAG,IAAI,CAkB9C;IAED;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAED,0EAA0E;IAC1E,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGvD;IAED;;;;;;OAMG;IACH,MAAM,IAAI,IAAI,CAGb;CAiQF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { ATTACHMENT_EVENT, CHART_ACTIVITY_TYPE, COMPACTION_ACTIVITY_TYPE, ELEMENT_TAG, LOAD_CAPABILITY_TOOL, MAX_TOOL_ROUNDS, MESSAGE_ROLE, RUN_FINISHED_EVENT, STATE_EVENT, SUBMIT_EVENT, TOGGLE_EVENT, TOOL_CALL_STATUS, TOOL_DISPLAY, UNREAD_EVENT, X_CONFIRM_KEY, X_DESTRUCTIVE_KEY, X_NAVIGATES_KEY, X_SUMMARY_KEY, } from "./constants.js";
2
- export { AgUiChat, type AttachmentsDetail, type MessageRole, type RunFinishedDetail, type StateDetail, type SubmitDetail, type ToggleDetail, type ToolRun, type UnreadDetail, } from "./core/ag_ui_chat.js";
1
+ export { ATTACHMENT_EVENT, CHART_ACTIVITY_TYPE, COMPACTION_ACTIVITY_TYPE, CUSTOM_AGENT_EVENT, ELEMENT_TAG, FEEDBACK_EVENT, INVALIDATE_CUSTOM_NAME, INVALIDATE_EVENT, LOAD_CAPABILITY_TOOL, MAX_TOOL_ROUNDS, MESSAGE_ROLE, RUN_FINISHED_EVENT, STATE_EVENT, SUBMIT_EVENT, SUGGESTIONS_ACTIVITY_TYPE, TOGGLE_EVENT, TOOL_CALL_STATUS, TOOL_DISPLAY, UNREAD_EVENT, X_CONFIRM_KEY, X_DESTRUCTIVE_KEY, X_NAVIGATES_KEY, X_SUMMARY_KEY, } from "./constants.js";
2
+ export { type ActivityRegistration, type ActivityRenderer, AgUiChat, type AttachmentsDetail, type CustomAgentDetail, type FeedbackDetail, type InvalidateDetail, type MessageRole, type RunFinishedDetail, type StateDetail, type SubmitDetail, type ToggleDetail, type ToolRun, type UnreadDetail, } from "./core/ag_ui_chat.js";
3
3
  export { AgUiClient, type AgUiClientConfig, type AgUiClientHandlers, type AgUiRunInputs, type AgUiToolCall, ConnectionLostError, type ExecuteTool, type InterruptResponse, type ResolveInterrupts, type ToolExecution, } from "./core/agui_client.js";
4
4
  export { type AttachmentRef, messageAttachments } from "./core/attachment.js";
5
5
  export { type ClientConversationStore, type NavigationCheckpoint, SessionStorageStore, type ThreadMeta, } from "./core/conversation_store.js";
@@ -32,9 +32,14 @@ export { chartSpecFrom } from "./ui/chart_spec_from.js";
32
32
  export { CHART_TOOL_NAME } from "./ui/chart_tool.js";
33
33
  export { CheckpointMenu, type CheckpointVerb } from "./ui/checkpoint_menu.js";
34
34
  export { type ConfirmationOptions, type ConfirmationRequest, requestConfirmation, } from "./ui/confirmation_card.js";
35
+ export { attachMessageActions, type MessageActionsOptions, messageActionBar, } from "./ui/message_actions.js";
36
+ export { attachQuoteOffer, type PageQuoteOffer, type PageQuoteOfferOptions, } from "./ui/page_quote_offer.js";
35
37
  export { prettifyToolName } from "./ui/prettify_tool_name.js";
36
38
  export { type QuestionOptions, type QuestionRenderer, type QuestionRequest, requestQuestion, } from "./ui/question_card.js";
39
+ export { asQuote, MAX_QUOTE_CHARS, type QuotableSelection, quotableSelection, } from "./ui/quote_selection.js";
40
+ export { type RelativeTimeFormatter, relativeTime, } from "./ui/relative_time.js";
37
41
  export { type RenderMarkdownOptions, renderMarkdown } from "./ui/render_markdown.js";
42
+ export { MAX_SUGGESTION_CHARS, MAX_SUGGESTIONS, renderSuggestionChips, suggestionPrompts, } from "./ui/suggestion_chips.js";
38
43
  export { type SettledStatus, ToolCallCard, type ToolCallStatus, type ToolDisplayMode, } from "./ui/tool_call_card.js";
39
44
  export { DEFAULT_UI_STRINGS, mergeUiStrings, type UiStrings } from "./ui/ui_strings.js";
40
45
  export { VERSION } from "./version.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAA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M,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,qBAAqB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,uBAAuB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