@artooi/ag-ui-web-component 0.23.0 → 0.24.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 +149 -36
- package/README.md +140 -9
- package/dist/ag-ui-web-component.bundle.js +113 -122
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/constants.d.ts +71 -85
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts +105 -127
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +24 -30
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/attachment.d.ts +9 -14
- package/dist/core/attachment.d.ts.map +1 -1
- package/dist/core/conversation_store.d.ts +38 -27
- package/dist/core/conversation_store.d.ts.map +1 -1
- package/dist/core/create_http_agent.d.ts +13 -15
- package/dist/core/create_http_agent.d.ts.map +1 -1
- package/dist/core/remote_conversation_store.d.ts +10 -9
- package/dist/core/remote_conversation_store.d.ts.map +1 -1
- package/dist/core/run_index.d.ts +11 -20
- package/dist/core/run_index.d.ts.map +1 -1
- package/dist/core/transcribe_audio.d.ts +8 -8
- package/dist/core/transcribe_audio.d.ts.map +1 -1
- package/dist/core/upload_attachment.d.ts +15 -18
- package/dist/core/upload_attachment.d.ts.map +1 -1
- package/dist/core/utils.d.ts +4 -6
- package/dist/core/utils.d.ts.map +1 -1
- package/dist/dom/animations.d.ts +22 -30
- package/dist/dom/animations.d.ts.map +1 -1
- package/dist/dom/dom_driver.d.ts +7 -7
- package/dist/dom/native_setter.d.ts +2 -2
- package/dist/dom/native_setter.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +357 -383
- package/dist/index.js.map +2 -2
- package/dist/skills/fill_template.d.ts +4 -5
- package/dist/skills/fill_template.d.ts.map +1 -1
- package/dist/skills/parse_skills.d.ts.map +1 -1
- package/dist/skills/skill.d.ts +7 -8
- package/dist/skills/skill.d.ts.map +1 -1
- package/dist/tools/client_tool_registry.d.ts +2 -2
- package/dist/tools/page_action_tools.d.ts +7 -10
- package/dist/tools/page_action_tools.d.ts.map +1 -1
- package/dist/tools/page_state.d.ts +5 -8
- package/dist/tools/page_state.d.ts.map +1 -1
- package/dist/tools/route_map.d.ts +7 -10
- package/dist/tools/route_map.d.ts.map +1 -1
- package/dist/ui/approval_card.d.ts +15 -20
- package/dist/ui/approval_card.d.ts.map +1 -1
- package/dist/ui/attach_copy_buttons.d.ts +4 -10
- package/dist/ui/attach_copy_buttons.d.ts.map +1 -1
- package/dist/ui/attachment_chips.d.ts +7 -10
- package/dist/ui/attachment_chips.d.ts.map +1 -1
- package/dist/ui/attachment_tray.d.ts +6 -6
- package/dist/ui/checkpoint_menu.d.ts +7 -8
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/confirmation_card.d.ts +10 -15
- package/dist/ui/confirmation_card.d.ts.map +1 -1
- package/dist/ui/question_card.d.ts +12 -15
- package/dist/ui/question_card.d.ts.map +1 -1
- package/dist/ui/relative_time.d.ts +5 -7
- package/dist/ui/relative_time.d.ts.map +1 -1
- package/dist/ui/render_markdown.d.ts +8 -8
- package/dist/ui/render_markdown.d.ts.map +1 -1
- package/dist/ui/resize_handle.d.ts +21 -34
- package/dist/ui/resize_handle.d.ts.map +1 -1
- package/dist/ui/run_notice.d.ts +5 -7
- package/dist/ui/run_notice.d.ts.map +1 -1
- package/dist/ui/skills_menu.d.ts +4 -5
- package/dist/ui/skills_menu.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/thoughts_block.d.ts +9 -11
- package/dist/ui/thoughts_block.d.ts.map +1 -1
- package/dist/ui/thread_drawer.d.ts +6 -5
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts +17 -25
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +6 -12
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/dist/ui/voice_input.d.ts +10 -11
- package/dist/ui/voice_input.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +74 -87
- package/src/core/ag_ui_chat.ts +313 -269
- package/src/core/agui_client.ts +60 -71
- package/src/core/attachment.ts +9 -14
- package/src/core/conversation_store.ts +55 -33
- package/src/core/create_http_agent.ts +18 -22
- package/src/core/remote_conversation_store.ts +28 -15
- package/src/core/run_index.ts +14 -23
- package/src/core/transcribe_audio.ts +9 -10
- package/src/core/upload_attachment.ts +18 -21
- package/src/core/utils.ts +4 -6
- package/src/dom/animations.ts +33 -43
- package/src/dom/dom_driver.ts +7 -7
- package/src/dom/native_setter.ts +11 -12
- package/src/index.ts +3 -0
- package/src/skills/fill_template.ts +4 -5
- package/src/skills/parse_skills.ts +3 -4
- package/src/skills/skill.ts +7 -8
- package/src/tools/client_tool_registry.ts +2 -2
- package/src/tools/page_action_tools.ts +12 -15
- package/src/tools/page_state.ts +5 -8
- package/src/tools/route_map.ts +15 -19
- package/src/ui/approval_card.ts +15 -20
- package/src/ui/attach_copy_buttons.ts +9 -18
- package/src/ui/attachment_chips.ts +7 -10
- package/src/ui/attachment_tray.ts +6 -6
- package/src/ui/checkpoint_menu.ts +7 -8
- package/src/ui/confirmation_card.ts +10 -15
- package/src/ui/question_card.ts +12 -15
- package/src/ui/relative_time.ts +5 -7
- package/src/ui/render_markdown.ts +25 -51
- package/src/ui/resize_handle.ts +25 -38
- package/src/ui/run_notice.ts +9 -12
- package/src/ui/skills_menu.ts +4 -5
- package/src/ui/styles.ts +92 -101
- package/src/ui/thoughts_block.ts +11 -13
- package/src/ui/thread_drawer.ts +6 -5
- package/src/ui/tool_call_card.ts +22 -32
- package/src/ui/ui_strings.ts +6 -12
- package/src/ui/voice_input.ts +10 -11
- package/src/version.ts +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,88 +1,80 @@
|
|
|
1
1
|
/** The Custom Element tag name registered by {@link defineAgUiChat}. */
|
|
2
2
|
export declare const ELEMENT_TAG = "ag-ui-chat";
|
|
3
|
-
/**
|
|
4
|
-
* Event dispatched by `<ag-ui-chat>` when the user submits a message.
|
|
5
|
-
* `detail` carries `{ content: string }`. Later phases wire this to the
|
|
6
|
-
* AG-UI client; for now it is the public seam for host integration.
|
|
7
|
-
*/
|
|
3
|
+
/** User submitted a message. `detail` is {@link SubmitDetail}. */
|
|
8
4
|
export declare const SUBMIT_EVENT = "ag-ui-submit";
|
|
9
5
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `{ collapsed: boolean }`. A host can listen to drive its own chrome, or hide
|
|
13
|
-
* the built-in toggle and drive the `collapsed` attribute itself.
|
|
6
|
+
* Collapsed state changed, via the built-in toggle or `setCollapsed`.
|
|
7
|
+
* `detail` is {@link ToggleDetail}.
|
|
14
8
|
*/
|
|
15
9
|
export declare const TOGGLE_EVENT = "ag-ui-toggle";
|
|
16
10
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* The built-in badge on the launcher renders exactly this. A host driving its
|
|
22
|
-
* own chrome can turn the badge off with `data-unread-badge="false"` and listen
|
|
23
|
-
* here instead.
|
|
11
|
+
* The count of answers that arrived while collapsed changed. `detail` is
|
|
12
|
+
* {@link UnreadDetail}. The built-in launcher badge renders exactly this; a
|
|
13
|
+
* host driving its own chrome sets `data-unread-badge="false"` and listens.
|
|
24
14
|
*/
|
|
25
15
|
export declare const UNREAD_EVENT = "ag-ui-unread";
|
|
26
16
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* {@link AgUiChat.sharedState}. `detail` carries `{ state }`.
|
|
17
|
+
* AG-UI shared state changed — a streamed `STATE_SNAPSHOT` / `STATE_DELTA`, or
|
|
18
|
+
* a host assignment to `sharedState`. `detail` is {@link StateDetail}.
|
|
30
19
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
20
|
+
* The protocol's own state channel, distinct from `registerPageState`, which
|
|
21
|
+
* exposes host state to the agent as ordinary tools.
|
|
33
22
|
*/
|
|
34
23
|
export declare const STATE_EVENT = "ag-ui-state";
|
|
35
24
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* This is the seam for a host that drives its own composer: without it the tray
|
|
43
|
-
* only ever spoke to the built-in Send button, so a custom send had no way to
|
|
44
|
-
* know whether a file was ready or still uploading.
|
|
25
|
+
* The attachment tray changed — a file queued, an upload finishing or failing,
|
|
26
|
+
* a chip removed, the tray cleared after a send. `detail` is
|
|
27
|
+
* {@link AttachmentsDetail}, carrying the refs that finished uploading and how
|
|
28
|
+
* many are still in flight. A host driving its own composer uses this to know
|
|
29
|
+
* whether a send would leave files behind.
|
|
45
30
|
*/
|
|
46
31
|
export declare const ATTACHMENT_EVENT = "ag-ui-attachments";
|
|
32
|
+
/**
|
|
33
|
+
* An interaction has finished, whatever ended it. `detail` is
|
|
34
|
+
* {@link RunFinishedDetail}, listing the tools that ran and which side ran them.
|
|
35
|
+
*
|
|
36
|
+
* For hosts that render data the agent can change. A server-side tool writes
|
|
37
|
+
* without the page's knowledge — nothing else the element dispatches implies
|
|
38
|
+
* "something may have moved underneath you", so a page showing that data has no
|
|
39
|
+
* reason to refetch and quietly goes stale. Shared state
|
|
40
|
+
* ({@link STATE_EVENT}) is the richer channel, but it needs the agent to emit
|
|
41
|
+
* state; this needs nothing of the agent at all.
|
|
42
|
+
*
|
|
43
|
+
* Fires once per interaction rather than once per tool round, on completion,
|
|
44
|
+
* error and cancellation alike, since a partial write is still a write.
|
|
45
|
+
*/
|
|
46
|
+
export declare const RUN_FINISHED_EVENT = "ag-ui-run-finished";
|
|
47
47
|
/** Roles a chat message can take. */
|
|
48
48
|
export declare const MESSAGE_ROLE: {
|
|
49
49
|
readonly USER: "user";
|
|
50
50
|
readonly ASSISTANT: "assistant";
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
56
|
-
* confirmation modal (unless `autoConfirm` is set).
|
|
53
|
+
* Schema-root key marking a tool destructive: the element gates its execution
|
|
54
|
+
* behind the confirmation card unless `autoConfirm` is set. All four `x-*` keys
|
|
55
|
+
* below mirror the `django-ag-ui` server side.
|
|
57
56
|
*/
|
|
58
57
|
export declare const X_DESTRUCTIVE_KEY = "x-destructive";
|
|
59
58
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* server side. When present, the inline confirmation card shows this instead of
|
|
63
|
-
* the generic `Run "<tool>"?`.
|
|
59
|
+
* Schema-root key holding a confirmation prompt (e.g. `"Activate this
|
|
60
|
+
* project?"`), shown instead of the generic `Run "<tool>"?`.
|
|
64
61
|
*/
|
|
65
62
|
export declare const X_CONFIRM_KEY = "x-confirm";
|
|
66
63
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* side; the tool-call card shows it instead of the raw tool name when present.
|
|
64
|
+
* Schema-root key holding a short label for a tool (e.g. `"Query orders"` for
|
|
65
|
+
* `query_model`), shown on the card instead of the raw tool name.
|
|
70
66
|
*/
|
|
71
67
|
export declare const X_SUMMARY_KEY = "x-summary";
|
|
72
68
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* and resumes the run loop once the next page mounts. Mirrors `x-destructive`.
|
|
69
|
+
* Schema-root key marking a tool as navigating — its handler triggers a full
|
|
70
|
+
* page reload. The element checkpoints the call before the reload and resumes
|
|
71
|
+
* the run loop once the next page mounts.
|
|
77
72
|
*/
|
|
78
73
|
export declare const X_NAVIGATES_KEY = "x-navigates";
|
|
79
74
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* also the documented recovery from a stale page, so the stale-page guard has
|
|
84
|
-
* to exempt it — refusing the very call that would refresh the agent's view
|
|
85
|
-
* would be a deadlock.
|
|
75
|
+
* The built-in tool that re-reads the current page, registered only when a
|
|
76
|
+
* page-map provider is set. Named here because the stale-page guard must exempt
|
|
77
|
+
* it: refusing the one call that would refresh the agent's view deadlocks.
|
|
86
78
|
*/
|
|
87
79
|
export declare const READ_PAGE_TOOL = "read_page";
|
|
88
80
|
/** Upper bound on frontend tool-call → re-run rounds within one send. */
|
|
@@ -109,22 +101,19 @@ export declare const ATTACHMENT_STATUS: {
|
|
|
109
101
|
};
|
|
110
102
|
/**
|
|
111
103
|
* Default client-side upload size cap (10 MiB), matching django-ag-ui's
|
|
112
|
-
* `ATTACHMENT_MAX_BYTES
|
|
113
|
-
*
|
|
104
|
+
* `ATTACHMENT_MAX_BYTES`. Overridable via `data-attachment-max-bytes`; the
|
|
105
|
+
* server stays authoritative.
|
|
114
106
|
*/
|
|
115
107
|
export declare const DEFAULT_ATTACHMENT_MAX_BYTES: number;
|
|
116
108
|
/**
|
|
117
|
-
* How much detail a tool-call card shows. Set via
|
|
118
|
-
*
|
|
109
|
+
* How much detail a tool-call card shows. Set via `data-tool-display`; the
|
|
110
|
+
* default is `full`.
|
|
119
111
|
*
|
|
120
|
-
* - `inline` —
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* - `
|
|
125
|
-
* - `compact` — name + status, with args *and* result tucked behind a single
|
|
126
|
-
* collapsed "Details" toggle. The light default for dense UIs.
|
|
127
|
-
* - `full` — args shown inline, result behind its own toggle (the original).
|
|
112
|
+
* - `inline` — one status row (icon + summary), no card chrome, result behind
|
|
113
|
+
* its own toggle. Reads as a line of the answer rather than a boxed card.
|
|
114
|
+
* - `minimal` — tool name + status pill only. No args, no result body.
|
|
115
|
+
* - `compact` — name + status, args and result behind one "Details" toggle.
|
|
116
|
+
* - `full` — args inline, result behind its own toggle.
|
|
128
117
|
*/
|
|
129
118
|
export declare const TOOL_DISPLAY: {
|
|
130
119
|
readonly INLINE: "inline";
|
|
@@ -133,30 +122,30 @@ export declare const TOOL_DISPLAY: {
|
|
|
133
122
|
readonly FULL: "full";
|
|
134
123
|
};
|
|
135
124
|
/**
|
|
136
|
-
* `activityType` of the
|
|
137
|
-
*
|
|
138
|
-
*
|
|
125
|
+
* `activityType` of the `ACTIVITY_SNAPSHOT` event django-ag-ui emits when a
|
|
126
|
+
* compaction capability trimmed the history. `content` carries
|
|
127
|
+
* `{ removed, before, after }`.
|
|
139
128
|
*/
|
|
140
129
|
export declare const COMPACTION_ACTIVITY_TYPE = "compaction";
|
|
141
130
|
/**
|
|
142
|
-
* Pydantic-AI's built-in tool
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* reaches the client — there is no separate event for it.
|
|
131
|
+
* Pydantic-AI's built-in tool for loading a deferred capability, with `{ id }`
|
|
132
|
+
* naming it. Agent skills are deferred capabilities keyed by skill name, so a
|
|
133
|
+
* call to this tool is the only signal that the agent picked a skill.
|
|
146
134
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
135
|
+
* Distinct from the host-provided {@link Skill} catalog, which is a human
|
|
136
|
+
* affordance launched from the slash palette.
|
|
149
137
|
*/
|
|
150
138
|
export declare const LOAD_CAPABILITY_TOOL = "load_capability";
|
|
151
139
|
/**
|
|
152
140
|
* The chrome's glyphs, as inline SVG markup.
|
|
153
141
|
*
|
|
154
|
-
* Static
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* of stroking. A host
|
|
159
|
-
* `slot="icon-…"` child
|
|
142
|
+
* Static author-written markup assigned as a `<slot>`'s fallback content, so it
|
|
143
|
+
* never passes through the sanitiser — nothing here is user or server data, and
|
|
144
|
+
* nothing user-supplied may be interpolated into it. Each icon is a 24x24
|
|
145
|
+
* viewBox carrying the shared `glyph` class, which `STYLES` sizes and paints
|
|
146
|
+
* from `currentColor`; `glyph--solid` fills instead of stroking. A host wanting
|
|
147
|
+
* its own mark projects a matching `slot="icon-…"` child instead of editing
|
|
148
|
+
* these.
|
|
160
149
|
*/
|
|
161
150
|
export declare const ICON_SEND = "<svg class=\"glyph\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12 19.5V5m-6.5 6.5L12 5l6.5 6.5\"/></svg>";
|
|
162
151
|
/** The Stop glyph the composer button wears while a run is in flight. */
|
|
@@ -168,13 +157,10 @@ export declare const ICON_VOICE = "<svg class=\"glyph\" viewBox=\"0 0 24 24\" ar
|
|
|
168
157
|
/** The default launcher mark (a speech bubble), shown when the host slots none. */
|
|
169
158
|
export declare const ICON_LAUNCHER = "<svg class=\"glyph\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H9l-5 4z\"/></svg>";
|
|
170
159
|
/**
|
|
171
|
-
* The attachment-chip
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* one, so nothing user- or server-supplied reaches the markup.
|
|
176
|
-
*
|
|
177
|
-
* The generic mark, for a family with nothing more specific to say.
|
|
160
|
+
* The generic attachment-chip mark, for a file family with nothing more
|
|
161
|
+
* specific to say. The chip marks share the contract of the chrome glyphs
|
|
162
|
+
* above; `iconFor` selects one by MIME family, never interpolating the MIME
|
|
163
|
+
* string into the markup.
|
|
178
164
|
*/
|
|
179
165
|
export declare const ICON_FILE = "<svg class=\"glyph\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z\"/><path d=\"M14 3v5h5\"/></svg>";
|
|
180
166
|
/** An image attachment: a framed picture with a horizon and a sun. */
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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
|
|
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,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,yEAAyE;AACzE,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;aAC3B,OAAO,EAAE,SAAS;aAClB,IAAI,EAAE,MAAM;aACZ,KAAK,EAAE,OAAO;aACd,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;aAC5B,SAAS,EAAE,WAAW;aACtB,KAAK,EAAE,OAAO;aACd,KAAK,EAAE,OAAO;CACN,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAE7D;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;aACvB,MAAM,EAAE,QAAQ;aAChB,OAAO,EAAE,SAAS;aAClB,OAAO,EAAE,SAAS;aAClB,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,eAAe,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,yHAAiH,CAAC;AAExI,yEAAyE;AACzE,eAAO,MAAM,SAAS,qJAAqI,CAAC;AAE5J,2CAA2C;AAC3C,eAAO,MAAM,WAAW,wJAAgJ,CAAC;AAEzK,yDAAyD;AACzD,eAAO,MAAM,UAAU,0MAA8L,CAAC;AAEtN,mFAAmF;AACnF,eAAO,MAAM,aAAa,2KAAmK,CAAC;AAE9L;;;;;GAKG;AACH,eAAO,MAAM,SAAS,0KAAgK,CAAC;AAEvL,sEAAsE;AACtE,eAAO,MAAM,eAAe,kOAA0M,CAAC;AAEvO,sEAAsE;AACtE,eAAO,MAAM,aAAa,iQAA2O,CAAC;AAEtQ,gDAAgD;AAChD,eAAO,MAAM,cAAc,8MAAkM,CAAC"}
|
|
@@ -34,6 +34,21 @@ export interface AttachmentsDetail {
|
|
|
34
34
|
export interface StateDetail {
|
|
35
35
|
readonly state: Readonly<Record<string, unknown>>;
|
|
36
36
|
}
|
|
37
|
+
/** One tool that ran during an interaction, as {@link RunFinishedDetail} lists it. */
|
|
38
|
+
export interface ToolRun {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Where it executed. `"server"` is the one a data-rendering host cares about:
|
|
42
|
+
* a `"client"` tool ran in the host's own handler, so the host already knows
|
|
43
|
+
* whatever it did.
|
|
44
|
+
*/
|
|
45
|
+
readonly side: "server" | "client";
|
|
46
|
+
}
|
|
47
|
+
/** `detail` shape of the {@link RUN_FINISHED_EVENT} CustomEvent. */
|
|
48
|
+
export interface RunFinishedDetail {
|
|
49
|
+
/** In settle order. Empty when the interaction called no tools. */
|
|
50
|
+
readonly tools: readonly ToolRun[];
|
|
51
|
+
}
|
|
37
52
|
/** `detail` shape of the {@link TOGGLE_EVENT} CustomEvent. */
|
|
38
53
|
export interface ToggleDetail {
|
|
39
54
|
readonly collapsed: boolean;
|
|
@@ -46,42 +61,35 @@ export interface UnreadDetail {
|
|
|
46
61
|
* `<ag-ui-chat>` — a framework-free chat sidebar Web Component over AG-UI.
|
|
47
62
|
*
|
|
48
63
|
* Owns the Shadow DOM shell (header, scrolling message list, input row),
|
|
49
|
-
* builds an {@link AgUiClient} on first send
|
|
50
|
-
* {@link agentFactory}
|
|
64
|
+
* builds an {@link AgUiClient} on first send via the overridable
|
|
65
|
+
* {@link agentFactory}, and renders streaming assistant text plus tool-call
|
|
51
66
|
* activity. Emits a {@link SUBMIT_EVENT} for host visibility.
|
|
52
67
|
*
|
|
53
|
-
* The per-run frontend tool catalog and context
|
|
54
|
-
* {@link
|
|
55
|
-
* registry, DOM driver) populate.
|
|
68
|
+
* The per-run frontend tool catalog and context come from {@link getTools} and
|
|
69
|
+
* {@link getContext}.
|
|
56
70
|
*/
|
|
57
71
|
export declare class AgUiChat extends HTMLElement {
|
|
58
72
|
#private;
|
|
59
73
|
/** Agent factory; override to inject a custom or fake agent (tests). */
|
|
60
74
|
agentFactory: AgentFactory;
|
|
61
75
|
/**
|
|
62
|
-
* Static extra HTTP headers, sent with
|
|
63
|
-
*
|
|
64
|
-
*
|
|
76
|
+
* Static extra HTTP headers, sent with every request this element makes: the
|
|
77
|
+
* agent run, the thread index and its messages, the tool and skill catalogs,
|
|
78
|
+
* the run index, uploads and transcription.
|
|
65
79
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* re-assignment updates it, so a token captured here is pinned until the host
|
|
70
|
-
* remembers to assign again.
|
|
80
|
+
* For values fixed for the element's lifetime. A rotating credential belongs
|
|
81
|
+
* in {@link getHeaders} instead — only a re-assignment updates this, so a
|
|
82
|
+
* token captured here is pinned until the host assigns again.
|
|
71
83
|
*/
|
|
72
84
|
headers: Record<string, string>;
|
|
73
85
|
/**
|
|
74
|
-
* Live header source,
|
|
75
|
-
* supply rotating credentials
|
|
76
|
-
*
|
|
77
|
-
* Set it to a function and each request calls it afresh: a token refreshed by
|
|
78
|
-
* the host between two requests reaches the second one, with nothing to
|
|
79
|
-
* re-assign and nothing to keep in sync.
|
|
86
|
+
* Live header source, called afresh immediately before every request — the
|
|
87
|
+
* way to supply rotating credentials, with nothing to re-assign or keep in
|
|
88
|
+
* sync.
|
|
80
89
|
*
|
|
81
|
-
* Composes with {@link headers} rather than replacing it:
|
|
82
|
-
*
|
|
83
|
-
* `Authorization`
|
|
84
|
-
* the other.
|
|
90
|
+
* Composes with {@link headers} rather than replacing it: merged per key with
|
|
91
|
+
* `getHeaders()` winning, so a static `X-Client` and a rotating
|
|
92
|
+
* `Authorization` are configured independently and neither drops the other.
|
|
85
93
|
*/
|
|
86
94
|
getHeaders: (() => Record<string, string>) | null;
|
|
87
95
|
/**
|
|
@@ -95,37 +103,31 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
95
103
|
autoConfirm: boolean;
|
|
96
104
|
/**
|
|
97
105
|
* When true, the built-in `ask_user` frontend tool is offered to the agent:
|
|
98
|
-
* calling it renders an inline question card
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* change the advertised catalog until a host asks for it.
|
|
106
|
+
* calling it renders an inline question card and returns the user's answer.
|
|
107
|
+
* Off by default, like the other built-in tool groups, so the advertised
|
|
108
|
+
* catalog does not change until a host asks for it.
|
|
102
109
|
*/
|
|
103
110
|
askUser: boolean;
|
|
104
111
|
/**
|
|
105
|
-
* Optional full replacement for the `ask_user` question UI
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* resolves with the answer. Unset (default) uses the built-in
|
|
109
|
-
* {@link requestQuestion} card — style that via the `strings` override and the
|
|
110
|
-
* `question*` CSS `::part()`s. Requires {@link askUser} to be enabled.
|
|
112
|
+
* Optional full replacement for the `ask_user` question UI, resolving with
|
|
113
|
+
* the answer; the same seam as {@link approvalRenderer}, styled via `strings`
|
|
114
|
+
* and the `question*` `::part()`s when left unset. Requires {@link askUser}.
|
|
111
115
|
*/
|
|
112
116
|
askUserRenderer: QuestionRenderer | null;
|
|
113
117
|
/**
|
|
114
|
-
* Optional full replacement for the server-side-tool approval UI
|
|
115
|
-
*
|
|
116
|
-
* card
|
|
117
|
-
* `
|
|
118
|
-
*
|
|
119
|
-
* `::part()`s. The gate itself is enabled server-side; this only changes how
|
|
120
|
-
* the decision is collected.
|
|
118
|
+
* Optional full replacement for the server-side-tool approval UI: an approval
|
|
119
|
+
* interrupt invokes this instead of the built-in {@link requestApproval}
|
|
120
|
+
* card, resolving `true` to approve or `false` to deny. Style the built-in
|
|
121
|
+
* card via `strings` and the `approval*` `::part()`s instead. The gate itself
|
|
122
|
+
* is enabled server-side; this only changes how the decision is collected.
|
|
121
123
|
*/
|
|
122
124
|
approvalRenderer: ApprovalRenderer | null;
|
|
123
125
|
/**
|
|
124
|
-
* Optional per-call confirmation predicate. When set
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* static `x-destructive` flag
|
|
128
|
-
*
|
|
126
|
+
* Optional per-call confirmation predicate. When set it is authoritative,
|
|
127
|
+
* deciding from the tool name and args whether this particular call needs
|
|
128
|
+
* confirmation — so one tool can be instant for some args and confirmed for
|
|
129
|
+
* others, which a static `x-destructive` flag cannot express. When unset the
|
|
130
|
+
* `x-destructive` flag decides. `autoConfirm` short-circuits both.
|
|
129
131
|
*/
|
|
130
132
|
confirmPredicate: ((toolName: string, args: Record<string, unknown>) => boolean | Promise<boolean>) | null;
|
|
131
133
|
/**
|
|
@@ -139,11 +141,8 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
139
141
|
* Per-run context provider. Defaults to the compact page map, when a
|
|
140
142
|
* {@link getPageMap} provider is set and {@link autoInjectPageMap} is on.
|
|
141
143
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* the client's copy only duplicated it, on exactly the turn a file was
|
|
145
|
-
* attached. Attachments still reach the agent; they reach it through the
|
|
146
|
-
* message, which is where they were already.
|
|
144
|
+
* Attachments are deliberately not restated here: the server derives its own
|
|
145
|
+
* manifest from the refs riding the messages.
|
|
147
146
|
*/
|
|
148
147
|
getContext: () => Context[];
|
|
149
148
|
/**
|
|
@@ -169,21 +168,17 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
169
168
|
conversationStore: ClientConversationStore;
|
|
170
169
|
/**
|
|
171
170
|
* How attached files are uploaded. `null` (default) uses the built-in
|
|
172
|
-
* multipart `POST` to `data-attachments-url
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* wire (refs are transport-agnostic). When set, the 📎 affordance appears even
|
|
177
|
-
* with no `data-attachments-url`; the handler owns its own endpoint + headers.
|
|
171
|
+
* multipart `POST` to `data-attachments-url`; a custom {@link UploadHandler}
|
|
172
|
+
* swaps the transport without changing the tray, the chips, or the AG-UI
|
|
173
|
+
* wire. When set, the 📎 affordance appears even with no
|
|
174
|
+
* `data-attachments-url`, and the handler owns its own endpoint and headers.
|
|
178
175
|
*/
|
|
179
176
|
uploadHandler: UploadHandler | null;
|
|
180
177
|
/**
|
|
181
178
|
* How recorded voice clips are transcribed. `null` (default) POSTs the clip
|
|
182
|
-
* to `data-transcribe-url
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* touching the mic button. When set, the 🎤 affordance appears even with no
|
|
186
|
-
* `data-transcribe-url`.
|
|
179
|
+
* to `data-transcribe-url`; a custom {@link TranscribeHandler} swaps the
|
|
180
|
+
* transport without touching the mic button. When set, the 🎤 affordance
|
|
181
|
+
* appears even with no `data-transcribe-url`.
|
|
187
182
|
*/
|
|
188
183
|
transcribeHandler: TranscribeHandler | null;
|
|
189
184
|
/**
|
|
@@ -199,12 +194,10 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
199
194
|
*/
|
|
200
195
|
skillContext: () => Record<string, unknown>;
|
|
201
196
|
/**
|
|
202
|
-
* Friendly display labels for tool-call cards, keyed by tool name
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* only the tool-call name). Client tools should prefer `x-summary` on their
|
|
207
|
-
* schema; this map is the seam for everything else.
|
|
197
|
+
* Friendly display labels for tool-call cards, keyed by tool name. The
|
|
198
|
+
* fallback when a tool has no `x-summary` in its own schema, which chiefly
|
|
199
|
+
* means server-side tools: AG-UI streams only the tool-call name, so their
|
|
200
|
+
* schema never reaches the browser. Client tools should prefer `x-summary`.
|
|
208
201
|
*/
|
|
209
202
|
toolSummaries: Record<string, string>;
|
|
210
203
|
/**
|
|
@@ -233,21 +226,17 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
233
226
|
* when the server streams `STATE_SNAPSHOT` / `STATE_DELTA`. Assigning seeds
|
|
234
227
|
* the next run; reading returns whatever the agent last applied.
|
|
235
228
|
*
|
|
236
|
-
* Listen for {@link STATE_EVENT} to react to server-driven changes.
|
|
237
|
-
*
|
|
238
|
-
* Not to be confused with {@link registerPageState}, which exposes host
|
|
239
|
-
* state to the agent as ordinary *tools*.
|
|
229
|
+
* Listen for {@link STATE_EVENT} to react to server-driven changes. Distinct
|
|
230
|
+
* from {@link registerPageState}, which exposes host state as ordinary tools.
|
|
240
231
|
*/
|
|
241
232
|
get sharedState(): Readonly<Record<string, unknown>>;
|
|
242
233
|
set sharedState(state: Readonly<Record<string, unknown>>);
|
|
243
234
|
/** Bind a piece of host page state to `read_<name>` / `set_<name>` tools. */
|
|
244
235
|
registerPageState(binding: PageState): void;
|
|
245
236
|
/**
|
|
246
|
-
* @deprecated Renamed to {@link registerPageState}
|
|
247
|
-
* AG-UI shared-state sync
|
|
248
|
-
*
|
|
249
|
-
* page state. Behaviour is unchanged; this alias will be removed in a future
|
|
250
|
-
* major.
|
|
237
|
+
* @deprecated Renamed to {@link registerPageState} — the old name read as
|
|
238
|
+
* AG-UI shared-state sync. Behaviour is unchanged; the alias will be removed
|
|
239
|
+
* in a future major.
|
|
251
240
|
*/
|
|
252
241
|
registerStateHook(binding: PageState): void;
|
|
253
242
|
/** The AG-UI endpoint URL, read from the `endpoint` attribute. */
|
|
@@ -258,19 +247,18 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
258
247
|
* `credentials` mode (`"omit"` / `"same-origin"` / `"include"`). Mirrored to
|
|
259
248
|
* the `credentials` attribute, so markup embeds can set it without script.
|
|
260
249
|
*
|
|
261
|
-
* `null` (the default) leaves the browser's
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* `
|
|
268
|
-
* (non-wildcard) `Access-Control-Allow-Origin` on the server.
|
|
250
|
+
* `null` (the default) leaves the browser's `same-origin` default in place,
|
|
251
|
+
* which sends no cookies at all to an endpoint on a different origin — and
|
|
252
|
+
* the request goes out anonymously rather than failing, so the symptom is a
|
|
253
|
+
* 401 from a server that looks correctly configured. A cookie-authenticated
|
|
254
|
+
* cross-origin deployment wants `"include"`, plus
|
|
255
|
+
* `Access-Control-Allow-Credentials: true` and a concrete, non-wildcard
|
|
256
|
+
* `Access-Control-Allow-Origin` on the server.
|
|
269
257
|
*
|
|
270
258
|
* Read per request, so a late assignment applies to everything after it.
|
|
271
|
-
* `"omit"` cannot be honoured by the built-in
|
|
272
|
-
*
|
|
273
|
-
*
|
|
259
|
+
* `"omit"` cannot be honoured by the built-in upload transport, an
|
|
260
|
+
* `XMLHttpRequest` with only a two-state cookie switch; every other endpoint
|
|
261
|
+
* honours all three modes.
|
|
274
262
|
*/
|
|
275
263
|
get credentials(): RequestCredentials | null;
|
|
276
264
|
set credentials(value: RequestCredentials | null);
|
|
@@ -290,24 +278,20 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
290
278
|
* the backend skill catalog and the thread's history — with the transport
|
|
291
279
|
* configuration as it stands now.
|
|
292
280
|
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* startup requests
|
|
296
|
-
* "try again, properly authenticated" without removing and re-inserting the
|
|
297
|
-
* node.
|
|
281
|
+
* For a host that can only configure the element after the fact (a token
|
|
282
|
+
* fetched in a passive effect, an async auth handshake), this re-issues the
|
|
283
|
+
* startup requests authenticated, without removing and re-inserting the node.
|
|
298
284
|
*
|
|
299
|
-
* A reload, not a merge
|
|
300
|
-
*
|
|
301
|
-
*
|
|
285
|
+
* A reload, not a merge: the in-flight run is cancelled and the transcript is
|
|
286
|
+
* rebuilt from persisted history, so anything streamed since is dropped. Call
|
|
287
|
+
* it once, when configuration lands, not between turns.
|
|
302
288
|
*/
|
|
303
289
|
reload(): Promise<void>;
|
|
304
290
|
/**
|
|
305
|
-
* Tear down live resources when the element leaves the DOM
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* removed `<ag-ui-chat>` leaks a streaming request, uploads, and a live
|
|
310
|
-
* `MediaRecorder`.
|
|
291
|
+
* Tear down live resources when the element leaves the DOM: cancel the
|
|
292
|
+
* in-flight run so its stream closes, abort in-flight uploads so they do not
|
|
293
|
+
* orphan server-side files, and release the mic so the browser's recording
|
|
294
|
+
* indicator clears. Without this a removed element leaks all three.
|
|
311
295
|
*/
|
|
312
296
|
disconnectedCallback(): void;
|
|
313
297
|
/**
|
|
@@ -344,12 +328,10 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
344
328
|
* Open the thread-history drawer: the imperative route to the control that
|
|
345
329
|
* renders as `::part(history-button)`.
|
|
346
330
|
*
|
|
347
|
-
* A host that hides `::part(header)`
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* {@link openCheckpoints}, {@link newChat}, {@link toggleCollapsed} and
|
|
352
|
-
* {@link toggleTheme}.
|
|
331
|
+
* A host that hides `::part(header)` for its own title bar hides the history,
|
|
332
|
+
* new-chat and collapse buttons with it. Each has a method so that chrome can
|
|
333
|
+
* be rebuilt: this one, {@link openCheckpoints}, {@link newChat},
|
|
334
|
+
* {@link toggleCollapsed} and {@link toggleTheme}.
|
|
353
335
|
*/
|
|
354
336
|
openThreads(): void;
|
|
355
337
|
/**
|
|
@@ -368,32 +350,28 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
368
350
|
/**
|
|
369
351
|
* Append a message bubble and return it.
|
|
370
352
|
*
|
|
371
|
-
* Assistant content
|
|
372
|
-
*
|
|
373
|
-
* rendering user-authored markup).
|
|
353
|
+
* Assistant content renders as sanitised markdown/HTML; user content stays
|
|
354
|
+
* literal text, which also avoids rendering user-authored markup.
|
|
374
355
|
*
|
|
375
|
-
* Assistant bubbles land in the current answer group, opening one if
|
|
376
|
-
*
|
|
377
|
-
*
|
|
356
|
+
* Assistant bubbles land in the current answer group, opening one if needed;
|
|
357
|
+
* a user bubble closes the prior group and sits directly in the list, the
|
|
358
|
+
* well wrapping only the assistant turn.
|
|
378
359
|
*/
|
|
379
360
|
appendMessage(role: MessageRole, content: string): HTMLDivElement;
|
|
380
361
|
/**
|
|
381
362
|
* Send a message as if the user had typed it — renders the user bubble,
|
|
382
363
|
* dispatches {@link SUBMIT_EVENT}, and starts the run.
|
|
383
364
|
*
|
|
384
|
-
* The programmatic half of the composer, for a host driving its own input
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
* here; Send itself now reads the composer, clears it, and calls this.
|
|
365
|
+
* The programmatic half of the composer, for a host driving its own input.
|
|
366
|
+
* Everything the built-in Send does happens here; Send reads the composer,
|
|
367
|
+
* clears it, and calls this.
|
|
388
368
|
*
|
|
389
|
-
* `attachments` are durable {@link AttachmentRef}s —
|
|
390
|
-
*
|
|
391
|
-
* {@link ATTACHMENT_EVENT} reports. Pass them to attach files to the message.
|
|
369
|
+
* `attachments` are durable {@link AttachmentRef}s — what {@link attachFile}
|
|
370
|
+
* resolves to and what {@link ATTACHMENT_EVENT} reports.
|
|
392
371
|
*
|
|
393
|
-
* No-ops while a run is in flight
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* composer stays in charge of its own state.
|
|
372
|
+
* No-ops on an empty message, and while a run is in flight, since a second
|
|
373
|
+
* concurrent run would orphan the first. Unlike the built-in Send it does not
|
|
374
|
+
* consult the tray: what you pass is what is sent.
|
|
397
375
|
*/
|
|
398
376
|
sendMessage(content: string, attachments?: readonly AttachmentRef[]): Promise<void>;
|
|
399
377
|
/**
|
|
@@ -401,11 +379,11 @@ export declare class AgUiChat extends HTMLElement {
|
|
|
401
379
|
* picker and drag-and-drop do — validation, progress chip, and all.
|
|
402
380
|
*
|
|
403
381
|
* Returns `false` when uploads are not configured (no `data-attachments-url`
|
|
404
|
-
* and no {@link uploadHandler})
|
|
405
|
-
*
|
|
382
|
+
* and no {@link uploadHandler}) — the only signal a host gets, since the tray
|
|
383
|
+
* does not exist to report anything then.
|
|
406
384
|
*
|
|
407
385
|
* Uploading is asynchronous: watch {@link ATTACHMENT_EVENT} for the resulting
|
|
408
|
-
* {@link AttachmentRef}
|
|
386
|
+
* {@link AttachmentRef} and pass it to {@link sendMessage} once `pending`
|
|
409
387
|
* reaches zero.
|
|
410
388
|
*/
|
|
411
389
|
attachFile(file: File): boolean;
|