@copilotkit/react-core 1.55.3-canary.1776260990 → 1.55.3-canary.1776979102

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.
Files changed (59) hide show
  1. package/dist/{copilotkit-Dcf7Lkjb.d.mts → copilotkit-3mXoM0Hd.d.mts} +9 -36
  2. package/dist/copilotkit-3mXoM0Hd.d.mts.map +1 -0
  3. package/dist/{copilotkit-9_JxoZgF.d.cts → copilotkit-BDDjvB-p.d.cts} +9 -36
  4. package/dist/copilotkit-BDDjvB-p.d.cts.map +1 -0
  5. package/dist/{copilotkit-9l47K1Ot.cjs → copilotkit-BkcqmpWt.cjs} +163 -282
  6. package/dist/copilotkit-BkcqmpWt.cjs.map +1 -0
  7. package/dist/{copilotkit-a2pL_KeT.mjs → copilotkit-C7n8Umv9.mjs} +165 -278
  8. package/dist/copilotkit-C7n8Umv9.mjs.map +1 -0
  9. package/dist/index.cjs +4 -9
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +4 -9
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/index.umd.js +144 -233
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/v2/index.cjs +1 -2
  18. package/dist/v2/index.d.cts +2 -2
  19. package/dist/v2/index.d.mts +2 -2
  20. package/dist/v2/index.mjs +2 -2
  21. package/dist/v2/index.umd.js +166 -282
  22. package/dist/v2/index.umd.js.map +1 -1
  23. package/package.json +6 -6
  24. package/src/components/copilot-provider/copilot-messages.tsx +24 -39
  25. package/src/components/copilot-provider/copilotkit-props.tsx +5 -9
  26. package/src/components/copilot-provider/copilotkit.tsx +1 -4
  27. package/src/hooks/__tests__/use-copilot-chat-internal-connect.test.tsx +16 -27
  28. package/src/hooks/use-copilot-chat_internal.ts +4 -15
  29. package/src/v2/__tests__/utils/test-helpers.tsx +7 -40
  30. package/src/v2/components/chat/CopilotChat.tsx +1 -1
  31. package/src/v2/components/chat/CopilotChatAssistantMessage.tsx +15 -18
  32. package/src/v2/components/chat/CopilotChatMessageView.tsx +2 -7
  33. package/src/v2/components/chat/CopilotChatReasoningMessage.tsx +4 -17
  34. package/src/v2/components/chat/CopilotChatUserMessage.tsx +10 -13
  35. package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.tsx +5 -131
  36. package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +0 -60
  37. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.tsx +1 -1
  38. package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.tsx +2 -5
  39. package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.tsx +2 -5
  40. package/src/v2/components/chat/__tests__/MCPAppsActivityRenderer.e2e.test.tsx +1 -55
  41. package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.tsx +0 -8
  42. package/src/v2/hooks/__tests__/use-agent-throttle.test.tsx +10 -10
  43. package/src/v2/hooks/__tests__/use-agent.e2e.test.tsx +2 -13
  44. package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.tsx +4 -23
  45. package/src/v2/hooks/index.ts +0 -1
  46. package/src/v2/hooks/use-agent.tsx +10 -157
  47. package/src/v2/hooks/use-interrupt.tsx +1 -10
  48. package/src/v2/hooks/use-render-activity-message.tsx +3 -9
  49. package/src/v2/hooks/use-render-custom-messages.tsx +1 -6
  50. package/src/v2/providers/CopilotKitProvider.tsx +2 -6
  51. package/dist/copilotkit-9_JxoZgF.d.cts.map +0 -1
  52. package/dist/copilotkit-9l47K1Ot.cjs.map +0 -1
  53. package/dist/copilotkit-Dcf7Lkjb.d.mts.map +0 -1
  54. package/dist/copilotkit-a2pL_KeT.mjs.map +0 -1
  55. package/src/components/copilot-provider/__tests__/error-visibility-prod.test.tsx +0 -70
  56. package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.tsx +0 -241
  57. package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.tsx +0 -327
  58. package/src/v2/hooks/__tests__/use-capabilities.test.tsx +0 -76
  59. package/src/v2/hooks/use-capabilities.tsx +0 -25
