@copilotkit/react-core 1.69.3 → 1.70.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-JdHy0xdu.mjs → copilotkit-B7aFKfQR.mjs} +65 -21
- package/dist/copilotkit-B7aFKfQR.mjs.map +1 -0
- package/dist/{copilotkit-BPeh62mW.cjs → copilotkit-BE76j111.cjs} +70 -20
- package/dist/copilotkit-BE76j111.cjs.map +1 -0
- package/dist/{copilotkit-CrNUgJiq.d.cts → copilotkit-BuzP0VeG.d.cts} +31 -4
- package/dist/copilotkit-BuzP0VeG.d.cts.map +1 -0
- package/dist/{copilotkit-DgO31tBq.d.mts → copilotkit-CbZGwElm.d.mts} +31 -4
- package/dist/copilotkit-CbZGwElm.d.mts.map +1 -0
- package/dist/index.cjs +93 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +93 -21
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +133 -32
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +14 -7
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.d.cts.map +1 -1
- package/dist/v2/headless.d.mts.map +1 -1
- package/dist/v2/headless.mjs +14 -7
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +2 -1
- 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 +64 -19
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/skills/react-core/SKILL.md +1 -1
- package/dist/copilotkit-BPeh62mW.cjs.map +0 -1
- package/dist/copilotkit-CrNUgJiq.d.cts.map +0 -1
- package/dist/copilotkit-DgO31tBq.d.mts.map +0 -1
- package/dist/copilotkit-JdHy0xdu.mjs.map +0 -1
package/dist/v2/headless.cjs
CHANGED
|
@@ -484,7 +484,7 @@ const EMPTY_DEPS$1 = [];
|
|
|
484
484
|
function useFrontendTool(tool, deps) {
|
|
485
485
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
486
486
|
const extraDeps = deps ?? EMPTY_DEPS$1;
|
|
487
|
-
(0, react.
|
|
487
|
+
(0, react.useLayoutEffect)(() => {
|
|
488
488
|
const name = tool.name;
|
|
489
489
|
if (copilotkit.getTool({
|
|
490
490
|
toolName: name,
|
|
@@ -581,6 +581,8 @@ function useComponent(config, deps) {
|
|
|
581
581
|
|
|
582
582
|
//#endregion
|
|
583
583
|
//#region src/v2/hooks/use-human-in-the-loop.tsx
|
|
584
|
+
/** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
|
|
585
|
+
const WILDCARD_TOOL_NAME = "*";
|
|
584
586
|
function useHumanInTheLoop(tool, deps) {
|
|
585
587
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
586
588
|
const resolvePromiseRef = (0, react.useRef)(null);
|
|
@@ -616,10 +618,11 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
616
618
|
}, []);
|
|
617
619
|
const RenderComponent = (0, react.useCallback)((props) => {
|
|
618
620
|
const ToolComponent = tool.render;
|
|
621
|
+
const name = tool.name === WILDCARD_TOOL_NAME ? props.name : tool.name;
|
|
619
622
|
if (props.status === _copilotkit_core.ToolCallStatus.InProgress) {
|
|
620
623
|
const enhancedProps = {
|
|
621
624
|
...props,
|
|
622
|
-
name
|
|
625
|
+
name,
|
|
623
626
|
description: tool.description || "",
|
|
624
627
|
agentId: tool.agentId,
|
|
625
628
|
respond: void 0
|
|
@@ -628,7 +631,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
628
631
|
} else if (props.status === _copilotkit_core.ToolCallStatus.Executing) {
|
|
629
632
|
const enhancedProps = {
|
|
630
633
|
...props,
|
|
631
|
-
name
|
|
634
|
+
name,
|
|
632
635
|
description: tool.description || "",
|
|
633
636
|
agentId: tool.agentId,
|
|
634
637
|
respond
|
|
@@ -637,7 +640,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
637
640
|
} else if (props.status === _copilotkit_core.ToolCallStatus.Complete) {
|
|
638
641
|
const enhancedProps = {
|
|
639
642
|
...props,
|
|
640
|
-
name
|
|
643
|
+
name,
|
|
641
644
|
description: tool.description || "",
|
|
642
645
|
agentId: tool.agentId,
|
|
643
646
|
respond: void 0
|
|
@@ -657,7 +660,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
657
660
|
handler,
|
|
658
661
|
render: RenderComponent
|
|
659
662
|
}, deps);
|
|
660
|
-
(0, react.
|
|
663
|
+
(0, react.useLayoutEffect)(() => {
|
|
661
664
|
return () => {
|
|
662
665
|
copilotkit.removeHookRenderToolCall(tool.name, tool.agentId);
|
|
663
666
|
};
|
|
@@ -669,8 +672,12 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
669
672
|
}
|
|
670
673
|
|
|
671
674
|
//#endregion
|
|
672
|
-
//#region src/v2/
|
|
675
|
+
//#region src/v2/types/interrupt.ts
|
|
676
|
+
/** Name of the legacy custom event agents emit to signal an interrupt. */
|
|
673
677
|
const INTERRUPT_EVENT_NAME = "on_interrupt";
|
|
678
|
+
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/v2/hooks/use-interrupt.tsx
|
|
674
681
|
function isPromiseLike(value) {
|
|
675
682
|
return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
|
|
676
683
|
}
|
|
@@ -1244,7 +1251,7 @@ function useThreadStoreSelector(store, selector) {
|
|
|
1244
1251
|
*/
|
|
1245
1252
|
function useThreads({ agentId, includeArchived, limit, enabled = true }) {
|
|
1246
1253
|
const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
|
|
1247
|
-
const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch:
|
|
1254
|
+
const [store] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: copilotkit.ɵruntimeFetch }));
|
|
1248
1255
|
const coreThreads = useThreadStoreSelector(store, _copilotkit_core.ɵselectThreads);
|
|
1249
1256
|
const threads = (0, react.useMemo)(() => coreThreads.map(({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({
|
|
1250
1257
|
id,
|