@artooi/ag-ui-web-component 0.28.0 → 0.30.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 (65) hide show
  1. package/CHANGELOG.md +615 -1
  2. package/README.md +564 -35
  3. package/dist/ag-ui-web-component.bundle.js +491 -50
  4. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  5. package/dist/constants.d.ts +129 -1
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/core/ag_ui_chat.d.ts +232 -1
  8. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  9. package/dist/core/agui_client.d.ts +56 -1
  10. package/dist/core/agui_client.d.ts.map +1 -1
  11. package/dist/index.d.ts +8 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2081 -98
  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 +56 -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/subagent_panel.d.ts +92 -0
  34. package/dist/ui/subagent_panel.d.ts.map +1 -0
  35. package/dist/ui/subagent_update.d.ts +19 -0
  36. package/dist/ui/subagent_update.d.ts.map +1 -0
  37. package/dist/ui/suggestion_chips.d.ts +29 -0
  38. package/dist/ui/suggestion_chips.d.ts.map +1 -0
  39. package/dist/ui/thread_drawer.d.ts +10 -0
  40. package/dist/ui/thread_drawer.d.ts.map +1 -1
  41. package/dist/ui/tool_call_card.d.ts +81 -1
  42. package/dist/ui/tool_call_card.d.ts.map +1 -1
  43. package/dist/ui/ui_strings.d.ts +50 -0
  44. package/dist/ui/ui_strings.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/src/constants.ts +138 -1
  47. package/src/core/ag_ui_chat.ts +1081 -73
  48. package/src/core/agui_client.ts +89 -2
  49. package/src/index.ts +43 -0
  50. package/src/ui/approval_card.ts +90 -2
  51. package/src/ui/checkpoint_menu.ts +22 -5
  52. package/src/ui/confirmation_card.ts +29 -1
  53. package/src/ui/message_actions.ts +170 -0
  54. package/src/ui/page_quote_offer.ts +215 -0
  55. package/src/ui/quote_selection.ts +345 -0
  56. package/src/ui/relative_time.ts +11 -0
  57. package/src/ui/stick_to_bottom.ts +126 -0
  58. package/src/ui/styles.ts +410 -0
  59. package/src/ui/subagent_panel.ts +213 -0
  60. package/src/ui/subagent_update.ts +80 -0
  61. package/src/ui/suggestion_chips.ts +73 -0
  62. package/src/ui/thread_drawer.ts +22 -2
  63. package/src/ui/tool_call_card.ts +138 -3
  64. package/src/ui/ui_strings.ts +75 -0
  65. package/src/version.ts +1 -1
@@ -8,6 +8,56 @@ export type ToolDisplayMode = (typeof TOOL_DISPLAY)[keyof typeof TOOL_DISPLAY];
8
8
  export type UnsettledStatus = typeof TOOL_CALL_STATUS.PENDING | typeof TOOL_CALL_STATUS.DEFERRED;
9
9
  /** The terminal states a card settles into (everything unsettled excluded). */
10
10
  export type SettledStatus = Exclude<ToolCallStatus, UnsettledStatus>;
