@copilotkit/react-core 1.60.1 → 1.60.2
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-BTHcCAVQ.cjs → copilotkit-CP5uyB2h.cjs} +43 -133
- package/dist/copilotkit-CP5uyB2h.cjs.map +1 -0
- package/dist/{copilotkit-C9ptuh-b.d.cts → copilotkit-CyL6ZsLP.d.cts} +7 -7
- package/dist/{copilotkit-DvbI8G0d.d.mts.map → copilotkit-CyL6ZsLP.d.cts.map} +1 -1
- package/dist/{copilotkit-CV519nFv.mjs → copilotkit-DheptEiV.mjs} +43 -133
- package/dist/copilotkit-DheptEiV.mjs.map +1 -0
- package/dist/{copilotkit-DvbI8G0d.d.mts → copilotkit-UaQ7KSUq.d.mts} +7 -7
- package/dist/{copilotkit-C9ptuh-b.d.cts.map → copilotkit-UaQ7KSUq.d.mts.map} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +44 -129
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/context.cjs +8 -3
- package/dist/v2/context.cjs.map +1 -1
- package/dist/v2/context.d.cts.map +1 -1
- package/dist/v2/context.d.mts.map +1 -1
- package/dist/v2/context.mjs +8 -3
- package/dist/v2/context.mjs.map +1 -1
- package/dist/v2/headless.cjs +15 -8
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts +3 -3
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts +3 -3
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +15 -8
- package/dist/v2/headless.mjs.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 +42 -132
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/dist/copilotkit-BTHcCAVQ.cjs.map +0 -1
- package/dist/copilotkit-CV519nFv.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -306,9 +306,14 @@ react_markdown = __toESM(react_markdown);
|
|
|
306
306
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
307
307
|
if (!context) throw new Error("useCopilotKit must be used within CopilotKitProvider");
|
|
308
308
|
(0, react.useEffect)(() => {
|
|
309
|
-
const subscription = context.copilotkit.subscribe({
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
const subscription = context.copilotkit.subscribe({
|
|
310
|
+
onRuntimeConnectionStatusChanged: () => {
|
|
311
|
+
forceUpdate();
|
|
312
|
+
},
|
|
313
|
+
onHeadersChanged: () => {
|
|
314
|
+
forceUpdate();
|
|
315
|
+
}
|
|
316
|
+
});
|
|
312
317
|
return () => {
|
|
313
318
|
subscription.unsubscribe();
|
|
314
319
|
};
|
|
@@ -385,9 +390,8 @@ react_markdown = __toESM(react_markdown);
|
|
|
385
390
|
const isActive = status === "inProgress" || status === "executing";
|
|
386
391
|
const isComplete = status === "complete";
|
|
387
392
|
const statusLabel = isActive ? "Running" : isComplete ? "Done" : status;
|
|
388
|
-
const
|
|
389
|
-
const
|
|
390
|
-
const badgeColor = isActive ? "#92400e" : isComplete ? "#065f46" : "#3f3f46";
|
|
393
|
+
const dotClassName = isActive ? "cpk:bg-amber-500" : isComplete ? "cpk:bg-emerald-500" : "cpk:bg-zinc-400";
|
|
394
|
+
const badgeClassName = isActive ? "cpk:bg-amber-100 cpk:text-amber-800 cpk:dark:bg-amber-500/15 cpk:dark:text-amber-400" : isComplete ? "cpk:bg-emerald-100 cpk:text-emerald-800 cpk:dark:bg-emerald-500/15 cpk:dark:text-emerald-400" : "cpk:bg-zinc-100 cpk:text-zinc-800 cpk:dark:bg-zinc-700/40 cpk:dark:text-zinc-300";
|
|
391
395
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
392
396
|
"data-testid": "copilot-tool-render",
|
|
393
397
|
"data-tool-name": name,
|
|
@@ -395,54 +399,20 @@ react_markdown = __toESM(react_markdown);
|
|
|
395
399
|
"data-status": status,
|
|
396
400
|
"data-args": safeStringifyForAttr(parameters),
|
|
397
401
|
"data-result": safeStringifyForAttr(result),
|
|
398
|
-
|
|
399
|
-
marginTop: "8px",
|
|
400
|
-
paddingBottom: "8px"
|
|
401
|
-
},
|
|
402
|
+
className: "cpk:mt-2 cpk:pb-2",
|
|
402
403
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
403
|
-
|
|
404
|
-
borderRadius: "12px",
|
|
405
|
-
border: "1px solid #e4e4e7",
|
|
406
|
-
backgroundColor: "#fafafa",
|
|
407
|
-
padding: "14px 16px"
|
|
408
|
-
},
|
|
404
|
+
className: "cpk:rounded-xl cpk:border cpk:border-zinc-200/60 cpk:bg-white/70 cpk:p-4 cpk:shadow-sm cpk:backdrop-blur cpk:dark:border-zinc-800/60 cpk:dark:bg-zinc-900/50",
|
|
409
405
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
410
406
|
type: "button",
|
|
411
407
|
"aria-expanded": isExpanded,
|
|
412
408
|
onClick: () => setIsExpanded(!isExpanded),
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
alignItems: "center",
|
|
416
|
-
justifyContent: "space-between",
|
|
417
|
-
gap: "10px",
|
|
418
|
-
cursor: "pointer",
|
|
419
|
-
userSelect: "none",
|
|
420
|
-
width: "100%",
|
|
421
|
-
border: "none",
|
|
422
|
-
padding: 0,
|
|
423
|
-
margin: 0,
|
|
424
|
-
background: "transparent",
|
|
425
|
-
textAlign: "left",
|
|
426
|
-
font: "inherit",
|
|
427
|
-
color: "inherit"
|
|
428
|
-
},
|
|
409
|
+
className: "cpk:flex cpk:w-full cpk:cursor-pointer cpk:select-none cpk:items-center cpk:justify-between cpk:gap-2.5 cpk:border-none cpk:bg-transparent cpk:p-0 cpk:m-0 cpk:text-left cpk:text-inherit",
|
|
410
|
+
style: { font: "inherit" },
|
|
429
411
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
430
|
-
|
|
431
|
-
display: "flex",
|
|
432
|
-
alignItems: "center",
|
|
433
|
-
gap: "8px",
|
|
434
|
-
minWidth: 0
|
|
435
|
-
},
|
|
412
|
+
className: "cpk:flex cpk:min-w-0 cpk:items-center cpk:gap-2",
|
|
436
413
|
children: [
|
|
437
414
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
438
|
-
|
|
439
|
-
height: "14px",
|
|
440
|
-
width: "14px",
|
|
441
|
-
color: "#71717a",
|
|
442
|
-
transition: "transform 0.15s",
|
|
443
|
-
transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)",
|
|
444
|
-
flexShrink: 0
|
|
445
|
-
},
|
|
415
|
+
className: `cpk:h-3.5 cpk:w-3.5 cpk:flex-shrink-0 cpk:text-zinc-500 cpk:transition-transform cpk:dark:text-zinc-400 ${isExpanded ? "cpk:rotate-90" : ""}`,
|
|
446
416
|
fill: "none",
|
|
447
417
|
viewBox: "0 0 24 24",
|
|
448
418
|
strokeWidth: 2,
|
|
@@ -453,93 +423,31 @@ react_markdown = __toESM(react_markdown);
|
|
|
453
423
|
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
454
424
|
})
|
|
455
425
|
}),
|
|
456
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
457
|
-
display: "inline-block",
|
|
458
|
-
height: "8px",
|
|
459
|
-
width: "8px",
|
|
460
|
-
borderRadius: "50%",
|
|
461
|
-
backgroundColor: dotColor,
|
|
462
|
-
flexShrink: 0
|
|
463
|
-
} }),
|
|
426
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: `cpk:inline-block cpk:h-2 cpk:w-2 cpk:flex-shrink-0 cpk:rounded-full ${dotClassName}` }),
|
|
464
427
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
465
428
|
"data-testid": "copilot-tool-render-name",
|
|
466
|
-
|
|
467
|
-
fontSize: "13px",
|
|
468
|
-
fontWeight: 600,
|
|
469
|
-
color: "#18181b",
|
|
470
|
-
overflow: "hidden",
|
|
471
|
-
textOverflow: "ellipsis",
|
|
472
|
-
whiteSpace: "nowrap"
|
|
473
|
-
},
|
|
429
|
+
className: "cpk:truncate cpk:text-[13px] cpk:font-semibold cpk:text-zinc-900 cpk:dark:text-zinc-100",
|
|
474
430
|
children: name
|
|
475
431
|
})
|
|
476
432
|
]
|
|
477
433
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
478
434
|
"data-testid": "copilot-tool-render-status",
|
|
479
|
-
|
|
480
|
-
display: "inline-flex",
|
|
481
|
-
alignItems: "center",
|
|
482
|
-
borderRadius: "9999px",
|
|
483
|
-
padding: "2px 8px",
|
|
484
|
-
fontSize: "11px",
|
|
485
|
-
fontWeight: 500,
|
|
486
|
-
backgroundColor: badgeBg,
|
|
487
|
-
color: badgeColor,
|
|
488
|
-
flexShrink: 0
|
|
489
|
-
},
|
|
435
|
+
className: `cpk:inline-flex cpk:flex-shrink-0 cpk:items-center cpk:rounded-full cpk:px-2 cpk:py-0.5 cpk:text-[11px] cpk:font-medium ${badgeClassName}`,
|
|
490
436
|
children: statusLabel
|
|
491
437
|
})]
|
|
492
438
|
}), isExpanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
493
|
-
|
|
494
|
-
marginTop: "12px",
|
|
495
|
-
display: "grid",
|
|
496
|
-
gap: "12px"
|
|
497
|
-
},
|
|
439
|
+
className: "cpk:mt-3 cpk:grid cpk:gap-3",
|
|
498
440
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
499
|
-
|
|
500
|
-
fontSize: "10px",
|
|
501
|
-
textTransform: "uppercase",
|
|
502
|
-
letterSpacing: "0.05em",
|
|
503
|
-
color: "#71717a"
|
|
504
|
-
},
|
|
441
|
+
className: "cpk:text-[10px] cpk:uppercase cpk:text-zinc-500 cpk:dark:text-zinc-400",
|
|
505
442
|
children: "Arguments"
|
|
506
443
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
507
|
-
|
|
508
|
-
marginTop: "6px",
|
|
509
|
-
maxHeight: "200px",
|
|
510
|
-
overflow: "auto",
|
|
511
|
-
borderRadius: "6px",
|
|
512
|
-
backgroundColor: "#f4f4f5",
|
|
513
|
-
padding: "10px",
|
|
514
|
-
fontSize: "11px",
|
|
515
|
-
lineHeight: 1.6,
|
|
516
|
-
color: "#27272a",
|
|
517
|
-
whiteSpace: "pre-wrap",
|
|
518
|
-
wordBreak: "break-word"
|
|
519
|
-
},
|
|
444
|
+
className: "cpk:mt-1.5 cpk:max-h-[200px] cpk:overflow-auto cpk:rounded-md cpk:bg-zinc-100 cpk:p-2.5 cpk:text-[11px] cpk:leading-relaxed cpk:text-zinc-800 cpk:whitespace-pre-wrap cpk:break-words cpk:dark:bg-zinc-800/60 cpk:dark:text-zinc-200",
|
|
520
445
|
children: safeStringifyForPre(parameters ?? {})
|
|
521
446
|
})] }), result !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
522
|
-
|
|
523
|
-
fontSize: "10px",
|
|
524
|
-
textTransform: "uppercase",
|
|
525
|
-
letterSpacing: "0.05em",
|
|
526
|
-
color: "#71717a"
|
|
527
|
-
},
|
|
447
|
+
className: "cpk:text-[10px] cpk:uppercase cpk:text-zinc-500 cpk:dark:text-zinc-400",
|
|
528
448
|
children: "Result"
|
|
529
449
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
530
|
-
|
|
531
|
-
marginTop: "6px",
|
|
532
|
-
maxHeight: "200px",
|
|
533
|
-
overflow: "auto",
|
|
534
|
-
borderRadius: "6px",
|
|
535
|
-
backgroundColor: "#f4f4f5",
|
|
536
|
-
padding: "10px",
|
|
537
|
-
fontSize: "11px",
|
|
538
|
-
lineHeight: 1.6,
|
|
539
|
-
color: "#27272a",
|
|
540
|
-
whiteSpace: "pre-wrap",
|
|
541
|
-
wordBreak: "break-word"
|
|
542
|
-
},
|
|
450
|
+
className: "cpk:mt-1.5 cpk:max-h-[200px] cpk:overflow-auto cpk:rounded-md cpk:bg-zinc-100 cpk:p-2.5 cpk:text-[11px] cpk:leading-relaxed cpk:text-zinc-800 cpk:whitespace-pre-wrap cpk:break-words cpk:dark:bg-zinc-800/60 cpk:dark:text-zinc-200",
|
|
543
451
|
children: typeof result === "string" ? result : safeStringifyForPre(result)
|
|
544
452
|
})] })]
|
|
545
453
|
})]
|
|
@@ -3301,18 +3209,25 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3301
3209
|
},
|
|
3302
3210
|
onRunFailed: () => {
|
|
3303
3211
|
localInterrupt = null;
|
|
3212
|
+
setPendingEvent(null);
|
|
3304
3213
|
}
|
|
3305
3214
|
});
|
|
3306
3215
|
return () => subscription.unsubscribe();
|
|
3307
3216
|
}, [agent]);
|
|
3308
|
-
const resolve = (0, react.useCallback)((response) => {
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3217
|
+
const resolve = (0, react.useCallback)(async (response) => {
|
|
3218
|
+
try {
|
|
3219
|
+
return await copilotkit.runAgent({
|
|
3220
|
+
agent,
|
|
3221
|
+
forwardedProps: { command: {
|
|
3222
|
+
resume: response,
|
|
3223
|
+
interruptEvent: pendingEventRef.current?.value
|
|
3224
|
+
} }
|
|
3225
|
+
});
|
|
3226
|
+
} catch (err) {
|
|
3227
|
+
console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
|
|
3228
|
+
setPendingEvent(null);
|
|
3229
|
+
throw err;
|
|
3230
|
+
}
|
|
3316
3231
|
}, [agent, copilotkit]);
|
|
3317
3232
|
const renderRef = (0, react.useRef)(config.render);
|
|
3318
3233
|
renderRef.current = config.render;
|
|
@@ -5888,8 +5803,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
5888
5803
|
/**
|
|
5889
5804
|
* `useCopilotChatHeadless_c` is for building fully custom UI (headless UI) implementations.
|
|
5890
5805
|
*
|
|
5891
|
-
* <Callout title="This is
|
|
5892
|
-
* Read more about <a href="/premium/overview">
|
|
5806
|
+
* <Callout title="This is an Enterprise Intelligence Platform feature">
|
|
5807
|
+
* Read more about <a href="/premium/overview">the Enterprise Intelligence Platform</a>.
|
|
5893
5808
|
*
|
|
5894
5809
|
* Usage is generous and **free** to get started.
|
|
5895
5810
|
* </Callout>
|
|
@@ -6068,11 +5983,11 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6068
5983
|
interrupt: null
|
|
6069
5984
|
});
|
|
6070
5985
|
/**
|
|
6071
|
-
* Enterprise React hook that provides complete chat functionality for fully custom UI implementations.
|
|
5986
|
+
* Enterprise Intelligence Platform React hook that provides complete chat functionality for fully custom UI implementations.
|
|
6072
5987
|
* Includes all advanced features like direct message access, suggestions array, interrupt handling, and MCP support.
|
|
6073
5988
|
*
|
|
6074
5989
|
* @param options - Configuration options for the chat
|
|
6075
|
-
* @returns Complete chat interface with all
|
|
5990
|
+
* @returns Complete chat interface with all Enterprise Intelligence Platform features
|
|
6076
5991
|
*
|
|
6077
5992
|
* @example
|
|
6078
5993
|
* ```tsx
|
|
@@ -6086,7 +6001,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
6086
6001
|
(0, react.useEffect)(() => {
|
|
6087
6002
|
if (!hasPublicApiKey) {
|
|
6088
6003
|
setBannerError(new _copilotkit_shared.CopilotKitError({
|
|
6089
|
-
message: "You're using useCopilotChatHeadless_c,
|
|
6004
|
+
message: "You're using useCopilotChatHeadless_c, an Enterprise Intelligence Platform feature that offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key.",
|
|
6090
6005
|
code: _copilotkit_shared.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
|
|
6091
6006
|
severity: _copilotkit_shared.Severity.WARNING,
|
|
6092
6007
|
visibility: _copilotkit_shared.ErrorVisibility.BANNER
|