Skip to content

feat: make ai plugin page context aware#57

Merged
olliethedev merged 20 commits intomainfrom
feat/ai-chat-improvements-2
Mar 4, 2026
Merged

feat: make ai plugin page context aware#57
olliethedev merged 20 commits intomainfrom
feat/ai-chat-improvements-2

Conversation

@olliethedev
Copy link
Collaborator

@olliethedev olliethedev commented Feb 25, 2026

Changes in this PR:

  • make ai plugin page context aware so that ai chat widget can summarize pages or interact with pages (pre-fill forms, interact with ui-builder state etc)
screenshot_2026-02-25_at_4 35 16___pm

Feb-28-2026 20-49-26


Note

Medium Risk
Introduces new request fields and tool-activation logic in the AI chat backend (including allowlists and an authorization hook), plus new server-side mutation helpers for CMS/Kanban that bypass hooks; mistakes could expose unintended tool access or writes. Changes are mostly additive but touch the chat request/streaming path and multiple example apps/e2e coverage.

Overview
Adds route-aware AI context to the ai-chat plugin: pages can register routeName, pageDescription, suggestions, and client-side tool handlers via new PageAIContextProvider + useRegisterPageAIContext, and ChatInterface now sends pageContext/availableTools/routeName with each chat request.

Extends the aiChatBackendPlugin to optionally (enablePageTools) merge built-in/consumer page tool schemas into streamText, enforce a built-in tool routeName allowlist (page-tools.ts), and expose a new hooks.onBeforeToolsActivated that can filter/deny tools (403 on throw); also updates widget UX (trigger/control props, page-context badge, clear/close) and merges page suggestions with global chatSuggestions.

Implements first-party integrations: blog pages register context + fillBlogForm (forms expose onFormReady and share handler), UI builder registers context + updatePageLayers, and examples wrap root layouts with PageAIContextProvider, mount a floating ChatLayout widget, enable page tools, and add a WealthReview demo tool that writes a CMS client-profile and creates/updates a Kanban review queue.

Adds server-side mutation surfaces: cms exposes createCMSContentItem and api.cms.createContentItem (ensures sync), kanban exposes createKanbanTask/findOrCreateKanbanBoard/getKanbanColumnsByBoardId, and docs are updated accordingly; adds Playwright smoke tests for page context + WealthReview flows, bumps @btst/stack to 2.4.0, and exports the new ai-chat/client/context entrypoint.

Written by Cursor Bugbot for commit 19ed237. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
better-stack-docs Ready Ready Preview, Comment Mar 4, 2026 8:31pm

Request Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@olliethedev olliethedev merged commit 3bb50a7 into main Mar 4, 2026
5 checks passed
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.

1 participant