Skip to content

feat(chat)!: remove provideChat(), fix app-level markdown registry overrides, and three API cleanups - #1055

Merged
blove merged 4 commits into
mainfrom
blove/chat-remove-provide-chat
Sep 8, 2026
Merged

feat(chat)!: remove provideChat(), fix app-level markdown registry overrides, and three API cleanups#1055
blove merged 4 commits into
mainfrom
blove/chat-remove-provide-chat

Conversation

@blove

@blove blove commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Closes three @threadplane/chat follow-ups from the API audit.

1. provideChat() / ChatConfig / CHAT_CONFIG removed

grep -rn CHAT_CONFIG libs/ confirmed the audit: the only readers were provide-chat.ts itself and the public-api re-export. Calling provideChat({}) configured nothing — renderRegistry, avatarLabel, and assistantName were values only a consumer's own wrappers could read back.

The provider, token, and interface are deleted outright, along with the unused duplicate ChatConfig in chat.types.ts. Every call site follows: 35 cockpit/**/angular/src/app/app.config.ts files, both standalone example apps, the chat and langgraph READMEs, the @threadplane/render JSDoc that referenced it, and the docs.

Three docs pages described the API: chat/api/provide-chat, chat/api/chat-config, and chat/guides/configuration (which was entirely about it). All three are deleted, dropped from the docs nav, added to RETIRED_ROUTE_PATTERN in the public-copy contract, and permanently redirected — with their /api/markdown mirrors — to chat installation, since the site already keeps a redirect map for retired docs routes. The remaining ~35 prose mentions across the chat, langgraph, ag-ui, deep-agents, runtimes, and a2ui docs are rewritten so the concept is simply gone rather than described as a no-op.

The seven blog tutorials whose bootstrap snippets called provideChat are included: their code no longer compiles otherwise. This is slightly wider than the stated scope, called out here so it can be reverted if unwanted.

2. An app-level MARKDOWN_VIEW_REGISTRY override now works

<chat-streaming-md> provided the token on its own injector from viewRegistry() ?? cacheplaneMarkdownViews, so a root or route provider was always shadowed. Resolution is now most-specific-first: the [viewRegistry] input, then an ancestor injector via skipSelf, then the default. The resolved value is still provided on the component injector, so markdown-children.component.ts and the table-row view are unchanged, and <chat> forwards nothing — it does not need to.

The markdown guide gets an accurate "App-wide override" section replacing the Callout that asserted the opposite, and the CHANGELOG entry making the same false claim is corrected.

7. Three small cleanups

  • ContentType loses 'mixed' along with the dead || currentType === 'mixed' branch. The classifier never emitted it. content-classifier.mdx and chat/guides/streaming.mdx updated.
  • messageContent() takes { content: unknown } instead of LangChain's BaseMessage. Callers hold the runtime-neutral Message, so ChatComponent.humanContent carried a cast and the docs told readers to pass something other than the message they have. The cast is gone; chat-message-list.mdx and message-model.mdx corrected.
  • --tplane-chat-launcher-offset-x / -y (both 1rem) position the <chat-popup> launcher. The popup window reads the horizontal one too, so it stays aligned when the launcher moves. Documented in chat-popup.mdx and the theming token table.

Specs added

  • streaming-markdown.registry-override.spec.ts — 4 cases; 2 fail on the old resolution (ancestor provider, and the same through <chat>), 2 pin the default and input precedence.
  • message-utils.spec.ts — fails to type-check against the old BaseMessage signature (4 errors under tsconfig.spec.json), passes after.
  • chat-popup.styles.spec.ts — 4 of 5 cases fail before the change; the window-alignment guard was mutation-checked by reverting that one declaration.
  • next.config.spec.ts — two new cases covering the retired-route redirects and their markdown mirrors.

'mixed' is a type-only removal with no runtime behavior to pin. A .type-spec.ts was attempted and dropped: chat:type-tests is already red on main (TS 6.0 baseUrl deprecation), and importing ContentType pulls @threadplane/a2ui source across that config's rootDir. The change is guarded by the compiler and by the regenerated api-docs.json.

