@copilotkit/react-core 2.0.0-rc.5 → 2.0.0-rc.50
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-QFCldfW_.d.cts +34 -0
- package/dist/MarkdownRendererContext-QFCldfW_.d.cts.map +1 -0
- package/dist/MarkdownRendererContext-aK63ZFd-.d.mts +34 -0
- package/dist/MarkdownRendererContext-aK63ZFd-.d.mts.map +1 -0
- package/dist/MarkdownSurfaces-Do948N1P.cjs +141 -0
- package/dist/MarkdownSurfaces-Do948N1P.cjs.map +1 -0
- package/dist/MarkdownSurfaces-rtE9wRUP.mjs +135 -0
- package/dist/MarkdownSurfaces-rtE9wRUP.mjs.map +1 -0
- package/dist/ProviderMarkdown-D0eI0aPo.cjs +268 -0
- package/dist/ProviderMarkdown-D0eI0aPo.cjs.map +1 -0
- package/dist/ProviderMarkdown-epL7F3Vt.mjs +214 -0
- package/dist/ProviderMarkdown-epL7F3Vt.mjs.map +1 -0
- package/dist/accessibility-BLK-gE0R.mjs +129 -0
- package/dist/accessibility-BLK-gE0R.mjs.map +1 -0
- package/dist/accessibility-GnodqxkH.cjs +228 -0
- package/dist/accessibility-GnodqxkH.cjs.map +1 -0
- package/dist/chat-B1zczXUD.mjs +1476 -0
- package/dist/chat-B1zczXUD.mjs.map +1 -0
- package/dist/chat-BZ_bvAkg.d.mts +38 -0
- package/dist/chat-BZ_bvAkg.d.mts.map +1 -0
- package/dist/chat-CkFZMo5E.cjs +1579 -0
- package/dist/chat-CkFZMo5E.cjs.map +1 -0
- package/dist/chat-CpZVyF_t.d.cts +38 -0
- package/dist/chat-CpZVyF_t.d.cts.map +1 -0
- package/dist/context.cjs +75 -63
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +62 -107
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +62 -107
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +76 -64
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui/map.cjs +26 -0
- package/dist/generative-ui/map.cjs.map +1 -0
- package/dist/generative-ui/map.d.cts +23 -0
- package/dist/generative-ui/map.d.cts.map +1 -0
- package/dist/generative-ui/map.d.mts +23 -0
- package/dist/generative-ui/map.d.mts.map +1 -0
- package/dist/generative-ui/map.mjs +24 -0
- package/dist/generative-ui/map.mjs.map +1 -0
- package/dist/generative-ui/native.cjs +67 -0
- package/dist/generative-ui/native.cjs.map +1 -0
- package/dist/generative-ui/native.d.cts +156 -0
- package/dist/generative-ui/native.d.cts.map +1 -0
- package/dist/generative-ui/native.d.mts +156 -0
- package/dist/generative-ui/native.d.mts.map +1 -0
- package/dist/generative-ui/native.mjs +25 -0
- package/dist/generative-ui/native.mjs.map +1 -0
- package/dist/generative-ui.cjs +33 -8088
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +2472 -4789
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +2472 -4789
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +9 -8074
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +289 -1054
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +149 -372
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +123 -237
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +283 -1054
- package/dist/headless.mjs.map +1 -1
- package/dist/hooks-D2H3iL0N.d.mts +84 -0
- package/dist/hooks-D2H3iL0N.d.mts.map +1 -0
- package/dist/hooks-Dy8HeEdr.d.cts +84 -0
- package/dist/hooks-Dy8HeEdr.d.cts.map +1 -0
- package/dist/index.cjs +8683 -13241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +303 -875
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +302 -874
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1773 -7808
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +13886 -13661
- package/dist/index.umd.js.map +1 -1
- package/dist/refs-B5Dn59Pn.cjs +43 -0
- package/dist/refs-B5Dn59Pn.cjs.map +1 -0
- package/dist/refs-BW15wX_V.mjs +31 -0
- package/dist/refs-BW15wX_V.mjs.map +1 -0
- package/dist/runtime-context-B7f4M85q.d.mts +215 -0
- package/dist/runtime-context-B7f4M85q.d.mts.map +1 -0
- package/dist/runtime-context-CIkZS0ap.d.cts +215 -0
- package/dist/runtime-context-CIkZS0ap.d.cts.map +1 -0
- package/dist/standard-CSBR4FhM.mjs +5800 -0
- package/dist/standard-CSBR4FhM.mjs.map +1 -0
- package/dist/standard-DBjcBGyd.cjs +5796 -0
- package/dist/standard-DBjcBGyd.cjs.map +1 -0
- package/dist/use-generative-ui-root-CIp0ytE6.cjs +390 -0
- package/dist/use-generative-ui-root-CIp0ytE6.cjs.map +1 -0
- package/dist/use-generative-ui-root-oBqPa6uy.mjs +386 -0
- package/dist/use-generative-ui-root-oBqPa6uy.mjs.map +1 -0
- package/package.json +49 -23
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts +0 -954
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts +0 -954
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-Bd--93O1.mjs +0 -3676
- package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
- package/dist/MarkdownSurfaces-S4wfUl3J.cjs +0 -3991
- 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"}
|