@copilotkit/react-core 1.61.0 → 1.61.1
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-DtPCrXXd.cjs → copilotkit-BCJDP8qd.cjs} +53 -10
- package/dist/copilotkit-BCJDP8qd.cjs.map +1 -0
- package/dist/copilotkit-CEdu_aie.d.cts.map +1 -1
- package/dist/copilotkit-M1FiciGd.d.mts.map +1 -1
- package/dist/{copilotkit-BCxdKlMw.mjs → copilotkit-UY-H6Kx7.mjs} +53 -10
- package/dist/copilotkit-UY-H6Kx7.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +21 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +52 -9
- 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 +52 -9
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +52 -9
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/skills/react-core/references/provider-setup.md +20 -2
- package/dist/copilotkit-BCxdKlMw.mjs.map +0 -1
- package/dist/copilotkit-DtPCrXXd.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_copilotkit = require('./copilotkit-
|
|
4
|
+
const require_copilotkit = require('./copilotkit-BCJDP8qd.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_copilotkit.__toESM(react);
|
|
7
7
|
let _copilotkit_core = require("@copilotkit/core");
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { $ as useAgent, Ct as useCopilotChatConfiguration, J as useConfigureSuggestions, Y as useSuggestions, _t as useCopilotKit, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useHumanInTheLoop$1, f as useToast, g as useCopilotContext, gt as defineToolCallRenderer, h as CopilotContext, i as ThreadsContext, it as useRenderCustomMessages, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useFrontendTool$1, o as useThreads, p as CopilotMessagesContext, pt as useRenderToolCall$1, q as useInterrupt, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback } from "./copilotkit-
|
|
3
|
+
import { $ as useAgent, Ct as useCopilotChatConfiguration, J as useConfigureSuggestions, Y as useSuggestions, _t as useCopilotKit, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useHumanInTheLoop$1, f as useToast, g as useCopilotContext, gt as defineToolCallRenderer, h as CopilotContext, i as ThreadsContext, it as useRenderCustomMessages, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, nt as useFrontendTool$1, o as useThreads, p as CopilotMessagesContext, pt as useRenderToolCall$1, q as useInterrupt, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback } from "./copilotkit-UY-H6Kx7.mjs";
|
|
4
4
|
import React, { Fragment, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus } from "@copilotkit/core";
|
|
6
6
|
import { AGUIConnectNotImplementedError, HttpAgent } from "@ag-ui/client";
|
package/dist/index.umd.js
CHANGED
|
@@ -2723,15 +2723,34 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2723
2723
|
function useHumanInTheLoop$1(tool, deps) {
|
|
2724
2724
|
const { copilotkit } = useCopilotKit();
|
|
2725
2725
|
const resolvePromiseRef = (0, react.useRef)(null);
|
|
2726
|
+
const cleanupAbortRef = (0, react.useRef)(null);
|
|
2726
2727
|
const respond = (0, react.useCallback)(async (result) => {
|
|
2727
2728
|
if (resolvePromiseRef.current) {
|
|
2729
|
+
cleanupAbortRef.current?.();
|
|
2730
|
+
cleanupAbortRef.current = null;
|
|
2728
2731
|
resolvePromiseRef.current(result);
|
|
2729
2732
|
resolvePromiseRef.current = null;
|
|
2730
2733
|
}
|
|
2731
2734
|
}, []);
|
|
2732
|
-
const handler = (0, react.useCallback)(async () => {
|
|
2733
|
-
|
|
2735
|
+
const handler = (0, react.useCallback)(async (_args, context) => {
|
|
2736
|
+
const signal = context?.signal;
|
|
2737
|
+
return new Promise((resolve, reject) => {
|
|
2738
|
+
if (signal?.aborted) {
|
|
2739
|
+
reject(/* @__PURE__ */ new Error("Human-in-the-loop interaction aborted"));
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2734
2742
|
resolvePromiseRef.current = resolve;
|
|
2743
|
+
if (signal) {
|
|
2744
|
+
const onAbort = () => {
|
|
2745
|
+
cleanupAbortRef.current = null;
|
|
2746
|
+
resolvePromiseRef.current = null;
|
|
2747
|
+
reject(/* @__PURE__ */ new Error("Human-in-the-loop interaction aborted"));
|
|
2748
|
+
};
|
|
2749
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
2750
|
+
cleanupAbortRef.current = () => {
|
|
2751
|
+
signal.removeEventListener("abort", onAbort);
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2735
2754
|
});
|
|
2736
2755
|
}, []);
|
|
2737
2756
|
const RenderComponent = (0, react.useCallback)((props) => {
|