@copilotkit/react-core 1.83.0 → 2.0.0-rc.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 (75) hide show
  1. package/dist/{runtime-context-CrHq-iTf.d.mts → MarkdownRendererContext-B4Us6mwL.d.cts} +127 -97
  2. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +1 -0
  3. package/dist/{runtime-context-D3NcP9oE.d.cts → MarkdownRendererContext-CRKFzsEB.d.mts} +127 -97
  4. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +1 -0
  5. package/dist/{MarkdownSurfaces-FF5za2kU.cjs → MarkdownSurfaces-C2XZISKn.cjs} +203 -55
  6. package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-DGpjmPaB.mjs → MarkdownSurfaces-ChSlVYOk.mjs} +171 -47
  8. package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +1 -0
  9. package/dist/{v2/context.cjs → context.cjs} +2 -2
  10. package/dist/context.cjs.map +1 -0
  11. package/dist/{v2/context.d.cts → context.d.cts} +5 -5
  12. package/dist/context.d.cts.map +1 -0
  13. package/dist/{v2/context.d.mts → context.d.mts} +5 -5
  14. package/dist/context.d.mts.map +1 -0
  15. package/dist/{v2/context.mjs → context.mjs} +2 -2
  16. package/dist/context.mjs.map +1 -0
  17. package/dist/{v2/generative-ui.cjs → generative-ui.cjs} +40 -43
  18. package/dist/generative-ui.cjs.map +1 -0
  19. package/dist/{v2/generative-ui.d.cts → generative-ui.d.cts} +14 -12
  20. package/dist/generative-ui.d.cts.map +1 -0
  21. package/dist/{v2/generative-ui.d.mts → generative-ui.d.mts} +14 -12
  22. package/dist/generative-ui.d.mts.map +1 -0
  23. package/dist/{v2/generative-ui.mjs → generative-ui.mjs} +40 -43
  24. package/dist/generative-ui.mjs.map +1 -0
  25. package/dist/{v2/headless.cjs → headless.cjs} +68 -53
  26. package/dist/headless.cjs.map +1 -0
  27. package/dist/{v2/headless.d.cts → headless.d.cts} +24 -23
  28. package/dist/headless.d.cts.map +1 -0
  29. package/dist/{v2/headless.d.mts → headless.d.mts} +21 -20
  30. package/dist/headless.d.mts.map +1 -0
  31. package/dist/{v2/headless.mjs → headless.mjs} +51 -36
  32. package/dist/headless.mjs.map +1 -0
  33. package/dist/index.cjs +15391 -1862
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.css +2 -0
  36. package/dist/index.d.cts +3252 -1370
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.mts +3234 -1369
  39. package/dist/index.d.mts.map +1 -1
  40. package/dist/index.mjs +13733 -1815
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/index.umd.js +11944 -5481
  43. package/dist/index.umd.js.map +1 -1
  44. package/package.json +21 -30
  45. package/dist/MarkdownSurfaces-DGpjmPaB.mjs.map +0 -1
  46. package/dist/MarkdownSurfaces-FF5za2kU.cjs.map +0 -1
  47. package/dist/copilotkit-BuIuo-Z1.cjs +0 -16531
  48. package/dist/copilotkit-BuIuo-Z1.cjs.map +0 -1
  49. package/dist/copilotkit-C765tOUi.d.mts +0 -4112
  50. package/dist/copilotkit-C765tOUi.d.mts.map +0 -1
  51. package/dist/copilotkit-DyxwF9wL.mjs +0 -16025
  52. package/dist/copilotkit-DyxwF9wL.mjs.map +0 -1
  53. package/dist/copilotkit-wqaNanhw.d.cts +0 -4129
  54. package/dist/copilotkit-wqaNanhw.d.cts.map +0 -1
  55. package/dist/runtime-context-CrHq-iTf.d.mts.map +0 -1
  56. package/dist/runtime-context-D3NcP9oE.d.cts.map +0 -1
  57. package/dist/v2/context.cjs.map +0 -1
  58. package/dist/v2/context.d.cts.map +0 -1
  59. package/dist/v2/context.d.mts.map +0 -1
  60. package/dist/v2/context.mjs.map +0 -1
  61. package/dist/v2/generative-ui.cjs.map +0 -1
  62. package/dist/v2/generative-ui.d.cts.map +0 -1
  63. package/dist/v2/generative-ui.d.mts.map +0 -1
  64. package/dist/v2/generative-ui.mjs.map +0 -1
  65. package/dist/v2/headless.cjs.map +0 -1
  66. package/dist/v2/headless.d.cts.map +0 -1
  67. package/dist/v2/headless.d.mts.map +0 -1
  68. package/dist/v2/headless.mjs.map +0 -1
  69. package/dist/v2/index.cjs +0 -1635
  70. package/dist/v2/index.css +0 -2
  71. package/dist/v2/index.d.cts +0 -4
  72. package/dist/v2/index.d.mts +0 -4
  73. package/dist/v2/index.mjs +0 -8
  74. package/dist/v2/index.umd.js +0 -20695
  75. package/dist/v2/index.umd.js.map +0 -1
