@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.
- package/CHANGELOG.md +417 -1
- package/README.md +371 -5
- package/dist/ag-ui-web-component.bundle.js +308 -50
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +69 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +207 -0
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +38 -0
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1516 -76
- package/dist/index.js.map +4 -4
- package/dist/ui/approval_card.d.ts +18 -0
- package/dist/ui/approval_card.d.ts.map +1 -1
- package/dist/ui/checkpoint_menu.d.ts +10 -0
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/confirmation_card.d.ts +16 -0
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/message_actions.d.ts +46 -0
- package/dist/ui/message_actions.d.ts.map +1 -0
- package/dist/ui/page_quote_offer.d.ts +33 -0
- package/dist/ui/page_quote_offer.d.ts.map +1 -0
- package/dist/ui/quote_selection.d.ts +66 -0
- package/dist/ui/quote_selection.d.ts.map +1 -0
- package/dist/ui/relative_time.d.ts +10 -0
- package/dist/ui/relative_time.d.ts.map +1 -1
- package/dist/ui/stick_to_bottom.d.ts +55 -0
- package/dist/ui/stick_to_bottom.d.ts.map +1 -0
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/suggestion_chips.d.ts +29 -0
- package/dist/ui/suggestion_chips.d.ts.map +1 -0
- package/dist/ui/thread_drawer.d.ts +10 -0
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +8 -0
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +40 -0
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +75 -0
- package/src/core/ag_ui_chat.ts +927 -73
- package/src/core/agui_client.ts +63 -0
- package/src/index.ts +39 -0
- package/src/ui/approval_card.ts +90 -2
- package/src/ui/checkpoint_menu.ts +22 -5
- package/src/ui/confirmation_card.ts +29 -1
- package/src/ui/message_actions.ts +158 -0
- package/src/ui/page_quote_offer.ts +215 -0
- package/src/ui/quote_selection.ts +345 -0
- package/src/ui/relative_time.ts +11 -0
- package/src/ui/stick_to_bottom.ts +126 -0
- package/src/ui/styles.ts +227 -0
- package/src/ui/suggestion_chips.ts +73 -0
- package/src/ui/thread_drawer.ts +22 -2
- package/src/ui/tool_call_card.ts +9 -0
- package/src/ui/ui_strings.ts +60 -0
- package/src/version.ts +1 -1
package/src/constants.ts
CHANGED
|
@@ -54,6 +54,71 @@ export const ATTACHMENT_EVENT = "ag-ui-attachments";
|
|
|
54
54
|
*/
|
|
55
55
|
export const RUN_FINISHED_EVENT = "ag-ui-run-finished";
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* The agent sent an AG-UI `CUSTOM` event. `detail` is {@link CustomAgentDetail}.
|
|
59
|
+
*
|
|
60
|
+
* `CUSTOM` is one of exactly two carriers whose payload name the protocol leaves
|
|
61
|
+
* an open string, and it is the **imperative** one: something for the host page
|
|
62
|
+
* to *do*, with no place in the transcript. Its sibling `ACTIVITY_SNAPSHOT`
|
|
63
|
+
* carries transcript **content**, which is why that one is materialised into a
|
|
64
|
+
* message, persisted, and replayed on restore while this one is not.
|
|
65
|
+
*
|
|
66
|
+
* That asymmetry is the rule for choosing between them. Content has a place in
|
|
67
|
+
* the conversation and should replay; an imperative has no place and no meaning
|
|
68
|
+
* once acted on, so replaying it on a thread load would be a bug. Anything that
|
|
69
|
+
* must survive a reload belongs on the other carrier.
|
|
70
|
+
*
|
|
71
|
+
* The element takes no view of what a name means -- it forwards every one. A
|
|
72
|
+
* host that does not recognise a name ignores the event, which is the graceful
|
|
73
|
+
* outcome the open field exists for.
|
|
74
|
+
*/
|
|
75
|
+
export const CUSTOM_AGENT_EVENT = "ag-ui-custom";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The agent named resources its write has moved. `detail` is
|
|
79
|
+
* {@link InvalidateDetail}.
|
|
80
|
+
*
|
|
81
|
+
* A convention on top of {@link CUSTOM_AGENT_EVENT}, not a second channel: the
|
|
82
|
+
* wire carries an ordinary AG-UI `CUSTOM` event whose `name` is
|
|
83
|
+
* {@link INVALIDATE_CUSTOM_NAME}, and this is that one name routed to its own
|
|
84
|
+
* DOM event so a host does not have to string-match. Every other name still
|
|
85
|
+
* arrives as `ag-ui-custom`.
|
|
86
|
+
*
|
|
87
|
+
* Fires **as each announcement arrives**, during the run, which is what makes a
|
|
88
|
+
* long multi-step run feel live: the list refreshes as the third of eight writes
|
|
89
|
+
* lands rather than when everything finishes. {@link RUN_FINISHED_EVENT} carries
|
|
90
|
+
* the same keys again at the end, de-duplicated, for a host that would rather
|
|
91
|
+
* refetch once.
|
|
92
|
+
*/
|
|
93
|
+
export const INVALIDATE_EVENT = "ag-ui-invalidate";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Fired when the user rates an assistant message from its action row.
|
|
97
|
+
*
|
|
98
|
+
* `detail` is a {@link FeedbackDetail}: the rated message's text and the
|
|
99
|
+
* rating. **Nothing is stored** -- a rating belongs to whatever the host
|
|
100
|
+
* already uses to hold product signals, and a write-only table inside a chat
|
|
101
|
+
* widget is a schema nobody reads.
|
|
102
|
+
*/
|
|
103
|
+
export const FEEDBACK_EVENT = "ag-ui-feedback";
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The `activity_type` carrying server-pushed follow-up prompts.
|
|
107
|
+
*
|
|
108
|
+
* Matches django-ag-ui's `SUGGESTIONS_ACTIVITY_TYPE`. A convention inside the
|
|
109
|
+
* protocol's open `activity_type` field, not an extension of it -- so a client
|
|
110
|
+
* that has never heard of it ignores the event, and this one is not privileged.
|
|
111
|
+
*/
|
|
112
|
+
export const SUGGESTIONS_ACTIVITY_TYPE = "suggestions";
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The AG-UI `CUSTOM` event `name` that carries an invalidation.
|
|
116
|
+
*
|
|
117
|
+
* Matched exactly. Namespaced so it cannot collide with a host's own custom
|
|
118
|
+
* events, which share the field.
|
|
119
|
+
*/
|
|
120
|
+
export const INVALIDATE_CUSTOM_NAME = "ag_ui.invalidate";
|
|
121
|
+
|
|
57
122
|
/** Roles a chat message can take. */
|
|
58
123
|
export const MESSAGE_ROLE = {
|
|
59
124
|
USER: "user",
|
|
@@ -221,3 +286,13 @@ export const ICON_FILE_TEXT = `<svg class="glyph" viewBox="0 0 24 24" aria-hidde
|
|
|
221
286
|
* event, which is the graceful outcome.
|
|
222
287
|
*/
|
|
223
288
|
export const CHART_ACTIVITY_TYPE = "chart";
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* How long a screen-reader status stays in the announcer before it is emptied.
|
|
292
|
+
*
|
|
293
|
+
* Long enough for a reader to pick the change up, short enough that the region
|
|
294
|
+
* is empty again before the next status lands. Emptying is what makes an
|
|
295
|
+
* identical consecutive message announce at all -- a live region is read on
|
|
296
|
+
* *change*, and setting the same string twice is not one.
|
|
297
|
+
*/
|
|
298
|
+
export const ANNOUNCE_CLEAR_MS = 150;
|