@artooi/ag-ui-web-component 0.8.1 → 0.10.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 +82 -4
- package/README.md +45 -7
- package/dist/ag-ui-web-component.bundle.js +163 -57
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/core/ag_ui_chat.d.ts +27 -1
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/core/agui_client.d.ts +6 -0
- package/dist/core/agui_client.d.ts.map +1 -1
- package/dist/core/attachment.d.ts +5 -0
- package/dist/core/attachment.d.ts.map +1 -1
- package/dist/core/conversation_store.d.ts +8 -0
- package/dist/core/conversation_store.d.ts.map +1 -1
- package/dist/core/remote_conversation_store.d.ts.map +1 -1
- package/dist/core/transcribe_audio.d.ts +25 -0
- package/dist/core/transcribe_audio.d.ts.map +1 -0
- package/dist/core/upload_attachment.d.ts +8 -2
- package/dist/core/upload_attachment.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +735 -55
- package/dist/index.js.map +4 -4
- package/dist/ui/attachment_tray.d.ts +7 -1
- package/dist/ui/attachment_tray.d.ts.map +1 -1
- package/dist/ui/relative_time.d.ts +5 -3
- package/dist/ui/relative_time.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 +30 -0
- package/dist/ui/thoughts_block.d.ts.map +1 -0
- package/dist/ui/thread_drawer.d.ts.map +1 -1
- package/dist/ui/tool_call_card.d.ts.map +1 -1
- package/dist/ui/ui_strings.d.ts +14 -1
- package/dist/ui/ui_strings.d.ts.map +1 -1
- package/dist/ui/voice_input.d.ts +41 -0
- package/dist/ui/voice_input.d.ts.map +1 -0
- package/dist/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/ag_ui_chat.ts +217 -7
- package/src/core/agui_client.ts +31 -2
- package/src/core/attachment.ts +21 -1
- package/src/core/conversation_store.ts +84 -18
- package/src/core/remote_conversation_store.ts +24 -3
- package/src/core/transcribe_audio.ts +62 -0
- package/src/core/upload_attachment.ts +8 -1
- package/src/index.ts +5 -0
- package/src/ui/attachment_tray.ts +42 -5
- package/src/ui/relative_time.ts +8 -3
- package/src/ui/styles.ts +113 -7
- package/src/ui/thoughts_block.ts +83 -0
- package/src/ui/thread_drawer.ts +83 -9
- package/src/ui/tool_call_card.ts +6 -0
- package/src/ui/ui_strings.ts +20 -1
- package/src/ui/voice_input.ts +169 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,82 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.10.0] — 2026-07-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Upload cancellation.** `UploadHandler` gains an optional third argument,
|
|
15
|
+
`signal: AbortSignal`. Removing a pending chip, clearing the tray, or removing
|
|
16
|
+
the element now aborts the in-flight upload, so a cancelled transfer no longer
|
|
17
|
+
orphans a server-side file. Non-breaking: existing two-argument handlers keep
|
|
18
|
+
working; a custom handler that honours the signal should abort its own
|
|
19
|
+
transport when it fires.
|
|
20
|
+
- **Teardown on disconnect.** `<ag-ui-chat>` now cleans up when it leaves the
|
|
21
|
+
DOM (a removed node or a client-side route swap): it cancels the in-flight
|
|
22
|
+
run so the SSE stream closes, aborts in-flight uploads, and releases the
|
|
23
|
+
microphone so the browser's recording indicator clears.
|
|
24
|
+
- **Accessible history drawer.** The chat-history drawer is now a proper modal
|
|
25
|
+
dialog — Escape closes it, focus moves into the panel on open and is restored
|
|
26
|
+
to the opener on close, Tab is trapped within the panel, and an inline rename
|
|
27
|
+
commits on blur.
|
|
28
|
+
- **Per-instance storage scoping.** The collapsed / theme / active-thread state
|
|
29
|
+
and the default thread store are now namespaced by the element's `id` (else
|
|
30
|
+
its `endpoint`), so two `<ag-ui-chat>` instances — or two apps — on the same
|
|
31
|
+
origin no longer share state. Pre-existing per-tab state migrates into the
|
|
32
|
+
namespace automatically on first load.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- **Submit while running.** Pressing Enter during a live run no longer starts a
|
|
37
|
+
second, concurrent SSE run (which orphaned the first and could corrupt its
|
|
38
|
+
pending tool cards). Enter now matches the Send/Stop button and is ignored
|
|
39
|
+
while a run is in flight.
|
|
40
|
+
- **Thread-switch race.** Rapidly switching threads against a slow remote store
|
|
41
|
+
can no longer interleave two replays into one transcript — a stale replay is
|
|
42
|
+
dropped once a newer switch begins.
|
|
43
|
+
- **Malformed thread responses.** A `200` from the threads endpoint whose body
|
|
44
|
+
isn't valid JSON (a proxy's HTML error page, a truncated stream) now falls
|
|
45
|
+
back to the local cache instead of silently failing to load the drawer or
|
|
46
|
+
history.
|
|
47
|
+
- **Relative timestamps.** An unparseable or missing `updated_at` now renders a
|
|
48
|
+
neutral "just now" rather than `"NaNw ago"` or `"~2950w ago"`.
|
|
49
|
+
- **Corrupt attachment refs.** Malformed entries in a message's persisted
|
|
50
|
+
attachments are dropped instead of throwing and aborting the whole history
|
|
51
|
+
replay.
|
|
52
|
+
- **Retry of a rejected upload.** Retrying a chip that was rejected client-side
|
|
53
|
+
(oversize / disallowed type) now re-applies the guard instead of uploading the
|
|
54
|
+
file in full.
|
|
55
|
+
- **Duplicate tool result.** A repeated `TOOL_CALL_RESULT` (or a replayed tool
|
|
56
|
+
message for an already-settled card) no longer appends a second result
|
|
57
|
+
section.
|
|
58
|
+
- **Run-error continuation.** A run that ends in an error is now terminal: the
|
|
59
|
+
loop no longer proceeds into frontend-tool execution or another round, so a
|
|
60
|
+
failed run can't surface a confusing second error. Pending tool cards still
|
|
61
|
+
settle.
|
|
62
|
+
|
|
63
|
+
## [0.9.0] — 2026-06-30
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- **Model thoughts.** When the server forwards a reasoning model's
|
|
68
|
+
chain-of-thought, the element now renders a muted, collapsible **thoughts
|
|
69
|
+
region** (part `thoughts`) at the top of the current answer group — it streams
|
|
70
|
+
while the model reasons and folds away on the answer's first token (the reader
|
|
71
|
+
can reopen it). `AgUiClientHandlers` gains `onReasoningStart` / `onReasoningDelta`
|
|
72
|
+
/ `onReasoningEnd`, wired from `@ag-ui/client`'s `REASONING_*` subscriber
|
|
73
|
+
callbacks (which also cover the deprecated `THINKING_*` family).
|
|
74
|
+
- **Voice input.** Set `data-transcribe-url` (django-ag-ui's
|
|
75
|
+
`TranscribeView`) to reveal a 🎤 mic button in the composer (part
|
|
76
|
+
`voice-button`): it records via `MediaRecorder`, POSTs the clip, and drops the
|
|
77
|
+
returned transcript into the textarea. A pluggable `transcribeHandler` —
|
|
78
|
+
`(audio: Blob) => Promise<string>` — swaps the transport (a different STT
|
|
79
|
+
endpoint, a Web Speech adapter) and reveals the mic even without the attribute.
|
|
80
|
+
New exports: `transcribeAudio`, `TranscribeOptions`, `TranscribeHandler`.
|
|
81
|
+
- **Built-in theme toggle.** The boolean `data-theme-toggle` attribute
|
|
82
|
+
adds an optional light⇄dark toggle to the header (part `theme-toggle`,
|
|
83
|
+
`toggleTheme()`) that flips `theme` and persists per tab. Off by default, so a
|
|
84
|
+
host-supplied switch in `slot="header-actions"` stays unaffected.
|
|
85
|
+
|
|
10
86
|
## [0.8.1] — 2026-06-30
|
|
11
87
|
|
|
12
88
|
### Fixed
|
|
@@ -21,7 +97,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
21
97
|
|
|
22
98
|
### Added
|
|
23
99
|
|
|
24
|
-
- **Per-turn answer group + opt-in well
|
|
100
|
+
- **Per-turn answer group + opt-in well.** Each assistant turn now
|
|
25
101
|
renders inside one `.answer` group (part `answer`) that holds its streamed
|
|
26
102
|
text, tool cards, and pending indicator — so a turn that calls tools reads as
|
|
27
103
|
a single answer instead of loose siblings. The group spans the whole
|
|
@@ -31,12 +107,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
31
107
|
`data-answer-well` attribute to box that group in a bordered, padded "well"
|
|
32
108
|
(themeable via `--ag-ui-well-bg` / `--ag-ui-well-border`); without it the
|
|
33
109
|
layout is the flat stack as before. Pure CSS, turn-scoped, no JS API.
|
|
34
|
-
- **Full-screen page placement
|
|
110
|
+
- **Full-screen page placement.** New `placement="page"`: a full-bleed
|
|
35
111
|
background with the conversation in a centred reading column (default ~820px,
|
|
36
112
|
set via `--ag-ui-content-max-width`). The assistant turn spans the column
|
|
37
113
|
while the user message stays a right-aligned pill — the layout for a dedicated
|
|
38
114
|
chat page (distinct from `full`'s edge-to-edge, left-aligned messages).
|
|
39
|
-
- **Inline tool-display mode + themeable status icons
|
|
115
|
+
- **Inline tool-display mode + themeable status icons.** New
|
|
40
116
|
`data-tool-display="inline"`: the lightest card — a one-line status row (icon
|
|
41
117
|
+ summary, no box chrome) with the result behind its own toggle. Every
|
|
42
118
|
tool-call card now leads with a CSS-drawn **status icon** (part
|
|
@@ -377,7 +453,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
377
453
|
### Notes
|
|
378
454
|
- First release — exercising the automated npm OIDC publish pipeline end-to-end.
|
|
379
455
|
|
|
380
|
-
[Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.
|
|
456
|
+
[Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.10.0...HEAD
|
|
457
|
+
[0.10.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.9.0...v0.10.0
|
|
458
|
+
[0.9.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.8.1...v0.9.0
|
|
381
459
|
[0.8.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.8.0...v0.8.1
|
|
382
460
|
[0.8.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.7.0...v0.8.0
|
|
383
461
|
[0.7.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.6.0...v0.7.0
|
package/README.md
CHANGED
|
@@ -158,6 +158,8 @@ That's the whole integration: an `endpoint` attribute pointing at your AG-UI ser
|
|
|
158
158
|
| `data-attachments-url` | — | URL of the file-upload endpoint (django-ag-ui's `AttachmentsView`); reveals the composer's 📎 picker + drag-and-drop. |
|
|
159
159
|
| `data-attachment-accept` | — | `<input accept>` list for client-side type filtering (e.g. `image/*,.pdf`). The server stays authoritative. |
|
|
160
160
|
| `data-attachment-max-bytes` | — | Client-side upload size cap in bytes (default 10 MiB; `0` disables). The server stays authoritative. |
|
|
161
|
+
| `data-transcribe-url` | — | URL of the voice-transcription endpoint (django-ag-ui's `TranscribeView`); reveals the composer's 🎤 mic button. See [Voice input](#voice-input). |
|
|
162
|
+
| `data-theme-toggle` | — | Boolean: show a built-in header light⇄dark toggle (persists per tab). Off by default. See [Theme toggle](#theme-toggle). |
|
|
161
163
|
| `data-strings` | `strings` | Partial JSON override of the UI string table (localization). The property wins key-by-key over the attribute; see [Internationalization](#internationalization-i18n). |
|
|
162
164
|
| `data-icon-url` | — | Header (and sidebar-rail) icon image URL. A slotted `slot="icon"` wins; see [Header & launcher icon](#header-and-launcher-icon). |
|
|
163
165
|
| `data-page-actions` | — | Opt-in built-in page-action tools: a comma list of `scroll` / `drag` (e.g. `"scroll,drag"`). See [Page-action tools](#page-action-tools). |
|
|
@@ -170,9 +172,9 @@ That's the whole integration: an `endpoint` attribute pointing at your AG-UI ser
|
|
|
170
172
|
|
|
171
173
|
**Properties** (JS only, not attributes): `headers`, `allowImages`, `autoConfirm`,
|
|
172
174
|
`confirmPredicate`, `agentFactory`, `getTools`, `getContext`, `routeMap`, `navigate`,
|
|
173
|
-
`getPageMap`, `autoInjectPageMap`, `conversationStore`, `uploadHandler`, `
|
|
174
|
-
`skillContext`, `toolSummaries`, `strings`, `resolvePageTarget`, plus the
|
|
175
|
-
`endpoint` / `toolDisplay` / `collapsed`.
|
|
175
|
+
`getPageMap`, `autoInjectPageMap`, `conversationStore`, `uploadHandler`, `transcribeHandler`,
|
|
176
|
+
`navigationResult`, `skillContext`, `toolSummaries`, `strings`, `resolvePageTarget`, plus the
|
|
177
|
+
mirrors `endpoint` / `toolDisplay` / `collapsed`.
|
|
176
178
|
|
|
177
179
|
`allowImages` (default `false`) re-enables `<img>` in rendered assistant markdown.
|
|
178
180
|
It is off by default because a model-controlled image URL is fetched by the browser
|
|
@@ -772,7 +774,8 @@ have to hand-tune the variables:
|
|
|
772
774
|
|
|
773
775
|
See [`src/ui/styles.ts`](src/ui/styles.ts) for the full variable + preset list. The
|
|
774
776
|
[`demo/`](demo/) live playground (`node demo/mock-server.mjs`) flips theme, density, placement,
|
|
775
|
-
text-animation, tool-display, and the answer well live from a single page
|
|
777
|
+
text-animation, tool-display, and the answer well live from a single page, and demos the
|
|
778
|
+
streamed thoughts region, the 🎤 mic, and the header theme toggle.
|
|
776
779
|
|
|
777
780
|
### Parts and slots
|
|
778
781
|
|
|
@@ -788,12 +791,13 @@ ag-ui-chat::part(tool-card) { font-family: var(--my-mono); }
|
|
|
788
791
|
```
|
|
789
792
|
|
|
790
793
|
Available parts: `panel`, `header`, `title`, `icon`, `header-controls`, `header-button`
|
|
791
|
-
(plus `history-button` / `new-button` / `collapse-button`), `messages`,
|
|
792
|
-
group), `
|
|
794
|
+
(plus `history-button` / `new-button` / `collapse-button` / `theme-toggle`), `messages`,
|
|
795
|
+
`answer` (the per-turn group), `thoughts` (plus `thoughts-toggle` / `thoughts-body`), `message`
|
|
796
|
+
(plus `message-user` / `message-assistant`), `empty`, `pending`, `tool-card`
|
|
793
797
|
(plus `tool-card-head` / `-icon` / `-name` / `-status` / `-args` / `-toggle` / `-result`),
|
|
794
798
|
`confirm` (plus `confirm-body` /
|
|
795
799
|
`-args` / `-actions` / `-button` / `-cancel` / `-confirm`), `composer`, `input`, `send`,
|
|
796
|
-
`attach-button`, `attachment-tray`, `launcher`, `launcher-icon`, and the drawer parts
|
|
800
|
+
`attach-button`, `voice-button`, `attachment-tray`, `launcher`, `launcher-icon`, and the drawer parts
|
|
797
801
|
(`drawer`, `drawer-backdrop`, `drawer-panel`, `drawer-header`, `drawer-title`, `drawer-new`,
|
|
798
802
|
`drawer-list`, `drawer-empty`, `drawer-row`, `drawer-row-select`).
|
|
799
803
|
|
|
@@ -865,6 +869,40 @@ pure CSS and turn-scoped — no JS API — and themeable via `--ag-ui-well-bg` /
|
|
|
865
869
|
<ag-ui-chat endpoint="/agent/" data-answer-well></ag-ui-chat>
|
|
866
870
|
```
|
|
867
871
|
|
|
872
|
+
### Model reasoning (thoughts)
|
|
873
|
+
|
|
874
|
+
When a reasoning model streams its chain-of-thought (django-ag-ui forwards it as AG-UI reasoning
|
|
875
|
+
events — enable a thinking budget via `MODEL_SETTINGS`, see its docs), the element renders a muted,
|
|
876
|
+
collapsible **thoughts region** (part `thoughts`) at the top of the current answer group. It opens
|
|
877
|
+
while the model reasons and folds away on the answer's first token; the reader can reopen it. The
|
|
878
|
+
web component handles the `REASONING_*` event family (and the deprecated `THINKING_*`, which
|
|
879
|
+
`@ag-ui/client` maps onto it), so no client config is needed — the thoughts appear whenever the
|
|
880
|
+
server forwards reasoning.
|
|
881
|
+
|
|
882
|
+
### Voice input
|
|
883
|
+
|
|
884
|
+
Set `data-transcribe-url` (django-ag-ui's `TranscribeView`) to reveal a 🎤 mic button in the
|
|
885
|
+
composer (part `voice-button`). Click it to record via `MediaRecorder`, click again to stop — the
|
|
886
|
+
clip is POSTed to the endpoint and the returned transcript is dropped into the textarea. Swap the
|
|
887
|
+
transport with a custom `transcribeHandler` — `(audio: Blob) => Promise<string>` — to use a
|
|
888
|
+
different STT endpoint or a browser Web Speech adapter without touching the button; when set, the
|
|
889
|
+
mic appears even with no `data-transcribe-url`.
|
|
890
|
+
|
|
891
|
+
```html
|
|
892
|
+
<ag-ui-chat endpoint="/agent/" data-transcribe-url="/agent/transcribe/"></ag-ui-chat>
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### Theme toggle
|
|
896
|
+
|
|
897
|
+
`theme` is a plain attribute you can set yourself, and a host can always drop its own switch into
|
|
898
|
+
`slot="header-actions"`. For convenience, the boolean `data-theme-toggle` attribute adds a built-in
|
|
899
|
+
light⇄dark toggle to the header (part `theme-toggle`) that flips `theme` and persists the choice
|
|
900
|
+
per tab. Off by default so it never competes with a host-supplied control.
|
|
901
|
+
|
|
902
|
+
```html
|
|
903
|
+
<ag-ui-chat endpoint="/agent/" data-theme-toggle></ag-ui-chat>
|
|
904
|
+
```
|
|
905
|
+
|
|
868
906
|
---
|
|
869
907
|
|
|
870
908
|
## Internationalization (i18n)
|