@artooi/ag-ui-web-component 0.38.0 → 0.40.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 (142) hide show
  1. package/CHANGELOG.md +515 -1
  2. package/README.md +232 -56
  3. package/dist/ag-ui-web-component.bundle.js +370 -139
  4. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  5. package/dist/constants.d.ts +17 -14
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/core/activity_registry.d.ts +46 -0
  8. package/dist/core/activity_registry.d.ts.map +1 -0
  9. package/dist/core/ag_ui_chat.d.ts +23 -10
  10. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  11. package/dist/core/agui_client.d.ts +28 -0
  12. package/dist/core/agui_client.d.ts.map +1 -1
  13. package/dist/core/client_seed.d.ts +27 -0
  14. package/dist/core/client_seed.d.ts.map +1 -0
  15. package/dist/core/read_max_tool_rounds.d.ts +9 -0
  16. package/dist/core/read_max_tool_rounds.d.ts.map +1 -0
  17. package/dist/core/run_handlers.d.ts +80 -0
  18. package/dist/core/run_handlers.d.ts.map +1 -0
  19. package/dist/core/storage_scope.d.ts +110 -0
  20. package/dist/core/storage_scope.d.ts.map +1 -0
  21. package/dist/core/tool_outcome.d.ts +2 -3
  22. package/dist/core/tool_outcome.d.ts.map +1 -1
  23. package/dist/core/utils.d.ts +46 -0
  24. package/dist/core/utils.d.ts.map +1 -1
  25. package/dist/index.js +16268 -14747
  26. package/dist/index.js.map +4 -4
  27. package/dist/skills/skill_catalog.d.ts +67 -0
  28. package/dist/skills/skill_catalog.d.ts.map +1 -0
  29. package/dist/skills/skill_name_from.d.ts +12 -0
  30. package/dist/skills/skill_name_from.d.ts.map +1 -0
  31. package/dist/tools/tool_catalog.d.ts +79 -0
  32. package/dist/tools/tool_catalog.d.ts.map +1 -0
  33. package/dist/tools/tool_dispatch.d.ts +104 -0
  34. package/dist/tools/tool_dispatch.d.ts.map +1 -0
  35. package/dist/ui/composer/attachment_tray.d.ts.map +1 -1
  36. package/dist/ui/composer/auto_grow.d.ts +10 -0
  37. package/dist/ui/composer/auto_grow.d.ts.map +1 -0
  38. package/dist/ui/composer/composer_attachments.d.ts +57 -0
  39. package/dist/ui/composer/composer_attachments.d.ts.map +1 -0
  40. package/dist/ui/composer/composer_voice.d.ts +48 -0
  41. package/dist/ui/composer/composer_voice.d.ts.map +1 -0
  42. package/dist/ui/composer/voice_input.d.ts.map +1 -1
  43. package/dist/ui/excerpts/transcript_quote_offer.d.ts +57 -0
  44. package/dist/ui/excerpts/transcript_quote_offer.d.ts.map +1 -0
  45. package/dist/ui/fill_ui_string.d.ts +32 -0
  46. package/dist/ui/fill_ui_string.d.ts.map +1 -0
  47. package/dist/ui/history/conversation_history.d.ts +203 -0
  48. package/dist/ui/history/conversation_history.d.ts.map +1 -0
  49. package/dist/ui/history/relative_time.d.ts.map +1 -1
  50. package/dist/ui/history/thread_drawer.d.ts +0 -14
  51. package/dist/ui/history/thread_drawer.d.ts.map +1 -1
  52. package/dist/ui/interrupts/confirmation_card.d.ts.map +1 -1
  53. package/dist/ui/interrupts/pending_decision.d.ts +23 -0
  54. package/dist/ui/interrupts/pending_decision.d.ts.map +1 -0
  55. package/dist/ui/placement/is_collapsible_placement.d.ts +18 -0
  56. package/dist/ui/placement/is_collapsible_placement.d.ts.map +1 -0
  57. package/dist/ui/placement/is_draggable_placement.d.ts +9 -0
  58. package/dist/ui/placement/is_draggable_placement.d.ts.map +1 -0
  59. package/dist/ui/placement/launcher_drag.d.ts +6 -0
  60. package/dist/ui/placement/launcher_drag.d.ts.map +1 -1
  61. package/dist/ui/placement/panel_placement.d.ts +119 -0
  62. package/dist/ui/placement/panel_placement.d.ts.map +1 -0
  63. package/dist/ui/progress/run_announcer.d.ts +41 -0
  64. package/dist/ui/progress/run_announcer.d.ts.map +1 -0
  65. package/dist/ui/progress/subagent_progress.d.ts +58 -0
  66. package/dist/ui/progress/subagent_progress.d.ts.map +1 -0
  67. package/dist/ui/progress/tool_call_card.d.ts.map +1 -1
  68. package/dist/ui/shell/adopt_styles.d.ts +23 -0
  69. package/dist/ui/shell/adopt_styles.d.ts.map +1 -0
  70. package/dist/ui/shell/glyph_slot.d.ts +7 -0
  71. package/dist/ui/shell/glyph_slot.d.ts.map +1 -0
  72. package/dist/ui/shell/header_button.d.ts +10 -0
  73. package/dist/ui/shell/header_button.d.ts.map +1 -0
  74. package/dist/ui/shell/icon_element.d.ts +12 -0
  75. package/dist/ui/shell/icon_element.d.ts.map +1 -0
  76. package/dist/ui/shell/is_unread_badge_enabled.d.ts +10 -0
  77. package/dist/ui/shell/is_unread_badge_enabled.d.ts.map +1 -0
  78. package/dist/ui/shell/read_launcher_icon_url.d.ts +8 -0
  79. package/dist/ui/shell/read_launcher_icon_url.d.ts.map +1 -0
  80. package/dist/ui/styles.d.ts +1 -1
  81. package/dist/ui/styles.d.ts.map +1 -1
  82. package/dist/ui/transcript/answer_actions.d.ts +39 -0
  83. package/dist/ui/transcript/answer_actions.d.ts.map +1 -0
  84. package/dist/ui/transcript/answer_stream.d.ts +56 -0
  85. package/dist/ui/transcript/answer_stream.d.ts.map +1 -0
  86. package/dist/ui/transcript/render_or_warn.d.ts +16 -0
  87. package/dist/ui/transcript/render_or_warn.d.ts.map +1 -0
  88. package/dist/ui/transcript/starter_chips.d.ts +21 -0
  89. package/dist/ui/transcript/starter_chips.d.ts.map +1 -0
  90. package/dist/ui/transcript/transcript.d.ts +171 -0
  91. package/dist/ui/transcript/transcript.d.ts.map +1 -0
  92. package/dist/ui/ui_strings.d.ts +29 -1
  93. package/dist/ui/ui_strings.d.ts.map +1 -1
  94. package/package.json +1 -1
  95. package/src/constants.ts +17 -15
  96. package/src/core/activity_registry.ts +133 -0
  97. package/src/core/ag_ui_chat.ts +945 -4419
  98. package/src/core/agui_client.ts +172 -16
  99. package/src/core/client_seed.ts +27 -0
  100. package/src/core/read_max_tool_rounds.ts +13 -0
  101. package/src/core/remote_conversation_store.ts +1 -1
  102. package/src/core/run_handlers.ts +501 -0
  103. package/src/core/storage_scope.ts +279 -0
  104. package/src/core/tool_outcome.ts +5 -3
  105. package/src/core/utils.ts +109 -0
  106. package/src/skills/skill_catalog.ts +166 -0
  107. package/src/skills/skill_name_from.ts +19 -0
  108. package/src/tools/tool_catalog.ts +354 -0
  109. package/src/tools/tool_dispatch.ts +521 -0
  110. package/src/ui/composer/attachment_tray.ts +6 -5
  111. package/src/ui/composer/auto_grow.ts +12 -0
  112. package/src/ui/composer/composer_attachments.ts +324 -0
  113. package/src/ui/composer/composer_voice.ts +93 -0
  114. package/src/ui/composer/voice_input.ts +4 -4
  115. package/src/ui/excerpts/transcript_quote_offer.ts +198 -0
  116. package/src/ui/fill_ui_string.ts +41 -0
  117. package/src/ui/history/conversation_history.ts +699 -0
  118. package/src/ui/history/relative_time.ts +5 -4
  119. package/src/ui/history/thread_drawer.ts +3 -50
  120. package/src/ui/interrupts/confirmation_card.ts +4 -2
  121. package/src/ui/interrupts/pending_decision.ts +34 -0
  122. package/src/ui/placement/is_collapsible_placement.ts +19 -0
  123. package/src/ui/placement/is_draggable_placement.ts +23 -0
  124. package/src/ui/placement/launcher_drag.ts +104 -89
  125. package/src/ui/placement/panel_placement.ts +1130 -0
  126. package/src/ui/progress/run_announcer.ts +67 -0
  127. package/src/ui/progress/subagent_progress.ts +201 -0
  128. package/src/ui/progress/tool_call_card.ts +2 -0
  129. package/src/ui/shell/adopt_styles.ts +28 -0
  130. package/src/ui/shell/glyph_slot.ts +12 -0
  131. package/src/ui/shell/header_button.ts +21 -0
  132. package/src/ui/shell/icon_element.ts +33 -0
  133. package/src/ui/shell/is_unread_badge_enabled.ts +11 -0
  134. package/src/ui/shell/read_launcher_icon_url.ts +9 -0
  135. package/src/ui/styles.ts +301 -70
  136. package/src/ui/transcript/answer_actions.ts +139 -0
  137. package/src/ui/transcript/answer_stream.ts +123 -0
  138. package/src/ui/transcript/render_or_warn.ts +22 -0
  139. package/src/ui/transcript/starter_chips.ts +42 -0
  140. package/src/ui/transcript/transcript.ts +429 -0
  141. package/src/ui/ui_strings.ts +38 -1
  142. package/src/version.ts +1 -1
