@copilotkit/react-core 1.85.0 → 1.87.0

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.
Files changed (69) hide show
  1. package/dist/MarkdownSurfaces-BCVdnDAk.cjs +161 -0
  2. package/dist/MarkdownSurfaces-BCVdnDAk.cjs.map +1 -0
  3. package/dist/MarkdownSurfaces-CjJduaJR.mjs +149 -0
  4. package/dist/MarkdownSurfaces-CjJduaJR.mjs.map +1 -0
  5. package/dist/{MarkdownSurfaces-3cGU5_0H.cjs → chat-BnsrQ0VS.cjs} +667 -320
  6. package/dist/chat-BnsrQ0VS.cjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-D-W4f9Dy.mjs → chat-IWySXWXP.mjs} +647 -312
  8. package/dist/chat-IWySXWXP.mjs.map +1 -0
  9. package/dist/{copilotkit-Dn4PbHJV.d.mts → copilotkit-BNPEXnEE.d.mts} +11 -6
  10. package/dist/{copilotkit-Dn4PbHJV.d.mts.map → copilotkit-BNPEXnEE.d.mts.map} +1 -1
  11. package/dist/{copilotkit-CuTAoQF2.d.cts → copilotkit-Bop-sY6y.d.cts} +9 -4
  12. package/dist/{copilotkit-CuTAoQF2.d.cts.map → copilotkit-Bop-sY6y.d.cts.map} +1 -1
  13. package/dist/{copilotkit-BpKHgURs.cjs → copilotkit-CZ9tI_J1.cjs} +203 -452
  14. package/dist/copilotkit-CZ9tI_J1.cjs.map +1 -0
  15. package/dist/{copilotkit-D6mTCuNU.mjs → copilotkit-ChqQa52S.mjs} +131 -380
  16. package/dist/{copilotkit-BpKHgURs.cjs.map → copilotkit-ChqQa52S.mjs.map} +1 -1
  17. package/dist/hooks-CEFWIeKR.d.cts +89 -0
  18. package/dist/hooks-CEFWIeKR.d.cts.map +1 -0
  19. package/dist/hooks-DFgYRjj3.d.mts +89 -0
  20. package/dist/hooks-DFgYRjj3.d.mts.map +1 -0
  21. package/dist/index.cjs +8 -8
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.mts +2 -2
  25. package/dist/index.mjs +2 -2
  26. package/dist/index.umd.js +769 -165
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/refs-DL7ITFFD.cjs +43 -0
  29. package/dist/refs-DL7ITFFD.cjs.map +1 -0
  30. package/dist/refs-DiZXJ63p.mjs +31 -0
  31. package/dist/refs-DiZXJ63p.mjs.map +1 -0
  32. package/dist/{runtime-context-Er5UIbZA.d.mts → runtime-context-B4fKyzo6.d.mts} +31 -9
  33. package/dist/runtime-context-B4fKyzo6.d.mts.map +1 -0
  34. package/dist/{runtime-context-DrVNUYLi.d.cts → runtime-context-Da7T5vy4.d.cts} +31 -9
  35. package/dist/runtime-context-Da7T5vy4.d.cts.map +1 -0
  36. package/dist/use-generative-ui-root-CaTyBFNR.cjs +390 -0
  37. package/dist/use-generative-ui-root-CaTyBFNR.cjs.map +1 -0
  38. package/dist/use-generative-ui-root-WI9ERMpo.mjs +385 -0
  39. package/dist/use-generative-ui-root-WI9ERMpo.mjs.map +1 -0
  40. package/dist/v2/generative-ui/native.cjs +66 -0
  41. package/dist/v2/generative-ui/native.cjs.map +1 -0
  42. package/dist/v2/generative-ui/native.d.cts +155 -0
  43. package/dist/v2/generative-ui/native.d.cts.map +1 -0
  44. package/dist/v2/generative-ui/native.d.mts +155 -0
  45. package/dist/v2/generative-ui/native.d.mts.map +1 -0
  46. package/dist/v2/generative-ui/native.mjs +24 -0
  47. package/dist/v2/generative-ui/native.mjs.map +1 -0
  48. package/dist/v2/generative-ui.cjs +45 -70
  49. package/dist/v2/generative-ui.cjs.map +1 -1
  50. package/dist/v2/generative-ui.d.cts +378 -457
  51. package/dist/v2/generative-ui.d.cts.map +1 -1
  52. package/dist/v2/generative-ui.d.mts +378 -457
  53. package/dist/v2/generative-ui.d.mts.map +1 -1
  54. package/dist/v2/generative-ui.mjs +4 -29
  55. package/dist/v2/generative-ui.mjs.map +1 -1
  56. package/dist/v2/headless.d.cts +185 -294
  57. package/dist/v2/headless.d.cts.map +1 -1
  58. package/dist/v2/index.cjs +5 -5
  59. package/dist/v2/index.d.cts +2 -2
  60. package/dist/v2/index.d.mts +2 -2
  61. package/dist/v2/index.mjs +2 -2
  62. package/dist/v2/index.umd.js +769 -165
  63. package/dist/v2/index.umd.js.map +1 -1
  64. package/package.json +14 -10
  65. package/dist/MarkdownSurfaces-3cGU5_0H.cjs.map +0 -1
  66. package/dist/MarkdownSurfaces-D-W4f9Dy.mjs.map +0 -1
  67. package/dist/copilotkit-D6mTCuNU.mjs.map +0 -1
  68. package/dist/runtime-context-DrVNUYLi.d.cts.map +0 -1
  69. package/dist/runtime-context-Er5UIbZA.d.mts.map +0 -1