11
+ /**
12
+ * One region of a card's body, handed to a host {@link ToolPayloadFormatter}.
13
+ *
14
+ * A discriminated union rather than three positional parameters because the two
15
+ * halves do not carry the same thing: arguments are the parsed record the call
16
+ * was made with, and a result is the raw string the tool returned, which may not
17
+ * be JSON at all. Flattening both into one `payload` parameter would force every
18
+ * formatter to re-derive which it had before it could read it, and the
19
+ * arguments would arrive re-serialised for no reason.
20
+ *
21
+ * `toolName` is the raw tool name, not the card's `x-summary` label -- a
22
+ * formatter dispatches on identity, and the label is a display string a server
23
+ * may change.
24
+ */
25
+ export type ToolPayload = {
26
+ readonly kind: "arguments";
27
+ readonly toolName: string;
28
+ readonly args: Record<string, unknown>;
29
+ } | {
30
+ readonly kind: "result";
31
+ readonly toolName: string;
32
+ readonly status: SettledStatus;
33
+ readonly text: string;
34
+ };
35
+ /**
36
+ * Renders one region of a tool card's body, for a host that would rather show a
37
+ * table or a summary line than a wall of pretty-printed JSON.
38
+ *
39
+ * Return a `Node` to take the region over, a `string` to replace its text, or
40
+ * `null` to fall through to the built-in pretty-print -- so a formatter that
41
+ * only cares about one tool, or only about results, declines the rest rather
42
+ * than reimplementing them.
43
+ *
44
+ * **Presentation only.** The model reads the tool result from its own copy of
45
+ * the message, which this never touches, so anything said here is said to the
46
+ * person and not to the agent. Translating a value -- an enum constant into a
47
+ * friendly label, an epoch into a date -- belongs on the server, where it also
48
+ * reaches the model's prose; doing it here would make the card and the answer
49
+ * beside it disagree about what happened.
50
+ *
51
+ * A returned string is set as text, never parsed as markup: this is not a
52
+ * second HTML channel into the transcript, and a host that wants elements
53
+ * builds them itself and returns the node.
54
+ */
55
+ export type ToolPayloadFormatter = (payload: ToolPayload) => Node | string | null;
56
+ /** Optional per-card wiring beyond the name, arguments, label and strings. */
57
+ export interface ToolCallCardOptions {
58
+ /** Host presentation hook for both body regions. See {@link ToolPayloadFormatter}. */
59
+ readonly formatPayload?: ToolPayloadFormatter;
60
+ }
11
61
  /**
12
62
  * A live tool-call card for the chat transcript.
13
63
  *
@@ -27,6 +77,12 @@ export type SettledStatus = Exclude<ToolCallStatus, UnsettledStatus>;
27
77
  * `--ag-ui-tool-icon-*` custom properties or the `tool-card-icon` part without
28
78
  * the card reaching into the host stylesheet.
29
79
  *
80
+ * Either region may be drawn by the host instead: `options.formatPayload` is
81
+ * asked about each one and pretty-prints as before whenever it declines. The
82
+ * arguments are offered from the constructor and the result from {@link settle},
83
+ * because that is when each exists -- so a formatter is asked twice per card,
84
+ * potentially long apart.
85
+ *
30
86
  * Pure DOM. The host appends {@link element} into its shadow root; all visible
31
87
  * text comes from {@link UiStrings}.
32
88
  */
