@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import React, { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseToolArguments, props, select, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵthreadAdapterEvents } from "@copilotkit/core";
|
|
3
|
+
import { AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, CopilotKitHeaderResolutionError, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, IntelligenceReplayFailedError, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseToolArguments, props, select, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵthreadAdapterEvents, ɵwithHeaderDefaults, ɵwithHeaderDefaults as ɵwithHeaderDefaults$1 } from "@copilotkit/core";
|
|
4
4
|
import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError as AGUIConnectNotImplementedError$1, AGUIError, AGUI_METADATA_KEY, AbstractAgent as AbstractAgent$1, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, CompatibilityBoundary, DebugLogger, EventType, FilterToolCallsMiddleware, FunctionMiddleware, HttpAgent, Middleware, PROTOCOL_VERSION, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText as contentToText$1, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, randomUUID as randomUUID$2, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
|
|
5
5
|
import { ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, BaseEventSchema, BaseMessageSchema, ContentPartSchema, ContextSchema, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FunctionCallSchema, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, PartSourceSchema, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UrlSourceSchema, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema } from "@ag-ui/core/schemas";
|
|
6
6
|
import { extendTailwindMerge, twMerge } from "tailwind-merge";
|
|
@@ -1626,7 +1626,7 @@ function useRenderToolCall() {
|
|
|
1626
1626
|
|
|
1627
1627
|
//#endregion
|
|
1628
1628
|
//#region package.json
|
|
1629
|
-
var version = "1.
|
|
1629
|
+
var version = "1.79.1-canary.1792034358";
|
|
1630
1630
|
|
|
1631
1631
|
//#endregion
|
|
1632
1632
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
@@ -3493,15 +3493,15 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3493
3493
|
useEffect(() => {
|
|
3494
3494
|
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.");
|
|
3495
3495
|
}, [hasSelfManagedAgents, resolvedPublicKey]);
|
|
3496
|
-
const
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
}, [
|
|
3496
|
+
const headersRef = useRef(headersProp);
|
|
3497
|
+
headersRef.current = headersProp;
|
|
3498
|
+
const isHeadersBuilder = typeof headersProp === "function";
|
|
3499
|
+
const stableHeadersBuilder = useCallback(() => {
|
|
3500
|
+
const current = headersRef.current;
|
|
3501
|
+
return typeof current === "function" ? current() : current;
|
|
3502
|
+
}, []);
|
|
3503
|
+
const headersInput = isHeadersBuilder ? stableHeadersBuilder : headersProp;
|
|
3504
|
+
const headersSource = useMemo(() => ɵwithHeaderDefaults(headersInput, resolvedPublicKey ? { [HEADER_NAME]: resolvedPublicKey } : {}), [headersInput, resolvedPublicKey]);
|
|
3505
3505
|
if (!runtimeUrl && !resolvedPublicKey && !hasLocalAgents) {
|
|
3506
3506
|
const message = "Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'";
|
|
3507
3507
|
if (process.env.NODE_ENV === "production") throw new Error(message);
|
|
@@ -3626,7 +3626,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3626
3626
|
runtimeUrl: chatApiEndpoint,
|
|
3627
3627
|
deferInitialConnection: true,
|
|
3628
3628
|
runtimeTransport: useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto",
|
|
3629
|
-
headers:
|
|
3629
|
+
headers: headersSource,
|
|
3630
3630
|
credentials,
|
|
3631
3631
|
messageFilter,
|
|
3632
3632
|
properties,
|
|
@@ -3721,7 +3721,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3721
3721
|
useEffect(() => {
|
|
3722
3722
|
copilotkit.setRuntimeUrl(chatApiEndpoint);
|
|
3723
3723
|
copilotkit.setRuntimeTransport(useSingleEndpoint === true ? "single" : useSingleEndpoint === false ? "rest" : "auto");
|
|
3724
|
-
copilotkit.setHeaders(
|
|
3724
|
+
copilotkit.setHeaders(headersSource);
|
|
3725
3725
|
copilotkit.setCredentials(credentials);
|
|
3726
3726
|
copilotkit.setProperties(a2uiCatalogProvided ? {
|
|
3727
3727
|
...properties,
|
|
@@ -3733,7 +3733,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3733
3733
|
}, [
|
|
3734
3734
|
copilotkit,
|
|
3735
3735
|
chatApiEndpoint,
|
|
3736
|
-
|
|
3736
|
+
headersSource,
|
|
3737
3737
|
credentials,
|
|
3738
3738
|
properties,
|
|
3739
3739
|
a2uiCatalogProvided,
|
|
@@ -3750,7 +3750,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
3750
3750
|
useEffect(() => {
|
|
3751
3751
|
copilotkit.setLearningConfig(learningConfig);
|
|
3752
3752
|
learningContainerIdsRef.current = learningConfig?.learningContainerIds;
|
|
3753
|
-
if (learningConfig?.sink === void 0 && !autoStart && learningConfig?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture
|
|
3753
|
+
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.");
|
|
3754
3754
|
}, [
|
|
3755
3755
|
copilotkit,
|
|
3756
3756
|
learningConfig,
|
|
@@ -5357,9 +5357,7 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5357
5357
|
const hasMoreThreads = useThreadStoreSelector(store, ɵselectHasNextPage);
|
|
5358
5358
|
const isFetchingMoreThreads = useThreadStoreSelector(store, ɵselectIsFetchingNextPage);
|
|
5359
5359
|
const isMutating = useThreadStoreSelector(store, ɵselectIsMutating);
|
|
5360
|
-
const headersKey =
|
|
5361
|
-
return JSON.stringify(Object.entries(copilotkit.headers ?? {}).sort(([left], [right]) => left.localeCompare(right)));
|
|
5362
|
-
}, [copilotkit.headers]);
|
|
5360
|
+
const headersKey = copilotkit.ɵheadersGeneration;
|
|
5363
5361
|
const runtimeStatus = copilotkit.runtimeConnectionStatus;
|
|
5364
5362
|
const threadListEndpointSupported = copilotkit.threadEndpoints?.list !== false;
|
|
5365
5363
|
const threadMutationsSupported = copilotkit.threadEndpoints?.mutations !== false;
|
|
@@ -5424,7 +5422,6 @@ function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
|
|
|
5424
5422
|
}
|
|
5425
5423
|
const context = {
|
|
5426
5424
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
5427
|
-
headers: { ...copilotkit.headers },
|
|
5428
5425
|
wsUrl: copilotkit.intelligence?.wsUrl,
|
|
5429
5426
|
agentId,
|
|
5430
5427
|
includeArchived,
|
|
@@ -5552,7 +5549,9 @@ function useMemories() {
|
|
|
5552
5549
|
*
|
|
5553
5550
|
* The function uses the same transport as `useLearnFromUserAction`:
|
|
5554
5551
|
* - `runtimeUrl` from `copilotkit.runtimeUrl` (BFF proxies to the platform)
|
|
5555
|
-
* - `
|
|
5552
|
+
* - `fetch: copilotkit.ɵruntimeFetch`, which adds the current core headers at
|
|
5553
|
+
* send time (#1937); `headers` here is only for extra request-specific
|
|
5554
|
+
* headers on top of that
|
|
5556
5555
|
* - `clientEventId` auto-generated via `randomUUID()` when omitted
|
|
5557
5556
|
* - `userId` is resolved server-side by the runtime; the client never sends it
|
|
5558
5557
|
* - Errors propagate to the caller (fire-and-propagate, not fire-and-forget)
|
|
@@ -5644,7 +5643,7 @@ function useLearnFromUserAction() {
|
|
|
5644
5643
|
return recordAnnotation({
|
|
5645
5644
|
fetch: copilotkit.ɵruntimeFetch,
|
|
5646
5645
|
runtimeUrl,
|
|
5647
|
-
headers:
|
|
5646
|
+
headers: {},
|
|
5648
5647
|
type: "user_action",
|
|
5649
5648
|
payload: Object.keys(payload).length > 0 ? payload : void 0,
|
|
5650
5649
|
threadId: input.threadId,
|
|
@@ -5972,16 +5971,13 @@ function useLearningContainers({ threadId, learningContainers }) {
|
|
|
5972
5971
|
/** Guards the missing-runtimeUrl warning so it fires at most once per hook instance. */
|
|
5973
5972
|
const warnedMissingUrlRef = useRef(false);
|
|
5974
5973
|
const runtimeUrlRef = useRef(copilotkit.runtimeUrl);
|
|
5975
|
-
const headersRef = useRef(copilotkit.headers ?? {});
|
|
5976
5974
|
const runtimeFetchRef = useRef(copilotkit.ɵruntimeFetch);
|
|
5977
5975
|
runtimeUrlRef.current = copilotkit.runtimeUrl;
|
|
5978
|
-
headersRef.current = copilotkit.headers ?? {};
|
|
5979
5976
|
runtimeFetchRef.current = copilotkit.ɵruntimeFetch;
|
|
5980
5977
|
const key = JSON.stringify(learningContainers);
|
|
5981
5978
|
const defaultKey = JSON.stringify(DEFAULT_CONTAINERS);
|
|
5982
5979
|
useEffect(() => {
|
|
5983
5980
|
const runtimeUrl = copilotkit.runtimeUrl;
|
|
5984
|
-
const headers = copilotkit.headers ?? {};
|
|
5985
5981
|
/**
|
|
5986
5982
|
* Fire-and-forget emit; errors must not surface in render.
|
|
5987
5983
|
* Failures are logged as warnings so they are diagnosable without
|
|
@@ -5998,7 +5994,7 @@ function useLearningContainers({ threadId, learningContainers }) {
|
|
|
5998
5994
|
recordAnnotation({
|
|
5999
5995
|
fetch: copilotkit.ɵruntimeFetch,
|
|
6000
5996
|
runtimeUrl,
|
|
6001
|
-
headers,
|
|
5997
|
+
headers: {},
|
|
6002
5998
|
type: "set_learning_containers",
|
|
6003
5999
|
payload: { containers },
|
|
6004
6000
|
threadId
|
|
@@ -6022,11 +6018,10 @@ function useLearningContainers({ threadId, learningContainers }) {
|
|
|
6022
6018
|
const capturedThreadId = threadId;
|
|
6023
6019
|
return () => {
|
|
6024
6020
|
const capturedRuntimeUrl = runtimeUrlRef.current;
|
|
6025
|
-
const capturedHeaders = headersRef.current;
|
|
6026
6021
|
if (capturedRuntimeUrl) recordAnnotation({
|
|
6027
6022
|
fetch: runtimeFetchRef.current,
|
|
6028
6023
|
runtimeUrl: capturedRuntimeUrl,
|
|
6029
|
-
headers:
|
|
6024
|
+
headers: {},
|
|
6030
6025
|
type: "set_learning_containers",
|
|
6031
6026
|
payload: { containers: DEFAULT_CONTAINERS },
|
|
6032
6027
|
threadId: capturedThreadId
|
|
@@ -8832,7 +8827,7 @@ async function transcribeAudio(core, audioBlob, filename = "recording.webm") {
|
|
|
8832
8827
|
message: "Runtime URL is not configured",
|
|
8833
8828
|
retryable: false
|
|
8834
8829
|
});
|
|
8835
|
-
const headers = { ...core.
|
|
8830
|
+
const headers = { ...await core.resolveHeaders() };
|
|
8836
8831
|
let response;
|
|
8837
8832
|
try {
|
|
8838
8833
|
if (core.runtimeTransport === "single") {
|
|
@@ -9244,7 +9239,6 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
9244
9239
|
threadStore.start();
|
|
9245
9240
|
const context = copilotkit.runtimeUrl ? {
|
|
9246
9241
|
runtimeUrl: copilotkit.runtimeUrl,
|
|
9247
|
-
headers: { ...copilotkit.headers },
|
|
9248
9242
|
wsUrl: copilotkit.intelligence?.wsUrl,
|
|
9249
9243
|
agentId: resolvedAgentId
|
|
9250
9244
|
} : null;
|
|
@@ -9340,7 +9334,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
9340
9334
|
hasNativeIntelligenceRunActivity,
|
|
9341
9335
|
copilotkit.runtimeConnectionStatus,
|
|
9342
9336
|
copilotkit.runtimeUrl,
|
|
9343
|
-
copilotkit
|
|
9337
|
+
copilotkit.ɵheadersGeneration,
|
|
9344
9338
|
copilotkit.intelligence?.wsUrl,
|
|
9345
9339
|
copilotkit.threadEndpoints?.realtimeMetadata,
|
|
9346
9340
|
standaloneRunActivityStore,
|
|
@@ -12331,6 +12325,16 @@ function CopilotListeners() {
|
|
|
12331
12325
|
|
|
12332
12326
|
//#endregion
|
|
12333
12327
|
//#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
|
|
12328
|
+
/**
|
|
12329
|
+
* Drops `null`/`undefined` entries so a `CopilotKitHeadersSource` record (or
|
|
12330
|
+
* a builder's resolved record) matches `CopilotApiConfig.headers`'s
|
|
12331
|
+
* `Record<string, string>` shape. Mirrors core's own (internal-only)
|
|
12332
|
+
* `normalizeHeaders`.
|
|
12333
|
+
*/
|
|
12334
|
+
function normalizeV1Headers(headers) {
|
|
12335
|
+
if (!headers) return {};
|
|
12336
|
+
return Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] != null));
|
|
12337
|
+
}
|
|
12334
12338
|
function CopilotKit({ children, ...props }) {
|
|
12335
12339
|
const enabled = shouldShowDevConsole(props.showDevConsole);
|
|
12336
12340
|
const publicApiKey = props.publicApiKey || props.publicLicenseKey;
|
|
@@ -12410,6 +12414,13 @@ function CopilotKitInternal(cpkProps) {
|
|
|
12410
12414
|
* This will throw an error if the props are invalid.
|
|
12411
12415
|
*/
|
|
12412
12416
|
validateProps(cpkProps);
|
|
12417
|
+
const headersPropRef = useRef(props.headers);
|
|
12418
|
+
headersPropRef.current = props.headers;
|
|
12419
|
+
const headersBuilderStateRef = useRef({
|
|
12420
|
+
fn: void 0,
|
|
12421
|
+
isAsync: false
|
|
12422
|
+
});
|
|
12423
|
+
const warnedAsyncHeadersRef = useRef(false);
|
|
12413
12424
|
const publicApiKey = props.publicLicenseKey || props.publicApiKey;
|
|
12414
12425
|
const chatApiEndpoint = props.runtimeUrl || COPILOT_CLOUD_CHAT_URL;
|
|
12415
12426
|
const [actions, setActions] = useState({});
|
|
@@ -12477,19 +12488,46 @@ function CopilotKitInternal(cpkProps) {
|
|
|
12477
12488
|
validTopics: props.guardrails_c?.validTopics || [],
|
|
12478
12489
|
invalidTopics: props.guardrails_c?.invalidTopics || []
|
|
12479
12490
|
} } } };
|
|
12480
|
-
|
|
12491
|
+
const config = {
|
|
12481
12492
|
publicApiKey,
|
|
12482
12493
|
...cloud ? { cloud } : {},
|
|
12483
12494
|
chatApiEndpoint,
|
|
12484
|
-
headers: typeof props.headers === "function" ? props.headers() : props.headers || {},
|
|
12485
12495
|
properties: props.properties || {},
|
|
12486
12496
|
transcribeAudioUrl: props.transcribeAudioUrl,
|
|
12487
12497
|
textToSpeechUrl: props.textToSpeechUrl,
|
|
12488
12498
|
credentials: props.credentials
|
|
12489
12499
|
};
|
|
12500
|
+
Object.defineProperty(config, "headers", {
|
|
12501
|
+
enumerable: true,
|
|
12502
|
+
configurable: true,
|
|
12503
|
+
get() {
|
|
12504
|
+
const source = headersPropRef.current;
|
|
12505
|
+
if (typeof source !== "function") return normalizeV1Headers(source);
|
|
12506
|
+
const state = headersBuilderStateRef.current;
|
|
12507
|
+
if (state.fn === source && state.isAsync) return {};
|
|
12508
|
+
const result = source();
|
|
12509
|
+
if (typeof result === "object" && result !== null && typeof result.then === "function") {
|
|
12510
|
+
headersBuilderStateRef.current = {
|
|
12511
|
+
fn: source,
|
|
12512
|
+
isAsync: true
|
|
12513
|
+
};
|
|
12514
|
+
result.then(void 0, () => {});
|
|
12515
|
+
if (process.env.NODE_ENV !== "production" && !warnedAsyncHeadersRef.current) {
|
|
12516
|
+
warnedAsyncHeadersRef.current = true;
|
|
12517
|
+
console.warn("[CopilotKit] An async `headers` builder is not supported by the v1 CopilotTask / GraphQL path; its headers are not sent there.");
|
|
12518
|
+
}
|
|
12519
|
+
return {};
|
|
12520
|
+
}
|
|
12521
|
+
headersBuilderStateRef.current = {
|
|
12522
|
+
fn: source,
|
|
12523
|
+
isAsync: false
|
|
12524
|
+
};
|
|
12525
|
+
return normalizeV1Headers(result);
|
|
12526
|
+
}
|
|
12527
|
+
});
|
|
12528
|
+
return config;
|
|
12490
12529
|
}, [
|
|
12491
12530
|
publicApiKey,
|
|
12492
|
-
props.headers,
|
|
12493
12531
|
props.properties,
|
|
12494
12532
|
props.transcribeAudioUrl,
|
|
12495
12533
|
props.textToSpeechUrl,
|
|
@@ -12497,27 +12535,6 @@ function CopilotKitInternal(cpkProps) {
|
|
|
12497
12535
|
props.cloudRestrictToTopic,
|
|
12498
12536
|
props.guardrails_c
|
|
12499
12537
|
]);
|
|
12500
|
-
useMemo(() => {
|
|
12501
|
-
const authHeaders = Object.values(authStates || {}).reduce((acc, state) => {
|
|
12502
|
-
if (state.status === "authenticated" && state.authHeaders) return {
|
|
12503
|
-
...acc,
|
|
12504
|
-
...Object.entries(state.authHeaders).reduce((headers, [key, value]) => ({
|
|
12505
|
-
...headers,
|
|
12506
|
-
[key.startsWith("X-Custom-") ? key : `X-Custom-${key}`]: value
|
|
12507
|
-
}), {})
|
|
12508
|
-
};
|
|
12509
|
-
return acc;
|
|
12510
|
-
}, {});
|
|
12511
|
-
return {
|
|
12512
|
-
...copilotApiConfig.headers,
|
|
12513
|
-
...copilotApiConfig.publicApiKey ? { [COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {},
|
|
12514
|
-
...authHeaders
|
|
12515
|
-
};
|
|
12516
|
-
}, [
|
|
12517
|
-
copilotApiConfig.headers,
|
|
12518
|
-
copilotApiConfig.publicApiKey,
|
|
12519
|
-
authStates
|
|
12520
|
-
]);
|
|
12521
12538
|
const [internalErrorHandlers, _setInternalErrorHandler] = useState({});
|
|
12522
12539
|
const setInternalErrorHandler = useCallback((handler) => {
|
|
12523
12540
|
_setInternalErrorHandler((prev) => ({
|
|
@@ -12832,5 +12849,5 @@ function validateProps(props) {
|
|
|
12832
12849
|
}
|
|
12833
12850
|
|
|
12834
12851
|
//#endregion
|
|
12835
|
-
export { useConfigureSuggestions as $,
|
|
12836
|
-
//# sourceMappingURL=copilotkit-
|
|
12852
|
+
export { useConfigureSuggestions as $, ɵselectMemoriesIsLoading$1 as $a, mergeMetadata as $i, MoveOperationSchema as $n, TextMessageContentEventSchema as $r, AudioPartSchema as $t, CopilotChatMessageView as A, ɵcreateThreadStore$1 as Aa, createActionGroup as Ai, HttpAgent as An, RunFinishedSuccessOutcomeSchema as Ar, CopilotKitInspector as At, CopilotChatUserMessage_default as B, ɵobservePhoenixEvent$ as Ba, emitInspectorViewThread as Bi, InputContentUrlSourceSchema as Bn, SubagentErrorEventSchema as Br, AGUI_METADATA_KEY as Bt, CopilotModalHeader as C, ɵCOPILOTKIT_FEATURES as Ca, authoritativeActivityTypes as Ci, EventType as Cn, RoleSchema as Cr, OpenGenerativeUIToolRenderer as Ct, CopilotChat as D, ɵTHREAD_REQUEST_TIMEOUT_MS as Da, contentHasMedia as Di, FilterToolCallsMiddleware as Dn, RunFinishedEventSchema as Dr, MCPAppsActivityRenderer as Dt, DefaultOpenIcon as E, ɵRUNTIME_PROBE_TIMEOUT_MS as Ea, completePartialMarkdown as Ei, FileSourceSchema as En, RunFinishedCancelledOutcomeSchema as Er, MCPAppsActivityContentSchema as Et, getIntelligenceTurnAnchors as F, ɵmapMemoryMetadataEvent as Fa, createSelector as Fi, ImageInputPartSchema as Fn, StateManager as Fr, CopilotChatConfigurationProvider as Ft, useLearningContainers as G, ɵphoenixSocket$ as Ga, ensureObjectArgs as Gi, JsonPatchSchema as Gn, SubagentInfoSchema as Gr, AddOperationSchema as Gt, CopilotChatAssistantMessage_default as H, ɵobservePhoenixSocketHealth$ as Ha, empty as Hi, IntelligenceReplayFailedError as Hn, SubagentFinishedOutcomeSchema as Hr, ActivityDeltaEventSchema as Ht, IntelligenceIndicatorView as I, ɵmemoryAdapterEvents as Ia, createStore as Ii, ImagePartSchema as In, StateSchema as Ir, useCopilotChatConfiguration as It, useLearnFromUserAction as J, ɵselectIsFetchingNextPage$1 as Ja, isAbortError as Ji, MemoryError as Jn, SuggestionEngine as Jr, AgentThreadLockedError as Jt, useAttachments as K, ɵselectFetchMoreError$1 as Ka, getRunOutcome as Ki, JsonPointerSchema as Kn, SubagentRunIdSchema as Kr, AgentCapabilitiesSchema as Kt, CopilotChatSuggestionView as L, ɵmemoryDomainEvents as La, defaultApplyEvents as Li, InputContentDataSourceSchema as Ln, StateSnapshotEventSchema as Lr, ACTIVITY_HISTORY_METADATA as Lt, messageRow as M, ɵisHttpAgent$1 as Ma, createEffect as Mi, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as Mn, RunStartedEventSchema as Mr, CopilotChatInput_default as Mt, INTELLIGENCE_TURN_HEAD as N, ɵisRetryableMemoryStatus as Na, createInspectorThreadRequestId as Ni, IdentityCapabilitiesSchema as Nn, StateCapabilitiesSchema as Nr, AudioRecorderError as Nt, CopilotChatView_default as O, ɵcreateMemoryStore as Oa, contentToText$1 as Oi, FunctionCallSchema as On, RunFinishedInterruptOutcomeSchema as Or, MCPAppsActivityType as Ot, IntelligenceIndicator as P, ɵjoinPhoenixChannel$ as Pa, createReducer as Pi, ImageInputContentSchema as Pn, StateDeltaEventSchema as Pr, CopilotChatAudioRecorder as Pt, INTERRUPT_EVENT_NAME as Q, ɵselectMemoriesError$1 as Qa, isRunCompletionAware$1 as Qi, Middleware as Qn, TextMessageChunkEventSchema as Qr, AudioInputPartSchema as Qt, CopilotChatSuggestionPill as R, ɵmemoryReducer as Ra, emitInspectorActiveThread$1 as Ri, InputContentSchema as Rn, StepFinishedEventSchema as Rr, AGUIConnectNotImplementedError$1 as Rt, CopilotSidebarView as S, withAuthoritativeActivityTypes as Sa, aggregateTokenUsage as Si, EventSchemas as Sn, ResumeEntrySchema as Sr, OpenGenerativeUIContentSchema as St, DefaultCloseIcon as T, ɵMAX_SOCKET_RETRIES as Ta, compactEvents as Ti, ExecutionCapabilitiesSchema as Tn, RunErrorEventSchema as Tr, useSandboxFunctions as Tt, CopilotChatToolCallsView as U, ɵobservePhoenixSocketSignals$ as Ua, enforceEvents as Ui, InterruptSchema as Un, SubagentFinishedSuccessOutcomeSchema as Ur, ActivityMessageSchema as Ut, CopilotChatAttachmentRenderer as V, ɵobservePhoenixJoinOutcome$ as Va, emitInspectorViewThreadResult$1 as Vi, IntelligenceAgent as Vn, SubagentFinishedEventSchema as Vr, AbstractAgent$1 as Vt, useLearningContainersInCurrentThread as W, ɵphoenixChannel$ as Wa, enforceOutgoingInput as Wi, JsonPatchOperationSchema as Wn, SubagentFinishedSuspendedOutcomeSchema as Wr, ActivitySnapshotEventSchema as Wt, useThreads$1 as X, ɵselectMemories$1 as Xa, isInterruptExpired as Xi, MessagesSnapshotEventSchema as Xn, TestOperationSchema as Xr, AttributableSchema as Xt, useMemories as Y, ɵselectIsMutating$1 as Ya, isInspectorThreadBridgeEnabled$1 as Yi, MessageSchema as Yn, SystemMessageSchema as Yr, AssistantMessageSchema as Yt, useInterrupt as Z, ɵselectMemoriesAvailable$1 as Za, isRecognizedEvent as Zi, MetadataSchema as Zn, TextInputContentSchema as Zr, AudioInputContentSchema as Zt, WildcardToolCallRender as _, tokenUsageFromAiSdkUsage as _a, UserMessageSchema as _i, DeveloperMessageSchema as _n, ReasoningMessageSchema as _r, defineToolCallRenderer as _t, ThreadsProvider as a, onInspectorViewThread$1 as aa, ToolCallArgsEventSchema as ai, CompatibilityBoundary as an, ɵthreadAdapterEvents as ao, OutputCapabilitiesSchema as ar, useHumanInTheLoop as at, CopilotSidebar as b, transformHttpEventStream as ba, VideoPartSchema as bi, DocumentPartSchema as bn, RemoveOperationSchema as br, OpenGenerativeUIActivityRenderer as bt, CoAgentStateRendersProvider as c, parseSSEStream as ca, ToolCallResultEventSchema as ci, ContextStore as cn, ProxiedCopilotRuntimeAgent$1 as cr, useComponent as ct, shouldShowDevConsole as d, randomUUID$2 as da, ToolCallStatus$1 as di, CopilotKitCoreRuntimeConnectionStatus$1 as dn, ReasoningEncryptedValueEventSchema as dr, useRenderActivityMessage as dt, ofType as ea, TextMessageEndEventSchema as ei, BackwardCompatibility_0_0_39 as en, ɵselectMemoriesIsMutating as eo, MultiAgentCapabilitiesSchema as er, useSuggestions as et, useToast as f, resolveAgentDebugConfig as fa, ToolMessageSchema as fi, CopilotKitHeaderResolutionError as fn, ReasoningEncryptedValueSubtypeSchema as fr, useRenderCustomMessages as ft, useCopilotContext as g, structuredClone_ as ga, UrlSourceSchema as gi, DebugLogger as gn, ReasoningMessageEndEventSchema as gr, CopilotKitCoreReact as gt, CopilotContext as h, select as ha, TransportCapabilitiesSchema as hi, DataSourceSchema as hn, ReasoningMessageContentEventSchema as hr, useLicenseContext$1 as ht, ThreadsContext as i, onInspectorStopViewing$1 as ia, TokenUsageSchema as ii, BaseMessageSchema as in, ɵselectThreadsIsLoading$1 as io, OptionalMetadataSchema as ir, useAgent as it, messageGroup as j, ɵisCopilotKitFeature as ja, createDebugLogger as ji, HumanInTheLoopCapabilitiesSchema as jn, RunHandler as jr, useRenderToolCall as jt, CopilotChatAttachmentQueue as k, ɵcreateThreadSelectors as ka, convertToLegacyEvents as ki, FunctionMiddleware as kn, RunFinishedOutcomeSchema as kr, ɵrunMcpFollowUp as kt, useCoAgentStateRenders as l, parseToolArguments as la, ToolCallSchema as li, CopilotKitCore$1 as ln, RawEventSchema as lr, useFrontendTools as lt, useCopilotMessagesContext as m, runHttpRequest as ma, ToolsCapabilitiesSchema as mi, CustomEventSchema as mn, ReasoningMessageChunkEventSchema as mr, useCopilotKit$1 as mt, defaultCopilotContextCategories as n, on as na, TextMessageStartEventSchema as ni, BackwardCompatibility_0_0_57 as nn, ɵselectThreads$1 as no, MultimodalInputCapabilitiesSchema as nr, useCapabilities as nt, useThreads as o, onInspectorViewThreadResult as oa, ToolCallChunkEventSchema as oi, ContentPartSchema as on, ɵwithHeaderDefaults$1 as oo, PROTOCOL_VERSION as or, useDefaultRenderTool as ot, CopilotMessagesContext as p, resolveDebugLogger as pa, ToolSchema as pi, CopyOperationSchema as pn, ReasoningEndEventSchema as pr, CopilotKitProvider as pt, useLearnFromUserActionInCurrentThread as q, ɵselectHasNextPage$1 as qa, getWebMCPModelContext as qi, MEMORY_ERROR_REGISTRY as qn, SubagentStartedEventSchema as qr, AgentRegistry as qt, CoAgentStateRenderBridge as r, onInspectorActiveThread as ra, TextPartSchema as ri, BaseEventSchema as rn, ɵselectThreadsError$1 as ro, MultimodalOutputCapabilitiesSchema as rr, UseAgentUpdate as rt, CoAgentStateRendersContext as s, parseProtoStream as sa, ToolCallEndEventSchema as si, ContextSchema as sn, PartSourceSchema as sr, useRenderTool as st, CopilotKit as t, omitOptionalNulls as ta, TextMessageRoleSchema as ti, BackwardCompatibility_0_0_45 as tn, ɵselectMemoriesRealtimeStatus$1 as to, MultimodalCapabilitiesSchema as tr, useAgentContext as tt, useAsyncCallback as u, props as ua, ToolCallStartEventSchema as ui, CopilotKitCoreErrorCode$1 as un, ReasoningCapabilitiesSchema as ur, useFrontendTool as ut, CopilotThreadsDrawer as v, tokenUsageFromLangChainMetadata as va, VideoInputContentSchema as vi, DocumentInputContentSchema as vn, ReasoningMessageStartEventSchema as vr, createA2UIMessageRenderer as vt, CopilotChatToggleButton as w, ɵInterruptState$1 as wa, buildResumeArray as wi, EventTypeSchema as wn, RunAgentInputSchema as wr, SandboxFunctionsContext as wt, CopilotPopupView as x, verifyEvents as xa, WebMCPRegistry as xi, EventSchema as xn, ReplaceOperationSchema as xr, OpenGenerativeUIActivityType as xt, CopilotPopup as y, transformChunks as ya, VideoInputPartSchema as yi, DocumentInputPartSchema as yn, ReasoningStartEventSchema as yr, GenerateSandboxedUiArgsSchema as yt, CopilotChatReasoningMessage_default as z, ɵmemoryRestEvents as za, emitInspectorStopViewing as zi, InputContentSourceSchema as zn, StepStartedEventSchema as zr, AGUIError as zt };
|
|
12853
|
+
//# sourceMappingURL=copilotkit-DtOQtboh.mjs.map
|