@@ -1,76 +0,0 @@
1
- import React from "react";
2
- import { renderHook } from "@testing-library/react";
3
- import { describe, it, expect, beforeEach, vi } from "vitest";
4
- import type { AgentCapabilities } from "@ag-ui/core";
5
- import { useCapabilities } from "../use-capabilities";
6
- import { useAgent } from "../use-agent";
7
-
8
- vi.mock("../use-agent", () => ({
9
- useAgent: vi.fn(),
10
- }));
11
-
12
- const mockUseAgent = useAgent as ReturnType<typeof vi.fn>;
13
-
14
- describe("useCapabilities", () => {
15
- beforeEach(() => {
16
- vi.clearAllMocks();
17
- });
18
-
19
- it("returns capabilities when agent exposes them", () => {
20
- const caps: AgentCapabilities = {
21
- tools: { supported: true, clientProvided: true },
22
- };
23
-
24
- mockUseAgent.mockReturnValue({
25
- agent: { capabilities: caps },
26
- });
27
-
28
- const { result } = renderHook(() => useCapabilities("my-agent"));
29
-
30
- expect(result.current).toEqual(caps);
31
- expect(mockUseAgent).toHaveBeenCalledWith({ agentId: "my-agent" });
32
- });
33
-
34
- it("returns undefined when agent has no capabilities property", () => {
35
- mockUseAgent.mockReturnValue({
36
- agent: { description: "basic agent" },
37
- });
38
-
39
- const { result } = renderHook(() => useCapabilities("basic"));
40
-
41
- expect(result.current).toBeUndefined();
42
- });
43
-
44
- it("returns undefined when agent is undefined (not connected yet)", () => {
45
- mockUseAgent.mockReturnValue({ agent: undefined });
46
-
47
- const { result } = renderHook(() => useCapabilities());
48
-
49
- expect(result.current).toBeUndefined();
50
- });
51
-
52
- it("returns undefined when capabilities property is explicitly undefined", () => {
53
- mockUseAgent.mockReturnValue({
54
- agent: { capabilities: undefined },
55
- });
56
-
57
- const { result } = renderHook(() => useCapabilities());
58
-
59
- expect(result.current).toBeUndefined();
60
- });
61
-
62
- it("uses default agent when no agentId is provided", () => {
63
- const caps: AgentCapabilities = {
64
- transport: { streaming: true },
65
- };
66
-
67
- mockUseAgent.mockReturnValue({
68
- agent: { capabilities: caps },
69
- });
70
-
71
- const { result } = renderHook(() => useCapabilities());
72
-
73
- expect(result.current).toEqual(caps);
74
- expect(mockUseAgent).toHaveBeenCalledWith({ agentId: undefined });
75
- });
76
- });
@@ -1,25 +0,0 @@
1
- import type { AgentCapabilities } from "@ag-ui/core";
2
- import { useAgent } from "./use-agent";
3
-
4
- /**
5
- * Returns the capabilities declared by the given agent (or the default agent).
6
- * Capabilities are populated from the runtime `/info` response at connection
7
- * time. The hook reads them synchronously from the agent instance — there is
8
- * no separate loading state, but the value will be `undefined` until the
9
- * runtime handshake completes.
10
- *
11
- * @param agentId - Optional agent ID. If omitted, uses the default agent.
12
- * @returns The agent's capabilities, or `undefined` if the agent doesn't
13
- * declare capabilities.
14
- */
15
- export function useCapabilities(
16
- agentId?: string,
17
- ): AgentCapabilities | undefined {
18
- const { agent } = useAgent({ agentId });
19
-
20
- if (agent && "capabilities" in agent) {
21
- return (agent as { capabilities?: AgentCapabilities }).capabilities;
22
- }
23
-
24
- return undefined;
25
- }