From 3fbde24c2af24620e10b5e339ecdcd9339b4e8e2 Mon Sep 17 00:00:00 2001 From: Artur Veres Date: Wed, 2 Dec 2026 17:01:05 +0100 Subject: [PATCH 01/18] Add and the chat's connectors panel Replays lane/connectors (474cd02..3280145) onto 0.20.0: the element and its two entries, the chat panel and header More row, the COOP sign-in fallback, the demo, docs and the CLAUDE.md row. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 18 + CLAUDE.md | 12 +- README.md | 2 + demo/app/app.js | 21 + demo/app/index.html | 45 + demo/app/scenarios.js | 19 +- demo/editors/editors.js | 22 +- demo/mock-server.mjs | 216 +++++ docs/connectors.md | 105 +++ docs/quickstart.md | 8 +- esbuild.config.mjs | 15 + mkdocs.yml | 1 + package.json | 8 + scripts/record_connectors_fixture.py | 214 +++++ src/connectors.ts | 17 + src/connectors/ag_ui_connectors.ts | 87 ++ src/connectors/connectors_strings.ts | 74 ++ src/connectors/connectors_styles.ts | 238 +++++ src/connectors/connectors_view.ts | 992 ++++++++++++++++++++ src/connectors/define_connectors.ts | 20 + src/connectors/types.ts | 155 ++++ src/constants.ts | 23 + src/core/ag_ui_chat.ts | 79 +- src/ui/shell/adopt_styles.ts | 12 +- src/ui/shell/build_header.ts | 29 +- src/ui/shell/header_overflow.ts | 15 +- src/ui/ui_strings.ts | 7 +- tests/ag_ui_chat_connectors.test.ts | 333 +++++++ tests/ag_ui_connectors.test.ts | 1074 ++++++++++++++++++++++ tests/browser/connectors.browser.test.ts | 250 +++++ tests/connectors_define_conflict.test.ts | 9 + tests/entries.test.ts | 28 +- tests/fixtures/connectors.json | 280 ++++++ tests/readme_api_surface.test.ts | 5 + 34 files changed, 4409 insertions(+), 24 deletions(-) create mode 100644 docs/connectors.md create mode 100644 scripts/record_connectors_fixture.py create mode 100644 src/connectors.ts create mode 100644 src/connectors/ag_ui_connectors.ts create mode 100644 src/connectors/connectors_strings.ts create mode 100644 src/connectors/connectors_styles.ts create mode 100644 src/connectors/connectors_view.ts create mode 100644 src/connectors/define_connectors.ts create mode 100644 src/connectors/types.ts create mode 100644 tests/ag_ui_chat_connectors.test.ts create mode 100644 tests/ag_ui_connectors.test.ts create mode 100644 tests/browser/connectors.browser.test.ts create mode 100644 tests/connectors_define_conflict.test.ts create mode 100644 tests/fixtures/connectors.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f15d71..3c12de9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- **``, and a connectors panel in the chat.** A new entry, + `./connectors` (and `./connectors/bundle`), draws django-ag-ui 0.93.0's connectors editor: + the user's remote MCP servers with their status, an add form with host presets + (`data-connector-presets`), sign-in in a popup that completes only on a message from the + connectors URL's origin and from that popup (or, when the popup closes without one, as a + provider page sending COOP forces, on the list reading the connector signed in), and each + connector's tools with Turn all on and a per-tool Ask or Always allow that the server's policy + can lock. Changed tools wait for approval; Off keeps the sign-in, Remove signs out. + `` gains `openConnectors()` and `closeConnectors()` and a Connectors row in the + header's More menu (a header button instead with `data-connectors-button`), and an open list + reloads on `ag_ui.connectors_changed`. Under `data-editors="external"` the row asks the page + with `ag-ui-open-editor`, `editor: "connectors"`, which a bound `` answers. + Opt-in: setting `data-connectors-url` on the chat makes the More row appear, and with it the + More button, so a row that fitted without More now keeps at most four controls beside it; on + `` it is the element's URL. Without the attribute nothing changes. + ## [0.20.0] — 2026-12-02 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index f9c526b..d16b488 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -98,14 +98,15 @@ slugs (`pymdownx.slugs`), so links keep working across a move between pages. (`./fill_field.ts`), never from an entry file. A new entry is a line in `LIBRARY` in `esbuild.config.mjs`, an `exports` key in `package.json`, a re-export in `src/bundle.ts`, and a row in `tests/entries.test.ts`. The exceptions are `src/a2ui/`, `src/mcp_apps/`, - `src/threads/`, `src/inbox/`, `src/answer/`, and the editor elements (`src/routines.ts`, - `src/skills.ts`): + `src/threads/`, `src/inbox/`, `src/answer/`, `src/connectors/`, and the editor elements + (`src/routines.ts`, `src/skills.ts`): each its own entry (`./a2ui` and `./a2ui/bundle`, `./mcp-apps` and `./mcp-apps/bundle`, `./threads` and `./threads/bundle`, `./inbox` and `./inbox/bundle`, `./routines` and - `./routines/bundle`, `./skills` and `./skills/bundle`, `./answer` and `./answer/bundle`), + `./routines/bundle`, `./skills` and `./skills/bundle`, `./answer` and `./answer/bundle`, `./connectors` and + `./connectors/bundle`), deliberately absent from `src/bundle.ts` so the main bundle carries none of them, reaching the element only through - the `chat` it is handed or bound to; `tests/entries.test.ts` enforces all seven. + the `chat` it is handed or bound to; `tests/entries.test.ts` enforces all eight. 7. **Use `.js` extensions in import specifiers** (`import { x } from "./x.js"`) even though the source file is `x.ts` — NodeNext convention. tsc, esbuild, and Vitest all resolve `.js` → `.ts`/`.d.ts` correctly, and the emitted `.d.ts` keeps `./x.js`, so consumers resolve @@ -131,6 +132,9 @@ slugs (`pymdownx.slugs`), so links keep working across a move between pages. `ui/skill_editor/`), which take narrowed strings so the editor bundles stay free of `ui_strings.ts`. `src/answer/` is a twelfth, ``, its own entry the same way; it needs no chat and reads a django-ag-ui answers mount over `fetch` alone. + `src/connectors/` is a thirteenth, ``, its own entry the same way; it + extends `EditorElement`, and the chat draws its `ConnectorsView` in the panel, so the view + and its strings sit there rather than under `ui/`. Every rule above this one governs a *file*, so a package can obey all eight and still put everything it owns in one flat directory — which is what `src/ui/` was at 37 diff --git a/README.md b/README.md index 99feb34..45b6a6a 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,8 @@ The full walkthrough, with headers, attributes and sending from your own UI, is - **``** (`./skills`): the stored-skill editor as an element of its own. [The editors](https://artui.github.io/agents-web-components/editors/#the-skills-element). `data-editors="external"` on the chat hands its editor buttons to these two elements. +- **``** (`./connectors`): the user's MCP connectors, with sign-in and each + tool's Ask or Always allow; the chat opens the same panel. [Connectors](https://artui.github.io/agents-web-components/connectors/). - **``** (`./answer`): a one-click answer about one subject, from a django-ag-ui answers mount. [One-click answers](https://artui.github.io/agents-web-components/answer/). diff --git a/demo/app/app.js b/demo/app/app.js index dab40cb..ffd6c2d 100644 --- a/demo/app/app.js +++ b/demo/app/app.js @@ -166,6 +166,24 @@ function mount(pathname, restart) { chat.setAttribute("data-strings", JSON.stringify(DE)); $("cfg-i18n").checked = true; } + // The connectors entry and URL are read once while connecting, so both checkboxes remount. + for (const [id, key, apply] of [ + ["cn-button", "demo:connectors-button", () => chat.setAttribute("data-connectors-button", "")], + ["cn-coop", "demo:connectors-coop", () => chat.setAttribute("data-connectors-url", "/connectors-coop/")], + ]) { + if (on("connectors") && sessionStorage.getItem(key) === "1") { + apply(); + $(id).checked = true; + } + $(id).addEventListener( + "change", + (event) => { + sessionStorage.setItem(key, event.target.checked ? "1" : "0"); + show(pathname); + }, + { signal }, + ); + } $("cfg-i18n").addEventListener( "change", (event) => { @@ -1026,6 +1044,9 @@ function mount(pathname, restart) { chat.getHeaders = () => ($("skills-csrf").checked ? { "X-CSRFToken": "demo-token" } : {}); $("skills-open").addEventListener("click", () => chat.openSkillEditor(), { signal }); } + if (on("connectors")) { + $("cn-open").addEventListener("click", () => chat.openConnectors(), { signal }); + } if (on("requests")) { chat.headers = { "X-Demo-Static": "from chat.headers" }; let staleNext = false; diff --git a/demo/app/index.html b/demo/app/index.html index 2bd81b2..d3839a3 100644 --- a/demo/app/index.html +++ b/demo/app/index.html @@ -718,6 +718,51 @@

What to look at

+ +