19 components19 new, November 12, 2026
AI
Interfaces for AI products and agents: generation, streaming answers, reasoning, agent runs, plans and permissions, knowledge sources, evals, enrichment, cited replies and chat history.
Image Generation CardNew, Oct 15
AI image panel: Generate resolves the image from coarse pixel blocks to sharp with a step counter, then four variations land. Pick one, or change the ratio.
Usage and propsReal data, 8 props, 3 dependencies
Usage
Pass generate to make real images. It gets the prompt, model and ratio with an AbortSignal and resolves to up to four image URLs; the first one resolves from blocks to sharp once it loads.
"use client";
import ImageGenerationCard from "@/components/kokonutui-pro/image-generation-card";
export function Studio() {
return (
<ImageGenerationCard
generate={async (request, signal) => {
const res = await fetch("/api/images", {
method: "POST",
body: JSON.stringify(request),
signal,
});
if (!res.ok) {
throw new Error("The model is busy, try again in a minute");
}
const { urls } = await res.json();
return urls;
}}
models={["gpt-image-1"]}
/>
);
}import { openai } from "@ai-sdk/openai";
import { experimental_generateImage as generateImage } from "ai";
const SIZES = { "1:1": "1024x1024", "4:3": "1536x1024", "16:9": "1536x1024" } as const;
export async function POST(req: Request) {
const { prompt, aspectRatio } = await req.json();
const { images } = await generateImage({
model: openai.image("gpt-image-1"),
prompt,
n: 4,
size: SIZES[aspectRatio as keyof typeof SIZES],
abortSignal: req.signal,
});
return Response.json({
urls: images.map((image) => `data:${image.mediaType};base64,${image.base64}`),
});
}Props
promptstringDefault built-inInitial prompt text
modelstringDefault DEFAULT_MODELS[0] ?? "Flux 1.1 Pro"Initially selected model
modelsstring[]Default built-inModels offered in the model menu
aspectRatioAspectRatioDefault "4:3"Initial aspect ratio
imagesstring[]Image URLs to show instead of the procedural demo scenes. Variations rotate through the list on each generation.
onGenerate(request: GenerateRequest) => voidCalled when Generate is pressed
generate(request: GenerateRequest, signal: AbortSignal) => Promise<string[]>Makes the images. Resolve with up to four URLs (data URLs work too). Leave it out for the drawn demo scenes.
classNamestringExtra classes for the root element.
AspectRatio
type AspectRatio = "1:1" | "4:3" | "16:9";
GenerateRequest
promptrequiredstringmodelrequiredstringaspectRatiorequiredAspectRatioDependencies
cn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Agent QuestionsNew, Oct 21
The questions an agent asks before it starts: pick with a click or a number key, and answers fold into a summary you can edit.
Usage and propsReal data, 4 props, 5 dependencies
Usage
Render it for the agent's ask tool call and send the answers back as the tool's output. Return the Promise from onSubmit so Start waits for it.
"use client";
import type { useChat } from "@ai-sdk/react";
import AgentQuestions, {
type AgentQuestion,
} from "@/components/kokonutui-pro/agent-questions";
type Chat = ReturnType<typeof useChat>;
export function AskPart({
part,
addToolOutput,
}: {
part: {
toolCallId: string;
state: string;
input: { task: string; questions: AgentQuestion[] };
};
addToolOutput: Chat["addToolOutput"];
}) {
if (part.state !== "input-available") {
return null;
}
return (
<AgentQuestions
onSubmit={(answers) =>
addToolOutput({
tool: "ask",
toolCallId: part.toolCallId,
output: answers,
})
}
questions={part.input.questions}
task={part.input.task}
/>
);
}Props
questionsAgentQuestion[]Default built-intaskstringDefault "Set up the marketing site"What the agent is about to do, shown under the heading.
onSubmit(answers: Record<string, QuestionAnswer>) => void | Promise<void>Called with every answer when the user starts the run. Return a Promise to hold Start until it settles; a rejection shows its message.
classNamestringExtra classes for the root element.
AgentQuestion
idrequiredstringtitlerequiredstringShort name for the answer row, such as "Framework".
promptrequiredstringoptionsrequiredQuestionOption[]multiplebooleanPick any number instead of one.
allowOtherbooleanOffer a free-text "Other" row. Defaults to true.
QuestionAnswer
type QuestionAnswer =
| { kind: "options"; ids: string[] }
| { kind: "other"; text: string }
| { kind: "agent" };QuestionOption
idrequiredstringlabelrequiredstringhintstringOne line on what picking it means.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Docs SearchNew, Oct 16
Search for a docs site that can also answer. Hits are grouped by page with the line that matched, and the first row asks instead: the answer is written from the matching sections, each sentence cites its source, and pointing at a citation lights up that source. With nothing to cite, it says so instead of guessing.
Usage and props5 props, 3 dependencies
Props
sectionsDocSection[]Default built-indefaultQuerystringDefault ""onNavigate(section: DocSection) => voidCalled when a result or source is opened.
placeholderstringDefault "Search the docs…"classNamestringExtra classes for the root element.
DocSection
idrequiredstringpagerequiredstringPage the section lives on, such as "Webhooks".
headingrequiredstringtextrequiredstringSearchable body text.
summaryrequiredstringOne plain sentence the answer can quote for this section.
hrefrequiredstringDependencies
cn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Run TraceNew, Oct 25
One agent run as a waterfall: model calls, tool calls and retrievals stream in on the run's own clock, so parallel calls sit side by side and a timeout stands out. Hover to read the clock, click a span for its input, output, tokens and cost, and collapse a step into one bar that still shows where its children ran.
Usage and propsReal data, 6 props, 5 dependencies
Usage
Pass the spans your tracer recorded, in tree order. While the run is going, pass elapsed and leave duration off the open spans so they grow to it; once it's done, pass live={false} to show it whole.
"use client";
import RunTrace, { type TraceSpan } from "@/components/kokonutui-pro/run-trace";
// One span from your tracing store (for an AI SDK run, the OpenTelemetry
// spans from `experimental_telemetry: { isEnabled: true }`).
interface StoredSpan {
id: string;
parentId?: string;
name: string;
kind: TraceSpan["kind"];
startedAt: number;
endedAt?: number;
error?: string;
}
const toSpan = (span: StoredSpan, runStart: number): TraceSpan => ({
id: span.id,
parentId: span.parentId,
kind: span.kind,
name: span.name,
start: span.startedAt - runStart,
duration: span.endedAt ? span.endedAt - span.startedAt : undefined,
status: span.error ? "error" : "ok",
error: span.error,
});
export function Trace({
spans,
runStart,
running,
}: {
spans: StoredSpan[];
runStart: number;
running: boolean;
}) {
return (
<RunTrace
elapsed={running ? Date.now() - runStart : undefined}
live={false}
spans={spans.map((span) => toSpan(span, runStart))}
/>
);
}Props
spansTraceSpan[]elapsednumberMilliseconds since your run began. Pass it to draw a run as it stands, with no replay: open spans grow to it and pulse as running.
livebooleanDefault trueDemo: play the run in as it streams. Defaults to true.
defaultSelectedstringThe span whose details are open at first.
onSelect(span: TraceSpan) => voidclassNamestringExtra classes for the root element.
TraceSpan
idrequiredstringparentIdstringThe span this one ran inside. Leave out for the run itself.
kindrequiredSpanKindnamerequiredstringstartrequirednumberMilliseconds from the start of the run.
durationnumberLeave out while the span runs; it grows to elapsed until you set it.
status"ok" | "error"tagstringShown beside the name, such as "retry 1".
modelstringtokensInnumbertokensOutnumbercostnumberIn US dollars.
inputstringoutputstringerrorstringWhat went wrong, for a span with status "error".
SpanKind
type SpanKind = "agent" | "model" | "tool" | "retrieval";
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Tool PermissionsNew, Oct 25
Allow, Ask or Block for every tool an agent can reach, grouped by connected server and tagged as reads, writes or destructive. Setting a whole server to Allow leaves its destructive tools as they were until you say so, and changed tools show what they were until Save.
Usage and props4 props, 5 dependencies
Props
agentstringDefault "Support agent"Whose permissions these are, shown in the header.
serversToolServer[]Default demo dataonSave(changes: PermissionChange[]) => Promise<void> | voidclassNamestringExtra classes for the root element.
ToolServer
idrequiredstringnamerequiredstringmonogramrequiredstringTwo letters for the server's tile.
colorrequiredstringBackground of the tile, any CSS color.
toolsrequiredAgentTool[]PermissionChange
serverrequiredstringtoolrequiredstringfromrequiredPermissiontorequiredPermissionAgentTool
idrequiredstringnamerequiredstringdescriptionrequiredstringeffectrequiredToolEffectpermissionrequiredPermissionPermission
type Permission = "allow" | "ask" | "block";
ToolEffect
type ToolEffect = "read" | "write" | "destructive";
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Knowledge SourcesNew, Oct 25
The files an assistant answers from, each drawn as its chunks. Cells fill in as a file is embedded, a scanned PDF says it needs OCR, and a test question lights up the chunks it would retrieve with their scores and matched words. Add the missing source and the ranking moves to make room.
Usage and propsReal data, 9 props, 5 dependencies
Usage
Pass your sources with indexed counting up while each one embeds, and search to run the test question against your real index. Add source and the fix button call onAdd and onFix, so they open your own picker and re-run your own pipeline.
"use client";
import KnowledgeSources, {
type KnowledgeSearch,
type KnowledgeSource,
} from "@/components/kokonutui-pro/knowledge-sources";
const search: KnowledgeSearch = async (query, sources, topK, signal) => {
const res = await fetch("/api/knowledge/search", {
method: "POST",
body: JSON.stringify({ query, topK, ids: sources.map((s) => s.id) }),
signal,
});
if (!res.ok) {
throw new Error("Search is unavailable right now");
}
// [{ sourceId, chunk, text, score, terms }]
const hits: Hit[] = await res.json();
return hits.flatMap((hit) => {
const source = sources.find((s) => s.id === hit.sourceId);
return source
? [
{
source,
passage: { chunk: hit.chunk, text: hit.text },
score: hit.score,
terms: hit.terms,
},
]
: [];
});
};
export function Sources({ sources }: { sources: KnowledgeSource[] }) {
return (
<KnowledgeSources
name="Help center"
onAdd={openFilePicker}
onFix={(source) => reindex(source.id, { ocr: true })}
search={search}
sources={sources}
/>
);
}On the server, embed the question with the AI SDK and rank by cosine similarity (or let your vector database do it):
import { openai } from "@ai-sdk/openai";
import { cosineSimilarity, embed } from "ai";
export async function POST(req: Request) {
const { query, topK, ids } = await req.json();
const { embedding } = await embed({
model: openai.textEmbeddingModel("text-embedding-3-small"),
value: query,
});
const chunks = await loadChunks(ids); // [{ sourceId, chunk, text, embedding }]
const hits = chunks
.map((c) => ({ ...c, score: cosineSimilarity(embedding, c.embedding) }))
.filter((c) => c.score >= 0.4)
.sort((a, b) => b.score - a.score)
.slice(0, topK)
.map(({ embedding: _, ...hit }) => ({ ...hit, terms: [] }));
return Response.json(hits);
}Props
namestringDefault "Help center"Shown in the header.
sourcesKnowledgeSource[]Default demo dataincomingKnowledgeSource[]Default demo dataFiles "Add source" brings in, one per click, for the demo.
defaultQuerystringDefault "Can I return a gift without a receipt?"retrieve(query: string, sources: KnowledgeSource[], topK: number) => RetrievedChunk[]Default wordOverlapReplaces the built-in word overlap scoring, in the browser.
searchKnowledgeSearchA real search: runs the test question against your index.
onAdd() => voidLive: Add source opens your own picker. Leave it out for the demo files.
onFix(source: KnowledgeSource) => voidLive: the fix button on a failed source, such as a retry with OCR.
classNamestringExtra classes for the root element.
KnowledgeSource
idrequiredstringnamerequiredstringkindrequired"pdf" | "md" | "html" | "docx"chunksrequirednumberHow many chunks the file splits into.
passagesrequiredSourcePassage[]The chunks with text to match against.
errorstringA source that couldn't be read, and why.
fixstringThe button that fixes the error, such as "Retry with OCR".
indexednumberLive: chunks embedded so far. Below chunks, the source shows as embedding. Leave it out for a source that's ready.
RetrievedChunk
sourcerequiredKnowledgeSourcepassagerequiredSourcePassagescorerequirednumbertermsrequiredstring[]KnowledgeSearch
type KnowledgeSearch = (query: string, sources: KnowledgeSource[], topK: number, signal: AbortSignal) => Promise<RetrievedChunk[]>;
SourcePassage
chunkrequirednumberPosition of the chunk in its file, from 0.
textrequiredstringDependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Prompt TemplateNew, Oct 25
A versioned prompt where every {{variable}} is tinted in place and gets its own field, added and removed as you type. Point at a field to see where it's used, switch to Preview for the prompt the model gets, and save the edit as the next version.
Usage and props5 props, 5 dependencies
Props
namestringDefault "support/refund-reply"The prompt's key, shown in the header.
versionsPromptVersion[]Default demo dataNewest first.
defaultValuesRecord<string, string>Default demo dataonSave(template: string) => Promise<void> | voidclassNamestringExtra classes for the root element.
PromptVersion
versionrequirednumbertemplaterequiredstringnoterequiredstringWhat changed, shown in the version menu.
daterequiredstringWhen it was saved, as shown.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Plan ReviewNew, Oct 25
The plan an agent writes before it starts: drag or arrow-key steps into order, rename, skip or add them, or ask for changes and see what the agent added. Approve runs it step by step, and steps that ask first wait for Run or Skip.
Usage and propsReal data, 6 props, 5 dependencies
Usage
Pass the agent's plan as steps. revise sends the person's note and resolves with the new plan (steps with new ids are marked Added), and runStep runs one approved step for real; a throw stops the run on that step with its message.
"use client";
import PlanReview, { type PlanStep } from "@/components/kokonutui-pro/plan-review";
const post = async (path: string, body: unknown, signal: AbortSignal) => {
const res = await fetch(path, {
method: "POST",
body: JSON.stringify(body),
signal,
});
if (!res.ok) {
throw new Error((await res.text()) || "Request failed");
}
return res.json();
};
export function Plan({ task, steps }: { task: string; steps: PlanStep[] }) {
return (
<PlanReview
onApprove={(approved) => console.info("running", approved.length)}
revise={(current, note, signal) =>
post("/api/plan/revise", { task, steps: current, note }, signal)
}
runStep={(step, signal) => post("/api/plan/run", { step }, signal)}
steps={steps}
task={task}
/>
);
}On the server, generateObject with a step schema writes and revises the plan:
import { anthropic } from "@ai-sdk/anthropic";
import { generateObject } from "ai";
import { z } from "zod";
export async function POST(req: Request) {
const { task, steps, note } = await req.json();
const { object } = await generateObject({
model: anthropic("claude-sonnet-5-5"),
schema: z.object({
steps: z.array(
z.object({
id: z.string(),
title: z.string(),
detail: z.string().optional(),
asks: z.boolean().optional(),
})
),
}),
prompt: `Task: ${task}\nPlan: ${JSON.stringify(steps)}\nRevise it: ${note}\nKeep ids of steps you keep; new steps get new ids.`,
abortSignal: req.signal,
});
return Response.json(object.steps);
}Props
taskstringDefault "Move billing emails to the new template"stepsPlanStep[]Default demo dataThe agent's plan. Edits stay inside the component until approved.
onApprove(steps: PlanStep[]) => voidCalled with the steps that will run, in order.
runStep(step: PlanStep, signal: AbortSignal) => Promise<void>Runs one step and resolves when it's done. A throw stops the run with the error on that step. Leave it out and steps run on timers.
revise(steps: PlanStep[], note: string, signal: AbortSignal) => Promise<PlanStep[]>Sends the person's note and resolves with the revised plan. Steps with new ids are marked as added. Leave it out for the demo agent.
classNamestringExtra classes for the root element.
PlanStep
idrequiredstringtitlerequiredstringdetailstringOne line on how, such as the files or command.
asksbooleanStop and wait for a person before this step runs.
msnumberHow long it takes in the demo, in milliseconds.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Streaming TextNew, Oct 25
An answer as it streams in. Words arrive in small uneven bursts and come into focus from a soft blur instead of popping in, with a caret riding the end. Stop freezes it where it is, and Continue picks up from the next word.
Usage and propsReal data, 7 props, 4 dependencies
Usage
Pass the answer as it grows and where the stream is. New words blur in as they arrive, and Stop calls your stop.
"use client";
import { useChat } from "@ai-sdk/react";
import { useState } from "react";
import StreamingText, {
type StreamStatus,
} from "@/components/kokonutui-pro/streaming-text";
export function Answer() {
const { messages, status, stop } = useChat();
const [stopped, setStopped] = useState(false);
const reply = messages.findLast((m) => m.role === "assistant");
const text = (reply?.parts ?? [])
.map((part) => (part.type === "text" ? part.text : ""))
.join("");
let streamStatus: StreamStatus = stopped ? "stopped" : "done";
if (status === "submitted" || status === "streaming") {
streamStatus = "streaming";
}
return (
<StreamingText
onStop={() => {
setStopped(true);
stop();
}}
status={streamStatus}
text={text}
/>
);
}Props
textstringDefault demo dataThe answer. Live, pass the text so far each time it grows.
statusStreamStatusPass it to follow your own stream: new words blur in as text grows, with the caret while streaming. Leave it out and the text plays in on its own.
onStop() => voidLive: shows Stop while streaming. Wire it to useChat's stop.
streamingbooleanDefault trueDemo: stream the text in. Defaults to true.
controlsbooleanDefault trueDemo: show Stop, Continue and Replay under the text. Defaults to true.
onDone() => voidDemo: called when the text has played in.
classNamestringExtra classes for the root element.
StreamStatus
Where a real stream is, as the AI SDK's useChat reports it.
type StreamStatus = "streaming" | "done" | "stopped";
Dependencies
motion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
ReasoningNew, Oct 25
While a model thinks, its thoughts rise through a short window that fades at the top, and the seconds roll over like a counter. When the answer arrives the window folds into "Thought for 9s", which opens back into the full trace.
Usage and props6 props, 5 dependencies
Props
stepsstring[]The reasoning so far, one thought per entry.
thinkingbooleanTrue while the model is still thinking. Omit to play the demo.
secondsnumberSeconds it took, once done. Counted on screen when omitted.
defaultOpenbooleanDefault falseOpen the full reasoning once it's done.
childrenReactNodeThe answer, shown under the reasoning once thinking is done.
classNamestringExtra classes for the root element.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Response FeedbackNew, Oct 25
The row under an answer: Copy, thumbs up, thumbs down and Retry. A thumbs down turns the row itself into a one-line "What went wrong?" field, with the thumb moving into it. Enter sends and the field folds back into the row.
Usage and props6 props, 5 dependencies
Props
answerstringDefault demo dataThe answer the row sits under. Copy copies this text.
childrenReactNodeRendered in place of the answer text, such as formatted markdown.
placeholderstringDefault "What went wrong?"Placeholder for the field a thumbs down opens.
onFeedback(result: FeedbackResult | null) => voidonRetry() => voidclassNamestringExtra classes for the root element.
FeedbackResult
ratingrequiredRatingnoterequiredstringRating
type Rating = "up" | "down";
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Eval GridNew, Oct 25
A prompt change run against its test suite. Cases resolve out of order as workers pick them up, and each is read against the old prompt, so regressions and fixes stand out even when the score doesn't move. Pick a cell for both outputs and the grader's reason.
Usage and propsReal data, 8 props, 5 dependencies
Usage
Pass your cases with the baseline results, and runCase to run one against the prompt under test. Run calls it a few at a time, cells fill as results land, and a throw counts as a failed case with the error as its reason.
"use client";
import EvalGrid, {
type EvalCase,
type EvalResult,
} from "@/components/kokonutui-pro/eval-grid";
async function runCase(
testCase: EvalCase,
signal: AbortSignal
): Promise<EvalResult> {
const res = await fetch("/api/evals/run", {
method: "POST",
body: JSON.stringify({
input: testCase.input,
expected: testCase.expected,
}),
signal,
});
if (!res.ok) {
throw new Error(`Run failed: ${res.status}`);
}
// { pass, output, reason?, latencyMs }, graded on the server.
return await res.json();
}
export function Evals({ cases }: { cases: EvalCase[] }) {
return (
<EvalGrid
baselineVersion="v13"
cases={cases}
runCase={runCase}
version="v14"
workers={4}
/>
);
}A route that answers with the AI SDK and grades the output:
import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";
export async function POST(req: Request) {
const { input, expected } = await req.json();
const started = Date.now();
const { text } = await generateText({
model: anthropic("claude-sonnet-5-5"),
system: SYSTEM_PROMPT_V14,
prompt: input,
abortSignal: req.signal,
});
const pass = await grade(text, expected);
return Response.json({
pass,
output: text,
reason: pass ? undefined : "Didn't match the expected answer",
latencyMs: Date.now() - started,
});
}Props
titlestringDefault "Support agent"casesEvalCase[]Default built-inversionstringDefault "v13"The prompt under test.
baselineVersionstringDefault "v12"The prompt it's compared with.
workersnumberDefault 4Cases that run at the same time.
runCase(testCase: EvalCase, signal: AbortSignal) => Promise<EvalResult>Runs one case against the prompt under test and resolves with its result. A throw counts as a failed case, with the error as the reason. Leave it out to simulate runs from the results passed in.
onRun() => voidCalled when a run starts.
classNamestringExtra classes for the root element.
EvalCase
idrequiredstringsuiterequiredstringThe row it sits in, e.g. "Refunds".
inputrequiredstringWhat the test sends, usually the user's message.
expectedrequiredstringcurrentrequiredEvalResultbaselinerequiredEvalResultEvalResult
passrequiredbooleanoutputrequiredstringreasonstringThe grader's note, shown when the case fails.
latencyMsrequirednumberDependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Enrich TableNew, Oct 25
A list of companies with one AI column. Fill answers it row by row, says when it found nothing, and every answer shows the sentence it was read from on hover.
Usage and propsReal data, 9 props, 5 dependencies
Usage
Pass your rows and a lookup that answers the column's question for one row. Fill runs it two rows at a time (concurrency to change that), each answer keeps its source for the hover card, and a lookup that throws shows its message in the cell.
"use client";
import EnrichTable, {
type EnrichLookup,
type EnrichRow,
} from "@/components/kokonutui-pro/enrich-table";
const lookup: EnrichLookup = async (row, prompt, signal) => {
const res = await fetch("/api/enrich", {
method: "POST",
body: JSON.stringify({ domain: row.domain, prompt }),
signal,
});
if (!res.ok) {
throw new Error("Lookup failed");
}
// { answer: string | null, source?: { url, quote, highlight? } }
return await res.json();
};
export function Leads({ rows }: { rows: EnrichRow[] }) {
return (
<EnrichTable
column="Employees"
lookup={lookup}
onFilled={(answers) => saveColumn("employees", answers)}
prompt="How many people work here?"
rows={rows}
/>
);
}A route that reads the company's site with a structured answer, so the quote it came from travels with it:
import { anthropic } from "@ai-sdk/anthropic";
import { generateObject } from "ai";
import { z } from "zod";
export async function POST(req: Request) {
const { domain, prompt } = await req.json();
const pages = await fetchPages(domain); // your crawler or search API
const { object } = await generateObject({
model: anthropic("claude-sonnet-5-5"),
schema: z.object({
answer: z.string().nullable(),
source: z
.object({
url: z.string(),
quote: z.string(),
highlight: z.string().optional(),
})
.optional(),
}),
prompt: `${prompt}\nAnswer null if the pages don't say.\n\n${pages}`,
abortSignal: req.signal,
});
return Response.json(object);
}Props
titlestringDefault "Leads"columnstringDefault "Employees"The AI column's name.
promptstringDefault "How many people work here?"The question asked for every row.
rowsEnrichRow[]Default demo dataLive, rows can leave answer out; the lookup fills it.
lookupEnrichLookupFills one row. Leave it out and the rows' own answers play in.
concurrencynumberDefault built-inRows looked up at once. Defaults to 2.
onFill() => voidCalled when a fill starts.
onFilled(answers: Record<string, EnrichAnswer>) => voidCalled with every row's answer once a fill ends.
classNamestringExtra classes for the root element.
EnrichRow
idrequiredstringnamerequiredstringdomainrequiredstringanswerstring | nullDemo: the answer to play in, null when nothing was found. Live, leave it out.
sourceEnrichSourceEnrichLookup
type EnrichLookup = (row: EnrichRow, prompt: string, signal: AbortSignal) => Promise<EnrichAnswer>;
EnrichAnswer
What a lookup found for one row.
answerrequiredstring | nullnull when nothing was found.
sourceEnrichSourceEnrichSource
urlrequiredstringquoterequiredstringThe sentence the answer was read from.
highlightstringThe part of the quote that answers the question.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Agent InboxNew, Oct 25
The background tasks a team's agents are working through, sorted by what they need from you. Questions are answered in the row, and tasks slide between Needs you, Running and Done as they move. Open one for its step log.
Usage and propsReal data, 4 props, 5 dependencies
Usage
Give each task live with where it really is: its status, the step it's on and when it started (the clock counts from it). Tasks with live aren't simulated. Return the Promise from onAnswer so the choices wait while the answer is sent.
"use client";
import AgentInbox, { type AgentTask } from "@/components/kokonutui-pro/agent-inbox";
// Your background runs, e.g. from a jobs table polled or pushed over SSE.
interface Run {
id: string;
title: string;
repo: string;
steps: string[];
step: number;
status: "running" | "needs" | "done" | "failed";
startedAt: number;
endedAt?: number;
question?: { text: string; options: string[] };
result?: string;
error?: string;
}
const toTask = (run: Run): AgentTask => ({
id: run.id,
title: run.title,
place: run.repo,
steps: run.steps,
result: run.result ?? "",
ask: run.question
? { atStep: run.step, question: run.question.text, options: run.question.options }
: undefined,
live: {
status: run.status,
step: run.step,
startedAt: run.startedAt,
endedAt: run.endedAt,
error: run.error,
},
});
export function Inbox({ runs }: { runs: Run[] }) {
return (
<AgentInbox
onAnswer={async (id, answer) => {
const res = await fetch(`/api/runs/${id}/answer`, {
method: "POST",
body: JSON.stringify({ answer }),
});
if (!res.ok) {
throw new Error("The agent didn't get that, try again");
}
}}
tasks={runs.map(toTask)}
/>
);
}Props
titlestringDefault "Agents"tasksAgentTask[]Default built-inonAnswer(taskId: string, answer: string) => void | Promise<void>Called with a task's answer. Return a Promise to hold the choices until it settles; a rejection shows its message under them.
classNamestringExtra classes for the root element.
AgentTask
idrequiredstringtitlerequiredstringplacerequiredstringWhere it runs, e.g. a repo or a workspace.
stepsrequiredstring[]askAgentTaskAskresultrequiredstringWhat came out of it, shown once done.
stepSecondsnumberSeconds each step takes in the demo.
start{ step: number; elapsed?: number; done?: string }Demo: where the task is when the inbox opens.
liveAgentTaskLiveLive: where the task really is. Leave it out to simulate it.
AgentTaskAsk
atSteprequirednumberThe step the agent stops at to ask.
questionrequiredstringoptionsrequiredstring[]AgentTaskLive
statusrequired"running" | "needs" | "done" | "failed"steprequirednumberThe step it's on, from 0.
startedAtrequirednumberWhen it started, in milliseconds since the epoch.
endedAtnumberWhen it ended, for a done or failed task.
answerstringThe answer it was given, shown in the step log.
errorstringWhy it failed.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Reply CopilotNew, Oct 25
A suggested support reply that writes itself in. Sourced sentences end with their article's number, and switching tone only fades in the words that change.
Usage and propsReal data, 8 props, 5 dependencies
Usage
Stream the draft in with streamObject and pass the sentences as they grow, with drafting until it's done. rewrite writes the draft in a tone it doesn't have yet; tones already in each sentence's text switch at once.
"use client";
import { experimental_useObject as useObject } from "@ai-sdk/react";
import { useEffect } from "react";
import { z } from "zod";
import ReplyCopilot, {
type CopilotSentence,
type CopilotSource,
} from "@/components/kokonutui-pro/reply-copilot";
const draftSchema = z.object({
sentences: z.array(
z.object({ id: z.string(), text: z.string(), cite: z.string().optional() })
),
});
export function Copilot({
ticketId,
sources,
}: {
ticketId: string;
sources: CopilotSource[];
}) {
const { object, isLoading, submit } = useObject({
api: "/api/reply/draft",
schema: draftSchema,
});
useEffect(() => submit({ ticketId, tone: "friendly" }), [ticketId, submit]);
const sentences: CopilotSentence[] = (object?.sentences ?? []).flatMap((s) =>
s?.id && s.text
? [{ id: s.id, cite: s.cite, text: { friendly: s.text } }]
: []
);
return (
<ReplyCopilot
drafting={isLoading}
onUse={(text) => insertIntoComposer(text)}
rewrite={async (tone, current, signal) => {
const res = await fetch("/api/reply/rewrite", {
method: "POST",
body: JSON.stringify({ tone, sentences: current }),
signal,
});
if (!res.ok) {
throw new Error("Couldn't rewrite the reply");
}
return await res.json(); // [{ id, text }]
}}
sentences={sentences}
sources={sources}
/>
);
}Props
subjectstringDefault "Priya Shah · Cracked blender jar"Who the reply is to and what about.
sentencesCopilotSentence[]Default built-insourcesCopilotSource[]Default built-intones{ id: string; label: string }[]Default built-indraftingbooleanDefault falseLive: the draft is still streaming in, so Use waits.
rewrite(tone: string, sentences: CopilotSentence[], signal: AbortSignal) => Promise<{ id: string; text: string }[]>Live: writes the draft in a tone it doesn't have yet. Resolve with the sentences in that tone, keyed by the same ids; a rejection keeps the current tone and shows the error.
onUse(text: string) => voidclassNamestringExtra classes for the root element.
CopilotSentence
idrequiredstringtextrequiredRecord<string, string>The sentence in each tone, keyed by tone id.
citestringThe article it comes from.
CopilotSource
idrequiredstringtitlerequiredstringurlrequiredstringDependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Chat HistoryNew, Oct 25
The conversation sidebar of an AI chat app, grouped by day. A new chat waits for its first answer, then writes in the title the model gave it.
Usage and propsReal data, 7 props, 5 dependencies
Usage
Pass your chats and onNewChat. Add the new chat with title: null and it waits with a spinner; set the title once the model has named it and it types itself in. Return the new id from onNewChat to select it.
"use client";
import { useState } from "react";
import ChatHistory, { type ChatSummary } from "@/components/kokonutui-pro/chat-history";
export function Sidebar({ initial }: { initial: ChatSummary[] }) {
const [chats, setChats] = useState(initial);
// Call this after the first answer: name the chat from it.
const nameChat = async (id: string, firstMessage: string) => {
const res = await fetch("/api/chats/title", {
method: "POST",
body: JSON.stringify({ message: firstMessage }),
});
const { title } = await res.json();
setChats((list) => list.map((c) => (c.id === id ? { ...c, title } : c)));
};
return (
<ChatHistory
chats={chats}
onNewChat={() => {
const id = crypto.randomUUID();
setChats((list) => [{ id, title: null, daysAgo: 0 }, ...list]);
return id;
}}
onSelect={(id) => openChat(id)}
/>
);
}import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";
export async function POST(req: Request) {
const { message } = await req.json();
const { text } = await generateText({
model: anthropic("claude-haiku-5-5"),
prompt: `Name this chat in at most five words, no quotes:\n\n${message}`,
});
return Response.json({ title: text.trim() });
}Props
chatsChatSummary[]Default demo dataactivestringThe open chat. Leave it out to keep the selection inside.
defaultActivestringonSelect(id: string) => voidonNewChat() => unknownLive: called by New chat. Add the chat to chats yourself, and return its id to select it. Leave it out for the demo.
newTitlesstring[]Default demo dataDemo: titles handed to new chats, in turn.
classNamestringExtra classes for the root element.
ChatSummary
idrequiredstringtitlerequiredstring | nullnull while the model is still naming the chat.
daysAgorequirednumberDays since the last message: 0 is today.
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Steer ComposerNew, Oct 25
An agent thread whose composer steers the run while it works. A steer waits above the input until the next step, then moves into the thread where the agent read it, and the remaining steps change to match.
Usage and propsReal data, 13 props, 5 dependencies
Usage
Pass the thread as your agent loop reports it, with status. While it runs, a message steers instead of sending: onSteer gets the text and an id. Queue it, hand it to the model at the next step, and add a steer item with that id once it's read, so the note flies from the composer into the thread.
"use client";
import { useState } from "react";
import SteerComposer, {
type SteerItem,
type SteerStatus,
} from "@/components/kokonutui-pro/steer-composer";
export function Agent() {
const [items, setItems] = useState<SteerItem[]>([]);
const [status, setStatus] = useState<SteerStatus>("done");
const [error, setError] = useState<string>();
const send = async (text: string) => {
setItems([{ kind: "user", id: crypto.randomUUID(), text }]);
setStatus("running");
setError(undefined);
try {
// Your loop: push a step item as each tool call starts, mark it done
// when it ends, and a note item for the final answer.
await runAgent(text, (item) => setItems((list) => upsert(list, item)));
setStatus("done");
} catch (err) {
setError(err instanceof Error ? err.message : "The run failed.");
setStatus("error");
}
};
return (
<SteerComposer
error={error}
items={items}
onSend={send}
onSteer={(text, id) => steerQueue.push({ id, text })}
onStop={() => abortAgent()}
status={status}
/>
);
}With the AI SDK, read the queue between steps in prepareStep:
import { anthropic } from "@ai-sdk/anthropic";
import { streamText } from "ai";
export const steerQueue: { id: string; text: string }[] = [];
const result = streamText({
model: anthropic("claude-sonnet-5-5"),
tools,
messages,
prepareStep: ({ messages }) => {
const steer = steerQueue.shift();
if (!steer) {
return;
}
onItem({ kind: "steer", id: steer.id, text: steer.text });
return { messages: [...messages, { role: "user", content: steer.text }] };
},
});Props
itemsSteerItem[]Live: the thread so far, as your agent loop reports it. Leave it out and the demo run plays.
statusSteerStatusLive: where the run is. Steer replaces Send while it's running.
errorstringLive: why the run failed, shown at the end of the thread.
onSend(text: string) => voidCalled with a new message once the run has ended.
onSteer(text: string, id: string) => voidCalled with a steer and the id it waits under. Add a steer item with that id when the agent reads it.
onStop() => voidLive: shows Stop while running.
promptstringDefault "Add rate limiting to the /api/upload route."Demo: the first message, sent when the thread opens.
stepsstring[]Default demo dataDemo: the steps the run plays.
resultstringDefault "Done. Uploads are limited to 10 a minute per I…Demo: said when the run ends.
acknowledgementstringDefault "Got it, changing course. Redoing the remaining…Demo: said when a steer is picked up.
steeredStepsstring[]Default demo dataDemo: the steps that replace what's left after a steer.
steeredResultstringDefault "Done. Uploads are limited to 10 a minute per I…Demo: said when a steered run ends.
classNamestringExtra classes for the root element.
SteerItem
One line of the thread.
type SteerItem =
| { kind: "user"; id: string; text: string }
| { kind: "step"; id: string; text: string; state: "active"
| "done"
| "stopped" }
| { kind: "steer"; id: string; text: string }
| { kind: "note"; id: string; text: string };SteerStatus
type SteerStatus = "running" | "done" | "stopped" | "error";
Dependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Double ComposerNew, Oct 25
The prompt box of a coding agent in two layers: the card holds the prompt, model, effort and access, and a tray tucked under it holds the machine and branch. Moving the work to the cloud turns the branch remote in place.
Usage and propsReal data, 9 props, 5 dependencies
Usage
onSubmit gets the text and every choice. Return a Promise and the tray holds "Starting on … from …" until the run has started; a rejection puts the prompt back and shows why.
"use client";
import DoubleComposer from "@/components/kokonutui-pro/double-composer";
export function Composer() {
return (
<DoubleComposer
branches={["main", "release/2.4"]}
onSubmit={async (text, choices) => {
// choices: { model, effort, access, workspace, branch }
const res = await fetch("/api/runs", {
method: "POST",
body: JSON.stringify({ prompt: text, ...choices }),
});
if (!res.ok) {
throw new Error("No cloud runner is free right now");
}
}}
/>
);
}Props
placeholderstringDefault "Ask for changes, send follow-ups, or attach im…modelsComposerOption[]Default built-ineffortsComposerOption[]Default built-inaccessComposerOption[]Default built-inworkspacesComposerOption[]Default built-inWhere the run happens; an option with id "cloud" makes branches remote.
branchesstring[]Default built-indefaultsPartial<ComposerChoices>onSubmit(text: string, choices: ComposerChoices) => void | Promise<void>Return a Promise to show Starting until the run has started.
classNamestringExtra classes for the root element.
ComposerOption
idrequiredstringlabelrequiredstringiconComponentType<SVGProps<SVGSVGElement>>Any icon component: a lucide icon or a brand logo.
hintstringComposerChoices
modelrequiredstringeffortrequiredstringaccessrequiredstringworkspacerequiredstringbranchrequiredstringDependencies
lucide-react^1.27.0npm, installed by the CLImotion^12.23.12npm, installed by the CLIcn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.
Dither Voice OrbNew, Nov 12
The face of a voice agent, drawn as a lit sphere in ordered dither. Tap it to talk: a ring of dots swells with your voice while it listens, the light swings round while it thinks, and the surface ripples with each word as the reply writes out underneath. Pass getLevel to drive it from real audio.
Usage and props7 props, 3 dependencies
Props
namestringDefault "Juniper"The agent's name, above the orb.
turnsVoiceOrbTurn[]Default built-inTurns played in order, one per tap.
getLevel() => numberLive input or output level, 0 to 1. Replaces the simulated one.
accentstringDefault "#ff5a1f"Colour of the highlight and the listening ring.
sizenumberDefault 228Orb diameter in CSS pixels.
onPhaseChange(phase: VoiceOrbPhase) => voidclassNamestringExtra classes for the root element.
VoiceOrbTurn
heardrequiredstringWhat the person says, shown while the orb listens.
replyrequiredstringThe agent's answer, written out while it speaks.
VoiceOrbPhase
type VoiceOrbPhase = "idle" | "listening" | "thinking" | "speaking";
Dependencies
cn from lib/utils.tsshadcn initNo provider, font or global CSS to set up: the file works as soon as it lands.