Skip to content

Dato Agent: setup checklist, "⋮" menu, and a remembered Agent tab width - #174

Merged
roger-datocms merged 17 commits into
masterfrom
fix/dato-agent-new-chat-setup
Nov 5, 2026
Merged

roger-datocms merged 17 commits into
masterfrom
fix/dato-agent-new-chat-setup

Conversation

@roger-datocms

@roger-datocms roger-datocms commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

(Claude here [Opus 5.5])

Closes #173. Closes #162.

Setup: a checklist that blocks chatting until it's done

With DatoCMS connected but no AI provider key, New chat looked enabled but did nothing (#173). The setup panel is now an Agent setup checklist:

  • Two numbered steps, each marked Done or To do with an icon and a word, not color alone:
    1. Choose AI provider & model. It doesn't name the provider, since editors don't need to know which one an admin picked. Users who can edit the schema get Open plugin settings, with the environment prefix in sandboxes. Everyone else is told to ask a developer or project admin.
    2. Connect AI to DatoCMS MCP. A short intro, a regular Connect button, and what each access choice on the DatoCMS consent screen lets the agent do.
  • No chat until setup is done: Chats shows the kit's disabled text box with a FieldError, "Finish setup first to start chatting.", and no New chat button or chat list.
  • Sign-in errors say what to do: "The DatoCMS sign-in was cancelled or denied. Click Connect to try again." The extra "Start sign-in again with a new registration" button is gone. Connect already registers a new client when DatoCMS rejects the stored one (invalid_client), and no other failure needs one.
1-new-chat-without-provider

Once set up: chats panel, toolbar, and the "⋮" menu

  • The chats panel is just the chat history. Setup details no longer appear there, so nobody changes the connection by accident.
  • Auto-approve toggle: off shows a slashed bolt and "Auto-approve is off". On reads "Auto: On" with a "Danger" badge.
  • A "⋮" menu in the toolbar:
    • AI settings. Disabled with a reason for users who can't edit the schema.
    • Current DatoCMS access level, with one line on what it allows ("The agent can edit content, but not the schema.").
    • Reconnect to change access… asks in a small dialog, then signs in again straight to the consent screen and revokes the previous token afterwards.
      • Each Connect registers its own OAuth client, and the consent screen stores the access level for that client only. So reconnecting is how an editor changes it, and it touches no other client's grant.
      • The dialog is inside the plugin frame on purpose. A browser lets the frame open the sign-in popup only shortly after a click in that frame, and a click on a host dialog happens in the parent page.
  • The agent's own guidance (MCP_ACCESS_CHANGE_GUIDANCE, used in the system prompt) used to tell editors to revoke access in their account settings, which affects every MCP client of the account. It now points to Reconnect.
  • No access flash on load: "DatoCMS access is not verified" no longer flashes above the composer while the first access check runs.
2-options-menu

Agent tab width (#162)

  • The chat starts at 300px, then at whatever width the editor last dragged it to. That width is saved in the plugin's localStorage, once per browser, so it applies in every project.

    • It isn't keyed by user ID, because a collaborator's ID differs in each project.
    • It saves on every resize. Telling a drag from a window resize by outerWidth failed in Firefox, which reports the iframe's own size there.
    • The plugin SDK has no per-user storage on the server.
  • Below 300px, a notice covers the chat: "Sidebar too narrow. Drag its edge wider to see the Dato Agent." The chat stays mounted underneath, so a reply in progress survives.

  • From Dato Agent: give the inspector chat a usable starting width #165, with Rodrigo as co-author:

    • the empty record pane says "Ask the agent to open a record and it appears in this pane. Drag the divider to resize it."
    • the conversation stays centred at 760px max

    Dato Agent: give the inspector chat a usable starting width #165's starting-width calculation is replaced by the remembered width.

  • Back from an opened record no longer spins forever. The record editor's back arrow switches to the inspector's record list, and the CMS shows an empty list as an endless spinner. The plugin now fills that list before every record it opens. A CMS-side fix (back to the previous view, a real empty state) is in progress separately.

3-agent-tab-width

Fixes for master

  • package-lock.json is resynced (@emnapi/wasi-threads), so npm ci works again.
  • The model-limit parsing moved out of extractAnthropicModel, so npm run lint passes again.

Known limits

  • The chat still marks a record "Current record" after the editor closes it. The inspector ctx doesn't tell plugins when its mode changes, so this needs a CMS and SDK change.
  • The OpenAI error messages are covered by unit tests only.

Testing

  • npm test: 983 pass. npm run lint and npm run build exit 0.
  • Checked by hand in a test project, master against this branch:
    • setup with no key, before and after connecting
    • the "⋮" menu and the reconnect dialog
    • the starting width at 1440px and 820px windows
    • the remembered width after a drag in Firefox
    • Back from an opened record landing on the list

🤖 Generated with Claude Code

roger-datocms and others added 17 commits November 4, 2026 15:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no provider key, "New chat" changed state the setup panel never
showed, so the click did nothing (#173). Now, while the provider is
missing:

- New chat and the chat list are disabled, and the tooltip says why.
  New chat uses aria-disabled so its tooltip still shows on hover.
- The "setup required" notice says chats need an API key and a model,
  with an "Open plugin settings" button for users who can edit the
  settings and "ask a project admin" for everyone else.

Picking a chat before connecting DatoCMS still works as before.

Fixes #173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ty rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Editors don't need to know which provider an admin picked. The notice
now says "Setup required", the tooltip says chats need an AI provider,
and editors who can't edit the settings are told to ask a developer or
project admin for help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… done

The connection screen mixed a provider notice, the DatoCMS connection
and a working-looking chat list. Now it shows two numbered steps, "AI
provider" and "DatoCMS account", each marked "Done" or "To do" with an
icon and a word. The provider step says what to do: an "Open plugin
settings" button for users who can edit them, or ask a developer or
project admin for help.

Until both steps are done, the Chats section shows only "Finish setup
first to start chatting.": no New chat button and no chat list. This
replaces the disabled New chat button from the first version of this
fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rename the panel "Agent setup", with the steps "Choose AI provider &
  model" and "Connect AI to DatoCMS MCP".
- Step 2 matches step 1: a short intro and a regular Connect button,
  without the logo row. It lists what each access choice on the
  DatoCMS consent screen lets the agent do.
- Until setup is done, Chats shows the kit's disabled text box with a
  FieldError explaining why, instead of placeholder-like text.
- Step 2 is a plain container instead of the kit's Form, which wrapped
  the text and the button in one item and dropped the gap between them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Auto-approve off shows a slashed bolt and "Auto-approve is off". On
  keeps the bolt and reads "Auto: On" with a "Danger" badge.
- The "DatoCMS access is not verified" notice flashed above the
  composer on every load: the access level reads "unknown" until the
  first check returns. The notice now waits for that check, so it
  only shows when access really couldn't be verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each Connect registers its own OAuth client, and the consent screen
stores the projects and the access level for that client only
(OauthApplicationAccountSetting, keyed by account and application). A
public client always sees the consent screen again. So disconnecting and
connecting again is how an editor changes the access level, and it
touches no other client's grant.

- Connected state: "Current access level", then one "Disconnect to
  change access" button. Drop "Check access again" (the plugin checks
  on every sign-in) and the account-settings link.
- Fix MCP_ACCESS_CHANGE_GUIDANCE, which the system prompt also uses: it
  told editors to revoke access in their account settings, which affects
  every MCP client of the account.
- Sign-in errors: drop "Start sign-in again with a new registration".
  Connect already re-registers when DatoCMS rejects the stored client
  (invalid_client), and no other failure needs a new client. Errors now
  say what happened and end with "Click Connect to try again."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… screen

The connected DatoCMS step now offers "Reconnect to change access"
instead of a disconnect button. It runs a forced fresh sign-in, so
DatoCMS shows the consent screen with its access choices, and then
revokes the previous token. Connect opens the popup before any network
call, so browsers don't block it. Pending approvals block it, as they
block Disconnect. If the editor cancels, they end up disconnected with
the old token revoked, and the error says to click Connect.

The agent's own guidance now points to the same button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…just chats

Setup is for editors who aren't set up yet. Once they are, the chats
panel shows only the chat history, so nobody changes the connection by
accident.

- A "⋮" menu in the chat toolbar holds:
  - "Plugin settings", disabled with a reason for users who can't edit
    the schema
  - the current DatoCMS access level, with one line on what it allows
  - "Reconnect to change access…", which asks first
- The confirmation is a small dialog inside the plugin frame, not a host
  dialog: the sign-in popup opens only from a click in this frame, and a
  click on a host dialog happens in the parent page.
- The setup screen no longer offers its own reconnect button.
- Tests render the surface inside the kit's plugin ctx, and the test
  setup stubs IntersectionObserver, which the kit's menu uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CMS owns the Agent tab's divider: the plugin SDK only sets a
starting width. Below 200px the chat can't be used, so the tab shows
"Sidebar too narrow. Drag its edge wider to see the Dato Agent." The
chat stays mounted underneath (inert), so a reply in progress survives
and continues once the tab is wider again. The record sidebar is
unaffected: the CMS already keeps it at least 300px wide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One constant, AGENT_PANE_WIDTH = 300, now sets both the starting width
of the Agent tab's chat (it was 420) and the narrowest it stays usable:
at 299px and below, the tab shows the "too narrow" notice. On a 1440px
window the chat frame measures exactly 300px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"AI settings" instead of "Plugin settings", "Current DatoCMS access
level", and summaries that start with "The agent can".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record sidebar already remembers its width in localStorage. The
Agent tab now does too: the chat saves its width on every resize (per
project, so projects don't share it), and the tab's starting split
leaves that width to the chat. A width under 300px isn't saved, so the
default comes back.

The plugin SDK has no per-user server-side storage, and plugin
parameters are shared by the whole project, so this stays per browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An editor wants their chat width in every project. A collaborator's user
ID differs per project, so keying by it would stay per-project; a single
key in the plugin's localStorage gives each browser profile, which
belongs to one person, one width everywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #165 (Rodrigo's "usable starting width" PR), without its
starting-width logic, which the draggable, remembered width replaces:

- The empty record pane adds "Ask the agent to open a record and it
  appears in this pane. Drag the divider to resize it."
- The transcript and composer stop growing at 760px and stay centred,
  so a wide chat doesn't make very long lines.

Co-authored-by: Rodrigo Barona <rodrigo.barona@wundermanthompson.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record editor's back arrow in the Agent tab switches the right pane
to the inspector's record list. The CMS shows an empty list as a loading
spinner that never ends, and the plugin only filled that list for
"show records", not when it opened a single record.

The inspector navigator now keeps the list filled: the last shown list,
plus every record the chat opened (newest first, up to 50), sent before
the editor opens. Back now lands on "Records opened from the chat".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roger-datocms roger-datocms changed the title Dato Agent: explain why "New chat" is off until an AI provider is set up Dato Agent: setup checklist, "⋮" menu, and a remembered Agent tab width Nov 5, 2026
@roger-datocms
roger-datocms merged commit 7fb6312 into master Nov 5, 2026
@matjack1
matjack1 deleted the fix/dato-agent-new-chat-setup branch November 13, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dato Agent: "New chat" does nothing until an AI provider is configured Dato Agent: the Agent tab chat opens too narrow

1 participant