@artooi/ag-ui-web-component 0.16.0 → 0.17.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 CHANGED
@@ -7,6 +7,91 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.17.0] — 2026-08-10
11
+
12
+ ### Added
13
+
14
+ - **`sendMessage(content, attachments?)`** — send as if the user had typed it:
15
+ user bubble, `ag-ui-submit`, run started. The programmatic half of the
16
+ composer, for an "Ask about this order" button, a command palette, or a
17
+ composer of your own replacing the built-in one. The built-in Send now reads
18
+ the composer, clears it, and calls this, so the two paths cannot drift.
19
+
20
+ It no-ops while a run is in flight — a second concurrent run would orphan the
21
+ first — and for an entirely empty message. ⚠ Unlike the built-in Send it does
22
+ **not** consult the attachment tray: what you pass is what is sent, so a host
23
+ composer stays in charge of its own state.
24
+
25
+ - **`attachFile(file)`** — queue a file into the tray exactly as the picker and
26
+ drag-and-drop do, with the same validation and progress chip. Returns `false`
27
+ when uploads are not configured (no `data-attachments-url`, no
28
+ `uploadHandler`), which is the only way for a host to tell: with no tray there
29
+ is nothing to report through, and silence would read as a queued file that
30
+ never uploads.
31
+
32
+ - **`ag-ui-attachments` event**, dispatched whenever the tray changes — a file
33
+ queued, an upload finishing or failing, a chip removed, the tray cleared after
34
+ a send. `detail` carries `{ attachments, pending }`: the durable refs of
35
+ everything settled, and how many are still in flight.
36
+
37
+ ⭐ **This is what makes `sendMessage` usable with files at all.** The tray only
38
+ ever spoke to the built-in Send button, so a host composer had no way to tell a
39
+ settled upload from one still uploading — the same information the built-in
40
+ Send needs, which was simply not exposed. The tray's `onChange` hook already
41
+ existed and nothing was wired to it.
42
+
43
+ ### Changed
44
+
45
+ - **Assigning a connect-time-only attribute after the element has connected now
46
+ warns**, instead of being silently ignored: `data-attachments-url`,
47
+ `data-attachment-accept`, `data-attachment-max-bytes`, `data-transcribe-url`,
48
+ `data-threads-url`, `data-tools-url`, `data-skills-url`, `data-skills`,
49
+ `data-prompt-chips`, `data-slash-commands`, `data-theme-toggle`,
50
+ `data-strings`, `data-icon-url`.
51
+
52
+ Each is read once while connecting, to decide what chrome exists at all, and
53
+ no later read revisits the decision. ⚠ **The symptom is an affordance that
54
+ simply never appears** — which reads as a broken component rather than a
55
+ mis-timed assignment, and it is the common React/Vue shape: the element mounts
56
+ on the first render pass and the framework patches attributes in on the next.
57
+
58
+ Set them before the element enters the DOM, or remove and re-insert it to
59
+ apply a new value. ⭐ The attributes that genuinely *are* re-read per use —
60
+ `data-runs-url`, `data-page-actions`, `data-text-animation`,
61
+ `data-tool-display`, `endpoint`, and CSS-reactive `theme` / `collapsed` — are
62
+ deliberately excluded, since a late change works there and a warning would be
63
+ wrong.
64
+
65
+ ### Fixed
66
+
67
+ - **The checkpoint panel now follows the theme.** Its rules read `--agui-surface`
68
+ / `--agui-border` / `--agui-hover` — note `--agui-`, not the `--ag-ui-`
69
+ namespace every other rule uses — each with a hardcoded light-mode fallback.
70
+ So the panel ignored `theme="dark"` entirely and rendered light-on-dark unless
71
+ a host happened to set three variables documented nowhere. Now derived from the
72
+ real theme tokens, with a new theme-aware `--ag-ui-hover` defined in every
73
+ theme block. ⭐ The fallbacks are what hid it: they made an unthemed panel look
74
+ deliberate.
75
+
76
+ `checkpoints-title` and `checkpoint-label` also gain `part` attributes — they
77
+ carried classes only, so neither could be styled from outside the shadow root.
78
+
79
+ - **Markdown tables are styled.** `table` / `thead` / `tbody` / `tr` / `th` /
80
+ `td` are all in the sanitizer's `ALLOWED_TAGS`, so an agent emitting a table
81
+ rendered it — completely unstyled, overflowing its bubble. Wide tables now
82
+ scroll inside their own box rather than pushing the layout sideways.
83
+
84
+ - **Sending while a file is still uploading now says so.** `readyRefs()` returns
85
+ only settled uploads and `clearReady()` deliberately keeps the rest for a
86
+ follow-up message — so the file was never lost, but the message went without
87
+ it and nothing indicated that. Attachments are frequently the entire point of
88
+ the message, which is what made the silence the defect. An inline notice now
89
+ names how many are still uploading and that they remain attached.
90
+
91
+ Send is deliberately **not** disabled while uploads are pending: that would
92
+ fight the tray's documented "keep for a follow-up" behaviour and could wedge
93
+ on an upload that never settles.
94
+
10
95
  ## [0.16.0] — 2026-08-09
