@copilotkit/react-core 1.78.0 → 1.79.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-gn5p8gXk.d.cts → copilotkit-2Fbb5_CC.d.cts} +41 -8
- package/dist/{copilotkit-gn5p8gXk.d.cts.map → copilotkit-2Fbb5_CC.d.cts.map} +1 -1
- package/dist/{copilotkit-D1y8IyXh.d.mts → copilotkit-DFMMPW2I.d.mts} +41 -8
- package/dist/{copilotkit-D1y8IyXh.d.mts.map → copilotkit-DFMMPW2I.d.mts.map} +1 -1
- package/dist/{copilotkit-DgJj6xa0.mjs → copilotkit-DQvE96lZ.mjs} +72 -55
- package/dist/copilotkit-DQvE96lZ.mjs.map +1 -0
- package/dist/{copilotkit-BFeenQQ0.cjs → copilotkit-DjrKQjfL.cjs} +70 -53
- package/dist/copilotkit-DjrKQjfL.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 +60 -37
- 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 +13 -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 +81 -52
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
- 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, 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.0";
|
|
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,
|
|
@@ -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 $, ɵselectMemoriesIsMutating as $a, ofType as $i, MultiAgentCapabilitiesSchema as $n, TextMessageEndEventSchema as $r, AudioPartSchema as $t, CopilotChatMessageView as A, ɵisCopilotKitFeature as Aa, createDebugLogger as Ai, HttpAgent as An, RunHandler as Ar, CopilotKitInspector as At, CopilotChatUserMessage_default as B, ɵobservePhoenixJoinOutcome$ as Ba, emitInspectorViewThreadResult$1 as Bi, InputContentUrlSourceSchema as Bn, SubagentFinishedEventSchema as Br, AGUI_METADATA_KEY as Bt, CopilotModalHeader as C, ɵInterruptState$1 as Ca, buildResumeArray as Ci, EventType as Cn, RunAgentInputSchema as Cr, OpenGenerativeUIToolRenderer as Ct, CopilotChat as D, ɵcreateMemoryStore as Da, contentToText$1 as Di, FilterToolCallsMiddleware as Dn, RunFinishedInterruptOutcomeSchema as Dr, MCPAppsActivityRenderer as Dt, DefaultOpenIcon as E, ɵTHREAD_REQUEST_TIMEOUT_MS as Ea, contentHasMedia as Ei, FileSourceSchema as En, RunFinishedEventSchema as Er, MCPAppsActivityContentSchema as Et, getIntelligenceTurnAnchors as F, ɵmemoryAdapterEvents as Fa, createStore as Fi, ImageInputPartSchema as Fn, StateSchema as Fr, CopilotChatConfigurationProvider as Ft, useLearningContainers as G, ɵselectFetchMoreError$1 as Ga, getRunOutcome as Gi, JsonPointerSchema as Gn, SubagentRunIdSchema as Gr, AddOperationSchema as Gt, CopilotChatAssistantMessage_default as H, ɵobservePhoenixSocketSignals$ as Ha, enforceEvents as Hi, InterruptSchema as Hn, SubagentFinishedSuccessOutcomeSchema as Hr, ActivityDeltaEventSchema as Ht, IntelligenceIndicatorView as I, ɵmemoryDomainEvents as Ia, defaultApplyEvents as Ii, ImagePartSchema as In, StateSnapshotEventSchema as Ir, useCopilotChatConfiguration as It, useLearnFromUserAction as J, ɵselectIsMutating$1 as Ja, isInspectorThreadBridgeEnabled$1 as Ji, MessageSchema as Jn, SystemMessageSchema as Jr, AgentThreadLockedError as Jt, useAttachments as K, ɵselectHasNextPage$1 as Ka, getWebMCPModelContext as Ki, MEMORY_ERROR_REGISTRY as Kn, SubagentStartedEventSchema as Kr, AgentCapabilitiesSchema as Kt, CopilotChatSuggestionView as L, ɵmemoryReducer as La, emitInspectorActiveThread$1 as Li, InputContentDataSourceSchema as Ln, StepFinishedEventSchema as Lr, ACTIVITY_HISTORY_METADATA as Lt, messageRow as M, ɵisRetryableMemoryStatus as Ma, createInspectorThreadRequestId as Mi, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as Mn, StateCapabilitiesSchema as Mr, CopilotChatInput_default as Mt, INTELLIGENCE_TURN_HEAD as N, ɵjoinPhoenixChannel$ as Na, createReducer as Ni, IdentityCapabilitiesSchema as Nn, StateDeltaEventSchema as Nr, AudioRecorderError as Nt, CopilotChatView_default as O, ɵcreateThreadSelectors as Oa, convertToLegacyEvents as Oi, FunctionCallSchema as On, RunFinishedOutcomeSchema as Or, MCPAppsActivityType as Ot, IntelligenceIndicator as P, ɵmapMemoryMetadataEvent as Pa, createSelector as Pi, ImageInputContentSchema as Pn, StateManager as Pr, CopilotChatAudioRecorder as Pt, INTERRUPT_EVENT_NAME as Q, ɵselectMemoriesIsLoading$1 as Qa, mergeMetadata as Qi, MoveOperationSchema as Qn, TextMessageContentEventSchema as Qr, AudioInputPartSchema as Qt, CopilotChatSuggestionPill as R, ɵmemoryRestEvents as Ra, emitInspectorStopViewing as Ri, InputContentSchema as Rn, StepStartedEventSchema as Rr, AGUIConnectNotImplementedError$1 as Rt, CopilotSidebarView as S, ɵCOPILOTKIT_FEATURES as Sa, authoritativeActivityTypes as Si, EventSchemas as Sn, RoleSchema as Sr, OpenGenerativeUIContentSchema as St, DefaultCloseIcon as T, ɵRUNTIME_PROBE_TIMEOUT_MS as Ta, completePartialMarkdown as Ti, ExecutionCapabilitiesSchema as Tn, RunFinishedCancelledOutcomeSchema as Tr, useSandboxFunctions as Tt, CopilotChatToolCallsView as U, ɵphoenixChannel$ as Ua, enforceOutgoingInput as Ui, JsonPatchOperationSchema as Un, SubagentFinishedSuspendedOutcomeSchema as Ur, ActivityMessageSchema as Ut, CopilotChatAttachmentRenderer as V, ɵobservePhoenixSocketHealth$ as Va, empty as Vi, IntelligenceAgent as Vn, SubagentFinishedOutcomeSchema as Vr, AbstractAgent$1 as Vt, useLearningContainersInCurrentThread as W, ɵphoenixSocket$ as Wa, ensureObjectArgs as Wi, JsonPatchSchema as Wn, SubagentInfoSchema as Wr, ActivitySnapshotEventSchema as Wt, useThreads$1 as X, ɵselectMemoriesAvailable$1 as Xa, isRecognizedEvent as Xi, MetadataSchema as Xn, TextInputContentSchema as Xr, AttributableSchema as Xt, useMemories as Y, ɵselectMemories$1 as Ya, isInterruptExpired as Yi, MessagesSnapshotEventSchema as Yn, TestOperationSchema as Yr, AssistantMessageSchema as Yt, useInterrupt as Z, ɵselectMemoriesError$1 as Za, isRunCompletionAware$1 as Zi, Middleware as Zn, TextMessageChunkEventSchema as Zr, AudioInputContentSchema as Zt, WildcardToolCallRender as _, tokenUsageFromLangChainMetadata as _a, VideoInputContentSchema as _i, DeveloperMessageSchema as _n, ReasoningMessageStartEventSchema as _r, defineToolCallRenderer as _t, ThreadsProvider as a, onInspectorViewThreadResult as aa, ToolCallChunkEventSchema as ai, CompatibilityBoundary as an, ɵwithHeaderDefaults$1 as ao, PROTOCOL_VERSION as ar, useHumanInTheLoop as at, CopilotSidebar as b, verifyEvents as ba, WebMCPRegistry as bi, DocumentPartSchema as bn, ReplaceOperationSchema as br, OpenGenerativeUIActivityRenderer as bt, CoAgentStateRendersProvider as c, parseToolArguments as ca, ToolCallSchema as ci, ContextStore as cn, RawEventSchema as cr, useComponent as ct, shouldShowDevConsole as d, resolveAgentDebugConfig as da, ToolMessageSchema as di, CopilotKitCoreRuntimeConnectionStatus$1 as dn, ReasoningEncryptedValueSubtypeSchema as dr, useRenderActivityMessage as dt, omitOptionalNulls as ea, TextMessageRoleSchema as ei, BackwardCompatibility_0_0_39 as en, ɵselectMemoriesRealtimeStatus$1 as eo, MultimodalCapabilitiesSchema as er, useSuggestions as et, useToast as f, resolveDebugLogger as fa, ToolSchema as fi, CopilotKitHeaderResolutionError as fn, ReasoningEndEventSchema as fr, useRenderCustomMessages as ft, useCopilotContext as g, tokenUsageFromAiSdkUsage as ga, UserMessageSchema as gi, DebugLogger as gn, ReasoningMessageSchema as gr, CopilotKitCoreReact as gt, CopilotContext as h, structuredClone_ as ha, UrlSourceSchema as hi, DataSourceSchema as hn, ReasoningMessageEndEventSchema as hr, useLicenseContext$1 as ht, ThreadsContext as i, onInspectorViewThread$1 as ia, ToolCallArgsEventSchema as ii, BaseMessageSchema as in, ɵthreadAdapterEvents as io, OutputCapabilitiesSchema as ir, useAgent as it, messageGroup as j, ɵisHttpAgent$1 as ja, createEffect as ji, HumanInTheLoopCapabilitiesSchema as jn, RunStartedEventSchema as jr, useRenderToolCall as jt, CopilotChatAttachmentQueue as k, ɵcreateThreadStore$1 as ka, createActionGroup as ki, FunctionMiddleware as kn, RunFinishedSuccessOutcomeSchema as kr, ɵrunMcpFollowUp as kt, useCoAgentStateRenders as l, props as la, ToolCallStartEventSchema as li, CopilotKitCore$1 as ln, ReasoningCapabilitiesSchema as lr, useFrontendTools as lt, useCopilotMessagesContext as m, select as ma, TransportCapabilitiesSchema as mi, CustomEventSchema as mn, ReasoningMessageContentEventSchema as mr, useCopilotKit$1 as mt, defaultCopilotContextCategories as n, onInspectorActiveThread as na, TextPartSchema as ni, BackwardCompatibility_0_0_57 as nn, ɵselectThreadsError$1 as no, MultimodalOutputCapabilitiesSchema as nr, useCapabilities as nt, useThreads as o, parseProtoStream as oa, ToolCallEndEventSchema as oi, ContentPartSchema as on, PartSourceSchema as or, useDefaultRenderTool as ot, CopilotMessagesContext as p, runHttpRequest as pa, ToolsCapabilitiesSchema as pi, CopyOperationSchema as pn, ReasoningMessageChunkEventSchema as pr, CopilotKitProvider as pt, useLearnFromUserActionInCurrentThread as q, ɵselectIsFetchingNextPage$1 as qa, isAbortError as qi, MemoryError as qn, SuggestionEngine as qr, AgentRegistry as qt, CoAgentStateRenderBridge as r, onInspectorStopViewing$1 as ra, TokenUsageSchema as ri, BaseEventSchema as rn, ɵselectThreadsIsLoading$1 as ro, OptionalMetadataSchema as rr, UseAgentUpdate as rt, CoAgentStateRendersContext as s, parseSSEStream as sa, ToolCallResultEventSchema as si, ContextSchema as sn, ProxiedCopilotRuntimeAgent$1 as sr, useRenderTool as st, CopilotKit as t, on as ta, TextMessageStartEventSchema as ti, BackwardCompatibility_0_0_45 as tn, ɵselectThreads$1 as to, MultimodalInputCapabilitiesSchema as tr, useAgentContext as tt, useAsyncCallback as u, randomUUID$2 as ua, ToolCallStatus$1 as ui, CopilotKitCoreErrorCode$1 as un, ReasoningEncryptedValueEventSchema as ur, useFrontendTool as ut, CopilotThreadsDrawer as v, transformChunks as va, VideoInputPartSchema as vi, DocumentInputContentSchema as vn, ReasoningStartEventSchema as vr, createA2UIMessageRenderer as vt, CopilotChatToggleButton as w, ɵMAX_SOCKET_RETRIES as wa, compactEvents as wi, EventTypeSchema as wn, RunErrorEventSchema as wr, SandboxFunctionsContext as wt, CopilotPopupView as x, withAuthoritativeActivityTypes as xa, aggregateTokenUsage as xi, EventSchema as xn, ResumeEntrySchema as xr, OpenGenerativeUIActivityType as xt, CopilotPopup as y, transformHttpEventStream as ya, VideoPartSchema as yi, DocumentInputPartSchema as yn, RemoveOperationSchema as yr, GenerateSandboxedUiArgsSchema as yt, CopilotChatReasoningMessage_default as z, ɵobservePhoenixEvent$ as za, emitInspectorViewThread as zi, InputContentSourceSchema as zn, SubagentErrorEventSchema as zr, AGUIError as zt };
|
|
12853
|
+
//# sourceMappingURL=copilotkit-DQvE96lZ.mjs.map
|