@copilotkit/react-core 2.0.0-rc.31 → 2.0.0-rc.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/MarkdownRendererContext-CPfNVyde.d.mts +241 -0
- package/dist/MarkdownRendererContext-CPfNVyde.d.mts.map +1 -0
- package/dist/MarkdownRendererContext-iOl2pj9l.d.cts +241 -0
- package/dist/MarkdownRendererContext-iOl2pj9l.d.cts.map +1 -0
- package/dist/MarkdownSurfaces-BFoO6wSB.cjs +1650 -0
- package/dist/MarkdownSurfaces-BFoO6wSB.cjs.map +1 -0
- package/dist/MarkdownSurfaces-BQ1HGCzB.mjs +1442 -0
- package/dist/MarkdownSurfaces-BQ1HGCzB.mjs.map +1 -0
- package/dist/generative-ui.cjs +687 -2964
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +2478 -2683
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +2477 -2682
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +299 -2585
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/index.cjs +26 -1367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +11 -1352
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +124 -3358
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/MarkdownRendererContext-BX26QLwl.d.cts +0 -937
- package/dist/MarkdownRendererContext-BX26QLwl.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-DAOMewji.d.mts +0 -937
- package/dist/MarkdownRendererContext-DAOMewji.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-BbrHcSHN.cjs +0 -3903
- package/dist/MarkdownSurfaces-BbrHcSHN.cjs.map +0 -1
- package/dist/MarkdownSurfaces-DQbRS91-.mjs +0 -3587
- package/dist/MarkdownSurfaces-DQbRS91-.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownSurfaces-BQ1HGCzB.mjs","names":["createGenerativeUI","createSharedGenerativeUI","noopSubscribe","accessibilityAttributes"],"sources":["../src/components/chat/StreamingMarkdownDefaultRenderer.tsx","../src/components/icons/CopilotIcon.tsx","../src/lib/shallow-stable-ref.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/lib/slots.tsx","../src/providers/MarkdownRendererContext.tsx","../src/types/defineToolCallRenderer.ts","../src/generative-ui/catalog.ts","../src/generative-ui/runtime-context.ts","../src/generative-ui/hooks.ts","../src/generative-ui/boundaries.tsx","../src/generative-ui/accessibility.ts","../src/generative-ui/SurfaceView.tsx","../src/generative-ui/chat.tsx","../src/generative-ui/markdown/ProviderMarkdown.tsx","../src/generative-ui/markdown/MarkdownSurfaces.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { StreamingMarkdownRenderer } from \"@copilotkit/markdown/react\";\nimport {\n CHAT_MARKDOWN_NODE_CLASS_NAMES,\n warnUnsupportedRichSyntaxOnce,\n} from \"@copilotkit/markdown\";\nimport type {\n DefaultMarkdownRendererProps,\n MarkdownRendererProps,\n} from \"../../providers/MarkdownRendererContext\";\n\n/**\n * react-core's built-in default markdown renderer — a thin adapter over\n * `@copilotkit/markdown`'s streaming renderer. Maps the pluggable\n * renderer contract (`{ content, isStreaming, className }`) onto the streaming\n * renderer for streaming-safe incremental rendering + per-token animation.\n * Still overridable via the slot/provider pluggable interface.\n */\nexport function StreamingMarkdownDefaultRenderer({\n content,\n isStreaming,\n className,\n nodeRenderers,\n caret,\n options,\n onLinkClick,\n onCitationClick,\n}: MarkdownRendererProps & DefaultMarkdownRendererProps) {\n if (!content) return null;\n // Dev-only: nudge upgraders from the bundled Streamdown default when their\n // content needs math/syntax highlighting the built-in renderer doesn't do.\n warnUnsupportedRichSyntaxOnce(content);\n return (\n <StreamingMarkdownRenderer\n className={className}\n isComplete={!isStreaming}\n caret={caret ?? !!isStreaming}\n nodeRenderers={nodeRenderers}\n nodeClassNames={CHAT_MARKDOWN_NODE_CLASS_NAMES}\n options={options}\n onLinkClick={onLinkClick}\n onCitationClick={onCitationClick}\n >\n {content}\n </StreamingMarkdownRenderer>\n );\n}\n\nStreamingMarkdownDefaultRenderer.displayName =\n \"StreamingMarkdownDefaultRenderer\";\n","import React, { createElement, forwardRef } from \"react\";\nimport { ɵcopilotIcons, ɵcopilotIconSvgAttributes } from \"@copilotkit/core\";\nimport type { CopilotIconName } from \"@copilotkit/core\";\nimport { cn } from \"../../lib/utils\";\n\n/** One SVG child element of an icon, such as a `<path>` or a `<circle>`. */\nexport interface IconSvgNode {\n readonly tag: string;\n readonly attributes: Readonly<Record<string, string | number>>;\n}\n\n/** Turns SVG attribute names such as `stroke-width` into React's `strokeWidth`. */\nfunction toReactAttributes(attributes: Readonly<Record<string, string>>) {\n return Object.fromEntries(\n Object.entries(attributes).map(([key, value]) => [\n key.replace(/-([a-z])/g, (_match, letter: string) =>\n letter.toUpperCase(),\n ),\n value,\n ]),\n );\n}\n\nconst svgDefaults = toReactAttributes(ɵcopilotIconSvgAttributes);\n\n/** True when the props give the icon an accessible name or role. */\nfunction hasAccessibleProp(props: object) {\n return Object.keys(props).some(\n (key) => key.startsWith(\"aria-\") || key === \"role\" || key === \"title\",\n );\n}\n\ntype SvgProps = React.ComponentPropsWithoutRef<\"svg\">;\n\n/** Props of `IconSvg` and `CopilotIcon` that change how the icon is drawn. */\ninterface IconDrawProps extends SvgProps {\n /** Width and height of the icon. Defaults to `24`. */\n size?: number | string;\n}\n\ninterface IconSvgProps extends IconDrawProps {\n /** The Lucide icon name in kebab case, for the `lucide-<name>` class. */\n lucideName: string;\n nodes: readonly IconSvgNode[];\n}\n\n/**\n * Internal. Draws a Lucide icon from its node data, the way Lucide's React package\n * does: Lucide's default SVG attributes, the `lucide lucide-<name>` classes,\n * and `aria-hidden=\"true\"` when no `aria-*`, `role` or `title` prop names it.\n */\nexport const IconSvg = forwardRef<SVGSVGElement, IconSvgProps>(function IconSvg(\n {\n lucideName,\n nodes,\n size = 24,\n color = \"currentColor\",\n strokeWidth = 2,\n className,\n children,\n ...props\n },\n ref,\n) {\n const isDecorative = !children && !hasAccessibleProp(props);\n return (\n <svg\n ref={ref}\n {...svgDefaults}\n width={size}\n height={size}\n stroke={color}\n strokeWidth={strokeWidth}\n className={cn(\"lucide\", `lucide-${lucideName}`, className)}\n aria-hidden={isDecorative || undefined}\n {...props}\n >\n {nodes.map((node, index) =>\n createElement(node.tag, { key: index, ...node.attributes }),\n )}\n {children}\n </svg>\n );\n});\n\n/** Props of `CopilotIcon`. Any other SVG prop goes on the `<svg>`. */\nexport interface CopilotIconProps extends IconDrawProps {\n /** The chat icon to draw, for example `\"ArrowUp\"`. */\n name: CopilotIconName;\n}\n\n/**\n * Draws one of the chat icons as an inline `<svg>`.\n *\n * The `<svg>` has the classes `lucide lucide-<icon name>`, so CSS that selects\n * them (for example `svg.lucide-arrow-up`) keeps working. The icon is hidden\n * from screen readers unless you give it an `aria-label`, `role` or `title`.\n *\n * @param props.name - The chat icon, for example `\"ArrowUp\"` or `\"X\"`.\n * @param props.size - Width and height. Defaults to `24`.\n * @param props.strokeWidth - Line width. Defaults to `2`.\n * @param props.color - Line color. Defaults to `currentColor`.\n *\n * @example\n * ```tsx\n * <CopilotIcon name=\"ArrowUp\" className=\"cpk-chat-input-send-icon\" />\n * <CopilotIcon name=\"X\" aria-label=\"Close\" />\n * ```\n */\nexport const CopilotIcon = forwardRef<SVGSVGElement, CopilotIconProps>(\n function CopilotIcon({ name, ...props }, ref) {\n const icon = ɵcopilotIcons[name];\n return (\n <IconSvg ref={ref} lucideName={icon.name} nodes={icon.nodes} {...props} />\n );\n },\n);\n","import { useRef } from \"react\";\nimport { ɵshallowEqualRecord } from \"@copilotkit/core\";\n\n// Reference-stability helpers, kept in their own leaf module (not in ./slots)\n// so that DOM-free consumers — e.g. CopilotChatConfigurationProvider, which is\n// re-exported from the lean `@copilotkit/react-core/headless` entry — reach\n// them without pulling in the slot rendering code (issue #4893).\n\n/**\n * Shallow equality comparison for objects: same own keys, each holding the\n * same value (`Object.is`). Core's `ɵshallowEqualRecord` holds the rule.\n */\nexport function shallowEqual<T extends Record<string, unknown>>(\n obj1: T,\n obj2: T,\n) {\n return ɵshallowEqualRecord(obj1, obj2);\n}\n\n/**\n * Returns true only for plain JS objects (`{}`), excluding arrays, Dates,\n * class instances, and other exotic objects that happen to have typeof \"object\".\n */\nfunction isPlainObject(obj: unknown): obj is Record<string, unknown> {\n return (\n obj !== null &&\n typeof obj === \"object\" &&\n Object.prototype.toString.call(obj) === \"[object Object]\"\n );\n}\n\n/**\n * Returns the same reference as long as the value is shallowly equal to the\n * previous render's value.\n *\n * - Identical references bail out immediately (O(1)).\n * - Plain objects ({}) are shallow-compared key-by-key.\n * - Arrays, Dates, class instances, functions, and primitives are compared by\n * reference only — shallowEqual is never called on non-plain objects, which\n * avoids incorrect equality for e.g. [1,2] vs [1,2] (different arrays).\n *\n * Typical use: stabilize inline slot props so MemoizedSlotWrapper's shallow\n * equality check isn't defeated by a new object reference on every render.\n */\nexport function useShallowStableRef<T>(value: T): T {\n const ref = useRef(value);\n\n // 1. Identical reference — bail early, no comparison needed.\n if (ref.current === value) return ref.current;\n\n // 2. Both are plain objects — shallow-compare to detect structural equality.\n if (isPlainObject(ref.current) && isPlainObject(value)) {\n if (shallowEqual(ref.current, value)) return ref.current;\n }\n\n // 3. Different values (or non-comparable types) — update the ref.\n ref.current = value;\n return ref.current;\n}\n","import type { ReactNode } from \"react\";\nimport React, {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport {\n CopilotChatDefaultLabels,\n ɵChatConfigurationStore,\n} from \"@copilotkit/core\";\nimport type { CopilotChatLabels } from \"@copilotkit/core\";\nimport { CopilotKitContext, useDefaultAgentId } from \"../context\";\n// Import from the leaf module (not ../lib/slots) so this provider stays lean in\n// the headless entry (issue #4893).\nimport { useShallowStableRef } from \"../lib/shallow-stable-ref\";\n\nexport interface CopilotChatConfigurationValue {\n labels: CopilotChatLabels;\n agentId: string;\n threadId: string;\n isModalOpen: boolean;\n setModalOpen: (open: boolean) => void;\n /**\n * Whether the thread-list drawer is open. A sibling boolean to `isModalOpen`\n * (deliberately NOT folded into a tri-state enum): on desktop the chat modal\n * and the drawer coexist, so two independent booleans are required.\n */\n drawerOpen: boolean;\n /**\n * Toggles the drawer open state. On mobile viewports (`<768px`) opening the\n * drawer closes the chat modal (mutual exclusion); on desktop there is no\n * constraint.\n */\n setDrawerOpen: (open: boolean) => void;\n /**\n * True once a `<CopilotThreadsDrawer>` wrapper has registered itself with this chat\n * configuration. The header thread-list launcher renders ONLY when this is\n * set, so chats with no drawer stay byte-for-byte unchanged.\n */\n drawerRegistered: boolean;\n /**\n * Called by the drawer wrapper on mount to announce its presence (and flip\n * `drawerRegistered`). Returns a cleanup function that de-registers the\n * drawer on unmount.\n *\n * @returns A cleanup callback that reverses the registration.\n */\n registerDrawer: () => () => void;\n /**\n * Internal: registers the modal-close setter of the provider that actually\n * owns the rendered modal (a descendant that supplied `isModalDefaultOpen`),\n * so the drawer's mobile mutual-exclusion — owned by the top-most provider —\n * closes the modal that is genuinely on screen rather than the top-most\n * provider's own (possibly unrendered) modal state.\n *\n * @param closeModal - A setter the drawer may call to close the rendered modal.\n * @returns A cleanup callback that de-registers the closer.\n */\n ɵregisterModalCloser: (closeModal: (open: boolean) => void) => () => void;\n // True when the current threadId was chosen by the caller rather than\n // silently minted inside the provider chain. Consumers that only make\n // sense against a real backend thread (e.g. /connect, suppressing the\n // welcome screen on switch) gate on this instead of `!!threadId`.\n hasExplicitThreadId: boolean;\n /**\n * Imperatively sets the active thread for this chat configuration.\n *\n * Use this to drive the rendered thread without a host callback — e.g. a\n * `<CopilotThreadsDrawer>` selecting a thread row sets it explicitly so the chat\n * connects to that backend thread.\n *\n * Guarded like the top-level `<CopilotKit>` provider's `setThreadId`: when\n * the consumer controls the threadId via the `threadId` prop on this\n * provider, this is a no-op (a warning is logged) so a prop-controlled\n * threadId is never silently overridden.\n *\n * @param threadId - The thread id to make active.\n * @param options.explicit - Whether the thread is a caller choice. Defaults\n * to `true` (a picked thread). Pass `false` to set a non-explicit thread\n * so the welcome screen shows (see {@link startNewThread}).\n */\n setActiveThreadId: (\n threadId: string,\n options?: { explicit?: boolean },\n ) => void;\n /**\n * Resets the active thread to a fresh, non-explicit client-side thread: a\n * newly minted UUID with `hasExplicitThreadId=false`, so the welcome screen\n * shows. Pairs with the core `startNewThread()` to clear the conversation\n * with no host wiring.\n *\n * Guarded identically to {@link setActiveThreadId}: a no-op when the\n * threadId is prop-controlled.\n */\n startNewThread: () => void;\n /**\n * Internal: the core store behind this value, so a nested provider can link\n * its own store to it.\n */\n ɵstore?: ɵChatConfigurationStore;\n}\n\n// Create the configuration context\nconst CopilotChatConfiguration =\n createContext<CopilotChatConfigurationValue | null>(null);\n\n// Provider props interface\nexport interface CopilotChatConfigurationProviderProps {\n children: ReactNode;\n labels?: Partial<CopilotChatLabels>;\n agentId?: string;\n threadId?: string;\n // Lets internal wrappers (e.g. the v1 CopilotKit bridge, which pipes a\n // ThreadsProvider-minted UUID through as `threadId`) declare that the\n // threadId they are supplying is NOT a caller choice. When omitted, the\n // provider infers explicitness from whether the `threadId` prop itself\n // was supplied.\n hasExplicitThreadId?: boolean;\n isModalDefaultOpen?: boolean;\n}\n\n// Provider component\nexport const CopilotChatConfigurationProvider: React.FC<\n CopilotChatConfigurationProviderProps\n> = ({\n children,\n labels,\n agentId,\n threadId,\n hasExplicitThreadId,\n isModalDefaultOpen,\n}) => {\n const parentConfig = useContext(CopilotChatConfiguration);\n\n // Stabilize labels references so that inline objects (new reference on every\n // parent render) don't invalidate mergedLabels and churn the context value.\n // parentConfig?.labels is already stabilized by the parent provider's own\n // useShallowStableRef, so we only need to stabilize the local labels prop.\n const stableLabels = useShallowStableRef(labels);\n const mergedLabels: CopilotChatLabels = useMemo(\n () => ({\n ...CopilotChatDefaultLabels,\n ...parentConfig?.labels,\n ...stableLabels,\n }),\n [stableLabels, parentConfig?.labels],\n );\n\n // Core owns thread, agent, modal and drawer resolution across the provider\n // chain. This component feeds it props during render (so the value is\n // current on the first pass), reports them after commit (so subscribers such\n // as nested stores and the open-thread registration hear about it), and\n // projects the snapshot into context.\n const providerAgentId = useDefaultAgentId();\n const options = {\n agentId,\n threadId,\n hasExplicitThreadId,\n isModalDefaultOpen,\n providerAgentId,\n };\n const parentStore = parentConfig?.ɵstore ?? null;\n const [store] = useState(\n () => new ɵChatConfigurationStore(options, parentStore),\n );\n store.ɵsetOptions(options);\n const snapshot = useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getSnapshot,\n );\n useEffect(() => {\n store.update({\n agentId,\n threadId,\n hasExplicitThreadId,\n isModalDefaultOpen,\n providerAgentId,\n });\n }, [\n store,\n agentId,\n threadId,\n hasExplicitThreadId,\n isModalDefaultOpen,\n providerAgentId,\n ]);\n\n // Tell Core which Thread this view shows, so captured interactions can link\n // to it. Read the context directly: this provider also works without a\n // CopilotKitProvider, and then there is nothing to register with.\n const copilotkit = useContext(CopilotKitContext)?.copilotkit;\n useEffect(() => {\n if (copilotkit === undefined) return;\n return store.bindOpenThread(copilotkit);\n }, [copilotkit, store]);\n\n // A provider without its own modal shows the modal state in context above\n // it, which may be a ControlledModalOpenScope's host-controlled value.\n const ownsModal = isModalDefaultOpen !== undefined;\n const isModalOpen =\n ownsModal || !parentConfig\n ? snapshot.isModalOpen\n : parentConfig.isModalOpen;\n const setModalOpen =\n ownsModal || !parentConfig ? store.setModalOpen : parentConfig.setModalOpen;\n\n // Keyed on the snapshot's fields, not its identity: a drawer that\n // unregisters and re-registers in one commit yields an equal snapshot, and\n // a new context value there would re-run the drawer's effect forever.\n const {\n agentId: resolvedAgentId,\n threadId: resolvedThreadId,\n hasExplicitThreadId: resolvedHasExplicitThreadId,\n drawerOpen,\n drawerRegistered,\n } = snapshot;\n const configurationValue: CopilotChatConfigurationValue = useMemo(\n () => ({\n labels: mergedLabels,\n agentId: resolvedAgentId,\n threadId: resolvedThreadId,\n hasExplicitThreadId: resolvedHasExplicitThreadId,\n isModalOpen,\n setModalOpen,\n drawerOpen,\n setDrawerOpen: store.setDrawerOpen,\n drawerRegistered,\n registerDrawer: store.registerDrawer,\n ɵregisterModalCloser: store.registerModalCloser,\n setActiveThreadId: store.setActiveThreadId,\n startNewThread: store.startNewThread,\n ɵstore: store,\n }),\n [\n mergedLabels,\n resolvedAgentId,\n resolvedThreadId,\n resolvedHasExplicitThreadId,\n isModalOpen,\n setModalOpen,\n drawerOpen,\n drawerRegistered,\n store,\n ],\n );\n\n return (\n <CopilotChatConfiguration.Provider value={configurationValue}>\n {children}\n </CopilotChatConfiguration.Provider>\n );\n};\n\n// Hook to use the full configuration\nexport const useCopilotChatConfiguration =\n (): CopilotChatConfigurationValue | null => {\n const configuration = useContext(CopilotChatConfiguration);\n return configuration;\n };\n\n/**\n * Props for {@link ControlledModalOpenScope}.\n */\nexport interface ControlledModalOpenScopeProps {\n children: ReactNode;\n /**\n * The host-owned open state. When this is a boolean, everything inside the\n * scope reads it as `isModalOpen`, so the host prop is the single source of\n * truth for what is on screen. Leave it `undefined` to keep the underlying\n * state in charge and only report requests through `onOpenChange`.\n */\n open?: boolean;\n /**\n * Called with the requested state whenever something inside the scope asks\n * to open or close the modal (the toggle button, click-outside, a consumer\n * calling `setModalOpen`). Fires whether or not `open` is supplied.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Reports modal open/close requests to the host, and — when `open` is\n * supplied — makes the modal state of an already-established chat\n * configuration **controlled** for the subtree it wraps.\n *\n * This is deliberately a scope component rather than another mode inside\n * {@link CopilotChatConfigurationProvider}. The provider resolves modal state\n * across a nested chain (own state, parent sync, drawer mutual-exclusion, the\n * modal-closer registry); a controlled branch inside that resolution would add\n * a fourth interacting mode. Overriding the context for the subtree instead\n * leaves every one of those paths untouched:\n *\n * - `isModalOpen` is replaced with the host's `open`, so the rendered surface\n * follows the prop from the very first frame (no open-then-close flash).\n * - `setModalOpen` still calls the underlying setter, so the existing\n * parent-sync and drawer mutual-exclusion side effects continue to run, and\n * *then* reports the request through `onOpenChange`.\n * - The wrapped setter is registered as the modal closer, so the drawer's\n * mobile mutual-exclusion reaches the host instead of silently flipping\n * state that nothing displays.\n *\n * A host that supplies `open` and ignores `onOpenChange` gets a modal pinned\n * to `open`, which is the standard controlled-component contract. A host that\n * supplies only `onOpenChange` is notified while the modal keeps managing\n * itself.\n *\n * Renders `children` unchanged when no chat configuration is in scope.\n */\nexport const ControlledModalOpenScope: React.FC<\n ControlledModalOpenScopeProps\n> = ({ children, open, onOpenChange }) => {\n const parentConfig = useContext(CopilotChatConfiguration);\n const parentSetModalOpen = parentConfig?.setModalOpen;\n const registerModalCloser = parentConfig?.ɵregisterModalCloser;\n\n const setModalOpen = useCallback(\n (next: boolean) => {\n parentSetModalOpen?.(next);\n onOpenChange?.(next);\n },\n [parentSetModalOpen, onOpenChange],\n );\n\n useEffect(() => {\n if (!registerModalCloser) return;\n return registerModalCloser(setModalOpen);\n }, [registerModalCloser, setModalOpen]);\n\n const configurationValue = useMemo(\n () =>\n parentConfig\n ? {\n ...parentConfig,\n isModalOpen: open ?? parentConfig.isModalOpen,\n setModalOpen,\n }\n : null,\n [parentConfig, open, setModalOpen],\n );\n\n if (!configurationValue) {\n return <>{children}</>;\n }\n\n return (\n <CopilotChatConfiguration.Provider value={configurationValue}>\n {children}\n </CopilotChatConfiguration.Provider>\n );\n};\n\nControlledModalOpenScope.displayName = \"ControlledModalOpenScope\";\n","import React from \"react\";\nimport { cn } from \"./utils\";\nimport { shallowEqual, useShallowStableRef } from \"./shallow-stable-ref\";\n\n// Reference-stability helpers moved to ./shallow-stable-ref (a leaf module) so\n// the lean @copilotkit/react-core/headless entry can reach them without\n// pulling in this module (issue #4893). Re-exported here to preserve this\n// module's public surface for existing importers (e.g. CopilotChat).\nexport { shallowEqual, useShallowStableRef };\n\n/** Existing union (unchanged) */\nexport type SlotValue<C extends React.ComponentType<any>> =\n | C\n | string\n | Partial<React.ComponentProps<C>>;\n\n/** Utility: concrete React elements for every slot */\ntype SlotElements<S> = { [K in keyof S]: React.ReactElement };\n\nexport type WithSlots<\n S extends Record<string, React.ComponentType<any>>,\n Rest = {},\n> = {\n /** Per‑slot overrides */\n [K in keyof S]?: SlotValue<S[K]>;\n} & {\n children?: (props: SlotElements<S> & Rest) => React.ReactNode;\n} & Omit<Rest, \"children\">;\n\n/**\n * Check if a value is a React component type (function, class, forwardRef, memo, etc.)\n */\nexport function isReactComponentType(\n value: unknown,\n): value is React.ComponentType<any> {\n if (typeof value === \"function\") {\n return true;\n }\n // forwardRef, memo, lazy have $$typeof but are not valid elements\n if (\n value &&\n typeof value === \"object\" &&\n \"$$typeof\" in value &&\n !React.isValidElement(value)\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Internal function to render a slot value as a React element (non-memoized).\n */\nfunction renderSlotElement(\n slot: SlotValue<React.ComponentType<any>> | undefined,\n DefaultComponent: React.ComponentType<any>,\n props: Record<string, unknown>,\n): React.ReactElement {\n if (typeof slot === \"string\") {\n // When slot is a string, treat it as a className and merge with existing className\n const existingClassName = props.className as string | undefined;\n return React.createElement(DefaultComponent, {\n ...props,\n className: cn(existingClassName, slot),\n });\n }\n\n // Check if slot is a React component type (function, forwardRef, memo, etc.)\n if (isReactComponentType(slot)) {\n return React.createElement(slot, props);\n }\n\n // If slot is a plain object (not a React element), treat it as props override\n if (slot && typeof slot === \"object\" && !React.isValidElement(slot)) {\n return React.createElement(DefaultComponent, {\n ...props,\n ...slot,\n });\n }\n\n return React.createElement(DefaultComponent, props);\n}\n\n/**\n * Internal memoized wrapper component for renderSlot.\n * Uses forwardRef to support ref forwarding.\n */\nconst MemoizedSlotWrapper = React.memo(\n React.forwardRef<unknown, any>(function MemoizedSlotWrapper(props, ref) {\n const { $slot, $component, ...rest } = props;\n const propsWithRef: Record<string, unknown> =\n ref !== null ? { ...rest, ref } : rest;\n return renderSlotElement($slot, $component, propsWithRef);\n }),\n (prev: any, next: any) => {\n // Compare slot and component references\n if (prev.$slot !== next.$slot) return false;\n if (prev.$component !== next.$component) return false;\n\n // Shallow compare remaining props (ref is handled separately by React)\n const { $slot: _ps, $component: _pc, ...prevRest } = prev;\n const { $slot: _ns, $component: _nc, ...nextRest } = next;\n return shallowEqual(\n prevRest as Record<string, unknown>,\n nextRest as Record<string, unknown>,\n );\n },\n);\n\n/**\n * Renders a slot value as a memoized React element.\n * Automatically prevents unnecessary re-renders using shallow prop comparison.\n * Supports ref forwarding.\n *\n * @example\n * renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })\n */\nexport function renderSlot<\n C extends React.ComponentType<any>,\n P = React.ComponentProps<C>,\n>(\n slot: SlotValue<C> | undefined,\n DefaultComponent: C,\n props: P,\n): React.ReactElement {\n return React.createElement(MemoizedSlotWrapper, {\n ...props,\n $slot: slot,\n $component: DefaultComponent,\n } as any);\n}\n","\"use client\";\n\nimport React, { createContext, useContext } from \"react\";\nimport type { StreamingMarkdownRendererProps } from \"@copilotkit/markdown/react\";\n\n/** Props every markdown renderer (built-in or plugged-in) receives. */\nexport interface MarkdownRendererProps {\n /** Raw, possibly-partial (streaming) markdown string. */\n content: string;\n /** Hint that the message is still streaming, for cursor/affordance use. */\n isStreaming?: boolean;\n className?: string;\n}\n\n/**\n * Config for the built-in default renderer. Pass this (instead of a component)\n * as `markdownRenderer` to configure the built-in renderer without writing a\n * wrapper — e.g. `markdownRenderer={{ nodeRenderers: { codeBlock: Shiki } }}`.\n */\nexport type DefaultMarkdownRendererProps = Pick<\n StreamingMarkdownRendererProps,\n | \"nodeRenderers\"\n | \"caret\"\n | \"options\"\n | \"className\"\n | \"onLinkClick\"\n | \"onCitationClick\"\n>;\n\n/** A markdown renderer: a component, OR config for the built-in default. */\nexport type MarkdownRenderer =\n | React.ComponentType<MarkdownRendererProps>\n | DefaultMarkdownRendererProps;\n\nconst MarkdownRendererContext = createContext<MarkdownRenderer | undefined>(\n undefined,\n);\n\nexport const MarkdownRendererProvider: React.FC<{\n renderer?: MarkdownRenderer;\n children: React.ReactNode;\n}> = ({ renderer, children }) => (\n <MarkdownRendererContext.Provider value={renderer}>\n {children}\n </MarkdownRendererContext.Provider>\n);\n\n/**\n * The markdown renderer set at the provider level, or `undefined` when none was\n * supplied. Message components fall back to the built-in\n * `StreamingMarkdownDefaultRenderer` (via `CopilotChatAssistantMessage.MarkdownRenderer`)\n * when this is `undefined`.\n */\nexport function useMarkdownRenderer(): MarkdownRenderer | undefined {\n return useContext(MarkdownRendererContext);\n}\n","import type React from \"react\";\nimport { ɵanySchema } from \"@copilotkit/shared\";\nimport type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport type { ToolCallRenderProps } from \"@copilotkit/core\";\nimport type { ReactToolCallRenderer } from \"./react-tool-call-renderer\";\n\n/**\n * Helper to define a type-safe tool call renderer entry.\n * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.\n * - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).\n * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>[\"render\"]'s param.\n * - For wildcard tools (name: \"*\"), args is optional and defaults to a schema that accepts any value.\n */\n// Overload for wildcard tools without args\nexport function defineToolCallRenderer(def: {\n name: \"*\";\n render: (props: ToolCallRenderProps<any>) => React.ReactElement | null;\n agentId?: string;\n group?: boolean;\n}): ReactToolCallRenderer<any>;\n\n// Overload for regular tools with args\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args: S;\n render: (\n props: ToolCallRenderProps<InferSchemaOutput<S>>,\n ) => React.ReactElement | null;\n agentId?: string;\n group?: boolean;\n}): ReactToolCallRenderer<InferSchemaOutput<S>>;\n\n// Implementation\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args?: S;\n render: (props: any) => React.ReactElement | null;\n agentId?: string;\n group?: boolean;\n}): ReactToolCallRenderer<any> {\n // For wildcard tools, default to a schema that accepts any value\n const argsSchema = def.name === \"*\" && !def.args ? ɵanySchema : def.args;\n\n return {\n name: def.name,\n args: argsSchema,\n render: def.render,\n ...(def.agentId ? { agentId: def.agentId } : {}),\n ...(def.group ? { group: true } : {}),\n };\n}\n","import type { ComponentType, ReactNode } from \"react\";\nimport { createGenerativeUI as createSharedGenerativeUI } from \"@copilotkit/shared/generative-ui\";\nimport type {\n AnyGenerativeUI,\n CreateGenerativeUIConfig as SharedCreateGenerativeUIConfig,\n GenerativeUI as SharedGenerativeUI,\n GenerativeUIBasesDefinitions,\n GenerativeUIComponentDefinition as SharedGenerativeUIComponentDefinition,\n GenerativeUIComponentProps as SharedGenerativeUIComponentProps,\n GenerativeUIDefinitions,\n GenerativeUIFunctionDefinition,\n GenerativeUIResultDefinitions,\n GenerativeUISchema,\n ResolvedGenerativeUIComponent as SharedResolvedGenerativeUIComponent,\n} from \"@copilotkit/shared/generative-ui\";\n\n// The catalog is framework-free and lives in `@copilotkit/shared/generative-ui`.\n// These types pin its component type to React components and its rendered\n// child type to `ReactNode`.\n\nexport {\n catalogIdsOf,\n componentCatalogIds,\n setterNameOf,\n} from \"@copilotkit/shared/generative-ui\";\nexport type {\n GenerativeUIComponentName,\n GenerativeUIDefinitionsOf,\n GenerativeUIEventDefinition,\n GenerativeUIEventInput,\n GenerativeUIFunctionArgs,\n GenerativeUIFunctionDefinition,\n GenerativeUIFunctionInput,\n GenerativeUIFunctionName,\n GenerativeUIFunctionsOf,\n GenerativeUISelector,\n GenerativeUISlotKind,\n GenerativeUIStateOf,\n PropsSchema,\n UnionToIntersection,\n} from \"@copilotkit/shared/generative-ui\";\n\n/** One component of a generative UI, as the renderer reads it. */\nexport type GenerativeUIComponentDefinition =\n SharedGenerativeUIComponentDefinition<ComponentType<any>>;\n\n/** A component after `createGenerativeUI` resolved its bindings. */\nexport type ResolvedGenerativeUIComponent = SharedResolvedGenerativeUIComponent<\n ComponentType<any>\n>;\n\n/**\n * Experimental. The result of `createGenerativeUI`: the components the model\n * can render, the app state they read, and the functions they call. Give it\n * to the provider (`generativeUI={{ ui }}`) and to the typed hooks.\n */\nexport type GenerativeUI<\n Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions,\n> = SharedGenerativeUI<Definitions, ComponentType<any>>;\n\n/**\n * Props that the renderer passes to a component:\n * `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, \"CheckoutForm\">)`.\n * Data props are the parsed `props` schema, bound props included. Event and\n * slot props are present only when they are bound or filled. Each writable\n * prop gets a setter (`value` gets `setValue`), which is always present.\n */\nexport type GenerativeUIComponentProps<\n UI extends AnyGenerativeUI,\n Name extends keyof NonNullable<UI[\"definitions\"]>[\"components\"] & string,\n> = SharedGenerativeUIComponentProps<UI, Name, ReactNode>;\n\n/** One new React component for each component of the bases that it names. */\ntype OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = {\n [Name in keyof GenerativeUIBasesDefinitions<Bases>[\"components\"] & string]?: {\n component: ComponentType<\n GenerativeUIBasesDefinitions<Bases> extends infer Definitions extends\n GenerativeUIDefinitions\n ? GenerativeUIComponentProps<GenerativeUI<Definitions>, Name>\n : never\n >;\n };\n};\n\n/** The config of `createGenerativeUI`. */\nexport type CreateGenerativeUIConfig<\n Bases extends readonly AnyGenerativeUI[],\n State extends Record<string, GenerativeUISchema>,\n Functions extends Record<string, GenerativeUIFunctionDefinition>,\n Props extends Record<string, unknown>,\n Events extends Record<string, unknown>,\n Slots extends Record<string, unknown>,\n Writable extends Record<string, unknown>,\n> = SharedCreateGenerativeUIConfig<\n Bases,\n State,\n Functions,\n Props,\n Events,\n Slots,\n Writable,\n OverridesConfig<Bases>\n>;\n\n/**\n * Experimental. Declares the components the model can render, the app state\n * they read, and the functions they call.\n *\n * - A prop with the name of a top-level state key is bound to that state.\n * - `bind: { prop: (state, props) => value }` binds a prop to a selector.\n * - An event binds to the function with its name, else to the name without\n * `on` (`onAddToCart` calls `addToCart`).\n * - `writable: [\"value\"]` gives the component a `setValue` prop. See\n * `GenerativeUIComponentDefinition.writable`.\n *\n * The model does not see bound props or matched events.\n *\n * @param config - `id`, then optional `extends`, `state`, `functions` and\n * `overrides`, then `components`. Put `state` before `components`, so the selectors\n * get typed state.\n * @throws Error when a name comes from two places, an override names no\n * component of the bases, `props` is not an object\n * schema with a JSON Schema, a key is reserved or used\n * twice on a component, an event matches two functions, an unmatched event\n * has no `parameters`, a `bind` key is not a prop, a `writable` key is not\n * a prop or is a bound prop, or a setter name is already a key of the\n * component. Also throws when `parameterOrder` contains duplicate or unknown\n * keys, or an ordered component declares integer-index keys whose JSON object\n * enumeration order cannot be controlled.\n *\n * @example\n * ```ts\n * const ui = createGenerativeUI({\n * id: \"acme/store@1\",\n * state: { cart: cartSchema },\n * functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },\n * components: {\n * CartSummary: {\n * component: CartSummary,\n * props: z.object({ count: z.number() }),\n * bind: { count: (state) => state.cart.count },\n * },\n * },\n * });\n * ```\n */\nexport function createGenerativeUI<\n Bases extends readonly AnyGenerativeUI[] = [],\n State extends Record<string, GenerativeUISchema> = {},\n Functions extends Record<string, GenerativeUIFunctionDefinition> = {},\n Props extends Record<string, unknown> = {},\n Events extends Record<string, unknown> = {},\n Slots extends Record<string, unknown> = {},\n Writable extends Record<string, unknown> = {},\n>(\n config: CreateGenerativeUIConfig<\n Bases,\n State,\n Functions,\n Props,\n Events,\n Slots,\n Writable\n >,\n) {\n // The React config only narrows the shared one (React component types),\n // so the shared runtime builds the same UI.\n const build = createSharedGenerativeUI as (config: unknown) => unknown;\n return build(config) as GenerativeUI<\n GenerativeUIResultDefinitions<\n Bases,\n State,\n Functions,\n Props,\n Events,\n Slots,\n Writable\n >\n >;\n}\n","import { createContext, useContext } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { GenerativeUIUserEvent } from \"@copilotkit/shared\";\nimport type { GenerativeUIAccessibility } from \"./accessibility\";\nimport type { GenerativeUI } from \"./catalog\";\nimport type { GenerativeUIDispatcher } from \"@copilotkit/core/generative-ui\";\nimport type {\n GenerativeUIErrorInfo,\n GenerativeUIInvokeResult,\n} from \"@copilotkit/shared/generative-ui\";\nimport type { GenerativeUISurfaceManager } from \"@copilotkit/core/generative-ui\";\nimport type { GenerativeUITheme } from \"@copilotkit/shared/generative-ui\";\n\nexport type { GenerativeUITheme };\n\nexport interface GenerativeUIErrorBoundaryConfig {\n /** Replaces the default per-component fallback. */\n fallback?: (props: {\n error: Error;\n retry: () => void;\n surfaceId: string;\n componentId: string;\n }) => ReactNode;\n /** Called for render, props, operation, function and event failures. */\n onError?: (info: GenerativeUIErrorInfo) => void;\n}\n\ninterface GenerativeUIBaseConfig {\n /**\n * The result of `createGenerativeUI`: the components the model can render,\n * the app state they read and the functions they call.\n */\n ui: GenerativeUI;\n /**\n * The agents that get the generative UI. When omitted, every agent gets\n * it. Other agents get no envelope.\n */\n agentIds?: string[];\n /**\n * Values for the `--a2ui-*` CSS variables and the map style. Top-level\n * values apply in both modes. `dark` changes them in dark mode, which is\n * on under a `.dark` class, like the CopilotKit chat.\n */\n theme?: GenerativeUITheme;\n /** Fallback UI and error reporting for generated UI. */\n errorBoundary?: GenerativeUIErrorBoundaryConfig;\n}\n\n/**\n * The tool transport: the model calls the `render_ui` tool, and the runtime\n * validates each operation before it streams it to the client.\n */\nexport interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {\n /** Leave it out, or set \"tool\". */\n transport?: \"tool\";\n // Markdown-only options. `never` makes them a type error here, also when\n // `transport` is left out.\n sendContext?: never;\n includeCatalog?: never;\n}\n\n/**\n * The markdown transport: the model writes the operations in ```a2ui fences\n * in its reply. The client reads and validates them.\n */\nexport interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {\n transport: \"markdown\";\n /**\n * Send the component schema and the fence guideline as context entries.\n * Set `false` when the backend builds its own prompt from the envelope.\n * Default `true`.\n */\n sendContext?: boolean;\n /**\n * Send the component schemas in the envelope (`catalog.components`).\n * Default `true`.\n */\n includeCatalog?: boolean;\n}\n\n/**\n * Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set\n * `transport: \"markdown\"` to get the markdown options.\n *\n * @example\n * ```tsx\n * <CopilotKitProvider generativeUI={{ ui }} />\n * <CopilotKitProvider generativeUI={{ ui, transport: \"markdown\", sendContext: false }} />\n * ```\n */\nexport type GenerativeUIConfig =\n | GenerativeUIToolConfig\n | GenerativeUIMarkdownConfig;\n\nexport interface GenerativeUIRuntime {\n manager: GenerativeUISurfaceManager;\n dispatcher: GenerativeUIDispatcher;\n /** The generative UI given to the provider as `generativeUI={{ ui }}`. */\n ui: GenerativeUI;\n /** How the model sends operations. \"tool\" when the config leaves it out. */\n transport: \"tool\" | \"markdown\";\n /** The latest `generativeUI` config of the provider. */\n readonly config: GenerativeUIConfig;\n /** The latest `theme`. Each surface root sets its CSS variables. */\n theme?: GenerativeUITheme;\n forwardEvent: (\n event: GenerativeUIUserEvent,\n agentId: string | undefined,\n ) => Promise<GenerativeUIInvokeResult>;\n reportError: (info: GenerativeUIErrorInfo) => void;\n readonly errorFallback?: GenerativeUIErrorBoundaryConfig[\"fallback\"];\n}\n\nexport const GenerativeUIRuntimeContext =\n createContext<GenerativeUIRuntime | null>(null);\n\nexport function useGenerativeUIRuntime(): GenerativeUIRuntime | null {\n return useContext(GenerativeUIRuntimeContext);\n}\n\nexport function useRequiredGenerativeUIRuntime(): GenerativeUIRuntime {\n const runtime = useContext(GenerativeUIRuntimeContext);\n if (!runtime) {\n throw new Error(\n \"Generative UI components must be rendered inside <CopilotKitProvider generativeUI={{ ui }}>.\",\n );\n }\n return runtime;\n}\n\nexport { reportErrorSafely } from \"@copilotkit/core/generative-ui\";\n\nexport interface GenerativeUINodeContextValue {\n surfaceKey: string;\n surfaceId: string;\n componentId: string;\n /** The resolved `accessibility` of the component envelope, if any. */\n accessibility?: GenerativeUIAccessibility;\n}\n\nexport const GenerativeUINodeContext =\n createContext<GenerativeUINodeContextValue | null>(null);\n","import { useEffect, useRef, useSyncExternalStore } from \"react\";\nimport type {\n GenerativeUI,\n GenerativeUIDefinitionsOf,\n GenerativeUIFunctionArgs,\n GenerativeUIFunctionName,\n GenerativeUIStateOf,\n} from \"./catalog\";\nimport { useRequiredGenerativeUIRuntime } from \"./runtime-context\";\nimport type { GenerativeUIRuntime } from \"./runtime-context\";\nimport { formatIssues, validateSchema } from \"@copilotkit/shared/generative-ui\";\nimport type {\n SchemaInput,\n ValidationResult,\n} from \"@copilotkit/shared/generative-ui\";\n\nconst noopSubscribe = () => () => {};\nconst zero = () => 0;\n\n/** Re-renders on any surface-manager change. */\nexport function useManagerVersion(runtime: GenerativeUIRuntime | null): number {\n return useSyncExternalStore(\n runtime?.manager.subscribe ?? noopSubscribe,\n runtime?.manager.getVersion ?? zero,\n zero,\n );\n}\n\n/** What `useGenerativeUIState` takes for one key: the input of its schema. */\ntype StateInput<\n UI extends GenerativeUI<any>,\n Key extends keyof GenerativeUIStateOf<UI>,\n> = SchemaInput<GenerativeUIDefinitionsOf<UI>[\"state\"][Key]>;\n\n/**\n * Experimental. Gives one key of the app state declared in\n * `createGenerativeUI({ state })` its value. Bound props of generated\n * components read it. The model does not see it.\n *\n * The key is set on mount and when the value changes (compared as JSON). It\n * is removed on unmount.\n *\n * @param ui - The object from `createGenerativeUI`. It gives the key and the\n * value their types.\n * @param key - A top-level key of `state`.\n * @param value - The value of that key. It must fit the key's schema.\n *\n * @example\n * ```tsx\n * useGenerativeUIState(storeUI, \"cart\", { count, total, coupon, items });\n * ```\n */\nexport function useGenerativeUIState<\n UI extends GenerativeUI<any>,\n Key extends keyof GenerativeUIStateOf<UI> & string,\n>(ui: UI, key: Key, value: StateInput<UI, Key>) {\n // ponytail: `ui` is for types only. The hook writes to the provider's generative UI and does not check that `ui` is that object.\n const runtime = useRequiredGenerativeUIRuntime();\n const serialized = JSON.stringify(value);\n useEffect(() => {\n const raw: unknown = JSON.parse(serialized ?? \"null\");\n let current = true;\n const apply = (parsed: ValidationResult) => {\n if (!current) return;\n if (parsed.success) {\n runtime.manager.setState(key, parsed.data);\n return;\n }\n // An invalid value is not stored. Bound props that read this key show the props fallback.\n runtime.manager.removeState(key);\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\n `[generativeUI] useGenerativeUIState: invalid value for \"${key}\": ${formatIssues(parsed.issues, \"value\")}`,\n );\n }\n };\n // Selectors get the parsed output, so schema defaults and transforms run\n // here. A schema that validates synchronously applies at once.\n const schema = runtime.ui.state.get(key);\n const parsed = schema\n ? validateSchema(schema, raw)\n : { success: true as const, data: raw };\n if (parsed instanceof Promise) void parsed.then(apply);\n else apply(parsed);\n return () => {\n current = false;\n };\n }, [runtime, key, serialized]);\n useEffect(() => () => runtime.manager.removeState(key), [runtime, key]);\n}\n\n/**\n * Experimental. Mounts the handler of a function declared in\n * `createGenerativeUI({ functions })`. Generated UI can call the function\n * only while exactly one handler for it is mounted.\n *\n * The handler gets the parsed arguments: schema defaults are set. It can\n * change on each render. The latest handler always runs, and the hook does\n * not register again.\n *\n * @param ui - The object from `createGenerativeUI`. It gives the name and the\n * handler arguments their types.\n * @param name - A key of `functions`.\n * @param handler - Runs when generated UI calls the function. Its return\n * value goes back to the caller as `{ ok: true, result }`.\n *\n * @example\n * ```tsx\n * useGenerativeUIFunction(storeUI, \"addToCart\", ({ productId, quantity }) =>\n * cart.addItem(productId, quantity),\n * );\n * ```\n */\nexport function useGenerativeUIFunction<\n UI extends GenerativeUI<any>,\n Name extends GenerativeUIFunctionName<UI>,\n>(\n ui: UI,\n name: Name,\n handler: (args: GenerativeUIFunctionArgs<UI, Name>) => unknown,\n) {\n // ponytail: `ui` is for types only. The hook registers with the provider's generative UI and does not check that `ui` is that object.\n const runtime = useRequiredGenerativeUIRuntime();\n const latest = useRef(handler);\n latest.current = handler;\n useEffect(() => runtime.dispatcher.register(name, latest), [runtime, name]);\n}\n","import React, { Component } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { reportErrorSafely } from \"./runtime-context\";\nimport type { GenerativeUIRuntime } from \"./runtime-context\";\n\nexport function DefaultNodeFallback({\n message,\n componentId,\n retry,\n}: {\n message: string;\n componentId: string;\n retry?: () => void;\n}) {\n return (\n <div\n role=\"alert\"\n data-generative-ui-error={componentId}\n style={{\n border: \"1px solid #fca5a5\",\n background: \"#fef2f2\",\n color: \"#991b1b\",\n borderRadius: 8,\n padding: \"8px 12px\",\n fontSize: 13,\n }}\n >\n Couldn’t display this part: {message}\n {retry && (\n <button\n type=\"button\"\n onClick={retry}\n style={{ marginLeft: 8, textDecoration: \"underline\" }}\n >\n Retry\n </button>\n )}\n </div>\n );\n}\n\n/**\n * A child that has not streamed yet renders nothing. The prose keeps\n * streaming above the surface, and each component appears as soon as it is\n * complete. A grey block in its place would read as a broken layout.\n */\nexport function NodePlaceholder(_props: { componentId: string }) {\n return null;\n}\n\ninterface NodeBoundaryProps {\n surfaceId: string;\n componentId: string;\n /** Wire props object of the node; a new object means a new agent revision. */\n revision: unknown;\n runtime: GenerativeUIRuntime;\n children: ReactNode;\n}\n\ninterface NodeBoundaryState {\n error: Error | null;\n revision: unknown;\n}\n\n/** Per-node boundary. Resets on retry or a new agent revision, not on data ticks. */\nexport class NodeBoundary extends Component<\n NodeBoundaryProps,\n NodeBoundaryState\n> {\n state: NodeBoundaryState = { error: null, revision: this.props.revision };\n\n static getDerivedStateFromError(error: Error): Partial<NodeBoundaryState> {\n return { error };\n }\n\n static getDerivedStateFromProps(\n props: NodeBoundaryProps,\n state: NodeBoundaryState,\n ): Partial<NodeBoundaryState> | null {\n return props.revision !== state.revision\n ? { error: null, revision: props.revision }\n : null;\n }\n\n componentDidCatch(error: Error) {\n const { runtime, surfaceId, componentId } = this.props;\n reportErrorSafely(runtime, {\n kind: \"render\",\n surfaceId,\n componentId,\n error,\n });\n }\n\n private retry = () => this.setState({ error: null });\n\n render() {\n const { error } = this.state;\n if (!error) return this.props.children;\n const { runtime, surfaceId, componentId } = this.props;\n const fallback = runtime.errorFallback;\n return fallback ? (\n fallback({ error, retry: this.retry, surfaceId, componentId })\n ) : (\n <DefaultNodeFallback\n message={error.message}\n componentId={componentId}\n retry={this.retry}\n />\n );\n }\n}\n\n/** Outer boundary: a failure here must not reach the chat or the host page. */\nexport class SurfaceBoundary extends Component<\n { surfaceId: string; runtime: GenerativeUIRuntime; children: ReactNode },\n { error: Error | null }\n> {\n state = { error: null as Error | null };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error) {\n reportErrorSafely(this.props.runtime, {\n kind: \"render\",\n surfaceId: this.props.surfaceId,\n error,\n });\n }\n\n render() {\n if (!this.state.error) return this.props.children;\n return (\n <DefaultNodeFallback\n message=\"this generated UI failed to render\"\n componentId=\"surface\"\n />\n );\n }\n}\n","import { useContext, useMemo } from \"react\";\nimport { accessibilityAttributes } from \"@copilotkit/core/generative-ui\";\nimport type { GenerativeUIAriaAttributes } from \"@copilotkit/core/generative-ui\";\nimport { GenerativeUINodeContext } from \"./runtime-context\";\n\n// The accessibility helpers are framework-free and live in\n// `@copilotkit/core/generative-ui`. The standard components import them\n// from here.\nexport {\n accessibilityAttributes,\n controlAria,\n namedRole,\n readAccessibility,\n wrapperAria,\n} from \"@copilotkit/core/generative-ui\";\nexport type {\n GenerativeUIAccessibility,\n GenerativeUIAriaAttributes,\n} from \"@copilotkit/core/generative-ui\";\n\n/**\n * Experimental. The ARIA attributes of the `accessibility` that the model\n * gave the component being rendered, to spread on its root element. The\n * standard components do this; a custom component does it itself:\n *\n * @example\n * ```tsx\n * function Panel({ children }: { children?: ReactNode }) {\n * const aria = useGenerativeUIAccessibility();\n * return <section {...aria}>{children}</section>;\n * }\n * ```\n *\n * Outside of generated UI it gives `{}`.\n */\nexport function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes {\n const node = useContext(GenerativeUINodeContext);\n const accessibility = node?.accessibility;\n return useMemo(() => accessibilityAttributes(accessibility), [accessibility]);\n}\n","import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { ComponentModel, SurfaceModel } from \"@a2ui/web_core/v0_9\";\nimport {\n A2UI_COMPONENT_ENVELOPE_KEYS,\n GENERATIVE_UI_ROOT_ID,\n isActionBinding,\n isPathBinding,\n mapAtChildRef,\n} from \"@copilotkit/shared\";\nimport type {\n ChildRef,\n GenerativeUIActionBinding,\n GenerativeUITemplateChildren,\n} from \"@copilotkit/shared\";\nimport { shallowEqual } from \"../lib/shallow-stable-ref\";\nimport { setterNameOf } from \"./catalog\";\nimport type { ResolvedGenerativeUIComponent } from \"./catalog\";\nimport {\n joinPath,\n resolvePath,\n tryResolveDynamicValue,\n} from \"@copilotkit/core/generative-ui\";\nimport {\n formatIssues,\n isAsyncIssue,\n issueKey,\n validateSchemaSync,\n withoutRejectedNulls,\n} from \"@copilotkit/shared/generative-ui\";\nimport {\n DefaultNodeFallback,\n NodeBoundary,\n NodePlaceholder,\n SurfaceBoundary,\n} from \"./boundaries\";\nimport {\n accessibilityAttributes,\n readAccessibility,\n wrapperAria,\n} from \"./accessibility\";\nimport type { GenerativeUIAccessibility } from \"./accessibility\";\nimport type { GenerativeUIInvokeResult } from \"@copilotkit/shared/generative-ui\";\nimport {\n invokeBoundEvent,\n invokeMatchedEvent,\n} from \"@copilotkit/core/generative-ui\";\nimport {\n GenerativeUINodeContext,\n reportErrorSafely,\n useRequiredGenerativeUIRuntime,\n} from \"./runtime-context\";\nimport type { GenerativeUIRuntime } from \"./runtime-context\";\nimport { themeStyleSheet } from \"@copilotkit/shared/generative-ui\";\nimport type {\n GenerativeUISurfaceManager,\n ManagedSurface,\n} from \"@copilotkit/core/generative-ui\";\n\nconst NO_ANCESTORS: readonly string[] = [];\nconst ROOT_STYLE = { display: \"contents\" } as const;\n// No surface state exists on the server or during hydration.\nconst undefinedSnapshot = () => undefined;\nconst noopSubscribe = () => () => {};\nconst zeroSnapshot = () => 0;\n\n/** A \"multiple\" slot value that repeats a component for each list item. */\nfunction isTemplateChildren(\n value: unknown,\n): value is GenerativeUITemplateChildren {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"componentId\" in value &&\n typeof value.componentId === \"string\" &&\n \"path\" in value &&\n typeof value.path === \"string\"\n );\n}\n\nexport function SurfaceView({ surface }: { surface: ManagedSurface }) {\n const runtime = useRequiredGenerativeUIRuntime();\n const { theme } = runtime;\n const sheet = useMemo(() => themeStyleSheet(theme), [theme]);\n // The root element is always there, so a theme change does not remount\n // the surface. `display: contents` keeps it out of the layout, and the\n // CSS variables still reach every component of the surface. The\n // `a2ui-surface` class scopes the standard catalog's surface CSS rules.\n // The theme is a stylesheet, not an inline style, so that its `dark`\n // values can apply in dark mode only. The values are checked in\n // `themeStyleSheet`, and the HTML is set as is, so the server render\n // keeps the quotes of the rule.\n return (\n <div\n className=\"a2ui-surface\"\n data-generative-ui-root={surface.surfaceId}\n data-a2ui-theme={sheet?.id}\n style={ROOT_STYLE}\n >\n {sheet ? <style dangerouslySetInnerHTML={{ __html: sheet.css }} /> : null}\n <SurfaceBoundary surfaceId={surface.surfaceId} runtime={runtime}>\n <NodeView\n surface={surface}\n componentId={GENERATIVE_UI_ROOT_ID}\n basePath={undefined}\n ancestors={NO_ANCESTORS}\n />\n </SurfaceBoundary>\n </div>\n );\n}\n\n/**\n * Resolves a component by id. Subscribes to the manager rather than web_core's\n * `onCreated`/`onDeleted`: web_core's EventEmitter awaits each listener in turn,\n * so with several subscribers (one per slotted child, or one per mount of the\n * same surface) all but the first are notified a microtask late. That is only\n * visible inside synchronous flushes such as `act()` / `flushSync`, where the\n * old tree would still be on screen, but it makes updates order-dependent.\n * The manager notifies synchronously once an ingest has been fully applied.\n */\nfunction useComponentModel(\n manager: GenerativeUISurfaceManager,\n model: SurfaceModel<any>,\n id: string,\n): ComponentModel | undefined {\n return useSyncExternalStore(\n manager.subscribe,\n () => model.componentsModel.get(id),\n undefinedSnapshot,\n );\n}\n\n/** Same reasoning as `useComponentModel`: never rely on web_core's emitters. */\nfunction useComponentProperties(\n manager: GenerativeUISurfaceManager,\n component: ComponentModel | undefined,\n) {\n return useSyncExternalStore(\n manager.subscribe,\n () => component?.properties,\n undefinedSnapshot,\n );\n}\n\n/**\n * The id of a node in the ancestor list. A template renders the same\n * component once per item, so the item path is part of the id. A real cycle\n * repeats both.\n */\nfunction scopedId(componentId: string, basePath: string | undefined) {\n return `${basePath ?? \"\"}#${componentId}`;\n}\n\nconst NodeView = memo(function NodeView({\n surface,\n componentId,\n basePath,\n ancestors,\n}: {\n surface: ManagedSurface;\n componentId: string;\n /**\n * The data model path of the template item this node renders, or\n * `undefined` outside of a template. Relative paths resolve against it.\n */\n basePath: string | undefined;\n /** Scoped ids of the nodes above this one; used to cut cyclic references. */\n ancestors: readonly string[];\n}) {\n const runtime = useRequiredGenerativeUIRuntime();\n const component = useComponentModel(\n runtime.manager,\n surface.model,\n componentId,\n );\n const properties = useComponentProperties(runtime.manager, component);\n if (ancestors.includes(scopedId(componentId, basePath))) {\n return (\n <DefaultNodeFallback\n message={`cyclic reference to ${componentId}`}\n componentId={componentId}\n />\n );\n }\n if (!component || !properties)\n return <NodePlaceholder componentId={componentId} />;\n const definition = runtime.ui.components.get(component.type);\n if (!definition) {\n return (\n <DefaultNodeFallback\n message={`unknown component \"${component.type}\"`}\n componentId={componentId}\n />\n );\n }\n return (\n <NodeBoundary\n key={component.type}\n surfaceId={surface.surfaceId}\n componentId={componentId}\n revision={properties}\n runtime={runtime}\n >\n <ResolvedNode\n surface={surface}\n componentId={componentId}\n definition={definition}\n properties={properties}\n runtime={runtime}\n basePath={basePath}\n ancestors={ancestors}\n />\n </NodeBoundary>\n );\n});\n\n/**\n * Renders the component of a template once for each item of the list at the\n * template path, keyed by index. Renders nothing when there is no list.\n */\nfunction TemplateChildren({\n surface,\n template,\n basePath,\n ancestors,\n}: {\n surface: ManagedSurface;\n template: GenerativeUITemplateChildren;\n basePath: string | undefined;\n ancestors: readonly string[];\n}) {\n const dataModel = surface.model.dataModel;\n const listPath = resolvePath(template.path, basePath);\n const subscribe = useCallback(\n (onChange: () => void) => {\n const subscription = dataModel.subscribe(listPath, onChange);\n return () => subscription.unsubscribe();\n },\n [dataModel, listPath],\n );\n const getCount = () => {\n const list = dataModel.get(listPath);\n return Array.isArray(list) ? list.length : 0;\n };\n const count = useSyncExternalStore(subscribe, getCount, zeroSnapshot);\n const indexes = Array.from({ length: count }, (_, index) => index);\n return (\n <>\n {indexes.map((index) => (\n <NodeView\n key={index}\n surface={surface}\n componentId={template.componentId}\n basePath={joinPath(listPath, String(index))}\n ancestors={ancestors}\n />\n ))}\n </>\n );\n}\n\n/** What one data prop resolved to, and what it read to get there. */\ninterface ResolvedProp {\n /** The raw prop value it was resolved from. */\n raw: unknown;\n /** The template item path it was resolved in. */\n basePath: string | undefined;\n /** The value, or the reason it could not be computed. */\n outcome: { ok: true; value: unknown } | { ok: false; message: string };\n /** The data model value at each path it read, when it was resolved. */\n reads: Map<string, unknown>;\n}\n\ntype ModelData =\n | {\n ok: true;\n values: Record<string, unknown>;\n /** The resolved `accessibility` of the component envelope. */\n accessibility: GenerativeUIAccessibility | undefined;\n }\n | { ok: false; problem: string };\n\n/**\n * The props the model sets, with their dynamic values resolved from the\n * surface data model: `{\"@path\"}` bindings, `{\"@call\"}` function values and\n * `{\"@call\":\"@index\"}` in a template, at any depth. A literal writable prop\n * that the component set shows the local value from `overrides`. Bound\n * props, events and slots are left out, and so are the keys of the A2UI\n * component envelope; `accessibility` is resolved the same way and given\n * on its own.\n *\n * A prop is resolved again only when its raw value or a data model value it\n * read has changed, so the result keeps its identity otherwise. A function\n * value that cannot be computed gives a problem instead of values.\n */\nfunction useModelDataProps(\n surface: ManagedSurface,\n definition: ResolvedGenerativeUIComponent,\n properties: Record<string, unknown>,\n basePath: string | undefined,\n overrides: Record<string, unknown>,\n): ModelData {\n const dataModel = surface.model.dataModel;\n // The units to resolve: each model prop, and each field of the envelope's\n // `accessibility` on its own, so a label that cannot be computed does not\n // take the other fields with it.\n const units = useMemo(() => {\n const list: Array<{ key: string; raw: unknown; field?: string }> = [];\n for (const key of Object.keys(properties)) {\n if (\n definition.events?.[key] ||\n definition.slots?.[key] ||\n Object.hasOwn(definition.selectors, key) ||\n A2UI_COMPONENT_ENVELOPE_KEYS.has(key)\n ) {\n continue;\n }\n list.push({ key, raw: properties[key] });\n }\n const a11y = properties.accessibility;\n if (typeof a11y === \"object\" && a11y !== null && !Array.isArray(a11y)) {\n for (const [field, raw] of Object.entries(a11y)) {\n list.push({ key: `accessibility/${field}`, raw, field });\n }\n }\n return list;\n }, [properties, definition]);\n const [, rerender] = useReducer((n: number) => n + 1, 0);\n const cache = useRef(new Map<string, ResolvedProp>());\n const values: Record<string, unknown> = {};\n const a11yValues: Record<string, unknown> = {};\n const paths = new Set<string>();\n let problem: string | undefined;\n const next = new Map<string, ResolvedProp>();\n for (const { key, raw, field } of units) {\n const cached = cache.current.get(key);\n // A cached resolution holds while the raw prop, the template item and\n // every value it read are the same. A data model notification clears\n // the cache (below), because web_core changes lists and objects in\n // place, so a changed item inside one keeps the identity of the list.\n const isFresh =\n cached !== undefined &&\n cached.raw === raw &&\n cached.basePath === basePath &&\n [...cached.reads].every(([path, value]) =>\n Object.is(dataModel.get(path), value),\n );\n const resolve = (): ResolvedProp => {\n const resolved = tryResolveDynamicValue(\n raw,\n { data: dataModel, basePath },\n { isChecks: key === \"checks\" },\n );\n // The reads are kept also when the resolution failed, so the node\n // stays subscribed to the data that can fix it.\n const reads = new Map<string, unknown>();\n for (const path of resolved.paths) reads.set(path, dataModel.get(path));\n return {\n raw,\n basePath,\n reads,\n outcome: resolved.ok\n ? { ok: true, value: resolved.value }\n : { ok: false, message: resolved.error.message },\n };\n };\n const entry = isFresh && cached ? cached : resolve();\n next.set(key, entry);\n if (field !== undefined) {\n // The envelope is not a prop: a label that cannot be computed names\n // nothing, and the component is not at fault for it. Its reads stay\n // subscribed, so the data that fixes it brings the label.\n if (entry.outcome.ok) a11yValues[field] = entry.outcome.value;\n } else if (entry.outcome.ok) values[key] = entry.outcome.value;\n else problem ??= `${key}: ${entry.outcome.message}`;\n for (const path of entry.reads.keys()) paths.add(path);\n }\n cache.current = next;\n const accessibility = readAccessibility(a11yValues);\n for (const [key, value] of Object.entries(overrides)) {\n if (!isPathBinding(properties[key])) values[key] = value;\n }\n // The values this render was based on, so the effect can detect a write that\n // landed between render and subscription (web_core never replays the current\n // value on subscribe).\n const rendered = useRef(next);\n rendered.current = next;\n const pathKey = [...paths].sort().join(\"\\n\");\n useEffect(() => {\n const list = pathKey === \"\" ? [] : pathKey.split(\"\\n\");\n const onChange = () => {\n cache.current = new Map();\n rerender();\n };\n const subscriptions = list.map((path) =>\n dataModel.subscribe(path, onChange),\n );\n const isStale = [...rendered.current.values()].some((entry) =>\n [...entry.reads].some(\n ([path, value]) => !Object.is(dataModel.get(path), value),\n ),\n );\n if (isStale) rerender();\n return () => subscriptions.forEach((s) => s.unsubscribe());\n }, [dataModel, pathKey]);\n const stable = useRef<ModelData>({\n ok: true,\n values: {},\n accessibility: undefined,\n });\n const result: ModelData =\n problem === undefined\n ? { ok: true, values, accessibility }\n : { ok: false, problem };\n const last = stable.current;\n const isSame =\n result.ok && last.ok\n ? shallowEqual(last.values, result.values) &&\n shallowEqual(\n (last.accessibility ?? {}) as Record<string, unknown>,\n (result.accessibility ?? {}) as Record<string, unknown>,\n )\n : !result.ok && !last.ok && last.problem === result.problem;\n if (!isSame) stable.current = result;\n return stable.current;\n}\n\n/** The selector results of one node, or the reason they could not be read. */\ntype Selection =\n | { ok: true; values: Record<string, unknown> }\n | { ok: false; problem: string };\n\nconst NO_SELECTION: Selection = { ok: true, values: {} };\n\nfunction isSameSelection(a: Selection, b: Selection) {\n if (a.ok && b.ok) return shallowEqual(a.values, b.values);\n if (!a.ok && !b.ok) return a.problem === b.problem;\n return false;\n}\n\n/** Runs every selector of a node. A selector that throws gives a problem. */\nfunction select(\n definition: ResolvedGenerativeUIComponent,\n state: Readonly<Record<string, unknown>>,\n modelProps: Record<string, unknown>,\n): Selection {\n const values: Record<string, unknown> = {};\n const selectors = Object.entries(definition.selectors);\n for (const [key, selector] of selectors) {\n try {\n values[key] = selector(state, modelProps);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { ok: false, problem: `${key}: selector threw: ${message}` };\n }\n }\n return { ok: true, values };\n}\n\ninterface SelectionCache {\n state: Readonly<Record<string, unknown>>;\n modelProps: Record<string, unknown>;\n selection: Selection;\n}\n\n/**\n * The values of the bound props of a node, read from the app state.\n *\n * The selectors run again only when the state object or the parsed model\n * props change. When the new values are shallow-equal to the last ones, the\n * last snapshot is kept. So the node re-renders only when a selected value\n * changes. A selector that returns a new array on each call cannot cause a\n * render loop: with the same inputs, the cached snapshot comes back.\n *\n * A node without bound props does not subscribe to the state.\n */\nfunction useSelection(\n manager: GenerativeUISurfaceManager,\n definition: ResolvedGenerativeUIComponent,\n modelProps: Record<string, unknown> | undefined,\n) {\n const hasSelectors = Object.keys(definition.selectors).length > 0;\n const cache = useRef<SelectionCache | undefined>(undefined);\n const getSnapshot = () => {\n if (!hasSelectors || modelProps === undefined) return NO_SELECTION;\n const state = manager.getState();\n const cached = cache.current;\n const isCacheHit =\n cached !== undefined &&\n cached.state === state &&\n cached.modelProps === modelProps;\n if (isCacheHit) return cached.selection;\n const next = select(definition, state, modelProps);\n const selection =\n cached !== undefined && isSameSelection(cached.selection, next)\n ? cached.selection\n : next;\n cache.current = { state, modelProps, selection };\n return selection;\n };\n // The server uses the same snapshot. It reads the state that is set now.\n return useSyncExternalStore(\n hasSelectors ? manager.subscribe : noopSubscribe,\n getSnapshot,\n getSnapshot,\n );\n}\n\ntype DataProps =\n | {\n ok: true;\n props: Record<string, unknown>;\n accessibility: GenerativeUIAccessibility | undefined;\n }\n | { ok: false; problem: string };\n\ntype ModelCheck =\n | { ok: true; values: Record<string, unknown> }\n | { ok: false; problem: string };\n\n/**\n * Checks the model-set props with the props schema before the selectors run.\n * The bound props are not set yet, so their issues do not count. Neither do\n * issues with no path (a check over several props), which the full check\n * after the selectors reports.\n */\nfunction checkModelProps(\n definition: ResolvedGenerativeUIComponent,\n modelData: Record<string, unknown>,\n): ModelCheck {\n if (!definition.props) return { ok: true, values: {} };\n let values = modelData;\n let result = validateSchemaSync(definition.props, values);\n if (!result.success) {\n // A null the schema rejects is an unset prop: check again without it.\n const unset = withoutRejectedNulls(values, result.issues);\n if (unset) {\n values = unset;\n result = validateSchemaSync(definition.props, values);\n }\n }\n if (!result.success) {\n const issues = result.issues.filter((issue) => {\n const key = issueKey(issue);\n return key === undefined\n ? isAsyncIssue(issue)\n : !Object.hasOwn(definition.selectors, key);\n });\n if (issues.length > 0) return { ok: false, problem: formatIssues(issues) };\n }\n return { ok: true, values };\n}\n\n/**\n * The data props of a node, in three steps: check the model-set props with\n * the props schema, run the selectors with them, then parse all props with\n * the props schema. Gives the reason when a step fails.\n */\nfunction useDataProps(\n runtime: GenerativeUIRuntime,\n surface: ManagedSurface,\n definition: ResolvedGenerativeUIComponent,\n properties: Record<string, unknown>,\n basePath: string | undefined,\n overrides: Record<string, unknown>,\n) {\n const modelData = useModelDataProps(\n surface,\n definition,\n properties,\n basePath,\n overrides,\n );\n const modelCheck = useMemo(\n () =>\n modelData.ok ? checkModelProps(definition, modelData.values) : modelData,\n [definition, modelData],\n );\n const selection = useSelection(\n runtime.manager,\n definition,\n modelCheck.ok ? modelCheck.values : undefined,\n );\n const accessibility = modelData.ok ? modelData.accessibility : undefined;\n return useMemo((): DataProps => {\n if (!modelCheck.ok) return modelCheck;\n if (!selection.ok) return selection;\n if (!definition.props) return { ok: true, props: {}, accessibility };\n const input = { ...modelCheck.values, ...selection.values };\n let parsed = validateSchemaSync(definition.props, input);\n if (!parsed.success) {\n // A null the schema rejects is an unset prop: validate without it.\n const unset = withoutRejectedNulls(input, parsed.issues);\n if (unset) parsed = validateSchemaSync(definition.props, unset);\n }\n if (!parsed.success) {\n return { ok: false, problem: formatIssues(parsed.issues) };\n }\n return {\n ok: true,\n props: parsed.data as Record<string, unknown>,\n accessibility,\n };\n }, [definition, modelCheck, selection, accessibility]);\n}\n\n/**\n * The event props of a node. A matched event (one that matches a declared\n * function) is always bound. An unmatched event is bound only when the model\n * bound it.\n */\nfunction useEventProps(\n runtime: GenerativeUIRuntime,\n surface: ManagedSurface,\n componentId: string,\n definition: ResolvedGenerativeUIComponent,\n properties: Record<string, unknown>,\n basePath: string | undefined,\n) {\n const latest = useRef(properties);\n latest.current = properties;\n const boundNames = Object.keys(definition.events ?? {})\n .filter(\n (name) =>\n Object.hasOwn(definition.eventFunctions, name) ||\n isActionBinding(properties[name]),\n )\n .join(\"|\");\n return useMemo(() => {\n const handlers: Record<\n string,\n (args?: unknown) => Promise<GenerativeUIInvokeResult>\n > = {};\n const names = boundNames ? boundNames.split(\"|\") : [];\n for (const name of names) {\n const call = {\n runtime,\n surface,\n componentId,\n name,\n parameters: definition.events?.[name]?.parameters,\n };\n const functionName = Object.hasOwn(definition.eventFunctions, name)\n ? definition.eventFunctions[name]\n : undefined;\n handlers[name] =\n functionName === undefined\n ? (args) =>\n invokeBoundEvent({\n ...call,\n binding: latest.current[name] as GenerativeUIActionBinding,\n basePath,\n args,\n })\n : (args) => invokeMatchedEvent({ ...call, functionName, args });\n }\n return handlers;\n }, [boundNames, runtime, surface, componentId, definition, basePath]);\n}\n\n/**\n * The setter props of a node: `setValue` for the writable prop `value`. For\n * a prop the model bound to `{\"@path\"}`, the setter writes the data model\n * and makes the path user-owned. For a literal prop, it sets `overrides`, a\n * local value of this mounted node. The setters keep their identity.\n */\nfunction useSetterProps(\n runtime: GenerativeUIRuntime,\n surface: ManagedSurface,\n componentId: string,\n definition: ResolvedGenerativeUIComponent,\n properties: Record<string, unknown>,\n basePath: string | undefined,\n) {\n const [overrides, setOverrides] = useState<Record<string, unknown>>({});\n const latest = useRef(properties);\n latest.current = properties;\n const setters = useMemo(() => {\n const result: Record<string, (value: unknown) => void> = {};\n const writable = definition.writable ?? [];\n for (const key of writable) {\n result[setterNameOf(key)] = (value) => {\n const binding = latest.current[key];\n if (!isPathBinding(binding)) {\n setOverrides((current) => ({ ...current, [key]: value }));\n return;\n }\n try {\n runtime.manager.setOwnedValue(\n surface.key,\n resolvePath(binding[\"@path\"], basePath),\n value,\n );\n } catch (cause) {\n const message =\n cause instanceof Error ? cause.message : String(cause);\n reportErrorSafely(runtime, {\n kind: \"props\",\n surfaceId: surface.surfaceId,\n componentId,\n error: new Error(`${setterNameOf(key)}: ${message}`),\n });\n }\n };\n }\n return result;\n }, [runtime, surface, componentId, definition, basePath]);\n return { overrides, setters };\n}\n\nfunction useSlotProps(\n surface: ManagedSurface,\n definition: ResolvedGenerativeUIComponent,\n properties: Record<string, unknown>,\n componentId: string,\n basePath: string | undefined,\n ancestors: readonly string[],\n) {\n return useMemo(() => {\n const childAncestors = [...ancestors, scopedId(componentId, basePath)];\n const slots: Record<string, ReactNode> = {};\n for (const [name, kind] of Object.entries(definition.slots ?? {})) {\n const value = properties[name];\n if (kind === \"single\" && typeof value === \"string\") {\n slots[name] = (\n <NodeView\n surface={surface}\n componentId={value}\n basePath={basePath}\n ancestors={childAncestors}\n />\n );\n } else if (kind === \"multiple\" && isTemplateChildren(value)) {\n slots[name] = (\n <TemplateChildren\n surface={surface}\n template={value}\n basePath={basePath}\n ancestors={childAncestors}\n />\n );\n } else if (kind === \"multiple\" && Array.isArray(value)) {\n // Dedupe so React keys stay unique if the agent repeats an id.\n const ids = [\n ...new Set(\n value.filter((id): id is string => typeof id === \"string\"),\n ),\n ];\n slots[name] = ids.map((id) => (\n <NodeView\n key={id}\n surface={surface}\n componentId={id}\n basePath={basePath}\n ancestors={childAncestors}\n />\n ));\n }\n }\n return slots;\n }, [surface, definition, properties, componentId, basePath, ancestors]);\n}\n\n/**\n * The parsed data props with every typed child reference (`child()`,\n * `childList()`, at any depth) replaced by the rendered component. Without\n * references, the parsed props come back as they are.\n */\nfunction useChildRefProps(\n surface: ManagedSurface,\n refs: readonly ChildRef[],\n props: Record<string, unknown> | undefined,\n componentId: string,\n basePath: string | undefined,\n ancestors: readonly string[],\n) {\n return useMemo(() => {\n if (props === undefined || refs.length === 0) return props;\n const childAncestors = [...ancestors, scopedId(componentId, basePath)];\n const render = (kind: ChildRef[\"kind\"], value: unknown): unknown => {\n if (kind === \"single\") {\n return typeof value === \"string\" ? (\n <NodeView\n surface={surface}\n componentId={value}\n basePath={basePath}\n ancestors={childAncestors}\n />\n ) : undefined;\n }\n if (isTemplateChildren(value)) {\n return (\n <TemplateChildren\n surface={surface}\n template={value}\n basePath={basePath}\n ancestors={childAncestors}\n />\n );\n }\n if (!Array.isArray(value)) return undefined;\n const ids = [\n ...new Set(value.filter((id): id is string => typeof id === \"string\")),\n ];\n return ids.map((id) => (\n <NodeView\n key={id}\n surface={surface}\n componentId={id}\n basePath={basePath}\n ancestors={childAncestors}\n />\n ));\n };\n let result: unknown = props;\n for (const ref of refs) {\n result = mapAtChildRef(result, ref.path, (found) =>\n render(ref.kind, found),\n );\n }\n return result as Record<string, unknown>;\n }, [surface, refs, props, componentId, basePath, ancestors]);\n}\n\nfunction ResolvedNode({\n surface,\n componentId,\n definition,\n properties,\n runtime,\n basePath,\n ancestors,\n}: {\n surface: ManagedSurface;\n componentId: string;\n definition: ResolvedGenerativeUIComponent;\n properties: Record<string, unknown>;\n runtime: GenerativeUIRuntime;\n basePath: string | undefined;\n ancestors: readonly string[];\n}) {\n const { overrides, setters } = useSetterProps(\n runtime,\n surface,\n componentId,\n definition,\n properties,\n basePath,\n );\n const dataProps = useDataProps(\n runtime,\n surface,\n definition,\n properties,\n basePath,\n overrides,\n );\n const eventProps = useEventProps(\n runtime,\n surface,\n componentId,\n definition,\n properties,\n basePath,\n );\n const slotProps = useSlotProps(\n surface,\n definition,\n properties,\n componentId,\n basePath,\n ancestors,\n );\n const childRefProps = useChildRefProps(\n surface,\n definition.childRefs,\n dataProps.ok ? dataProps.props : undefined,\n componentId,\n basePath,\n ancestors,\n );\n const accessibility = dataProps.ok ? dataProps.accessibility : undefined;\n const nodeContext = useMemo(\n () => ({\n surfaceKey: surface.key,\n surfaceId: surface.surfaceId,\n componentId,\n accessibility,\n }),\n [surface.key, surface.surfaceId, componentId, accessibility],\n );\n const problem = dataProps.ok ? undefined : dataProps.problem;\n\n useEffect(() => {\n if (problem) {\n reportErrorSafely(runtime, {\n kind: \"props\",\n surfaceId: surface.surfaceId,\n componentId,\n error: new Error(`Invalid props: ${problem}`),\n });\n }\n }, [problem, runtime, surface.surfaceId, componentId]);\n\n if (!dataProps.ok) {\n return (\n <DefaultNodeFallback\n message={`invalid props (${problem})`}\n componentId={componentId}\n />\n );\n }\n const Component = definition.component;\n const rendered = (\n <Component {...childRefProps} {...eventProps} {...slotProps} {...setters} />\n );\n // The hidden state and the live region of the envelope apply to every\n // component here, in a wrapper with no box of its own. A label or a\n // description needs an element with a role, so the component sets those\n // itself (the standard ones do; see useGenerativeUIAccessibility). The\n // wrapper is there whenever the component has an envelope (unless the\n // component applies the envelope itself: a table row or cell cannot sit\n // in a span), whatever its values: a bound `hidden` that flips must not remount the component and\n // lose what the user typed into it. A component that is sent again with\n // an envelope added or removed does remount: a wrapper on every node\n // would break the stylesheet's child selectors (table rows and cells,\n // the last text of a spaceBetween row), and bound inputs keep their\n // values in the data model anyway.\n const hasEnvelope =\n properties.accessibility !== undefined &&\n definition.accessibility !== \"self\";\n return (\n <GenerativeUINodeContext.Provider value={nodeContext}>\n {hasEnvelope ? (\n <span\n data-a2ui-accessibility=\"\"\n style={ROOT_STYLE}\n {...wrapperAria(accessibilityAttributes(accessibility))}\n >\n {rendered}\n </span>\n ) : (\n rendered\n )}\n </GenerativeUINodeContext.Provider>\n );\n}\n","import React, {\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n} from \"react\";\nimport type { ComponentType, ReactNode } from \"react\";\nimport * as z from \"zod\";\nimport {\n GENERATIVE_UI_ACTIVITY_TYPE,\n GENERATIVE_UI_CHAT_TARGET,\n GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE,\n GENERATIVE_UI_RENDER_TOOL,\n} from \"@copilotkit/shared\";\nimport type {\n GenerativeUIRejectedOperation,\n GenerativeUISurfaceContent,\n} from \"@copilotkit/shared\";\n// From ../context, not the provider module: the provider imports this file.\nimport { useCopilotKit } from \"../context\";\nimport { useCopilotChatConfiguration } from \"../providers/CopilotChatConfigurationProvider\";\nimport { defineToolCallRenderer } from \"../types/defineToolCallRenderer\";\nimport type { ReactActivityMessageRenderer } from \"../types/react-activity-message-renderer\";\nimport { useManagerVersion } from \"./hooks\";\nimport { useGenerativeUIRuntime } from \"./runtime-context\";\nimport { SurfaceView } from \"./SurfaceView\";\n\nexport interface GenerativeUIChatSurfaceProps {\n surfaceId: string;\n isStreaming: boolean;\n /**\n * Set when operations from the latest render_ui call were rejected. The\n * message is user-facing; `error.cause` holds the same list as `rejected`.\n */\n error?: Error;\n /** Rejected operations from the latest render_ui call, with validator reasons. */\n rejected: GenerativeUIRejectedOperation[];\n children: ReactNode;\n}\n\nexport const GenerativeUIChatSlotContext = createContext<\n ComponentType<GenerativeUIChatSurfaceProps> | undefined\n>(undefined);\n\nexport function DefaultGenerativeUIChatCard({\n surfaceId,\n error,\n children,\n}: GenerativeUIChatSurfaceProps) {\n return (\n <div\n data-generative-ui-chat-surface={surfaceId}\n className=\"cpk-generative-ui-chat-card\"\n >\n {children}\n {error && (\n <div role=\"alert\" className=\"cpk-generative-ui-chat-card-error\">\n Part of this UI couldn't be shown.\n </div>\n )}\n </div>\n );\n}\n\nconst ContentSchema = z\n .object({\n surfaceId: z.string(),\n target: z.string(),\n catalogId: z.string(),\n operations: z.array(z.any()),\n status: z.enum([\"streaming\", \"ready\", \"error\"]),\n rejected: z\n .array(z.object({ index: z.number(), reason: z.string() }))\n .default([]),\n })\n .loose();\n\nfunction GenerativeUIChatActivity({\n content,\n agent,\n}: {\n content: GenerativeUISurfaceContent;\n agent: { threadId?: string; agentId?: string } | undefined;\n}) {\n const runtime = useGenerativeUIRuntime();\n const threadId = useCopilotChatConfiguration()?.threadId ?? agent?.threadId;\n const Wrapper =\n useContext(GenerativeUIChatSlotContext) ?? DefaultGenerativeUIChatCard;\n useManagerVersion(runtime);\n useLayoutEffect(() => {\n if (runtime && threadId)\n runtime.manager.ingest(threadId, agent?.agentId, content);\n }, [runtime, threadId, agent?.agentId, content]);\n\n if (!runtime || !threadId || content.target !== GENERATIVE_UI_CHAT_TARGET)\n return null;\n // A surface whose createSurface was rejected shows only the error.\n const surface =\n runtime.manager.getSurface(threadId, content.surfaceId) ??\n runtime.manager.getFailedSurface(threadId, content.surfaceId);\n if (!surface) return null;\n // Both lists cover only the latest render_ui call (see the manager's ingest).\n // Custom wrappers get the detailed reasons (`rejected`, `error.cause`), and\n // client-side ones also reach `errorBoundary.onError`; the default card\n // shows a generic message.\n const rejected = [...(content.rejected ?? []), ...surface.clientRejected];\n const error = rejected.length\n ? new Error(`${rejected.length} UI update(s) could not be shown`, {\n cause: rejected,\n })\n : undefined;\n return (\n <Wrapper\n surfaceId={content.surfaceId}\n isStreaming={content.status === \"streaming\"}\n error={error}\n rejected={rejected}\n >\n {surface.failed ? null : <SurfaceView surface={surface} />}\n </Wrapper>\n );\n}\n\nexport function createGenerativeUIActivityRenderer(): ReactActivityMessageRenderer<GenerativeUISurfaceContent> {\n return {\n activityType: GENERATIVE_UI_ACTIVITY_TYPE,\n content:\n ContentSchema as unknown as ReactActivityMessageRenderer<GenerativeUISurfaceContent>[\"content\"],\n render:\n GenerativeUIChatActivity as ReactActivityMessageRenderer<GenerativeUISurfaceContent>[\"render\"],\n };\n}\n\n/**\n * Shows nothing in the chat for an agent-called function. The root reads the\n * function-call activities from the messages and runs them. This renderer\n * only keeps a wildcard (\"*\") activity renderer from showing them.\n */\nexport function createGenerativeUIFunctionCallActivityRenderer(): ReactActivityMessageRenderer<unknown> {\n return {\n activityType: GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE,\n content: z.unknown(),\n render: () => null,\n };\n}\n\n/** Hides the raw `render_ui` tool call; the surface activity owns the UX. */\nexport function GenerativeUIToolCallRenderer(): null {\n const { copilotkit } = useCopilotKit();\n useEffect(() => {\n const renderer = defineToolCallRenderer({\n name: GENERATIVE_UI_RENDER_TOOL,\n args: z.any(),\n render: () => <></>,\n });\n // Built-in: app renderers win over it, and it goes when the feature does.\n return copilotkit.ɵaddBuiltInRenderToolCall(renderer);\n }, [copilotkit]);\n return null;\n}\n","\"use client\";\n\nimport React from \"react\";\nimport { StreamingMarkdownDefaultRenderer } from \"../../components/chat/StreamingMarkdownDefaultRenderer\";\nimport { isReactComponentType } from \"../../lib/slots\";\nimport { useMarkdownRenderer } from \"../../providers/MarkdownRendererContext\";\nimport type {\n DefaultMarkdownRendererProps,\n MarkdownRendererProps,\n} from \"../../providers/MarkdownRendererContext\";\n\n/**\n * Markdown prose inside generative UI, rendered like the chat text around\n * it: the renderer set on the provider when there is one, else the built-in\n * streaming renderer. Config passed here wins over provider config.\n */\nexport function ProviderMarkdown({\n content,\n isStreaming,\n className,\n ...config\n}: MarkdownRendererProps & DefaultMarkdownRendererProps) {\n const renderer = useMarkdownRenderer();\n if (renderer && isReactComponentType(renderer)) {\n const Renderer = renderer;\n return (\n <Renderer\n content={content}\n isStreaming={isStreaming}\n className={className}\n />\n );\n }\n return (\n <StreamingMarkdownDefaultRenderer\n {...(renderer as DefaultMarkdownRendererProps | undefined)}\n {...config}\n content={content}\n isStreaming={isStreaming}\n className={className}\n />\n );\n}\n","import React, { useContext, useInsertionEffect, useMemo } from \"react\";\nimport type { ComponentType } from \"react\";\nimport { splitA2UIMarkdown } from \"@copilotkit/core\";\nimport { GENERATIVE_UI_ROOT_ID } from \"@copilotkit/shared\";\nimport { useCopilotChatConfiguration } from \"../../providers/CopilotChatConfigurationProvider\";\nimport { GenerativeUIChatSlotContext } from \"../chat\";\nimport type { GenerativeUIChatSurfaceProps } from \"../chat\";\nimport { useManagerVersion } from \"../hooks\";\nimport { useRequiredGenerativeUIRuntime } from \"../runtime-context\";\nimport type { GenerativeUIRuntime } from \"../runtime-context\";\nimport { SurfaceView } from \"../SurfaceView\";\nimport type { DefaultMarkdownRendererProps } from \"../../providers/MarkdownRendererContext\";\nimport { ProviderMarkdown } from \"./ProviderMarkdown\";\nimport { getMarkdownSurfaceSource } from \"@copilotkit/core/generative-ui\";\nimport type { MarkdownFenceBlock } from \"@copilotkit/core/generative-ui\";\n\n/** Config for the built-in markdown renderer, plus `className`. */\ntype MarkdownProps = DefaultMarkdownRendererProps;\n\nconst FADE_STYLE_ID = \"a2ui-markdown-fade\";\n/**\n * Components fade in as they stream: each element that appears under a\n * markdown surface runs the keyframes once on mount. React keeps the keys\n * stable per component id, so an element that is already there never\n * animates again. SVG internals are left out: a chart library re-creates\n * its nodes on each render, and a fade on each of them would read as the\n * chart flashing whenever a sibling arrives. The fade runs under reduced\n * motion too, because it moves nothing.\n */\nconst FADE_CSS = [\n // Opacity only, so it also runs when the user asks for reduced motion:\n // that setting is about movement, and a short fade is not movement.\n // The keyframes give only the start, so each element fades to its own\n // opacity (a disabled control to its dimmed one), and no fill holds the\n // end: a finished fade must not pin opacity, or an element that hides\n // itself with opacity (the map's zoom hint) stays visible forever.\n \"@keyframes a2ui-fade-in{from{opacity:0}}\",\n \"[data-a2ui-markdown-surface] .a2ui-surface *:not(svg):not(svg *){animation:a2ui-fade-in .35s ease-out backwards}\",\n].join(\"\\n\");\n\n// There is no document on the server, so nothing is added there.\nconst noEffect: typeof useInsertionEffect = () => {};\nconst useInjectEffect =\n typeof document === \"undefined\" ? noEffect : useInsertionEffect;\n\nfunction useFadeStyles() {\n useInjectEffect(() => {\n if (document.getElementById(FADE_STYLE_ID)) return;\n const style = document.createElement(\"style\");\n style.id = FADE_STYLE_ID;\n style.textContent = FADE_CSS;\n document.head.appendChild(style);\n }, []);\n}\n\n/**\n * The default wrapper of a chat surface in the markdown transport. It draws\n * no box: a surface sits in the flow of the reply like a paragraph, and a\n * Card draws its own box when it is interactive. Nothing shows while the\n * surface streams. A rejected operation gets one line.\n */\nexport function DefaultMarkdownChatSurface({\n surfaceId,\n error,\n children,\n}: GenerativeUIChatSurfaceProps) {\n useFadeStyles();\n return (\n <div\n data-generative-ui-chat-surface={surfaceId}\n data-a2ui-markdown-surface={surfaceId}\n className=\"cpk-markdown-chat-surface\"\n >\n {children}\n {error && (\n <div role=\"alert\" className=\"cpk-markdown-chat-surface-error\">\n Part of this UI couldn't be shown.\n </div>\n )}\n </div>\n );\n}\n\nexport type MarkdownSurfacesProps = MarkdownProps & {\n /** The text of the assistant message, complete or still streaming. */\n content: string;\n /** The id of the message. The fences of the message are found by it. */\n messageId: string;\n /** Whether the message is still streaming. Only its last prose shows the caret. */\n isStreaming?: boolean;\n};\n\n/**\n * One chat surface in the chat wrapper. Nothing renders until the surface\n * has its root component, so a half-streamed fence shows no empty card.\n */\nfunction ChatSurface({\n runtime,\n threadId,\n surfaceId,\n Wrapper,\n}: {\n runtime: GenerativeUIRuntime;\n threadId: string;\n surfaceId: string;\n Wrapper: ComponentType<GenerativeUIChatSurfaceProps>;\n}) {\n // A surface whose createSurface was rejected shows only the error.\n const surface =\n runtime.manager.getSurface(threadId, surfaceId) ??\n runtime.manager.getFailedSurface(threadId, surfaceId);\n const root = surface?.model.componentsModel.get(GENERATIVE_UI_ROOT_ID);\n if (!surface || (!root && !surface.failed)) return null;\n const rejected = [...surface.serverRejected, ...surface.clientRejected];\n const error = rejected.length\n ? new Error(`${rejected.length} UI update(s) could not be shown`, {\n cause: rejected,\n })\n : undefined;\n return (\n <Wrapper\n surfaceId={surfaceId}\n isStreaming={surface.status === \"streaming\"}\n error={error}\n rejected={rejected}\n >\n {surface.failed ? null : <SurfaceView surface={surface} />}\n </Wrapper>\n );\n}\n\n/** The blocks of one fence: lifted prose and chat surfaces, in order. */\nfunction FenceBlocks({\n blocks,\n runtime,\n threadId,\n isStreaming,\n markdownProps,\n}: {\n blocks: MarkdownFenceBlock[];\n runtime: GenerativeUIRuntime;\n threadId: string;\n isStreaming: boolean;\n markdownProps: MarkdownProps;\n}) {\n const Wrapper =\n useContext(GenerativeUIChatSlotContext) ?? DefaultMarkdownChatSurface;\n let surfaceCount = 0;\n return (\n <>\n {blocks.map((block, index) => {\n // Keys follow the surfaces, so a surface keeps its element when\n // prose splits off around it during streaming.\n if (block.kind === \"markdown\") {\n return (\n <ProviderMarkdown\n key={`md-${surfaceCount}`}\n {...markdownProps}\n content={block.markdown}\n isStreaming={isStreaming && index === blocks.length - 1}\n />\n );\n }\n surfaceCount++;\n return (\n <ChatSurface\n key={block.surfaceId}\n runtime={runtime}\n threadId={threadId}\n surfaceId={block.surfaceId}\n Wrapper={Wrapper}\n />\n );\n })}\n </>\n );\n}\n\n/**\n * Experimental. Renders an assistant message of the markdown transport.\n * Prose renders as markdown. In place of each ```a2ui fence:\n *\n * - the fence that created a chat surface renders that surface (and the\n * prose lifted out of it) in the chat wrapper;\n * - every other fence renders nothing: a fence that updates the surface of\n * an earlier fence, or a fence for a named target, which\n * `<GenerativeUISurface id>` renders.\n *\n * Use it inside `<CopilotKitProvider generativeUI={{ ui, transport: \"markdown\" }}>`.\n * `CopilotChatAssistantMessage` uses it there on its own.\n *\n * @example\n * ```tsx\n * <MarkdownSurfaces content={message.content} messageId={message.id} />\n * ```\n */\nexport function MarkdownSurfaces({\n content,\n messageId,\n isStreaming = false,\n ...markdownProps\n}: MarkdownSurfacesProps) {\n const runtime = useRequiredGenerativeUIRuntime();\n const chatThreadId = useCopilotChatConfiguration()?.threadId;\n useManagerVersion(runtime);\n const segments = useMemo(() => splitA2UIMarkdown(content), [content]);\n const threadId = chatThreadId ?? runtime.manager.getActiveThread();\n const source = getMarkdownSurfaceSource(runtime);\n\n return (\n <>\n {segments.map((segment, index) => {\n const isLast = index === segments.length - 1;\n if (segment.type === \"markdown\") {\n return (\n <ProviderMarkdown\n key={`md-${index}`}\n {...markdownProps}\n content={segment.text}\n isStreaming={isStreaming && isLast}\n />\n );\n }\n const blocks = threadId\n ? source.getFenceBlocks(threadId, messageId, segment.index)\n : undefined;\n if (!threadId || !blocks) return null;\n return (\n <FenceBlocks\n key={`a2ui-${segment.index}`}\n blocks={blocks}\n runtime={runtime}\n threadId={threadId}\n isStreaming={isStreaming && isLast}\n markdownProps={markdownProps}\n />\n );\n })}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,iCAAiC,EAC/C,SACA,aACA,WACA,eACA,OACA,SACA,aACA,mBACuD;AACvD,KAAI,CAAC,QAAS,QAAO;AAGrB,+BAA8B,QAAQ;AACtC,QACE,oBAAC;EACY;EACX,YAAY,CAAC;EACb,OAAO,SAAS,CAAC,CAAC;EACH;EACf,gBAAgB;EACP;EACI;EACI;YAEhB;GACyB;;AAIhC,iCAAiC,cAC/B;;;;;ACvCF,SAAS,kBAAkB,YAA8C;AACvE,QAAO,OAAO,YACZ,OAAO,QAAQ,WAAW,CAAC,KAAK,CAAC,KAAK,WAAW,CAC/C,IAAI,QAAQ,cAAc,QAAQ,WAChC,OAAO,aAAa,CACrB,EACD,MACD,CAAC,CACH;;AAGH,MAAM,cAAc,kBAAkB,0BAA0B;;AAGhE,SAAS,kBAAkB,OAAe;AACxC,QAAO,OAAO,KAAK,MAAM,CAAC,MACvB,QAAQ,IAAI,WAAW,QAAQ,IAAI,QAAQ,UAAU,QAAQ,QAC/D;;;;;;;AAsBH,MAAa,UAAU,WAAwC,SAAS,QACtE,EACE,YACA,OACA,OAAO,IACP,QAAQ,gBACR,cAAc,GACd,WACA,UACA,GAAG,SAEL,KACA;CACA,MAAM,eAAe,CAAC,YAAY,CAAC,kBAAkB,MAAM;AAC3D,QACE,qBAAC;EACM;EACL,GAAI;EACJ,OAAO;EACP,QAAQ;EACR,QAAQ;EACK;EACb,WAAW,GAAG,UAAU,UAAU,cAAc,UAAU;EAC1D,eAAa,gBAAgB;EAC7B,GAAI;aAEH,MAAM,KAAK,MAAM,UAChB,cAAc,KAAK,KAAK;GAAE,KAAK;GAAO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