@@ -1,13 +1,12 @@
1
- import { A as GenerativeUIAccessibility, C as createGenerativeUI, D as GenerativeUIErrorInfo, E as GenerativeUIErrorCode, M as useGenerativeUIAccessibility, N as DefaultGenerativeUIChatCard, O as GenerativeUIEventHandler, P as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIError, _ as GenerativeUIFunctionArgs, a as useGenerativeUIRuntime, b as GenerativeUIFunctionName, c as GenerativeUIThemeVariable, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, h as GenerativeUIDefinitionsOf, i as GenerativeUIToolConfig, j as GenerativeUIAriaAttributes, k as GenerativeUIInvokeResult, l as GenerativeUIThemeVariables, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIThemeValues, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as SchemaInput, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../runtime-context-D3NcP9oE.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-B4Us6mwL.cjs";
3
2
  import * as react from "react";
4
- import { ComponentProps, ReactNode } from "react";
3
+ import { ReactNode } from "react";
5
4
  import { GenerativeUIJSONSchema } from "@copilotkit/shared";
6
- import { Streamdown } from "streamdown";
7
5
  import * as zod from "zod";
8
6
  import { z } from "zod";
7
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
9
8
 
10
- //#region src/v2/generative-ui/refs.d.ts
9
+ //#region src/generative-ui/refs.d.ts
11
10
  /**
12
11
  * One component id. The component receives the rendered child. Pass the
13
12
  * description here, not with `.describe()`, which would replace the mark.
@@ -33,7 +32,7 @@ declare function childList(description?: string): z.ZodEffects<z.ZodUnion<[z.Zod
33
32
  componentId: string;
34
33
  }>;
35
34
  //#endregion
36
- //#region src/v2/generative-ui/catalog-export.d.ts
35
+ //#region src/generative-ui/catalog-export.d.ts
37
36
  /** What `exportA2UICatalog` adds at the top of the catalog. */
38
37
  interface ExportA2UICatalogOptions {
39
38
  /** The title of the catalog. */
@@ -107,7 +106,7 @@ declare function exportA2UICatalog(ui: GenerativeUI, options?: ExportA2UICatalog
107
106
  catalogId: string;
108
107
  };
109
108
  //#endregion
110
- //#region src/v2/generative-ui/GenerativeUISurface.d.ts
109
+ //#region src/generative-ui/GenerativeUISurface.d.ts
111
110
  interface GenerativeUISurfaceBaseProps {
112
111
  /** Target id the agent renders into. */
113
112
  id: string;
@@ -172,8 +171,9 @@ declare function GenerativeUISurface<UI extends GenerativeUI<any> = GenerativeUI
172
171
  autoScroll
173
172
  }: GenerativeUISurfaceProps<UI>): react_jsx_runtime0.JSX.Element;
174
173
  //#endregion
175
- //#region src/v2/generative-ui/markdown/MarkdownSurfaces.d.ts
176
- type MarkdownProps = Omit<ComponentProps<typeof Streamdown>, "children">;
174
+ //#region src/generative-ui/markdown/MarkdownSurfaces.d.ts
175
+ /** Config for the built-in markdown renderer, plus `className`. */
176
+ type MarkdownProps = DefaultMarkdownRendererProps;
177
177
  /**
178
178
  * The default wrapper of a chat surface in the markdown transport. It draws
179
179
  * no box: a surface sits in the flow of the reply like a paragraph, and a
@@ -182,7 +182,8 @@ type MarkdownProps = Omit<ComponentProps<typeof Streamdown>, "children">;
182
182
  */
183
183
  type MarkdownSurfacesProps = MarkdownProps & {
184
184
  /** The text of the assistant message, complete or still streaming. */content: string; /** The id of the message. The fences of the message are found by it. */
185
- messageId: string;
185
+ messageId: string; /** Whether the message is still streaming. Only its last prose shows the caret. */
186
+ isStreaming?: boolean;
186
187
  };
187
188
  /**
188
189
  * Experimental. Renders an assistant message of the markdown transport.
@@ -205,10 +206,11 @@ type MarkdownSurfacesProps = MarkdownProps & {
205
206
  declare function MarkdownSurfaces({
206
207
  content,
207
208
  messageId,
209
+ isStreaming,
208
210
  ...markdownProps
209
211
  }: MarkdownSurfacesProps): react_jsx_runtime0.JSX.Element;
210
212
  //#endregion
211
- //#region src/v2/generative-ui/hooks.d.ts
213
+ //#region src/generative-ui/hooks.d.ts
212
214
  /** What `useGenerativeUIState` takes for one key: the input of its schema. */
213
215
  type StateInput<UI extends GenerativeUI<any>, Key extends keyof GenerativeUIStateOf<UI>> = SchemaInput<GenerativeUIDefinitionsOf<UI>["state"][Key]>;
214
216
  /**
@@ -254,7 +256,7 @@ declare function useGenerativeUIState<UI extends GenerativeUI<any>, Key extends
254
256
  */
255
257
  declare function useGenerativeUIFunction<UI extends GenerativeUI<any>, Name extends GenerativeUIFunctionName<UI>>(ui: UI, name: Name, handler: (args: GenerativeUIFunctionArgs<UI, Name>) => unknown): void;
256
258
  //#endregion
257
- //#region src/v2/generative-ui/standard/index.d.ts
259
+ //#region src/generative-ui/standard/index.d.ts
258
260
  /**
259
261
  * Experimental. The standard components: layout, text, inputs, feedback,
260
262
  * data, media and composites. Give it to the provider as it is, or add your
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative-ui.d.cts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/catalog-export.ts","../src/generative-ui/GenerativeUISurface.tsx","../src/generative-ui/markdown/MarkdownSurfaces.tsx","../src/generative-ui/hooks.ts","../src/generative-ui/standard/index.ts"],"mappings":";;;;;;;;;;;;;iBAgCgB,KAAA,CAAM,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,SAAA,uCAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,IAAA,KAAA,CAAA,WAAA;;;AAA1C;;;;iBAcgB,SAAA,CAAU,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,QAAA,EAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA,WAAA,CAAA,CAAA,SAAA;;;;;;;;;gFAAA,KAAA,CAAA,qBAAA;;;;;;;UChB7B,wBAAA;;EAEf,KAAA;;EAEA,WAAA;;EAEA,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;ADUF;;;iBCkBgB,iBAAA,CACd,EAAA,EAAI,YAAA,EACJ,OAAA,GAAS,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC1DD,4BAAA;;EAER,EAAA;;;;;EAKA,WAAA;EFiBmB;EEfnB,QAAA,GAAW,SAAA;EACX,SAAA;EFcwC;;;;;;EEPxC,UAAA;AAAA;;;;;KAqBU,wBAAA,YACC,YAAA,QAAoB,YAAA,SAC7B,4BAAA;EFhBsC;;;;EEuBlC,EAAA,EAAI,EAAA;EFvB8B;;AAc1C;;;;EEgBQ,UAAA,YAAsB,yBAAA,CAA0B,EAAA;AAAA;EAEhD,EAAA;EAAgB,UAAA;AAAA;;;;;;;;;;;;;;;iBA0CR,mBAAA,YACH,YAAA,QAAoB,YAAA,MAAA,CAAA;EAE/B,EAAA;EACA,WAAA;EACA,EAAA;EACA,UAAA;EACA,QAAA;EACA,SAAA;EACA;AAAA,GACC,wBAAA,CAAyB,EAAA,IAAG,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KCnG1B,aAAA,GAAgB,4BAAA;;;;;;AHerB;KGmDY,qBAAA,GAAwB,aAAA;EHnDM,sEGqDxC,OAAA,UHrDwC;EGuDxC,SAAA,UHvDwC;EGyDxC,WAAA;AAAA;;;;;;;;;;;;;;;AH3CF;;;;iBGsJgB,gBAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA,WAAA;EAAA,GACG;AAAA,GACF,qBAAA,GAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KC/KnB,UAAA,YACQ,YAAA,yBACO,mBAAA,CAAoB,EAAA,KACpC,WAAA,CAAY,yBAAA,CAA0B,EAAA,WAAa,GAAA;;;AJGvD;;;;;;;;;;;;;;;;iBIiBgB,oBAAA,YACH,YAAA,yBACO,mBAAA,CAAoB,EAAA,WAAA,CACtC,EAAA,EAAI,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,KAAA,EAAO,UAAA,CAAW,EAAA,EAAI,GAAA;;;;;;;;AJN1C;;;;;;;;;;;;;;;iBIgEgB,uBAAA,YACH,YAAA,oBACE,wBAAA,CAAyB,EAAA,EAAA,CAEtC,EAAA,EAAI,EAAA,EACJ,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,IAAA,EAAM,wBAAA,CAAyB,EAAA,EAAI,IAAA;;;;;;;;;;;;AJpF/C;;;;;;;;;;;;;;;cKuCa,UAAA;;;;;;cAGX,GAAA,CAAA,SAAA"}
@@ -1,13 +1,12 @@
1
- import { A as GenerativeUIAccessibility, C as createGenerativeUI, D as GenerativeUIErrorInfo, E as GenerativeUIErrorCode, M as useGenerativeUIAccessibility, N as DefaultGenerativeUIChatCard, O as GenerativeUIEventHandler, P as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIError, _ as GenerativeUIFunctionArgs, a as useGenerativeUIRuntime, b as GenerativeUIFunctionName, c as GenerativeUIThemeVariable, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, h as GenerativeUIDefinitionsOf, i as GenerativeUIToolConfig, j as GenerativeUIAriaAttributes, k as GenerativeUIInvokeResult, l as GenerativeUIThemeVariables, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIThemeValues, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as SchemaInput, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../runtime-context-CrHq-iTf.mjs";
1
+ import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-CRKFzsEB.mjs";
2
2
  import * as react from "react";
3
- import { ComponentProps, ReactNode } from "react";
4
- import { GenerativeUIJSONSchema } from "@copilotkit/shared";
3
+ import { ReactNode } from "react";
5
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
- import { Streamdown } from "streamdown";
5
+ import { GenerativeUIJSONSchema } from "@copilotkit/shared";
7
6
  import * as zod from "zod";
8
7
  import { z } from "zod";
9
8
 
10
- //#region src/v2/generative-ui/refs.d.ts
9
+ //#region src/generative-ui/refs.d.ts
11
10
  /**
12
11
  * One component id. The component receives the rendered child. Pass the
13
12
  * description here, not with `.describe()`, which would replace the mark.
@@ -33,7 +32,7 @@ declare function childList(description?: string): z.ZodEffects<z.ZodUnion<[z.Zod
33
32
  componentId: string;
34
33
  }>;
35
34
  //#endregion
36
- //#region src/v2/generative-ui/catalog-export.d.ts
35
+ //#region src/generative-ui/catalog-export.d.ts
37
36
  /** What `exportA2UICatalog` adds at the top of the catalog. */
38
37
  interface ExportA2UICatalogOptions {
39
38
  /** The title of the catalog. */
@@ -107,7 +106,7 @@ declare function exportA2UICatalog(ui: GenerativeUI, options?: ExportA2UICatalog
107
106
  catalogId: string;
108
107
  };
109
108
  //#endregion
110
- //#region src/v2/generative-ui/GenerativeUISurface.d.ts
109
+ //#region src/generative-ui/GenerativeUISurface.d.ts
111
110
  interface GenerativeUISurfaceBaseProps {
112
111
  /** Target id the agent renders into. */
113
112
  id: string;
@@ -172,8 +171,9 @@ declare function GenerativeUISurface<UI extends GenerativeUI<any> = GenerativeUI
172
171
  autoScroll
173
172
  }: GenerativeUISurfaceProps<UI>): react_jsx_runtime0.JSX.Element;
174
173
  //#endregion
175
- //#region src/v2/generative-ui/markdown/MarkdownSurfaces.d.ts
176
- type MarkdownProps = Omit<ComponentProps<typeof Streamdown>, "children">;
174
+ //#region src/generative-ui/markdown/MarkdownSurfaces.d.ts
175
+ /** Config for the built-in markdown renderer, plus `className`. */
176
+ type MarkdownProps = DefaultMarkdownRendererProps;
177
177
  /**
178
178
  * The default wrapper of a chat surface in the markdown transport. It draws
179
179
  * no box: a surface sits in the flow of the reply like a paragraph, and a
@@ -182,7 +182,8 @@ type MarkdownProps = Omit<ComponentProps<typeof Streamdown>, "children">;
182
182
  */
183
183
  type MarkdownSurfacesProps = MarkdownProps & {
184
184
  /** The text of the assistant message, complete or still streaming. */content: string; /** The id of the message. The fences of the message are found by it. */
185
- messageId: string;
185
+ messageId: string; /** Whether the message is still streaming. Only its last prose shows the caret. */
186
+ isStreaming?: boolean;
186
187
  };
187
188
  /**
188
189
  * Experimental. Renders an assistant message of the markdown transport.
@@ -205,10 +206,11 @@ type MarkdownSurfacesProps = MarkdownProps & {
205
206
  declare function MarkdownSurfaces({
206
207
  content,
207
208
  messageId,
209
+ isStreaming,
208
210
  ...markdownProps
209
211
  }: MarkdownSurfacesProps): react_jsx_runtime0.JSX.Element;
210
212
  //#endregion
211
- //#region src/v2/generative-ui/hooks.d.ts
213
+ //#region src/generative-ui/hooks.d.ts
212
214
  /** What `useGenerativeUIState` takes for one key: the input of its schema. */
213
215
  type StateInput<UI extends GenerativeUI<any>, Key extends keyof GenerativeUIStateOf<UI>> = SchemaInput<GenerativeUIDefinitionsOf<UI>["state"][Key]>;
214
216
  /**
@@ -254,7 +256,7 @@ declare function useGenerativeUIState<UI extends GenerativeUI<any>, Key extends
254
256
  */
255
257
  declare function useGenerativeUIFunction<UI extends GenerativeUI<any>, Name extends GenerativeUIFunctionName<UI>>(ui: UI, name: Name, handler: (args: GenerativeUIFunctionArgs<UI, Name>) => unknown): void;
256
258
  //#endregion
257
- //#region src/v2/generative-ui/standard/index.d.ts
259
+ //#region src/generative-ui/standard/index.d.ts
258
260
  /**
259
261
  * Experimental. The standard components: layout, text, inputs, feedback,
260
262
  * data, media and composites. Give it to the provider as it is, or add your
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative-ui.d.mts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/catalog-export.ts","../src/generative-ui/GenerativeUISurface.tsx","../src/generative-ui/markdown/MarkdownSurfaces.tsx","../src/generative-ui/hooks.ts","../src/generative-ui/standard/index.ts"],"mappings":";;;;;;;;;;;;;iBAgCgB,KAAA,CAAM,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,SAAA,uCAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,IAAA,KAAA,CAAA,WAAA;;;AAA1C;;;;iBAcgB,SAAA,CAAU,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,QAAA,EAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA,WAAA,CAAA,CAAA,SAAA;;;;;;;;;gFAAA,KAAA,CAAA,qBAAA;;;;;;;UChB7B,wBAAA;;EAEf,KAAA;;EAEA,WAAA;;EAEA,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;ADUF;;;iBCkBgB,iBAAA,CACd,EAAA,EAAI,YAAA,EACJ,OAAA,GAAS,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC1DD,4BAAA;;EAER,EAAA;;;;;EAKA,WAAA;EFiBmB;EEfnB,QAAA,GAAW,SAAA;EACX,SAAA;EFcwC;;;;;;EEPxC,UAAA;AAAA;;;;;KAqBU,wBAAA,YACC,YAAA,QAAoB,YAAA,SAC7B,4BAAA;EFhBsC;;;;EEuBlC,EAAA,EAAI,EAAA;EFvB8B;;AAc1C;;;;EEgBQ,UAAA,YAAsB,yBAAA,CAA0B,EAAA;AAAA;EAEhD,EAAA;EAAgB,UAAA;AAAA;;;;;;;;;;;;;;;iBA0CR,mBAAA,YACH,YAAA,QAAoB,YAAA,MAAA,CAAA;EAE/B,EAAA;EACA,WAAA;EACA,EAAA;EACA,UAAA;EACA,QAAA;EACA,SAAA;EACA;AAAA,GACC,wBAAA,CAAyB,EAAA,IAAG,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KCnG1B,aAAA,GAAgB,4BAAA;;;;;;AHerB;KGmDY,qBAAA,GAAwB,aAAA;EHnDM,sEGqDxC,OAAA,UHrDwC;EGuDxC,SAAA,UHvDwC;EGyDxC,WAAA;AAAA;;;;;;;;;;;;;;;AH3CF;;;;iBGsJgB,gBAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA,WAAA;EAAA,GACG;AAAA,GACF,qBAAA,GAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;KC/KnB,UAAA,YACQ,YAAA,yBACO,mBAAA,CAAoB,EAAA,KACpC,WAAA,CAAY,yBAAA,CAA0B,EAAA,WAAa,GAAA;;;AJGvD;;;;;;;;;;;;;;;;iBIiBgB,oBAAA,YACH,YAAA,yBACO,mBAAA,CAAoB,EAAA,WAAA,CACtC,EAAA,EAAI,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,KAAA,EAAO,UAAA,CAAW,EAAA,EAAI,GAAA;;;;;;;;AJN1C;;;;;;;;;;;;;;;iBIgEgB,uBAAA,YACH,YAAA,oBACE,wBAAA,CAAyB,EAAA,EAAA,CAEtC,EAAA,EAAI,EAAA,EACJ,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,IAAA,EAAM,wBAAA,CAAyB,EAAA,EAAI,IAAA;;;;;;;;;;;;AJpF/C;;;;;;;;;;;;;;;cKuCa,UAAA;;;;;;cAGX,GAAA,CAAA,SAAA"}
@@ -1,15 +1,13 @@
1
1
  "use client";
2
2
 
3
- import { A as isRecord, I as useKatexStyles, N as createGenerativeUI, P as toJsonSchema, c as DARK_THEME_CSS, d as useGenerativeUIAccessibility, f as wrapperAria, g as GenerativeUINodeContext, h as useManagerVersion, k as GenerativeUIError, l as controlAria, m as useGenerativeUIState, n as DefaultGenerativeUIChatCard, p as useGenerativeUIFunction, s as SurfaceView, t as MarkdownSurfaces, u as namedRole, v as useGenerativeUIRuntime, y as useRequiredGenerativeUIRuntime } from "../MarkdownSurfaces-DGpjmPaB.mjs";
3
+ import { A as GenerativeUIError, F as toJsonSchema, P as createGenerativeUI, _ as GenerativeUINodeContext, b as useRequiredGenerativeUIRuntime, c as SurfaceView, d as namedRole, f as useGenerativeUIAccessibility, g as useManagerVersion, h as useGenerativeUIState, j as isRecord, l as DARK_THEME_CSS, m as useGenerativeUIFunction, n as ProviderMarkdown, p as wrapperAria, r as DefaultGenerativeUIChatCard, t as MarkdownSurfaces, u as controlAria, y as useGenerativeUIRuntime } from "./MarkdownSurfaces-ChSlVYOk.mjs";
4
4
  import React, { Suspense, createContext, isValidElement, memo, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
- import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, childRefKind, functionCallers } from "@copilotkit/shared";
6
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
- import { Streamdown } from "streamdown";
6
+ import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, childRefKind, functionCallers } from "@copilotkit/shared";
8
7
  import { z } from "zod";
9
8
  import { createPortal } from "react-dom";
10
- import { renderToString } from "katex";
11
9
 
12
- //#region src/v2/generative-ui/refs.ts
10
+ //#region src/generative-ui/refs.ts
13
11
  /**
14
12
  * Schema helpers that mark a prop as a component reference, the way A2UI
15
13
  * 1.0 marks it with the `ComponentId` and `ChildList` common types. The
@@ -49,7 +47,7 @@ function childList(description) {
49
47
  }
50
48
 
51
49
  //#endregion
52
- //#region src/v2/generative-ui/catalog-export.ts
50
+ //#region src/generative-ui/catalog-export.ts
53
51
  const COMMON = "common_types.json#/$defs/";
54
52
  const DATA_BINDING_REF = `${COMMON}DataBinding`;
55
53
  const FUNCTION_CALL_REF = `${COMMON}FunctionCall`;
@@ -370,7 +368,7 @@ function typeSchema(type) {
370
368
  }
371
369
 
372
370
  //#endregion
373
- //#region src/v2/generative-ui/GenerativeUISurface.tsx
371
+ //#region src/generative-ui/GenerativeUISurface.tsx
374
372
  /** Scrolls `element` into view, unless it is already fully on screen. */
375
373
  function scrollToSurface(element) {
376
374
  const { top, bottom } = element.getBoundingClientRect();
@@ -455,7 +453,7 @@ function GenerativeUISurface({ id, description, ui, components, fallback = null,
455
453
  }
456
454
 
457
455
  //#endregion
458
- //#region src/v2/generative-ui/standard/overlay-stack.ts
456
+ //#region src/generative-ui/standard/overlay-stack.ts
459
457
  /**
460
458
  * The open overlays (Modal dialogs, Lightboxes), newest last. One document
461
459
  * listener closes the newest one on Escape, so a Lightbox inside a Modal
@@ -495,7 +493,7 @@ function useOverlayEscape(isOpen, close) {
495
493
  }
496
494
 
497
495
  //#endregion
498
- //#region src/v2/generative-ui/standard/tokens.ts
496
+ //#region src/generative-ui/standard/tokens.ts
499
497
  /**
500
498
  * Design tokens of the standard components. Each token is a CSS variable
501
499
  * with a literal fallback, so a host can restyle a surface with the
@@ -765,7 +763,7 @@ const FONT_WEIGHT = {
765
763
  };
766
764
 
767
765
  //#endregion
768
- //#region src/v2/generative-ui/standard/lightbox.tsx
766
+ //#region src/generative-ui/standard/lightbox.tsx
769
767
  const LIGHTBOX_BUTTON = {
770
768
  position: "absolute",
771
769
  border: "none",
@@ -898,7 +896,7 @@ function openUrl(href) {
898
896
  }
899
897
 
900
898
  //#endregion
901
- //#region src/v2/generative-ui/standard/styles.ts
899
+ //#region src/generative-ui/standard/styles.ts
902
900
  /**
903
901
  * The stylesheet for what inline styles cannot do: pseudo-elements (slider
904
902
  * track and thumb, placeholder), `:checked` and `:first-child` states,
@@ -968,7 +966,7 @@ function useStandardStyles() {
968
966
  }
969
967
 
970
968
  //#endregion
971
- //#region src/v2/generative-ui/standard/layout.tsx
969
+ //#region src/generative-ui/standard/layout.tsx
972
970
  /** A number is a count of 4px steps. A string is raw CSS. */
973
971
  const sizeValue = z.union([z.number(), z.string()]);
974
972
  /** The A2UI `weight`: how much of the free space of a Row or Column to take. */
@@ -1955,7 +1953,7 @@ const layoutComponents = {
1955
1953
  };
1956
1954
 
1957
1955
  //#endregion
1958
- //#region src/v2/generative-ui/standard/markdown.tsx
1956
+ //#region src/generative-ui/standard/markdown.tsx
1959
1957
  const SAFE_URL = /^(https?:|mailto:)/i;
1960
1958
  /** The trimmed URL when it is http, https or mailto. Else `undefined`. */
1961
1959
  function safeHref(url) {
@@ -2094,27 +2092,25 @@ function renderInlineMarkdown(text) {
2094
2092
  return out.length === 1 && typeof out[0] === "string" ? out[0] : out;
2095
2093
  }
2096
2094
  /**
2097
- * Full GitHub-flavored markdown, rendered with Streamdown like the chat
2098
- * messages. It has no typography of its own, so it reads like the chat
2099
- * text around the surface. While `streaming` is true, Streamdown closes
2100
- * markdown that is not complete yet.
2095
+ * Full GitHub-flavored markdown, rendered with the same markdown renderer
2096
+ * as the chat messages. It has no typography of its own, so it reads like
2097
+ * the chat text around the surface. While `streaming` is true, the renderer
2098
+ * handles markdown that is not complete yet.
2101
2099
  */
2102
2100
  function Markdown({ text, streaming = false }) {
2103
2101
  useStandardStyles();
2104
- useKatexStyles();
2105
2102
  return /* @__PURE__ */ jsx("div", {
2106
2103
  className: "a2ui-markdown",
2107
2104
  "data-a2ui-std": "",
2108
- children: /* @__PURE__ */ jsx(Streamdown, {
2109
- mode: streaming ? "streaming" : "static",
2110
- parseIncompleteMarkdown: streaming,
2111
- children: text
2105
+ children: /* @__PURE__ */ jsx(ProviderMarkdown, {
2106
+ content: text,
2107
+ isStreaming: streaming
2112
2108
  })
2113
2109
  });
2114
2110
  }
2115
2111
 
2116
2112
  //#endregion
2117
- //#region src/v2/generative-ui/standard/media.tsx
2113
+ //#region src/generative-ui/standard/media.tsx
2118
2114
  const NO_ARGS$2 = z.object({});
2119
2115
  const colorProp$1 = z.string().optional();
2120
2116
  const ICON_SIZES = [
@@ -3018,7 +3014,7 @@ const mediaComponents = {
3018
3014
  };
3019
3015
 
3020
3016
  //#endregion
3021
- //#region src/v2/generative-ui/standard/composites.tsx
3017
+ //#region src/generative-ui/standard/composites.tsx
3022
3018
  /**
3023
3019
  * The composite components: the prebuilt widgets that sit next to
3024
3020
  * its primitives (LinkCard, Citation, FollowUp pills, entity cards, image
@@ -3720,7 +3716,7 @@ const compositeComponents = {
3720
3716
  };
3721
3717
 
3722
3718
  //#endregion
3723
- //#region src/v2/generative-ui/standard/Chart.tsx
3719
+ //#region src/generative-ui/standard/Chart.tsx
3724
3720
  const chartSeries = z.union([z.string(), z.object({
3725
3721
  key: z.string(),
3726
3722
  label: z.string().optional(),
@@ -4169,7 +4165,7 @@ function Chart(props) {
4169
4165
  }
4170
4166
 
4171
4167
  //#endregion
4172
- //#region src/v2/generative-ui/standard/Map.tsx
4168
+ //#region src/generative-ui/standard/Map.tsx
4173
4169
  const mapMarker = z.object({
4174
4170
  label: z.string(),
4175
4171
  lat: z.number(),
@@ -4483,7 +4479,7 @@ function MapView(props) {
4483
4479
  }
4484
4480
 
4485
4481
  //#endregion
4486
- //#region src/v2/generative-ui/standard/data.tsx
4482
+ //#region src/generative-ui/standard/data.tsx
4487
4483
  const cellAlign = z.enum([
4488
4484
  "start",
4489
4485
  "center",
@@ -5055,7 +5051,7 @@ const dataComponents = {
5055
5051
  };
5056
5052
 
5057
5053
  //#endregion
5058
- //#region src/v2/generative-ui/standard/feedback.tsx
5054
+ //#region src/generative-ui/standard/feedback.tsx
5059
5055
  const FEEDBACK_STYLE_ID = "a2ui-standard-feedback";
5060
5056
  /**
5061
5057
  * The keyframes of the feedback components, and the rule for reduced
@@ -5634,7 +5630,7 @@ const feedbackComponents = {
5634
5630
  };
5635
5631
 
5636
5632
  //#endregion
5637
- //#region src/v2/generative-ui/standard/checks.ts
5633
+ //#region src/generative-ui/standard/checks.ts
5638
5634
  /**
5639
5635
  * The `checks` of the A2UI 1.0 `Checkable` components. The model writes
5640
5636
  * each condition as a validator call or a boolean binding:
@@ -5718,7 +5714,7 @@ function checkMessageStyle(severity) {
5718
5714
  }
5719
5715
 
5720
5716
  //#endregion
5721
- //#region src/v2/generative-ui/standard/inputs.tsx
5717
+ //#region src/generative-ui/standard/inputs.tsx
5722
5718
  /** Copies text to the clipboard. False when the API is not there. */
5723
5719
  async function copyText(text) {
5724
5720
  try {
@@ -7286,7 +7282,7 @@ const inputComponents = {
7286
7282
  };
7287
7283
 
7288
7284
  //#endregion
7289
- //#region src/v2/generative-ui/standard/text.tsx
7285
+ //#region src/generative-ui/standard/text.tsx
7290
7286
  const colorProp = z.string().optional().describe(`One of ${TEXT_COLORS.join("|")} or a CSS color`);
7291
7287
  const fontWeight = z.enum(WEIGHTS).optional();
7292
7288
  const textAlign = z.enum([
@@ -7657,17 +7653,18 @@ function Code(props) {
7657
7653
  })
7658
7654
  });
7659
7655
  }
7656
+ /**
7657
+ * Shows the TeX source as code. react-core ships no math typesetter, so a
7658
+ * formula reads as its source, which is still exact.
7659
+ */
7660
7660
  function MathFormula(props) {
7661
- useKatexStyles();
7662
- const isBlock = props.block === true;
7663
- const html = useMemo(() => renderToString(props.value, {
7664
- displayMode: isBlock,
7665
- throwOnError: false,
7666
- trust: false
7667
- }), [props.value, isBlock]);
7668
- return /* @__PURE__ */ jsx(isBlock ? "div" : "span", {
7669
- "data-math": isBlock ? "block" : "inline",
7670
- dangerouslySetInnerHTML: { __html: html }
7661
+ if (props.block === true) return /* @__PURE__ */ jsx("pre", {
7662
+ "data-math": "block",
7663
+ children: /* @__PURE__ */ jsx("code", { children: props.value })
7664
+ });
7665
+ return /* @__PURE__ */ jsx("code", {
7666
+ "data-math": "inline",
7667
+ children: props.value
7671
7668
  });
7672
7669
  }
7673
7670
  function ShimmerText(props) {
@@ -7866,7 +7863,7 @@ const textComponents = {
7866
7863
  };
7867
7864
 
7868
7865
  //#endregion
7869
- //#region src/v2/generative-ui/standard/parameter-order.ts
7866
+ //#region src/generative-ui/standard/parameter-order.ts
7870
7867
  /** CopilotKit catalog design, not an A2UI-mandated list of signatures.
7871
7868
  * Express maps positional arguments using the exported JSON Schema property order:
7872
7869
  * https://a2ui.org/specification/proposals/express/a2ui_express/#schema-driven-key-mapping
@@ -8092,7 +8089,7 @@ function standardParameterOrder(name, definition) {
8092
8089
  }
8093
8090
 
8094
8091
  //#endregion
8095
- //#region src/v2/generative-ui/standard/index.ts
8092
+ //#region src/generative-ui/standard/index.ts
8096
8093
  const components = {
8097
8094
  ...layoutComponents,
8098
8095
  ...textComponents,