@copilotkit/react-core 2.0.0-rc.26 → 2.0.0-rc.28
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/{MarkdownSurfaces-v9AplTEj.cjs → MarkdownSurfaces-BbrHcSHN.cjs} +2 -3
- package/dist/{MarkdownSurfaces-v9AplTEj.cjs.map → MarkdownSurfaces-BbrHcSHN.cjs.map} +1 -1
- package/dist/{MarkdownSurfaces-CD0FAiZq.mjs → MarkdownSurfaces-DQbRS91-.mjs} +2 -3
- package/dist/{MarkdownSurfaces-CD0FAiZq.mjs.map → MarkdownSurfaces-DQbRS91-.mjs.map} +1 -1
- package/dist/context.cjs +14 -1
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +12 -1
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +12 -1
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +14 -1
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +1 -1
- package/dist/generative-ui.mjs +1 -1
- package/dist/headless.cjs +11 -41
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +18 -18
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +6 -17
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +13 -43
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +513 -564
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -26
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +21 -26
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +276 -567
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +514 -566
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
package/dist/headless.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1, { ComponentType, MutableRefObject, ReactNode } from "react";
|
|
2
2
|
import * as _copilotkit_core0 from "@copilotkit/core";
|
|
3
|
-
import { CopilotChatDefaultLabels, CopilotChatLabels, CopilotChatLabels as CopilotChatLabels$1, FrontendTool, HumanInTheLoopRenderProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, Suggestion, ToolCallRenderProps, ToolCallRendererDef, ɵChatConfigurationStore, ɵJsonSerializable, ɵSuggestionsConfigInput } from "@copilotkit/core";
|
|
3
|
+
import { CopilotChatDefaultLabels, CopilotChatLabels, CopilotChatLabels as CopilotChatLabels$1, FrontendTool, HumanInTheLoopRenderProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, Suggestion, ToolCallRenderProps, ToolCallRendererDef, ɵChatConfigurationStore, ɵJsonSerializable, ɵSuggestionsConfigInput, ɵThreadSummary } from "@copilotkit/core";
|
|
4
4
|
import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
|
|
5
5
|
import { CopilotKitCoreReact, CopilotKitCoreReactConfig, useCopilotKit } from "@copilotkit/react-core/context";
|
|
6
6
|
import * as _ag_ui_client0 from "@ag-ui/client";
|
|
@@ -561,23 +561,12 @@ declare function useAgentContext(context: AgentContextInput): void;
|
|
|
561
561
|
* A conversation thread managed by CopilotKit Intelligence.
|
|
562
562
|
*
|
|
563
563
|
* Each thread has a unique `id`, an optional human-readable `name`, and
|
|
564
|
-
*
|
|
564
|
+
* ISO-8601 `createdAt` and `updatedAt` timestamps. `lastRunAt` is the time of
|
|
565
|
+
* the most recent agent run, absent when the thread has never run; prefer it
|
|
566
|
+
* over `updatedAt` for "last activity", since rename and archive do not bump
|
|
567
|
+
* it. The shape is core's thread summary, which Angular also exposes.
|
|
565
568
|
*/
|
|
566
|
-
|
|
567
|
-
id: string;
|
|
568
|
-
agentId: string;
|
|
569
|
-
name: string | null;
|
|
570
|
-
archived: boolean;
|
|
571
|
-
createdAt: string;
|
|
572
|
-
updatedAt: string;
|
|
573
|
-
/**
|
|
574
|
-
* ISO-8601 timestamp of the most recent agent run on this thread. Absent
|
|
575
|
-
* when the thread has never been run. Prefer this over `updatedAt` for
|
|
576
|
-
* user-facing "last activity" displays — it is not bumped by metadata-only
|
|
577
|
-
* actions like rename or archive.
|
|
578
|
-
*/
|
|
579
|
-
lastRunAt?: string;
|
|
580
|
-
}
|
|
569
|
+
type Thread = ɵThreadSummary;
|
|
581
570
|
/**
|
|
582
571
|
* Configuration for the {@link useThreads} hook.
|
|
583
572
|
*
|
package/dist/headless.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAAQ,mBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EDrBP;;;;;EC2BR,UAAA;EDL2B;;;;;ECW3B,aAAA,GAAgB,IAAA;EDTD;;;;;ECef,gBAAA;EDhBsB;;;;;;;ECwBtB,cAAA;;;AA/BF;;;;;;;;EA0CE,oBAAA,GAAuB,UAAA,GAAa,IAAA;EAKpC,mBAAA;EA1Ce;;;;;;;;;;;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;;;AAyB9C;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"headless.d.mts","names":[],"sources":["../src/providers/use-owned-core.ts","../src/providers/CopilotChatConfigurationProvider.tsx","../src/hooks/use-agent.tsx","../src/types/react-tool-call-renderer.ts","../src/types/frontend-tool.ts","../src/hooks/use-frontend-tool.tsx","../src/hooks/use-frontend-tools.tsx","../src/hooks/use-component.tsx","../src/types/human-in-the-loop.ts","../src/hooks/use-human-in-the-loop.tsx","../src/hooks/use-interrupt.tsx","../src/hooks/use-suggestions.tsx","../src/hooks/use-configure-suggestions.tsx","../src/hooks/use-agent-context.tsx","../src/hooks/use-threads.tsx","../src/hooks/use-render-tool.tsx","../src/hooks/use-render-tool-call.tsx","../src/types/defineToolCallRenderer.ts","../src/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;;;;UAIU,UAAA;EACR,OAAA;AAAA;;;;;;AAJ4C;;;;;AAyB9C;;;;;;;;iBAAgB,aAAA,WAAwB,UAAA,CAAA,CACtC,GAAA,EAAK,gBAAA,CAAiB,CAAA,UACtB,MAAA,QAAc,CAAA,GAAC,CAAA;;;UCRA,6BAAA;EACf,MAAA,EAAQ,mBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EDrBP;;;;;EC2BR,UAAA;EDL2B;;;;;ECW3B,aAAA,GAAgB,IAAA;EDTD;;;;;ECef,gBAAA;EDhBsB;;;;;;;ECwBtB,cAAA;;;AA/BF;;;;;;;;EA0CE,oBAAA,GAAuB,UAAA,GAAa,IAAA;EAKpC,mBAAA;EA1Ce;;;;;;;;;;;;;;;;;EA4Df,iBAAA,GACE,QAAA,UACA,OAAA;IAAY,QAAA;EAAA;EAwBsC;;;;;;;;;EAbpD,cAAA;EAeS;;;;EAVT,MAAA,GAAS,uBAAA;AAAA;AAAA,UAQM,qCAAA;EACf,QAAA,EAAU,SAAA;EACV,MAAA,GAAS,OAAA,CAAQ,mBAAA;EACjB,OAAA;EACA,QAAA;EAMA,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A;;;;;;;;;;;;;;AdmCT;;;;;;;;;;;;;;iBcLgB,aAAA,WAAwB,gBAAA,CAAA,CACtC,MAAA;EACE,IAAA;EACA,UAAA,EAAY,CAAA;EACZ,MAAA,GAAS,KAAA,EAAO,eAAA,CAAgB,CAAA,MAAO,KAAA,CAAM,YAAA;EAC7C,OAAA,WdeS;EcbT,KAAA;AAAA,GAEF,IAAA,GAAO,aAAA;;;UChGQ,sBAAA;EACf,QAAA,EAAU,QAAA;EACV,WAAA,GAAc,WAAA;AAAA;;;;;;;iBAsHA,iBAAA,CAAA;EAAiB,QAAA;EAAA;AAAA,GAoB1B,sBAAA,KAAyB,OAAA,CAAM,YAAA;;;;;;;;;AhB9JQ;iBiBa9B,sBAAA,CAAuB,GAAA;EACrC,IAAA;EACA,MAAA,GAAS,KAAA,EAAO,mBAAA,UAA6B,OAAA,CAAM,YAAA;EACnD,OAAA;EACA,KAAA;AAAA,IACE,qBAAA;AAAA,iBAGY,sBAAA,WAAiC,gBAAA,CAAA,CAAkB,GAAA;EACjE,IAAA;EACA,IAAA,EAAM,CAAA;EACN,MAAA,GACE,KAAA,EAAO,mBAAA,CAAoB,iBAAA,CAAkB,CAAA,OAC1C,OAAA,CAAM,YAAA;EACX,OAAA;EACA,KAAA;AAAA,IACE,qBAAA,CAAsB,iBAAA,CAAkB,CAAA;;;;;;;;;;;;AjB7BE;;;;iBkBgB9B,eAAA,CACd,OAAA,YACC,iBAAA"}
|
package/dist/headless.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CopilotKitContext, CopilotKitCoreReact, useCopilotKit, useCopilotKit as useCopilotKit$1, useDefaultAgentId } from "@copilotkit/react-core/context";
|
|
2
2
|
import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { CopilotChatDefaultLabels, CopilotChatDefaultLabels as CopilotChatDefaultLabels$1, ToolCallStatus, ɵChatConfigurationStore, ɵInterruptController, ɵThreadsController, ɵbindSuggestionsConfig, ɵbuildHumanInTheLoopTool, ɵbuildToolCallRenderProps, ɵcomponentToolDescription, ɵcreateThreadStore, ɵdescribeUnrenderedToolCalls, ɵgetAgentCapabilities, ɵgetAgentResolver, ɵhitlRenderProps, ɵresolveAgentId, ɵresolveAgentThreadId, ɵresolveToolCallAgentId, ɵresolveToolCallRenderer, ɵserializeContextValue, ɵshallowEqualRecord, ɵsubscribeToAgentSuggestions, ɵsubscribeToAgentUpdates, ɵvalidateAgentBinding } from "@copilotkit/core";
|
|
3
|
+
import { CopilotChatDefaultLabels, CopilotChatDefaultLabels as CopilotChatDefaultLabels$1, ToolCallStatus, ɵChatConfigurationStore, ɵInterruptController, ɵThreadsController, ɵbindSuggestionsConfig, ɵbuildHumanInTheLoopTool, ɵbuildToolCallRenderProps, ɵcomponentToolDescription, ɵcreateThreadStore, ɵdescribeUnrenderedToolCalls, ɵgetAgentCapabilities, ɵgetAgentResolver, ɵhitlRenderProps, ɵregisterFrontendTools, ɵresolveAgentId, ɵresolveAgentThreadId, ɵresolveToolCallAgentId, ɵresolveToolCallRenderer, ɵserializeContextValue, ɵshallowEqualRecord, ɵsubscribeToAgentSuggestions, ɵsubscribeToAgentUpdates, ɵvalidateAgentBinding } from "@copilotkit/core";
|
|
4
4
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
5
|
+
import { ɵanySchema } from "@copilotkit/shared";
|
|
6
6
|
|
|
7
7
|
//#region src/providers/use-owned-core.ts
|
|
8
8
|
/**
|
|
@@ -429,21 +429,7 @@ function useFrontendTool(tool, deps) {
|
|
|
429
429
|
const { copilotkit } = useCopilotKit$1();
|
|
430
430
|
const depsVersion = useDepsVersion(deps);
|
|
431
431
|
useLayoutEffect(() => {
|
|
432
|
-
|
|
433
|
-
if (copilotkit.getTool({
|
|
434
|
-
toolName: name,
|
|
435
|
-
agentId: tool.agentId
|
|
436
|
-
})) console.warn(`Tool '${name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
|
|
437
|
-
const unregister = copilotkit.addTool(tool);
|
|
438
|
-
if (tool.render) copilotkit.addHookRenderToolCall({
|
|
439
|
-
name,
|
|
440
|
-
args: tool.parameters,
|
|
441
|
-
agentId: tool.agentId,
|
|
442
|
-
render: tool.render
|
|
443
|
-
});
|
|
444
|
-
return () => {
|
|
445
|
-
unregister();
|
|
446
|
-
};
|
|
432
|
+
return ɵregisterFrontendTools(copilotkit, [tool], (renderer) => copilotkit.addHookRenderToolCall(renderer));
|
|
447
433
|
}, [
|
|
448
434
|
tool.name,
|
|
449
435
|
tool.available,
|
|
@@ -513,30 +499,7 @@ function useFrontendTools(tools, deps) {
|
|
|
513
499
|
const toolList = tools ?? EMPTY_TOOLS;
|
|
514
500
|
const extraDeps = deps ?? EMPTY_DEPS;
|
|
515
501
|
useLayoutEffect(() => {
|
|
516
|
-
|
|
517
|
-
for (const tool of toolList) {
|
|
518
|
-
const key = `${tool.agentId ?? ""}:${tool.name}`;
|
|
519
|
-
if (deduped.has(key)) console.warn(`Tool '${tool.name}' is listed more than once for agent '${tool.agentId || "global"}' in the same useFrontendTools call. Using the last entry.`);
|
|
520
|
-
deduped.set(key, tool);
|
|
521
|
-
}
|
|
522
|
-
const registered = [...deduped.values()];
|
|
523
|
-
const unregisters = [];
|
|
524
|
-
for (const tool of registered) {
|
|
525
|
-
if (copilotkit.getTool({
|
|
526
|
-
toolName: tool.name,
|
|
527
|
-
agentId: tool.agentId
|
|
528
|
-
})) console.warn(`Tool '${tool.name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
|
|
529
|
-
unregisters.push(copilotkit.addTool(tool));
|
|
530
|
-
if (tool.render) copilotkit.addHookRenderToolCall({
|
|
531
|
-
name: tool.name,
|
|
532
|
-
args: tool.parameters,
|
|
533
|
-
agentId: tool.agentId,
|
|
534
|
-
render: tool.render
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
return () => {
|
|
538
|
-
for (const unregister of unregisters) unregister();
|
|
539
|
-
};
|
|
502
|
+
return ɵregisterFrontendTools(copilotkit, toolList, (renderer) => copilotkit.addHookRenderToolCall(renderer));
|
|
540
503
|
}, [
|
|
541
504
|
JSON.stringify(toolList.map((tool) => [
|
|
542
505
|
tool.name,
|
|
@@ -720,7 +683,11 @@ function useSuggestions({ agentId } = {}) {
|
|
|
720
683
|
const { copilotkit } = useCopilotKit$1();
|
|
721
684
|
const config = useCopilotChatConfiguration();
|
|
722
685
|
const providerAgentId = useDefaultAgentId();
|
|
723
|
-
const resolvedAgentId = useMemo(() =>
|
|
686
|
+
const resolvedAgentId = useMemo(() => ɵresolveAgentId({
|
|
687
|
+
agentId,
|
|
688
|
+
chatAgentId: config?.agentId,
|
|
689
|
+
providerAgentId
|
|
690
|
+
}), [
|
|
724
691
|
agentId,
|
|
725
692
|
config?.agentId,
|
|
726
693
|
providerAgentId
|
|
@@ -763,7 +730,10 @@ function useConfigureSuggestions(config, deps) {
|
|
|
763
730
|
const { copilotkit } = useCopilotKit$1();
|
|
764
731
|
const chatConfig = useCopilotChatConfiguration();
|
|
765
732
|
const providerAgentId = useDefaultAgentId();
|
|
766
|
-
const chatAgentId =
|
|
733
|
+
const chatAgentId = ɵresolveAgentId({
|
|
734
|
+
chatAgentId: chatConfig?.agentId,
|
|
735
|
+
providerAgentId
|
|
736
|
+
});
|
|
767
737
|
const extraDeps = deps ?? [];
|
|
768
738
|
const bindingRef = useRef(null);
|
|
769
739
|
const latestRef = useRef({
|