@copilotkit/react-core 2.0.0-rc.1 → 2.0.0-rc.10
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/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-CS35epe1.d.mts} +17 -33
- package/dist/MarkdownRendererContext-CS35epe1.d.mts.map +1 -0
- package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-CfTh92vk.d.cts} +17 -33
- package/dist/MarkdownRendererContext-CfTh92vk.d.cts.map +1 -0
- package/dist/{MarkdownSurfaces-ChSlVYOk.mjs → MarkdownSurfaces-CimUSR3Y.mjs} +153 -76
- package/dist/MarkdownSurfaces-CimUSR3Y.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-C2XZISKn.cjs → MarkdownSurfaces-DGDeUhbX.cjs} +175 -85
- package/dist/MarkdownSurfaces-DGDeUhbX.cjs.map +1 -0
- package/dist/context.cjs +20 -17
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +38 -98
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +38 -98
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +20 -17
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +564 -564
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +2137 -4178
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +2137 -4178
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +69 -70
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +50 -76
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +78 -253
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +56 -202
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +43 -74
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +1383 -1958
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +213 -538
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +212 -537
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1089 -1920
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1549 -2039
- package/dist/index.umd.js.map +1 -1
- package/package.json +20 -35
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +0 -1
- package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +0 -1
- package/dist/index.css +0 -2
|
@@ -28,18 +28,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
let _copilotkit_core = require("@copilotkit/core");
|
|
29
29
|
let react = require("react");
|
|
30
30
|
react = __toESM(react);
|
|
31
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
32
31
|
let _copilotkit_markdown_renderer_react = require("@copilotkit/markdown-renderer/react");
|
|
33
32
|
let _copilotkit_markdown_renderer = require("@copilotkit/markdown-renderer");
|
|
34
|
-
let
|
|
33
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
35
34
|
let _copilotkit_shared = require("@copilotkit/shared");
|
|
36
35
|
let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
|
|
37
36
|
let zod = require("zod");
|
|
38
|
-
|
|
37
|
+
zod = __toESM(zod);
|
|
39
38
|
|
|
40
39
|
//#region src/components/chat/StreamingMarkdownDefaultRenderer.tsx
|
|
41
40
|
const defaultNodeRenderers = (0, _copilotkit_markdown_renderer_react.createStreamingMarkdownNodeRenderers)({ codeBlock: ({ node }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
42
|
-
className: "cpk
|
|
41
|
+
className: "cpk-markdown-code-block",
|
|
43
42
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
44
43
|
"data-code-info": node.info ?? void 0,
|
|
45
44
|
children: node.text
|
|
@@ -72,6 +71,90 @@ function StreamingMarkdownDefaultRenderer({ content, isStreaming, className, nod
|
|
|
72
71
|
}
|
|
73
72
|
StreamingMarkdownDefaultRenderer.displayName = "StreamingMarkdownDefaultRenderer";
|
|
74
73
|
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/lib/utils.ts
|
|
76
|
+
/**
|
|
77
|
+
* Joins class names, skipping falsy values. Takes the same inputs as `clsx`.
|
|
78
|
+
* Classes are not merged: every rule CopilotKit ships sits in `:where()`, so a
|
|
79
|
+
* class the app adds wins without removing ours.
|
|
80
|
+
*/
|
|
81
|
+
function cn(...inputs) {
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const input of inputs) {
|
|
84
|
+
if (!input) continue;
|
|
85
|
+
if (typeof input === "string" || typeof input === "number" || typeof input === "bigint") out.push(String(input));
|
|
86
|
+
else if (Array.isArray(input)) {
|
|
87
|
+
const nested = cn(...input);
|
|
88
|
+
if (nested) out.push(nested);
|
|
89
|
+
} else if (typeof input === "object") {
|
|
90
|
+
for (const key in input) if (input[key]) out.push(key);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out.join(" ");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/components/icons/CopilotIcon.tsx
|
|
98
|
+
/** Turns SVG attribute names such as `stroke-width` into React's `strokeWidth`. */
|
|
99
|
+
function toReactAttributes(attributes) {
|
|
100
|
+
return Object.fromEntries(Object.entries(attributes).map(([key, value]) => [key.replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase()), value]));
|
|
101
|
+
}
|
|
102
|
+
const svgDefaults = toReactAttributes(_copilotkit_core.ɵcopilotIconSvgAttributes);
|
|
103
|
+
/** True when the props give the icon an accessible name or role. */
|
|
104
|
+
function hasAccessibleProp(props) {
|
|
105
|
+
return Object.keys(props).some((key) => key.startsWith("aria-") || key === "role" || key === "title");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Internal. Draws a Lucide icon from its node data, the way Lucide's React package
|
|
109
|
+
* does: Lucide's default SVG attributes, the `lucide lucide-<name>` classes,
|
|
110
|
+
* and `aria-hidden="true"` when no `aria-*`, `role` or `title` prop names it.
|
|
111
|
+
*/
|
|
112
|
+
const IconSvg = (0, react.forwardRef)(function IconSvg({ lucideName, nodes, size = 24, color = "currentColor", strokeWidth = 2, className, children, ...props }, ref) {
|
|
113
|
+
const isDecorative = !children && !hasAccessibleProp(props);
|
|
114
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
115
|
+
ref,
|
|
116
|
+
...svgDefaults,
|
|
117
|
+
width: size,
|
|
118
|
+
height: size,
|
|
119
|
+
stroke: color,
|
|
120
|
+
strokeWidth,
|
|
121
|
+
className: cn("lucide", `lucide-${lucideName}`, className),
|
|
122
|
+
"aria-hidden": isDecorative || void 0,
|
|
123
|
+
...props,
|
|
124
|
+
children: [nodes.map((node, index) => (0, react.createElement)(node.tag, {
|
|
125
|
+
key: index,
|
|
126
|
+
...node.attributes
|
|
127
|
+
})), children]
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Draws one of the chat icons as an inline `<svg>`.
|
|
132
|
+
*
|
|
133
|
+
* The `<svg>` has the classes `lucide lucide-<icon name>`, so CSS that selects
|
|
134
|
+
* them (for example `svg.lucide-arrow-up`) keeps working. The icon is hidden
|
|
135
|
+
* from screen readers unless you give it an `aria-label`, `role` or `title`.
|
|
136
|
+
*
|
|
137
|
+
* @param props.name - The chat icon, for example `"ArrowUp"` or `"X"`.
|
|
138
|
+
* @param props.size - Width and height. Defaults to `24`.
|
|
139
|
+
* @param props.strokeWidth - Line width. Defaults to `2`.
|
|
140
|
+
* @param props.color - Line color. Defaults to `currentColor`.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* <CopilotIcon name="ArrowUp" className="cpk-chat-input-send-icon" />
|
|
145
|
+
* <CopilotIcon name="X" aria-label="Close" />
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
const CopilotIcon = (0, react.forwardRef)(function CopilotIcon({ name, ...props }, ref) {
|
|
149
|
+
const icon = _copilotkit_core.ɵcopilotIcons[name];
|
|
150
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconSvg, {
|
|
151
|
+
ref,
|
|
152
|
+
lucideName: icon.name,
|
|
153
|
+
nodes: icon.nodes,
|
|
154
|
+
...props
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
75
158
|
//#endregion
|
|
76
159
|
//#region src/lib/shallow-stable-ref.ts
|
|
77
160
|
/**
|
|
@@ -116,51 +199,6 @@ function useShallowStableRef(value) {
|
|
|
116
199
|
|
|
117
200
|
//#endregion
|
|
118
201
|
//#region src/providers/CopilotChatConfigurationProvider.tsx
|
|
119
|
-
const CopilotChatDefaultLabels = {
|
|
120
|
-
chatInputPlaceholder: "Type a message...",
|
|
121
|
-
chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
|
|
122
|
-
chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
|
|
123
|
-
chatInputToolbarFinishTranscribeButtonLabel: "Finish",
|
|
124
|
-
chatInputToolbarAddButtonLabel: "Add attachments",
|
|
125
|
-
chatInputToolbarToolsButtonLabel: "Tools",
|
|
126
|
-
chatInputToolbarSendButtonLabel: "Send message",
|
|
127
|
-
chatInputToolbarStopButtonLabel: "Stop",
|
|
128
|
-
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
129
|
-
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
130
|
-
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
131
|
-
assistantMessageToolbarInspectorLabel: "View in Inspector",
|
|
132
|
-
assistantMessageToolbarInspectorDescription: "Open this message in the Inspector",
|
|
133
|
-
assistantMessageToolbarInspectorLocalOnlyLabel: "Local only",
|
|
134
|
-
assistantMessageToolbarInspectorLocalOnlyDescription: "Only visible on localhost or loopback hosts in development. Never shown in production.",
|
|
135
|
-
assistantMessageToolbarInspectorTitle: "CopilotKit Inspector",
|
|
136
|
-
assistantMessageToolbarInspectorHideLabel: "Hide this icon",
|
|
137
|
-
assistantMessageToolbarInspectorHideDescription: "Until you reload this page",
|
|
138
|
-
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
139
|
-
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
140
|
-
assistantMessageFeedbackCommentPlaceholder: "Add a comment (optional)",
|
|
141
|
-
assistantMessageFeedbackCommentSubmitLabel: "Send comment",
|
|
142
|
-
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
143
|
-
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
144
|
-
userMessageToolbarCopyMessageLabel: "Copy",
|
|
145
|
-
userMessageToolbarEditMessageLabel: "Edit",
|
|
146
|
-
userMessageToolbarPreviousBranchLabel: "Previous branch",
|
|
147
|
-
userMessageToolbarNextBranchLabel: "Next branch",
|
|
148
|
-
chatDisclaimerText: "AI can make mistakes. Please verify important information.",
|
|
149
|
-
chatToggleOpenLabel: "Open chat",
|
|
150
|
-
chatToggleCloseLabel: "Close chat",
|
|
151
|
-
chatScrollToBottomLabel: "Scroll to bottom",
|
|
152
|
-
modalHeaderTitle: "CopilotKit Chat",
|
|
153
|
-
welcomeMessageText: "How can I help you today?",
|
|
154
|
-
reasoningMessageThinkingLabel: "Thinking…",
|
|
155
|
-
chatInputSlashMenuLabel: "Slash commands",
|
|
156
|
-
chatInputSlashMenuEmptyText: "No commands found",
|
|
157
|
-
attachmentRemoveButtonLabel: "Remove attachment",
|
|
158
|
-
attachmentPlayVideoButtonLabel: "Play video",
|
|
159
|
-
attachmentPreviewCloseButtonLabel: "Close preview",
|
|
160
|
-
modalHeaderCloseButtonLabel: "Close",
|
|
161
|
-
modalHeaderThreadsButtonLabel: "Open threads",
|
|
162
|
-
sidebarLabel: "Copilot chat sidebar"
|
|
163
|
-
};
|
|
164
202
|
/**
|
|
165
203
|
* Mobile breakpoint below which the chat modal and the thread-list drawer are
|
|
166
204
|
* mutually exclusive. At or above this width both surfaces may coexist. This
|
|
@@ -185,7 +223,7 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
|
|
|
185
223
|
const parentConfig = (0, react.useContext)(CopilotChatConfiguration);
|
|
186
224
|
const stableLabels = useShallowStableRef(labels);
|
|
187
225
|
const mergedLabels = (0, react.useMemo)(() => ({
|
|
188
|
-
...CopilotChatDefaultLabels,
|
|
226
|
+
..._copilotkit_core.CopilotChatDefaultLabels,
|
|
189
227
|
...parentConfig?.labels,
|
|
190
228
|
...stableLabels
|
|
191
229
|
}), [stableLabels, parentConfig?.labels]);
|
|
@@ -435,7 +473,7 @@ function renderSlotElement(slot, DefaultComponent, props) {
|
|
|
435
473
|
const existingClassName = props.className;
|
|
436
474
|
return react.default.createElement(DefaultComponent, {
|
|
437
475
|
...props,
|
|
438
|
-
className: (
|
|
476
|
+
className: cn(existingClassName, slot)
|
|
439
477
|
});
|
|
440
478
|
}
|
|
441
479
|
if (isReactComponentType(slot)) return react.default.createElement(slot, props);
|
|
@@ -498,7 +536,7 @@ function useMarkdownRenderer() {
|
|
|
498
536
|
//#endregion
|
|
499
537
|
//#region src/types/defineToolCallRenderer.ts
|
|
500
538
|
function defineToolCallRenderer(def) {
|
|
501
|
-
const argsSchema = def.name === "*" && !def.args ?
|
|
539
|
+
const argsSchema = def.name === "*" && !def.args ? _copilotkit_shared.ɵanySchema : def.args;
|
|
502
540
|
return {
|
|
503
541
|
name: def.name,
|
|
504
542
|
args: argsSchema,
|
|
@@ -511,12 +549,11 @@ function defineToolCallRenderer(def) {
|
|
|
511
549
|
//#endregion
|
|
512
550
|
//#region src/generative-ui/json-schema.ts
|
|
513
551
|
/**
|
|
514
|
-
* JSON Schema for a Standard Schema
|
|
515
|
-
* inlined, no `$schema`. A prop marked by `child()` or `childList()`
|
|
552
|
+
* JSON Schema for a Standard Schema, without `$schema`. A prop marked by `child()` or `childList()`
|
|
516
553
|
* becomes an A2UI `$ref` to `ComponentId` or `ChildList`.
|
|
517
554
|
*/
|
|
518
555
|
function toJsonSchema(schema) {
|
|
519
|
-
const { $schema: _omit, ...rest } = (0, _copilotkit_shared.schemaToJsonSchema)(schema
|
|
556
|
+
const { $schema: _omit, ...rest } = (0, _copilotkit_shared.schemaToJsonSchema)(schema);
|
|
520
557
|
return (0, _copilotkit_shared.applyChildRefMarks)(rest);
|
|
521
558
|
}
|
|
522
559
|
|
|
@@ -823,13 +860,6 @@ function toManifest(definition, modelProps, modelEvents) {
|
|
|
823
860
|
return manifest;
|
|
824
861
|
}
|
|
825
862
|
|
|
826
|
-
//#endregion
|
|
827
|
-
//#region src/generative-ui/is-record.ts
|
|
828
|
-
/** True for a plain object: not null, not an array. Internal, not exported. */
|
|
829
|
-
function isRecord(value) {
|
|
830
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
863
|
//#endregion
|
|
834
864
|
//#region src/generative-ui/errors.ts
|
|
835
865
|
var GenerativeUIError = class extends Error {
|
|
@@ -1035,6 +1065,13 @@ function givesValidationResult(name) {
|
|
|
1035
1065
|
return _copilotkit_shared.GENERATIVE_UI_FUNCTIONS[name]?.returnType === "validationResult";
|
|
1036
1066
|
}
|
|
1037
1067
|
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/generative-ui/is-record.ts
|
|
1070
|
+
/** True for a plain object: not null, not an array. Internal, not exported. */
|
|
1071
|
+
function isRecord(value) {
|
|
1072
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1038
1075
|
//#endregion
|
|
1039
1076
|
//#region src/generative-ui/markdown/source.ts
|
|
1040
1077
|
/**
|
|
@@ -1683,6 +1720,7 @@ const OPERATORS = [
|
|
|
1683
1720
|
"*",
|
|
1684
1721
|
"/",
|
|
1685
1722
|
"%",
|
|
1723
|
+
"^",
|
|
1686
1724
|
"(",
|
|
1687
1725
|
")",
|
|
1688
1726
|
",",
|
|
@@ -1769,7 +1807,29 @@ const MATH = {
|
|
|
1769
1807
|
round: ([x, decimals = 0]) => {
|
|
1770
1808
|
const factor = 10 ** Math.trunc(decimals);
|
|
1771
1809
|
return Math.round(x * factor) / factor;
|
|
1772
|
-
}
|
|
1810
|
+
},
|
|
1811
|
+
pow: ([x, y]) => x ** y,
|
|
1812
|
+
sqrt: ([x]) => Math.sqrt(x),
|
|
1813
|
+
exp: ([x]) => Math.exp(x),
|
|
1814
|
+
ln: ([x]) => Math.log(x),
|
|
1815
|
+
log10: ([x]) => Math.log10(x)
|
|
1816
|
+
};
|
|
1817
|
+
/** How many args a function takes, at least and at most; min and max take any. */
|
|
1818
|
+
const ARITY = {
|
|
1819
|
+
abs: [1, 1],
|
|
1820
|
+
floor: [1, 1],
|
|
1821
|
+
ceil: [1, 1],
|
|
1822
|
+
round: [1, 2],
|
|
1823
|
+
pow: [2, 2],
|
|
1824
|
+
sqrt: [1, 1],
|
|
1825
|
+
exp: [1, 1],
|
|
1826
|
+
ln: [1, 1],
|
|
1827
|
+
log10: [1, 1]
|
|
1828
|
+
};
|
|
1829
|
+
/** Named constants, when no arg of the same name is passed. */
|
|
1830
|
+
const CONSTANTS = {
|
|
1831
|
+
pi: Math.PI,
|
|
1832
|
+
e: Math.E
|
|
1773
1833
|
};
|
|
1774
1834
|
var CalcParser = class {
|
|
1775
1835
|
constructor(tokens, scope, source) {
|
|
@@ -1904,7 +1964,20 @@ var CalcParser = class {
|
|
|
1904
1964
|
this.pos++;
|
|
1905
1965
|
return !truthOf(this.unary());
|
|
1906
1966
|
}
|
|
1907
|
-
return this.
|
|
1967
|
+
return this.power();
|
|
1968
|
+
}
|
|
1969
|
+
/** `a ^ b`: binds tighter than `*` and unary minus, right to left. */
|
|
1970
|
+
power() {
|
|
1971
|
+
const base = this.primary();
|
|
1972
|
+
if (!this.peekOp("^")) return base;
|
|
1973
|
+
this.pos++;
|
|
1974
|
+
const exponent = this.unary();
|
|
1975
|
+
if (this.skipDepth > 0) return null;
|
|
1976
|
+
return this.finite(this.num(base, "the left side of ^") ** this.num(exponent, "the right side of ^"), "^");
|
|
1977
|
+
}
|
|
1978
|
+
finite(value, what) {
|
|
1979
|
+
if (!Number.isFinite(value)) this.fail(`${what} has no finite result`);
|
|
1980
|
+
return value;
|
|
1908
1981
|
}
|
|
1909
1982
|
primary() {
|
|
1910
1983
|
const token = this.tokens[this.pos++];
|
|
@@ -1939,10 +2012,15 @@ var CalcParser = class {
|
|
|
1939
2012
|
const fn = Object.prototype.hasOwnProperty.call(MATH, name) ? MATH[name] : void 0;
|
|
1940
2013
|
if (!fn) this.fail(`unknown function ${name}`);
|
|
1941
2014
|
if (args.length === 0) this.fail(`${name} needs an argument`);
|
|
1942
|
-
|
|
2015
|
+
const [least, most] = ARITY[name] ?? [1, Infinity];
|
|
2016
|
+
if (args.length < least || args.length > most) this.fail(`${name} takes ${least === most ? least : `${least} or ${most}`} argument${most === 1 ? "" : "s"}`);
|
|
2017
|
+
return this.finite(fn(args), name);
|
|
1943
2018
|
}
|
|
1944
2019
|
if (this.skipDepth > 0) return null;
|
|
1945
|
-
if (!Object.prototype.hasOwnProperty.call(this.scope, name))
|
|
2020
|
+
if (!Object.prototype.hasOwnProperty.call(this.scope, name)) {
|
|
2021
|
+
if (Object.prototype.hasOwnProperty.call(CONSTANTS, name)) return CONSTANTS[name];
|
|
2022
|
+
this.fail(`unknown name ${name}; pass it as an arg`);
|
|
2023
|
+
}
|
|
1946
2024
|
const value = this.scope[name];
|
|
1947
2025
|
if (value !== null && typeof value !== "number" && typeof value !== "string" && typeof value !== "boolean") this.fail(`${name} is not a number, text or boolean (${describe(value)})`);
|
|
1948
2026
|
return value;
|
|
@@ -3448,29 +3526,29 @@ const GenerativeUIChatSlotContext = (0, react.createContext)(void 0);
|
|
|
3448
3526
|
function DefaultGenerativeUIChatCard({ surfaceId, isStreaming, error, children }) {
|
|
3449
3527
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3450
3528
|
"data-generative-ui-chat-surface": surfaceId,
|
|
3451
|
-
className: "cpk
|
|
3529
|
+
className: "cpk-generative-ui-chat-card",
|
|
3452
3530
|
children: [children, error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3453
3531
|
role: "alert",
|
|
3454
|
-
className: "cpk
|
|
3532
|
+
className: "cpk-generative-ui-chat-card-error",
|
|
3455
3533
|
children: "Part of this UI couldn't be shown."
|
|
3456
3534
|
})]
|
|
3457
3535
|
});
|
|
3458
3536
|
}
|
|
3459
|
-
const ContentSchema = zod.
|
|
3460
|
-
surfaceId: zod.
|
|
3461
|
-
target: zod.
|
|
3462
|
-
catalogId: zod.
|
|
3463
|
-
operations: zod.
|
|
3464
|
-
status: zod.
|
|
3537
|
+
const ContentSchema = zod.object({
|
|
3538
|
+
surfaceId: zod.string(),
|
|
3539
|
+
target: zod.string(),
|
|
3540
|
+
catalogId: zod.string(),
|
|
3541
|
+
operations: zod.array(zod.any()),
|
|
3542
|
+
status: zod.enum([
|
|
3465
3543
|
"streaming",
|
|
3466
3544
|
"ready",
|
|
3467
3545
|
"error"
|
|
3468
3546
|
]),
|
|
3469
|
-
rejected: zod.
|
|
3470
|
-
index: zod.
|
|
3471
|
-
reason: zod.
|
|
3547
|
+
rejected: zod.array(zod.object({
|
|
3548
|
+
index: zod.number(),
|
|
3549
|
+
reason: zod.string()
|
|
3472
3550
|
})).default([])
|
|
3473
|
-
}).
|
|
3551
|
+
}).loose();
|
|
3474
3552
|
function GenerativeUIChatActivity({ content, agent }) {
|
|
3475
3553
|
const runtime = useGenerativeUIRuntime();
|
|
3476
3554
|
const threadId = useCopilotChatConfiguration()?.threadId ?? agent?.threadId;
|
|
@@ -3512,7 +3590,7 @@ function createGenerativeUIActivityRenderer() {
|
|
|
3512
3590
|
function createGenerativeUIFunctionCallActivityRenderer() {
|
|
3513
3591
|
return {
|
|
3514
3592
|
activityType: _copilotkit_shared.GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE,
|
|
3515
|
-
content: zod.
|
|
3593
|
+
content: zod.unknown(),
|
|
3516
3594
|
render: () => null
|
|
3517
3595
|
};
|
|
3518
3596
|
}
|
|
@@ -3522,7 +3600,7 @@ function GenerativeUIToolCallRenderer() {
|
|
|
3522
3600
|
(0, react.useEffect)(() => {
|
|
3523
3601
|
const renderer = defineToolCallRenderer({
|
|
3524
3602
|
name: _copilotkit_shared.GENERATIVE_UI_RENDER_TOOL,
|
|
3525
|
-
args: zod.
|
|
3603
|
+
args: zod.any(),
|
|
3526
3604
|
render: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})
|
|
3527
3605
|
});
|
|
3528
3606
|
const existing = copilotkit._renderToolCalls ?? [];
|
|
@@ -3589,10 +3667,10 @@ function DefaultMarkdownChatSurface({ surfaceId, error, children }) {
|
|
|
3589
3667
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3590
3668
|
"data-generative-ui-chat-surface": surfaceId,
|
|
3591
3669
|
"data-a2ui-markdown-surface": surfaceId,
|
|
3592
|
-
className: "cpk
|
|
3670
|
+
className: "cpk-markdown-chat-surface",
|
|
3593
3671
|
children: [children, error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3594
3672
|
role: "alert",
|
|
3595
|
-
className: "cpk
|
|
3673
|
+
className: "cpk-markdown-chat-surface-error",
|
|
3596
3674
|
children: "Part of this UI couldn't be shown."
|
|
3597
3675
|
})]
|
|
3598
3676
|
});
|
|
@@ -3697,10 +3775,10 @@ Object.defineProperty(exports, 'CopilotChatConfigurationProvider', {
|
|
|
3697
3775
|
return CopilotChatConfigurationProvider;
|
|
3698
3776
|
}
|
|
3699
3777
|
});
|
|
3700
|
-
Object.defineProperty(exports, '
|
|
3778
|
+
Object.defineProperty(exports, 'CopilotIcon', {
|
|
3701
3779
|
enumerable: true,
|
|
3702
3780
|
get: function () {
|
|
3703
|
-
return
|
|
3781
|
+
return CopilotIcon;
|
|
3704
3782
|
}
|
|
3705
3783
|
});
|
|
3706
3784
|
Object.defineProperty(exports, 'DARK_THEME_CSS', {
|
|
@@ -3751,6 +3829,12 @@ Object.defineProperty(exports, 'GenerativeUIToolCallRenderer', {
|
|
|
3751
3829
|
return GenerativeUIToolCallRenderer;
|
|
3752
3830
|
}
|
|
3753
3831
|
});
|
|
3832
|
+
Object.defineProperty(exports, 'IconSvg', {
|
|
3833
|
+
enumerable: true,
|
|
3834
|
+
get: function () {
|
|
3835
|
+
return IconSvg;
|
|
3836
|
+
}
|
|
3837
|
+
});
|
|
3754
3838
|
Object.defineProperty(exports, 'MarkdownRendererProvider', {
|
|
3755
3839
|
enumerable: true,
|
|
3756
3840
|
get: function () {
|
|
@@ -3793,6 +3877,12 @@ Object.defineProperty(exports, 'catalogIdsOf', {
|
|
|
3793
3877
|
return catalogIdsOf;
|
|
3794
3878
|
}
|
|
3795
3879
|
});
|
|
3880
|
+
Object.defineProperty(exports, 'cn', {
|
|
3881
|
+
enumerable: true,
|
|
3882
|
+
get: function () {
|
|
3883
|
+
return cn;
|
|
3884
|
+
}
|
|
3885
|
+
});
|
|
3796
3886
|
Object.defineProperty(exports, 'componentCatalogIds', {
|
|
3797
3887
|
enumerable: true,
|
|
3798
3888
|
get: function () {
|
|
@@ -3961,4 +4051,4 @@ Object.defineProperty(exports, 'wrapperAria', {
|
|
|
3961
4051
|
return wrapperAria;
|
|
3962
4052
|
}
|
|
3963
4053
|
});
|
|
3964
|
-
//# sourceMappingURL=MarkdownSurfaces-
|
|
4054
|
+
//# sourceMappingURL=MarkdownSurfaces-DGDeUhbX.cjs.map
|