@copilotkit/react-core 1.84.2-canary.openbot-intel-fixes → 1.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MarkdownSurfaces-BCVdnDAk.cjs +161 -0
- package/dist/MarkdownSurfaces-BCVdnDAk.cjs.map +1 -0
- package/dist/MarkdownSurfaces-CjJduaJR.mjs +149 -0
- package/dist/MarkdownSurfaces-CjJduaJR.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-3cGU5_0H.cjs → chat-BnsrQ0VS.cjs} +667 -320
- package/dist/chat-BnsrQ0VS.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-D-W4f9Dy.mjs → chat-IWySXWXP.mjs} +647 -312
- package/dist/chat-IWySXWXP.mjs.map +1 -0
- package/dist/{copilotkit-UHD9sXsS.mjs → copilotkit-B1OLgEU8.mjs} +6 -354
- package/dist/copilotkit-B1OLgEU8.mjs.map +1 -0
- package/dist/{copilotkit-Dn4PbHJV.d.mts → copilotkit-C7G95NO-.d.mts} +4 -4
- package/dist/{copilotkit-Dn4PbHJV.d.mts.map → copilotkit-C7G95NO-.d.mts.map} +1 -1
- package/dist/{copilotkit-DYtl9zj0.cjs → copilotkit-Ca0IcTZU.cjs} +79 -427
- package/dist/copilotkit-Ca0IcTZU.cjs.map +1 -0
- package/dist/{copilotkit-CuTAoQF2.d.cts → copilotkit-DwD7D6jJ.d.cts} +2 -2
- package/dist/{copilotkit-CuTAoQF2.d.cts.map → copilotkit-DwD7D6jJ.d.cts.map} +1 -1
- package/dist/hooks-DMSkcNOl.d.cts +89 -0
- package/dist/hooks-DMSkcNOl.d.cts.map +1 -0
- package/dist/hooks-EwGvqYsW.d.mts +89 -0
- package/dist/hooks-EwGvqYsW.d.mts.map +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +645 -140
- package/dist/index.umd.js.map +1 -1
- package/dist/refs-DL7ITFFD.cjs +43 -0
- package/dist/refs-DL7ITFFD.cjs.map +1 -0
- package/dist/refs-DiZXJ63p.mjs +31 -0
- package/dist/refs-DiZXJ63p.mjs.map +1 -0
- package/dist/{runtime-context-Er5UIbZA.d.mts → runtime-context-B4fKyzo6.d.mts} +31 -9
- package/dist/runtime-context-B4fKyzo6.d.mts.map +1 -0
- package/dist/{runtime-context-DrVNUYLi.d.cts → runtime-context-Da7T5vy4.d.cts} +31 -9
- package/dist/runtime-context-Da7T5vy4.d.cts.map +1 -0
- package/dist/use-generative-ui-root-CaTyBFNR.cjs +390 -0
- package/dist/use-generative-ui-root-CaTyBFNR.cjs.map +1 -0
- package/dist/use-generative-ui-root-WI9ERMpo.mjs +385 -0
- package/dist/use-generative-ui-root-WI9ERMpo.mjs.map +1 -0
- package/dist/v2/generative-ui/native.cjs +66 -0
- package/dist/v2/generative-ui/native.cjs.map +1 -0
- package/dist/v2/generative-ui/native.d.cts +155 -0
- package/dist/v2/generative-ui/native.d.cts.map +1 -0
- package/dist/v2/generative-ui/native.d.mts +155 -0
- package/dist/v2/generative-ui/native.d.mts.map +1 -0
- package/dist/v2/generative-ui/native.mjs +24 -0
- package/dist/v2/generative-ui/native.mjs.map +1 -0
- package/dist/v2/generative-ui.cjs +45 -70
- package/dist/v2/generative-ui.cjs.map +1 -1
- package/dist/v2/generative-ui.d.cts +229 -308
- package/dist/v2/generative-ui.d.cts.map +1 -1
- package/dist/v2/generative-ui.d.mts +229 -308
- package/dist/v2/generative-ui.d.mts.map +1 -1
- package/dist/v2/generative-ui.mjs +4 -29
- package/dist/v2/generative-ui.mjs.map +1 -1
- package/dist/v2/headless.d.cts +185 -294
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/index.cjs +5 -5
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/index.umd.js +645 -140
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +15 -11
- package/dist/MarkdownSurfaces-3cGU5_0H.cjs.map +0 -1
- package/dist/MarkdownSurfaces-D-W4f9Dy.mjs.map +0 -1
- package/dist/copilotkit-DYtl9zj0.cjs.map +0 -1
- package/dist/copilotkit-UHD9sXsS.mjs.map +0 -1
- package/dist/runtime-context-DrVNUYLi.d.cts.map +0 -1
- package/dist/runtime-context-Er5UIbZA.d.mts.map +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { C as createGenerativeUI, E as useGenerativeUIAccessibility, O as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIAriaAttributes, _ as GenerativeUIFunctionArgs, a as GenerativeUIRuntimeContext, b as GenerativeUIFunctionName, c as useGenerativeUIRuntime, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, i as GenerativeUIRuntime, k as GenerativeUIToolCallRenderer, l as useRequiredGenerativeUIRuntime, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIToolConfig, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as GenerativeUIAccessibility, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../../runtime-context-Da7T5vy4.cjs";
|
|
2
|
+
import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-DMSkcNOl.cjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import React, { ComponentType, ReactNode } from "react";
|
|
5
|
+
import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent } from "@copilotkit/shared";
|
|
6
|
+
import { GenerativeUISurfaceContentSchema, ManagedSurface, ParsedGenerativeUISurfaceContent, parseGenerativeUISurfaceContent } from "@copilotkit/core/generative-ui";
|
|
7
|
+
import { ExportA2UICatalogOptions, GenerativeUIError, GenerativeUIErrorCode, GenerativeUIErrorInfo, GenerativeUIEventHandler, GenerativeUIInvokeResult, exportA2UICatalog } from "@copilotkit/shared/generative-ui";
|
|
8
|
+
import { CopilotKitCoreReact } from "@copilotkit/react-core/v2/context";
|
|
9
|
+
|
|
10
|
+
//#region src/v2/generative-ui/SurfaceView.d.ts
|
|
11
|
+
declare function SurfaceView({
|
|
12
|
+
surface
|
|
13
|
+
}: {
|
|
14
|
+
surface: ManagedSurface;
|
|
15
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/v2/generative-ui/activity.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* The rejected operations of a surface (the runtime's first, then the
|
|
20
|
+
* client's) and the error that goes with them, for a wrapper: a generic
|
|
21
|
+
* message, with the same list as its `cause`. The `cause` is not enumerable,
|
|
22
|
+
* so `JSON.stringify`, a spread and error reporters leave the list out.
|
|
23
|
+
* `clientRejected` is appended to in place by the manager, so its length is
|
|
24
|
+
* part of the key.
|
|
25
|
+
*/
|
|
26
|
+
declare function useGenerativeUIRejected(serverRejected: readonly GenerativeUIRejectedOperation[] | undefined, clientRejected: readonly GenerativeUIRejectedOperation[] | undefined): {
|
|
27
|
+
rejected: GenerativeUIRejectedOperation[];
|
|
28
|
+
error: Error | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* What a renderer of one surface activity message shows: the surface (or the
|
|
32
|
+
* failed surface whose `createSurface` was rejected), and its rejected
|
|
33
|
+
* operations with their error (see {@link useGenerativeUIRejected}). It
|
|
34
|
+
* ingests `content` into the manager (idempotent: the root ingests the
|
|
35
|
+
* agent's messages too, and this covers an agent the root has not seen yet),
|
|
36
|
+
* and renders again on every change of the manager.
|
|
37
|
+
*
|
|
38
|
+
* `surface` is undefined when there is no runtime, thread or content, when
|
|
39
|
+
* the surface's target is not `target`, or when the surface does not exist
|
|
40
|
+
* (the agent deleted it). Both rejected lists cover only the latest
|
|
41
|
+
* `render_ui` call (see the manager's ingest).
|
|
42
|
+
*/
|
|
43
|
+
declare function useGenerativeUIActivitySurface({
|
|
44
|
+
runtime,
|
|
45
|
+
threadId,
|
|
46
|
+
agentId,
|
|
47
|
+
content,
|
|
48
|
+
target
|
|
49
|
+
}: {
|
|
50
|
+
runtime: GenerativeUIRuntime | null;
|
|
51
|
+
threadId: string | undefined;
|
|
52
|
+
agentId: string | undefined; /** The parsed content; undefined when it is malformed. */
|
|
53
|
+
content: GenerativeUISurfaceContent | undefined; /** The target whose surfaces this renderer shows. */
|
|
54
|
+
target: string;
|
|
55
|
+
}): {
|
|
56
|
+
surface: ManagedSurface | undefined;
|
|
57
|
+
rejected: GenerativeUIRejectedOperation[];
|
|
58
|
+
error: Error | undefined;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/v2/generative-ui/host.d.ts
|
|
62
|
+
/** Props of {@link GenerativeUIHost.SurfaceRoot}. */
|
|
63
|
+
interface GenerativeUISurfaceRootProps {
|
|
64
|
+
surfaceId: string;
|
|
65
|
+
/** The theme of the provider (`generativeUI.theme`). */
|
|
66
|
+
theme: GenerativeUITheme | undefined;
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/** Props of {@link GenerativeUIHost.AccessibilityWrapper}. */
|
|
70
|
+
interface GenerativeUIAccessibilityWrapperProps {
|
|
71
|
+
/**
|
|
72
|
+
* The hidden state and live region of the component's envelope. A label
|
|
73
|
+
* or a description needs an element with a role, so the component applies
|
|
74
|
+
* those itself.
|
|
75
|
+
*/
|
|
76
|
+
attributes: Pick<GenerativeUIAriaAttributes, "aria-hidden" | "aria-live">;
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
}
|
|
79
|
+
/** Props of {@link GenerativeUIHost.NodeFallback}. */
|
|
80
|
+
interface GenerativeUINodeFallbackProps {
|
|
81
|
+
message: string;
|
|
82
|
+
/**
|
|
83
|
+
* The node that cannot be shown, or `"surface"` for a whole surface that
|
|
84
|
+
* failed. The marker is in the id space: a node the model named
|
|
85
|
+
* `"surface"` looks the same. The error report tells the two apart (a
|
|
86
|
+
* surface failure has no `componentId`).
|
|
87
|
+
*/
|
|
88
|
+
componentId: string;
|
|
89
|
+
/** Renders the node again. Given for render failures only. */
|
|
90
|
+
retry?: () => void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The few host elements that a surface draws itself, around the catalog's
|
|
94
|
+
* components. The defaults are DOM elements, so a platform without a DOM
|
|
95
|
+
* must supply its own host through `GenerativeUIHostContext`, above every
|
|
96
|
+
* surface it renders. React Native does
|
|
97
|
+
* (`@copilotkit/react-native/generative-ui`), so that the same renderer runs
|
|
98
|
+
* on both.
|
|
99
|
+
*
|
|
100
|
+
* The host and its components must keep their identity across renders:
|
|
101
|
+
* define them at module scope, or memoize them. React takes a new component
|
|
102
|
+
* type for a different element: a `SurfaceRoot` written inline (for example
|
|
103
|
+
* `host={{ ...base, SurfaceRoot: (p) => ... }}`) remounts every surface on
|
|
104
|
+
* each render of its provider, and a new `AccessibilityWrapper` remounts
|
|
105
|
+
* every wrapped component, so what the user typed into them is lost.
|
|
106
|
+
*/
|
|
107
|
+
interface GenerativeUIHost {
|
|
108
|
+
/** Wraps a whole surface. Must not remount when the theme changes. */
|
|
109
|
+
SurfaceRoot: ComponentType<GenerativeUISurfaceRootProps>;
|
|
110
|
+
/**
|
|
111
|
+
* Wraps every component that has an accessibility envelope, unless its
|
|
112
|
+
* definition applies the envelope itself (`accessibility: "self"`). It
|
|
113
|
+
* wraps the component whatever the envelope's values, even with no
|
|
114
|
+
* `hidden` or live region set, so it must render its children in the same
|
|
115
|
+
* place in either case: a bound `hidden` that toggles must not remount
|
|
116
|
+
* the component and lose its local state.
|
|
117
|
+
*/
|
|
118
|
+
AccessibilityWrapper: ComponentType<GenerativeUIAccessibilityWrapperProps>;
|
|
119
|
+
/**
|
|
120
|
+
* Shown in place of a component that cannot be shown: it failed to render
|
|
121
|
+
* (with `retry`), its props are invalid, its type is unknown, or it is a
|
|
122
|
+
* cyclic reference. It also stands in for a whole surface that failed,
|
|
123
|
+
* with `componentId: "surface"`. When the app sets
|
|
124
|
+
* `errorBoundary.fallback`, that replaces it for render failures, and this
|
|
125
|
+
* stands in only if the app's fallback throws. If this throws, the node
|
|
126
|
+
* renders nothing and the error is reported, once for each message; it is
|
|
127
|
+
* tried again with a new message, a new revision of the node or Retry.
|
|
128
|
+
*/
|
|
129
|
+
NodeFallback: ComponentType<GenerativeUINodeFallbackProps>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The host elements of the surfaces below. Defaults to the DOM host, so a
|
|
133
|
+
* web app never sets it.
|
|
134
|
+
*/
|
|
135
|
+
declare const GenerativeUIHostContext: React.Context<GenerativeUIHost>;
|
|
136
|
+
declare function useGenerativeUIHost(): GenerativeUIHost;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/v2/generative-ui/native.d.ts
|
|
139
|
+
/**
|
|
140
|
+
* Provider-side wiring: the surface manager, the agent subscriptions and the
|
|
141
|
+
* envelope of each run. Typed with the `CopilotKitCoreReact` of
|
|
142
|
+
* `/v2/context`, which is the instance a React Native provider holds.
|
|
143
|
+
*
|
|
144
|
+
* In source it is the same class that `use-generative-ui-root.ts` imports
|
|
145
|
+
* from `../lib/react-core`, so no cast is needed. The annotation is for the
|
|
146
|
+
* emitted declarations: `../context` is external to the build, so they import
|
|
147
|
+
* the class from `@copilotkit/react-core/v2/context`. Re-exported as is, the
|
|
148
|
+
* hook would be declared with a copy of the class from a bundled chunk, which
|
|
149
|
+
* the `/v2/context` instance is not assignable to (the class has private
|
|
150
|
+
* members). `scripts/assert-dist-context-types.mjs` checks this.
|
|
151
|
+
*/
|
|
152
|
+
declare const useGenerativeUIRoot: (copilotkit: CopilotKitCoreReact, config: GenerativeUIConfig | undefined) => GenerativeUIRuntime | null;
|
|
153
|
+
//#endregion
|
|
154
|
+
export { type CreateGenerativeUIConfig, type ExportA2UICatalogOptions, type GenerativeUI, type GenerativeUIAccessibility, type GenerativeUIAccessibilityWrapperProps, type GenerativeUIAriaAttributes, type GenerativeUIChatSurfaceProps, type GenerativeUIComponentDefinition, type GenerativeUIComponentName, type GenerativeUIComponentProps, type GenerativeUIConfig, GenerativeUIError, type GenerativeUIErrorBoundaryConfig, type GenerativeUIErrorCode, type GenerativeUIErrorInfo, type GenerativeUIEventDefinition, type GenerativeUIEventHandler, type GenerativeUIFunctionArgs, type GenerativeUIFunctionDefinition, type GenerativeUIFunctionInput, type GenerativeUIFunctionName, type GenerativeUIHost, GenerativeUIHostContext, type GenerativeUIInvokeResult, type GenerativeUIMarkdownConfig, type GenerativeUINodeFallbackProps, type GenerativeUIRuntime, GenerativeUIRuntimeContext, type GenerativeUISlotKind, type GenerativeUIStateOf, GenerativeUISurfaceContentSchema, type GenerativeUISurfaceRootProps, type GenerativeUITheme, GenerativeUIToolCallRenderer, type GenerativeUIToolConfig, type ParsedGenerativeUISurfaceContent, SurfaceView, child, childList, createGenerativeUI, exportA2UICatalog, parseGenerativeUISurfaceContent, useGenerativeUIAccessibility, useGenerativeUIActivitySurface, useGenerativeUIFunction, useGenerativeUIHost, useGenerativeUIRejected, useGenerativeUIRoot, useGenerativeUIRuntime, useGenerativeUIState, useManagerVersion, useRequiredGenerativeUIRuntime };
|
|
155
|
+
//# sourceMappingURL=native.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.cts","names":[],"sources":["../../../src/v2/generative-ui/SurfaceView.tsx","../../../src/v2/generative-ui/activity.ts","../../../src/v2/generative-ui/host.tsx","../../../src/v2/generative-ui/native.ts"],"mappings":";;;;;;;;;;iBAgGgB,WAAA,CAAA;EAAc;AAAA;EAAa,OAAA,EAAS,cAAA;AAAA,IAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;AAApE;;;iBCxEgB,uBAAA,CACd,cAAA,WAAyB,6BAAA,gBACzB,cAAA,WAAyB,6BAAA;EACtB,QAAA,EAAU,6BAAA;EAAiC,KAAA,EAAO,KAAA;AAAA;;;;;;;;;;;;;AAHvD;iBAoCgB,8BAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA;AAAA;EAEA,OAAA,EAAS,mBAAA;EACT,QAAA;EACA,OAAA,sBA1Ca;EA4Cb,OAAA,EAAS,0BAAA,cA5CiD;EA8C1D,MAAA;AAAA;EAEA,OAAA,EAAS,cAAA;EACT,QAAA,EAAU,6BAAA;EACV,KAAA,EAAO,KAAA;AAAA;;;;UCtEQ,4BAAA;EACf,SAAA;;EAEA,KAAA,EAAO,iBAAA;EACP,QAAA,EAAU,SAAA;AAAA;;UAIK,qCAAA;EFiFa;;;;;EE3E5B,UAAA,EAAY,IAAA,CAAK,0BAAA;EACjB,QAAA,EAAU,SAAA;AAAA;;UAIK,6BAAA;EACf,OAAA;EFqEkE;;;;;ACxEpE;ECUE,WAAA;;EAEA,KAAA;AAAA;;;;;;;;;;;;;;;ADwBF;UCNiB,gBAAA;;EAEf,WAAA,EAAa,aAAA,CAAc,4BAAA;EDM3B;;;;;;;;ECGA,oBAAA,EAAsB,aAAA,CAAc,qCAAA;EDYxB;;;;;;;;;;ECDZ,YAAA,EAAc,aAAA,CAAc,6BAAA;AAAA;;;;;cAuFjB,uBAAA,EAAuB,KAAA,CAAA,OAAA,CAAA,gBAAA;AAAA,iBAGpB,mBAAA,CAAA,GAAuB,gBAAA;;;;;;;;;;;;;;;;cCvF1B,mBAAA,GACX,UAAA,EAAY,mBAAA,EACZ,MAAA,EAAQ,kBAAA,iBACL,mBAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { C as createGenerativeUI, E as useGenerativeUIAccessibility, O as GenerativeUIChatSurfaceProps, S as GenerativeUIStateOf, T as GenerativeUIAriaAttributes, _ as GenerativeUIFunctionArgs, a as GenerativeUIRuntimeContext, b as GenerativeUIFunctionName, c as useGenerativeUIRuntime, d as GenerativeUI, f as GenerativeUIComponentDefinition, g as GenerativeUIEventDefinition, i as GenerativeUIRuntime, k as GenerativeUIToolCallRenderer, l as useRequiredGenerativeUIRuntime, m as GenerativeUIComponentProps, n as GenerativeUIErrorBoundaryConfig, o as GenerativeUITheme, p as GenerativeUIComponentName, r as GenerativeUIMarkdownConfig, s as GenerativeUIToolConfig, t as GenerativeUIConfig, u as CreateGenerativeUIConfig, v as GenerativeUIFunctionDefinition, w as GenerativeUIAccessibility, x as GenerativeUISlotKind, y as GenerativeUIFunctionInput } from "../../runtime-context-B4fKyzo6.mjs";
|
|
2
|
+
import { a as childList, i as child, n as useGenerativeUIState, r as useManagerVersion, t as useGenerativeUIFunction } from "../../hooks-EwGvqYsW.mjs";
|
|
3
|
+
import React, { ComponentType, ReactNode } from "react";
|
|
4
|
+
import { GenerativeUIRejectedOperation, GenerativeUISurfaceContent } from "@copilotkit/shared";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
import { GenerativeUISurfaceContentSchema, ManagedSurface, ParsedGenerativeUISurfaceContent, parseGenerativeUISurfaceContent } from "@copilotkit/core/generative-ui";
|
|
7
|
+
import { ExportA2UICatalogOptions, GenerativeUIError, GenerativeUIErrorCode, GenerativeUIErrorInfo, GenerativeUIEventHandler, GenerativeUIInvokeResult, exportA2UICatalog } from "@copilotkit/shared/generative-ui";
|
|
8
|
+
import { CopilotKitCoreReact } from "@copilotkit/react-core/v2/context";
|
|
9
|
+
|
|
10
|
+
//#region src/v2/generative-ui/SurfaceView.d.ts
|
|
11
|
+
declare function SurfaceView({
|
|
12
|
+
surface
|
|
13
|
+
}: {
|
|
14
|
+
surface: ManagedSurface;
|
|
15
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/v2/generative-ui/activity.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* The rejected operations of a surface (the runtime's first, then the
|
|
20
|
+
* client's) and the error that goes with them, for a wrapper: a generic
|
|
21
|
+
* message, with the same list as its `cause`. The `cause` is not enumerable,
|
|
22
|
+
* so `JSON.stringify`, a spread and error reporters leave the list out.
|
|
23
|
+
* `clientRejected` is appended to in place by the manager, so its length is
|
|
24
|
+
* part of the key.
|
|
25
|
+
*/
|
|
26
|
+
declare function useGenerativeUIRejected(serverRejected: readonly GenerativeUIRejectedOperation[] | undefined, clientRejected: readonly GenerativeUIRejectedOperation[] | undefined): {
|
|
27
|
+
rejected: GenerativeUIRejectedOperation[];
|
|
28
|
+
error: Error | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* What a renderer of one surface activity message shows: the surface (or the
|
|
32
|
+
* failed surface whose `createSurface` was rejected), and its rejected
|
|
33
|
+
* operations with their error (see {@link useGenerativeUIRejected}). It
|
|
34
|
+
* ingests `content` into the manager (idempotent: the root ingests the
|
|
35
|
+
* agent's messages too, and this covers an agent the root has not seen yet),
|
|
36
|
+
* and renders again on every change of the manager.
|
|
37
|
+
*
|
|
38
|
+
* `surface` is undefined when there is no runtime, thread or content, when
|
|
39
|
+
* the surface's target is not `target`, or when the surface does not exist
|
|
40
|
+
* (the agent deleted it). Both rejected lists cover only the latest
|
|
41
|
+
* `render_ui` call (see the manager's ingest).
|
|
42
|
+
*/
|
|
43
|
+
declare function useGenerativeUIActivitySurface({
|
|
44
|
+
runtime,
|
|
45
|
+
threadId,
|
|
46
|
+
agentId,
|
|
47
|
+
content,
|
|
48
|
+
target
|
|
49
|
+
}: {
|
|
50
|
+
runtime: GenerativeUIRuntime | null;
|
|
51
|
+
threadId: string | undefined;
|
|
52
|
+
agentId: string | undefined; /** The parsed content; undefined when it is malformed. */
|
|
53
|
+
content: GenerativeUISurfaceContent | undefined; /** The target whose surfaces this renderer shows. */
|
|
54
|
+
target: string;
|
|
55
|
+
}): {
|
|
56
|
+
surface: ManagedSurface | undefined;
|
|
57
|
+
rejected: GenerativeUIRejectedOperation[];
|
|
58
|
+
error: Error | undefined;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/v2/generative-ui/host.d.ts
|
|
62
|
+
/** Props of {@link GenerativeUIHost.SurfaceRoot}. */
|
|
63
|
+
interface GenerativeUISurfaceRootProps {
|
|
64
|
+
surfaceId: string;
|
|
65
|
+
/** The theme of the provider (`generativeUI.theme`). */
|
|
66
|
+
theme: GenerativeUITheme | undefined;
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/** Props of {@link GenerativeUIHost.AccessibilityWrapper}. */
|
|
70
|
+
interface GenerativeUIAccessibilityWrapperProps {
|
|
71
|
+
/**
|
|
72
|
+
* The hidden state and live region of the component's envelope. A label
|
|
73
|
+
* or a description needs an element with a role, so the component applies
|
|
74
|
+
* those itself.
|
|
75
|
+
*/
|
|
76
|
+
attributes: Pick<GenerativeUIAriaAttributes, "aria-hidden" | "aria-live">;
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
}
|
|
79
|
+
/** Props of {@link GenerativeUIHost.NodeFallback}. */
|
|
80
|
+
interface GenerativeUINodeFallbackProps {
|
|
81
|
+
message: string;
|
|
82
|
+
/**
|
|
83
|
+
* The node that cannot be shown, or `"surface"` for a whole surface that
|
|
84
|
+
* failed. The marker is in the id space: a node the model named
|
|
85
|
+
* `"surface"` looks the same. The error report tells the two apart (a
|
|
86
|
+
* surface failure has no `componentId`).
|
|
87
|
+
*/
|
|
88
|
+
componentId: string;
|
|
89
|
+
/** Renders the node again. Given for render failures only. */
|
|
90
|
+
retry?: () => void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The few host elements that a surface draws itself, around the catalog's
|
|
94
|
+
* components. The defaults are DOM elements, so a platform without a DOM
|
|
95
|
+
* must supply its own host through `GenerativeUIHostContext`, above every
|
|
96
|
+
* surface it renders. React Native does
|
|
97
|
+
* (`@copilotkit/react-native/generative-ui`), so that the same renderer runs
|
|
98
|
+
* on both.
|
|
99
|
+
*
|
|
100
|
+
* The host and its components must keep their identity across renders:
|
|
101
|
+
* define them at module scope, or memoize them. React takes a new component
|
|
102
|
+
* type for a different element: a `SurfaceRoot` written inline (for example
|
|
103
|
+
* `host={{ ...base, SurfaceRoot: (p) => ... }}`) remounts every surface on
|
|
104
|
+
* each render of its provider, and a new `AccessibilityWrapper` remounts
|
|
105
|
+
* every wrapped component, so what the user typed into them is lost.
|
|
106
|
+
*/
|
|
107
|
+
interface GenerativeUIHost {
|
|
108
|
+
/** Wraps a whole surface. Must not remount when the theme changes. */
|
|
109
|
+
SurfaceRoot: ComponentType<GenerativeUISurfaceRootProps>;
|
|
110
|
+
/**
|
|
111
|
+
* Wraps every component that has an accessibility envelope, unless its
|
|
112
|
+
* definition applies the envelope itself (`accessibility: "self"`). It
|
|
113
|
+
* wraps the component whatever the envelope's values, even with no
|
|
114
|
+
* `hidden` or live region set, so it must render its children in the same
|
|
115
|
+
* place in either case: a bound `hidden` that toggles must not remount
|
|
116
|
+
* the component and lose its local state.
|
|
117
|
+
*/
|
|
118
|
+
AccessibilityWrapper: ComponentType<GenerativeUIAccessibilityWrapperProps>;
|
|
119
|
+
/**
|
|
120
|
+
* Shown in place of a component that cannot be shown: it failed to render
|
|
121
|
+
* (with `retry`), its props are invalid, its type is unknown, or it is a
|
|
122
|
+
* cyclic reference. It also stands in for a whole surface that failed,
|
|
123
|
+
* with `componentId: "surface"`. When the app sets
|
|
124
|
+
* `errorBoundary.fallback`, that replaces it for render failures, and this
|
|
125
|
+
* stands in only if the app's fallback throws. If this throws, the node
|
|
126
|
+
* renders nothing and the error is reported, once for each message; it is
|
|
127
|
+
* tried again with a new message, a new revision of the node or Retry.
|
|
128
|
+
*/
|
|
129
|
+
NodeFallback: ComponentType<GenerativeUINodeFallbackProps>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The host elements of the surfaces below. Defaults to the DOM host, so a
|
|
133
|
+
* web app never sets it.
|
|
134
|
+
*/
|
|
135
|
+
declare const GenerativeUIHostContext: React.Context<GenerativeUIHost>;
|
|
136
|
+
declare function useGenerativeUIHost(): GenerativeUIHost;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/v2/generative-ui/native.d.ts
|
|
139
|
+
/**
|
|
140
|
+
* Provider-side wiring: the surface manager, the agent subscriptions and the
|
|
141
|
+
* envelope of each run. Typed with the `CopilotKitCoreReact` of
|
|
142
|
+
* `/v2/context`, which is the instance a React Native provider holds.
|
|
143
|
+
*
|
|
144
|
+
* In source it is the same class that `use-generative-ui-root.ts` imports
|
|
145
|
+
* from `../lib/react-core`, so no cast is needed. The annotation is for the
|
|
146
|
+
* emitted declarations: `../context` is external to the build, so they import
|
|
147
|
+
* the class from `@copilotkit/react-core/v2/context`. Re-exported as is, the
|
|
148
|
+
* hook would be declared with a copy of the class from a bundled chunk, which
|
|
149
|
+
* the `/v2/context` instance is not assignable to (the class has private
|
|
150
|
+
* members). `scripts/assert-dist-context-types.mjs` checks this.
|
|
151
|
+
*/
|
|
152
|
+
declare const useGenerativeUIRoot: (copilotkit: CopilotKitCoreReact, config: GenerativeUIConfig | undefined) => GenerativeUIRuntime | null;
|
|
153
|
+
//#endregion
|
|
154
|
+
export { type CreateGenerativeUIConfig, type ExportA2UICatalogOptions, type GenerativeUI, type GenerativeUIAccessibility, type GenerativeUIAccessibilityWrapperProps, type GenerativeUIAriaAttributes, type GenerativeUIChatSurfaceProps, type GenerativeUIComponentDefinition, type GenerativeUIComponentName, type GenerativeUIComponentProps, type GenerativeUIConfig, GenerativeUIError, type GenerativeUIErrorBoundaryConfig, type GenerativeUIErrorCode, type GenerativeUIErrorInfo, type GenerativeUIEventDefinition, type GenerativeUIEventHandler, type GenerativeUIFunctionArgs, type GenerativeUIFunctionDefinition, type GenerativeUIFunctionInput, type GenerativeUIFunctionName, type GenerativeUIHost, GenerativeUIHostContext, type GenerativeUIInvokeResult, type GenerativeUIMarkdownConfig, type GenerativeUINodeFallbackProps, type GenerativeUIRuntime, GenerativeUIRuntimeContext, type GenerativeUISlotKind, type GenerativeUIStateOf, GenerativeUISurfaceContentSchema, type GenerativeUISurfaceRootProps, type GenerativeUITheme, GenerativeUIToolCallRenderer, type GenerativeUIToolConfig, type ParsedGenerativeUISurfaceContent, SurfaceView, child, childList, createGenerativeUI, exportA2UICatalog, parseGenerativeUISurfaceContent, useGenerativeUIAccessibility, useGenerativeUIActivitySurface, useGenerativeUIFunction, useGenerativeUIHost, useGenerativeUIRejected, useGenerativeUIRoot, useGenerativeUIRuntime, useGenerativeUIState, useManagerVersion, useRequiredGenerativeUIRuntime };
|
|
155
|
+
//# sourceMappingURL=native.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.mts","names":[],"sources":["../../../src/v2/generative-ui/SurfaceView.tsx","../../../src/v2/generative-ui/activity.ts","../../../src/v2/generative-ui/host.tsx","../../../src/v2/generative-ui/native.ts"],"mappings":";;;;;;;;;;iBAgGgB,WAAA,CAAA;EAAc;AAAA;EAAa,OAAA,EAAS,cAAA;AAAA,IAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;AAApE;;;iBCxEgB,uBAAA,CACd,cAAA,WAAyB,6BAAA,gBACzB,cAAA,WAAyB,6BAAA;EACtB,QAAA,EAAU,6BAAA;EAAiC,KAAA,EAAO,KAAA;AAAA;;;;;;;;;;;;;AAHvD;iBAoCgB,8BAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA;AAAA;EAEA,OAAA,EAAS,mBAAA;EACT,QAAA;EACA,OAAA,sBA1Ca;EA4Cb,OAAA,EAAS,0BAAA,cA5CiD;EA8C1D,MAAA;AAAA;EAEA,OAAA,EAAS,cAAA;EACT,QAAA,EAAU,6BAAA;EACV,KAAA,EAAO,KAAA;AAAA;;;;UCtEQ,4BAAA;EACf,SAAA;;EAEA,KAAA,EAAO,iBAAA;EACP,QAAA,EAAU,SAAA;AAAA;;UAIK,qCAAA;EFiFa;;;;;EE3E5B,UAAA,EAAY,IAAA,CAAK,0BAAA;EACjB,QAAA,EAAU,SAAA;AAAA;;UAIK,6BAAA;EACf,OAAA;EFqEkE;;;;;ACxEpE;ECUE,WAAA;;EAEA,KAAA;AAAA;;;;;;;;;;;;;;;ADwBF;UCNiB,gBAAA;;EAEf,WAAA,EAAa,aAAA,CAAc,4BAAA;EDM3B;;;;;;;;ECGA,oBAAA,EAAsB,aAAA,CAAc,qCAAA;EDYxB;;;;;;;;;;ECDZ,YAAA,EAAc,aAAA,CAAc,6BAAA;AAAA;;;;;cAuFjB,uBAAA,EAAuB,KAAA,CAAA,OAAA,CAAA,gBAAA;AAAA,iBAGpB,mBAAA,CAAA,GAAuB,gBAAA;;;;;;;;;;;;;;;;cCvF1B,mBAAA,GACX,UAAA,EAAY,mBAAA,EACZ,MAAA,EAAQ,kBAAA,iBACL,mBAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { C as GenerativeUIRuntimeContext, T as useRequiredGenerativeUIRuntime, _ as useGenerativeUIActivitySurface, b as useGenerativeUIState, d as GenerativeUIHostContext, f as useGenerativeUIHost, g as parseGenerativeUISurfaceContent, h as GenerativeUISurfaceContentSchema, l as useGenerativeUIAccessibility, m as createGenerativeUI, o as SurfaceView, r as GenerativeUIToolCallRenderer, v as useGenerativeUIRejected, w as useGenerativeUIRuntime, x as useManagerVersion, y as useGenerativeUIFunction } from "../../chat-IWySXWXP.mjs";
|
|
2
|
+
import { t as useGenerativeUIRoot$1 } from "../../use-generative-ui-root-WI9ERMpo.mjs";
|
|
3
|
+
import { n as childList, t as child } from "../../refs-DiZXJ63p.mjs";
|
|
4
|
+
import { GenerativeUIError, exportA2UICatalog } from "@copilotkit/shared/generative-ui";
|
|
5
|
+
|
|
6
|
+
//#region src/v2/generative-ui/native.ts
|
|
7
|
+
/**
|
|
8
|
+
* Provider-side wiring: the surface manager, the agent subscriptions and the
|
|
9
|
+
* envelope of each run. Typed with the `CopilotKitCoreReact` of
|
|
10
|
+
* `/v2/context`, which is the instance a React Native provider holds.
|
|
11
|
+
*
|
|
12
|
+
* In source it is the same class that `use-generative-ui-root.ts` imports
|
|
13
|
+
* from `../lib/react-core`, so no cast is needed. The annotation is for the
|
|
14
|
+
* emitted declarations: `../context` is external to the build, so they import
|
|
15
|
+
* the class from `@copilotkit/react-core/v2/context`. Re-exported as is, the
|
|
16
|
+
* hook would be declared with a copy of the class from a bundled chunk, which
|
|
17
|
+
* the `/v2/context` instance is not assignable to (the class has private
|
|
18
|
+
* members). `scripts/assert-dist-context-types.mjs` checks this.
|
|
19
|
+
*/
|
|
20
|
+
const useGenerativeUIRoot = useGenerativeUIRoot$1;
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { GenerativeUIError, GenerativeUIHostContext, GenerativeUIRuntimeContext, GenerativeUISurfaceContentSchema, GenerativeUIToolCallRenderer, SurfaceView, child, childList, createGenerativeUI, exportA2UICatalog, parseGenerativeUISurfaceContent, useGenerativeUIAccessibility, useGenerativeUIActivitySurface, useGenerativeUIFunction, useGenerativeUIHost, useGenerativeUIRejected, useGenerativeUIRoot, useGenerativeUIRuntime, useGenerativeUIState, useManagerVersion, useRequiredGenerativeUIRuntime };
|
|
24
|
+
//# sourceMappingURL=native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["useGenerativeUIRootImpl"],"sources":["../../../src/v2/generative-ui/native.ts"],"sourcesContent":["// The `@copilotkit/react-core/v2/generative-ui/native` entry: generative UI\n// without the DOM. It has the catalog API, the hooks and the surface\n// renderer, and leaves out what only a browser can run: the standard\n// catalog (DOM components, portals, KaTeX), the markdown surfaces\n// (streamdown) and the DOM `<GenerativeUISurface>` mount. A platform gives\n// its host elements through `GenerativeUIHostContext`. That context defaults\n// to the DOM host, which renders HTML elements, so a platform\n// without a DOM MUST provide its own host above every surface it renders.\n// Nothing checks that it did: without one, on React Native, the `<div>` of\n// the surface root fails to render, the surface fallback (a `<div>` too)\n// fails as well, and the surface renders nothing; only the reported errors\n// show it. `@copilotkit/react-native/generative-ui` is built on this entry,\n// and its `GenerativeUIProvider` provides the native host.\n//\n// It is built together with `/v2` and `/v2/generative-ui`, so the three\n// entries share one copy of each React context.\n\n// The catalog API, as in `/v2/generative-ui`.\nexport { createGenerativeUI } from \"./catalog\";\nexport type {\n CreateGenerativeUIConfig,\n GenerativeUI,\n GenerativeUIComponentDefinition,\n GenerativeUIComponentName,\n GenerativeUIComponentProps,\n GenerativeUIEventDefinition,\n GenerativeUIFunctionArgs,\n GenerativeUIFunctionDefinition,\n GenerativeUIFunctionInput,\n GenerativeUIFunctionName,\n GenerativeUISlotKind,\n GenerativeUIStateOf,\n} from \"./catalog\";\nexport { child, childList } from \"./refs\";\nexport { exportA2UICatalog } from \"@copilotkit/shared/generative-ui\";\nexport type { ExportA2UICatalogOptions } from \"@copilotkit/shared/generative-ui\";\nexport { useGenerativeUIAccessibility } from \"./accessibility\";\nexport type {\n GenerativeUIAccessibility,\n GenerativeUIAriaAttributes,\n} from \"./accessibility\";\nexport { GenerativeUIError } from \"@copilotkit/shared/generative-ui\";\nexport type {\n GenerativeUIErrorCode,\n GenerativeUIErrorInfo,\n GenerativeUIEventHandler,\n GenerativeUIInvokeResult,\n} from \"@copilotkit/shared/generative-ui\";\nexport type {\n GenerativeUIConfig,\n GenerativeUIErrorBoundaryConfig,\n GenerativeUIMarkdownConfig,\n GenerativeUITheme,\n GenerativeUIToolConfig,\n} from \"./runtime-context\";\nexport { useGenerativeUIRuntime } from \"./runtime-context\";\nexport { useGenerativeUIFunction, useGenerativeUIState } from \"./hooks\";\n\n// The plumbing that a platform package uses to build its provider and\n// surfaces.\nimport { useGenerativeUIRoot as useGenerativeUIRootImpl } from \"./use-generative-ui-root\";\nimport type { CopilotKitCoreReact } from \"../context\";\nimport type {\n GenerativeUIConfig,\n GenerativeUIRuntime,\n} from \"./runtime-context\";\n/**\n * Provider-side wiring: the surface manager, the agent subscriptions and the\n * envelope of each run. Typed with the `CopilotKitCoreReact` of\n * `/v2/context`, which is the instance a React Native provider holds.\n *\n * In source it is the same class that `use-generative-ui-root.ts` imports\n * from `../lib/react-core`, so no cast is needed. The annotation is for the\n * emitted declarations: `../context` is external to the build, so they import\n * the class from `@copilotkit/react-core/v2/context`. Re-exported as is, the\n * hook would be declared with a copy of the class from a bundled chunk, which\n * the `/v2/context` instance is not assignable to (the class has private\n * members). `scripts/assert-dist-context-types.mjs` checks this.\n */\nexport const useGenerativeUIRoot: (\n copilotkit: CopilotKitCoreReact,\n config: GenerativeUIConfig | undefined,\n) => GenerativeUIRuntime | null = useGenerativeUIRootImpl;\nexport {\n GenerativeUIRuntimeContext,\n useRequiredGenerativeUIRuntime,\n} from \"./runtime-context\";\nexport type { GenerativeUIRuntime } from \"./runtime-context\";\nexport { useManagerVersion } from \"./hooks\";\nexport { SurfaceView } from \"./SurfaceView\";\nexport { GenerativeUIToolCallRenderer } from \"./chat\";\nexport {\n GenerativeUISurfaceContentSchema,\n parseGenerativeUISurfaceContent,\n useGenerativeUIActivitySurface,\n useGenerativeUIRejected,\n} from \"./activity\";\nexport type { ParsedGenerativeUISurfaceContent } from \"./activity\";\nexport type { GenerativeUIChatSurfaceProps } from \"./chat\";\nexport { GenerativeUIHostContext, useGenerativeUIHost } from \"./host\";\nexport type {\n GenerativeUIAccessibilityWrapperProps,\n GenerativeUIHost,\n GenerativeUINodeFallbackProps,\n GenerativeUISurfaceRootProps,\n} from \"./host\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+EA,MAAa,sBAGqBA"}
|