@copilotkit/agentcore-runner 1.57.2
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/LICENSE +21 -0
- package/dist/agentcore-runner.cjs +62 -0
- package/dist/agentcore-runner.cjs.map +1 -0
- package/dist/agentcore-runner.d.cts +35 -0
- package/dist/agentcore-runner.d.cts.map +1 -0
- package/dist/agentcore-runner.d.mts +35 -0
- package/dist/agentcore-runner.d.mts.map +1 -0
- package/dist/agentcore-runner.mjs +62 -0
- package/dist/agentcore-runner.mjs.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -0
- package/package.json +44 -0
- package/src/__tests__/agentcore-runner.e2e.test.ts +239 -0
- package/src/__tests__/agentcore-runner.test.ts +24 -0
- package/src/agentcore-runner.ts +67 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +13 -0
- package/tsdown.config.ts +12 -0
- package/vitest.config.mjs +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Atai Barkai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
let node_crypto = require("node:crypto");
|
|
2
|
+
let _ag_ui_client = require("@ag-ui/client");
|
|
3
|
+
let _copilotkit_runtime_v2 = require("@copilotkit/runtime/v2");
|
|
4
|
+
let rxjs = require("rxjs");
|
|
5
|
+
|
|
6
|
+
//#region src/agentcore-runner.ts
|
|
7
|
+
/**
|
|
8
|
+
* AgentCore stores conversation history server-side via AgentCoreMemorySaver /
|
|
9
|
+
* AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing
|
|
10
|
+
* thread (e.g. page refresh), two issues arise that this runner fixes:
|
|
11
|
+
*
|
|
12
|
+
* 1. Unknown threads — CopilotKit may call `connect()` for a thread that has
|
|
13
|
+
* never had a `run()` (first load). The base runner would error; we emit an
|
|
14
|
+
* empty snapshot instead so the UI initialises cleanly.
|
|
15
|
+
* 2. Missing tool-call results — AgentCore's replayed history contains assistant
|
|
16
|
+
* messages with tool calls but no corresponding TOOL_CALL_RESULT events.
|
|
17
|
+
* CopilotKit needs those to reconcile its message state, so we synthesise
|
|
18
|
+
* empty results for each past tool call before the snapshot.
|
|
19
|
+
*/
|
|
20
|
+
var AgentCoreRunner = class extends _copilotkit_runtime_v2.InMemoryAgentRunner {
|
|
21
|
+
knownThreadIds = /* @__PURE__ */ new Set();
|
|
22
|
+
run(request) {
|
|
23
|
+
if (request.threadId) this.knownThreadIds.add(request.threadId);
|
|
24
|
+
return super.run(request);
|
|
25
|
+
}
|
|
26
|
+
connect(request) {
|
|
27
|
+
if (!request.threadId || !this.knownThreadIds.has(request.threadId)) {
|
|
28
|
+
const threadId = request.threadId ?? (0, node_crypto.randomUUID)();
|
|
29
|
+
const runId = (0, node_crypto.randomUUID)();
|
|
30
|
+
return (0, rxjs.of)({
|
|
31
|
+
type: _ag_ui_client.EventType.RUN_STARTED,
|
|
32
|
+
threadId,
|
|
33
|
+
runId
|
|
34
|
+
}, {
|
|
35
|
+
type: _ag_ui_client.EventType.MESSAGES_SNAPSHOT,
|
|
36
|
+
messages: []
|
|
37
|
+
}, {
|
|
38
|
+
type: _ag_ui_client.EventType.RUN_FINISHED,
|
|
39
|
+
threadId,
|
|
40
|
+
runId
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return super.connect(request).pipe((0, rxjs.concatMap)((event) => {
|
|
44
|
+
if (event.type !== _ag_ui_client.EventType.MESSAGES_SNAPSHOT) return (0, rxjs.of)(event);
|
|
45
|
+
const snapshot = event;
|
|
46
|
+
return (0, rxjs.of)(...snapshot.messages.flatMap((message) => {
|
|
47
|
+
if (message.role !== "assistant" || !message.toolCalls?.length) return [];
|
|
48
|
+
return message.toolCalls.map((toolCall) => ({
|
|
49
|
+
type: _ag_ui_client.EventType.TOOL_CALL_RESULT,
|
|
50
|
+
toolCallId: toolCall.id,
|
|
51
|
+
messageId: `${toolCall.id}-result`,
|
|
52
|
+
content: "",
|
|
53
|
+
role: "tool"
|
|
54
|
+
}));
|
|
55
|
+
}), snapshot);
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.AgentCoreRunner = AgentCoreRunner;
|
|
62
|
+
//# sourceMappingURL=agentcore-runner.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentcore-runner.cjs","names":["InMemoryAgentRunner","EventType"],"sources":["../src/agentcore-runner.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n EventType,\n type BaseEvent,\n type Message,\n type MessagesSnapshotEvent,\n type ToolCall,\n type ToolCallResultEvent,\n} from \"@ag-ui/client\";\nimport { InMemoryAgentRunner } from \"@copilotkit/runtime/v2\";\nimport { concatMap, Observable, of } from \"rxjs\";\n\n/**\n * AgentCore stores conversation history server-side via AgentCoreMemorySaver /\n * AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing\n * thread (e.g. page refresh), two issues arise that this runner fixes:\n *\n * 1. Unknown threads — CopilotKit may call `connect()` for a thread that has\n * never had a `run()` (first load). The base runner would error; we emit an\n * empty snapshot instead so the UI initialises cleanly.\n * 2. Missing tool-call results — AgentCore's replayed history contains assistant\n * messages with tool calls but no corresponding TOOL_CALL_RESULT events.\n * CopilotKit needs those to reconcile its message state, so we synthesise\n * empty results for each past tool call before the snapshot.\n */\nexport class AgentCoreRunner extends InMemoryAgentRunner {\n private readonly knownThreadIds = new Set<string>();\n\n override run(request: Parameters<InMemoryAgentRunner[\"run\"]>[0]) {\n if (request.threadId) this.knownThreadIds.add(request.threadId);\n return super.run(request);\n }\n\n override connect(request: Parameters<InMemoryAgentRunner[\"connect\"]>[0]) {\n if (!request.threadId || !this.knownThreadIds.has(request.threadId)) {\n const threadId = request.threadId ?? randomUUID();\n const runId = randomUUID();\n return of(\n { type: EventType.RUN_STARTED, threadId, runId },\n { type: EventType.MESSAGES_SNAPSHOT, messages: [] },\n { type: EventType.RUN_FINISHED, threadId, runId },\n ) as Observable<BaseEvent>;\n }\n\n return super.connect(request).pipe(\n concatMap((event: BaseEvent) => {\n if (event.type !== EventType.MESSAGES_SNAPSHOT) return of(event);\n const snapshot = event as MessagesSnapshotEvent;\n const replayedResults: ToolCallResultEvent[] =\n snapshot.messages.flatMap((message: Message) => {\n if (message.role !== \"assistant\" || !message.toolCalls?.length)\n return [];\n return message.toolCalls.map<ToolCallResultEvent>(\n (toolCall: ToolCall) => ({\n type: EventType.TOOL_CALL_RESULT,\n toolCallId: toolCall.id,\n messageId: `${toolCall.id}-result`,\n content: \"\",\n role: \"tool\",\n }),\n );\n });\n return of(...replayedResults, snapshot) as Observable<BaseEvent>;\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,IAAa,kBAAb,cAAqCA,2CAAoB;CACvD,AAAiB,iCAAiB,IAAI,KAAa;CAEnD,AAAS,IAAI,SAAoD;AAC/D,MAAI,QAAQ,SAAU,MAAK,eAAe,IAAI,QAAQ,SAAS;AAC/D,SAAO,MAAM,IAAI,QAAQ;;CAG3B,AAAS,QAAQ,SAAwD;AACvE,MAAI,CAAC,QAAQ,YAAY,CAAC,KAAK,eAAe,IAAI,QAAQ,SAAS,EAAE;GACnE,MAAM,WAAW,QAAQ,yCAAwB;GACjD,MAAM,qCAAoB;AAC1B,uBACE;IAAE,MAAMC,wBAAU;IAAa;IAAU;IAAO,EAChD;IAAE,MAAMA,wBAAU;IAAmB,UAAU,EAAE;IAAE,EACnD;IAAE,MAAMA,wBAAU;IAAc;IAAU;IAAO,CAClD;;AAGH,SAAO,MAAM,QAAQ,QAAQ,CAAC,0BACjB,UAAqB;AAC9B,OAAI,MAAM,SAASA,wBAAU,kBAAmB,qBAAU,MAAM;GAChE,MAAM,WAAW;AAejB,uBAAU,GAbR,SAAS,SAAS,SAAS,YAAqB;AAC9C,QAAI,QAAQ,SAAS,eAAe,CAAC,QAAQ,WAAW,OACtD,QAAO,EAAE;AACX,WAAO,QAAQ,UAAU,KACtB,cAAwB;KACvB,MAAMA,wBAAU;KAChB,YAAY,SAAS;KACrB,WAAW,GAAG,SAAS,GAAG;KAC1B,SAAS;KACT,MAAM;KACP,EACF;KACD,EAC0B,SAAS;IACvC,CACH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as zod from "zod";
|
|
2
|
+
import { EventType } from "@ag-ui/client";
|
|
3
|
+
import { InMemoryAgentRunner } from "@copilotkit/runtime/v2";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
|
|
6
|
+
//#region src/agentcore-runner.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* AgentCore stores conversation history server-side via AgentCoreMemorySaver /
|
|
9
|
+
* AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing
|
|
10
|
+
* thread (e.g. page refresh), two issues arise that this runner fixes:
|
|
11
|
+
*
|
|
12
|
+
* 1. Unknown threads — CopilotKit may call `connect()` for a thread that has
|
|
13
|
+
* never had a `run()` (first load). The base runner would error; we emit an
|
|
14
|
+
* empty snapshot instead so the UI initialises cleanly.
|
|
15
|
+
* 2. Missing tool-call results — AgentCore's replayed history contains assistant
|
|
16
|
+
* messages with tool calls but no corresponding TOOL_CALL_RESULT events.
|
|
17
|
+
* CopilotKit needs those to reconcile its message state, so we synthesise
|
|
18
|
+
* empty results for each past tool call before the snapshot.
|
|
19
|
+
*/
|
|
20
|
+
declare class AgentCoreRunner extends InMemoryAgentRunner {
|
|
21
|
+
private readonly knownThreadIds;
|
|
22
|
+
run(request: Parameters<InMemoryAgentRunner["run"]>[0]): Observable<zod.objectOutputType<{
|
|
23
|
+
type: zod.ZodNativeEnum<typeof EventType>;
|
|
24
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
25
|
+
rawEvent: zod.ZodOptional<zod.ZodAny>;
|
|
26
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
27
|
+
connect(request: Parameters<InMemoryAgentRunner["connect"]>[0]): Observable<zod.objectOutputType<{
|
|
28
|
+
type: zod.ZodNativeEnum<typeof EventType>;
|
|
29
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
30
|
+
rawEvent: zod.ZodOptional<zod.ZodAny>;
|
|
31
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { AgentCoreRunner };
|
|
35
|
+
//# sourceMappingURL=agentcore-runner.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentcore-runner.d.cts","names":[],"sources":["../src/agentcore-runner.ts"],"mappings":";;;;;;;;;AAyBA;;;;;;;;;;cAAa,eAAA,SAAwB,mBAAA;EAAA,iBAClB,cAAA;EAER,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,mBAAA,cAA8B,UAAA,KAAA,gBAAA;;;;;EAKtD,OAAA,CAAQ,OAAA,EAAS,UAAA,CAAW,mBAAA,kBAAkC,UAAA,KAAA,gBAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EventType } from "@ag-ui/client";
|
|
2
|
+
import { InMemoryAgentRunner } from "@copilotkit/runtime/v2";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import * as zod from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/agentcore-runner.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* AgentCore stores conversation history server-side via AgentCoreMemorySaver /
|
|
9
|
+
* AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing
|
|
10
|
+
* thread (e.g. page refresh), two issues arise that this runner fixes:
|
|
11
|
+
*
|
|
12
|
+
* 1. Unknown threads — CopilotKit may call `connect()` for a thread that has
|
|
13
|
+
* never had a `run()` (first load). The base runner would error; we emit an
|
|
14
|
+
* empty snapshot instead so the UI initialises cleanly.
|
|
15
|
+
* 2. Missing tool-call results — AgentCore's replayed history contains assistant
|
|
16
|
+
* messages with tool calls but no corresponding TOOL_CALL_RESULT events.
|
|
17
|
+
* CopilotKit needs those to reconcile its message state, so we synthesise
|
|
18
|
+
* empty results for each past tool call before the snapshot.
|
|
19
|
+
*/
|
|
20
|
+
declare class AgentCoreRunner extends InMemoryAgentRunner {
|
|
21
|
+
private readonly knownThreadIds;
|
|
22
|
+
run(request: Parameters<InMemoryAgentRunner["run"]>[0]): Observable<zod.objectOutputType<{
|
|
23
|
+
type: zod.ZodNativeEnum<typeof EventType>;
|
|
24
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
25
|
+
rawEvent: zod.ZodOptional<zod.ZodAny>;
|
|
26
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
27
|
+
connect(request: Parameters<InMemoryAgentRunner["connect"]>[0]): Observable<zod.objectOutputType<{
|
|
28
|
+
type: zod.ZodNativeEnum<typeof EventType>;
|
|
29
|
+
timestamp: zod.ZodOptional<zod.ZodNumber>;
|
|
30
|
+
rawEvent: zod.ZodOptional<zod.ZodAny>;
|
|
31
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { AgentCoreRunner };
|
|
35
|
+
//# sourceMappingURL=agentcore-runner.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentcore-runner.d.mts","names":[],"sources":["../src/agentcore-runner.ts"],"mappings":";;;;;;;;;AAyBA;;;;;;;;;;cAAa,eAAA,SAAwB,mBAAA;EAAA,iBAClB,cAAA;EAER,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,mBAAA,cAA8B,UAAA,KAAA,gBAAA;;;;;EAKtD,OAAA,CAAQ,OAAA,EAAS,UAAA,CAAW,mBAAA,kBAAkC,UAAA,KAAA,gBAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { EventType } from "@ag-ui/client";
|
|
3
|
+
import { InMemoryAgentRunner } from "@copilotkit/runtime/v2";
|
|
4
|
+
import { concatMap, of } from "rxjs";
|
|
5
|
+
|
|
6
|
+
//#region src/agentcore-runner.ts
|
|
7
|
+
/**
|
|
8
|
+
* AgentCore stores conversation history server-side via AgentCoreMemorySaver /
|
|
9
|
+
* AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing
|
|
10
|
+
* thread (e.g. page refresh), two issues arise that this runner fixes:
|
|
11
|
+
*
|
|
12
|
+
* 1. Unknown threads — CopilotKit may call `connect()` for a thread that has
|
|
13
|
+
* never had a `run()` (first load). The base runner would error; we emit an
|
|
14
|
+
* empty snapshot instead so the UI initialises cleanly.
|
|
15
|
+
* 2. Missing tool-call results — AgentCore's replayed history contains assistant
|
|
16
|
+
* messages with tool calls but no corresponding TOOL_CALL_RESULT events.
|
|
17
|
+
* CopilotKit needs those to reconcile its message state, so we synthesise
|
|
18
|
+
* empty results for each past tool call before the snapshot.
|
|
19
|
+
*/
|
|
20
|
+
var AgentCoreRunner = class extends InMemoryAgentRunner {
|
|
21
|
+
knownThreadIds = /* @__PURE__ */ new Set();
|
|
22
|
+
run(request) {
|
|
23
|
+
if (request.threadId) this.knownThreadIds.add(request.threadId);
|
|
24
|
+
return super.run(request);
|
|
25
|
+
}
|
|
26
|
+
connect(request) {
|
|
27
|
+
if (!request.threadId || !this.knownThreadIds.has(request.threadId)) {
|
|
28
|
+
const threadId = request.threadId ?? randomUUID();
|
|
29
|
+
const runId = randomUUID();
|
|
30
|
+
return of({
|
|
31
|
+
type: EventType.RUN_STARTED,
|
|
32
|
+
threadId,
|
|
33
|
+
runId
|
|
34
|
+
}, {
|
|
35
|
+
type: EventType.MESSAGES_SNAPSHOT,
|
|
36
|
+
messages: []
|
|
37
|
+
}, {
|
|
38
|
+
type: EventType.RUN_FINISHED,
|
|
39
|
+
threadId,
|
|
40
|
+
runId
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return super.connect(request).pipe(concatMap((event) => {
|
|
44
|
+
if (event.type !== EventType.MESSAGES_SNAPSHOT) return of(event);
|
|
45
|
+
const snapshot = event;
|
|
46
|
+
return of(...snapshot.messages.flatMap((message) => {
|
|
47
|
+
if (message.role !== "assistant" || !message.toolCalls?.length) return [];
|
|
48
|
+
return message.toolCalls.map((toolCall) => ({
|
|
49
|
+
type: EventType.TOOL_CALL_RESULT,
|
|
50
|
+
toolCallId: toolCall.id,
|
|
51
|
+
messageId: `${toolCall.id}-result`,
|
|
52
|
+
content: "",
|
|
53
|
+
role: "tool"
|
|
54
|
+
}));
|
|
55
|
+
}), snapshot);
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { AgentCoreRunner };
|
|
62
|
+
//# sourceMappingURL=agentcore-runner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentcore-runner.mjs","names":[],"sources":["../src/agentcore-runner.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n EventType,\n type BaseEvent,\n type Message,\n type MessagesSnapshotEvent,\n type ToolCall,\n type ToolCallResultEvent,\n} from \"@ag-ui/client\";\nimport { InMemoryAgentRunner } from \"@copilotkit/runtime/v2\";\nimport { concatMap, Observable, of } from \"rxjs\";\n\n/**\n * AgentCore stores conversation history server-side via AgentCoreMemorySaver /\n * AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing\n * thread (e.g. page refresh), two issues arise that this runner fixes:\n *\n * 1. Unknown threads — CopilotKit may call `connect()` for a thread that has\n * never had a `run()` (first load). The base runner would error; we emit an\n * empty snapshot instead so the UI initialises cleanly.\n * 2. Missing tool-call results — AgentCore's replayed history contains assistant\n * messages with tool calls but no corresponding TOOL_CALL_RESULT events.\n * CopilotKit needs those to reconcile its message state, so we synthesise\n * empty results for each past tool call before the snapshot.\n */\nexport class AgentCoreRunner extends InMemoryAgentRunner {\n private readonly knownThreadIds = new Set<string>();\n\n override run(request: Parameters<InMemoryAgentRunner[\"run\"]>[0]) {\n if (request.threadId) this.knownThreadIds.add(request.threadId);\n return super.run(request);\n }\n\n override connect(request: Parameters<InMemoryAgentRunner[\"connect\"]>[0]) {\n if (!request.threadId || !this.knownThreadIds.has(request.threadId)) {\n const threadId = request.threadId ?? randomUUID();\n const runId = randomUUID();\n return of(\n { type: EventType.RUN_STARTED, threadId, runId },\n { type: EventType.MESSAGES_SNAPSHOT, messages: [] },\n { type: EventType.RUN_FINISHED, threadId, runId },\n ) as Observable<BaseEvent>;\n }\n\n return super.connect(request).pipe(\n concatMap((event: BaseEvent) => {\n if (event.type !== EventType.MESSAGES_SNAPSHOT) return of(event);\n const snapshot = event as MessagesSnapshotEvent;\n const replayedResults: ToolCallResultEvent[] =\n snapshot.messages.flatMap((message: Message) => {\n if (message.role !== \"assistant\" || !message.toolCalls?.length)\n return [];\n return message.toolCalls.map<ToolCallResultEvent>(\n (toolCall: ToolCall) => ({\n type: EventType.TOOL_CALL_RESULT,\n toolCallId: toolCall.id,\n messageId: `${toolCall.id}-result`,\n content: \"\",\n role: \"tool\",\n }),\n );\n });\n return of(...replayedResults, snapshot) as Observable<BaseEvent>;\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,IAAa,kBAAb,cAAqC,oBAAoB;CACvD,AAAiB,iCAAiB,IAAI,KAAa;CAEnD,AAAS,IAAI,SAAoD;AAC/D,MAAI,QAAQ,SAAU,MAAK,eAAe,IAAI,QAAQ,SAAS;AAC/D,SAAO,MAAM,IAAI,QAAQ;;CAG3B,AAAS,QAAQ,SAAwD;AACvE,MAAI,CAAC,QAAQ,YAAY,CAAC,KAAK,eAAe,IAAI,QAAQ,SAAS,EAAE;GACnE,MAAM,WAAW,QAAQ,YAAY,YAAY;GACjD,MAAM,QAAQ,YAAY;AAC1B,UAAO,GACL;IAAE,MAAM,UAAU;IAAa;IAAU;IAAO,EAChD;IAAE,MAAM,UAAU;IAAmB,UAAU,EAAE;IAAE,EACnD;IAAE,MAAM,UAAU;IAAc;IAAU;IAAO,CAClD;;AAGH,SAAO,MAAM,QAAQ,QAAQ,CAAC,KAC5B,WAAW,UAAqB;AAC9B,OAAI,MAAM,SAAS,UAAU,kBAAmB,QAAO,GAAG,MAAM;GAChE,MAAM,WAAW;AAejB,UAAO,GAAG,GAbR,SAAS,SAAS,SAAS,YAAqB;AAC9C,QAAI,QAAQ,SAAS,eAAe,CAAC,QAAQ,WAAW,OACtD,QAAO,EAAE;AACX,WAAO,QAAQ,UAAU,KACtB,cAAwB;KACvB,MAAM,UAAU;KAChB,YAAY,SAAS;KACrB,WAAW,GAAG,SAAS,GAAG;KAC1B,SAAS;KACT,MAAM;KACP,EACF;KACD,EAC0B,SAAS;IACvC,CACH"}
|
package/dist/index.cjs
ADDED
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@copilotkit/agentcore-runner",
|
|
3
|
+
"version": "1.57.2",
|
|
4
|
+
"description": "AWS Bedrock AgentCore-compatible agent runner for CopilotKit2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.cts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ag-ui/client": "0.0.53",
|
|
21
|
+
"rxjs": "7.8.1",
|
|
22
|
+
"@copilotkit/runtime": "1.57.2"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.15.3",
|
|
26
|
+
"tsdown": "^0.20.3",
|
|
27
|
+
"typescript": "5.8.2",
|
|
28
|
+
"vitest": "^3.0.5",
|
|
29
|
+
"@copilotkit/typescript-config": "1.55.0-next.8"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsdown",
|
|
36
|
+
"dev": "tsdown --watch",
|
|
37
|
+
"check-types": "tsc --noEmit",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"test:watch": "vitest",
|
|
40
|
+
"test:coverage": "vitest run --coverage",
|
|
41
|
+
"publint": "publint .",
|
|
42
|
+
"attw": "attw --pack . --profile node16"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end integration tests for AgentCoreRunner.
|
|
3
|
+
*
|
|
4
|
+
* These tests wire a ScriptedAgent (mimicking the AG-UI event stream that
|
|
5
|
+
* AgentCore produces — including the pathological cases the runner exists
|
|
6
|
+
* to paper over) through the real InMemoryAgentRunner machinery, then assert
|
|
7
|
+
* the runner's run()/connect() outputs downstream.
|
|
8
|
+
*
|
|
9
|
+
* If these pass, the published package behaves correctly when consumed by
|
|
10
|
+
* a real CopilotRuntime + HttpAgent stack pointed at AWS AgentCore, without
|
|
11
|
+
* requiring AWS, Docker, or a browser.
|
|
12
|
+
*/
|
|
13
|
+
import { describe, it, expect } from "vitest";
|
|
14
|
+
import { EMPTY, firstValueFrom } from "rxjs";
|
|
15
|
+
import { toArray } from "rxjs/operators";
|
|
16
|
+
import {
|
|
17
|
+
AbstractAgent,
|
|
18
|
+
EventType,
|
|
19
|
+
type BaseEvent,
|
|
20
|
+
type Message,
|
|
21
|
+
type MessagesSnapshotEvent,
|
|
22
|
+
type RunAgentInput,
|
|
23
|
+
type RunFinishedEvent,
|
|
24
|
+
type RunStartedEvent,
|
|
25
|
+
type ToolCallResultEvent,
|
|
26
|
+
} from "@ag-ui/client";
|
|
27
|
+
import type {
|
|
28
|
+
AgentRunnerConnectRequest,
|
|
29
|
+
AgentRunnerRunRequest,
|
|
30
|
+
} from "@copilotkit/runtime/v2";
|
|
31
|
+
import { AgentCoreRunner } from "..";
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Fixtures
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
interface ScriptedAgentCallbacks {
|
|
38
|
+
onEvent: (args: { event: BaseEvent }) => void | Promise<void>;
|
|
39
|
+
onRunStartedEvent?: () => void | Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class ScriptedAgent extends AbstractAgent {
|
|
43
|
+
constructor(private readonly script: BaseEvent[] = []) {
|
|
44
|
+
super();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async runAgent(
|
|
48
|
+
input: RunAgentInput,
|
|
49
|
+
callbacks: ScriptedAgentCallbacks,
|
|
50
|
+
): Promise<void> {
|
|
51
|
+
const runStarted: RunStartedEvent = {
|
|
52
|
+
type: EventType.RUN_STARTED,
|
|
53
|
+
threadId: input.threadId,
|
|
54
|
+
runId: input.runId,
|
|
55
|
+
};
|
|
56
|
+
await callbacks.onEvent({ event: runStarted });
|
|
57
|
+
await callbacks.onRunStartedEvent?.();
|
|
58
|
+
for (const event of this.script) await callbacks.onEvent({ event });
|
|
59
|
+
const hasRunFinished = this.script.some(
|
|
60
|
+
(e) => e.type === EventType.RUN_FINISHED,
|
|
61
|
+
);
|
|
62
|
+
if (!hasRunFinished) {
|
|
63
|
+
const runFinished: RunFinishedEvent = {
|
|
64
|
+
type: EventType.RUN_FINISHED,
|
|
65
|
+
threadId: input.threadId,
|
|
66
|
+
runId: input.runId,
|
|
67
|
+
};
|
|
68
|
+
await callbacks.onEvent({ event: runFinished });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
clone(): AbstractAgent {
|
|
73
|
+
return new ScriptedAgent([...this.script]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected run(): ReturnType<AbstractAgent["run"]> {
|
|
77
|
+
return EMPTY;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
protected connect(): ReturnType<AbstractAgent["connect"]> {
|
|
81
|
+
return EMPTY;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function makeRunInput(
|
|
86
|
+
threadId: string,
|
|
87
|
+
runId: string,
|
|
88
|
+
messages: Message[] = [],
|
|
89
|
+
): RunAgentInput {
|
|
90
|
+
return {
|
|
91
|
+
threadId,
|
|
92
|
+
runId,
|
|
93
|
+
parentRunId: undefined,
|
|
94
|
+
state: {},
|
|
95
|
+
messages,
|
|
96
|
+
tools: [],
|
|
97
|
+
context: [],
|
|
98
|
+
forwardedProps: undefined,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function collect(
|
|
103
|
+
obs: ReturnType<AgentCoreRunner["run"] | AgentCoreRunner["connect"]>,
|
|
104
|
+
): Promise<BaseEvent[]> {
|
|
105
|
+
return firstValueFrom(obs.pipe(toArray()));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Tests
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
describe("AgentCoreRunner e2e", () => {
|
|
113
|
+
it("emits empty snapshot when connect() is called before any run()", async () => {
|
|
114
|
+
const runner = new AgentCoreRunner();
|
|
115
|
+
const request: AgentRunnerConnectRequest = { threadId: "fresh-thread" };
|
|
116
|
+
|
|
117
|
+
const events = await collect(runner.connect(request));
|
|
118
|
+
|
|
119
|
+
expect(events.map((e) => e.type)).toEqual([
|
|
120
|
+
EventType.RUN_STARTED,
|
|
121
|
+
EventType.MESSAGES_SNAPSHOT,
|
|
122
|
+
EventType.RUN_FINISHED,
|
|
123
|
+
]);
|
|
124
|
+
expect((events[1] as MessagesSnapshotEvent).messages).toEqual([]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("passes text-only run events through unchanged", async () => {
|
|
128
|
+
const runner = new AgentCoreRunner();
|
|
129
|
+
const threadId = "thread-text";
|
|
130
|
+
const runRequest: AgentRunnerRunRequest = {
|
|
131
|
+
threadId,
|
|
132
|
+
agent: new ScriptedAgent([
|
|
133
|
+
{
|
|
134
|
+
type: EventType.TEXT_MESSAGE_START,
|
|
135
|
+
messageId: "m-1",
|
|
136
|
+
role: "assistant",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: EventType.TEXT_MESSAGE_CONTENT,
|
|
140
|
+
messageId: "m-1",
|
|
141
|
+
delta: "hello",
|
|
142
|
+
},
|
|
143
|
+
{ type: EventType.TEXT_MESSAGE_END, messageId: "m-1" },
|
|
144
|
+
] as BaseEvent[]),
|
|
145
|
+
input: makeRunInput(threadId, "run-0", [
|
|
146
|
+
{ id: "u-1", role: "user", content: "hi" } as Message,
|
|
147
|
+
]),
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const runEvents = await collect(runner.run(runRequest));
|
|
151
|
+
|
|
152
|
+
const textContent = runEvents.find(
|
|
153
|
+
(e) => e.type === EventType.TEXT_MESSAGE_CONTENT,
|
|
154
|
+
);
|
|
155
|
+
expect(textContent).toBeDefined();
|
|
156
|
+
expect(runEvents.at(-1)?.type).toBe(EventType.RUN_FINISHED);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("synthesises TOOL_CALL_RESULT events before replayed MESSAGES_SNAPSHOT on reconnect", async () => {
|
|
160
|
+
const runner = new AgentCoreRunner();
|
|
161
|
+
const threadId = "thread-replay";
|
|
162
|
+
|
|
163
|
+
// Simulate AgentCore's memory replay: during run(), the remote emits a
|
|
164
|
+
// MESSAGES_SNAPSHOT that contains assistant messages with toolCalls,
|
|
165
|
+
// but *no* corresponding TOOL_CALL_RESULT events. This is the exact
|
|
166
|
+
// shape the runner is designed to compensate for.
|
|
167
|
+
const replayedSnapshot: MessagesSnapshotEvent = {
|
|
168
|
+
type: EventType.MESSAGES_SNAPSHOT,
|
|
169
|
+
messages: [
|
|
170
|
+
{ id: "u-1", role: "user", content: "what is the weather?" },
|
|
171
|
+
{
|
|
172
|
+
id: "a-1",
|
|
173
|
+
role: "assistant",
|
|
174
|
+
content: "",
|
|
175
|
+
toolCalls: [
|
|
176
|
+
{
|
|
177
|
+
id: "tc-1",
|
|
178
|
+
type: "function",
|
|
179
|
+
function: { name: "getWeather", arguments: "{}" },
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
] as Message[],
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
await collect(
|
|
187
|
+
runner.run({
|
|
188
|
+
threadId,
|
|
189
|
+
agent: new ScriptedAgent([replayedSnapshot as BaseEvent]),
|
|
190
|
+
input: makeRunInput(threadId, "run-0"),
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const connectEvents = await collect(runner.connect({ threadId }));
|
|
195
|
+
|
|
196
|
+
const snapshotIndex = connectEvents.findIndex(
|
|
197
|
+
(e) => e.type === EventType.MESSAGES_SNAPSHOT,
|
|
198
|
+
);
|
|
199
|
+
expect(snapshotIndex).toBeGreaterThan(-1);
|
|
200
|
+
|
|
201
|
+
const toolResults = connectEvents.filter(
|
|
202
|
+
(e): e is ToolCallResultEvent => e.type === EventType.TOOL_CALL_RESULT,
|
|
203
|
+
);
|
|
204
|
+
expect(toolResults).toHaveLength(1);
|
|
205
|
+
expect(toolResults[0].toolCallId).toBe("tc-1");
|
|
206
|
+
|
|
207
|
+
const toolResultIndex = connectEvents.findIndex(
|
|
208
|
+
(e) => e.type === EventType.TOOL_CALL_RESULT,
|
|
209
|
+
);
|
|
210
|
+
expect(toolResultIndex).toBeLessThan(snapshotIndex);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("does not synthesise TOOL_CALL_RESULT events for assistant messages without tool calls", async () => {
|
|
214
|
+
const runner = new AgentCoreRunner();
|
|
215
|
+
const threadId = "thread-no-tools";
|
|
216
|
+
|
|
217
|
+
const replayedSnapshot: MessagesSnapshotEvent = {
|
|
218
|
+
type: EventType.MESSAGES_SNAPSHOT,
|
|
219
|
+
messages: [
|
|
220
|
+
{ id: "u-1", role: "user", content: "hi" },
|
|
221
|
+
{ id: "a-1", role: "assistant", content: "hello!" },
|
|
222
|
+
] as Message[],
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
await collect(
|
|
226
|
+
runner.run({
|
|
227
|
+
threadId,
|
|
228
|
+
agent: new ScriptedAgent([replayedSnapshot as BaseEvent]),
|
|
229
|
+
input: makeRunInput(threadId, "run-0"),
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
const connectEvents = await collect(runner.connect({ threadId }));
|
|
234
|
+
const toolResults = connectEvents.filter(
|
|
235
|
+
(e) => e.type === EventType.TOOL_CALL_RESULT,
|
|
236
|
+
);
|
|
237
|
+
expect(toolResults).toEqual([]);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { firstValueFrom } from "rxjs";
|
|
3
|
+
import { toArray } from "rxjs/operators";
|
|
4
|
+
import { EventType, type MessagesSnapshotEvent } from "@ag-ui/client";
|
|
5
|
+
import type { AgentRunnerConnectRequest } from "@copilotkit/runtime/v2";
|
|
6
|
+
import { AgentCoreRunner } from "..";
|
|
7
|
+
|
|
8
|
+
describe("AgentCoreRunner.connect()", () => {
|
|
9
|
+
it("emits empty snapshot for unknown thread", async () => {
|
|
10
|
+
const runner = new AgentCoreRunner();
|
|
11
|
+
const request: AgentRunnerConnectRequest = { threadId: "unknown-thread" };
|
|
12
|
+
const events = await firstValueFrom(
|
|
13
|
+
runner.connect(request).pipe(toArray()),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(events.map((e) => e.type)).toEqual([
|
|
17
|
+
EventType.RUN_STARTED,
|
|
18
|
+
EventType.MESSAGES_SNAPSHOT,
|
|
19
|
+
EventType.RUN_FINISHED,
|
|
20
|
+
]);
|
|
21
|
+
const snapshot = events[1] as MessagesSnapshotEvent;
|
|
22
|
+
expect(snapshot.messages).toEqual([]);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import {
|
|
3
|
+
EventType,
|
|
4
|
+
type BaseEvent,
|
|
5
|
+
type Message,
|
|
6
|
+
type MessagesSnapshotEvent,
|
|
7
|
+
type ToolCall,
|
|
8
|
+
type ToolCallResultEvent,
|
|
9
|
+
} from "@ag-ui/client";
|
|
10
|
+
import { InMemoryAgentRunner } from "@copilotkit/runtime/v2";
|
|
11
|
+
import { concatMap, Observable, of } from "rxjs";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* AgentCore stores conversation history server-side via AgentCoreMemorySaver /
|
|
15
|
+
* AgentCoreMemorySessionManager. When CopilotKit reconnects to an existing
|
|
16
|
+
* thread (e.g. page refresh), two issues arise that this runner fixes:
|
|
17
|
+
*
|
|
18
|
+
* 1. Unknown threads — CopilotKit may call `connect()` for a thread that has
|
|
19
|
+
* never had a `run()` (first load). The base runner would error; we emit an
|
|
20
|
+
* empty snapshot instead so the UI initialises cleanly.
|
|
21
|
+
* 2. Missing tool-call results — AgentCore's replayed history contains assistant
|
|
22
|
+
* messages with tool calls but no corresponding TOOL_CALL_RESULT events.
|
|
23
|
+
* CopilotKit needs those to reconcile its message state, so we synthesise
|
|
24
|
+
* empty results for each past tool call before the snapshot.
|
|
25
|
+
*/
|
|
26
|
+
export class AgentCoreRunner extends InMemoryAgentRunner {
|
|
27
|
+
private readonly knownThreadIds = new Set<string>();
|
|
28
|
+
|
|
29
|
+
override run(request: Parameters<InMemoryAgentRunner["run"]>[0]) {
|
|
30
|
+
if (request.threadId) this.knownThreadIds.add(request.threadId);
|
|
31
|
+
return super.run(request);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override connect(request: Parameters<InMemoryAgentRunner["connect"]>[0]) {
|
|
35
|
+
if (!request.threadId || !this.knownThreadIds.has(request.threadId)) {
|
|
36
|
+
const threadId = request.threadId ?? randomUUID();
|
|
37
|
+
const runId = randomUUID();
|
|
38
|
+
return of(
|
|
39
|
+
{ type: EventType.RUN_STARTED, threadId, runId },
|
|
40
|
+
{ type: EventType.MESSAGES_SNAPSHOT, messages: [] },
|
|
41
|
+
{ type: EventType.RUN_FINISHED, threadId, runId },
|
|
42
|
+
) as Observable<BaseEvent>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return super.connect(request).pipe(
|
|
46
|
+
concatMap((event: BaseEvent) => {
|
|
47
|
+
if (event.type !== EventType.MESSAGES_SNAPSHOT) return of(event);
|
|
48
|
+
const snapshot = event as MessagesSnapshotEvent;
|
|
49
|
+
const replayedResults: ToolCallResultEvent[] =
|
|
50
|
+
snapshot.messages.flatMap((message: Message) => {
|
|
51
|
+
if (message.role !== "assistant" || !message.toolCalls?.length)
|
|
52
|
+
return [];
|
|
53
|
+
return message.toolCalls.map<ToolCallResultEvent>(
|
|
54
|
+
(toolCall: ToolCall) => ({
|
|
55
|
+
type: EventType.TOOL_CALL_RESULT,
|
|
56
|
+
toolCallId: toolCall.id,
|
|
57
|
+
messageId: `${toolCall.id}-result`,
|
|
58
|
+
content: "",
|
|
59
|
+
role: "tool",
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
return of(...replayedResults, snapshot) as Observable<BaseEvent>;
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./agentcore-runner";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@copilotkit/typescript-config/base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"types": ["vitest/globals"]
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*"],
|
|
12
|
+
"exclude": ["dist", "node_modules", "src/**/__tests__/**", "src/**/*.test.ts"]
|
|
13
|
+
}
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
env: {
|
|
6
|
+
COPILOTKIT_TELEMETRY_DISABLED: "true",
|
|
7
|
+
},
|
|
8
|
+
environment: "node",
|
|
9
|
+
globals: true,
|
|
10
|
+
include: ["src/**/__tests__/**/*.{test,spec}.ts"],
|
|
11
|
+
exclude: ["**/node_modules/**"],
|
|
12
|
+
reporters: [["default", { summary: false }]],
|
|
13
|
+
silent: true,
|
|
14
|
+
coverage: {
|
|
15
|
+
reporter: ["text", "lcov", "html"],
|
|
16
|
+
include: ["src/**/*.ts"],
|
|
17
|
+
exclude: ["src/**/*.d.ts", "src/**/index.ts"],
|
|
18
|
+
},
|
|
19
|
+
setupFiles: [],
|
|
20
|
+
},
|
|
21
|
+
});
|