@copilotkit/react-core 2.0.0-rc.5 → 2.0.0-rc.51
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,43 @@
|
|
|
1
|
+
const require_accessibility = require('./accessibility-GnodqxkH.cjs');
|
|
2
|
+
let _copilotkit_shared_generative_ui = require("@copilotkit/shared/generative-ui");
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/refs.ts
|
|
5
|
+
/**
|
|
6
|
+
* One component id. The component receives the rendered child. Pass the
|
|
7
|
+
* description here, not with `.describe()`, which would replace the mark.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const tabsSchema = z.object({
|
|
12
|
+
* tabs: z.array(z.object({ title: z.string(), child: child() })),
|
|
13
|
+
* });
|
|
14
|
+
* // The component gets `tabs: { title: string; child: ReactNode }[]`.
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function child(description) {
|
|
18
|
+
return (0, _copilotkit_shared_generative_ui.child)(description);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A list of component ids, or a template `{ componentId, path }` that
|
|
22
|
+
* repeats one component for each item of the list at `path`. The
|
|
23
|
+
* component receives the rendered children. Pass the description here,
|
|
24
|
+
* not with `.describe()`.
|
|
25
|
+
*/
|
|
26
|
+
function childList(description) {
|
|
27
|
+
return (0, _copilotkit_shared_generative_ui.childList)(description);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
Object.defineProperty(exports, 'child', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return child;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, 'childList', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return childList;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=refs-B5Dn59Pn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs-B5Dn59Pn.cjs","names":[],"sources":["../src/generative-ui/refs.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n child as sharedChild,\n childList as sharedChildList,\n} from \"@copilotkit/shared/generative-ui\";\n\n/**\n * One component id. The component receives the rendered child. Pass the\n * description here, not with `.describe()`, which would replace the mark.\n *\n * @example\n * ```ts\n * const tabsSchema = z.object({\n * tabs: z.array(z.object({ title: z.string(), child: child() })),\n * });\n * // The component gets `tabs: { title: string; child: ReactNode }[]`.\n * ```\n */\nexport function child(description?: string) {\n return sharedChild<ReactNode>(description);\n}\n\n/**\n * A list of component ids, or a template `{ componentId, path }` that\n * repeats one component for each item of the list at `path`. The\n * component receives the rendered children. Pass the description here,\n * not with `.describe()`.\n */\nexport function childList(description?: string) {\n return sharedChildList<ReactNode>(description);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgB,MAAM,aAAsB;AAC1C,oDAA8B,YAAY;;;;;;;;AAS5C,SAAgB,UAAU,aAAsB;AAC9C,wDAAkC,YAAY"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { child, childList } from "@copilotkit/shared/generative-ui";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/refs.ts
|
|
4
|
+
/**
|
|
5
|
+
* One component id. The component receives the rendered child. Pass the
|
|
6
|
+
* description here, not with `.describe()`, which would replace the mark.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const tabsSchema = z.object({
|
|
11
|
+
* tabs: z.array(z.object({ title: z.string(), child: child() })),
|
|
12
|
+
* });
|
|
13
|
+
* // The component gets `tabs: { title: string; child: ReactNode }[]`.
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function child$1(description) {
|
|
17
|
+
return child(description);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A list of component ids, or a template `{ componentId, path }` that
|
|
21
|
+
* repeats one component for each item of the list at `path`. The
|
|
22
|
+
* component receives the rendered children. Pass the description here,
|
|
23
|
+
* not with `.describe()`.
|
|
24
|
+
*/
|
|
25
|
+
function childList$1(description) {
|
|
26
|
+
return childList(description);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { childList$1 as n, child$1 as t };
|
|
31
|
+
//# sourceMappingURL=refs-BW15wX_V.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs-BW15wX_V.mjs","names":["child","sharedChild","childList","sharedChildList"],"sources":["../src/generative-ui/refs.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport {\n child as sharedChild,\n childList as sharedChildList,\n} from \"@copilotkit/shared/generative-ui\";\n\n/**\n * One component id. The component receives the rendered child. Pass the\n * description here, not with `.describe()`, which would replace the mark.\n *\n * @example\n * ```ts\n * const tabsSchema = z.object({\n * tabs: z.array(z.object({ title: z.string(), child: child() })),\n * });\n * // The component gets `tabs: { title: string; child: ReactNode }[]`.\n * ```\n */\nexport function child(description?: string) {\n return sharedChild<ReactNode>(description);\n}\n\n/**\n * A list of component ids, or a template `{ componentId, path }` that\n * repeats one component for each item of the list at `path`. The\n * component receives the rendered children. Pass the description here,\n * not with `.describe()`.\n */\nexport function childList(description?: string) {\n return sharedChildList<ReactNode>(description);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAgBA,QAAM,aAAsB;AAC1C,QAAOC,MAAuB,YAAY;;;;;;;;AAS5C,SAAgBC,YAAU,aAAsB;AAC9C,QAAOC,UAA2B,YAAY"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as react from "react";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
import { GenerativeUIUserEvent } from "@copilotkit/shared";
|
|
4
|
+
import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
|
|
5
|
+
import { AnyGenerativeUI, CreateGenerativeUIConfig, GenerativeUI, GenerativeUIBasesDefinitions, GenerativeUIComponentDefinition, GenerativeUIComponentName, GenerativeUIComponentProps, GenerativeUIDefinitions, GenerativeUIDefinitionsOf, GenerativeUIErrorInfo, GenerativeUIEventDefinition, GenerativeUIFunctionArgs, GenerativeUIFunctionDefinition, GenerativeUIFunctionDefinition as GenerativeUIFunctionDefinition$1, GenerativeUIFunctionInput, GenerativeUIFunctionName, GenerativeUIInvokeResult, GenerativeUIResultDefinitions, GenerativeUISchema, GenerativeUISlotKind, GenerativeUIStateOf, GenerativeUITheme } from "@copilotkit/shared/generative-ui";
|
|
6
|
+
|
|
7
|
+
//#region src/generative-ui/catalog.d.ts
|
|
8
|
+
/** One component of a generative UI, as the renderer reads it. */
|
|
9
|
+
type GenerativeUIComponentDefinition$1 = GenerativeUIComponentDefinition<ComponentType<any>>;
|
|
10
|
+
/**
|
|
11
|
+
* Experimental. The result of `createGenerativeUI`: the components the model
|
|
12
|
+
* can render, the app state they read, and the functions they call. Give it
|
|
13
|
+
* to the provider (`generativeUI={{ ui }}`) and to the typed hooks.
|
|
14
|
+
*/
|
|
15
|
+
type GenerativeUI$1<Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions> = GenerativeUI<Definitions, ComponentType<any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Props that the renderer passes to a component:
|
|
18
|
+
* `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, "CheckoutForm">)`.
|
|
19
|
+
* Data props are the parsed `props` schema, bound props included. Event and
|
|
20
|
+
* slot props are present only when they are bound or filled. Each writable
|
|
21
|
+
* prop gets a setter (`value` gets `setValue`), which is always present.
|
|
22
|
+
*/
|
|
23
|
+
type GenerativeUIComponentProps$1<UI extends AnyGenerativeUI, Name extends keyof NonNullable<UI["definitions"]>["components"] & string> = GenerativeUIComponentProps<UI, Name, ReactNode>;
|
|
24
|
+
/** One new React component for each component of the bases that it names. */
|
|
25
|
+
type OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = { [Name in keyof GenerativeUIBasesDefinitions<Bases>["components"] & string]?: {
|
|
26
|
+
component: ComponentType<GenerativeUIBasesDefinitions<Bases> extends infer Definitions extends GenerativeUIDefinitions ? GenerativeUIComponentProps$1<GenerativeUI$1<Definitions>, Name> : never>;
|
|
27
|
+
} };
|
|
28
|
+
/** The config of `createGenerativeUI`. */
|
|
29
|
+
type CreateGenerativeUIConfig$1<Bases extends readonly AnyGenerativeUI[], State extends Record<string, GenerativeUISchema>, Functions extends Record<string, GenerativeUIFunctionDefinition>, Props extends Record<string, unknown>, Events extends Record<string, unknown>, Slots extends Record<string, unknown>, Writable extends Record<string, unknown>> = CreateGenerativeUIConfig<Bases, State, Functions, Props, Events, Slots, Writable, OverridesConfig<Bases>>;
|
|
30
|
+
/**
|
|
31
|
+
* Experimental. Declares the components the model can render, the app state
|
|
32
|
+
* they read, and the functions they call.
|
|
33
|
+
*
|
|
34
|
+
* - A prop with the name of a top-level state key is bound to that state.
|
|
35
|
+
* - `bind: { prop: (state, props) => value }` binds a prop to a selector.
|
|
36
|
+
* - An event binds to the function with its name, else to the name without
|
|
37
|
+
* `on` (`onAddToCart` calls `addToCart`).
|
|
38
|
+
* - `writable: ["value"]` gives the component a `setValue` prop. See
|
|
39
|
+
* `GenerativeUIComponentDefinition.writable`.
|
|
40
|
+
*
|
|
41
|
+
* The model does not see bound props or matched events.
|
|
42
|
+
*
|
|
43
|
+
* @param config - `id`, then optional `extends`, `state`, `functions` and
|
|
44
|
+
* `overrides`, then `components`. Put `state` before `components`, so the selectors
|
|
45
|
+
* get typed state.
|
|
46
|
+
* @throws Error when a name comes from two places, an override names no
|
|
47
|
+
* component of the bases, `props` is not an object
|
|
48
|
+
* schema with a JSON Schema, a key is reserved or used
|
|
49
|
+
* twice on a component, an event matches two functions, an unmatched event
|
|
50
|
+
* has no `parameters`, a `bind` key is not a prop, a `writable` key is not
|
|
51
|
+
* a prop or is a bound prop, or a setter name is already a key of the
|
|
52
|
+
* component. Also throws when `parameterOrder` contains duplicate or unknown
|
|
53
|
+
* keys, or an ordered component declares integer-index keys whose JSON object
|
|
54
|
+
* enumeration order cannot be controlled.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const ui = createGenerativeUI({
|
|
59
|
+
* id: "acme/store@1",
|
|
60
|
+
* state: { cart: cartSchema },
|
|
61
|
+
* functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },
|
|
62
|
+
* components: {
|
|
63
|
+
* CartSummary: {
|
|
64
|
+
* component: CartSummary,
|
|
65
|
+
* props: z.object({ count: z.number() }),
|
|
66
|
+
* bind: { count: (state) => state.cart.count },
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function createGenerativeUI$1<Bases extends readonly AnyGenerativeUI[] = [], State extends Record<string, GenerativeUISchema> = {}, Functions extends Record<string, GenerativeUIFunctionDefinition> = {}, Props extends Record<string, unknown> = {}, Events extends Record<string, unknown> = {}, Slots extends Record<string, unknown> = {}, Writable extends Record<string, unknown> = {}>(config: CreateGenerativeUIConfig$1<Bases, State, Functions, Props, Events, Slots, Writable>): GenerativeUI$1<GenerativeUIResultDefinitions<Bases, State, Functions, Props, Events, Slots, Writable>>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/generative-ui/accessibility.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* Experimental. The ARIA attributes of the `accessibility` that the model
|
|
77
|
+
* gave the component being rendered, to spread on its root element. The
|
|
78
|
+
* standard components do this; a custom component does it itself:
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* function Panel({ children }: { children?: ReactNode }) {
|
|
83
|
+
* const aria = useGenerativeUIAccessibility();
|
|
84
|
+
* return <section {...aria}>{children}</section>;
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Outside of generated UI it gives `{}`.
|
|
89
|
+
*/
|
|
90
|
+
declare function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/generative-ui/runtime-context.d.ts
|
|
93
|
+
interface GenerativeUIErrorBoundaryConfig {
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the host's fallback for a component that failed to render. It
|
|
96
|
+
* is not used for invalid props, unknown types, cyclic references or a
|
|
97
|
+
* failed surface: the host's `NodeFallback` shows those. If it throws,
|
|
98
|
+
* the host's fallback stands in and the error is reported. `error` is
|
|
99
|
+
* always an Error: a component that throws something else (a string,
|
|
100
|
+
* `undefined`) gets an Error that describes it, with the value as its
|
|
101
|
+
* `cause`.
|
|
102
|
+
*/
|
|
103
|
+
fallback?: (props: {
|
|
104
|
+
error: Error;
|
|
105
|
+
retry: () => void;
|
|
106
|
+
surfaceId: string;
|
|
107
|
+
componentId: string;
|
|
108
|
+
}) => ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Called for render, props, operation, function and event failures. A
|
|
111
|
+
* render or props failure that stays the same across new revisions of the
|
|
112
|
+
* node or the surface is reported once, until the node or surface renders
|
|
113
|
+
* again. A failed function or event is reported on every call.
|
|
114
|
+
*/
|
|
115
|
+
onError?: (info: GenerativeUIErrorInfo) => void;
|
|
116
|
+
}
|
|
117
|
+
interface GenerativeUIBaseConfig {
|
|
118
|
+
/**
|
|
119
|
+
* The result of `createGenerativeUI`: the components the model can render,
|
|
120
|
+
* the app state they read and the functions they call. Leave it out to
|
|
121
|
+
* use `standardUI` when the runtime turns generative UI on; the other
|
|
122
|
+
* options (such as `map` or `theme`) still apply.
|
|
123
|
+
*/
|
|
124
|
+
ui?: GenerativeUI$1;
|
|
125
|
+
/**
|
|
126
|
+
* The agents that get the generative UI. When omitted, every agent gets
|
|
127
|
+
* it. Other agents get no envelope.
|
|
128
|
+
*/
|
|
129
|
+
agentIds?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Web only. Values for the `--a2ui-*` CSS variables and the map style.
|
|
132
|
+
* Top-level values apply in both modes. `dark` changes them in dark mode,
|
|
133
|
+
* which is on under a `.dark` class, like the CopilotKit chat. React
|
|
134
|
+
* Native ignores it.
|
|
135
|
+
*/
|
|
136
|
+
theme?: GenerativeUITheme;
|
|
137
|
+
/**
|
|
138
|
+
* Web only. Loads `maplibre-gl` for the standard `Map` component. Pass
|
|
139
|
+
* `loadMapLibre` from `@copilotkit/react-core/generative-ui/map` and
|
|
140
|
+
* install `maplibre-gl`. Without it, Map shows its markers as a list, and
|
|
141
|
+
* the app builds without `maplibre-gl`. React Native ignores it.
|
|
142
|
+
*/
|
|
143
|
+
map?: GenerativeUILibraryLoader;
|
|
144
|
+
/** Fallback UI and error reporting for generated UI. */
|
|
145
|
+
errorBoundary?: GenerativeUIErrorBoundaryConfig;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Loads an optional library for a standard component, such as
|
|
149
|
+
* `loadMapLibre` from `@copilotkit/react-core/generative-ui/map`. The
|
|
150
|
+
* library stays out of apps that do not pass a loader.
|
|
151
|
+
*/
|
|
152
|
+
type GenerativeUILibraryLoader = () => Promise<unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* The tool transport: the model calls the `render_ui` tool, and the runtime
|
|
155
|
+
* validates each operation before it streams it to the client.
|
|
156
|
+
*/
|
|
157
|
+
interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {
|
|
158
|
+
/** Leave it out, or set "tool". */
|
|
159
|
+
transport?: "tool";
|
|
160
|
+
sendContext?: never;
|
|
161
|
+
includeCatalog?: never;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The markdown transport: the model writes the operations in ```a2ui fences
|
|
165
|
+
* in its reply. The client reads and validates them.
|
|
166
|
+
*/
|
|
167
|
+
interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {
|
|
168
|
+
transport: "markdown";
|
|
169
|
+
/**
|
|
170
|
+
* Send the component schema and the fence guideline as context entries.
|
|
171
|
+
* Set `false` when the backend builds its own prompt from the envelope.
|
|
172
|
+
* Default `true`.
|
|
173
|
+
*/
|
|
174
|
+
sendContext?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Send the component schemas in the envelope (`catalog.components`).
|
|
177
|
+
* Default `true`.
|
|
178
|
+
*/
|
|
179
|
+
includeCatalog?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set
|
|
183
|
+
* `transport: "markdown"` to get the markdown options.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```tsx
|
|
187
|
+
* <CopilotKitProvider generativeUI={{ ui }} />
|
|
188
|
+
* <CopilotKitProvider generativeUI={{ ui, transport: "markdown", sendContext: false }} />
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
type GenerativeUIConfig = GenerativeUIToolConfig | GenerativeUIMarkdownConfig;
|
|
192
|
+
interface GenerativeUIRuntime {
|
|
193
|
+
manager: GenerativeUISurfaceManager;
|
|
194
|
+
dispatcher: GenerativeUIDispatcher;
|
|
195
|
+
/** The generative UI given to the provider as `generativeUI={{ ui }}`. */
|
|
196
|
+
ui: GenerativeUI$1;
|
|
197
|
+
/** How the model sends operations. "tool" when the config leaves it out. */
|
|
198
|
+
transport: "tool" | "markdown";
|
|
199
|
+
/** The latest `generativeUI` config of the provider. */
|
|
200
|
+
readonly config: GenerativeUIConfig;
|
|
201
|
+
/**
|
|
202
|
+
* The latest `theme`. The host's surface root gets it: on the web it sets
|
|
203
|
+
* the CSS variables; the React Native root ignores it.
|
|
204
|
+
*/
|
|
205
|
+
theme?: GenerativeUITheme;
|
|
206
|
+
forwardEvent: (event: GenerativeUIUserEvent, agentId: string | undefined) => Promise<GenerativeUIInvokeResult>;
|
|
207
|
+
reportError: (info: GenerativeUIErrorInfo) => void;
|
|
208
|
+
readonly errorFallback?: GenerativeUIErrorBoundaryConfig["fallback"];
|
|
209
|
+
}
|
|
210
|
+
declare const GenerativeUIRuntimeContext: react.Context<GenerativeUIRuntime | null>;
|
|
211
|
+
declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
|
|
212
|
+
declare function useRequiredGenerativeUIRuntime(): GenerativeUIRuntime;
|
|
213
|
+
//#endregion
|
|
214
|
+
export { GenerativeUIFunctionInput as C, createGenerativeUI$1 as D, GenerativeUIStateOf as E, GenerativeUIFunctionDefinition$1 as S, GenerativeUISlotKind as T, GenerativeUIComponentName as _, GenerativeUIRuntime as a, GenerativeUIEventDefinition as b, GenerativeUIToolConfig as c, GenerativeUIAccessibility as d, GenerativeUIAriaAttributes$1 as f, GenerativeUIComponentDefinition$1 as g, GenerativeUI$1 as h, GenerativeUIMarkdownConfig as i, useGenerativeUIRuntime as l, CreateGenerativeUIConfig$1 as m, GenerativeUIErrorBoundaryConfig as n, GenerativeUIRuntimeContext as o, useGenerativeUIAccessibility as p, GenerativeUILibraryLoader as r, GenerativeUITheme as s, GenerativeUIConfig as t, useRequiredGenerativeUIRuntime as u, GenerativeUIComponentProps$1 as v, GenerativeUIFunctionName as w, GenerativeUIFunctionArgs as x, GenerativeUIDefinitionsOf as y };
|
|
215
|
+
//# sourceMappingURL=runtime-context-B7f4M85q.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-context-B7f4M85q.d.mts","names":[],"sources":["../src/generative-ui/catalog.ts","../src/generative-ui/accessibility.ts","../src/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;KA2CY,iCAAA,GACV,+BAAA,CAAsC,aAAA;;;;;AAYxC;KAAY,cAAA,qBACU,uBAAA,GAA0B,uBAAA,IAC5C,YAAA,CAAmB,WAAA,EAAa,aAAA;;;;;;;;KASxB,4BAAA,YACC,eAAA,qBACQ,WAAA,CAAY,EAAA,2CAC7B,0BAAA,CAAiC,EAAA,EAAI,IAAA,EAAM,SAAA;;KAG1C,eAAA,wBAAuC,eAAA,uBAC3B,4BAAA,CAA6B,KAAA;EAC1C,SAAA,EAAW,aAAA,CACT,4BAAA,CAA6B,KAAA,oCAC3B,uBAAA,GACE,4BAAA,CAA2B,cAAA,CAAa,WAAA,GAAc,IAAA;AAAA;;KAOpD,0BAAA,wBACa,eAAA,kBACT,MAAA,SAAe,kBAAA,qBACX,MAAA,SAAe,8BAAA,iBACnB,MAAA,kCACC,MAAA,iCACD,MAAA,oCACG,MAAA,qBACf,wBAAA,CACF,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA,EACA,eAAA,CAAgB,KAAA;AAlClB;;;;;;;;;;;;;;;;;;;;;;;AAG0D;;;;;;;;;;;;;;;;;;;AAH1D,iBA+EgB,oBAAA,wBACS,eAAA,uBACT,MAAA,SAAe,kBAAA,0BACX,MAAA,SAAe,8BAAA,sBACnB,MAAA,uCACC,MAAA,sCACD,MAAA,yCACG,MAAA,uBAAA,CAEjB,MAAA,EAAQ,0BAAA,CACN,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA,IAMsB,cAAA,CACtB,6BAAA,CACE,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA;;;;;;;AArIN;;;;;AAaA;;;;;;iBCrBgB,4BAAA,CAAA,GAAgC,0BAAA;;;UCpB/B,+BAAA;EF6Bf;;AAYF;;;;;;;EE/BE,QAAA,IAAY,KAAA;IACV,KAAA,EAAO,KAAA;IACP,KAAA;IACA,SAAA;IACA,WAAA;EAAA,MACI,SAAA;EF4BJ;;;;;AASJ;EE9BE,OAAA,IAAW,IAAA,EAAM,qBAAA;AAAA;AAAA,UAGT,sBAAA;EF6BuB;;;;;;EEtB/B,EAAA,GAAK,cAAA;EFuB6B;;;;EElBlC,QAAA;EFiB+B;;;;;;EEV/B,KAAA,GAAQ,iBAAA;EFcL;;;;;;EEPH,GAAA,GAAM,yBAAA;EFUF;EERJ,aAAA,GAAgB,+BAAA;AAAA;;;;;;KAQN,yBAAA,SAAkC,OAAA;;;;;UAM7B,sBAAA,SAA+B,sBAAA;EFP5C;EESF,SAAA;EAGA,WAAA;EACA,cAAA;AAAA;;;;;UAOe,0BAAA,SAAmC,sBAAA;EAClD,SAAA;EFlBkE;AAOpE;;;;EEiBE,WAAA;EFfc;;;;EEoBd,cAAA;AAAA;;;;;;;;;;;KAaU,kBAAA,GACR,sBAAA,GACA,0BAAA;AAAA,UAEa,mBAAA;EACf,OAAA,EAAS,0BAAA;EACT,UAAA,EAAY,sBAAA;EFxCW;EE0CvB,EAAA,EAAI,cAAA;EFzCU;EE2Cd,SAAA;EF1CA;EAAA,SE4CS,MAAA,EAAQ,kBAAA;EF5CgB;;;;EEiDjC,KAAA,GAAQ,iBAAA;EACR,YAAA,GACE,KAAA,EAAO,qBAAA,EACP,OAAA,yBACG,OAAA,CAAQ,wBAAA;EACb,WAAA,GAAc,IAAA,EAAM,qBAAA;EAAA,SACX,aAAA,GAAgB,+BAAA;AAAA;AAAA,cAGd,0BAAA,EAA0B,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,iBAGvB,sBAAA,CAAA,GAA0B,mBAAA;AAAA,iBAI1B,8BAAA,CAAA,GAAkC,mBAAA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as react from "react";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
import { AnyGenerativeUI, CreateGenerativeUIConfig, GenerativeUI, GenerativeUIBasesDefinitions, GenerativeUIComponentDefinition, GenerativeUIComponentName, GenerativeUIComponentProps, GenerativeUIDefinitions, GenerativeUIDefinitionsOf, GenerativeUIErrorInfo, GenerativeUIEventDefinition, GenerativeUIFunctionArgs, GenerativeUIFunctionDefinition, GenerativeUIFunctionDefinition as GenerativeUIFunctionDefinition$1, GenerativeUIFunctionInput, GenerativeUIFunctionName, GenerativeUIInvokeResult, GenerativeUIResultDefinitions, GenerativeUISchema, GenerativeUISlotKind, GenerativeUIStateOf, GenerativeUITheme } from "@copilotkit/shared/generative-ui";
|
|
4
|
+
import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
|
|
5
|
+
import { GenerativeUIUserEvent } from "@copilotkit/shared";
|
|
6
|
+
|
|
7
|
+
//#region src/generative-ui/catalog.d.ts
|
|
8
|
+
/** One component of a generative UI, as the renderer reads it. */
|
|
9
|
+
type GenerativeUIComponentDefinition$1 = GenerativeUIComponentDefinition<ComponentType<any>>;
|
|
10
|
+
/**
|
|
11
|
+
* Experimental. The result of `createGenerativeUI`: the components the model
|
|
12
|
+
* can render, the app state they read, and the functions they call. Give it
|
|
13
|
+
* to the provider (`generativeUI={{ ui }}`) and to the typed hooks.
|
|
14
|
+
*/
|
|
15
|
+
type GenerativeUI$1<Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions> = GenerativeUI<Definitions, ComponentType<any>>;
|
|
16
|
+
/**
|
|
17
|
+
* Props that the renderer passes to a component:
|
|
18
|
+
* `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, "CheckoutForm">)`.
|
|
19
|
+
* Data props are the parsed `props` schema, bound props included. Event and
|
|
20
|
+
* slot props are present only when they are bound or filled. Each writable
|
|
21
|
+
* prop gets a setter (`value` gets `setValue`), which is always present.
|
|
22
|
+
*/
|
|
23
|
+
type GenerativeUIComponentProps$1<UI extends AnyGenerativeUI, Name extends keyof NonNullable<UI["definitions"]>["components"] & string> = GenerativeUIComponentProps<UI, Name, ReactNode>;
|
|
24
|
+
/** One new React component for each component of the bases that it names. */
|
|
25
|
+
type OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = { [Name in keyof GenerativeUIBasesDefinitions<Bases>["components"] & string]?: {
|
|
26
|
+
component: ComponentType<GenerativeUIBasesDefinitions<Bases> extends infer Definitions extends GenerativeUIDefinitions ? GenerativeUIComponentProps$1<GenerativeUI$1<Definitions>, Name> : never>;
|
|
27
|
+
} };
|
|
28
|
+
/** The config of `createGenerativeUI`. */
|
|
29
|
+
type CreateGenerativeUIConfig$1<Bases extends readonly AnyGenerativeUI[], State extends Record<string, GenerativeUISchema>, Functions extends Record<string, GenerativeUIFunctionDefinition>, Props extends Record<string, unknown>, Events extends Record<string, unknown>, Slots extends Record<string, unknown>, Writable extends Record<string, unknown>> = CreateGenerativeUIConfig<Bases, State, Functions, Props, Events, Slots, Writable, OverridesConfig<Bases>>;
|
|
30
|
+
/**
|
|
31
|
+
* Experimental. Declares the components the model can render, the app state
|
|
32
|
+
* they read, and the functions they call.
|
|
33
|
+
*
|
|
34
|
+
* - A prop with the name of a top-level state key is bound to that state.
|
|
35
|
+
* - `bind: { prop: (state, props) => value }` binds a prop to a selector.
|
|
36
|
+
* - An event binds to the function with its name, else to the name without
|
|
37
|
+
* `on` (`onAddToCart` calls `addToCart`).
|
|
38
|
+
* - `writable: ["value"]` gives the component a `setValue` prop. See
|
|
39
|
+
* `GenerativeUIComponentDefinition.writable`.
|
|
40
|
+
*
|
|
41
|
+
* The model does not see bound props or matched events.
|
|
42
|
+
*
|
|
43
|
+
* @param config - `id`, then optional `extends`, `state`, `functions` and
|
|
44
|
+
* `overrides`, then `components`. Put `state` before `components`, so the selectors
|
|
45
|
+
* get typed state.
|
|
46
|
+
* @throws Error when a name comes from two places, an override names no
|
|
47
|
+
* component of the bases, `props` is not an object
|
|
48
|
+
* schema with a JSON Schema, a key is reserved or used
|
|
49
|
+
* twice on a component, an event matches two functions, an unmatched event
|
|
50
|
+
* has no `parameters`, a `bind` key is not a prop, a `writable` key is not
|
|
51
|
+
* a prop or is a bound prop, or a setter name is already a key of the
|
|
52
|
+
* component. Also throws when `parameterOrder` contains duplicate or unknown
|
|
53
|
+
* keys, or an ordered component declares integer-index keys whose JSON object
|
|
54
|
+
* enumeration order cannot be controlled.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const ui = createGenerativeUI({
|
|
59
|
+
* id: "acme/store@1",
|
|
60
|
+
* state: { cart: cartSchema },
|
|
61
|
+
* functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },
|
|
62
|
+
* components: {
|
|
63
|
+
* CartSummary: {
|
|
64
|
+
* component: CartSummary,
|
|
65
|
+
* props: z.object({ count: z.number() }),
|
|
66
|
+
* bind: { count: (state) => state.cart.count },
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function createGenerativeUI<Bases extends readonly AnyGenerativeUI[] = [], State extends Record<string, GenerativeUISchema> = {}, Functions extends Record<string, GenerativeUIFunctionDefinition> = {}, Props extends Record<string, unknown> = {}, Events extends Record<string, unknown> = {}, Slots extends Record<string, unknown> = {}, Writable extends Record<string, unknown> = {}>(config: CreateGenerativeUIConfig$1<Bases, State, Functions, Props, Events, Slots, Writable>): GenerativeUI$1<GenerativeUIResultDefinitions<Bases, State, Functions, Props, Events, Slots, Writable>>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/generative-ui/accessibility.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* Experimental. The ARIA attributes of the `accessibility` that the model
|
|
77
|
+
* gave the component being rendered, to spread on its root element. The
|
|
78
|
+
* standard components do this; a custom component does it itself:
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* function Panel({ children }: { children?: ReactNode }) {
|
|
83
|
+
* const aria = useGenerativeUIAccessibility();
|
|
84
|
+
* return <section {...aria}>{children}</section>;
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Outside of generated UI it gives `{}`.
|
|
89
|
+
*/
|
|
90
|
+
declare function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/generative-ui/runtime-context.d.ts
|
|
93
|
+
interface GenerativeUIErrorBoundaryConfig {
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the host's fallback for a component that failed to render. It
|
|
96
|
+
* is not used for invalid props, unknown types, cyclic references or a
|
|
97
|
+
* failed surface: the host's `NodeFallback` shows those. If it throws,
|
|
98
|
+
* the host's fallback stands in and the error is reported. `error` is
|
|
99
|
+
* always an Error: a component that throws something else (a string,
|
|
100
|
+
* `undefined`) gets an Error that describes it, with the value as its
|
|
101
|
+
* `cause`.
|
|
102
|
+
*/
|
|
103
|
+
fallback?: (props: {
|
|
104
|
+
error: Error;
|
|
105
|
+
retry: () => void;
|
|
106
|
+
surfaceId: string;
|
|
107
|
+
componentId: string;
|
|
108
|
+
}) => ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Called for render, props, operation, function and event failures. A
|
|
111
|
+
* render or props failure that stays the same across new revisions of the
|
|
112
|
+
* node or the surface is reported once, until the node or surface renders
|
|
113
|
+
* again. A failed function or event is reported on every call.
|
|
114
|
+
*/
|
|
115
|
+
onError?: (info: GenerativeUIErrorInfo) => void;
|
|
116
|
+
}
|
|
117
|
+
interface GenerativeUIBaseConfig {
|
|
118
|
+
/**
|
|
119
|
+
* The result of `createGenerativeUI`: the components the model can render,
|
|
120
|
+
* the app state they read and the functions they call. Leave it out to
|
|
121
|
+
* use `standardUI` when the runtime turns generative UI on; the other
|
|
122
|
+
* options (such as `map` or `theme`) still apply.
|
|
123
|
+
*/
|
|
124
|
+
ui?: GenerativeUI$1;
|
|
125
|
+
/**
|
|
126
|
+
* The agents that get the generative UI. When omitted, every agent gets
|
|
127
|
+
* it. Other agents get no envelope.
|
|
128
|
+
*/
|
|
129
|
+
agentIds?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Web only. Values for the `--a2ui-*` CSS variables and the map style.
|
|
132
|
+
* Top-level values apply in both modes. `dark` changes them in dark mode,
|
|
133
|
+
* which is on under a `.dark` class, like the CopilotKit chat. React
|
|
134
|
+
* Native ignores it.
|
|
135
|
+
*/
|
|
136
|
+
theme?: GenerativeUITheme;
|
|
137
|
+
/**
|
|
138
|
+
* Web only. Loads `maplibre-gl` for the standard `Map` component. Pass
|
|
139
|
+
* `loadMapLibre` from `@copilotkit/react-core/generative-ui/map` and
|
|
140
|
+
* install `maplibre-gl`. Without it, Map shows its markers as a list, and
|
|
141
|
+
* the app builds without `maplibre-gl`. React Native ignores it.
|
|
142
|
+
*/
|
|
143
|
+
map?: GenerativeUILibraryLoader;
|
|
144
|
+
/** Fallback UI and error reporting for generated UI. */
|
|
145
|
+
errorBoundary?: GenerativeUIErrorBoundaryConfig;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Loads an optional library for a standard component, such as
|
|
149
|
+
* `loadMapLibre` from `@copilotkit/react-core/generative-ui/map`. The
|
|
150
|
+
* library stays out of apps that do not pass a loader.
|
|
151
|
+
*/
|
|
152
|
+
type GenerativeUILibraryLoader = () => Promise<unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* The tool transport: the model calls the `render_ui` tool, and the runtime
|
|
155
|
+
* validates each operation before it streams it to the client.
|
|
156
|
+
*/
|
|
157
|
+
interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {
|
|
158
|
+
/** Leave it out, or set "tool". */
|
|
159
|
+
transport?: "tool";
|
|
160
|
+
sendContext?: never;
|
|
161
|
+
includeCatalog?: never;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The markdown transport: the model writes the operations in ```a2ui fences
|
|
165
|
+
* in its reply. The client reads and validates them.
|
|
166
|
+
*/
|
|
167
|
+
interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {
|
|
168
|
+
transport: "markdown";
|
|
169
|
+
/**
|
|
170
|
+
* Send the component schema and the fence guideline as context entries.
|
|
171
|
+
* Set `false` when the backend builds its own prompt from the envelope.
|
|
172
|
+
* Default `true`.
|
|
173
|
+
*/
|
|
174
|
+
sendContext?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Send the component schemas in the envelope (`catalog.components`).
|
|
177
|
+
* Default `true`.
|
|
178
|
+
*/
|
|
179
|
+
includeCatalog?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set
|
|
183
|
+
* `transport: "markdown"` to get the markdown options.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```tsx
|
|
187
|
+
* <CopilotKitProvider generativeUI={{ ui }} />
|
|
188
|
+
* <CopilotKitProvider generativeUI={{ ui, transport: "markdown", sendContext: false }} />
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
type GenerativeUIConfig = GenerativeUIToolConfig | GenerativeUIMarkdownConfig;
|
|
192
|
+
interface GenerativeUIRuntime {
|
|
193
|
+
manager: GenerativeUISurfaceManager;
|
|
194
|
+
dispatcher: GenerativeUIDispatcher;
|
|
195
|
+
/** The generative UI given to the provider as `generativeUI={{ ui }}`. */
|
|
196
|
+
ui: GenerativeUI$1;
|
|
197
|
+
/** How the model sends operations. "tool" when the config leaves it out. */
|
|
198
|
+
transport: "tool" | "markdown";
|
|
199
|
+
/** The latest `generativeUI` config of the provider. */
|
|
200
|
+
readonly config: GenerativeUIConfig;
|
|
201
|
+
/**
|
|
202
|
+
* The latest `theme`. The host's surface root gets it: on the web it sets
|
|
203
|
+
* the CSS variables; the React Native root ignores it.
|
|
204
|
+
*/
|
|
205
|
+
theme?: GenerativeUITheme;
|
|
206
|
+
forwardEvent: (event: GenerativeUIUserEvent, agentId: string | undefined) => Promise<GenerativeUIInvokeResult>;
|
|
207
|
+
reportError: (info: GenerativeUIErrorInfo) => void;
|
|
208
|
+
readonly errorFallback?: GenerativeUIErrorBoundaryConfig["fallback"];
|
|
209
|
+
}
|
|
210
|
+
declare const GenerativeUIRuntimeContext: react.Context<GenerativeUIRuntime | null>;
|
|
211
|
+
declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
|
|
212
|
+
declare function useRequiredGenerativeUIRuntime(): GenerativeUIRuntime;
|
|
213
|
+
//#endregion
|
|
214
|
+
export { GenerativeUIFunctionInput as C, createGenerativeUI as D, GenerativeUIStateOf as E, GenerativeUIFunctionDefinition$1 as S, GenerativeUISlotKind as T, GenerativeUIComponentName as _, GenerativeUIRuntime as a, GenerativeUIEventDefinition as b, GenerativeUIToolConfig as c, GenerativeUIAccessibility as d, GenerativeUIAriaAttributes$1 as f, GenerativeUIComponentDefinition$1 as g, GenerativeUI$1 as h, GenerativeUIMarkdownConfig as i, useGenerativeUIRuntime as l, CreateGenerativeUIConfig$1 as m, GenerativeUIErrorBoundaryConfig as n, GenerativeUIRuntimeContext as o, useGenerativeUIAccessibility as p, GenerativeUILibraryLoader as r, GenerativeUITheme as s, GenerativeUIConfig as t, useRequiredGenerativeUIRuntime as u, GenerativeUIComponentProps$1 as v, GenerativeUIFunctionName as w, GenerativeUIFunctionArgs as x, GenerativeUIDefinitionsOf as y };
|
|
215
|
+
//# sourceMappingURL=runtime-context-CIkZS0ap.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-context-CIkZS0ap.d.cts","names":[],"sources":["../src/generative-ui/catalog.ts","../src/generative-ui/accessibility.ts","../src/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;KA2CY,iCAAA,GACV,+BAAA,CAAsC,aAAA;;;;;AAYxC;KAAY,cAAA,qBACU,uBAAA,GAA0B,uBAAA,IAC5C,YAAA,CAAmB,WAAA,EAAa,aAAA;;;;;;;;KASxB,4BAAA,YACC,eAAA,qBACQ,WAAA,CAAY,EAAA,2CAC7B,0BAAA,CAAiC,EAAA,EAAI,IAAA,EAAM,SAAA;;KAG1C,eAAA,wBAAuC,eAAA,uBAC3B,4BAAA,CAA6B,KAAA;EAC1C,SAAA,EAAW,aAAA,CACT,4BAAA,CAA6B,KAAA,oCAC3B,uBAAA,GACE,4BAAA,CAA2B,cAAA,CAAa,WAAA,GAAc,IAAA;AAAA;;KAOpD,0BAAA,wBACa,eAAA,kBACT,MAAA,SAAe,kBAAA,qBACX,MAAA,SAAe,8BAAA,iBACnB,MAAA,kCACC,MAAA,iCACD,MAAA,oCACG,MAAA,qBACf,wBAAA,CACF,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA,EACA,eAAA,CAAgB,KAAA;AAlClB;;;;;;;;;;;;;;;;;;;;;;;AAG0D;;;;;;;;;;;;;;;;;;;AAH1D,iBA+EgB,kBAAA,wBACS,eAAA,uBACT,MAAA,SAAe,kBAAA,0BACX,MAAA,SAAe,8BAAA,sBACnB,MAAA,uCACC,MAAA,sCACD,MAAA,yCACG,MAAA,uBAAA,CAEjB,MAAA,EAAQ,0BAAA,CACN,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA,IAMsB,cAAA,CACtB,6BAAA,CACE,KAAA,EACA,KAAA,EACA,SAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,QAAA;;;;;;;AArIN;;;;;AAaA;;;;;;iBCrBgB,4BAAA,CAAA,GAAgC,0BAAA;;;UCpB/B,+BAAA;EF6Bf;;AAYF;;;;;;;EE/BE,QAAA,IAAY,KAAA;IACV,KAAA,EAAO,KAAA;IACP,KAAA;IACA,SAAA;IACA,WAAA;EAAA,MACI,SAAA;EF4BJ;;;;;AASJ;EE9BE,OAAA,IAAW,IAAA,EAAM,qBAAA;AAAA;AAAA,UAGT,sBAAA;EF6BuB;;;;;;EEtB/B,EAAA,GAAK,cAAA;EFuB6B;;;;EElBlC,QAAA;EFiB+B;;;;;;EEV/B,KAAA,GAAQ,iBAAA;EFcL;;;;;;EEPH,GAAA,GAAM,yBAAA;EFUF;EERJ,aAAA,GAAgB,+BAAA;AAAA;;;;;;KAQN,yBAAA,SAAkC,OAAA;;;;;UAM7B,sBAAA,SAA+B,sBAAA;EFP5C;EESF,SAAA;EAGA,WAAA;EACA,cAAA;AAAA;;;;;UAOe,0BAAA,SAAmC,sBAAA;EAClD,SAAA;EFlBkE;AAOpE;;;;EEiBE,WAAA;EFfc;;;;EEoBd,cAAA;AAAA;;;;;;;;;;;KAaU,kBAAA,GACR,sBAAA,GACA,0BAAA;AAAA,UAEa,mBAAA;EACf,OAAA,EAAS,0BAAA;EACT,UAAA,EAAY,sBAAA;EFxCW;EE0CvB,EAAA,EAAI,cAAA;EFzCU;EE2Cd,SAAA;EF1CA;EAAA,SE4CS,MAAA,EAAQ,kBAAA;EF5CgB;;;;EEiDjC,KAAA,GAAQ,iBAAA;EACR,YAAA,GACE,KAAA,EAAO,qBAAA,EACP,OAAA,yBACG,OAAA,CAAQ,wBAAA;EACb,WAAA,GAAc,IAAA,EAAM,qBAAA;EAAA,SACX,aAAA,GAAgB,+BAAA;AAAA;AAAA,cAGd,0BAAA,EAA0B,KAAA,CAAA,OAAA,CAAA,mBAAA;AAAA,iBAGvB,sBAAA,CAAA,GAA0B,mBAAA;AAAA,iBAI1B,8BAAA,CAAA,GAAkC,mBAAA"}
|