@copilotkit/react-core 1.79.1-canary.1792091124 → 1.79.2-canary.1792172552

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.
@@ -40,7 +40,7 @@ function shallowEqual(obj1, obj2) {
40
40
  * Returns true only for plain JS objects (`{}`), excluding arrays, Dates,
41
41
  * class instances, and other exotic objects that happen to have typeof "object".
42
42
  */
43
- function isPlainObject(obj) {
43
+ function isPlainObject$1(obj) {
44
44
  return obj !== null && typeof obj === "object" && Object.prototype.toString.call(obj) === "[object Object]";
45
45
  }
46
46
  /**
@@ -59,7 +59,7 @@ function isPlainObject(obj) {
59
59
  function useShallowStableRef(value) {
60
60
  const ref = useRef(value);
61
61
  if (ref.current === value) return ref.current;
62
- if (isPlainObject(ref.current) && isPlainObject(value)) {
62
+ if (isPlainObject$1(ref.current) && isPlainObject$1(value)) {
63
63
  if (shallowEqual(ref.current, value)) return ref.current;
64
64
  }
65
65
  ref.current = value;
@@ -1626,7 +1626,7 @@ function useRenderToolCall() {
1626
1626
 
1627
1627
  //#endregion
1628
1628
  //#region package.json
1629
- var version = "1.79.1-canary.1792091124";
1629
+ var version = "1.79.2-canary.1792172552";
1630
1630
 
1631
1631
  //#endregion
1632
1632
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -3991,12 +3991,86 @@ function useRenderActivityMessage() {
3991
3991
  }), [renderActivityMessage, findRenderer]);
3992
3992
  }
3993
3993
 
3994
+ //#endregion
3995
+ //#region src/v2/hooks/tool-registration.ts
3996
+ /**
3997
+ * Deps comparison shared by `useFrontendTool` (and through it
3998
+ * `useHumanInTheLoop` and `useComponent`) and `useRenderTool`. Not part of the
3999
+ * public API.
4000
+ */
4001
+ const EMPTY_DEPS$1 = [];
4002
+ function isPlainObject(value) {
4003
+ const proto = Object.getPrototypeOf(value);
4004
+ return proto === Object.prototype || proto === null;
4005
+ }
4006
+ /**
4007
+ * Plain data (primitives, plain objects, arrays, dates) compares by value.
4008
+ * Functions always compare equal: these hooks used to compare
4009
+ * `JSON.stringify(deps)`, which turns every function into `null`, and a
4010
+ * function that counted as changed would re-register on every render when it
4011
+ * is written inline (and loop in a component that also reads
4012
+ * `useRenderToolCall`). Everything else (class instances, maps, sets) compares
4013
+ * by identity. A cycle inside plain data is safe: a pair already being
4014
+ * compared counts as equal for that branch.
4015
+ */
4016
+ function depEqual(a, b, seen) {
4017
+ if (Object.is(a, b)) return true;
4018
+ if (typeof a === "function" && typeof b === "function") return true;
4019
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
4020
+ if (a instanceof Date && b instanceof Date) return Object.is(a.getTime(), b.getTime());
4021
+ const aIsArray = Array.isArray(a);
4022
+ if (aIsArray !== Array.isArray(b)) return false;
4023
+ if (!aIsArray && !(isPlainObject(a) && isPlainObject(b))) return false;
4024
+ if (seen.get(a) === b) return true;
4025
+ seen.set(a, b);
4026
+ if (aIsArray) {
4027
+ const left = a;
4028
+ const right = b;
4029
+ if (left.length !== right.length) return false;
4030
+ for (let i = 0; i < left.length; i++) if (!depEqual(left[i], right[i], seen)) return false;
4031
+ return true;
4032
+ }
4033
+ const left = a;
4034
+ const right = b;
4035
+ const leftKeys = Object.keys(left);
4036
+ if (leftKeys.length !== Object.keys(right).length) return false;
4037
+ for (const key of leftKeys) {
4038
+ if (!Object.prototype.hasOwnProperty.call(right, key)) return false;
4039
+ if (!depEqual(left[key], right[key], seen)) return false;
4040
+ }
4041
+ return true;
4042
+ }
4043
+ /** Whether two deps arrays are equal. A change in length is always a change. */
4044
+ function depsEqual(prev, next) {
4045
+ if (prev.length !== next.length) return false;
4046
+ const seen = /* @__PURE__ */ new Map();
4047
+ for (let i = 0; i < prev.length; i++) if (!depEqual(prev[i], next[i], seen)) return false;
4048
+ return true;
4049
+ }
4050
+ /**
4051
+ * Turns a caller's `deps` array into a number that changes exactly when the
4052
+ * deps change, by the rules of {@link depsEqual}. Put the number, not the
4053
+ * array, in the registration effect's dependency list: that keeps the list a
4054
+ * constant length and never serializes a value.
4055
+ */
4056
+ function useDepsVersion(deps) {
4057
+ const next = deps ?? EMPTY_DEPS$1;
4058
+ const ref = useRef({
4059
+ deps: next,
4060
+ version: 0
4061
+ });
4062
+ if (ref.current.deps !== next && !depsEqual(ref.current.deps, next)) ref.current = {
4063
+ deps: next,
4064
+ version: ref.current.version + 1
4065
+ };
4066
+ return ref.current.version;
4067
+ }
4068
+
3994
4069
  //#endregion
3995
4070
  //#region src/v2/hooks/use-frontend-tool.tsx
3996
- const EMPTY_DEPS$2 = [];
3997
4071
  function useFrontendTool(tool, deps) {
3998
4072
  const { copilotkit } = useCopilotKit();
3999
- const extraDeps = deps ?? EMPTY_DEPS$2;
4073
+ const depsVersion = useDepsVersion(deps);
4000
4074
  useLayoutEffect(() => {
4001
4075
  const name = tool.name;
4002
4076
  if (copilotkit.getTool({
@@ -4020,14 +4094,14 @@ function useFrontendTool(tool, deps) {
4020
4094
  tool.name,
4021
4095
  tool.available,
4022
4096
  copilotkit,
4023
- JSON.stringify(extraDeps),
4097
+ depsVersion,
4024
4098
  JSON.stringify(tool.webmcp ?? null)
4025
4099
  ]);
4026
4100
  }
4027
4101
 
4028
4102
  //#endregion
4029
4103
  //#region src/v2/hooks/use-frontend-tools.tsx
4030
- const EMPTY_DEPS$1 = [];
4104
+ const EMPTY_DEPS = [];
4031
4105
  const EMPTY_TOOLS = [];
4032
4106
  /**
4033
4107
  * Register a list of frontend tools whose length can change between renders.
@@ -4081,7 +4155,7 @@ const EMPTY_TOOLS = [];
4081
4155
  function useFrontendTools(tools, deps) {
4082
4156
  const { copilotkit } = useCopilotKit();
4083
4157
  const toolList = tools ?? EMPTY_TOOLS;
4084
- const extraDeps = deps ?? EMPTY_DEPS$1;
4158
+ const extraDeps = deps ?? EMPTY_DEPS;
4085
4159
  useLayoutEffect(() => {
4086
4160
  const deduped = /* @__PURE__ */ new Map();
4087
4161
  for (const tool of toolList) {
@@ -4192,7 +4266,6 @@ function useComponent(config, deps) {
4192
4266
 
4193
4267
  //#endregion
4194
4268
  //#region src/v2/hooks/use-render-tool.tsx
4195
- const EMPTY_DEPS = [];
4196
4269
  /**
4197
4270
  * Registers a renderer entry in CopilotKit's `renderToolCalls` registry.
4198
4271
  *
@@ -4236,7 +4309,7 @@ const EMPTY_DEPS = [];
4236
4309
  */
4237
4310
  function useRenderTool(config, deps) {
4238
4311
  const { copilotkit } = useCopilotKit();
4239
- const extraDeps = deps ?? EMPTY_DEPS;
4312
+ const depsVersion = useDepsVersion(deps);
4240
4313
  useEffect(() => {
4241
4314
  const renderer = config.name === "*" && !config.parameters ? defineToolCallRenderer({
4242
4315
  name: "*",
@@ -4268,7 +4341,7 @@ function useRenderTool(config, deps) {
4268
4341
  }, [
4269
4342
  config.name,
4270
4343
  copilotkit,
4271
- JSON.stringify(extraDeps)
4344
+ depsVersion
4272
4345
  ]);
4273
4346
  }
4274
4347
 
@@ -12866,4 +12939,4 @@ function validateProps(props) {
12866
12939
 
12867
12940
  //#endregion
12868
12941
  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 };
12869
- //# sourceMappingURL=copilotkit-D123rHtg.mjs.map
12942
+ //# sourceMappingURL=copilotkit-DcENKLnJ.mjs.map