diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f15d71..b9edf44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,107 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.21.0] — 2026-12-02 + +### 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. + A connector's tool call (its `TOOL_CALL_START` carries `metadata.connector`) shows the + connector's name, its host and "your connector" on its card, live, and read back when the + store kept the call's `metadata`. An MCP App view from a connector (`serverId` + `connector-`) is drawn as one line saying it is not shown, live and read back, whoever + registered `mcp-apps`. Neither needs an opt-in, but a host with its own `data-strings` table + should translate the two new keys, `connectorProvenance` (`{name}`, `{host}`) and + `connectorViewWithheld`, or those lines read in English. A chat removed or moved while its + connectors panel is open drops a sign-in wait and comes back on the conversation. + A connector call's approval card (its interrupt carries the same `metadata.connector`) shows + that line under its prompt, and, when the chat has `data-connectors-url`, an "Always allow + " box, named by the server's tool name (the run's `__` after the first + `__`) and absent for a connector whose `editable` is `false`. Approving with it ticked + approves the call at once and, alongside, reads the connectors list and puts that entry back + whole with the tool always allowed, so a later run skips the question; a policy's refusal + (a `403` with a JSON `error`; any other `403`, such as a CSRF page, is a failure) shows the server's rule in the box's place, and any other failure a line saying it + was not saved, neither holding the approval. Unticked, or denied, nothing is written. Writes + from one batch go one after another; an open connectors list in the chat reloads once one is + saved. `requestApproval` takes `metadata` and `alwaysAllow` options; a host's own + `approvalRenderer` gets neither the line nor the box. Opt-in: the box needs + `data-connectors-url`; the line needs nothing. A host with its own `data-strings` table + should translate `approvalAlwaysAllow` and `approvalAlwaysAllowFailed` (`{tool}`), and + `connectorAlwaysForbidden`, the notice on a connector's tools screen when the server's policy + locks Always allow. +- **An approval form for a gated call's arguments.** Under `approveWithEdits`, a call whose + tool has an argument projection (the catalog's `arguments`, or a client tool's + `parameters.properties`) and no nested argument reads on the approval card as a labelled + list, with Edit and Edit as JSON. Edit opens a field per argument, labelled by its title: a + checkbox for a boolean, a number field for a number, a select over the choices' titles that + sends the choice's constant, a date field for a `format: date` day, text otherwise. A hidden + argument gets no field and is sent unchanged, an emptied text field sends an empty string + (a null one stays null), and an emptied number or date field refuses on the card, naming it, + as unparseable JSON does. Edit as JSON is the JSON field as before, and a nested call or a + tool with no projection gets it at once. `requestApproval` takes a `display` option for + the projection, and a field left alone sends its value as it came. Opt-in: only a host that + sets `approveWithEdits` sees the form, and one that already sets it sees it wherever its + server ships argument projections. For every host, the approval card's actions row now + wraps: where Deny and Approve do not fit side by side (a narrow panel, the card inside a + tool card), Approve drops under Deny instead of Deny overflowing the card; that is the only + change without `approveWithEdits`. + A host with its own `data-strings` table should translate the form's three new keys, + `approvalEditFields`, `approvalEditJson` and `approvalFieldInvalid`, or its buttons and + refusal read in English. + +- **Hosts restyle the connectors view and the form fields like the rest of the panel.** New + parts `connector-action`, `connector-notice`, `connector-tag` and `connector-seg` join the + connectors view's parts, and `new-connector-button` and `connectors-button` are now listed. The + key `connectorUrlPlaceholder` holds the server URL's placeholder. `--ag-ui-select-chevron` + colours every select's chevron. The approval form's fields read `--ag-ui-input-bg` and focus in + `--ag-ui-ring`, as the editors' fields do, and the connectors spinner turns at + `--ag-ui-tool-spin-duration`. Unset, each draws as before. + +### Changed + +- **A summary template fills an enumerated argument with its label.** A `{status}` placeholder + whose value strictly equals a choice's `const` in the call's argument display (a client tool's + `parameters.properties`, else the catalog's `arguments`) now reads that choice's `title`, as + the readable arguments list already did: "Search orders for acme in Running late", not "in + late". A value no choice matches, a blank title and a tool with no choices fill with the raw + value as before. No opt-in: a template over an argument that declares labelled choices + changes its wording, nothing else. + +- **`` follows a running answer through `answers//events/`, and hides + Regenerate when the server says the reader may not.** A running answer (`status: + "running"`, or a POST's `409`) is now followed at + `answers//events/?subject=&after=0`, never `threads//events/`, so a shared + answer (django-ag-ui `AnswerSkill(shared_subject=...)`) can be followed as a per-principal + one is. Every JSON body's `can_regenerate` is read: `false` hides Regenerate, `true` or + absent shows it; a `403` on Regenerate shows the failed state. `degraded` is not drawn. + No opt-in: nothing changes in the element's attributes, properties or events. The server + floor rises to django-ag-ui 0.95.0, the release with the new route: on an older mount a + running answer shows the failed state, while a stored or new one still draws. + +### Fixed + +- **A select draws its chevron inside the field, its text aligned with an input's.** Every select + in the chat and the editor elements drops the browser's chevron, which sat on the border with + the text indented past an input's, for one inset from the border in the field's ink. No opt-in. + +- **A full-panel view's footer wraps rather than overflowing.** At the default 380px panel, the + connectors screen's Test again and Approve changes ran past the panel's edge; a footer's buttons + now wrap onto a second line, in the connectors, skills and routines views alike. + ## [0.20.0] — 2026-12-02 ### Added @@ -1127,7 +1228,8 @@ move page walks a host over. Each entry below says whether a host opts in. kept offering the moon under `theme="dark"`. Only the toggle's own click redrew it before. A host opts in to nothing. -[Unreleased]: https://github.com/Artui/agents-web-components/compare/v0.20.0...HEAD +[Unreleased]: https://github.com/Artui/agents-web-components/compare/v0.21.0...HEAD +[0.21.0]: https://github.com/Artui/agents-web-components/compare/v0.20.0...v0.21.0 [0.20.0]: https://github.com/Artui/agents-web-components/compare/v0.19.0...v0.20.0 [0.19.0]: https://github.com/Artui/agents-web-components/compare/v0.18.0...v0.19.0 [0.18.0]: https://github.com/Artui/agents-web-components/compare/v0.17.0...v0.18.0 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/answer.mjs b/demo/answer.mjs index 7e65d44..3e50e20 100644 --- a/demo/answer.mjs +++ b/demo/answer.mjs @@ -2,12 +2,14 @@ // /answers/, replaying the bodies recorded from the released server in // tests/fixtures/answers.json, so the page shows what a real mount sends. // -// - GET /answers/answers/explain-event/?subject= the stored answer, or 404 -// - POST /answers/answers/explain-event/ the run's stream, word by word -// - GET /answers/threads//events/?after=0 a running answer's run log +// - GET /answers/answers/explain-event/?subject= the stored answer, or 404 +// - POST /answers/answers/explain-event/ the run's stream, word by word +// - GET /answers/answers/explain-event/events/?subject= a running answer's run log // -// Subject "42" has no answer until the first open writes one; "running" is an -// answer another tab is writing, which the element follows through events/. +// Subject "42" has no answer until the first open writes one; "running" is a +// shared answer another reader is writing, which the element follows through +// events/ and then shows without Regenerate, since its bodies say +// can_regenerate: false. import { readFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; @@ -17,7 +19,7 @@ const RECORDED = JSON.parse( readFileSync(join(HERE, "..", "tests", "fixtures", "answers.json"), "utf8"), ); const ANSWER = "/answers/answers/explain-event/"; -const EVENTS = /^\/answers\/threads\/[^/]+\/events\/$/; +const EVENTS = `${ANSWER}events/`; const STEP_MS = 120; const GENERATED = JSON.parse(RECORDED.getDone.body).text; const stored = new Map(); @@ -69,7 +71,7 @@ export function answerRoute(req, res, path) { send( res, subject === "running" - ? RECORDED.getRunning + ? RECORDED.sharedGetRunning : stored.has(subject) ? withText(RECORDED.getDone, stored.get(subject)) : RECORDED.get404, @@ -91,8 +93,9 @@ export function answerRoute(req, res, path) { }); return true; } - if (EVENTS.test(path) && req.method === "GET") { - void trickle(res, RECORDED.eventsReplay); + if (path === EVENTS && req.method === "GET") { + const subject = new URL(req.url, "http://demo").searchParams.get("subject"); + void trickle(res, subject === "running" ? RECORDED.sharedEventsReplay : RECORDED.eventsReplay); return true; } return false; diff --git a/demo/answer/index.html b/demo/answer/index.html index 2340f82..3f8e331 100644 --- a/demo/answer/index.html +++ b/demo/answer/index.html @@ -45,7 +45,7 @@