@@ -0,0 +1,39 @@
1
+ import type { UiStrings } from "../ui_strings.js";
2
+ /** What the answer actions need from the element that owns them. */
3
+ export interface AnswerActionsHost {
4
+ /** The custom element: its `data-message-actions`, and where feedback is dispatched. */
5
+ readonly element: HTMLElement;
6
+ /** The resolved string table. */
7
+ readonly strings: () => UiStrings;
8
+ /** Retry the last turn, as the element's public `retryLastTurn` does. */
9
+ readonly retry: () => void;
10
+ }
11
+ /**
12
+ * The action row under a finished answer -- copy, retry, feedback -- and the
13
+ * one row currently holding Retry.
14
+ *
15
+ * Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
16
+ * instance.
17
+ */
18
+ export declare class AnswerActions {
19
+ #private;
20
+ constructor(host: AnswerActionsHost);
21
+ /** Forget the row holding Retry, with the transcript it was in. */
22
+ forget(): void;
23
+ /**
24
+ * Give a finished assistant bubble its action row, and hand it Retry.
25
+ *
26
+ * Every finished bubble gets copy and feedback -- both are safe on a message
27
+ * of any age. Retry moves to the newest, because it is the only one where
28
+ * re-running answers the same question rather than rewriting history.
29
+ *
30
+ * `data-message-actions` subtracts from that. The row is built only when
31
+ * something survives to go in it: an empty row still takes its margin, still
32
+ * answers to the `message-actions` part, and still reads to a screen reader
33
+ * as a group of actions with none in it.
34
+ */
35
+ attach(bubble: HTMLDivElement, options?: {
36
+ rateable?: boolean;
37
+ }): void;
38
+ }
39
+ //# sourceMappingURL=answer_actions.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,56 @@
1
+ /** What the streamed answer needs from the element that owns it. */
2
+ export interface AnswerStreamHost {
3
+ /** Append an empty assistant bubble to the transcript, and return it. */
4
+ readonly openBubble: () => HTMLDivElement;
5
+ /** The element's `allowImages`, read per render. */
6
+ readonly allowImages: () => boolean;
7
+ /** Keep the transcript at its foot, if the reader is there. */
8
+ readonly follow: () => void;
9
+ }
10
+ /**
11
+ * The assistant answer currently streaming: the bubble it streams into, the
12
+ * text the next frame will draw, and how many deltas it arrived in.
13
+ *
14
+ * Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
15
+ * instance.
16
+ */
17
+ export declare class AnswerStream {
18
+ #private;
19
+ constructor(host: AnswerStreamHost);
20
+ /** Text deltas the current answer has arrived in so far. */
21
+ get deltas(): number;
22
+ /**
23
+ * Count one delta received. Counted per delta received, not per render: the
24
+ * word reveal asks whether the answer *arrived* progressively, which
25
+ * coalescing renders must not change the answer to.
26
+ */
27
+ countDelta(): void;
28
+ /**
29
+ * Queue a render of the answer so far, at most one per frame.
30
+ *
31
+ * Each `TEXT_MESSAGE_CONTENT` event carries the *whole* accumulated answer,
32
+ * and drawing it means marked + DOMPurify over the entire document and a
33
+ * wholesale replacement of the bubble's subtree. Once per token that is
34
+ * quadratic in the answer's length — a long answer is agent-controlled, so
35
+ * an ordinary run becomes a progressively stalling tab — and every rebuild
36
+ * takes any selection or focus inside the bubble with it.
37
+ *
38
+ * A frame is the right grain: it is the fastest anything on screen can
39
+ * change anyway, so a burst of tokens costs one parse and the text still
40
+ * appears to flow rather than in visible chunks.
41
+ */
42
+ queue(buffer: string): void;
43
+ /** Render `buffer` into the streaming bubble now, dropping any queued frame. */
44
+ into(buffer: string): HTMLDivElement;
45
+ /**
46
+ * Close the current answer's streaming bubble.
47
+ *
48
+ * Draws a queued render first. A run that ends without a text end — a
49
+ * cancel, an error, a round boundary — leaves the last delta sitting in the
50
+ * queue, and simply dropping the bubble here would strand it: the partial
51
+ * answer the user stopped mid-sentence would lose its final tokens, or be an
52
+ * empty bubble above the stopped note.
53
+ */
54
+ end(): void;
55
+ }
56
+ //# sourceMappingURL=answer_stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer_stream.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/answer_stream.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,cAAc,CAAC;IAC1C,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,qBAAa,YAAY;;IAcvB,YAAY,IAAI,EAAE,gBAAgB,EAEjC;IAED,4DAA4D;IAC5D,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;OAIG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAU1B;IAED,gFAAgF;IAChF,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAYnC;IAED;;;;;;;;OAQG;IACH,GAAG,IAAI,IAAI,CAKV;CAgBF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Call a consumer's renderer, turning a throw into "nothing drawn".
3
+ *
4
+ * `render` is consumer code -- a host's activity renderer, a tool's `render` --
5
+ * and both call sites run inside the history replay, where a throw abandons the
6
+ * loop and takes every later turn of the transcript with it -- silently, and
7
+ * again on every reload. One thing that fails to draw is worth losing; the rest
8
+ * of the conversation is not. Reported so the failure is findable rather than
9
+ * merely survived.
10
+ *
11
+ * @param render - The consumer's renderer, already bound to its input.
12
+ * @param subject - What was being drawn, for the warning: `tool <name>` or
13
+ * `activity <type>`.
14
+ */
15
+ export declare function renderOrWarn(render: () => Node | null, subject: string): Node | null;
16
+ //# sourceMappingURL=render_or_warn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render_or_warn.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/render_or_warn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAOpF"}
@@ -0,0 +1,21 @@
1
+ import type { UiStrings } from "../ui_strings.js";
2
+ /**
3
+ * The prompts offered on an empty transcript, from `element`'s `data-starters`.
4
+ *
5
+ * Different from the suggestion chips a run pushes, which are follow-ups to
6
+ * something already said. These answer the blank-page question instead, and
7
+ * they are the host's rather than the model's -- only the host knows what its
8
+ * page is for. Shares the renderer, the count and the length limit, because
9
+ * two rows of prompt chips that behaved differently would be the harder
10
+ * thing to explain.
11
+ *
12
+ * Read once at connect: it is content for a state the widget is in before
13
+ * anything happens, and a host that wants it to change has `slot="empty"`.
14
+ *
15
+ * Parses the attribute itself rather than through the element's JSON attribute
16
+ * reader, because the warning is its own: it says no starters are shown and
17
+ * gives an example of the shape, where the shared one says a built-in default
18
+ * is in use, which for this attribute there is not.
19
+ */
20
+ export declare function renderStarterChips(element: Element, strings: UiStrings, onPick: (prompt: string) => void): HTMLElement | null;
21
+ //# sourceMappingURL=starter_chips.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter_chips.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/starter_chips.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAC/B,WAAW,GAAG,IAAI,CAgBpB"}
@@ -0,0 +1,171 @@
1
+ import type { AgUiToolCall } from "../../core/agui_client.js";
2
+ import type { MessageRole } from "../../core/message_role.js";
3
+ import type { ChartRenderer, ClientTool } from "../../tools/client_tool_registry.js";
4
+ import { ThoughtsBlock } from "../progress/thoughts_block.js";
5
+ import { ToolCallCard, type ToolPayload } from "../progress/tool_call_card.js";
6
+ import type { UiStrings } from "../ui_strings.js";
7
+ /** What the transcript needs from the element that owns it. */
8
+ export interface TranscriptHost {
9
+ /** The custom element: its text-animation attribute, and the `data-empty` stamp. */
10
+ readonly element: HTMLElement;
11
+ /** The scrolling message list. */
12
+ readonly messages: HTMLDivElement;
13
+ /** The empty-state region at the top of the list. */
14
+ readonly emptyWrap: HTMLDivElement;
15
+ /** The resolved string table. */
16
+ readonly strings: () => UiStrings;
17
+ /** The element's `allowImages`, read per render. */
18
+ readonly allowImages: () => boolean;
19
+ /** Resolve a frontend tool by name, for its `x-summary`. */
20
+ readonly resolveTool: (name: string) => ClientTool | null;
21
+ /** The element's `toolSummaries`, read per card. */
22
+ readonly toolSummaries: () => Record<string, string>;
23
+ /** The server catalog's label for a tool, if it sent one. */
24
+ readonly serverSummary: (name: string) => string | undefined;
25
+ /** The element's `formatToolPayload`, asked per region of a card. */
26
+ readonly formatToolPayload: (payload: ToolPayload) => Node | string | null;
27
+ }
28
+ /**
29
+ * The transcript: the bubbles, the open answer group, the pending dots, the
30
+ * reasoning region, the tool cards by call id, and the scroller that follows
31
+ * the foot.
32
+ *
33
+ * The hub most other parts of the element draw into, so it holds only the
34
+ * transcript's own state and asks the element for nothing but configuration.
35
+ *
36
+ * Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
37
+ * instance.
38
+ */
39
+ export declare class Transcript {
40
+ #private;
41
+ constructor(host: TranscriptHost);
42
+ /**
43
+ * Start following the foot of the list, and wire the jump button to it.
44
+ * Called while rendering rather than at construction: the viewport has to
45
+ * exist and the observer has to have something to observe. The button
46
+ * outlives a connection, so its listener goes under `signal`.
47
+ */
48
+ mountScroller(jumpButton: HTMLButtonElement, signal: AbortSignal): void;
49
+ /** Stop following, when the element leaves the document. */
50
+ disposeScroller(): void;
51
+ /** Keep the list at its foot, if the reader is there. */
52
+ follow(): void;
53
+ /** Go to the foot, whether or not the reader had scrolled away. */
54
+ jump(): void;
55
+ /** Whether the empty-state region is showing, which is when nothing else is. */
56
+ isEmpty(): boolean;
57
+ /** The card drawn for a call id, while it is still awaiting execution. */
58
+ card(callId: string): ToolCallCard | undefined;
59
+ /** Every card still awaiting execution. */
60
+ cards(): IterableIterator<ToolCallCard>;
61
+ /** Stop tracking a call's card as awaiting execution. */
62
+ forgetCard(callId: string): void;
63
+ /** Remember the element a call's card is, for a renderer to place itself against. */
64
+ setCardElement(callId: string, element: HTMLElement): void;
65
+ /** Record that a call's card was settled from a streamed server-side result. */
66
+ markServerSettled(callId: string): void;
67
+ /** Whether a call's card was settled from a streamed server-side result. */
68
+ isServerSettled(callId: string): boolean;
69
+ /** Fold the reasoning region away, once the answer has begun. */
70
+ collapseThoughts(): void;
71
+ /**
72
+ * Close the turn's answer group. Drop it if the turn rendered nothing
73
+ * (e.g. a server-only round that streamed no text/card) so an opted-in
74
+ * well leaves no empty box behind.
75
+ */
76
+ closeGroup(): void;
77
+ /**
78
+ * Let go of the open turn: its group, its reasoning region, its pending dots
79
+ * and the cards awaiting execution. The first half of wiping the transcript.
80
+ */
81
+ releaseTurn(): void;
82
+ /** Forget which cards settled from the server and where each card is. */
83
+ forgetCards(): void;
84
+ /** Empty the list back to its empty-state region. The last half of wiping it. */
85
+ empty(): void;
86
+ /** The bubble behind `AgUiChat.appendMessage`, whose doc is the contract. */
87
+ append(role: MessageRole, content: string): HTMLDivElement;
88
+ /**
89
+ * The open answer group, creating and appending it on first use. Everything a
90
+ * single assistant turn renders (text, tool cards, the pending indicator)
91
+ * goes inside it, so the opt-in `data-answer-well` styling can box the whole
92
+ * turn. Idempotent across the turn's runs — it persists until the run's
93
+ * settle closes it, see {@link closeGroup}.
94
+ */
95
+ ensureGroup(): HTMLDivElement;
96
+ /**
97
+ * Word-by-word reveal for the `word` text-animation mode, applied to a
98
+ * completed assistant bubble. `fade` is pure CSS (no JS); `none` is a no-op.
99
+ */
100
+ revealWords(bubble: HTMLDivElement): void;
101
+ /**
102
+ * Hide the empty-state region once the message list holds anything else, and
103
+ * say so on the host as `data-empty`.
104
+ *
105
+ * Stamped on the host because the layout has to answer it: where the
106
+ * composer sits is decided outside the list this region lives in, and no
107
+ * selector reaches from inside the list back up to the list's siblings. It is
108
+ * also a documented styling hook for a host's own chrome around a full-page
109
+ * chat.
110
+ */
111
+ updateEmptyState(): void;
112
+ /** A muted "⏹ Stopped" line in the transcript (distinct from the ⚠️ error bubble). */
113
+ appendStoppedNote(): void;
114
+ /**
115
+ * Show a "thinking" indicator while the agent is being awaited — both the
116
+ * silent stretch before the first token and the gap after a tool result
117
+ * while the next round is requested. Idempotent.
118
+ */
119
+ showPending(): void;
120
+ /** Remove the pending indicator if shown. */
121
+ hidePending(): void;
122
+ /**
123
+ * The current turn's thoughts region, creating it (at the top of the answer
124
+ * group, above any streamed text or tool cards) on first sight. Idempotent
125
+ * across a turn's reasoning tokens.
126
+ */
127
+ showThoughts(): ThoughtsBlock;
128
+ /**
129
+ * Render a skill notice for a `load_capability` call; ``true`` when handled.
130
+ *
131
+ * Shared by the live stream and history replay so the transcript looks the
132
+ * same before and after a reload.
133
+ */
134
+ noticeIfSkillLoad(call: AgUiToolCall): boolean;
135
+ /**
136
+ * An inline notice about something the run did.
137
+ *
138
+ * Goes through {@link ensureGroup} like a tool card so it lands *inside* the
139
+ * assistant turn it annotates rather than floating between turns, and does
140
+ * the same empty-state and scroll bookkeeping afterwards.
141
+ *
142
+ * `undo` is offered only where the agent rearranged the user's own window --
143
+ * see {@link renderRunNotice} for why a notice may carry that one control and
144
+ * nothing else.
145
+ */
146
+ appendNotice(icon: string, text: string, kind: string, undo?: {
147
+ readonly label: string;
148
+ readonly onActivate: () => void;
149
+ }): void;
150
+ /**
151
+ * Place a tool's rendered node against its own card.
152
+ *
153
+ * Anchored rather than appended because a client tool's handler does not run
154
+ * until the round is over: appending would put the node after everything the
155
+ * model said next, visibly detached from the call that produced it, and in a
156
+ * different order than the same transcript takes on reload. The card was
157
+ * created inline, in the right place, so anchoring makes *when* the handler
158
+ * runs stop mattering.
159
+ */
160
+ renderToolOutput(render: ChartRenderer, call: AgUiToolCall): void;
161
+ /** Update the empty state and follow the foot, after the transcript grew. */
162
+ afterGrew(): void;
163
+ /**
164
+ * The card for ``call``, creating and appending it on first sight.
165
+ *
166
+ * The run's tool-call handler creates the card (pending) during the run; the
167
+ * tool's execution later retrieves the same card to settle it.
168
+ */
169
+ cardFor(call: AgUiToolCall): ToolCallCard;
170
+ }
171
+ //# sourceMappingURL=transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../src/ui/transcript/transcript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAKrF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,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AAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAA;KAAE,GACjE,IAAI,CAIN;IAED;;;;;;;;;OASG;IACH,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAUhE;IAED,6EAA6E;IAC7E,SAAS,IAAI,IAAI,CAGhB;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CA0BxC;CACF"}
@@ -44,6 +44,13 @@ export interface UiStrings {
44
44
  expandUnread: string;
45
45
  /** Built-in header theme toggle (light ⇄ dark). */
46
46
  toggleTheme: string;
47
+ /**
48
+ * The greeting over an empty conversation under `placement="page"` (or an
49
+ * `embedded` panel that opted in). Token: `{name}`, the `user-name` attribute.
50
+ */
51
+ greeting: string;
52
+ /** The same greeting when the host named nobody: no `user-name`, or a blank one. */
53
+ greetingNoName: string;
47
54
  /** `aria-label` of the scrolling message log. */
48
55
  conversation: string;
49
56
  /** The button offering to return to the foot of the transcript. */
@@ -67,10 +74,25 @@ export interface UiStrings {
67
74
  stopped: string;
68
75
  /** Error shown when the stream drops without a terminal AG-UI event. */
69
76
  connectionLost: string;
70
- /** Fallback when a tool call produced no result. */
77
+ /**
78
+ * Formerly the card text for a tool call that produced no result.
79
+ *
80
+ * @deprecated No longer drawn: such a call is now answered with
81
+ * {@link callNotFinished}, on its card and in the conversation alike. Kept so a
82
+ * string table that sets it still type-checks.
83
+ */
71
84
  noResult: string;
85
+ /**
86
+ * Tool-result content (and card text) for a call that never produced a result
87
+ * and that nobody refused: the run was stopped or failed first, the page
88
+ * reloaded, or no tool here answered it. Sent to the agent, so it must not say
89
+ * a person declined.
90
+ */
91
+ callNotFinished: string;
72
92
  /** Tool-result content when the user declines a confirmed action. */
73
93
  declinedAction: string;
94
+ /** Tool-result content (and card text) when `confirmPredicate` threw, so the call was refused. */
95
+ confirmCheckFailed: string;
74
96
  /** A navigating tool's card text while the page reloads. */
75
97
  navigating: string;
76
98
  /** Notice shown when the server replaced the conversation wholesale. */
@@ -93,6 +115,8 @@ export interface UiStrings {
93
115
  notConnected: string;
94
116
  /** Composer hint when a run continuation was picked with an empty composer. */
95
117
  continueNeedsTurn: string;
118
+ /** Composer hint when a run continuation was picked while a run is in flight. */
119
+ continueWhileRunning: string;
96
120
  /** `aria-label` of the message textarea. */
97
121
  message: string;
98
122
  /** Placeholder of the message textarea. */
@@ -127,6 +151,8 @@ export interface UiStrings {
127
151
  toolError: string;
128
152
  /** Status pill on a declined call. */
129
153
  toolDeclined: string;
154
+ /** Status pill on a call that ended without a result nobody refused. */
155
+ toolInterrupted: string;
130
156
  /** Accessible label on the panel resize handle. */
131
157
  resizePanel: string;
132
158
  /** Note on a tool card whose call a human approved. */
@@ -141,6 +167,8 @@ export interface UiStrings {
141
167
  errorLabel: string;
142
168
  /** Heading over a tool card's result region when the call was declined. */
143
169
  declinedLabel: string;
170
+ /** Heading over a tool card's result region when the call did not finish. */
171
+ interruptedLabel: string;
144
172
  /** Label on the toggle that expands a tool card's body. */
145
173
  details: string;
146
174
  /**
@@ -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,MAAM,CAAC;IACpB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,C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S,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.38.0",
3
+ "version": "0.40.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
@@ -244,7 +244,13 @@ export const MESSAGE_ACTIONS = {
244
244
 
245
245
  /**
246
246
  * Lifecycle status of a rendered tool-call card. A card opens as `PENDING`
247
- * while the call runs, then settles to `DONE`, `ERROR`, or `DECLINED`.
247
+ * while the call runs, then settles to `DONE`, `ERROR`, `DECLINED` or
248
+ * `INTERRUPTED`.
249
+ *
250
+ * `INTERRUPTED` is a call that never produced a result and that nobody refused:
251
+ * the run was stopped or failed before it finished, or no tool here answered it.
252
+ * Neither of the older terminal states is true of it. `DONE` claimed a success
253
+ * nothing achieved, and `DECLINED` says a person or a guard refused.
248
254
  *
249
255
  * `DEFERRED` is the one non-terminal state that is not "running": a server-side
250
256
  * tool a `ToolGuard` gated never executed, the run finished on an interrupt, and
@@ -261,6 +267,7 @@ export const TOOL_CALL_STATUS = {
261
267
  DONE: "done",
262
268
  ERROR: "error",
263
269
  DECLINED: "declined",
270
+ INTERRUPTED: "interrupted",
264
271
  } as const;
265
272
 
266
273
  /**
@@ -276,10 +283,14 @@ export const TOOL_CALL_STATUS = {
276
283
  * annotation on the event and not a required one. `FAILED` is a call that ran
277
284
  * and failed; `DENIED` is one a person or a guard refused, so it never ran at
278
285
  * all. The two are worth distinguishing on screen because only the second is
279
- * something the user did.
280
- *
281
- * Anything *else* on the wire a value from a later protocol version, or
282
- * pydantic-ai's own `interrupted` is read as a success rather than rejected.
286
+ * something the user did. `INTERRUPTED` is a call that produced no result because
287
+ * the run ended first: pydantic-ai writes it when it repairs a history a
288
+ * cancelled stream left, and the element writes it for the same reason when a
289
+ * run ends with a call still unanswered, so the next request carries a result
290
+ * for every call without claiming anyone refused one.
291
+ *
292
+ * Anything *else* on the wire — a value from a later protocol version — is read
293
+ * as a success rather than rejected.
283
294
  * A card is a claim about what happened, and "I do not know this word" is not
284
295
  * grounds for claiming failure. `toolStatusFromOutcome` is where that is done.
285
296
  */
@@ -287,6 +298,7 @@ export const TOOL_OUTCOME = {
287
298
  SUCCESS: "success",
288
299
  FAILED: "failed",
289
300
  DENIED: "denied",
301
+ INTERRUPTED: "interrupted",
290
302
  } as const;
291
303
 
292
304
  /**
@@ -460,16 +472,6 @@ export const ANNOUNCE_CLEAR_MS = 150;
460
472
  */
461
473
  export const HIGHLIGHT_OVERLAY_Z_INDEX = 2147483001;
462
474
 
463
- /**
464
- * The panel width at which the conversation list stops covering the transcript
465
- * and docks beside it.
466
- *
467
- * Wide enough that the list and a readable column both fit: the list asks for
468
- * 300px and the reading column is capped at 820px. Below this a docked list
469
- * would leave a strip of transcript narrower than the messages in it.
470
- */
471
- export const THREADS_DOCK_MIN_WIDTH = 900;
472
-
473
475
  /**
474
476
  * How many characters a pasted string has to reach before it becomes an
475
477
  * attachment rather than composer text.
@@ -0,0 +1,133 @@
1
+ import { renderOrWarn } from "../ui/transcript/render_or_warn.js";
2
+ import type { ActivityRegistration } from "./activity_registration.js";
3
+
4
+ /** What the activity registry needs from the element that owns it. */
5
+ export interface ActivityRegistryHost {
6
+ /** The current answer group, opening one if none is open. */
7
+ readonly ensureGroup: () => HTMLDivElement;
8
+ /** Update the empty state and follow the foot after the transcript grew. */
9
+ readonly afterTranscriptGrew: () => void;
10
+ /** Append an ambient run notice to the current group. */
11
+ readonly appendNotice: (icon: string, text: string, kind: string) => void;
12
+ }
13
+
14
+ /**
15
+ * The AG-UI activities this element can draw, and the blocks it drew: which
16
+ * `activity_type`s have a renderer, which arrived with none, and the node each
17
+ * drawn activity is on screen as.
18
+ *
19
+ * Owned one-to-one by an `<ag-ui-chat>`, and holding no state outside the
20
+ * instance.
21
+ */
22
+ export class ActivityRegistry {
23
+ readonly #host: ActivityRegistryHost;
24
+ /**
25
+ * Which `activity_type`s this element can draw, by name.
26
+ *
27
+ * A registry rather than a branch because `activity_type` is an open string
28
+ * the protocol does not enumerate. The two built-ins go through it like any
29
+ * host registration, which is the test that the seam is real.
30
+ */
31
+ readonly #activityRenderers = new Map<string, ActivityRegistration>();
32
+ /** Types that arrived with nobody registered to draw them. See {@link unhandledTypes}. */
33
+ readonly #unhandledActivityTypes = new Set<string>();
34
+ /** Chart blocks by activity message id, so an update redraws in place. */
35
+ readonly #activityBlocks = new Map<string, HTMLElement>();
36
+
37
+ constructor(host: ActivityRegistryHost) {
38
+ this.#host = host;
39
+ }
40
+
41
+ /** The registration behind `AgUiChat.registerActivityRenderer`, whose doc is the contract. */
42
+ register(registration: ActivityRegistration): void {
43
+ this.#activityRenderers.set(registration.type, registration);
44
+ this.#unhandledActivityTypes.delete(registration.type);
45
+ }
46
+
47
+ /** Whether a renderer is registered for `activityType`. */
48
+ has(activityType: string): boolean {
49
+ return this.#activityRenderers.has(activityType);
50
+ }
51
+
52
+ /** The set behind `AgUiChat.unhandledActivityTypes`, whose doc is the contract. */
53
+ unhandledTypes(): readonly string[] {
54
+ return [...this.#unhandledActivityTypes];
55
+ }
56
+
57
+ /** Forget the drawn blocks, with the transcript they were drawn into. */
58
+ clearBlocks(): void {
59
+ this.#activityBlocks.clear();
60
+ }
61
+
62
+ /**
63
+ * Draw, replace or remove one activity, whatever kind it is.
64
+ *
65
+ * The single path for all three routes an activity arrives by -- pushed
66
+ * (`onActivity`), patched (`onActivityChanged`) and replayed from history --
67
+ * which is why the renderer contract has to be pure: the same content is
68
+ * drawn again on every thread load.
69
+ *
70
+ * An unregistered type draws nothing and says nothing. That is the protocol's
71
+ * own answer -- a client that does not know a name ignores the event -- and a
72
+ * warning here would fire on every well-behaved forward-compatible server,
73
+ * while a placeholder would put the protocol's growth in the user's face.
74
+ * {@link unhandledTypes} is the way to find out what arrived.
75
+ */
76
+ draw(messageId: string, activityType: string, content: unknown): void {
77
+ const registration = this.#activityRenderers.get(activityType);
78
+ if (registration === undefined) {
79
+ this.#unhandledActivityTypes.add(activityType);
80
+ return;
81
+ }
82
+ const node = renderOrWarn(() => registration.render(content), `activity ${activityType}`);
83
+ if (node === null) {
84
+ this.#remove(messageId, activityType, registration.removedNotice, content);
85
+ return;
86
+ }
87
+ const existing = this.#activityBlocks.get(messageId);
88
+ if (existing === undefined) {
89
+ this.#host.ensureGroup().appendChild(node as HTMLElement);
90
+ } else {
91
+ // Replaced rather than appended: a server redrawing under the same id
92
+ // means *this one changed*, and a second copy below the first would read
93
+ // as two measurements instead of one that moved.
94
+ existing.replaceWith(node);
95
+ }
96
+ this.#activityBlocks.set(messageId, node as HTMLElement);
97
+ this.#host.afterTranscriptGrew();
98
+ }
99
+
100
+ /**
101
+ * Take away an activity whose content stopped being drawable.
102
+ *
103
+ * Leaving the old one up is the worst available answer: it shows values that
104
+ * have been retracted, reading as current, and a reload drops it anyway
105
+ * because the *stored* content is the version that could not be drawn. Live
106
+ * and reload should agree, and both should say "gone".
107
+ *
108
+ * Removing is right; doing it in silence was not. A chart that had been drawn
109
+ * simply disappeared, with no `console` call anywhere on the path -- which
110
+ * nobody reports as a bug, they report as "the charts are flaky".
111
+ */
112
+ #remove(
113
+ messageId: string,
114
+ activityType: string,
115
+ notice: string | undefined,
116
+ content: unknown,
117
+ ): void {
118
+ const had = this.#activityBlocks.has(messageId);
119
+ this.#activityBlocks.get(messageId)?.remove();
120
+ this.#activityBlocks.delete(messageId);
121
+ console.warn(
122
+ `ag-ui-chat: activity ${messageId} (${activityType}) was not drawable and has been ` +
123
+ "removed. A chart's points must each be a finite JSON number; a numeric column " +
124
+ "serialised as a string (a Decimal, typically) is rejected rather than coerced.",
125
+ content,
126
+ );
127
+ // Only when something was on screen: content that never drew has no
128
+ // disappearance to explain, and a notice for every rejected push is noise.
129
+ if (had && notice !== undefined) {
130
+ this.#host.appendNotice("\u{1F4C9}", notice, "chart-undrawable");
131
+ }
132
+ }
133
+ }