Skip to content

feat: make ai plugin page context aware#57

Open
olliethedev wants to merge 6 commits intomainfrom
feat/ai-chat-improvements-2
Open

feat: make ai plugin page context aware#57
olliethedev wants to merge 6 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

ezgif-5b45c74805c7a554


Note

Medium Risk
Adds new request fields and tool-merging logic to the AI chat /chat endpoint plus client-side tool dispatch, which can affect prompting/tool behavior and chat reliability across apps. Also changes Suspense fallback behavior and example app wiring, so regressions are possible in hydration and widget UX.

Overview
Adds route-aware page AI context to the AI Chat plugin via a new PageAIContextProvider and useRegisterPageAIContext, letting pages publish pageDescription, suggestions, and client-side tool handlers.

Updates the chat flow end-to-end: ChatInterface now sends pageContext/availableTools, dispatches tool calls to page-registered handlers and returns outputs, and the backend conditionally merges built-in + consumer clientToolSchemas into streamText while appending page context to the system prompt. Example apps are wired to wrap root layouts with the provider and show a floating widget; blog/UI-builder pages register context/tools (e.g. fillBlogForm, updatePageLayers), docs/e2e coverage are added, and ComposedRoute Suspense fallback is made SSR/CSR-consistent to avoid hydration issues.

Written by Cursor Bugbot for commit ac738bb. 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 Feb 26, 2026 5:39pm

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.

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