16720a5e62
Adds the chat.agent({...}) task definition (server runtime) and the
browser-side TriggerChatTransport + AgentChat that drives it from a
React or Next.js app. The runtime sits on top of the Sessions primitive
and handles the durable conversational task lifecycle.
Server runtime:
- chat.agent({...}) — session-aware task definition
- Lifecycle hooks: onChatStart, onTurnStart, onTurnComplete, onAction,
onValidateMessages, hydrateMessages
- chat.history read primitives for HITL flows
- chat.local, chat.headStart, chat.handover, oomMachine
- Delta-only wire + S3 snapshot reconstruction at run boot
- Actions are no longer turns
Browser transport:
- TriggerChatTransport (ai-sdk Transport): delta-only wire sends,
SSE reconnection with lastEventId resume, stop/abort cleanup,
dynamic accessToken refresh
- AgentChat: direct programmatic API
- useTriggerChatTransport (React hook)
- chat-tab-coordinator: cross-tab leader election
Includes the chat-agent, chat-agent-delta-wire-snapshots,
chat-history-read-primitives, chat-head-start, chat-actions-no-turn,
chat-session-attributes, agent-skills, and mock-chat-agent-test-harness
changesets.
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { lazy } from "react";
|
|
import type { CodeHighlighterPlugin } from "streamdown";
|
|
|
|
export const StreamdownRenderer = lazy(() =>
|
|
Promise.all([import("streamdown"), import("@streamdown/code"), import("./shikiTheme")]).then(
|
|
([{ Streamdown }, { createCodePlugin }, { triggerDarkTheme }]) => {
|
|
// Type assertion needed: @streamdown/code and streamdown resolve different shiki
|
|
// versions under pnpm, causing structurally-identical CodeHighlighterPlugin types
|
|
// to be considered incompatible (different BundledLanguage string unions).
|
|
const codePlugin = createCodePlugin({
|
|
themes: [triggerDarkTheme, triggerDarkTheme],
|
|
}) as unknown as CodeHighlighterPlugin;
|
|
|
|
return {
|
|
default: ({
|
|
children,
|
|
isAnimating = false,
|
|
}: {
|
|
children: string;
|
|
isAnimating?: boolean;
|
|
}) => (
|
|
<Streamdown isAnimating={isAnimating} plugins={{ code: codePlugin }}>
|
|
{children}
|
|
</Streamdown>
|
|
),
|
|
};
|
|
}
|
|
)
|
|
);
|