@copilotkit/react-core 1.59.5 → 1.60.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/{copilotkit-CFfEVdV4.cjs → copilotkit-BTHcCAVQ.cjs} +93 -78
- package/dist/copilotkit-BTHcCAVQ.cjs.map +1 -0
- package/dist/{copilotkit-Ctvinul7.d.cts → copilotkit-C9ptuh-b.d.cts} +32 -70
- package/dist/copilotkit-C9ptuh-b.d.cts.map +1 -0
- package/dist/{copilotkit-DEGlMWM0.mjs → copilotkit-CV519nFv.mjs} +94 -79
- package/dist/copilotkit-CV519nFv.mjs.map +1 -0
- package/dist/{copilotkit-DqDT5RLa.d.mts → copilotkit-DvbI8G0d.d.mts} +32 -70
- package/dist/copilotkit-DvbI8G0d.d.mts.map +1 -0
- package/dist/index.cjs +11 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -12
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +47 -54
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.css +1 -1
- package/dist/v2/index.d.cts +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +92 -77
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/skills/react-core/SKILL.md +5 -5
- package/skills/react-core/references/chat-components.md +2 -1
- package/skills/react-core/references/client-side-tools.md +1 -1
- package/skills/react-core/references/custom-message-renderers.md +8 -11
- package/skills/react-core/references/debug-mode.md +15 -15
- package/skills/react-core/references/provider-setup.md +45 -52
- package/skills/react-core/references/rendering-activity-messages.md +6 -12
- package/dist/copilotkit-CFfEVdV4.cjs.map +0 -1
- package/dist/copilotkit-Ctvinul7.d.cts.map +0 -1
- package/dist/copilotkit-DEGlMWM0.mjs.map +0 -1
- package/dist/copilotkit-DqDT5RLa.d.mts.map +0 -1
package/dist/v2/index.umd.js
CHANGED
|
@@ -2011,7 +2011,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
2011
2011
|
severity: "warning",
|
|
2012
2012
|
message: `Your CopilotKit license expires in ${graceRemaining} day${graceRemaining !== 1 ? "s" : ""}. Please renew.`,
|
|
2013
2013
|
actionLabel: "Renew",
|
|
2014
|
-
actionUrl: "https://
|
|
2014
|
+
actionUrl: "https://dashboard.operations.copilotkit.ai",
|
|
2015
2015
|
onDismiss
|
|
2016
2016
|
});
|
|
2017
2017
|
case "expired": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
@@ -3579,67 +3579,61 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3579
3579
|
return null;
|
|
3580
3580
|
}
|
|
3581
3581
|
|
|
3582
|
-
//#endregion
|
|
3583
|
-
//#region src/v2/hooks/use-agent-context.tsx
|
|
3584
|
-
function useAgentContext(context) {
|
|
3585
|
-
const { description, value } = context;
|
|
3586
|
-
const { copilotkit } = useCopilotKit();
|
|
3587
|
-
const stringValue = (0, react.useMemo)(() => {
|
|
3588
|
-
if (typeof value === "string") return value;
|
|
3589
|
-
return JSON.stringify(value);
|
|
3590
|
-
}, [value]);
|
|
3591
|
-
(0, react.useLayoutEffect)(() => {
|
|
3592
|
-
if (!copilotkit) return;
|
|
3593
|
-
const id = copilotkit.addContext({
|
|
3594
|
-
description,
|
|
3595
|
-
value: stringValue
|
|
3596
|
-
});
|
|
3597
|
-
return () => {
|
|
3598
|
-
copilotkit.removeContext(id);
|
|
3599
|
-
};
|
|
3600
|
-
}, [
|
|
3601
|
-
description,
|
|
3602
|
-
stringValue,
|
|
3603
|
-
copilotkit
|
|
3604
|
-
]);
|
|
3605
|
-
}
|
|
3606
|
-
|
|
3607
3582
|
//#endregion
|
|
3608
3583
|
//#region src/v2/a2ui/A2UICatalogContext.tsx
|
|
3609
3584
|
/**
|
|
3610
3585
|
* Renders agent context describing the available A2UI catalog and custom components.
|
|
3611
3586
|
* Only mount this component when A2UI is enabled.
|
|
3612
3587
|
*
|
|
3588
|
+
* The entries are scoped to the agents the runtime applies A2UI to
|
|
3589
|
+
* (`copilotkit.a2uiAgents`, #5369), so agents outside that list don't receive
|
|
3590
|
+
* the catalog/schema/guidelines payload on their runs.
|
|
3591
|
+
*
|
|
3613
3592
|
* When `includeSchema` is true, the full component schemas (JSON Schema) are also
|
|
3614
3593
|
* sent as context using the same description key as the A2UI middleware, so the
|
|
3615
3594
|
* middleware can optionally overwrite it with a server-side schema.
|
|
3616
3595
|
*/
|
|
3617
3596
|
function A2UICatalogContext({ catalog, includeSchema }) {
|
|
3618
|
-
useAgentContext({
|
|
3619
|
-
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
3620
|
-
value: (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog)
|
|
3621
|
-
});
|
|
3622
3597
|
const { copilotkit } = useCopilotKit();
|
|
3598
|
+
const capabilitiesValue = (0, react.useMemo)(() => (0, _copilotkit_a2ui_renderer.buildCatalogContextValue)(catalog), [catalog]);
|
|
3623
3599
|
const schemaValue = (0, react.useMemo)(() => includeSchema !== false ? JSON.stringify((0, _copilotkit_a2ui_renderer.extractCatalogComponentSchemas)(catalog)) : null, [catalog, includeSchema]);
|
|
3600
|
+
const a2uiAgentsKey = copilotkit?.a2uiAgents?.join(",");
|
|
3624
3601
|
(0, react.useLayoutEffect)(() => {
|
|
3625
|
-
if (!copilotkit
|
|
3602
|
+
if (!copilotkit) return;
|
|
3603
|
+
const agentIds = copilotkit.a2uiAgents;
|
|
3604
|
+
const scope = agentIds ? { agentIds } : {};
|
|
3626
3605
|
const ids = [];
|
|
3627
3606
|
ids.push(copilotkit.addContext({
|
|
3628
|
-
description:
|
|
3629
|
-
value:
|
|
3630
|
-
|
|
3631
|
-
ids.push(copilotkit.addContext({
|
|
3632
|
-
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
3633
|
-
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES
|
|
3634
|
-
}));
|
|
3635
|
-
ids.push(copilotkit.addContext({
|
|
3636
|
-
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
3637
|
-
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES
|
|
3607
|
+
description: "A2UI catalog capabilities: available catalog IDs and custom component definitions the client can render.",
|
|
3608
|
+
value: capabilitiesValue,
|
|
3609
|
+
...scope
|
|
3638
3610
|
}));
|
|
3611
|
+
if (schemaValue) {
|
|
3612
|
+
ids.push(copilotkit.addContext({
|
|
3613
|
+
description: _copilotkit_a2ui_renderer.A2UI_SCHEMA_CONTEXT_DESCRIPTION,
|
|
3614
|
+
value: schemaValue,
|
|
3615
|
+
...scope
|
|
3616
|
+
}));
|
|
3617
|
+
ids.push(copilotkit.addContext({
|
|
3618
|
+
description: "A2UI generation guidelines — protocol rules, tool arguments, path rules, data model format, and form/two-way-binding instructions.",
|
|
3619
|
+
value: _copilotkit_shared.A2UI_DEFAULT_GENERATION_GUIDELINES,
|
|
3620
|
+
...scope
|
|
3621
|
+
}));
|
|
3622
|
+
ids.push(copilotkit.addContext({
|
|
3623
|
+
description: "A2UI design guidelines — visual design rules, component hierarchy tips, and action handler patterns.",
|
|
3624
|
+
value: _copilotkit_shared.A2UI_DEFAULT_DESIGN_GUIDELINES,
|
|
3625
|
+
...scope
|
|
3626
|
+
}));
|
|
3627
|
+
}
|
|
3639
3628
|
return () => {
|
|
3640
3629
|
for (const id of ids) copilotkit.removeContext(id);
|
|
3641
3630
|
};
|
|
3642
|
-
}, [
|
|
3631
|
+
}, [
|
|
3632
|
+
copilotkit,
|
|
3633
|
+
capabilitiesValue,
|
|
3634
|
+
schemaValue,
|
|
3635
|
+
a2uiAgentsKey
|
|
3636
|
+
]);
|
|
3643
3637
|
return null;
|
|
3644
3638
|
}
|
|
3645
3639
|
|
|
@@ -4392,6 +4386,31 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
4392
4386
|
if (agent && "capabilities" in agent) return agent.capabilities;
|
|
4393
4387
|
}
|
|
4394
4388
|
|
|
4389
|
+
//#endregion
|
|
4390
|
+
//#region src/v2/hooks/use-agent-context.tsx
|
|
4391
|
+
function useAgentContext(context) {
|
|
4392
|
+
const { description, value } = context;
|
|
4393
|
+
const { copilotkit } = useCopilotKit();
|
|
4394
|
+
const stringValue = (0, react.useMemo)(() => {
|
|
4395
|
+
if (typeof value === "string") return value;
|
|
4396
|
+
return JSON.stringify(value);
|
|
4397
|
+
}, [value]);
|
|
4398
|
+
(0, react.useLayoutEffect)(() => {
|
|
4399
|
+
if (!copilotkit) return;
|
|
4400
|
+
const id = copilotkit.addContext({
|
|
4401
|
+
description,
|
|
4402
|
+
value: stringValue
|
|
4403
|
+
});
|
|
4404
|
+
return () => {
|
|
4405
|
+
copilotkit.removeContext(id);
|
|
4406
|
+
};
|
|
4407
|
+
}, [
|
|
4408
|
+
description,
|
|
4409
|
+
stringValue,
|
|
4410
|
+
copilotkit
|
|
4411
|
+
]);
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4395
4414
|
//#endregion
|
|
4396
4415
|
//#region src/v2/hooks/use-suggestions.tsx
|
|
4397
4416
|
function useSuggestions({ agentId } = {}) {
|
|
@@ -6187,40 +6206,28 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6187
6206
|
* rendered by the {@link IntelligenceIndicator} brain and the default
|
|
6188
6207
|
* value for the `intelligenceIndicator` slot.
|
|
6189
6208
|
*
|
|
6190
|
-
*
|
|
6191
|
-
*
|
|
6192
|
-
*
|
|
6193
|
-
*
|
|
6194
|
-
* length) and the whole SVG rotates — so the viewer sees one
|
|
6195
|
-
* C-shaped arc spinning around the visual center.
|
|
6196
|
-
* 2. **Icon morph (~250 ms).** On status flip the single icon path
|
|
6197
|
-
* interpolates from the arc to a checkmark via CSS `d:` while the
|
|
6198
|
-
* dashed stroke transitions to solid (filling in the gap that was
|
|
6199
|
-
* the spinner's open portion). The SVG rotation animation is
|
|
6200
|
-
* removed; the snap back to identity is masked by the simultaneous
|
|
6201
|
-
* shape change. Chrome and text stay at full opacity throughout.
|
|
6202
|
-
* 3. **Settle (~400 ms, starts at +250 ms).** Chrome (background,
|
|
6203
|
-
* border, shadow, backdrop-blur) fades to zero opacity. The label
|
|
6204
|
-
* and icon stroke color transitions from saturated purple to a
|
|
6205
|
-
* true-neutral gray at 0.8 alpha — no hue cast, reads as "settled
|
|
6206
|
-
* history metadata." The label simultaneously skews to ~10° (a
|
|
6207
|
-
* transform-based italic feel that interpolates smoothly with the
|
|
6208
|
-
* color, rather than the discrete `font-style: italic` snap that
|
|
6209
|
-
* would cause a layout pop). The label text stays put — only its
|
|
6210
|
-
* color and slant change — so there is no "bump" where the brand
|
|
6211
|
-
* text disappears and reappears.
|
|
6209
|
+
* Layout: a glassmorphism pill (the `__chrome` layer) wrapping an icon
|
|
6210
|
+
* and a label. The icon is two overlaid SVG paths — a spinner arc and a
|
|
6211
|
+
* checkmark — whose geometry lives in each path's `d` ATTRIBUTE so it
|
|
6212
|
+
* renders in every browser (the CSS `d:` property is Chrome-only).
|
|
6212
6213
|
*
|
|
6213
|
-
*
|
|
6214
|
-
* for
|
|
6214
|
+
* Two states, driven by the `data-status` attribute (see globals.css
|
|
6215
|
+
* for the exact timing):
|
|
6216
|
+
* 1. **In-progress.** The arc spins (CSS rotation) inside the pill and
|
|
6217
|
+
* the checkmark is hidden. Label + icon are a saturated purple.
|
|
6218
|
+
* 2. **Finished.** The arc fades out mid-spin while the checkmark draws
|
|
6219
|
+
* itself in upright (animated `stroke-dashoffset`); the pill chrome
|
|
6220
|
+
* fades away; and the label + icon settle from purple to a neutral
|
|
6221
|
+
* gray, with the label slanting slightly (a `transform: skewX`
|
|
6222
|
+
* faux-italic, so it interpolates with the color instead of snapping
|
|
6223
|
+
* and never reflows). The result reads as quiet "history metadata"
|
|
6224
|
+
* rather than an active spinner. The label text itself never changes
|
|
6225
|
+
* — the static check plus the color/slant shift carry the "done"
|
|
6226
|
+
* meaning, so no wording change is needed.
|
|
6215
6227
|
*
|
|
6216
|
-
*
|
|
6217
|
-
*
|
|
6218
|
-
*
|
|
6219
|
-
*
|
|
6220
|
-
* The label is identical in both states (default "CopilotKit
|
|
6221
|
-
* Intelligence"). The static check icon carries the "done" semantic;
|
|
6222
|
-
* the color + slant transition does the "settle" work without needing
|
|
6223
|
-
* any wording change.
|
|
6228
|
+
* All motion is gated behind `prefers-reduced-motion` (globals.css):
|
|
6229
|
+
* when reduced motion is requested the arc does not spin and the two
|
|
6230
|
+
* states swap instantly, without transitions.
|
|
6224
6231
|
*
|
|
6225
6232
|
* Customize via the `intelligenceIndicator` slot on `CopilotChat`:
|
|
6226
6233
|
* a className string restyles the wrapper, a props object tweaks
|
|
@@ -6241,13 +6248,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6241
6248
|
"aria-hidden": "true"
|
|
6242
6249
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
6243
6250
|
className: "cpk-intelligence-indicator__content",
|
|
6244
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6251
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6245
6252
|
className: "cpk-intelligence-indicator__icon",
|
|
6246
6253
|
viewBox: "0 0 24 24",
|
|
6247
6254
|
width: "14",
|
|
6248
6255
|
height: "14",
|
|
6249
6256
|
"aria-hidden": "true",
|
|
6250
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6257
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6258
|
+
className: "cpk-intelligence-indicator__icon-arc",
|
|
6259
|
+
pathLength: 1,
|
|
6260
|
+
d: "M 12 3 C 17 3 21 7 21 12 C 21 17 17 21 12 21 C 7 21 3 17 3 12 C 3 7 7 3 12 3"
|
|
6261
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
6262
|
+
className: "cpk-intelligence-indicator__icon-check",
|
|
6263
|
+
pathLength: 1,
|
|
6264
|
+
d: "M 5 12.5 L 9 16.5 L 19 6.5"
|
|
6265
|
+
})]
|
|
6251
6266
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6252
6267
|
className: "cpk-intelligence-indicator__label",
|
|
6253
6268
|
children: label
|
|
@@ -9467,7 +9482,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
9467
9482
|
} };
|
|
9468
9483
|
case _copilotkit_shared.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR: return { primary: {
|
|
9469
9484
|
label: "Upgrade",
|
|
9470
|
-
onClick: () => window.open("https://
|
|
9485
|
+
onClick: () => window.open("https://dashboard.operations.copilotkit.ai", "_blank", "noopener,noreferrer")
|
|
9471
9486
|
} };
|
|
9472
9487
|
default: return;
|
|
9473
9488
|
}
|