@copilotkit/react-core 1.84.2-canary.1793807121 → 1.84.2-canary.openbot-intel-fixes

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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/MarkdownSurfaces-3cGU5_0H.cjs +1619 -0
  3. package/dist/MarkdownSurfaces-3cGU5_0H.cjs.map +1 -0
  4. package/dist/MarkdownSurfaces-D-W4f9Dy.mjs +1442 -0
  5. package/dist/MarkdownSurfaces-D-W4f9Dy.mjs.map +1 -0
  6. package/dist/{copilotkit-OVo9Xjmp.d.cts → copilotkit-CuTAoQF2.d.cts} +5 -5
  7. package/dist/{copilotkit-OVo9Xjmp.d.cts.map → copilotkit-CuTAoQF2.d.cts.map} +1 -1
  8. package/dist/{copilotkit-CP8oYU3L.cjs → copilotkit-DYtl9zj0.cjs} +56 -1347
  9. package/dist/copilotkit-DYtl9zj0.cjs.map +1 -0
  10. package/dist/{copilotkit-CFqSAotl.d.mts → copilotkit-Dn4PbHJV.d.mts} +5 -5
  11. package/dist/{copilotkit-CFqSAotl.d.mts.map → copilotkit-Dn4PbHJV.d.mts.map} +1 -1
  12. package/dist/{copilotkit-CdZ3W0B2.mjs → copilotkit-UHD9sXsS.mjs} +44 -1335
  13. package/dist/copilotkit-UHD9sXsS.mjs.map +1 -0
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.mjs +2 -2
  18. package/dist/index.umd.js +165 -3347
  19. package/dist/index.umd.js.map +1 -1
  20. package/dist/runtime-context-DrVNUYLi.d.cts +228 -0
  21. package/dist/runtime-context-DrVNUYLi.d.cts.map +1 -0
  22. package/dist/runtime-context-Er5UIbZA.d.mts +228 -0
  23. package/dist/runtime-context-Er5UIbZA.d.mts.map +1 -0
  24. package/dist/v2/generative-ui.cjs +687 -2963
  25. package/dist/v2/generative-ui.cjs.map +1 -1
  26. package/dist/v2/generative-ui.d.cts +4506 -4712
  27. package/dist/v2/generative-ui.d.cts.map +1 -1
  28. package/dist/v2/generative-ui.d.mts +4506 -4712
  29. package/dist/v2/generative-ui.d.mts.map +1 -1
  30. package/dist/v2/generative-ui.mjs +299 -2585
  31. package/dist/v2/generative-ui.mjs.map +1 -1
  32. package/dist/v2/index.cjs +2 -20
  33. package/dist/v2/index.d.cts +3 -3
  34. package/dist/v2/index.d.mts +3 -3
  35. package/dist/v2/index.mjs +3 -3
  36. package/dist/v2/index.umd.js +149 -3349
  37. package/dist/v2/index.umd.js.map +1 -1
  38. package/package.json +11 -11
  39. package/dist/MarkdownSurfaces-DV9P0Gi9.mjs +0 -3573
  40. package/dist/MarkdownSurfaces-DV9P0Gi9.mjs.map +0 -1
  41. package/dist/MarkdownSurfaces-IUaWSJ0E.cjs +0 -3858
  42. package/dist/MarkdownSurfaces-IUaWSJ0E.cjs.map +0 -1
  43. package/dist/copilotkit-CP8oYU3L.cjs.map +0 -1
  44. package/dist/copilotkit-CdZ3W0B2.mjs.map +0 -1
  45. package/dist/runtime-context-CrHq-iTf.d.mts +0 -924
  46. package/dist/runtime-context-CrHq-iTf.d.mts.map +0 -1
  47. package/dist/runtime-context-D3NcP9oE.d.cts +0 -924
  48. package/dist/runtime-context-D3NcP9oE.d.cts.map +0 -1