@@ -0,0 +1,161 @@
1
+ const require_chat = require('./chat-BnsrQ0VS.cjs');
2
+ let react = require("react");
3
+ react = require_chat.__toESM(react);
4
+ let _copilotkit_core = require("@copilotkit/core");
5
+ let _copilotkit_shared = require("@copilotkit/shared");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let streamdown = require("streamdown");
8
+ let _copilotkit_core_generative_ui = require("@copilotkit/core/generative-ui");
9
+
10
+ //#region src/v2/hooks/useKatexStyles.ts
11
+ let injected = false;
12
+ /**
13
+ * Dynamically injects KaTeX CSS at runtime to avoid the Next.js
14
+ * "Global CSS cannot be imported from within node_modules" build error.
15
+ *
16
+ * Uses a singleton flag so the stylesheet is only injected once.
17
+ */
18
+ function useKatexStyles() {
19
+ (0, react.useEffect)(() => {
20
+ if (injected || typeof document === "undefined") return;
21
+ injected = true;
22
+ import("katex/dist/katex.min.css").catch(() => {
23
+ console.warn("[CopilotKit] Failed to load katex styles — math content may render without formatting");
24
+ });
25
+ }, []);
26
+ }
27
+
28
+ //#endregion
29
+ //#region src/v2/generative-ui/markdown/MarkdownSurfaces.tsx
30
+ const FADE_STYLE_ID = "a2ui-markdown-fade";
31
+ /**
32
+ * Components fade in as they stream: each element that appears under a
33
+ * markdown surface runs the keyframes once on mount. React keeps the keys
34
+ * stable per component id, so an element that is already there never
35
+ * animates again. SVG internals are left out: a chart library re-creates
36
+ * its nodes on each render, and a fade on each of them would read as the
37
+ * chart flashing whenever a sibling arrives. The fade runs under reduced
38
+ * motion too, because it moves nothing.
39
+ */
40
+ const FADE_CSS = ["@keyframes a2ui-fade-in{from{opacity:0}}", "[data-a2ui-markdown-surface] .a2ui-surface *:not(svg):not(svg *){animation:a2ui-fade-in .35s ease-out backwards}"].join("\n");
41
+ const noEffect = () => {};
42
+ const useInjectEffect = typeof document === "undefined" ? noEffect : react.useInsertionEffect;
43
+ function useFadeStyles() {
44
+ useInjectEffect(() => {
45
+ if (document.getElementById(FADE_STYLE_ID)) return;
46
+ const style = document.createElement("style");
47
+ style.id = FADE_STYLE_ID;
48
+ style.textContent = FADE_CSS;
49
+ document.head.appendChild(style);
50
+ }, []);
51
+ }
52
+ /**
53
+ * The default wrapper of a chat surface in the markdown transport. It draws
54
+ * no box: a surface sits in the flow of the reply like a paragraph, and a
55
+ * Card draws its own box when it is interactive. Nothing shows while the
56
+ * surface streams. A rejected operation gets one line.
57
+ */
58
+ function DefaultMarkdownChatSurface({ surfaceId, error, children }) {
59
+ useFadeStyles();
60
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
61
+ "data-generative-ui-chat-surface": surfaceId,
62
+ "data-a2ui-markdown-surface": surfaceId,
63
+ className: "cpk:relative cpk:my-4 cpk:flex cpk:w-full cpk:min-w-0 cpk:max-w-full cpk:flex-col",
64
+ children: [children, error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
65
+ role: "alert",
66
+ className: "cpk:mt-2 cpk:text-xs cpk:text-red-600",
67
+ children: "Part of this UI couldn't be shown."
68
+ })]
69
+ });
70
+ }
71
+ /**
72
+ * One chat surface in the chat wrapper. Nothing renders until the surface
73
+ * has its root component, so a half-streamed fence shows no empty card.
74
+ */
75
+ function ChatSurface({ runtime, threadId, surfaceId, Wrapper }) {
76
+ const surface = runtime.manager.getSurface(threadId, surfaceId) ?? runtime.manager.getFailedSurface(threadId, surfaceId);
77
+ const root = surface?.model.componentsModel.get(_copilotkit_shared.GENERATIVE_UI_ROOT_ID);
78
+ if (!surface || !root && !surface.failed) return null;
79
+ const rejected = [...surface.serverRejected, ...surface.clientRejected];
80
+ const error = rejected.length ? new Error(`${rejected.length} UI update(s) could not be shown`, { cause: rejected }) : void 0;
81
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Wrapper, {
82
+ surfaceId,
83
+ isStreaming: surface.status === "streaming",
84
+ error,
85
+ rejected,
86
+ children: surface.failed ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.SurfaceView, { surface })
87
+ });
88
+ }
89
+ /** The blocks of one fence: lifted prose and chat surfaces, in order. */
90
+ function FenceBlocks({ blocks, runtime, threadId, markdownProps }) {
91
+ const Wrapper = (0, react.useContext)(require_chat.GenerativeUIChatSlotContext) ?? DefaultMarkdownChatSurface;
92
+ let surfaceCount = 0;
93
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: blocks.map((block) => {
94
+ if (block.kind === "markdown") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
95
+ ...markdownProps,
96
+ children: block.markdown
97
+ }, `md-${surfaceCount}`);
98
+ surfaceCount++;
99
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChatSurface, {
100
+ runtime,
101
+ threadId,
102
+ surfaceId: block.surfaceId,
103
+ Wrapper
104
+ }, block.surfaceId);
105
+ }) });
106
+ }
107
+ /**
108
+ * Experimental. Renders an assistant message of the markdown transport.
109
+ * Prose renders as markdown. In place of each ```a2ui fence:
110
+ *
111
+ * - the fence that created a chat surface renders that surface (and the
112
+ * prose lifted out of it) in the chat wrapper;
113
+ * - every other fence renders nothing: a fence that updates the surface of
114
+ * an earlier fence, or a fence for a named target, which
115
+ * `<GenerativeUISurface id>` renders.
116
+ *
117
+ * Use it inside `<CopilotKitProvider generativeUI={{ ui, transport: "markdown" }}>`.
118
+ * `CopilotChatAssistantMessage` uses it there on its own.
119
+ *
120
+ * @example
121
+ * ```tsx
122
+ * <MarkdownSurfaces content={message.content} messageId={message.id} />
123
+ * ```
124
+ */
125
+ function MarkdownSurfaces({ content, messageId, ...markdownProps }) {
126
+ const runtime = require_chat.useRequiredGenerativeUIRuntime();
127
+ const chatThreadId = require_chat.useCopilotChatConfiguration()?.threadId;
128
+ require_chat.useManagerVersion(runtime);
129
+ const segments = (0, react.useMemo)(() => (0, _copilotkit_core.splitA2UIMarkdown)(content), [content]);
130
+ const threadId = chatThreadId ?? runtime.manager.getActiveThread();
131
+ const source = (0, _copilotkit_core_generative_ui.getMarkdownSurfaceSource)(runtime);
132
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: segments.map((segment, index) => {
133
+ if (segment.type === "markdown") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
134
+ ...markdownProps,
135
+ children: segment.text
136
+ }, `md-${index}`);
137
+ const blocks = threadId ? source.getFenceBlocks(threadId, messageId, segment.index) : void 0;
138
+ if (!threadId || !blocks) return null;
139
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FenceBlocks, {
140
+ blocks,
141
+ runtime,
142
+ threadId,
143
+ markdownProps
144
+ }, `a2ui-${segment.index}`);
145
+ }) });
146
+ }
147
+
148
+ //#endregion
149
+ Object.defineProperty(exports, 'MarkdownSurfaces', {
150
+ enumerable: true,
151
+ get: function () {
152
+ return MarkdownSurfaces;
153
+ }
154
+ });
155
+ Object.defineProperty(exports, 'useKatexStyles', {
156
+ enumerable: true,
157
+ get: function () {
158
+ return useKatexStyles;
159
+ }
160
+ });
161
+ //# sourceMappingURL=MarkdownSurfaces-BCVdnDAk.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownSurfaces-BCVdnDAk.cjs","names":["useInsertionEffect","GENERATIVE_UI_ROOT_ID","SurfaceView","GenerativeUIChatSlotContext","Streamdown","useRequiredGenerativeUIRuntime","useCopilotChatConfiguration"],"sources":["../src/v2/hooks/useKatexStyles.ts","../src/v2/generative-ui/markdown/MarkdownSurfaces.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\n\nlet injected = false;\n\n/**\n * Dynamically injects KaTeX CSS at runtime to avoid the Next.js\n * \"Global CSS cannot be imported from within node_modules\" build error.\n *\n * Uses a singleton flag so the stylesheet is only injected once.\n */\nexport function useKatexStyles(): void {\n useEffect(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n\n // Dynamic import defers CSS loading to runtime, bypassing\n // Next.js static analysis that rejects global CSS from node_modules.\n\n void import(\"katex/dist/katex.min.css\").catch(() => {\n console.warn(\n \"[CopilotKit] Failed to load katex styles — math content may render without formatting\",\n );\n });\n }, []);\n}\n","import React, { useContext, useInsertionEffect, useMemo } from \"react\";\nimport type { ComponentProps, ComponentType } from \"react\";\nimport { Streamdown } from \"streamdown\";\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 { getMarkdownSurfaceSource } from \"@copilotkit/core/generative-ui\";\nimport type { MarkdownFenceBlock } from \"@copilotkit/core/generative-ui\";\n\ntype MarkdownProps = Omit<ComponentProps<typeof Streamdown>, \"children\">;\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:relative cpk:my-4 cpk:flex cpk:w-full cpk:min-w-0 cpk:max-w-full cpk:flex-col\"\n >\n {children}\n {error && (\n <div role=\"alert\" className=\"cpk:mt-2 cpk:text-xs cpk:text-red-600\">\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};\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 markdownProps,\n}: {\n blocks: MarkdownFenceBlock[];\n runtime: GenerativeUIRuntime;\n threadId: string;\n markdownProps: MarkdownProps;\n}) {\n const Wrapper =\n useContext(GenerativeUIChatSlotContext) ?? DefaultMarkdownChatSurface;\n let surfaceCount = 0;\n return (\n <>\n {blocks.map((block) => {\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 <Streamdown key={`md-${surfaceCount}`} {...markdownProps}>\n {block.markdown}\n </Streamdown>\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 ...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 if (segment.type === \"markdown\") {\n return (\n <Streamdown key={`md-${index}`} {...markdownProps}>\n {segment.text}\n </Streamdown>\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 markdownProps={markdownProps}\n />\n );\n })}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAI,WAAW;;;;;;;AAQf,SAAgB,iBAAuB;AACrC,4BAAgB;AACd,MAAI,YAAY,OAAO,aAAa,YAAa;AACjD,aAAW;AAKX,EAAK,OAAO,4BAA4B,YAAY;AAClD,WAAQ,KACN,wFACD;IACD;IACD,EAAE,CAAC;;;;;ACRR,MAAM,gBAAgB;;;;;;;;;;AAUtB,MAAM,WAAW,CAOf,4CACA,mHACD,CAAC,KAAK,KAAK;AAGZ,MAAM,iBAA4C;AAClD,MAAM,kBACJ,OAAO,aAAa,cAAc,WAAWA;AAE/C,SAAS,gBAAgB;AACvB,uBAA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gB,iBAAiB,EAC/B,SACA,WACA,GAAG,iBACqB;CACxB,MAAM,UAAUC,6CAAgC;CAChD,MAAM,eAAeC,0CAA6B,EAAE;AACpD,gCAAkB,QAAQ;CAC1B,MAAM,4EAA2C,QAAQ,EAAE,CAAC,QAAQ,CAAC;CACrE,MAAM,WAAW,gBAAgB,QAAQ,QAAQ,iBAAiB;CAClE,MAAM,sEAAkC,QAAQ;AAEhD,QACE,mFACG,SAAS,KAAK,SAAS,UAAU;AAChC,MAAI,QAAQ,SAAS,WACnB,QACE,2CAACF;GAA+B,GAAI;aACjC,QAAQ;KADM,MAAM,QAEV;EAGjB,MAAM,SAAS,WACX,OAAO,eAAe,UAAU,WAAW,QAAQ,MAAM,GACzD;AACJ,MAAI,CAAC,YAAY,CAAC,OAAQ,QAAO;AACjC,SACE,2CAAC;GAES;GACC;GACC;GACK;KAJV,QAAQ,QAAQ,QAKrB;GAEJ,GACD"}
@@ -0,0 +1,149 @@
1
+ import { A as useCopilotChatConfiguration, T as useRequiredGenerativeUIRuntime, n as GenerativeUIChatSlotContext, o as SurfaceView, x as useManagerVersion } from "./chat-IWySXWXP.mjs";
2
+ import React, { useContext, useEffect, useInsertionEffect, useMemo } from "react";
3
+ import { splitA2UIMarkdown } from "@copilotkit/core";
4
+ import { GENERATIVE_UI_ROOT_ID } from "@copilotkit/shared";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Streamdown } from "streamdown";
7
+ import { getMarkdownSurfaceSource } from "@copilotkit/core/generative-ui";
8
+
9
+ //#region src/v2/hooks/useKatexStyles.ts
10
+ let injected = false;
11
+ /**
12
+ * Dynamically injects KaTeX CSS at runtime to avoid the Next.js
13
+ * "Global CSS cannot be imported from within node_modules" build error.
14
+ *
15
+ * Uses a singleton flag so the stylesheet is only injected once.
16
+ */
17
+ function useKatexStyles() {
18
+ useEffect(() => {
19
+ if (injected || typeof document === "undefined") return;
20
+ injected = true;
21
+ import("katex/dist/katex.min.css").catch(() => {
22
+ console.warn("[CopilotKit] Failed to load katex styles — math content may render without formatting");
23
+ });
24
+ }, []);
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/v2/generative-ui/markdown/MarkdownSurfaces.tsx
29
+ const FADE_STYLE_ID = "a2ui-markdown-fade";
30
+ /**
31
+ * Components fade in as they stream: each element that appears under a
32
+ * markdown surface runs the keyframes once on mount. React keeps the keys
33
+ * stable per component id, so an element that is already there never
34
+ * animates again. SVG internals are left out: a chart library re-creates
35
+ * its nodes on each render, and a fade on each of them would read as the
36
+ * chart flashing whenever a sibling arrives. The fade runs under reduced
37
+ * motion too, because it moves nothing.
38
+ */
39
+ const FADE_CSS = ["@keyframes a2ui-fade-in{from{opacity:0}}", "[data-a2ui-markdown-surface] .a2ui-surface *:not(svg):not(svg *){animation:a2ui-fade-in .35s ease-out backwards}"].join("\n");
40
+ const noEffect = () => {};
41
+ const useInjectEffect = typeof document === "undefined" ? noEffect : useInsertionEffect;
42
+ function useFadeStyles() {
43
+ useInjectEffect(() => {
44
+ if (document.getElementById(FADE_STYLE_ID)) return;
45
+ const style = document.createElement("style");
46
+ style.id = FADE_STYLE_ID;
47
+ style.textContent = FADE_CSS;
48
+ document.head.appendChild(style);
49
+ }, []);
50
+ }
51
+ /**
52
+ * The default wrapper of a chat surface in the markdown transport. It draws
53
+ * no box: a surface sits in the flow of the reply like a paragraph, and a
54
+ * Card draws its own box when it is interactive. Nothing shows while the
55
+ * surface streams. A rejected operation gets one line.
56
+ */
57
+ function DefaultMarkdownChatSurface({ surfaceId, error, children }) {
58
+ useFadeStyles();
59
+ return /* @__PURE__ */ jsxs("div", {
60
+ "data-generative-ui-chat-surface": surfaceId,
61
+ "data-a2ui-markdown-surface": surfaceId,
62
+ className: "cpk:relative cpk:my-4 cpk:flex cpk:w-full cpk:min-w-0 cpk:max-w-full cpk:flex-col",
63
+ children: [children, error && /* @__PURE__ */ jsx("div", {
64
+ role: "alert",
65
+ className: "cpk:mt-2 cpk:text-xs cpk:text-red-600",
66
+ children: "Part of this UI couldn't be shown."
67
+ })]
68
+ });
69
+ }
70
+ /**
71
+ * One chat surface in the chat wrapper. Nothing renders until the surface
72
+ * has its root component, so a half-streamed fence shows no empty card.
73
+ */
74
+ function ChatSurface({ runtime, threadId, surfaceId, Wrapper }) {
75
+ const surface = runtime.manager.getSurface(threadId, surfaceId) ?? runtime.manager.getFailedSurface(threadId, surfaceId);
76
+ const root = surface?.model.componentsModel.get(GENERATIVE_UI_ROOT_ID);
77
+ if (!surface || !root && !surface.failed) return null;
78
+ const rejected = [...surface.serverRejected, ...surface.clientRejected];
79
+ const error = rejected.length ? new Error(`${rejected.length} UI update(s) could not be shown`, { cause: rejected }) : void 0;
80
+ return /* @__PURE__ */ jsx(Wrapper, {
81
+ surfaceId,
82
+ isStreaming: surface.status === "streaming",
83
+ error,
84
+ rejected,
85
+ children: surface.failed ? null : /* @__PURE__ */ jsx(SurfaceView, { surface })
86
+ });
87
+ }
88
+ /** The blocks of one fence: lifted prose and chat surfaces, in order. */
89
+ function FenceBlocks({ blocks, runtime, threadId, markdownProps }) {
90
+ const Wrapper = useContext(GenerativeUIChatSlotContext) ?? DefaultMarkdownChatSurface;
91
+ let surfaceCount = 0;
92
+ return /* @__PURE__ */ jsx(Fragment$1, { children: blocks.map((block) => {
93
+ if (block.kind === "markdown") return /* @__PURE__ */ jsx(Streamdown, {
94
+ ...markdownProps,
95
+ children: block.markdown
96
+ }, `md-${surfaceCount}`);
97
+ surfaceCount++;
98
+ return /* @__PURE__ */ jsx(ChatSurface, {
99
+ runtime,
100
+ threadId,
101
+ surfaceId: block.surfaceId,
102
+ Wrapper
103
+ }, block.surfaceId);
104
+ }) });
105
+ }
106
+ /**
107
+ * Experimental. Renders an assistant message of the markdown transport.
108
+ * Prose renders as markdown. In place of each ```a2ui fence:
109
+ *
110
+ * - the fence that created a chat surface renders that surface (and the
111
+ * prose lifted out of it) in the chat wrapper;
112
+ * - every other fence renders nothing: a fence that updates the surface of
113
+ * an earlier fence, or a fence for a named target, which
114
+ * `<GenerativeUISurface id>` renders.
115
+ *
116
+ * Use it inside `<CopilotKitProvider generativeUI={{ ui, transport: "markdown" }}>`.
117
+ * `CopilotChatAssistantMessage` uses it there on its own.
118
+ *
119
+ * @example
120
+ * ```tsx
121
+ * <MarkdownSurfaces content={message.content} messageId={message.id} />
122
+ * ```
123
+ */
124
+ function MarkdownSurfaces({ content, messageId, ...markdownProps }) {
125
+ const runtime = useRequiredGenerativeUIRuntime();
126
+ const chatThreadId = useCopilotChatConfiguration()?.threadId;
127
+ useManagerVersion(runtime);
128
+ const segments = useMemo(() => splitA2UIMarkdown(content), [content]);
129
+ const threadId = chatThreadId ?? runtime.manager.getActiveThread();
130
+ const source = getMarkdownSurfaceSource(runtime);
131
+ return /* @__PURE__ */ jsx(Fragment$1, { children: segments.map((segment, index) => {
132
+ if (segment.type === "markdown") return /* @__PURE__ */ jsx(Streamdown, {
133
+ ...markdownProps,
134
+ children: segment.text
135
+ }, `md-${index}`);
136
+ const blocks = threadId ? source.getFenceBlocks(threadId, messageId, segment.index) : void 0;
137
+ if (!threadId || !blocks) return null;
138
+ return /* @__PURE__ */ jsx(FenceBlocks, {
139
+ blocks,
140
+ runtime,
141
+ threadId,
142
+ markdownProps
143
+ }, `a2ui-${segment.index}`);
144
+ }) });
145
+ }
146
+
147
+ //#endregion
148
+ export { useKatexStyles as n, MarkdownSurfaces as t };
149
+ //# sourceMappingURL=MarkdownSurfaces-CjJduaJR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownSurfaces-CjJduaJR.mjs","names":[],"sources":["../src/v2/hooks/useKatexStyles.ts","../src/v2/generative-ui/markdown/MarkdownSurfaces.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\n\nlet injected = false;\n\n/**\n * Dynamically injects KaTeX CSS at runtime to avoid the Next.js\n * \"Global CSS cannot be imported from within node_modules\" build error.\n *\n * Uses a singleton flag so the stylesheet is only injected once.\n */\nexport function useKatexStyles(): void {\n useEffect(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n\n // Dynamic import defers CSS loading to runtime, bypassing\n // Next.js static analysis that rejects global CSS from node_modules.\n\n void import(\"katex/dist/katex.min.css\").catch(() => {\n console.warn(\n \"[CopilotKit] Failed to load katex styles — math content may render without formatting\",\n );\n });\n }, []);\n}\n","import React, { useContext, useInsertionEffect, useMemo } from \"react\";\nimport type { ComponentProps, ComponentType } from \"react\";\nimport { Streamdown } from \"streamdown\";\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 { getMarkdownSurfaceSource } from \"@copilotkit/core/generative-ui\";\nimport type { MarkdownFenceBlock } from \"@copilotkit/core/generative-ui\";\n\ntype MarkdownProps = Omit<ComponentProps<typeof Streamdown>, \"children\">;\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:relative cpk:my-4 cpk:flex cpk:w-full cpk:min-w-0 cpk:max-w-full cpk:flex-col\"\n >\n {children}\n {error && (\n <div role=\"alert\" className=\"cpk:mt-2 cpk:text-xs cpk:text-red-600\">\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};\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 markdownProps,\n}: {\n blocks: MarkdownFenceBlock[];\n runtime: GenerativeUIRuntime;\n threadId: string;\n markdownProps: MarkdownProps;\n}) {\n const Wrapper =\n useContext(GenerativeUIChatSlotContext) ?? DefaultMarkdownChatSurface;\n let surfaceCount = 0;\n return (\n <>\n {blocks.map((block) => {\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 <Streamdown key={`md-${surfaceCount}`} {...markdownProps}>\n {block.markdown}\n </Streamdown>\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 ...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 if (segment.type === \"markdown\") {\n return (\n <Streamdown key={`md-${index}`} {...markdownProps}>\n {segment.text}\n </Streamdown>\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 markdownProps={markdownProps}\n />\n );\n })}\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAIA,IAAI,WAAW;;;;;;;AAQf,SAAgB,iBAAuB;AACrC,iBAAgB;AACd,MAAI,YAAY,OAAO,aAAa,YAAa;AACjD,aAAW;AAKX,EAAK,OAAO,4BAA4B,YAAY;AAClD,WAAQ,KACN,wFACD;IACD;IACD,EAAE,CAAC;;;;;ACRR,MAAM,gBAAgB;;;;;;;;;;AAUtB,MAAM,WAAW,CAOf,4CACA,mHACD,CAAC,KAAK,KAAK;AAGZ,MAAM,iBAA4C;AAClD,MAAM,kBACJ,OAAO,aAAa,cAAc,WAAW;AAE/C,SAAS,gBAAgB;AACvB,uBAAsB;AACpB,MAAI,SAAS,eAAe,cAAc,CAAE;EAC5C,MAAM,QAAQ,SAAS,cAAc,QAAQ;AAC7C,QAAM,KAAK;AACX,QAAM,cAAc;AACpB,WAAS,KAAK,YAAY,MAAM;IAC/B,EAAE,CAAC;;;;;;;;AASR,SAAgB,2BAA2B,EACzC,WACA,OACA,YAC+B;AAC/B,gBAAe;AACf,QACE,qBAAC;EACC,mCAAiC;EACjC,8BAA4B;EAC5B,WAAU;aAET,UACA,SACC,oBAAC;G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