Verification

  • npx nx run-many -t lint,test,build --projects=chat,render — green (0 lint errors).
  • npx vitest run --root apps/website — 131 files, 1328 tests passed. positioning.spec.ts and the public-copy/install-option guards pass unchanged.
  • GROWTH_FORM_POLICY=growth_v1 npx nx build website — succeeded.
  • npx nx run-many -t build for cockpit-chat-messages-angular, cockpit-langgraph-streaming-angular, cockpit-ag-ui-interrupts-angular — all built.
  • npx nx run-many -t e2e for the same three — 1 / 3 / 3 passed.
  • npm run generate-api-docs and npx tsx scripts/generate-ag-ui-deployment-config.ts run; the api-docs changes are committed (the deployment config produced no diff).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 8, 2026 3:56am UTC

Request Review

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

blove and others added 3 commits September 7, 2026 20:44
No component in @threadplane/chat ever injected CHAT_CONFIG, so
provideChat({}) configured nothing: renderRegistry, avatarLabel, and
assistantName were values only a consumer's own wrappers could read back.
The provider, the token, the interface, and the dead ChatConfig duplicate
in chat.types.ts are deleted outright.

Every call site follows: 35 cockpit example app.config.ts files, both
standalone example apps, the chat and langgraph READMEs, the @threadplane
/render JSDoc that referenced it, the docs pages that described it, and the
blog tutorials whose bootstrap snippets would otherwise no longer compile.

The three pages that documented the API — chat/api/provide-chat,
chat/api/chat-config, and chat/guides/configuration — are deleted, dropped
from the docs nav, added to the retired-route pattern the public-copy
contract enforces, and permanently redirected (with their /api/markdown
mirrors) to chat installation so delivered links do not 404.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…iews

<chat-streaming-md> provided MARKDOWN_VIEW_REGISTRY on its own component
injector from its own default, so a provider at the application root or on a
route was always shadowed and never reached the markdown node components.
The [viewRegistry] input was the only override that worked.

Resolution is now most-specific-first: the [viewRegistry] input, then a
registry found through skipSelf on an ancestor injector, then
cacheplaneMarkdownViews. The resolved value is still provided on the component
injector, so <chat-md-children> and the table-row view are unchanged, and
<chat> needs to forward nothing for an app-wide override to reach the markdown
it renders for assistant messages.

The new spec fails on the old resolution in two of its four cases (ancestor
provider, and the same through <chat>) and passes on the other two, which pin
the default and the input precedence.

Restores an accurate "App-wide override" section in the markdown guide, which
previously carried a Callout asserting the opposite, and corrects the
CHANGELOG entry that made the same claim.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ageContent, tokenize the popup launcher

Three small cleanups:

- ContentType no longer carries 'mixed'. createContentClassifier never emitted
  it, so the `|| currentType === 'mixed'` branch in the delta path was dead and
  any consumer switch on it had a case no input reaches. The docs said as much
  and told readers not to branch on it; the member is simply gone instead.

- messageContent() takes { content: unknown } rather than LangChain's
  BaseMessage. Every caller in this library holds the runtime-neutral Message
  from agent.messages(), so ChatComponent.humanContent carried a cast and the
  docs told consumers to pass something other than the message they actually
  have. The function reads nothing but .content, so the structural parameter is
  the honest signature; the cast is gone.

- --tplane-chat-launcher-offset-x / -y (both 1rem) position the <chat-popup>
  launcher, which was pinned with hard-coded corner offsets. The popup window
  reads the horizontal one too, so it stays aligned when the launcher moves
  clear of a bottom bar or a consent banner.

The new message-utils spec fails to type-check against the old BaseMessage
signature (four errors under tsconfig.spec.json) and passes after. The new
chat-popup styles spec fails four of its five cases before the change, and its
window-alignment guard was mutation-checked by reverting that one declaration.

Regenerates the chat and render api-docs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@blove
blove force-pushed the blove/chat-remove-provide-chat branch from 633319e to c63be78 Compare September 8, 2026 03:45
@blove
blove enabled auto-merge (squash) September 8, 2026 03:45
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

Widening messageContent() to { content: unknown } removed the last
LangChain import from the published package, so @nx/dependency-checks
fails the declared peer. It stays a peer of @threadplane/langgraph,
which is why the install command still lists it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove merged commit f17f456 into main Sep 8, 2026
76 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