@copilotkitnext/core 0.0.2 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkitnext/core",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Core web utilities for CopilotKit2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@ag-ui/client": "0.0.36-alpha.1",
29
29
  "rxjs": "7.8.1",
30
30
  "zod": "^3.25.75",
31
- "@copilotkitnext/shared": "0.0.2"
31
+ "@copilotkitnext/shared": "0.0.4"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=18"
@@ -1,23 +0,0 @@
1
-
2
- 
3
- > @copilotkitnext/core@0.0.1 build /Users/mme/Code/vnext_experimental/packages/core
4
- > tsup
5
-
6
- CLI Building entry: src/index.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.0
9
- CLI Using tsup config: /Users/mme/Code/vnext_experimental/packages/core/tsup.config.ts
10
- CLI Target: es2022
11
- CLI Cleaning output folder
12
- CJS Build start
13
- ESM Build start
14
- CJS dist/index.js 16.30 KB
15
- CJS dist/index.js.map 30.55 KB
16
- CJS ⚡️ Build success in 11ms
17
- ESM dist/index.mjs 15.02 KB
18
- ESM dist/index.mjs.map 30.38 KB
19
- ESM ⚡️ Build success in 11ms
20
- DTS Build start
21
- DTS ⚡️ Build success in 1131ms
22
- DTS dist/index.d.ts 3.38 KB
23
- DTS dist/index.d.mts 3.38 KB
@@ -1,4 +0,0 @@
1
-
2
- > @copilotkit/core@0.0.0 check-types /Users/mme/Code/CopilotKit2/packages/core
3
- > tsc --noEmit
4
-
@@ -1,12 +0,0 @@
1
-
2
- > @copilotkit/core@0.0.0 lint /Users/mme/Code/CopilotKit2/packages/core
3
- > eslint . --max-warnings 0
4
-
5
-
6
- /Users/mme/Code/CopilotKit2/packages/core/src/core.ts
7
- 3:34 warning 'HttpAgent' is defined but never used @typescript-eslint/no-unused-vars
8
-
9
- ✖ 1 problem (0 errors, 1 warning)
10
-
11
- ESLint found too many warnings (maximum: 0).
12
-  ELIFECYCLE  Command failed with exit code 1.
@@ -1,96 +0,0 @@
1
-
2
- > @copilotkitnext/core@0.0.0 test /Users/mme/Code/CopilotKit2/packages/core
3
- > vitest run
4
-
5
-
6
- RUN v3.2.4 /Users/mme/Code/CopilotKit2/packages/core
7
-
8
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 4: should handle follow-up with recursion
9
- TEST 4: Starting follow-up test
10
- TEST 4: Call count: 1
11
-
12
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 4: should handle follow-up with recursion
13
- TEST 4: Call count: 2
14
-
15
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 4: should handle follow-up with recursion
16
- TEST 4: Success - calls: 2
17
-
18
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 5: should handle multiple tools with at least one follow-up
19
- TEST 5: Starting multiple tools test
20
- TEST 5: Call count: 1
21
-
22
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 5: should handle multiple tools with at least one follow-up
23
- TEST 5: Call count: 2
24
-
25
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 5: should handle multiple tools with at least one follow-up
26
- TEST 5: Success - calls: 2
27
-
28
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 6: should handle tool with undefined follow-up (defaults to true)
29
- TEST 6: Starting undefined follow-up test
30
- TEST 6: Call count: 1
31
-
32
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 6: should handle tool with undefined follow-up (defaults to true)
33
- TEST 6: Call count: 2
34
-
35
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 6: should handle tool with undefined follow-up (defaults to true)
36
- TEST 6: Success - calls: 2
37
-
38
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 7: should handle invalid JSON in tool arguments
39
- TEST 7: Starting invalid JSON test
40
-
41
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 7: should handle invalid JSON in tool arguments
42
- TEST 7: Success - caught error: SyntaxError: Expected property name or '}' in JSON at position 2
43
-
44
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 8: should handle empty string arguments
45
- TEST 8: Starting empty arguments test
46
-
47
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 8: should handle empty string arguments
48
- TEST 8: Success - caught error: SyntaxError: Unexpected end of JSON input
49
-
50
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 9: should handle chain of follow-ups
51
- TEST 9: Starting chain test
52
- TEST 9: Call count: 1
53
-
54
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 9: should handle chain of follow-ups
55
- TEST 9: Call count: 2
56
-
57
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 9: should handle chain of follow-ups
58
- TEST 9: Call count: 3
59
-
60
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 9: should handle chain of follow-ups
61
- TEST 9: Success - calls: 3
62
-
63
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 10: should handle concurrent tool calls
64
- TEST 10: Starting concurrent tools test
65
-
66
- ✓ src/__tests__/core-basic.test.ts (2 tests) 14ms
67
- ✓ src/__tests__/core-wildcard.test.ts (2 tests) 3ms
68
- ✓ src/__tests__/core-simple.test.ts (1 test) 2ms
69
- stdout | src/__tests__/core-tool-simple.test.ts > CopilotKitCore Tool Simple > should execute a simple tool
70
- Starting simple tool test
71
- About to run agent
72
-
73
- stdout | src/__tests__/core-tool-simple.test.ts > CopilotKitCore Tool Simple > should execute a simple tool
74
- Tool handler called
75
-
76
- ✓ src/__tests__/core-basic-functionality.test.ts (10 tests) 61ms
77
- ✓ src/__tests__/core-tool-minimal.test.ts (2 tests) 4ms
78
- stdout | src/__tests__/core-full.test.ts > CopilotKitCore.runAgent - Full Test Suite > Tests that might reveal problems > TEST 10: should handle concurrent tool calls
79
- TEST 10: Success - duration: 176ms
80
-
81
- stdout | src/__tests__/core-tool-simple.test.ts > CopilotKitCore Tool Simple > should execute a simple tool
82
- Agent run complete
83
-
84
- ✓ src/__tests__/core-follow-up.test.ts (7 tests) 16ms
85
- ✓ src/__tests__/core-full.test.ts (10 tests) 194ms
86
- ✓ src/__tests__/core-edge-cases.test.ts (7 tests) 23ms
87
- ✓ src/__tests__/core-tool-simple.test.ts (1 test) 79ms
88
- ✓ src/__tests__/simple.test.ts (1 test) 4ms
89
- ✓ src/__tests__/import.test.ts (1 test) 1ms
90
- ✓ src/__tests__/core-agent-constraints.test.ts (3 tests) 3ms
91
-
92
- Test Files 12 passed (12)
93
- Tests 47 passed (47)
94
- Start at 10:38:15
95
- Duration 2.27s (transform 488ms, setup 0ms, collect 5.43s, tests 404ms, environment 1ms, prepare 4.27s)
96
-
@@ -1,86 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { CopilotKitCore } from '../core';
3
- import { FrontendTool } from '../types';
4
- import { MockAgent, createAssistantMessage } from './test-utils';
5
-
6
- describe('CopilotKitCore - Agent Constraints', () => {
7
- it('should add tool with agentId', () => {
8
- const core = new CopilotKitCore({
9
- headers: {},
10
- properties: {},
11
- });
12
-
13
- const tool: FrontendTool = {
14
- name: 'testTool',
15
- handler: vi.fn(),
16
- agentId: 'agent1',
17
- };
18
-
19
- core.addTool(tool);
20
- expect(core.tools['testTool']).toBeDefined();
21
- expect(core.tools['testTool']?.agentId).toBe('agent1');
22
- });
23
-
24
- it('should add multiple tools with different agentIds', () => {
25
- const core = new CopilotKitCore({
26
- headers: {},
27
- properties: {},
28
- });
29
-
30
- const globalTool: FrontendTool = {
31
- name: 'globalTool',
32
- handler: vi.fn(),
33
- };
34
-
35
- const agent1Tool: FrontendTool = {
36
- name: 'agent1Tool',
37
- handler: vi.fn(),
38
- agentId: 'agent1',
39
- };
40
-
41
- const agent2Tool: FrontendTool = {
42
- name: 'agent2Tool',
43
- handler: vi.fn(),
44
- agentId: 'agent2',
45
- };
46
-
47
- core.addTool(globalTool);
48
- core.addTool(agent1Tool);
49
- core.addTool(agent2Tool);
50
-
51
- expect(core.tools['globalTool']).toBeDefined();
52
- expect(core.tools['globalTool']?.agentId).toBeUndefined();
53
-
54
- expect(core.tools['agent1Tool']).toBeDefined();
55
- expect(core.tools['agent1Tool']?.agentId).toBe('agent1');
56
-
57
- expect(core.tools['agent2Tool']).toBeDefined();
58
- expect(core.tools['agent2Tool']?.agentId).toBe('agent2');
59
- });
60
-
61
- it('should preserve all FrontendTool properties including agentId', () => {
62
- const core = new CopilotKitCore({
63
- headers: {},
64
- properties: {},
65
- });
66
-
67
- const handler = vi.fn(async () => 'result');
68
- const tool: FrontendTool = {
69
- name: 'fullTool',
70
- description: 'A complete tool',
71
- handler,
72
- followUp: false,
73
- agentId: 'specificAgent',
74
- };
75
-
76
- core.addTool(tool);
77
-
78
- const addedTool = core.tools['fullTool'];
79
- expect(addedTool).toBeDefined();
80
- expect(addedTool?.name).toBe('fullTool');
81
- expect(addedTool?.description).toBe('A complete tool');
82
- expect(addedTool?.handler).toBe(handler);
83
- expect(addedTool?.followUp).toBe(false);
84
- expect(addedTool?.agentId).toBe('specificAgent');
85
- });
86
- });
@@ -1,158 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi, afterEach } from "vitest";
2
- import { CopilotKitCore } from "../core";
3
- import {
4
- MockAgent,
5
- createMessage,
6
- createAssistantMessage,
7
- createToolCallMessage,
8
- createTool,
9
- } from "./test-utils";
10
-
11
- describe("CopilotKitCore.runAgent - Basic Functionality", () => {
12
- let copilotKitCore: CopilotKitCore;
13
-
14
- beforeEach(() => {
15
- copilotKitCore = new CopilotKitCore({});
16
- vi.clearAllMocks();
17
- });
18
-
19
- afterEach(() => {
20
- vi.restoreAllMocks();
21
- });
22
-
23
- it("should run agent without tools", async () => {
24
- const messages = [
25
- createMessage({ content: "Hello" }),
26
- createAssistantMessage({ content: "Hi there!" }),
27
- ];
28
- const agent = new MockAgent({ newMessages: messages });
29
-
30
- const result = await copilotKitCore.runAgent({ agent: agent as any });
31
-
32
- expect(result.newMessages).toEqual(messages);
33
- expect(agent.runAgentCalls).toHaveLength(1);
34
- expect(agent.runAgentCalls[0].forwardedProps).toEqual({});
35
- });
36
-
37
- it("should pass withMessages to agent.addMessages", async () => {
38
- const initialMessages = [createMessage({ content: "Initial" })];
39
- const newMessages = [createAssistantMessage({ content: "Response" })];
40
- const agent = new MockAgent({ newMessages });
41
-
42
- await copilotKitCore.runAgent({ agent: agent as any, withMessages: initialMessages });
43
-
44
- expect(agent.addMessages).toHaveBeenCalledWith(initialMessages);
45
- expect(agent.messages).toContain(initialMessages[0]);
46
- });
47
-
48
- it("should work without withMessages parameter", async () => {
49
- const newMessages = [createAssistantMessage({ content: "Response" })];
50
- const agent = new MockAgent({ newMessages });
51
-
52
- const result = await copilotKitCore.runAgent({ agent: agent as any });
53
-
54
- expect(result.newMessages).toEqual(newMessages);
55
- expect(agent.addMessages).not.toHaveBeenCalled();
56
- });
57
-
58
- it("should forward properties to agent.runAgent", async () => {
59
- const properties = { apiKey: "test-key", model: "gpt-4" };
60
- copilotKitCore = new CopilotKitCore({ properties });
61
- const agent = new MockAgent({ newMessages: [] });
62
-
63
- await copilotKitCore.runAgent({ agent: agent as any });
64
-
65
- expect(agent.runAgentCalls[0].forwardedProps).toEqual(properties);
66
- });
67
-
68
- it("should handle empty newMessages array", async () => {
69
- const agent = new MockAgent({ newMessages: [] });
70
-
71
- const result = await copilotKitCore.runAgent({ agent: agent as any });
72
-
73
- expect(result.newMessages).toEqual([]);
74
- expect(agent.runAgentCalls).toHaveLength(1);
75
- });
76
-
77
- it("should ignore non-assistant messages for tool processing", async () => {
78
- const messages = [
79
- createMessage({ role: "user", content: "User message" }),
80
- createMessage({ role: "system", content: "System message" }),
81
- createMessage({ role: "tool", content: "Tool result", toolCallId: "123" }),
82
- ];
83
- const agent = new MockAgent({ newMessages: messages });
84
-
85
- const result = await copilotKitCore.runAgent({ agent: agent as any });
86
-
87
- expect(result.newMessages).toEqual(messages);
88
- expect(agent.runAgentCalls).toHaveLength(1);
89
- });
90
-
91
- it("should handle messages with undefined toolCalls", async () => {
92
- const message = createAssistantMessage({
93
- content: "Response",
94
- toolCalls: undefined
95
- });
96
- const agent = new MockAgent({ newMessages: [message] });
97
-
98
- const result = await copilotKitCore.runAgent({ agent: agent as any });
99
-
100
- expect(result.newMessages).toEqual([message]);
101
- expect(agent.runAgentCalls).toHaveLength(1);
102
- });
103
-
104
- it("should handle tool returning undefined as empty string", async () => {
105
- const toolName = "undefinedTool";
106
- const tool = createTool({
107
- name: toolName,
108
- handler: vi.fn(async () => undefined),
109
- });
110
- copilotKitCore.addTool(tool);
111
-
112
- const message = createToolCallMessage(toolName);
113
- const agent = new MockAgent({ newMessages: [message] });
114
-
115
- await copilotKitCore.runAgent({ agent: agent as any });
116
-
117
- expect(agent.messages).toContainEqual(
118
- expect.objectContaining({
119
- role: "tool",
120
- content: "", // Should be empty string, not "undefined"
121
- })
122
- );
123
- });
124
-
125
- it("should handle tool returning null as empty string", async () => {
126
- const toolName = "nullTool";
127
- const tool = createTool({
128
- name: toolName,
129
- handler: vi.fn(async () => null),
130
- });
131
- copilotKitCore.addTool(tool);
132
-
133
- const message = createToolCallMessage(toolName);
134
- const agent = new MockAgent({ newMessages: [message] });
135
-
136
- await copilotKitCore.runAgent({ agent: agent as any });
137
-
138
- expect(agent.messages).toContainEqual(
139
- expect.objectContaining({
140
- role: "tool",
141
- content: "", // Should be empty string, not "null"
142
- })
143
- );
144
- });
145
-
146
- it("should return correct result structure", async () => {
147
- const newMessages = [
148
- createAssistantMessage({ content: "Test" })
149
- ];
150
- const agent = new MockAgent({ newMessages });
151
-
152
- const result = await copilotKitCore.runAgent({ agent: agent as any });
153
-
154
- expect(result).toHaveProperty("newMessages");
155
- expect(Array.isArray(result.newMessages)).toBe(true);
156
- expect(result.newMessages).toEqual(newMessages);
157
- });
158
- });
@@ -1,27 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi } from "vitest";
2
- import { CopilotKitCore } from "../core";
3
-
4
- describe("CopilotKitCore Basic", () => {
5
- let copilotKitCore: CopilotKitCore;
6
-
7
- beforeEach(() => {
8
- copilotKitCore = new CopilotKitCore({});
9
- });
10
-
11
- it("should create an instance", () => {
12
- expect(copilotKitCore).toBeDefined();
13
- expect(copilotKitCore.agents).toEqual({});
14
- expect(copilotKitCore.tools).toEqual({});
15
- });
16
-
17
- it("should add a tool", () => {
18
- const tool = {
19
- name: "testTool",
20
- handler: vi.fn(),
21
- };
22
-
23
- copilotKitCore.addTool(tool);
24
-
25
- expect(copilotKitCore.tools["testTool"]).toBe(tool);
26
- });
27
- });
@@ -1,166 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi, afterEach } from "vitest";
2
- import { CopilotKitCore } from "../core";
3
- import {
4
- MockAgent,
5
- createAssistantMessage,
6
- createToolCallMessage,
7
- createToolResultMessage,
8
- createTool,
9
- } from "./test-utils";
10
-
11
- describe("CopilotKitCore.runAgent - Edge Cases", () => {
12
- let copilotKitCore: CopilotKitCore;
13
-
14
- beforeEach(() => {
15
- copilotKitCore = new CopilotKitCore({});
16
- vi.clearAllMocks();
17
- });
18
-
19
- afterEach(() => {
20
- vi.restoreAllMocks();
21
- });
22
-
23
- it("should skip tool call when result already exists in newMessages", async () => {
24
- const tool = createTool({
25
- name: "alreadyProcessedTool",
26
- handler: vi.fn(async () => "Should not be called"),
27
- });
28
- copilotKitCore.addTool(tool);
29
-
30
- const toolCallId = "processed-call";
31
- const assistantMsg = createToolCallMessage("alreadyProcessedTool");
32
- if (assistantMsg.role === 'assistant' && assistantMsg.toolCalls && assistantMsg.toolCalls[0]) {
33
- assistantMsg.toolCalls[0].id = toolCallId;
34
- }
35
- const existingResult = createToolResultMessage(toolCallId, "Already processed");
36
-
37
- const agent = new MockAgent({
38
- newMessages: [assistantMsg, existingResult],
39
- });
40
-
41
- await copilotKitCore.runAgent({ agent: agent as any });
42
-
43
- expect(tool.handler).not.toHaveBeenCalled();
44
- });
45
-
46
- it("should handle empty tool function name", async () => {
47
- const message = createAssistantMessage({
48
- content: "",
49
- toolCalls: [{
50
- id: "empty-name-call",
51
- type: "function",
52
- function: {
53
- name: "",
54
- arguments: "{}",
55
- },
56
- }],
57
- });
58
-
59
- const agent = new MockAgent({ newMessages: [message] });
60
-
61
- await copilotKitCore.runAgent({ agent: agent as any });
62
-
63
- expect(agent.messages.filter(m => m.role === "tool")).toHaveLength(0);
64
- });
65
-
66
- it("should handle tool arguments as empty string", async () => {
67
- const tool = createTool({
68
- name: "emptyArgsTool",
69
- handler: vi.fn(async (args) => `Received: ${JSON.stringify(args)}`),
70
- });
71
- copilotKitCore.addTool(tool);
72
-
73
- const message = createAssistantMessage({
74
- content: "",
75
- toolCalls: [{
76
- id: "empty-args-call",
77
- type: "function",
78
- function: {
79
- name: "emptyArgsTool",
80
- arguments: "",
81
- },
82
- }],
83
- });
84
-
85
- const agent = new MockAgent({ newMessages: [message] });
86
-
87
- await expect(copilotKitCore.runAgent({ agent: agent as any })).rejects.toThrow();
88
- });
89
-
90
- it("should handle very large tool result", async () => {
91
- const largeResult = "x".repeat(100000); // 100KB string
92
- const tool = createTool({
93
- name: "largeTool",
94
- handler: vi.fn(async () => largeResult),
95
- followUp: false,
96
- });
97
- copilotKitCore.addTool(tool);
98
-
99
- const message = createToolCallMessage("largeTool");
100
- const agent = new MockAgent({ newMessages: [message] });
101
-
102
- await copilotKitCore.runAgent({ agent: agent as any });
103
-
104
- const toolMessage = agent.messages.find(m => m.role === "tool");
105
- expect(toolMessage?.content).toBe(largeResult);
106
- });
107
-
108
- it("should handle tool handler modifying agent state", async () => {
109
- const tool = createTool({
110
- name: "stateTool",
111
- handler: vi.fn(async () => {
112
- // Try to modify agent messages during execution
113
- agent.messages.push(createAssistantMessage({ content: "Injected" }));
114
- return "Result";
115
- }),
116
- followUp: false,
117
- });
118
- copilotKitCore.addTool(tool);
119
-
120
- const message = createToolCallMessage("stateTool");
121
- const agent = new MockAgent({ newMessages: [message] });
122
-
123
- await copilotKitCore.runAgent({ agent: agent as any });
124
-
125
- // The injected message should be present
126
- expect(agent.messages.some(m => m.content === "Injected")).toBe(true);
127
- // Tool result should still be added correctly
128
- expect(agent.messages.some(m => m.role === "tool" && m.content === "Result")).toBe(true);
129
- });
130
-
131
- it("should propagate errors from agent.runAgent", async () => {
132
- const errorMessage = "Agent execution failed";
133
- const agent = new MockAgent({
134
- error: new Error(errorMessage)
135
- });
136
-
137
- await expect(copilotKitCore.runAgent({ agent: agent as any }))
138
- .rejects
139
- .toThrow(errorMessage);
140
- });
141
-
142
- it("should handle tool with invalid JSON arguments", async () => {
143
- const toolName = "invalidJsonTool";
144
- const tool = createTool({
145
- name: toolName,
146
- handler: vi.fn(async () => "Should not be called"),
147
- });
148
- copilotKitCore.addTool(tool);
149
-
150
- const message = createAssistantMessage({
151
- content: "",
152
- toolCalls: [{
153
- id: "tool-call-1",
154
- type: "function",
155
- function: {
156
- name: toolName,
157
- arguments: "{ invalid json",
158
- },
159
- }],
160
- });
161
- const agent = new MockAgent({ newMessages: [message] });
162
-
163
- await expect(copilotKitCore.runAgent({ agent: agent as any })).rejects.toThrow();
164
- expect(tool.handler).not.toHaveBeenCalled();
165
- });
166
- });