@copilotkit/react-core 2.0.0-rc.6 → 2.0.0-rc.60

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 (115) hide show
  1. package/README.md +1 -1
  2. package/dist/MarkdownRendererContext-QFCldfW_.d.cts +34 -0
  3. package/dist/MarkdownRendererContext-QFCldfW_.d.cts.map +1 -0
  4. package/dist/MarkdownRendererContext-aK63ZFd-.d.mts +34 -0
  5. package/dist/MarkdownRendererContext-aK63ZFd-.d.mts.map +1 -0
  6. package/dist/MarkdownSurfaces-Do948N1P.cjs +141 -0
  7. package/dist/MarkdownSurfaces-Do948N1P.cjs.map +1 -0
  8. package/dist/MarkdownSurfaces-rtE9wRUP.mjs +135 -0
  9. package/dist/MarkdownSurfaces-rtE9wRUP.mjs.map +1 -0
  10. package/dist/ProviderMarkdown-D0eI0aPo.cjs +268 -0
  11. package/dist/ProviderMarkdown-D0eI0aPo.cjs.map +1 -0
  12. package/dist/ProviderMarkdown-epL7F3Vt.mjs +214 -0
  13. package/dist/ProviderMarkdown-epL7F3Vt.mjs.map +1 -0
  14. package/dist/accessibility-BLK-gE0R.mjs +129 -0
  15. package/dist/accessibility-BLK-gE0R.mjs.map +1 -0
  16. package/dist/accessibility-GnodqxkH.cjs +228 -0
  17. package/dist/accessibility-GnodqxkH.cjs.map +1 -0
  18. package/dist/chat-B1zczXUD.mjs +1476 -0
  19. package/dist/chat-B1zczXUD.mjs.map +1 -0
  20. package/dist/chat-BZ_bvAkg.d.mts +38 -0
  21. package/dist/chat-BZ_bvAkg.d.mts.map +1 -0
  22. package/dist/chat-CkFZMo5E.cjs +1579 -0
  23. package/dist/chat-CkFZMo5E.cjs.map +1 -0
  24. package/dist/chat-CpZVyF_t.d.cts +38 -0
  25. package/dist/chat-CpZVyF_t.d.cts.map +1 -0
  26. package/dist/context.cjs +75 -63
  27. package/dist/context.cjs.map +1 -1
  28. package/dist/context.d.cts +62 -107
  29. package/dist/context.d.cts.map +1 -1
  30. package/dist/context.d.mts +62 -107
  31. package/dist/context.d.mts.map +1 -1
  32. package/dist/context.mjs +76 -64
  33. package/dist/context.mjs.map +1 -1
  34. package/dist/generative-ui/map.cjs +26 -0
  35. package/dist/generative-ui/map.cjs.map +1 -0
  36. package/dist/generative-ui/map.d.cts +23 -0
  37. package/dist/generative-ui/map.d.cts.map +1 -0
  38. package/dist/generative-ui/map.d.mts +23 -0
  39. package/dist/generative-ui/map.d.mts.map +1 -0
  40. package/dist/generative-ui/map.mjs +24 -0
  41. package/dist/generative-ui/map.mjs.map +1 -0
  42. package/dist/generative-ui/native.cjs +67 -0
  43. package/dist/generative-ui/native.cjs.map +1 -0
  44. package/dist/generative-ui/native.d.cts +156 -0
  45. package/dist/generative-ui/native.d.cts.map +1 -0
  46. package/dist/generative-ui/native.d.mts +156 -0
  47. package/dist/generative-ui/native.d.mts.map +1 -0
  48. package/dist/generative-ui/native.mjs +25 -0
  49. package/dist/generative-ui/native.mjs.map +1 -0
  50. package/dist/generative-ui.cjs +33 -8088
  51. package/dist/generative-ui.cjs.map +1 -1
  52. package/dist/generative-ui.d.cts +2472 -4789
  53. package/dist/generative-ui.d.cts.map +1 -1
  54. package/dist/generative-ui.d.mts +2472 -4789
  55. package/dist/generative-ui.d.mts.map +1 -1
  56. package/dist/generative-ui.mjs +9 -8074
  57. package/dist/generative-ui.mjs.map +1 -1
  58. package/dist/headless.cjs +289 -1054
  59. package/dist/headless.cjs.map +1 -1
  60. package/dist/headless.d.cts +149 -372
  61. package/dist/headless.d.cts.map +1 -1
  62. package/dist/headless.d.mts +123 -237
  63. package/dist/headless.d.mts.map +1 -1
  64. package/dist/headless.mjs +283 -1054
  65. package/dist/headless.mjs.map +1 -1
  66. package/dist/hooks-D2H3iL0N.d.mts +84 -0
  67. package/dist/hooks-D2H3iL0N.d.mts.map +1 -0
  68. package/dist/hooks-Dy8HeEdr.d.cts +84 -0
  69. package/dist/hooks-Dy8HeEdr.d.cts.map +1 -0
  70. package/dist/index.cjs +8702 -13238
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.d.cts +312 -872
  73. package/dist/index.d.cts.map +1 -1
  74. package/dist/index.d.mts +311 -871
  75. package/dist/index.d.mts.map +1 -1
  76. package/dist/index.mjs +1790 -7803
  77. package/dist/index.mjs.map +1 -1
  78. package/dist/index.umd.js +14075 -13828
  79. package/dist/index.umd.js.map +1 -1
  80. package/dist/refs-B5Dn59Pn.cjs +43 -0
  81. package/dist/refs-B5Dn59Pn.cjs.map +1 -0
  82. package/dist/refs-BW15wX_V.mjs +31 -0
  83. package/dist/refs-BW15wX_V.mjs.map +1 -0
  84. package/dist/runtime-context-B7f4M85q.d.mts +215 -0
  85. package/dist/runtime-context-B7f4M85q.d.mts.map +1 -0
  86. package/dist/runtime-context-CIkZS0ap.d.cts +215 -0
  87. package/dist/runtime-context-CIkZS0ap.d.cts.map +1 -0
  88. package/dist/standard-CSBR4FhM.mjs +5800 -0
  89. package/dist/standard-CSBR4FhM.mjs.map +1 -0
  90. package/dist/standard-DBjcBGyd.cjs +5796 -0
  91. package/dist/standard-DBjcBGyd.cjs.map +1 -0
  92. package/dist/use-generative-ui-root-CIp0ytE6.cjs +390 -0
  93. package/dist/use-generative-ui-root-CIp0ytE6.cjs.map +1 -0
  94. package/dist/use-generative-ui-root-oBqPa6uy.mjs +386 -0
  95. package/dist/use-generative-ui-root-oBqPa6uy.mjs.map +1 -0
  96. package/dist/v2/context.d.cts +28 -0
  97. package/dist/v2/context.d.mts +28 -0
  98. package/dist/v2/generative-ui/native.d.cts +112 -0
  99. package/dist/v2/generative-ui/native.d.mts +112 -0
  100. package/dist/v2/generative-ui.d.cts +96 -0
  101. package/dist/v2/generative-ui.d.mts +96 -0
  102. package/dist/v2/headless.d.cts +96 -0
  103. package/dist/v2/headless.d.mts +96 -0
  104. package/dist/v2/index.d.cts +2220 -0
  105. package/dist/v2/index.d.mts +2220 -0
  106. package/dist/v2/styles.css +5 -0
  107. package/package.json +116 -24
  108. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts +0 -954
  109. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
  110. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts +0 -954
  111. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
  112. package/dist/MarkdownSurfaces-Bd--93O1.mjs +0 -3676
  113. package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
  114. package/dist/MarkdownSurfaces-S4wfUl3J.cjs +0 -3991
  115. package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
