@copilotkit/react-core 1.78.0 → 1.79.1-canary.1792034358
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-gn5p8gXk.d.cts → copilotkit-BA0vyDds.d.cts} +43 -9
- package/dist/{copilotkit-gn5p8gXk.d.cts.map → copilotkit-BA0vyDds.d.cts.map} +1 -1
- package/dist/{copilotkit-DgJj6xa0.mjs → copilotkit-DtOQtboh.mjs} +73 -56
- package/dist/copilotkit-DtOQtboh.mjs.map +1 -0
- package/dist/{copilotkit-D1y8IyXh.d.mts → copilotkit-kcYN96tM.d.mts} +43 -9
- package/dist/{copilotkit-D1y8IyXh.d.mts.map → copilotkit-kcYN96tM.d.mts.map} +1 -1
- package/dist/{copilotkit-BFeenQQ0.cjs → copilotkit-t6Gs-59F.cjs} +71 -54
- package/dist/copilotkit-t6Gs-59F.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +61 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/v2/headless.cjs +1 -4
- package/dist/v2/headless.cjs.map +1 -1
- package/dist/v2/headless.mjs +1 -4
- package/dist/v2/headless.mjs.map +1 -1
- package/dist/v2/index.cjs +19 -1
- package/dist/v2/index.css +1 -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 +88 -53
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/copilotkit-BFeenQQ0.cjs.map +0 -1
- package/dist/copilotkit-DgJj6xa0.mjs.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-t6Gs-59F.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.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Af as
|
|
1
|
+
import { Af as CrewsTaskStateItem, Bf as ActionRenderPropsWait, Cf as LangGraphInterruptRenderHandlerProps, Df as CrewsResponse, Ef as CrewsAgentState, Ff as Tree, Gf as FrontendActionAvailability, Hf as CatchAllActionRenderPropsWait, If as TreeNode, Kf as RenderFunctionStatus, Lf as ActionRenderProps, Mf as CopilotChatSuggestionConfiguration, Nf as SystemMessageFunction, Of as CrewsResponseStatus, Pf as DocumentPointer, Rf as ActionRenderPropsNoArgs, Sf as LangGraphInterruptRender, Tf as QueuedInterruptEvent, Uf as CatchAllFrontendAction, Vf as CatchAllActionRenderProps, Wf as FrontendAction, X as useAgent, _f as useCopilotContext, bf as LangGraphInterruptActionSetter, gf as CopilotContextParams, hf as CopilotContext, jf as CrewsToolStateItem, kf as CrewsStateItem, mf as CopilotApiConfig, n as defaultCopilotContextCategories, pf as CoagentInChatRenderFunction, r as CopilotKitProps, t as CopilotKit, vf as CoAgentStateRender, wf as LangGraphInterruptRenderProps, xf as LangGraphInterruptActionSetterArgs, xt as useRenderToolCall$1, yf as LangGraphInterruptAction, zf as ActionRenderPropsNoArgsWait } from "./copilotkit-BA0vyDds.cjs";
|
|
2
2
|
import "./v2/index.cjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { CopilotRuntimeClient, CopilotRuntimeClientOptions, ForwardedParametersInput, Message } from "@copilotkit/runtime-client-gql";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Af as
|
|
1
|
+
import { Af as CrewsTaskStateItem, Bf as ActionRenderPropsWait, Cf as LangGraphInterruptRenderHandlerProps, Df as CrewsResponse, Ef as CrewsAgentState, Ff as Tree, Gf as FrontendActionAvailability, Hf as CatchAllActionRenderPropsWait, If as TreeNode, Kf as RenderFunctionStatus, Lf as ActionRenderProps, Mf as CopilotChatSuggestionConfiguration, Nf as SystemMessageFunction, Of as CrewsResponseStatus, Pf as DocumentPointer, Rf as ActionRenderPropsNoArgs, Sf as LangGraphInterruptRender, Tf as QueuedInterruptEvent, Uf as CatchAllFrontendAction, Vf as CatchAllActionRenderProps, Wf as FrontendAction, X as useAgent, _f as useCopilotContext, bf as LangGraphInterruptActionSetter, gf as CopilotContextParams, hf as CopilotContext, jf as CrewsToolStateItem, kf as CrewsStateItem, mf as CopilotApiConfig, n as defaultCopilotContextCategories, pf as CoagentInChatRenderFunction, r as CopilotKitProps, t as CopilotKit, vf as CoAgentStateRender, wf as LangGraphInterruptRenderProps, xf as LangGraphInterruptActionSetterArgs, xt as useRenderToolCall$1, yf as LangGraphInterruptAction, zf as ActionRenderPropsNoArgsWait } from "./copilotkit-kcYN96tM.mjs";
|
|
2
2
|
import "./v2/index.mjs";
|
|
3
3
|
import React, { ReactNode, RefObject, SetStateAction } from "react";
|
|
4
4
|
import { StaticSuggestionsConfig, Suggestion } from "@copilotkit/core";
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { $ as useConfigureSuggestions, It as useCopilotChatConfiguration, Q as INTERRUPT_EVENT_NAME, Z as useInterrupt, _t as defineToolCallRenderer, a as ThreadsProvider, at as useHumanInTheLoop$1, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useSuggestions, f as useToast, ft as useRenderCustomMessages, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, it as useAgent, jt as useRenderToolCall$1, l as useCoAgentStateRenders, m as useCopilotMessagesContext, mt as useCopilotKit, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, ut as useFrontendTool$1 } from "./copilotkit-
|
|
3
|
+
import { $ as useConfigureSuggestions, It as useCopilotChatConfiguration, Q as INTERRUPT_EVENT_NAME, Z as useInterrupt, _t as defineToolCallRenderer, a as ThreadsProvider, at as useHumanInTheLoop$1, c as CoAgentStateRendersProvider, d as shouldShowDevConsole, et as useSuggestions, f as useToast, ft as useRenderCustomMessages, g as useCopilotContext, h as CopilotContext, i as ThreadsContext, it as useAgent, jt as useRenderToolCall$1, l as useCoAgentStateRenders, m as useCopilotMessagesContext, mt as useCopilotKit, n as defaultCopilotContextCategories, o as useThreads, p as CopilotMessagesContext, r as CoAgentStateRenderBridge, s as CoAgentStateRendersContext, t as CopilotKit, u as useAsyncCallback, ut as useFrontendTool$1 } from "./copilotkit-DtOQtboh.mjs";
|
|
4
4
|
import React, { Fragment, createElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { CopilotKitCoreRuntimeConnectionStatus, ToolCallStatus, ɵisHttpAgent } from "@copilotkit/core";
|
|
6
6
|
import { AGUIConnectNotImplementedError } from "@ag-ui/client";
|
package/dist/index.umd.js
CHANGED
|
@@ -602,7 +602,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
602
602
|
|
|
603
603
|
//#endregion
|
|
604
604
|
//#region package.json
|
|
605
|
-
var version = "1.
|
|
605
|
+
var version = "1.79.1-canary.1792034358";
|
|
606
606
|
|
|
607
607
|
//#endregion
|
|
608
608
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
@@ -2341,15 +2341,15 @@ react_markdown = __toESM(react_markdown);
|
|
|
2341
2341
|
(0, react.useEffect)(() => {
|
|
2342
2342
|
if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence tier. Provide a `publicLicenseKey` for production use — contact the CopilotKit team about licensing.");
|
|
2343
2343
|
}, [hasSelfManagedAgents, resolvedPublicKey]);
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
}, [
|
|
2344
|
+
const headersRef = (0, react.useRef)(headersProp);
|
|
2345
|
+
headersRef.current = headersProp;
|
|
2346
|
+
const isHeadersBuilder = typeof headersProp === "function";
|
|
2347
|
+
const stableHeadersBuilder = (0, react.useCallback)(() => {
|
|
2348
|
+
const current = headersRef.current;
|
|
2349
|
+
return typeof current === "function" ? current() : current;
|
|
2350
|
+
}, []);
|
|
2351
|
+
const headersInput = isHeadersBuilder ? stableHeadersBuilder : headersProp;
|
|
2352
|
+
const headersSource = (0, react.useMemo)(() => (0, _copilotkit_core.ɵwithHeaderDefaults)(headersInput, resolvedPublicKey ? { [HEADER_NAME]: resolvedPublicKey } : {}), [headersInput, resolvedPublicKey]);
|
|
2353
2353
|
if (!runtimeUrl && !resolvedPublicKey && !hasLocalAgents) {
|
|
2354
2354
|
const message = "Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'";
|
|
2355
2355
|
if (process.env.NODE_ENV === "production") throw new Error(message);
|
|
@@ -2474,7 +2474,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
2474
2474
|
runtimeUrl: chatApiEndpoint,
|
|
2475
2475
|
deferInitialConnection: true,
|
|
2476
2476
|
runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
|
|
2477
|
-
headers:
|
|
2477
|
+
headers: headersSource,
|
|
2478
2478
|
credentials,
|
|
2479
2479
|
messageFilter,
|
|
2480
2480
|
properties,
|
|
@@ -2569,7 +2569,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
2569
2569
|
(0, react.useEffect)(() => {
|
|
2570
2570
|
copilotkit.setRuntimeUrl(chatApiEndpoint);
|
|
2571
2571
|
copilotkit.setRuntimeTransport(useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto");
|
|
2572
|
-
copilotkit.setHeaders(
|
|
2572
|
+
copilotkit.setHeaders(headersSource);
|
|
2573
2573
|
copilotkit.setCredentials(credentials);
|
|
2574
2574
|
copilotkit.setProperties(a2uiCatalogProvided ? {
|
|
2575
2575
|
...properties,
|
|
@@ -2581,7 +2581,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
2581
2581
|
}, [
|
|
2582
2582
|
copilotkit,
|
|
2583
2583
|
chatApiEndpoint,
|
|
2584
|
-
|
|
2584
|
+
headersSource,
|
|
2585
2585
|
credentials,
|
|
2586
2586
|
properties,
|
|
2587
2587
|
a2uiCatalogProvided,
|
|
@@ -2598,7 +2598,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
2598
2598
|
(0, react.useEffect)(() => {
|
|
2599
2599
|
copilotkit.setLearningConfig(learningConfig);
|
|
2600
2600
|
learningContainerIdsRef.current = learningConfig?.learningContainerIds;
|
|
2601
|
-
if (learningConfig?.sink === void 0 && !autoStart && learningConfig?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture
|
|
2601
|
+
if (learningConfig?.sink === void 0 && !autoStart && learningConfig?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture ignores it; assign Learning Spaces on the server with getTrajectoryLearningContainerIds on CopilotKitIntelligence, and remove learningContainerIds from the capture options.");
|
|
2602
2602
|
}, [
|
|
2603
2603
|
copilotkit,
|
|
2604
2604
|
learningConfig,
|
|
@@ -5281,6 +5281,16 @@ react_markdown = __toESM(react_markdown);
|
|
|
5281
5281
|
|
|
5282
5282
|
//#endregion
|
|
5283
5283
|
//#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
|
|
5284
|
+
/**
|
|
5285
|
+
* Drops `null`/`undefined` entries so a `CopilotKitHeadersSource` record (or
|
|
5286
|
+
* a builder's resolved record) matches `CopilotApiConfig.headers`'s
|
|
5287
|
+
* `Record<string, string>` shape. Mirrors core's own (internal-only)
|
|
5288
|
+
* `normalizeHeaders`.
|
|
5289
|
+
*/
|
|
5290
|
+
function normalizeV1Headers(headers) {
|
|
5291
|
+
if (!headers) return {};
|
|
5292
|
+
return Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] != null));
|
|
5293
|
+
}
|
|
5284
5294
|
function CopilotKit({ children, ...props }) {
|
|
5285
5295
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
5286
5296
|
const publicApiKey = props.publicApiKey || props.publicLicenseKey;
|
|
@@ -5360,6 +5370,13 @@ react_markdown = __toESM(react_markdown);
|
|
|
5360
5370
|
* This will throw an error if the props are invalid.
|
|
5361
5371
|
*/
|
|
5362
5372
|
validateProps(cpkProps);
|
|
5373
|
+
const headersPropRef = (0, react.useRef)(props.headers);
|
|
5374
|
+
headersPropRef.current = props.headers;
|
|
5375
|
+
const headersBuilderStateRef = (0, react.useRef)({
|
|
5376
|
+
fn: void 0,
|
|
5377
|
+
isAsync: false
|
|
5378
|
+
});
|
|
5379
|
+
const warnedAsyncHeadersRef = (0, react.useRef)(false);
|
|
5363
5380
|
const publicApiKey = props.publicLicenseKey || props.publicApiKey;
|
|
5364
5381
|
const chatApiEndpoint = props.runtimeUrl || _copilotkit_shared.COPILOT_CLOUD_CHAT_URL;
|
|
5365
5382
|
const [actions, setActions] = (0, react.useState)({});
|
|
@@ -5427,19 +5444,46 @@ react_markdown = __toESM(react_markdown);
|
|
|
5427
5444
|
validTopics: props.guardrails_c?.validTopics || [],
|
|
5428
5445
|
invalidTopics: props.guardrails_c?.invalidTopics || []
|
|
5429
5446
|
} } } };
|
|
5430
|
-
|
|
5447
|
+
const config = {
|
|
5431
5448
|
publicApiKey,
|
|
5432
5449
|
...cloud ? { cloud } : {},
|
|
5433
5450
|
chatApiEndpoint,
|
|
5434
|
-
headers: typeof props.headers === "function" ? props.headers() : props.headers || {},
|
|
5435
5451
|
properties: props.properties || {},
|
|
5436
5452
|
transcribeAudioUrl: props.transcribeAudioUrl,
|
|
5437
5453
|
textToSpeechUrl: props.textToSpeechUrl,
|
|
5438
5454
|
credentials: props.credentials
|
|
5439
5455
|
};
|
|
5456
|
+
Object.defineProperty(config, "headers", {
|
|
5457
|
+
enumerable: true,
|
|
5458
|
+
configurable: true,
|
|
5459
|
+
get() {
|
|
5460
|
+
const source = headersPropRef.current;
|
|
5461
|
+
if (typeof source !== "function") return normalizeV1Headers(source);
|
|
5462
|
+
const state = headersBuilderStateRef.current;
|
|
5463
|
+
if (state.fn === source && state.isAsync) return {};
|
|
5464
|
+
const result = source();
|
|
5465
|
+
if (typeof result === "object" && result !== null && typeof result.then === "function") {
|
|
5466
|
+
headersBuilderStateRef.current = {
|
|
5467
|
+
fn: source,
|
|
5468
|
+
isAsync: true
|
|
5469
|
+
};
|
|
5470
|
+
result.then(void 0, () => {});
|
|
5471
|
+
if (process.env.NODE_ENV !== "production" && !warnedAsyncHeadersRef.current) {
|
|
5472
|
+
warnedAsyncHeadersRef.current = true;
|
|
5473
|
+
console.warn("[CopilotKit] An async `headers` builder is not supported by the v1 CopilotTask / GraphQL path; its headers are not sent there.");
|
|
5474
|
+
}
|
|
5475
|
+
return {};
|
|
5476
|
+
}
|
|
5477
|
+
headersBuilderStateRef.current = {
|
|
5478
|
+
fn: source,
|
|
5479
|
+
isAsync: false
|
|
5480
|
+
};
|
|
5481
|
+
return normalizeV1Headers(result);
|
|
5482
|
+
}
|
|
5483
|
+
});
|
|
5484
|
+
return config;
|
|
5440
5485
|
}, [
|
|
5441
5486
|
publicApiKey,
|
|
5442
|
-
props.headers,
|
|
5443
5487
|
props.properties,
|
|
5444
5488
|
props.transcribeAudioUrl,
|
|
5445
5489
|
props.textToSpeechUrl,
|
|
@@ -5447,27 +5491,6 @@ react_markdown = __toESM(react_markdown);
|
|
|
5447
5491
|
props.cloudRestrictToTopic,
|
|
5448
5492
|
props.guardrails_c
|
|
5449
5493
|
]);
|
|
5450
|
-
(0, react.useMemo)(() => {
|
|
5451
|
-
const authHeaders = Object.values(authStates || {}).reduce((acc, state) => {
|
|
5452
|
-
if (state.status === "authenticated" && state.authHeaders) return {
|
|
5453
|
-
...acc,
|
|
5454
|
-
...Object.entries(state.authHeaders).reduce((headers, [key, value]) => ({
|
|
5455
|
-
...headers,
|
|
5456
|
-
[key.startsWith("X-Custom-") ? key : `X-Custom-${key}`]: value
|
|
5457
|
-
}), {})
|
|
5458
|
-
};
|
|
5459
|
-
return acc;
|
|
5460
|
-
}, {});
|
|
5461
|
-
return {
|
|
5462
|
-
...copilotApiConfig.headers,
|
|
5463
|
-
...copilotApiConfig.publicApiKey ? { [_copilotkit_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {},
|
|
5464
|
-
...authHeaders
|
|
5465
|
-
};
|
|
5466
|
-
}, [
|
|
5467
|
-
copilotApiConfig.headers,
|
|
5468
|
-
copilotApiConfig.publicApiKey,
|
|
5469
|
-
authStates
|
|
5470
|
-
]);
|
|
5471
5494
|
const [internalErrorHandlers, _setInternalErrorHandler] = (0, react.useState)({});
|
|
5472
5495
|
const setInternalErrorHandler = (0, react.useCallback)((handler) => {
|
|
5473
5496
|
_setInternalErrorHandler((prev) => ({
|