Each Explain asks the mock answers mount at /answers/, which replays the - bodies recorded from django-ag-ui 0.93.0. Hover sends nothing; Bump version discards the + bodies recorded from django-ag-ui 0.95.0. Hover sends nothing; Bump version discards the answer shown, and the next open asks again. Back to the demo

@@ -55,7 +55,7 @@

Event 42: imported

-

Event 43: being explained in another tab

+

Event 43: an answer already being written

Follow the answer diff --git a/demo/app/app.js b/demo/app/app.js index dab40cb..35bc705 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) => { @@ -906,10 +924,13 @@ function mount(pathname, restart) { // ── MCP Apps ───────────────────────────────────────────────────────────────── - // Registered on its own scenario only, so every other page shows the + // Registered on its own scenario, and on Connectors, which shows a connector's + // view left out whoever registered the type; every other page shows the // element's built-in notice: in 0.5.0 the two draw the same thing. - if (on("mcp-apps")) { + if (on("mcp-apps", "connectors")) { registerMcpApps(chat, { url: "/mcp-apps/" }); + } + if (on("mcp-apps")) { $("mcp-out").textContent = 'registerMcpApps(chat, { url: "/mcp-apps/" }) from /mcp-apps.bundle.js'; } @@ -1026,6 +1047,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

+ +