@copilotkit/runtime 1.8.14-next.1 → 1.8.14-next.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/CHANGELOG.md +7 -0
- package/dist/{chunk-JJBN24EK.mjs → chunk-5FDI6FH6.mjs} +2 -2
- package/dist/{chunk-KTTUYDBP.mjs → chunk-MZSUT6FW.mjs} +2 -2
- package/dist/{chunk-WUBMXNOG.mjs → chunk-RM7LK6G2.mjs} +2 -2
- package/dist/{chunk-F4NU7EVL.mjs → chunk-YLRGZOEQ.mjs} +9 -10
- package/dist/chunk-YLRGZOEQ.mjs.map +1 -0
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.js +8 -9
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/{agentwire-action.ts → agui-action.ts} +8 -8
- package/src/lib/runtime/copilot-runtime.ts +10 -2
- package/src/lib/runtime/remote-actions.ts +2 -2
- package/dist/chunk-F4NU7EVL.mjs.map +0 -1
- /package/dist/{chunk-JJBN24EK.mjs.map → chunk-5FDI6FH6.mjs.map} +0 -0
- /package/dist/{chunk-KTTUYDBP.mjs.map → chunk-MZSUT6FW.mjs.map} +0 -0
- /package/dist/{chunk-WUBMXNOG.mjs.map → chunk-RM7LK6G2.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.8.14-next.
|
|
12
|
+
"version": "1.8.14-next.2",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"rxjs": "^7.8.1",
|
|
65
65
|
"type-graphql": "2.0.0-rc.1",
|
|
66
66
|
"zod": "^3.23.3",
|
|
67
|
-
"@copilotkit/shared": "1.8.14-next.
|
|
67
|
+
"@copilotkit/shared": "1.8.14-next.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@ag-ui/client": ">=0.0.28",
|
|
@@ -7,15 +7,15 @@ import telemetry from "../telemetry-client";
|
|
|
7
7
|
import { RemoteAgentHandlerParams } from "./remote-actions";
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
AssistantMessage as
|
|
11
|
-
Message as
|
|
10
|
+
AssistantMessage as AGUIAssistantMessage,
|
|
11
|
+
Message as AGUIMessage,
|
|
12
12
|
ToolCall,
|
|
13
13
|
} from "@ag-ui/client";
|
|
14
14
|
|
|
15
15
|
import { AbstractAgent } from "@ag-ui/client";
|
|
16
16
|
import { parseJson } from "@copilotkit/shared";
|
|
17
17
|
|
|
18
|
-
export function
|
|
18
|
+
export function constructAGUIRemoteAction({
|
|
19
19
|
logger,
|
|
20
20
|
messages,
|
|
21
21
|
agentStates,
|
|
@@ -37,7 +37,7 @@ export function constructAgentWireRemoteAction({
|
|
|
37
37
|
}: RemoteAgentHandlerParams): Promise<Observable<RuntimeEvent>> => {
|
|
38
38
|
logger.debug({ actionName: agent.agentId }, "Executing remote agent");
|
|
39
39
|
|
|
40
|
-
const agentWireMessages =
|
|
40
|
+
const agentWireMessages = convertMessagesToAGUIMessage(messages);
|
|
41
41
|
agent.messages = agentWireMessages;
|
|
42
42
|
agent.threadId = threadId;
|
|
43
43
|
|
|
@@ -72,8 +72,8 @@ export function constructAgentWireRemoteAction({
|
|
|
72
72
|
return [action];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function
|
|
76
|
-
const result:
|
|
75
|
+
export function convertMessagesToAGUIMessage(messages: Message[]): AGUIMessage[] {
|
|
76
|
+
const result: AGUIMessage[] = [];
|
|
77
77
|
|
|
78
78
|
for (const message of messages) {
|
|
79
79
|
if (message.isTextMessage()) {
|
|
@@ -93,9 +93,9 @@ export function convertMessagesToAgentWire(messages: Message[]): AgentWireMessag
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
if (message.parentMessageId && result.some((m) => m.id === message.parentMessageId)) {
|
|
96
|
-
const parentMessage:
|
|
96
|
+
const parentMessage: AGUIAssistantMessage | undefined = result.find(
|
|
97
97
|
(m) => m.id === message.parentMessageId,
|
|
98
|
-
) as
|
|
98
|
+
) as AGUIAssistantMessage;
|
|
99
99
|
if (parentMessage.toolCalls === undefined) {
|
|
100
100
|
parentMessage.toolCalls = [];
|
|
101
101
|
}
|
|
@@ -193,7 +193,16 @@ export interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []
|
|
|
193
193
|
langserve?: RemoteChainParameters[];
|
|
194
194
|
|
|
195
195
|
/*
|
|
196
|
-
* A map of agent names to
|
|
196
|
+
* A map of agent names to AGUI agents.
|
|
197
|
+
* Example agent config:
|
|
198
|
+
* ```ts
|
|
199
|
+
* import { AbstractAgent } from "@ag-ui/client";
|
|
200
|
+
* // ...
|
|
201
|
+
* agents: {
|
|
202
|
+
* "support": new CustomerSupportAgent(),
|
|
203
|
+
* "technical": new TechnicalAgent()
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
197
206
|
*/
|
|
198
207
|
agents?: Record<string, AbstractAgent>;
|
|
199
208
|
|
|
@@ -416,7 +425,6 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
416
425
|
|
|
417
426
|
return newMessages;
|
|
418
427
|
}
|
|
419
|
-
// --- MCP Instruction Injection Method ---
|
|
420
428
|
|
|
421
429
|
async processRuntimeRequest(request: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse> {
|
|
422
430
|
const {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "@copilotkit/shared";
|
|
19
19
|
import { MetaEventInput } from "../../graphql/inputs/meta-event.input";
|
|
20
20
|
import { AbstractAgent } from "@ag-ui/client";
|
|
21
|
-
import {
|
|
21
|
+
import { constructAGUIRemoteAction } from "./agui-action";
|
|
22
22
|
|
|
23
23
|
export type EndpointDefinition = CopilotKitEndpoint | LangGraphPlatformEndpoint;
|
|
24
24
|
|
|
@@ -196,7 +196,7 @@ export async function setupRemoteActions({
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
result.push(
|
|
199
|
-
|
|
199
|
+
constructAGUIRemoteAction({
|
|
200
200
|
logger,
|
|
201
201
|
messages,
|
|
202
202
|
agentStates,
|