Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
826f969
Rewrite framework docs to showcase power and developer experience
claude Feb 28, 2026
e055f5b
Rewrite Docusaurus docs site to be compelling and developer-focused
claude Feb 28, 2026
2ab6415
Highlight tools-as-blocks, hybrid resources, ecosystem, and flows-as-…
claude Feb 28, 2026
3beeba8
Fix incorrect session state route — sessions endpoint has no kind seg…
claude Feb 28, 2026
a124c47
Stylize as flow-state.dev, fix branding, improve examples, add connec…
claude Feb 28, 2026
c93a5c7
Rewrite blog post to reflect framework vision: exploring new AI patterns
claude Feb 28, 2026
15967b8
Redesign landing page: dark theme, modern layout, mobile-friendly
claude Feb 28, 2026
01be582
Show component item model in landing page examples
claude Feb 28, 2026
ed2ee16
Showcase full sequencer DSL power in landing page and blocks docs
claude Feb 28, 2026
3854c7f
Replace analyze handler with sequencer that emits component via tap
claude Feb 28, 2026
59228a0
Fix API contract mismatches flagged in PR review comments
claude Feb 28, 2026
f8b34ec
Merge main into feature branch, resolve conflict in core README
claude Mar 1, 2026
eeebc57
Improve Define tab: imports, comments, inputSchema, sessionStateSchema
claude Mar 1, 2026
f8e67a7
Fix comment indentation on landing page, add state bubbling docs
claude Mar 1, 2026
482de34
Add Type System concept page, callout in state docs, fix comment indent
claude Mar 1, 2026
e9a6097
Reorder type-system in sidebar, fix naming, add type extraction docs
claude Mar 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Show component item model in landing page examples
Blocks don't send outputs to the client — they emit typed items.
Updated Define example to show ctx.emitComponent() with a handler
that emits a named "report-card" component. Updated Render example
to show FlowProvider with registered component renderers and how
ItemRenderer resolves component items from the stream.

https://claude.ai/code/session_01F9D1j5EPAQseYvXfyeNuwh
  • Loading branch information
claude committed Feb 28, 2026
commit 01be5822818955d9e650fa96b68356524c2d093d
67 changes: 43 additions & 24 deletions apps/docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,36 @@ import styles from "./index.module.css";

/* ── Code examples ── */

const defineExample = `import { defineFlow, generator, sequencer } from "@flow-state-dev/core";
const defineExample = `import { defineFlow, generator, handler, sequencer } from "@flow-state-dev/core";

// A tool that's a full multi-step pipeline — not a function wrapper
const deepResearch = sequencer({ name: "deep-research" })
.then(searchIndex)
.then(rankResults)
.then(summarize);

// Resources: hybrid memory — text content + structured state
const docResource = {
stateSchema: z.object({
byId: z.record(z.object({
title: z.string(),
content: z.string(), // Rich text — the "file" part
tags: z.array(z.string()), // Structured state — the "metadata" part
})).default({}),
}),
writable: true,
};
// Blocks emit component items — structured data for the UI
const analyze = handler({
name: "analyze",
execute: async (input, ctx) => {
const report = await buildReport(input);
const component = ctx.emitComponent("report-card", {
title: report.title,
findings: report.findings,
confidence: report.score,
});
component.done();
return report;
},
});

const agent = generator({
name: "agent",
model: "gpt-5-mini",
prompt: "You are a research assistant.",
history: (_input, ctx) => ctx.session.items.llm(),
user: (input) => input.message,
tools: [deepResearch, readDoc, writeDoc],
tools: [deepResearch, analyze, readDoc, writeDoc],
});

export default defineFlow({
Expand Down Expand Up @@ -64,22 +67,38 @@ export const { GET, POST, DELETE } = createFlowApiRouter({ registry });
// GET /api/flows/research-assistant/requests/:id/stream
// GET /api/flows/sessions/:id/state`;

const renderExample = `function ResearchApp() {
const renderExample = `// Register component renderers — the UI counterpart to ctx.emitComponent()
function ReportCard({ item }: { item: ComponentItem }) {
const { title, findings, confidence } = item.data;
return (
<div className="report-card">
<h3>{title}</h3>
<ul>{findings.map(f => <li key={f}>{f}</li>)}</ul>
<meter value={confidence} />
</div>
);
}

function App() {
return (
<FlowProvider
config={{ baseUrl: "/api" }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Replace unsupported FlowProvider config prop in example

FlowProvider does not accept a config prop (its public props are flowKind, sessionId, userId, baseUrl, and renderers), so this homepage example is not copy-pastable and will fail type-checking; it also omits flowKind/userId, which makes useFlow({ autoCreateSession: true }) fail when creating a session. Use the documented top-level props instead.

Useful? React with 👍 / 👎.

renderers={{ component: { "report-card": ReportCard } }}
>
<ResearchApp />
</FlowProvider>
);
}

function ResearchApp() {
const flow = useFlow({ autoCreateSession: true });
const session = useSession(flow.activeSessionId);
const { session: proj } = useProjections(session, {
session: ["docList"],
});

return (
<>
{/* ItemRenderer resolves component items to registered renderers */}
{session.items.map(item => <ItemRenderer key={item.id} item={item} />)}

<aside>
<h3>Documents ({proj?.docList?.length ?? 0})</h3>
{proj?.docList?.map(doc => <DocCard key={doc.id} {...doc} />)}
</aside>

<button
onClick={() => session.sendAction("chat", { message: "Hello" })}
disabled={session.isStreaming}
Expand Down Expand Up @@ -134,7 +153,7 @@ const codeTabs: CodeTab[] = [
},
{
label: "Render",
caption: "React hooks that stream items and projections in real time.",
caption: "Register component renderers. ItemRenderer resolves them from the stream.",
code: renderExample,
language: "tsx",
},
Expand Down Expand Up @@ -175,7 +194,7 @@ const features: FeatureItem[] = [
{
title: "Streaming that just works.",
description:
"Items stream over SSE as blocks execute. Disconnect mid-response? Reconnect with a sequence cursor. No data loss.",
"Messages, components, status updates — all stream over SSE as blocks execute. Disconnect mid-response? Reconnect with a sequence cursor.",
},
{
title: "Type-safe, end to end.",
Expand Down