chore(examples,docs): cleanup & maintenance — standardize chat wiring on fetchLLM#711
Open
ankit-thesys wants to merge 8 commits into
Open
chore(examples,docs): cleanup & maintenance — standardize chat wiring on fetchLLM#711ankit-thesys wants to merge 8 commits into
ankit-thesys wants to merge 8 commits into
Conversation
Replace hand-written ChatLLM objects with fetchLLM({ url, streamAdapter,
messageFormat }) in openui-chat, shadcn-chat, material-ui-chat,
supabase-chat, mastra-chat, and form-generator. No route changes: all
routes read body.messages (supabase also body.threadId, which fetchLLM
sends natively) and ignore the extra RunAgentInput fields.
Aligns the examples with what the docs already teach ("most apps never
construct a ChatLLM by hand"). Verified: tsc --noEmit + next/vite build
per app.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… server-side The client used to send TableContext's threadId (always "default"), which keys the server-side table store. fetchLLM sends AgentInterface's per-thread uuid instead, which would desync chat tools from the visible spreadsheet — so the route now keys the shared table store by the constant "default" and ignores body.threadId, preserving today's actual behavior (setThreadId was never called anywhere). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Page: custom ChatLLM -> fetchLLM (openAIReadableStreamAdapter + openAIMessageFormat); client no longer computes the system prompt. - Route: conversation id now read from body.threadId (fetchLLM sends it), x-conversation-id header kept as fallback; system prompt computed server-side from openuiLibrary with body.systemPrompt as optional override. - next.config.ts: issuer-scoped webpack external for genui-lib — Next 16's route-handler graph rejects its client-oriented React imports when bundled; scoping avoids a second React instance during page SSR. - Docs page updated to match the new wiring (snippets + prose). Verified: tsc, next build, runtime smoke test, docs build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e prompt Frontend: custom ChatLLM -> fetchLLM (openAIReadableStreamAdapter + openAIMessageFormat); the client no longer sends systemPrompt. Backend: body["systemPrompt"] hard-KeyError -> optional override; the default prompt is read from backend/app/system_prompt.txt, generated by the new frontend generate:prompt script (Node, imports genui-lib). The generated prompt file is committed so the Python backend runs without a Node step; regenerate when the library prompt changes (README updated). Verified: vite build, py_compile, generate:prompt end-to-end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ace llm
Upgrade off the stale pinned @openuidev/react-headless 0.8.2 to
workspace:* (matching sibling examples) and migrate ChatProvider off the
removed flat processMessage/streamProtocol props to
llm={fetchLLM({ url, streamAdapter: openAIAdapter(), messageFormat:
openAIMessageFormat })}. Route unchanged (reads body.messages).
Lockfile changes land separately in the final chore commit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…neration The scaffold the quickstart points at taught the hand-written-ChatLLM anti-pattern. The template page now uses fetchLLM; the route serves the system prompt server-side (body.systemPrompt optional override), reading a file generated at build time by the new scripts/generate-prompt.mjs (direct genui-lib import in a route breaks next build under the react-server condition, so generation mirrors the committed-file pattern other examples use). Verified end-to-end: CLI built, template scaffolded into a scratch dir against published 0.12.1/0.9.1, tsc + eslint + next build all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- docs/public/AGENTS.md: Cloud quickstart rewritten fetchLLM-first (with
a slice(-1) messageFormat wrapper and a route snippet consistent with
the RunAgentInput body); custom-ChatLLM guidance rescoped to genuinely
non-HTTP cases (vercel-eve); fetchLLM POST body contract corrected to
{ threadId, runId, messages, tools: [], context: [] }.
- packages/react-headless/AGENTS.md: full refresh off the removed
threadApiUrl/apiUrl/processMessage props era — current {llm, storage}
contract, regenerated file map (src/adapters, src/stream/formats,
src/hooks), updated recipes and test-suite list.
- packages/react-headless/README.md: fetchLLM-first quickstart; fixed
bare un-called adapter usages.
- packages/react-ui/README.md: quickstart on fetchLLM; CSS import
standardized on components.css (styles/index.css is a byte-identical
alias).
- docs llms.txt route: /AGENTS.md now advertised first in the index.
- CONTRIBUTING.md: routes coding agents to the AGENTS.md system.
- vercel-eve AGENTS.md: marks its hand-written ChatLLM as the intentional
exception (client-side stream synthesis, no HTTP endpoint).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… importer Two causes: (1) react-email's move from pinned react-headless 0.8.2 to workspace:* removes the old 0.8.2 dependency tree; (2) pnpm install ran in a checkout without the gitignored examples/openui-cloud/vendor/ dir, so the lockfile's vendor-package importer (and its now-unreferenced transitive entries) was dropped. (2) is arguably a fix: pnpm install --frozen-lockfile now passes on a fresh checkout (the known post-retire-shells CI lockfile debt). Devs with vendor/ present locally will see this importer churn back on their next install — drop this hunk at review if that trade-off is not wanted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup & general maintenance
No new features. This PR removes drift that accumulated after the Agent Interface SDK landed: example code that contradicts the docs, agent-facing docs describing removed APIs, and a few pieces of dead weight. Consumer-visible behavior is unchanged except that examples/scaffold now demonstrate the documented pattern.
1 · Example drift → aligned with the docs
The docs teach fetchLLM-first ("Most apps never construct a ChatLLM by hand" — adapters-and-formats), but 8 example apps and the CLI scaffold hand-rolled custom
ChatLLMobjects. Cleaned up:1df94b0dfetchLLM(...)ae88f1cd"default"(matches actual prior behavior —setThreadIdwas never called)5d0e926fbody.threadId(header fallback kept); system prompt moved server-side; docs page updated to stop contradicting the example0b433708systemPromptoptional; default prompt generated viagenerate:promptand committed (no Node step needed to run the Python backend)e89b3893workspace:*; migrated off removed flat ChatProvider props75eb6354Deliberately not converted (legitimate escape hatches, now documented as such):
examples/openui-cloud,examples/harnesses/vercel-eve.2 · Doc rot → corrected (
6113ba76)docs/public/AGENTS.md: Cloud quickstart rewritten fetchLLM-first; custom-ChatLLM guidance rescoped to genuinely non-HTTP cases; fetchLLM POST body contract corrected (real body:{ threadId, runId, messages, tools: [], context: [] })packages/react-headless/AGENTS.md: still described the removedthreadApiUrl/apiUrl/processMessageera with a wrong file map — fully refreshed from the current treepackages/react-headless/README.md: bare un-called adapter factories fixed, fetchLLM added;packages/react-ui/README.md: quickstart on fetchLLM, CSS import standardized oncomponents.cssdocsllms.txt: now advertises/AGENTS.md(it was invisible to agents discovering the site);CONTRIBUTING.mdroutes coding agents to the AGENTS.md system; vercel-eveAGENTS.mdmarks its custom ChatLLM as the intentional exception3 · Hygiene (
0b67d190)Lockfile: react-email's old 0.8.2 tree removed; the importer for the gitignored
examples/openui-cloud/vendor/dropped — after whichpnpm install --frozen-lockfilepasses on a fresh checkout (long-standing CI lockfile debt). Devs withvendor/locally will see the importer churn back on their next install — this hunk is isolated in its own commit and droppable if the trade-off isn't wanted.Verification
tsc --noEmit+next/vitebuild for every converted app; fastapi additionallypy_compile+ prompt generation end-to-end; pi-harness runtime smoke testpnpm install --frozen-lockfilegreen on fresh checkoutKnown divergence (tracked, out of scope)
The rewritten
/AGENTS.mdCloud quickstart uses the RunAgentInputmessagesbody while the unconvertedexamples/openui-cloudstill posts{ threadId, input }— converging them needs a fetchLLM body-mapping option (deferred SDK idea).🤖 Generated with Claude Code