@@ -0,0 +1,228 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import React$1, { ComponentType, ReactNode } from "react";
3
+ import { GenerativeUIRejectedOperation, GenerativeUIUserEvent, StandardSchemaV1 } from "@copilotkit/shared";
4
+ import { AbstractAgent } from "@ag-ui/client";
5
+ import { ActivityMessage } from "@ag-ui/core";
6
+ import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
7
+ 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";
8
+
9
+ //#region src/v2/types/react-activity-message-renderer.d.ts
10
+ interface ReactActivityMessageRenderer<TActivityContent> {
11
+ /**
12
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
13
+ */
14
+ activityType: string;
15
+ /**
16
+ * Optional agent ID to scope the renderer to a particular agent.
17
+ */
18
+ agentId?: string;
19
+ /**
20
+ * Schema describing the activity content payload.
21
+ */
22
+ content: StandardSchemaV1<any, TActivityContent>;
23
+ /**
24
+ * React component invoked to render the activity message.
25
+ */
26
+ render: React.ComponentType<{
27
+ activityType: string;
28
+ content: TActivityContent;
29
+ message: ActivityMessage;
30
+ agent: AbstractAgent | undefined;
31
+ }>;
32
+ }
33
+ //#endregion
34
+ //#region src/v2/generative-ui/chat.d.ts
35
+ interface GenerativeUIChatSurfaceProps {
36
+ surfaceId: string;
37
+ isStreaming: boolean;
38
+ /**
39
+ * Set when operations from the latest render_ui call were rejected. The
40
+ * message is user-facing; `error.cause` holds the same list as `rejected`.
41
+ */
42
+ error?: Error;
43
+ /** Rejected operations from the latest render_ui call, with validator reasons. */
44
+ rejected: GenerativeUIRejectedOperation[];
45
+ children: ReactNode;
46
+ }
47
+ declare function DefaultGenerativeUIChatCard({
48
+ surfaceId,
49
+ isStreaming,
50
+ error,
51
+ children
52
+ }: GenerativeUIChatSurfaceProps): react_jsx_runtime0.JSX.Element;
53
+ //#endregion
54
+ //#region src/v2/generative-ui/accessibility.d.ts
55
+ /**
56
+ * Experimental. The ARIA attributes of the `accessibility` that the model
57
+ * gave the component being rendered, to spread on its root element. The
58
+ * standard components do this; a custom component does it itself:
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * function Panel({ children }: { children?: ReactNode }) {
63
+ * const aria = useGenerativeUIAccessibility();
64
+ * return <section {...aria}>{children}</section>;
65
+ * }
66
+ * ```
67
+ *
68
+ * Outside of generated UI it gives `{}`.
69
+ */
70
+ declare function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes;
71
+ //#endregion
72
+ //#region src/v2/generative-ui/catalog.d.ts
73
+ /** One component of a generative UI, as the renderer reads it. */
74
+ type GenerativeUIComponentDefinition$1 = GenerativeUIComponentDefinition<ComponentType<any>>;
75
+ /**
76
+ * Experimental. The result of `createGenerativeUI`: the components the model
77
+ * can render, the app state they read, and the functions they call. Give it
78
+ * to the provider (`generativeUI={{ ui }}`) and to the typed hooks.
79
+ */
80
+ type GenerativeUI$1<Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions> = GenerativeUI<Definitions, ComponentType<any>>;
81
+ /**
82
+ * Props that the renderer passes to a component:
83
+ * `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, "CheckoutForm">)`.
84
+ * Data props are the parsed `props` schema, bound props included. Event and
85
+ * slot props are present only when they are bound or filled. Each writable
86
+ * prop gets a setter (`value` gets `setValue`), which is always present.
87
+ */
88
+ type GenerativeUIComponentProps$1<UI extends AnyGenerativeUI, Name extends keyof NonNullable<UI["definitions"]>["components"] & string> = GenerativeUIComponentProps<UI, Name, ReactNode>;
89
+ /** One new React component for each component of the bases that it names. */
90
+ type OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = { [Name in keyof GenerativeUIBasesDefinitions<Bases>["components"] & string]?: {
91
+ component: ComponentType<GenerativeUIBasesDefinitions<Bases> extends infer Definitions extends GenerativeUIDefinitions ? GenerativeUIComponentProps$1<GenerativeUI$1<Definitions>, Name> : never>;
92
+ } };
93
+ /** The config of `createGenerativeUI`. */
94
+ 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>>;
95
+ /**
96
+ * Experimental. Declares the components the model can render, the app state
97
+ * they read, and the functions they call.
98
+ *
99
+ * - A prop with the name of a top-level state key is bound to that state.
100
+ * - `bind: { prop: (state, props) => value }` binds a prop to a selector.
101
+ * - An event binds to the function with its name, else to the name without
102
+ * `on` (`onAddToCart` calls `addToCart`).
103
+ * - `writable: ["value"]` gives the component a `setValue` prop. See
104
+ * `GenerativeUIComponentDefinition.writable`.
105
+ *
106
+ * The model does not see bound props or matched events.
107
+ *
108
+ * @param config - `id`, then optional `extends`, `state`, `functions` and
109
+ * `overrides`, then `components`. Put `state` before `components`, so the selectors
110
+ * get typed state.
111
+ * @throws Error when a name comes from two places, an override names no
112
+ * component of the bases, `props` is not an object
113
+ * schema with a JSON Schema, a key is reserved or used
114
+ * twice on a component, an event matches two functions, an unmatched event
115
+ * has no `parameters`, a `bind` key is not a prop, a `writable` key is not
116
+ * a prop or is a bound prop, or a setter name is already a key of the
117
+ * component. Also throws when `parameterOrder` contains duplicate or unknown
118
+ * keys, or an ordered component declares integer-index keys whose JSON object
119
+ * enumeration order cannot be controlled.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * const ui = createGenerativeUI({
124
+ * id: "acme/store@1",
125
+ * state: { cart: cartSchema },
126
+ * functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },
127
+ * components: {
128
+ * CartSummary: {
129
+ * component: CartSummary,
130
+ * props: z.object({ count: z.number() }),
131
+ * bind: { count: (state) => state.cart.count },
132
+ * },
133
+ * },
134
+ * });
135
+ * ```
136
+ */
137
+ 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>>;
138
+ //#endregion
139
+ //#region src/v2/generative-ui/runtime-context.d.ts
140
+ interface GenerativeUIErrorBoundaryConfig {
141
+ /** Replaces the default per-component fallback. */
142
+ fallback?: (props: {
143
+ error: Error;
144
+ retry: () => void;
145
+ surfaceId: string;
146
+ componentId: string;
147
+ }) => ReactNode;
148
+ /** Called for render, props, operation, function and event failures. */
149
+ onError?: (info: GenerativeUIErrorInfo) => void;
150
+ }
151
+ interface GenerativeUIBaseConfig {
152
+ /**
153
+ * The result of `createGenerativeUI`: the components the model can render,
154
+ * the app state they read and the functions they call.
155
+ */
156
+ ui: GenerativeUI$1;
157
+ /**
158
+ * The agents that get the generative UI. When omitted, every agent gets
159
+ * it. Other agents get no envelope.
160
+ */
161
+ agentIds?: string[];
162
+ /**
163
+ * Values for the `--a2ui-*` CSS variables and the map style. Top-level
164
+ * values apply in both modes. `dark` changes them in dark mode, which is
165
+ * on under a `.dark` class, like the CopilotKit chat.
166
+ */
167
+ theme?: GenerativeUITheme;
168
+ /** Fallback UI and error reporting for generated UI. */
169
+ errorBoundary?: GenerativeUIErrorBoundaryConfig;
170
+ }
171
+ /**
172
+ * The tool transport: the model calls the `render_ui` tool, and the runtime
173
+ * validates each operation before it streams it to the client.
174
+ */
175
+ interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {
176
+ /** Leave it out, or set "tool". */
177
+ transport?: "tool";
178
+ sendContext?: never;
179
+ includeCatalog?: never;
180
+ }
181
+ /**
182
+ * The markdown transport: the model writes the operations in ```a2ui fences
183
+ * in its reply. The client reads and validates them.
184
+ */
185
+ interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {
186
+ transport: "markdown";
187
+ /**
188
+ * Send the component schema and the fence guideline as context entries.
189
+ * Set `false` when the backend builds its own prompt from the envelope.
190
+ * Default `true`.
191
+ */
192
+ sendContext?: boolean;
193
+ /**
194
+ * Send the component schemas in the envelope (`catalog.components`).
195
+ * Default `true`.
196
+ */
197
+ includeCatalog?: boolean;
198
+ }
199
+ /**
200
+ * Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set
201
+ * `transport: "markdown"` to get the markdown options.
202
+ *
203
+ * @example
204
+ * ```tsx
205
+ * <CopilotKitProvider generativeUI={{ ui }} />
206
+ * <CopilotKitProvider generativeUI={{ ui, transport: "markdown", sendContext: false }} />
207
+ * ```
208
+ */
209
+ type GenerativeUIConfig = GenerativeUIToolConfig | GenerativeUIMarkdownConfig;
210
+ interface GenerativeUIRuntime {
211
+ manager: GenerativeUISurfaceManager;
212
+ dispatcher: GenerativeUIDispatcher;
213
+ /** The generative UI given to the provider as `generativeUI={{ ui }}`. */
214
+ ui: GenerativeUI$1;
215
+ /** How the model sends operations. "tool" when the config leaves it out. */
216
+ transport: "tool" | "markdown";
217
+ /** The latest `generativeUI` config of the provider. */
218
+ readonly config: GenerativeUIConfig;
219
+ /** The latest `theme`. Each surface root sets its CSS variables. */
220
+ theme?: GenerativeUITheme;
221
+ forwardEvent: (event: GenerativeUIUserEvent, agentId: string | undefined) => Promise<GenerativeUIInvokeResult>;
222
+ reportError: (info: GenerativeUIErrorInfo) => void;
223
+ readonly errorFallback?: GenerativeUIErrorBoundaryConfig["fallback"];
224
+ }
225
+ declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
226
+ //#endregion
227
+ export { useGenerativeUIAccessibility as C, ReactActivityMessageRenderer as E, GenerativeUIAriaAttributes$1 as S, GenerativeUIChatSurfaceProps as T, GenerativeUIFunctionName as _, GenerativeUIToolConfig as a, createGenerativeUI as b, GenerativeUI$1 as c, GenerativeUIComponentProps$1 as d, GenerativeUIDefinitionsOf as f, GenerativeUIFunctionInput as g, GenerativeUIFunctionDefinition$1 as h, GenerativeUITheme as i, GenerativeUIComponentDefinition$1 as l, GenerativeUIFunctionArgs as m, GenerativeUIErrorBoundaryConfig as n, useGenerativeUIRuntime as o, GenerativeUIEventDefinition as p, GenerativeUIMarkdownConfig as r, CreateGenerativeUIConfig$1 as s, GenerativeUIConfig as t, GenerativeUIComponentName as u, GenerativeUISlotKind as v, DefaultGenerativeUIChatCard as w, GenerativeUIAccessibility as x, GenerativeUIStateOf as y };
228
+ //# sourceMappingURL=runtime-context-DrVNUYLi.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-context-DrVNUYLi.d.cts","names":[],"sources":["../src/v2/types/react-activity-message-renderer.ts","../src/v2/generative-ui/chat.tsx","../src/v2/generative-ui/accessibility.ts","../src/v2/generative-ui/catalog.ts","../src/v2/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;;UAIiB,4BAAA;;;;EAIf,YAAA;;AAJF;;EAQE,OAAA;EAI+B;;;EAA/B,OAAA,EAAS,gBAAA,MAAsB,gBAAA;EAQtB;;;EAJT,MAAA,EAAQ,KAAA,CAAM,aAAA;IACZ,YAAA;IACA,OAAA,EAAS,gBAAA;IACT,OAAA,EAAS,eAAA;IACT,KAAA,EAAO,aAAA;EAAA;AAAA;;;UCGM,4BAAA;EACf,SAAA;EACA,WAAA;;;ADzBF;;EC8BE,KAAA,GAAQ,KAAA;EDlBuB;ECoB/B,QAAA,EAAU,6BAAA;EACV,QAAA,EAAU,SAAA;AAAA;AAAA,iBAOI,2BAAA,CAAA;EACd,SAAA;EACA,WAAA;EACA,KAAA;EACA;AAAA,GACC,4BAAA,GAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;AD7C/B;;;;;;;;;iBE+BgB,4BAAA,CAAA,GAAgC,0BAAA;;;;KCQpC,iCAAA,GACV,+BAAA,CAAsC,aAAA;;AHxCxC;;;;KGoDY,cAAA,q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;;;;EIiBA,QAAA;EJfW;;;;;EIqBX,KAAA,GAAQ,iBAAA;EJnBc;EIqBtB,aAAA,GAAgB,+BAAA;AAAA;;AHlBlB;;;UGyBiB,sBAAA,SAA+B,sBAAA;EHhBpC;EGkBV,SAAA;EAGA,WAAA;EACA,cAAA;AAAA;;;;;UAOe,0BAAA,SAAmC,sBAAA;EAClD,SAAA;EH7BU;;;AAOZ;;EG4BE,WAAA;EH3BA;;;;EGgCA,cAAA;AAAA;;;;;;;;;;;KAaU,kBAAA,GACR,sBAAA,GACA,0BAAA;AAAA,UAEa,mBAAA;EACf,OAAA,EAAS,0BAAA;EACT,UAAA,EAAY,sBAAA;EH/CiB;EGiD7B,EAAA,EAAI,cAAA;;EAEJ,SAAA;EFjEc;EAAA,SEmEL,MAAA,EAAQ,kBAAA;;EAEjB,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,iBAMX,sBAAA,CAAA,GAA0B,mBAAA"}
@@ -0,0 +1,228 @@
1
+ import React$1, { ComponentType, ReactNode } from "react";
2
+ import { AbstractAgent } from "@ag-ui/client";
3
+ import { GenerativeUIRejectedOperation, GenerativeUIUserEvent, StandardSchemaV1 } from "@copilotkit/shared";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+ import { ActivityMessage } from "@ag-ui/core";
6
+ import { GenerativeUIAccessibility, GenerativeUIAriaAttributes, GenerativeUIAriaAttributes as GenerativeUIAriaAttributes$1, GenerativeUIDispatcher, GenerativeUISurfaceManager } from "@copilotkit/core/generative-ui";
7
+ 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";
8
+
9
+ //#region src/v2/types/react-activity-message-renderer.d.ts
10
+ interface ReactActivityMessageRenderer<TActivityContent> {
11
+ /**
12
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
13
+ */
14
+ activityType: string;
15
+ /**
16
+ * Optional agent ID to scope the renderer to a particular agent.
17
+ */
18
+ agentId?: string;
19
+ /**
20
+ * Schema describing the activity content payload.
21
+ */
22
+ content: StandardSchemaV1<any, TActivityContent>;
23
+ /**
24
+ * React component invoked to render the activity message.
25
+ */
26
+ render: React.ComponentType<{
27
+ activityType: string;
28
+ content: TActivityContent;
29
+ message: ActivityMessage;
30
+ agent: AbstractAgent | undefined;
31
+ }>;
32
+ }
33
+ //#endregion
34
+ //#region src/v2/generative-ui/chat.d.ts
35
+ interface GenerativeUIChatSurfaceProps {
36
+ surfaceId: string;
37
+ isStreaming: boolean;
38
+ /**
39
+ * Set when operations from the latest render_ui call were rejected. The
40
+ * message is user-facing; `error.cause` holds the same list as `rejected`.
41
+ */
42
+ error?: Error;
43
+ /** Rejected operations from the latest render_ui call, with validator reasons. */
44
+ rejected: GenerativeUIRejectedOperation[];
45
+ children: ReactNode;
46
+ }
47
+ declare function DefaultGenerativeUIChatCard({
48
+ surfaceId,
49
+ isStreaming,
50
+ error,
51
+ children
52
+ }: GenerativeUIChatSurfaceProps): react_jsx_runtime0.JSX.Element;
53
+ //#endregion
54
+ //#region src/v2/generative-ui/accessibility.d.ts
55
+ /**
56
+ * Experimental. The ARIA attributes of the `accessibility` that the model
57
+ * gave the component being rendered, to spread on its root element. The
58
+ * standard components do this; a custom component does it itself:
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * function Panel({ children }: { children?: ReactNode }) {
63
+ * const aria = useGenerativeUIAccessibility();
64
+ * return <section {...aria}>{children}</section>;
65
+ * }
66
+ * ```
67
+ *
68
+ * Outside of generated UI it gives `{}`.
69
+ */
70
+ declare function useGenerativeUIAccessibility(): GenerativeUIAriaAttributes;
71
+ //#endregion
72
+ //#region src/v2/generative-ui/catalog.d.ts
73
+ /** One component of a generative UI, as the renderer reads it. */
74
+ type GenerativeUIComponentDefinition$1 = GenerativeUIComponentDefinition<ComponentType<any>>;
75
+ /**
76
+ * Experimental. The result of `createGenerativeUI`: the components the model
77
+ * can render, the app state they read, and the functions they call. Give it
78
+ * to the provider (`generativeUI={{ ui }}`) and to the typed hooks.
79
+ */
80
+ type GenerativeUI$1<Definitions extends GenerativeUIDefinitions = GenerativeUIDefinitions> = GenerativeUI<Definitions, ComponentType<any>>;
81
+ /**
82
+ * Props that the renderer passes to a component:
83
+ * `function CheckoutForm(props: GenerativeUIComponentProps<typeof ui, "CheckoutForm">)`.
84
+ * Data props are the parsed `props` schema, bound props included. Event and
85
+ * slot props are present only when they are bound or filled. Each writable
86
+ * prop gets a setter (`value` gets `setValue`), which is always present.
87
+ */
88
+ type GenerativeUIComponentProps$1<UI extends AnyGenerativeUI, Name extends keyof NonNullable<UI["definitions"]>["components"] & string> = GenerativeUIComponentProps<UI, Name, ReactNode>;
89
+ /** One new React component for each component of the bases that it names. */
90
+ type OverridesConfig<Bases extends readonly AnyGenerativeUI[]> = { [Name in keyof GenerativeUIBasesDefinitions<Bases>["components"] & string]?: {
91
+ component: ComponentType<GenerativeUIBasesDefinitions<Bases> extends infer Definitions extends GenerativeUIDefinitions ? GenerativeUIComponentProps$1<GenerativeUI$1<Definitions>, Name> : never>;
92
+ } };
93
+ /** The config of `createGenerativeUI`. */
94
+ 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>>;
95
+ /**
96
+ * Experimental. Declares the components the model can render, the app state
97
+ * they read, and the functions they call.
98
+ *
99
+ * - A prop with the name of a top-level state key is bound to that state.
100
+ * - `bind: { prop: (state, props) => value }` binds a prop to a selector.
101
+ * - An event binds to the function with its name, else to the name without
102
+ * `on` (`onAddToCart` calls `addToCart`).
103
+ * - `writable: ["value"]` gives the component a `setValue` prop. See
104
+ * `GenerativeUIComponentDefinition.writable`.
105
+ *
106
+ * The model does not see bound props or matched events.
107
+ *
108
+ * @param config - `id`, then optional `extends`, `state`, `functions` and
109
+ * `overrides`, then `components`. Put `state` before `components`, so the selectors
110
+ * get typed state.
111
+ * @throws Error when a name comes from two places, an override names no
112
+ * component of the bases, `props` is not an object
113
+ * schema with a JSON Schema, a key is reserved or used
114
+ * twice on a component, an event matches two functions, an unmatched event
115
+ * has no `parameters`, a `bind` key is not a prop, a `writable` key is not
116
+ * a prop or is a bound prop, or a setter name is already a key of the
117
+ * component. Also throws when `parameterOrder` contains duplicate or unknown
118
+ * keys, or an ordered component declares integer-index keys whose JSON object
119
+ * enumeration order cannot be controlled.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * const ui = createGenerativeUI({
124
+ * id: "acme/store@1",
125
+ * state: { cart: cartSchema },
126
+ * functions: { addToCart: { parameters: z.object({ productId: z.string() }) } },
127
+ * components: {
128
+ * CartSummary: {
129
+ * component: CartSummary,
130
+ * props: z.object({ count: z.number() }),
131
+ * bind: { count: (state) => state.cart.count },
132
+ * },
133
+ * },
134
+ * });
135
+ * ```
136
+ */
137
+ 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>>;
138
+ //#endregion
139
+ //#region src/v2/generative-ui/runtime-context.d.ts
140
+ interface GenerativeUIErrorBoundaryConfig {
141
+ /** Replaces the default per-component fallback. */
142
+ fallback?: (props: {
143
+ error: Error;
144
+ retry: () => void;
145
+ surfaceId: string;
146
+ componentId: string;
147
+ }) => ReactNode;
148
+ /** Called for render, props, operation, function and event failures. */
149
+ onError?: (info: GenerativeUIErrorInfo) => void;
150
+ }
151
+ interface GenerativeUIBaseConfig {
152
+ /**
153
+ * The result of `createGenerativeUI`: the components the model can render,
154
+ * the app state they read and the functions they call.
155
+ */
156
+ ui: GenerativeUI$1;
157
+ /**
158
+ * The agents that get the generative UI. When omitted, every agent gets
159
+ * it. Other agents get no envelope.
160
+ */
161
+ agentIds?: string[];
162
+ /**
163
+ * Values for the `--a2ui-*` CSS variables and the map style. Top-level
164
+ * values apply in both modes. `dark` changes them in dark mode, which is
165
+ * on under a `.dark` class, like the CopilotKit chat.
166
+ */
167
+ theme?: GenerativeUITheme;
168
+ /** Fallback UI and error reporting for generated UI. */
169
+ errorBoundary?: GenerativeUIErrorBoundaryConfig;
170
+ }
171
+ /**
172
+ * The tool transport: the model calls the `render_ui` tool, and the runtime
173
+ * validates each operation before it streams it to the client.
174
+ */
175
+ interface GenerativeUIToolConfig extends GenerativeUIBaseConfig {
176
+ /** Leave it out, or set "tool". */
177
+ transport?: "tool";
178
+ sendContext?: never;
179
+ includeCatalog?: never;
180
+ }
181
+ /**
182
+ * The markdown transport: the model writes the operations in ```a2ui fences
183
+ * in its reply. The client reads and validates them.
184
+ */
185
+ interface GenerativeUIMarkdownConfig extends GenerativeUIBaseConfig {
186
+ transport: "markdown";
187
+ /**
188
+ * Send the component schema and the fence guideline as context entries.
189
+ * Set `false` when the backend builds its own prompt from the envelope.
190
+ * Default `true`.
191
+ */
192
+ sendContext?: boolean;
193
+ /**
194
+ * Send the component schemas in the envelope (`catalog.components`).
195
+ * Default `true`.
196
+ */
197
+ includeCatalog?: boolean;
198
+ }
199
+ /**
200
+ * Experimental. The `generativeUI` prop of `CopilotKitProvider`. Set
201
+ * `transport: "markdown"` to get the markdown options.
202
+ *
203
+ * @example
204
+ * ```tsx
205
+ * <CopilotKitProvider generativeUI={{ ui }} />
206
+ * <CopilotKitProvider generativeUI={{ ui, transport: "markdown", sendContext: false }} />
207
+ * ```
208
+ */
209
+ type GenerativeUIConfig = GenerativeUIToolConfig | GenerativeUIMarkdownConfig;
210
+ interface GenerativeUIRuntime {
211
+ manager: GenerativeUISurfaceManager;
212
+ dispatcher: GenerativeUIDispatcher;
213
+ /** The generative UI given to the provider as `generativeUI={{ ui }}`. */
214
+ ui: GenerativeUI$1;
215
+ /** How the model sends operations. "tool" when the config leaves it out. */
216
+ transport: "tool" | "markdown";
217
+ /** The latest `generativeUI` config of the provider. */
218
+ readonly config: GenerativeUIConfig;
219
+ /** The latest `theme`. Each surface root sets its CSS variables. */
220
+ theme?: GenerativeUITheme;
221
+ forwardEvent: (event: GenerativeUIUserEvent, agentId: string | undefined) => Promise<GenerativeUIInvokeResult>;
222
+ reportError: (info: GenerativeUIErrorInfo) => void;
223
+ readonly errorFallback?: GenerativeUIErrorBoundaryConfig["fallback"];
224
+ }
225
+ declare function useGenerativeUIRuntime(): GenerativeUIRuntime | null;
226
+ //#endregion
227
+ export { useGenerativeUIAccessibility as C, ReactActivityMessageRenderer as E, GenerativeUIAriaAttributes$1 as S, GenerativeUIChatSurfaceProps as T, GenerativeUIFunctionName as _, GenerativeUIToolConfig as a, createGenerativeUI$1 as b, GenerativeUI$1 as c, GenerativeUIComponentProps$1 as d, GenerativeUIDefinitionsOf as f, GenerativeUIFunctionInput as g, GenerativeUIFunctionDefinition$1 as h, GenerativeUITheme as i, GenerativeUIComponentDefinition$1 as l, GenerativeUIFunctionArgs as m, GenerativeUIErrorBoundaryConfig as n, useGenerativeUIRuntime as o, GenerativeUIEventDefinition as p, GenerativeUIMarkdownConfig as r, CreateGenerativeUIConfig$1 as s, GenerativeUIConfig as t, GenerativeUIComponentName as u, GenerativeUISlotKind as v, DefaultGenerativeUIChatCard as w, GenerativeUIAccessibility as x, GenerativeUIStateOf as y };
228
+ //# sourceMappingURL=runtime-context-Er5UIbZA.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-context-Er5UIbZA.d.mts","names":[],"sources":["../src/v2/types/react-activity-message-renderer.ts","../src/v2/generative-ui/chat.tsx","../src/v2/generative-ui/accessibility.ts","../src/v2/generative-ui/catalog.ts","../src/v2/generative-ui/runtime-context.ts"],"mappings":";;;;;;;;;UAIiB,4BAAA;;;;EAIf,YAAA;;AAJF;;EAQE,OAAA;EAI+B;;;EAA/B,OAAA,EAAS,gBAAA,MAAsB,gBAAA;EAQtB;;;EAJT,MAAA,EAAQ,KAAA,CAAM,aAAA;IACZ,YAAA;IACA,OAAA,EAAS,gBAAA;IACT,OAAA,EAAS,eAAA;IACT,KAAA,EAAO,aAAA;EAAA;AAAA;;;UCGM,4BAAA;EACf,SAAA;EACA,WAAA;;;ADzBF;;EC8BE,KAAA,GAAQ,KAAA;EDlBuB;ECoB/B,QAAA,EAAU,6BAAA;EACV,QAAA,EAAU,SAAA;AAAA;AAAA,iBAOI,2BAAA,CAAA;EACd,SAAA;EACA,WAAA;EACA,KAAA;EACA;AAAA,GACC,4BAAA,GAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;AD7C/B;;;;;;;;;iBE+BgB,4BAAA,CAAA,GAAgC,0BAAA;;;;KCQpC,iCAAA,GACV,+BAAA,CAAsC,aAAA;;AHxCxC;;;;KGoDY,cAAA,qBACU,uBAAA,GAA0B,uBAAA,IAC5C,YAAA,CAAmB,WAAA,EAAa,aAAA;;;;;;;;KASxB,4BAAA,Y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