@copilotkit/react-core 2.0.0-rc.1 → 2.0.0-rc.3
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-ChSlVYOk.mjs → MarkdownSurfaces-Bd--93O1.mjs} +30 -9
- package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-C2XZISKn.cjs → MarkdownSurfaces-S4wfUl3J.cjs} +35 -8
- package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +1 -0
- package/dist/generative-ui.cjs +1 -1
- package/dist/generative-ui.mjs +1 -1
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +426 -432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +33 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +427 -434
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +451 -432
- package/dist/index.umd.js.map +1 -1
- package/package.json +12 -26
- package/dist/MarkdownSurfaces-C2XZISKn.cjs.map +0 -1
- package/dist/MarkdownSurfaces-ChSlVYOk.mjs.map +0 -1
- package/dist/index.css +0 -2
|
@@ -3,7 +3,6 @@ import React, { Component, createContext, memo, useCallback, useContext, useEffe
|
|
|
3
3
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { StreamingMarkdownRenderer, createStreamingMarkdownNodeRenderers } from "@copilotkit/markdown-renderer/react";
|
|
5
5
|
import { warnUnsupportedRichSyntaxOnce } from "@copilotkit/markdown-renderer";
|
|
6
|
-
import { twMerge } from "tailwind-merge";
|
|
7
6
|
import { A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_INDEX_FUNCTION, A2UI_VERSION, DEFAULT_AGENT_ID, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, applyChildRefMarks, childIdsAtRefs, collectChildRefs, functionCallers, getOperationKind, hasBoundChildRef, isActionBinding, isCallBinding, isPathBinding, isValidationResult, mapAtChildRef, randomUUID, schemaToJsonSchema, validateOperation } from "@copilotkit/shared";
|
|
8
7
|
import { CopilotKitContext, useCopilotKit, useDefaultAgentId } from "@copilotkit/react-core/context";
|
|
9
8
|
import { z } from "zod";
|
|
@@ -11,7 +10,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
11
10
|
|
|
12
11
|
//#region src/components/chat/StreamingMarkdownDefaultRenderer.tsx
|
|
13
12
|
const defaultNodeRenderers = createStreamingMarkdownNodeRenderers({ codeBlock: ({ node }) => /* @__PURE__ */ jsx("pre", {
|
|
14
|
-
className: "cpk
|
|
13
|
+
className: "cpk-markdown-code-block",
|
|
15
14
|
children: /* @__PURE__ */ jsx("code", {
|
|
16
15
|
"data-code-info": node.info ?? void 0,
|
|
17
16
|
children: node.text
|
|
@@ -389,6 +388,28 @@ const ControlledModalOpenScope = ({ children, open, onOpenChange }) => {
|
|
|
389
388
|
};
|
|
390
389
|
ControlledModalOpenScope.displayName = "ControlledModalOpenScope";
|
|
391
390
|
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/lib/utils.ts
|
|
393
|
+
/**
|
|
394
|
+
* Joins class names, skipping falsy values. Takes the same inputs as `clsx`.
|
|
395
|
+
* Classes are not merged: every rule CopilotKit ships sits in `:where()`, so a
|
|
396
|
+
* class the app adds wins without removing ours.
|
|
397
|
+
*/
|
|
398
|
+
function cn(...inputs) {
|
|
399
|
+
const out = [];
|
|
400
|
+
for (const input of inputs) {
|
|
401
|
+
if (!input) continue;
|
|
402
|
+
if (typeof input === "string" || typeof input === "number" || typeof input === "bigint") out.push(String(input));
|
|
403
|
+
else if (Array.isArray(input)) {
|
|
404
|
+
const nested = cn(...input);
|
|
405
|
+
if (nested) out.push(nested);
|
|
406
|
+
} else if (typeof input === "object") {
|
|
407
|
+
for (const key in input) if (input[key]) out.push(key);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return out.join(" ");
|
|
411
|
+
}
|
|
412
|
+
|
|
392
413
|
//#endregion
|
|
393
414
|
//#region src/lib/slots.tsx
|
|
394
415
|
/**
|
|
@@ -407,7 +428,7 @@ function renderSlotElement(slot, DefaultComponent, props) {
|
|
|
407
428
|
const existingClassName = props.className;
|
|
408
429
|
return React.createElement(DefaultComponent, {
|
|
409
430
|
...props,
|
|
410
|
-
className:
|
|
431
|
+
className: cn(existingClassName, slot)
|
|
411
432
|
});
|
|
412
433
|
}
|
|
413
434
|
if (isReactComponentType(slot)) return React.createElement(slot, props);
|
|
@@ -3420,10 +3441,10 @@ const GenerativeUIChatSlotContext = createContext(void 0);
|
|
|
3420
3441
|
function DefaultGenerativeUIChatCard({ surfaceId, isStreaming, error, children }) {
|
|
3421
3442
|
return /* @__PURE__ */ jsxs("div", {
|
|
3422
3443
|
"data-generative-ui-chat-surface": surfaceId,
|
|
3423
|
-
className: "cpk
|
|
3444
|
+
className: "cpk-generative-ui-chat-card",
|
|
3424
3445
|
children: [children, error && /* @__PURE__ */ jsx("div", {
|
|
3425
3446
|
role: "alert",
|
|
3426
|
-
className: "cpk
|
|
3447
|
+
className: "cpk-generative-ui-chat-card-error",
|
|
3427
3448
|
children: "Part of this UI couldn't be shown."
|
|
3428
3449
|
})]
|
|
3429
3450
|
});
|
|
@@ -3561,10 +3582,10 @@ function DefaultMarkdownChatSurface({ surfaceId, error, children }) {
|
|
|
3561
3582
|
return /* @__PURE__ */ jsxs("div", {
|
|
3562
3583
|
"data-generative-ui-chat-surface": surfaceId,
|
|
3563
3584
|
"data-a2ui-markdown-surface": surfaceId,
|
|
3564
|
-
className: "cpk
|
|
3585
|
+
className: "cpk-markdown-chat-surface",
|
|
3565
3586
|
children: [children, error && /* @__PURE__ */ jsx("div", {
|
|
3566
3587
|
role: "alert",
|
|
3567
|
-
className: "cpk
|
|
3588
|
+
className: "cpk-markdown-chat-surface-error",
|
|
3568
3589
|
children: "Part of this UI couldn't be shown."
|
|
3569
3590
|
})]
|
|
3570
3591
|
});
|
|
@@ -3651,5 +3672,5 @@ function MarkdownSurfaces({ content, messageId, isStreaming = false, ...markdown
|
|
|
3651
3672
|
}
|
|
3652
3673
|
|
|
3653
3674
|
//#endregion
|
|
3654
|
-
export { GenerativeUIError as A, renderSlot as B, issueKey as C, getMarkdownSurfaceSource as D, containsDynamicValue as E, toJsonSchema as F,
|
|
3655
|
-
//# sourceMappingURL=MarkdownSurfaces-
|
|
3675
|
+
export { GenerativeUIError as A, renderSlot as B, issueKey as C, getMarkdownSurfaceSource as D, containsDynamicValue as E, toJsonSchema as F, useCopilotChatConfiguration as G, ControlledModalOpenScope as H, defineToolCallRenderer as I, useShallowStableRef as K, MarkdownRendererProvider as L, catalogIdsOf as M, componentCatalogIds as N, BASIC_FUNCTIONS as O, createGenerativeUI as P, useMarkdownRenderer as R, isAsyncIssue as S, withoutRejectedNulls as T, CopilotChatConfigurationProvider as U, cn as V, CopilotChatDefaultLabels as W, GenerativeUINodeContext as _, GenerativeUIToolCallRenderer as a, useRequiredGenerativeUIRuntime as b, SurfaceView as c, namedRole as d, useGenerativeUIAccessibility as f, useManagerVersion as g, useGenerativeUIState as h, GenerativeUIChatSlotContext as i, isRecord as j, ExpressionError as k, DARK_THEME_CSS as l, useGenerativeUIFunction as m, ProviderMarkdown as n, createGenerativeUIActivityRenderer as o, wrapperAria as p, StreamingMarkdownDefaultRenderer as q, DefaultGenerativeUIChatCard as r, createGenerativeUIFunctionCallActivityRenderer as s, MarkdownSurfaces as t, controlAria as u, GenerativeUIRuntimeContext as v, validateSchemaSync as w, formatIssues as x, useGenerativeUIRuntime as y, isReactComponentType as z };
|
|
3676
|
+
//# sourceMappingURL=MarkdownSurfaces-Bd--93O1.mjs.map
|