@@ -0,0 +1,84 @@
1
+ import { E as GenerativeUIStateOf, a as GenerativeUIRuntime, h as GenerativeUI$1, w as GenerativeUIFunctionName, x as GenerativeUIFunctionArgs, y as GenerativeUIDefinitionsOf } from "./runtime-context-B7f4M85q.mjs";
2
+ import { ReactNode } from "react";
3
+ import { SchemaInput } from "@copilotkit/shared/generative-ui";
4
+ import * as zod from "zod";
5
+ import * as zod_v4_core0 from "zod/v4/core";
6
+
7
+ //#region src/generative-ui/refs.d.ts
8
+ /**
9
+ * One component id. The component receives the rendered child. Pass the
10
+ * description here, not with `.describe()`, which would replace the mark.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const tabsSchema = z.object({
15
+ * tabs: z.array(z.object({ title: z.string(), child: child() })),
16
+ * });
17
+ * // The component gets `tabs: { title: string; child: ReactNode }[]`.
18
+ * ```
19
+ */
20
+ declare function child$1(description?: string): zod.ZodPipe<zod.ZodString, zod.ZodTransform<ReactNode, string>>;
21
+ /**
22
+ * A list of component ids, or a template `{ componentId, path }` that
23
+ * repeats one component for each item of the list at `path`. The
24
+ * component receives the rendered children. Pass the description here,
25
+ * not with `.describe()`.
26
+ */
27
+ declare function childList$1(description?: string): zod.ZodPipe<zod.ZodUnion<readonly [zod.ZodArray<zod.ZodString>, zod.ZodObject<{
28
+ componentId: zod.ZodString;
29
+ path: zod.ZodString;
30
+ }, zod_v4_core0.$strip>]>, zod.ZodTransform<ReactNode, string[] | {
31
+ componentId: string;
32
+ path: string;
33
+ }>>;
34
+ //#endregion
35
+ //#region src/generative-ui/hooks.d.ts
36
+ /** Re-renders on any surface-manager change. */
37
+ declare function useManagerVersion(runtime: GenerativeUIRuntime | null): number;
38
+ /** What `useGenerativeUIState` takes for one key: the input of its schema. */
39
+ type StateInput<UI extends GenerativeUI$1<any>, Key extends keyof GenerativeUIStateOf<UI>> = SchemaInput<GenerativeUIDefinitionsOf<UI>["state"][Key]>;
40
+ /**
41
+ * Experimental. Gives one key of the app state declared in
42
+ * `createGenerativeUI({ state })` its value. Bound props of generated
43
+ * components read it. The model does not see it.
44
+ *
45
+ * The key is set on mount and when the value changes (compared as JSON). It
46
+ * is removed on unmount.
47
+ *
48
+ * @param ui - The object from `createGenerativeUI`. It gives the key and the
49
+ * value their types.
50
+ * @param key - A top-level key of `state`.
51
+ * @param value - The value of that key. It must fit the key's schema.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * useGenerativeUIState(storeUI, "cart", { count, total, coupon, items });
56
+ * ```
57
+ */
58
+ declare function useGenerativeUIState<UI extends GenerativeUI$1<any>, Key extends keyof GenerativeUIStateOf<UI> & string>(ui: UI, key: Key, value: StateInput<UI, Key>): void;
59
+ /**
60
+ * Experimental. Mounts the handler of a function declared in
61
+ * `createGenerativeUI({ functions })`. Generated UI can call the function
62
+ * only while exactly one handler for it is mounted.
63
+ *
64
+ * The handler gets the parsed arguments: schema defaults are set. It can
65
+ * change on each render. The latest handler always runs, and the hook does
66
+ * not register again.
67
+ *
68
+ * @param ui - The object from `createGenerativeUI`. It gives the name and the
69
+ * handler arguments their types.
70
+ * @param name - A key of `functions`.
71
+ * @param handler - Runs when generated UI calls the function. Its return
72
+ * value goes back to the caller as `{ ok: true, result }`.
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * useGenerativeUIFunction(storeUI, "addToCart", ({ productId, quantity }) =>
77
+ * cart.addItem(productId, quantity),
78
+ * );
79
+ * ```
80
+ */
81
+ declare function useGenerativeUIFunction<UI extends GenerativeUI$1<any>, Name extends GenerativeUIFunctionName<UI>>(ui: UI, name: Name, handler: (args: GenerativeUIFunctionArgs<UI, Name>) => unknown): void;
82
+ //#endregion
83
+ export { childList$1 as a, child$1 as i, useGenerativeUIState as n, useManagerVersion as r, useGenerativeUIFunction as t };
84
+ //# sourceMappingURL=hooks-D2H3iL0N.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-D2H3iL0N.d.mts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/hooks.ts"],"mappings":";;;;;;;;;;;;;AAkBA;;;;;;iBAAgB,OAAA,CAAM,WAAA,YAAoB,GAAA,CAAA,OAAA,CAArB,GAAA,CAAqB,SAAA,EAAA,GAAA,CAAA,YAAA,CAAA,SAAA;;;;;;;iBAU1B,WAAA,CAAU,WAAA,gBAAoB,OAAA,CAAA,GAAA,CAAA,QAAA,WAAA,GAAA,CAAA,QAAA,CAArB,GAAA,CAAqB,SAAA,OAAA,SAAA;eAAA,GAAA,CAAA,SAAA;;;;;;;;;iBCR9B,iBAAA,CAAkB,OAAA,EAAS,mBAAA;;KAStC,UAAA,YACQ,cAAA,yBACO,mBAAA,CAAoB,EAAA,KACpC,WAAA,CAAY,yBAAA,CAA0B,EAAA,WAAa,GAAA;ADdvD;;;;;;;;;;;;;;;;AAUA;;AAVA,iBCkCgB,oBAAA,YACH,cAAA,yBACO,mBAAA,CAAoB,EAAA,WAAA,CACtC,EAAA,EAAI,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,KAAA,EAAO,UAAA,CAAW,EAAA,EAAI,GAAA;;;;;;;;;;;;;;;;;;;;;;;iBA0D1B,uBAAA,YACH,cAAA,oBACE,wBAAA,CAAyB,EAAA,EAAA,CAEtC,EAAA,EAAI,EAAA,EACJ,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,IAAA,EAAM,wBAAA,CAAyB,EAAA,EAAI,IAAA"}
@@ -0,0 +1,84 @@
1
+ import { E as GenerativeUIStateOf, a as GenerativeUIRuntime, h as GenerativeUI$1, w as GenerativeUIFunctionName, x as GenerativeUIFunctionArgs, y as GenerativeUIDefinitionsOf } from "./runtime-context-CIkZS0ap.cjs";
2
+ import { ReactNode } from "react";
3
+ import { SchemaInput } from "@copilotkit/shared/generative-ui";
4
+ import * as zod from "zod";
5
+ import * as zod_v4_core0 from "zod/v4/core";
6
+
7
+ //#region src/generative-ui/refs.d.ts
8
+ /**
9
+ * One component id. The component receives the rendered child. Pass the
10
+ * description here, not with `.describe()`, which would replace the mark.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const tabsSchema = z.object({
15
+ * tabs: z.array(z.object({ title: z.string(), child: child() })),
16
+ * });
17
+ * // The component gets `tabs: { title: string; child: ReactNode }[]`.
18
+ * ```
19
+ */
20
+ declare function child(description?: string): zod.ZodPipe<zod.ZodString, zod.ZodTransform<ReactNode, string>>;
21
+ /**
22
+ * A list of component ids, or a template `{ componentId, path }` that
23
+ * repeats one component for each item of the list at `path`. The
24
+ * component receives the rendered children. Pass the description here,
25
+ * not with `.describe()`.
26
+ */
27
+ declare function childList(description?: string): zod.ZodPipe<zod.ZodUnion<readonly [zod.ZodArray<zod.ZodString>, zod.ZodObject<{
28
+ componentId: zod.ZodString;
29
+ path: zod.ZodString;
30
+ }, zod_v4_core0.$strip>]>, zod.ZodTransform<ReactNode, string[] | {
31
+ componentId: string;
32
+ path: string;
33
+ }>>;
34
+ //#endregion
35
+ //#region src/generative-ui/hooks.d.ts
36
+ /** Re-renders on any surface-manager change. */
37
+ declare function useManagerVersion(runtime: GenerativeUIRuntime | null): number;
38
+ /** What `useGenerativeUIState` takes for one key: the input of its schema. */
39
+ type StateInput<UI extends GenerativeUI$1<any>, Key extends keyof GenerativeUIStateOf<UI>> = SchemaInput<GenerativeUIDefinitionsOf<UI>["state"][Key]>;
40
+ /**
41
+ * Experimental. Gives one key of the app state declared in
42
+ * `createGenerativeUI({ state })` its value. Bound props of generated
43
+ * components read it. The model does not see it.
44
+ *
45
+ * The key is set on mount and when the value changes (compared as JSON). It
46
+ * is removed on unmount.
47
+ *
48
+ * @param ui - The object from `createGenerativeUI`. It gives the key and the
49
+ * value their types.
50
+ * @param key - A top-level key of `state`.
51
+ * @param value - The value of that key. It must fit the key's schema.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * useGenerativeUIState(storeUI, "cart", { count, total, coupon, items });
56
+ * ```
57
+ */
58
+ declare function useGenerativeUIState<UI extends GenerativeUI$1<any>, Key extends keyof GenerativeUIStateOf<UI> & string>(ui: UI, key: Key, value: StateInput<UI, Key>): void;
59
+ /**
60
+ * Experimental. Mounts the handler of a function declared in
61
+ * `createGenerativeUI({ functions })`. Generated UI can call the function
62
+ * only while exactly one handler for it is mounted.
63
+ *
64
+ * The handler gets the parsed arguments: schema defaults are set. It can
65
+ * change on each render. The latest handler always runs, and the hook does
66
+ * not register again.
67
+ *
68
+ * @param ui - The object from `createGenerativeUI`. It gives the name and the
69
+ * handler arguments their types.
70
+ * @param name - A key of `functions`.
71
+ * @param handler - Runs when generated UI calls the function. Its return
72
+ * value goes back to the caller as `{ ok: true, result }`.
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * useGenerativeUIFunction(storeUI, "addToCart", ({ productId, quantity }) =>
77
+ * cart.addItem(productId, quantity),
78
+ * );
79
+ * ```
80
+ */
81
+ declare function useGenerativeUIFunction<UI extends GenerativeUI$1<any>, Name extends GenerativeUIFunctionName<UI>>(ui: UI, name: Name, handler: (args: GenerativeUIFunctionArgs<UI, Name>) => unknown): void;
82
+ //#endregion
83
+ export { childList as a, child as i, useGenerativeUIState as n, useManagerVersion as r, useGenerativeUIFunction as t };
84
+ //# sourceMappingURL=hooks-Dy8HeEdr.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-Dy8HeEdr.d.cts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/hooks.ts"],"mappings":";;;;;;;;;;;;;AAkBA;;;;;;iBAAgB,KAAA,CAAM,WAAA,YAAoB,GAAA,CAAA,OAAA,CAArB,GAAA,CAAqB,SAAA,EAAA,GAAA,CAAA,YAAA,CAAA,SAAA;;;;;;;iBAU1B,SAAA,CAAU,WAAA,gBAAoB,OAAA,CAAA,GAAA,CAAA,QAAA,WAAA,GAAA,CAAA,QAAA,CAArB,GAAA,CAAqB,SAAA,OAAA,SAAA;eAAA,GAAA,CAAA,SAAA;;;;;;;;;iBCR9B,iBAAA,CAAkB,OAAA,EAAS,mBAAA;;KAStC,UAAA,YACQ,cAAA,yBACO,mBAAA,CAAoB,EAAA,KACpC,WAAA,CAAY,yBAAA,CAA0B,EAAA,WAAa,GAAA;ADdvD;;;;;;;;;;;;;;;;AAUA;;AAVA,iBCkCgB,oBAAA,YACH,cAAA,yBACO,mBAAA,CAAoB,EAAA,WAAA,CACtC,EAAA,EAAI,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,KAAA,EAAO,UAAA,CAAW,EAAA,EAAI,GAAA;;;;;;;;;;;;;;;;;;;;;;;iBA0D1B,uBAAA,YACH,cAAA,oBACE,wBAAA,CAAyB,EAAA,EAAA,CAEtC,EAAA,EAAI,EAAA,EACJ,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,IAAA,EAAM,wBAAA,CAAyB,EAAA,EAAI,IAAA"}