Skip to content

feat(ai-chat): page widgets, server content and usage analytics - #283

Merged
olliethedev merged 8 commits into
mainfrom
feat/ai-chat-page-widget
Sep 30, 2026
Merged

olliethedev merged 8 commits into
mainfrom
feat/ai-chat-page-widget

Conversation

@olliethedev

@olliethedev olliethedev commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Page-specific floating chat currently requires application code for context isolation, navigation resets, responsive sizing, a timed introduction, and reading documents beyond the 16,000-character inline limit. Add these as optional ChatLayout props and a server pageContent resolver, keeping publication/access checks in the application.
  • Add provider-independent, content-free usage events through overrides.aiChat.onAnalyticsEvent. Track widget/tip interactions, suggestions, submissions, response outcomes and clears without prompts, answers, page descriptions or tool output. Preserve existing embedded/full layouts and global page registration.
  • Prepare Stack and Codegen 4.2.0, including the generated Stack install pin. The readPage server tool uses the existing authorization and streaming loop, validates configured paths, preserves full content, and renders a localized status with aiChatClientPlugin({ pageContent: true }); existing custom tools named readPage keep their detailed renderer by default. Page changes stop old streams and ignore late client-tool output.

Type of change

  • Feature / enhancement to an existing plugin
  • Documentation
  • Chore / refactor / tooling (release versions and regenerated registry)

Checklist

  • pnpm build passes
  • pnpm typecheck passes
  • pnpm lint passes
  • Tests added or updated (1,124 Stack and 196 Codegen tests pass, including 128 AI Chat tests for renderer compatibility, unavailable results, safety filtering and send/edit/retry permission preflight)
  • Docs updated (docs/content/docs/) and docs production build passes
  • All three codegen-projects create successfully and pass E2E tests (Next.js 193, TanStack 190, React Router 189; the TanStack-only origin test is intentionally skipped on the other two frameworks)
  • New-plugin submission checklist: not applicable

Additional checks: pnpm --filter @btst/stack knip passes; registry regenerated. Actual AI SDK model/tool-loop regressions cover a document over 140,000 characters, invalid/oversized paths, missing pages, and a transforming path schema applied once. Component tests cover context isolation, page reset/stream cancellation, tip lifetime, compact reader states, StrictMode analytics deduplication, private-content exclusion, and callback failure isolation. External model requests are not needed for these deterministic library tests; the real Biomogging consumer passed production build/typecheck/lint/ISR and all 286 application browser cases (including 18 chat cases), with no retries or skips against the packed candidate. Its eight guest/member × compound/blog × desktop/mobile long-page cases assert once-only submission/completion events through the real PostHog SDK and exclude question/answer/email content. All four actual OpenRouter guest/member × compound/blog cases also pass on >100,000-character fixtures, retrieving unique final labels and answering follow-ups, with no browser errors or overflow. The fresh Next.js codegen widget browser test also passes (7.7s), including the rendered article content in both page requests. Local registry E2E passed: all nine ejected plugins install and the fresh consumer builds. All required CI/deployments pass on the final reviewed head; the release gate passes. The final reviewed package also passes the consuming app production build/typecheck and all 18 focused chat cases, including unavailable-page tool errors and content-free analytics. One unchanged Media concurrent-render test failed once in CI; its 10-case file passed locally and the single CI retry passed. No Media code or test assertions were changed.

Screenshots

Actual Biomogging consumer using the packed 4.2.0 candidate:

Desktop introduction Mobile introduction
Desktop page assistant introduction Mobile introduction above compound actions

Mobile article chat with a real OpenRouter response

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
better-stack-docs Ready Ready Preview Sep 30, 2026 9:39pm UTC
better-stack-playground Ready Ready Preview Sep 30, 2026 9:39pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T21:44:30.513427Z 749d578 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5eaa87462f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/package.json Resolved
@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b67dbfba6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af7d4b9649

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 333d16b915

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c31aadd45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d5328f42d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 749d5780fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@olliethedev
olliethedev merged commit 2149559 into main Sep 30, 2026
14 checks passed

This branch was successfully deployed

2 active deployments
Preview – better-stack-docs — 749d5780 Deployed Sep 30, 2026 by vercel[bot]
Preview – better-stack-playground — 749d5780 Deployed Sep 30, 2026 by vercel[bot]
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