11
96
 
12
97
  ### Added
@@ -748,7 +833,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
748
833
  ### Notes
749
834
  - First release — exercising the automated npm OIDC publish pipeline end-to-end.
750
835
 
751
- [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.16.0...HEAD
836
+ [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.17.0...HEAD
837
+ [0.17.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.16.0...v0.17.0
752
838
  [0.16.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.15.0...v0.16.0
753
839
  [0.15.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.14.1...v0.15.0
754
840
  [0.14.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.14.0...v0.14.1
package/README.md CHANGED
@@ -194,8 +194,35 @@ labels are fetched automatically — per card, `x-summary` → an explicit
194
194
 
195
195
  **Properties** (selected): `sharedState` — AG-UI shared state (documented under Tools & state).
196
196
 
197
- **Methods**: `registerTool`, `registerPageState`, `setSkills`, `appendMessage`, `newChat`,
198
- `setCollapsed`, `toggleCollapsed`.
197
+ **Methods**: `registerTool`, `registerPageState`, `setSkills`, `sendMessage`, `attachFile`,
198
+ `appendMessage`, `newChat`, `setCollapsed`, `toggleCollapsed`.
199
+
200
+ ### Sending from your own UI
201
+
202
+ `sendMessage(content, attachments?)` sends as if the user had typed it — user bubble,
203
+ `ag-ui-submit` event, run started. Use it for an "Ask about this order" button, a command
204
+ palette, or a composer of your own replacing the built-in one. It no-ops while a run is in
205
+ flight and for an entirely empty message, and unlike the built-in Send it does **not** consult
206
+ the attachment tray: what you pass is what is sent, so your composer stays in charge of its
207
+ own state.
208
+
209
+ `attachFile(file)` queues a file into the tray exactly as the picker and drag-and-drop do, with
210
+ the same validation and progress chip. It returns `false` when uploads are not configured
211
+ (no `data-attachments-url` and no `uploadHandler`) — the only way to tell, since with no tray
212
+ there is nothing to report through.
213
+
214
+ Uploading is asynchronous, so watch `ag-ui-attachments` for the result. Its `detail` carries
215
+ `{ attachments, pending }`: the durable refs of everything that has finished, and how many are
216
+ still in flight. Send once `pending` is `0`, or you will leave files behind.
217
+
218
+ ```js
219
+ chat.addEventListener("ag-ui-attachments", (e) => {
220
+ const { attachments, pending } = e.detail;
221
+ sendButton.disabled = pending > 0;
222
+ sendButton.onclick = () => chat.sendMessage(input.value, attachments);
223
+ });
224
+ chat.attachFile(fileInput.files[0]);
225
+ ```
199
226
 
200
227
  A self-contained live playground lives in [`demo/`](demo/) — run `make demo` to serve it against a
201
228
  mock AG-UI server.