@copilotkit/react-core 1.56.4 → 1.56.5
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-DFaI4j2r.d.mts.map +1 -1
- package/dist/{copilotkit-tb4zqaMK.cjs → copilotkit-DMFu29Kx.cjs} +120 -79
- package/dist/copilotkit-DMFu29Kx.cjs.map +1 -0
- package/dist/copilotkit-Dg4r4Gi_.d.cts.map +1 -1
- package/dist/{copilotkit-Bd0m5HFp.mjs → copilotkit-OmIUrWym.mjs} +120 -79
- package/dist/copilotkit-OmIUrWym.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +24 -0
- 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.mjs +1 -1
- package/dist/v2/index.umd.js +122 -81
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/v2/components/chat/CopilotChatAttachmentQueue.tsx +3 -113
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.tsx +26 -6
- package/src/v2/components/chat/CopilotChatUserMessage.tsx +2 -2
- package/src/v2/components/chat/CopilotChatView.tsx +21 -5
- package/src/v2/components/chat/Lightbox.tsx +103 -0
- package/src/v2/components/chat/__tests__/CopilotChat.suggestionsAlways.test.tsx +183 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.tsx +92 -0
- package/src/v2/hooks/use-configure-suggestions.tsx +50 -1
- package/dist/copilotkit-Bd0m5HFp.mjs.map +0 -1
- package/dist/copilotkit-tb4zqaMK.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-DMFu29Kx.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 { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-
|
|
3
|
+
import { B as useConfigureSuggestions, Q as useRenderToolCall$1, U as useHumanInTheLoop$1, V as useSuggestions, Y as useRenderCustomMessages, Z as useAgent, a as ThreadsProvider, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useCopilotKit, f as useToast, g as useCopilotContext, h as CopilotContext, ht as useCopilotChatConfiguration, i as ThreadsContext, l as useCoAgentStateRenders, m as useCopilotMessagesContext, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, q as useFrontendTool$1, r as CoAgentStateRenderBridge, rt as defineToolCallRenderer, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, z as useInterrupt } from "./copilotkit-OmIUrWym.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
|
@@ -2838,16 +2838,20 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2838
2838
|
return consumer;
|
|
2839
2839
|
}, [normalizedConfig, resolvedConsumerAgentId]);
|
|
2840
2840
|
const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
|
|
2841
|
+
const isDynamicConfigType = (0, react.useMemo)(() => !!normalizedConfig && "instructions" in normalizedConfig, [normalizedConfig]);
|
|
2841
2842
|
const requestReload = (0, react.useCallback)(() => {
|
|
2842
2843
|
if (!normalizedConfig) return;
|
|
2843
2844
|
if (isGlobalConfig) {
|
|
2844
2845
|
var _copilotkit$agents;
|
|
2846
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2845
2847
|
const agents = Object.values((_copilotkit$agents = copilotkit.agents) !== null && _copilotkit$agents !== void 0 ? _copilotkit$agents : {});
|
|
2846
2848
|
for (const entry of agents) {
|
|
2847
2849
|
const agentId = entry.agentId;
|
|
2848
2850
|
if (!agentId) continue;
|
|
2851
|
+
seen.add(agentId);
|
|
2849
2852
|
if (!entry.isRunning) copilotkit.reloadSuggestions(agentId);
|
|
2850
2853
|
}
|
|
2854
|
+
if (targetAgentId && !seen.has(targetAgentId)) copilotkit.reloadSuggestions(targetAgentId);
|
|
2851
2855
|
return;
|
|
2852
2856
|
}
|
|
2853
2857
|
if (!targetAgentId) return;
|
|
@@ -2892,6 +2896,26 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2892
2896
|
requestReload,
|
|
2893
2897
|
...extraDeps
|
|
2894
2898
|
]);
|
|
2899
|
+
(0, react.useEffect)(() => {
|
|
2900
|
+
if (!normalizedConfig || !isDynamicConfigType) return;
|
|
2901
|
+
if (!targetAgentId) return;
|
|
2902
|
+
if (!!copilotkit.getAgent(targetAgentId)) return;
|
|
2903
|
+
const subscription = copilotkit.subscribe({ onAgentsChanged: () => {
|
|
2904
|
+
if (copilotkit.getAgent(targetAgentId)) {
|
|
2905
|
+
requestReload();
|
|
2906
|
+
subscription.unsubscribe();
|
|
2907
|
+
}
|
|
2908
|
+
} });
|
|
2909
|
+
return () => {
|
|
2910
|
+
subscription.unsubscribe();
|
|
2911
|
+
};
|
|
2912
|
+
}, [
|
|
2913
|
+
copilotkit,
|
|
2914
|
+
normalizedConfig,
|
|
2915
|
+
isDynamicConfigType,
|
|
2916
|
+
targetAgentId,
|
|
2917
|
+
requestReload
|
|
2918
|
+
]);
|
|
2895
2919
|
}
|
|
2896
2920
|
function isDynamicConfig(config) {
|
|
2897
2921
|
return "instructions" in config;
|