@artooi/ag-ui-web-component 0.26.0 → 0.27.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,98 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.27.0] — 2026-08-26
11
+
12
+ ### Fixed
13
+
14
+ - **A deliberate cancel was reported as an error as well as a cancellation.**
15
+ Pressing Stop (or Escape, or anything else that cancels a run) could put a
16
+ warning bubble carrying the browser's own abort text — Chrome's is
17
+ `BodyStreamBuffer was aborted` — directly above the muted stopped note: one
18
+ deliberate stop, described twice, once as a failure. Cancelling aborts the
19
+ response while its body is being read, and that abort can reach the AG-UI
20
+ subscriber as a `RUN_ERROR` event, which was forwarded to `onError` without
21
+ consulting the cancel flag. Only the promise route ever checked it. It looked
22
+ intermittent because whether the abort produces a run error depends on where
23
+ in the stream it lands. A cancelled run now reports the cancellation alone; a
24
+ run that failed on its own still reports its error.
25
+
26
+ - **Chrome's mid-read abort was classified as a genuine error.**
27
+ `isAbortError` matched only `name === "AbortError"`, and Chrome raises
28
+ `TypeError: BodyStreamBuffer was aborted` when a fetch body is cancelled
29
+ mid-read. The cancel flag hid this in the common case; an abort arriving
30
+ without it — a caller aborting the request by another route — was reported as
31
+ a failure. A `TypeError` whose message names the abort is now read as one.
32
+
33
+ - **The new-chat button deleted the conversation it left.** Pressing the header's
34
+ new-chat button (or the drawer's "New chat", or calling `newChat()`) cleared the
35
+ active thread from the store before minting the next id — the same call the
36
+ drawer's own delete action makes. The conversation vanished from the history
37
+ drawer, and with `data-threads-url` set it was deleted on the server too, since
38
+ the remote store answers `clear` with a `DELETE`. The line predates the history
39
+ drawer: it was written when "new chat" meant wiping the one conversation there
40
+ was, and multi-thread support was layered over it. Starting a conversation now
41
+ leaves the previous one where it was, to return to from the drawer. A thread
42
+ nothing was ever sent in is still dropped — it never appeared in the drawer, so
43
+ keeping it would only strand a record per press.
44
+
45
+ ### Added
46
+
47
+ - **`ClientConversationStore.newThread()`** — start a conversation without
48
+ destroying one. Optional, so an existing custom store keeps working: the
49
+ element then mints the id itself and hands it to `setActiveThread`, which loses
50
+ only the store's own record that the thread is new. `SessionStorageStore` and
51
+ `RemoteConversationStore` both implement it.
52
+
53
+ ## [0.26.1] — 2026-08-25
54
+
55
+ ### Fixed
56
+
57
+ - **A chart the server retracted stayed on screen.** When an update replaced a
58
+ chart with a payload that could not be drawn, the superseded chart was left in
59
+ place — showing numbers the server had already withdrawn, reading as current —
60
+ and then vanished on the next reload, because the *stored* content was the
61
+ version that could not be drawn. Live and reload now agree, and both say gone.
62
+
63
+ - **`enableCharts()` after the element connected silently dropped every chart in
64
+ restored history.** History replays on connect, and charts were off at that
65
+ moment, so they were skipped. That is the ordinary way to call it — you have
66
+ to query the element to call anything on it — so the first call now redraws
67
+ rather than the docs asking for an ordering nobody can satisfy. The README
68
+ example was that order.
69
+
70
+ - **A stacked chart wrote `NaN` into the DOM** for a series carrying more points
71
+ than there are labels. `renderChart` is exported, so it can be handed a spec
72
+ the validator would have refused; a cast there claimed that could not happen.
73
+
74
+ - **A sparse `labels` array was accepted**, drawing a chart with blank axis
75
+ labels — `Array.prototype.some` skips holes.
76
+
77
+ - **A spec inside the point budget could still block the main thread.** The
78
+ point limit bounds the data; the DOM is bounded by labels, since each emits an
79
+ axis node whatever the series count. Now capped at 2,000 labels, and the
80
+ ceiling applies again on every reload of a stored conversation.
81
+
82
+ ### Documentation
83
+
84
+ - **Whether a pushed chart survives a reload depends on where the conversation
85
+ is stored**, and the README now says which is which. A client-side store keeps
86
+ activities; a server storing the thread as the model's message history does
87
+ not, because a pushed chart is deliberately not in that history. An
88
+ agent-requested chart survives either way — its spec travels as the tool
89
+ call's arguments.
90
+
91
+ ### Changed
92
+
93
+ - **The handler/render split is now enforced by a signature rather than a
94
+ comment.** The replay path is handed the `render` function alone, never the
95
+ tool that owns it, so the code that runs on restore cannot reach `handler`.
96
+ The documentation claimed this guarantee was structural while the code passed
97
+ the whole tool around and relied on two call sites happening not to use it.
98
+
99
+ - The built-in chart tool no longer builds the chart twice per call, once only
100
+ to choose its reply string.
101
+
10
102
  ## [0.26.0] — 2026-08-25
11
103
 
12
104
  ### Added
@@ -1613,7 +1705,9 @@ hosts that both arrange the page the way it expects.
1613
1705
  ### Notes
1614
1706
  - First release — exercising the automated npm OIDC publish pipeline end-to-end.
1615
1707
 
1616
- [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.26.0...HEAD
1708
+ [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.27.0...HEAD
1709
+ [0.27.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.26.1...v0.27.0
1710
+ [0.26.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.26.0...v0.26.1
1617
1711
  [0.26.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.25.2...v0.26.0
1618
1712
  [0.25.2]: https://github.com/Artui/ag-ui-web-component/compare/v0.25.1...v0.25.2
1619
1713
  [0.25.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.25.0...v0.25.1
package/README.md CHANGED
@@ -773,8 +773,11 @@ handler), gate `drag_and_drop` with [`confirmPredicate`](#inline-confirmation-x-
773
773
  The header carries two built-in buttons: a new-chat (✚) button and a collapse (—) toggle. The
774
774
  matching JS API:
775
775
 
776
- - `newChat()` — clears the transcript and the persisted history, drops the in-memory run state,
777
- and mints a new thread id.
776
+ - `newChat()` — clears the transcript, drops the in-memory run state, and mints a new thread id.
777
+ The conversation it leaves is **kept**: it stays in the history drawer to return to, and on a
778
+ server-backed store it stays on the server. Deleting one is the drawer row's own action. A chat
779
+ nothing was ever sent in is the exception — it was never listed, so it is dropped rather than
780
+ left behind.
778
781
  - `setCollapsed(collapsed)` / `toggleCollapsed()` — collapse or expand the widget. The state is
779
782
  reflected as the boolean `collapsed` attribute/property and persisted per-tab in
780
783
  `sessionStorage`, so it survives a reload.
@@ -871,6 +874,16 @@ const chat = document.querySelector("ag-ui-chat");
871
874
  chat.enableCharts(["tool", "activity"]);
872
875
  ```
873
876
 
877
+ Order does not matter. Calling it after the element is on the page redraws any
878
+ charts already in the restored history, so you do not have to reach the element
879
+ before it connects — which you generally cannot.
880
+
881
+ Specs are bounded, and anything outside is dropped rather than half-drawn: at
882
+ most **20,000 points** and **2,000 labels**, and every point a finite number no
883
+ larger than **1e15**. The first two keep a stored transcript from blocking the
884
+ main thread on every reload; the last one keeps the value range finite, since
885
+ scaling divides by it.
886
+
874
887
  **`"tool"`** registers a `render_chart` tool the agent may call. The numbers are
875
888
  in its context, so it can talk about them; it costs one model round.
876
889
 
@@ -880,6 +893,13 @@ reaches the model, there is no extra round, and this is the only route that can
880
893
  **update a chart in place** — the server repeats the same `messageId` to redraw
881
894
  it, or sends an `ACTIVITY_DELTA` to move one series as a computation advances.
882
895
 
896
+ **Whether a pushed chart survives a reload depends on where the conversation is
897
+ stored.** A client-side store keeps activities, so it comes back. A server that
898
+ stores the thread as the model's message history does not — a pushed chart is
899
+ deliberately not in that history, which is the reason to push it. A chart the
900
+ agent asked for survives either way, because its spec travels as the tool call's
901
+ arguments and the component redraws from those without re-running anything.
902
+
883
903
  Either way the payload is the same shape:
884
904
 
885
905
  ```json
@@ -917,10 +937,13 @@ chat.registerTool({
917
937
 
918
938
  **`render` is the only half a restored transcript replays.** Replaying a tool's
919
939
  *effect* is out of the question — re-running a form-filling tool on every reload
920
- is a bug so the restore path holds no reference to `handler` and cannot run
921
- it. That makes the guarantee structural rather than a promise, and it is why
922
- `render` has to be a pure, deterministic function of its arguments: it runs
923
- again every time the conversation is restored.
940
+ is a bug. The replay path is handed the `render` function alone, never the tool
941
+ that owns it, so the code that runs on restore cannot reach `handler` even by
942
+ mistake: adding a "no render? fall back to the handler" convenience there means
943
+ changing a type signature first, which is the moment the question gets asked.
944
+
945
+ That is why `render` has to be a pure, deterministic function of its arguments —
946
+ it runs again every time the conversation is restored.
924
947
 
925
948
  ---
926
949