@@ -48,7 +104,31 @@ export declare class ToolCallCard {
48
104
  * Empty until used, and hidden while empty by the shadow CSS.
49
105
  */
50
106
  readonly approvalSlot: HTMLDivElement;
51
- constructor(name: string, args: Record<string, unknown>, summary?: string, strings?: UiStrings);
107
+ /**
108
+ * Where a *nested* run's progress renders — the sub-agent this call delegated
109
+ * to, narrating itself while the card waits.
110
+ *
111
+ * A slot rather than a rendered thing, on the same reasoning as
112
+ * {@link approvalSlot}: the card owns the position and something else owns the
113
+ * content. What makes the position right is that the wire keys a delegation on
114
+ * this card's own `toolCallId`, so the run being narrated is the one this card
115
+ * already stands for.
116
+ *
117
+ * Placed above the Details toggle rather than inside the body, because the
118
+ * body is what the display modes hide — and a progress line that only appears
119
+ * in `full` mode would leave exactly the stall it exists to end. Empty on every
120
+ * card that delegated nothing, and hidden while empty by the shadow CSS.
121
+ */
122
+ readonly subagentSlot: HTMLDivElement;
123
+ /**
124
+ * The arguments this call was made with.
125
+ *
126
+ * Retained rather than only rendered, because an approval interrupt names a
127
+ * `toolCallId` and nothing else -- so this card is the only place the args
128
+ * still exist when the user is asked to approve, edit or deny the call.
129
+ */
130
+ readonly args: Record<string, unknown>;
131
+ constructor(name: string, args: Record<string, unknown>, summary?: string, strings?: UiStrings, options?: ToolCallCardOptions);
52
132
  /**
53
133
  * Move between the two states that are not an outcome — `pending` (running)
54
134
  * and `deferred` (gated, waiting on a person).
@@ -1 +1 @@
1
- {"version":3,"file":"tool_call_card.d.ts","sourceRoot":"","sources":["../../src/ui/tool_call_card.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AC,EAAE,oBAAoB,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,YAAY;;IACvB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAEjC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC;IAStC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAMvC,YACE,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE,SAA8B,EACvC,OAAO,GAAE,mBAAwB,EAkFlC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAMlC;IAED;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAKlD;IAED,gFAAgF;IAChF,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBhD;CAkEF"}
@@ -30,6 +30,18 @@ export interface UiStrings {
30
30
  toggleTheme: string;
31
31
  /** `aria-label` of the scrolling message log. */
32
32
  conversation: string;
33
+ /** The button offering to return to the foot of the transcript. */
34
+ jumpToLatest: string;
35
+ /** Announced when a turn starts. Screen-reader only; never rendered. */
36
+ announceResponding: string;
37
+ /** Announced when the answer has finished arriving. Screen-reader only. */
38
+ announceAnswerReady: string;
39
+ /** Announced when a card is waiting for the user's decision. Token: `{count}`. */
40
+ announceAwaitingDecision: string;
41
+ /** Announced when the user stopped the run. Screen-reader only. */
42
+ announceStopped: string;
43
+ /** Announced when the run failed. Screen-reader only. */
44
+ announceFailed: string;
33
45
  /** `aria-label` of the "thinking" pending indicator, and the thoughts region's
34
46
  * header while the model is still reasoning. */
35
47
  thinking: string;
@@ -45,6 +57,10 @@ export interface UiStrings {
45
57
  declinedAction: string;
46
58
  /** A navigating tool's card text while the page reloads. */
47
59
  navigating: string;
60
+ /** Notice shown when the server replaced the conversation wholesale. */
61
+ historyReplaced: string;
62
+ /** Notice shown when a pushed chart could not be drawn and was removed. */
63
+ chartUndrawable: string;
48
64
  /** Missing-placeholder skill hint. Tokens: `{title}`, `{fields}`. */
49
65
  skillNeeds: string;
50
66
  /** Notice shown when the agent condensed earlier turns. Token: `{count}`. */
@@ -107,8 +123,42 @@ export interface UiStrings {
107
123
  declinedLabel: string;
108
124
  /** Label on the toggle that expands a tool card's body. */
109
125
  details: string;
126
+ /**
127
+ * The delegation row's text before the server's own status line lands.
128
+ *
129
+ * A fallback, not a state: every announcement carries a pre-rendered `status`,
130
+ * and this only shows if one arrives unusable. The row is the expander, so it
131
+ * must never be blank.
132
+ */
133
+ subAgentWorking: string;
134
+ /** `aria-label` of the region holding the sub-agent's own tool calls. */
135
+ subAgentSteps: string;
136
+ /** `aria-label` of the editable arguments field on an approval card. */
137
+ approvalEditArgs: string;
138
+ /** Shown when the edited arguments are not valid JSON. */
139
+ approvalArgsInvalid: string;
140
+ /** Shown when the edited arguments parse but are not a JSON object. */
141
+ approvalArgsNotAnObject: string;
142
+ /** `aria-label` of the follow-up suggestion chips row. */
143
+ suggestions: string;
144
+ /** `aria-label` of a message's action row. */
145
+ messageActions: string;
146
+ /** The offer that floats beside a selection in the transcript. */
147
+ quoteSelection: string;
148
+ /** Copy this message (button `title` / `aria-label`). Its confirmation and
149
+ * failure text are the code block's `copied` / `copyFailed`, which say the
150
+ * same thing about the same clipboard. */
151
+ copyMessage: string;
152
+ /** Ask for a different answer to the same question. */
153
+ retryMessage: string;
154
+ /** Rate this answer as good. */
155
+ feedbackUp: string;
156
+ /** Rate this answer as poor. */
157
+ feedbackDown: string;
110
158
  /** `aria-label` of the inline confirmation card. */
111
159
  confirmAction: string;
160
+ /** Waive confirmation for this tool for the rest of the session. Token: `{tool}`. */
161
+ confirmAlways: string;
112
162
  /** Generic confirmation prompt when a tool has no `x-confirm`. Token: `{tool}`. */
113
163
  confirmRun: string;
114
164
  /** Confirm button. */
@@ -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,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IAGpB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB;oDACgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IAC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,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;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,SAsHhC,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.28.0",
3
+ "version": "0.30.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
@@ -54,6 +54,110 @@ 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
+
122
+ /**
123
+ * The AG-UI `CUSTOM` event `name` carrying a delegated sub-agent's progress.
124
+ *
125
+ * Matched exactly, and namespaced the way {@link INVALIDATE_CUSTOM_NAME} is, so
126
+ * it cannot collide with a host's own custom events on the same open field.
127
+ *
128
+ * Routed to the delegating tool card rather than dispatched to the page: the
129
+ * payload keys on the **parent's own `delegate_task` call id**, so what it
130
+ * describes is already on screen and the progress belongs beside it. Every other
131
+ * name still reaches the host as {@link CUSTOM_AGENT_EVENT}.
132
+ *
133
+ * Deliberately on the imperative carrier and not on an activity, which means it
134
+ * is **never persisted and never replayed**. That is the right half of the
135
+ * split: a delegation that was live an hour ago is not live now, and replaying
136
+ * its progress on a thread restore would be a lie about a run that is over. On a
137
+ * reload mid-run the nested detail is gone and the tool card remains.
138
+ */
139
+ export const SUBAGENT_CUSTOM_NAME = "ag_ui.subagent";
140
+
141
+ /**
142
+ * The phases one delegation moves through, as the server spells them.
143
+ *
144
+ * Exactly one `STARTED` opens a delegation and exactly one `FINISHED` or
145
+ * `FAILED` closes it; the two tool phases repeat in between, once per call the
146
+ * child makes and once per result it gets back.
147
+ *
148
+ * `FAILED` carries **no exception text**, deliberately — the same reasoning that
149
+ * redacts a `RUN_ERROR`, since an exception's words are written for an operator.
150
+ * The detail rides the ordinary `TOOL_CALL_RESULT` for that delegation, on the
151
+ * card the progress is already attached to.
152
+ */
153
+ export const SUBAGENT_PHASE = {
154
+ STARTED: "started",
155
+ TOOL_CALL: "tool_call",
156
+ TOOL_RESULT: "tool_result",
157
+ FINISHED: "finished",
158
+ FAILED: "failed",
159
+ } as const;
160
+
57
161
  /** Roles a chat message can take. */
58
162
  export const MESSAGE_ROLE = {
59
163
  USER: "user",
@@ -93,9 +197,32 @@ export const X_NAVIGATES_KEY = "x-navigates";
93
197
  */
94
198
  export const READ_PAGE_TOOL = "read_page";
95
199
 
96
- /** Upper bound on frontend tool-call → re-run rounds within one send. */
200
+ /**
201
+ * Default upper bound on frontend tool-call → re-run rounds within one send.
202
+ * Overridable via `data-max-tool-rounds`, or `AgUiClientConfig.maxToolRounds`
203
+ * for a host driving the client directly.
204
+ */
97
205
  export const MAX_TOOL_ROUNDS = 10;
98
206
 
207
+ /**
208
+ * The actions a finished assistant message's row can carry, and the tokens
209
+ * `data-message-actions` selects them by.
210
+ *
211
+ * All three are on when the attribute is absent. Naming them individually
212
+ * rather than shipping one on/off switch is what the three differ over: feedback
213
+ * is only useful to a host listening for {@link FEEDBACK_EVENT}, retry re-runs
214
+ * the agent and a constrained surface may not permit that, and copy is the one
215
+ * nobody objects to. A single switch would make dropping either of the first two
216
+ * cost the third, and a host that only wanted one gone would rebuild the row
217
+ * from `attachMessageActions` -- reimplementing the part names, the accessible
218
+ * grouping and the retry hand-off to lose two buttons.
219
+ */
220
+ export const MESSAGE_ACTIONS = {
221
+ COPY: "copy",
222
+ RETRY: "retry",
223
+ FEEDBACK: "feedback",
224
+ } as const;
225
+
99
226
  /**
100
227
  * Lifecycle status of a rendered tool-call card. A card opens as `PENDING`
101
228
  * while the call runs, then settles to `DONE`, `ERROR`, or `DECLINED`.
@@ -221,3 +348,13 @@ export const ICON_FILE_TEXT = `<svg class="glyph" viewBox="0 0 24 24" aria-hidde
221
348
  * event, which is the graceful outcome.
222
349
  */
223
350
  export const CHART_ACTIVITY_TYPE = "chart";
351
+
352
+ /**
353
+ * How long a screen-reader status stays in the announcer before it is emptied.
354
+ *
355
+ * Long enough for a reader to pick the change up, short enough that the region
356
+ * is empty again before the next status lands. Emptying is what makes an
357
+ * identical consecutive message announce at all -- a live region is read on
358
+ * *change*, and setting the same string twice is not one.
359
+ */
360
+ export const ANNOUNCE_CLEAR_MS = 150;