@copilotkit/runtime 1.8.5-next.4 → 1.8.5-next.5
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 +41 -0
- package/dist/{chunk-WQZQTGHT.mjs → chunk-AIQJ5N22.mjs} +2 -2
- package/dist/{chunk-GGXHVDCG.mjs → chunk-FP7EJSMU.mjs} +2 -2
- package/dist/{chunk-574FKWP5.mjs → chunk-GQEDXH53.mjs} +2 -2
- package/dist/{chunk-PKO7BUPS.mjs → chunk-Q4KJZACA.mjs} +124 -4
- package/dist/chunk-Q4KJZACA.mjs.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +166 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +159 -39
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +3 -2
- package/dist/lib/integrations/index.js +15 -10
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +2 -1
- package/dist/lib/integrations/nest/index.js +15 -10
- 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.d.ts +2 -1
- package/dist/lib/integrations/node-express/index.js +15 -10
- 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.d.ts +2 -1
- package/dist/lib/integrations/node-http/index.js +15 -10
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{shared-86ec42e7.d.ts → shared-93687488.d.ts} +3 -0
- package/package.json +6 -2
- package/src/lib/runtime/agentwire-action.ts +123 -0
- package/src/lib/runtime/copilot-runtime.ts +9 -1
- package/src/lib/runtime/remote-action-constructors.ts +2 -7
- package/src/lib/runtime/remote-actions.ts +25 -1
- package/dist/chunk-PKO7BUPS.mjs.map +0 -1
- /package/dist/{chunk-WQZQTGHT.mjs.map → chunk-AIQJ5N22.mjs.map} +0 -0
- /package/dist/{chunk-GGXHVDCG.mjs.map → chunk-FP7EJSMU.mjs.map} +0 -0
- /package/dist/{chunk-574FKWP5.mjs.map → chunk-GQEDXH53.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
+
## 1.8.5-next.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c0d3261: - full AWP support
|
|
8
|
+
|
|
9
|
+
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
10
|
+
|
|
11
|
+
- refactor: address linter issues with the new pages
|
|
12
|
+
|
|
13
|
+
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
14
|
+
|
|
15
|
+
- Merge branch 'mme/acp' into mme/mastra
|
|
16
|
+
- add sse example
|
|
17
|
+
- Create small-turkeys-agree.md
|
|
18
|
+
- upgrade AWP
|
|
19
|
+
- Merge branch 'mme/mastra' of github.com:CopilotKit/CopilotKit into mme/mastra
|
|
20
|
+
- make agents a dict
|
|
21
|
+
- update docs
|
|
22
|
+
- send tools
|
|
23
|
+
- update to latest packages
|
|
24
|
+
- fix problem where state sync are preventing tool calls
|
|
25
|
+
- set possibly undefined toolCalls to an empty array
|
|
26
|
+
- fix missing tool call ids
|
|
27
|
+
|
|
28
|
+
- c0d3261: - add AWP support
|
|
29
|
+
|
|
30
|
+
- make it work
|
|
31
|
+
- update docs
|
|
32
|
+
- refactor: move UI files to be normal NextJS pages and update generation
|
|
33
|
+
|
|
34
|
+
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
35
|
+
|
|
36
|
+
- refactor: address linter issues with the new pages
|
|
37
|
+
|
|
38
|
+
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
|
|
39
|
+
|
|
40
|
+
- Merge branch 'mme/acp' into mme/mastra
|
|
41
|
+
- add sse example
|
|
42
|
+
- @copilotkit/shared@1.8.5-next.5
|
|
43
|
+
|
|
3
44
|
## 1.8.5-next.4
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q4KJZACA.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNestEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-AIQJ5N22.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q4KJZACA.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
config,
|
|
78
78
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-FP7EJSMU.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q4KJZACA.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNodeExpressEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-GQEDXH53.mjs.map
|
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
publishConfig: {
|
|
40
40
|
access: "public"
|
|
41
41
|
},
|
|
42
|
-
version: "1.8.5-next.
|
|
42
|
+
version: "1.8.5-next.5",
|
|
43
43
|
sideEffects: false,
|
|
44
44
|
main: "./dist/index.js",
|
|
45
45
|
module: "./dist/index.mjs",
|
|
@@ -76,6 +76,10 @@ var require_package = __commonJS({
|
|
|
76
76
|
"zod-to-json-schema": "^3.23.5"
|
|
77
77
|
},
|
|
78
78
|
dependencies: {
|
|
79
|
+
"@agentwire/client": "0.0.26",
|
|
80
|
+
"@agentwire/proto": "0.0.26",
|
|
81
|
+
"@agentwire/core": "0.0.26",
|
|
82
|
+
"@agentwire/encoder": "0.0.26",
|
|
79
83
|
"@anthropic-ai/sdk": "^0.27.3",
|
|
80
84
|
"@copilotkit/shared": "workspace:*",
|
|
81
85
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
@@ -1410,6 +1414,9 @@ import { of, concat, scan as scan2, concatMap, ReplaySubject as ReplaySubject2,
|
|
|
1410
1414
|
// src/lib/telemetry-client.ts
|
|
1411
1415
|
import { TelemetryClient } from "@copilotkit/shared";
|
|
1412
1416
|
|
|
1417
|
+
// src/lib/runtime/remote-actions.ts
|
|
1418
|
+
import { CopilotKitErrorCode } from "@copilotkit/shared";
|
|
1419
|
+
|
|
1413
1420
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1414
1421
|
import { createHash as createHash2 } from "crypto";
|
|
1415
1422
|
|
|
@@ -2579,6 +2586,100 @@ __name(createHeaders, "createHeaders");
|
|
|
2579
2586
|
|
|
2580
2587
|
// src/lib/runtime/remote-actions.ts
|
|
2581
2588
|
import { CopilotKitLowLevelError as CopilotKitLowLevelError2, ResolvedCopilotKitError as ResolvedCopilotKitError2, CopilotKitError as CopilotKitError2 } from "@copilotkit/shared";
|
|
2589
|
+
|
|
2590
|
+
// src/lib/runtime/agentwire-action.ts
|
|
2591
|
+
import { parseJson as parseJson3 } from "@copilotkit/shared";
|
|
2592
|
+
function constructAgentWireRemoteAction({ logger: logger2, messages, agentStates, agent }) {
|
|
2593
|
+
const action = {
|
|
2594
|
+
name: agent.agentId,
|
|
2595
|
+
description: agent.description,
|
|
2596
|
+
parameters: [],
|
|
2597
|
+
handler: async (_args) => {
|
|
2598
|
+
},
|
|
2599
|
+
remoteAgentHandler: async ({ actionInputsWithoutAgents, threadId }) => {
|
|
2600
|
+
logger2.debug({
|
|
2601
|
+
actionName: agent.agentId
|
|
2602
|
+
}, "Executing remote agent");
|
|
2603
|
+
const agentWireMessages = convertMessagesToAgentWire(messages);
|
|
2604
|
+
agent.messages = agentWireMessages;
|
|
2605
|
+
agent.threadId = threadId;
|
|
2606
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {
|
|
2607
|
+
agentExecution: true,
|
|
2608
|
+
type: "self-hosted",
|
|
2609
|
+
agentsAmount: 1
|
|
2610
|
+
});
|
|
2611
|
+
let state = {};
|
|
2612
|
+
if (agentStates) {
|
|
2613
|
+
const jsonState = agentStates.find((state2) => state2.agentName === agent.agentId);
|
|
2614
|
+
if (jsonState) {
|
|
2615
|
+
state = parseJson3(jsonState.state, {});
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
agent.state = state;
|
|
2619
|
+
const tools = actionInputsWithoutAgents.map((input) => {
|
|
2620
|
+
return {
|
|
2621
|
+
name: input.name,
|
|
2622
|
+
description: input.description,
|
|
2623
|
+
parameters: JSON.parse(input.jsonSchema)
|
|
2624
|
+
};
|
|
2625
|
+
});
|
|
2626
|
+
return agent.legacy_to_be_removed_runAgentBridged({
|
|
2627
|
+
tools
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
};
|
|
2631
|
+
return [
|
|
2632
|
+
action
|
|
2633
|
+
];
|
|
2634
|
+
}
|
|
2635
|
+
__name(constructAgentWireRemoteAction, "constructAgentWireRemoteAction");
|
|
2636
|
+
function convertMessagesToAgentWire(messages) {
|
|
2637
|
+
const result = [];
|
|
2638
|
+
for (const message of messages) {
|
|
2639
|
+
if (message.isTextMessage()) {
|
|
2640
|
+
result.push({
|
|
2641
|
+
id: message.id,
|
|
2642
|
+
role: message.role,
|
|
2643
|
+
content: message.content
|
|
2644
|
+
});
|
|
2645
|
+
} else if (message.isActionExecutionMessage()) {
|
|
2646
|
+
const toolCall = {
|
|
2647
|
+
id: message.id,
|
|
2648
|
+
type: "function",
|
|
2649
|
+
function: {
|
|
2650
|
+
name: message.name,
|
|
2651
|
+
arguments: JSON.stringify(message.arguments)
|
|
2652
|
+
}
|
|
2653
|
+
};
|
|
2654
|
+
if (message.parentMessageId && result.some((m) => m.id === message.parentMessageId)) {
|
|
2655
|
+
const parentMessage = result.find((m) => m.id === message.parentMessageId);
|
|
2656
|
+
if (parentMessage.toolCalls === void 0) {
|
|
2657
|
+
parentMessage.toolCalls = [];
|
|
2658
|
+
}
|
|
2659
|
+
parentMessage.toolCalls.push(toolCall);
|
|
2660
|
+
} else {
|
|
2661
|
+
result.push({
|
|
2662
|
+
id: message.parentMessageId ?? message.id,
|
|
2663
|
+
role: "assistant",
|
|
2664
|
+
toolCalls: [
|
|
2665
|
+
toolCall
|
|
2666
|
+
]
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
} else if (message.isResultMessage()) {
|
|
2670
|
+
result.push({
|
|
2671
|
+
id: message.id,
|
|
2672
|
+
role: "tool",
|
|
2673
|
+
content: message.result,
|
|
2674
|
+
toolCallId: message.actionExecutionId
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
return result;
|
|
2679
|
+
}
|
|
2680
|
+
__name(convertMessagesToAgentWire, "convertMessagesToAgentWire");
|
|
2681
|
+
|
|
2682
|
+
// src/lib/runtime/remote-actions.ts
|
|
2582
2683
|
var EndpointType;
|
|
2583
2684
|
(function(EndpointType2) {
|
|
2584
2685
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
@@ -2634,7 +2735,7 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2634
2735
|
}
|
|
2635
2736
|
}
|
|
2636
2737
|
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
2637
|
-
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
|
|
2738
|
+
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl, agents }) {
|
|
2638
2739
|
const logger2 = graphqlContext.logger.child({
|
|
2639
2740
|
component: "remote-actions.fetchRemoteActions"
|
|
2640
2741
|
});
|
|
@@ -2683,6 +2784,22 @@ async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, m
|
|
|
2683
2784
|
agentStates
|
|
2684
2785
|
});
|
|
2685
2786
|
}));
|
|
2787
|
+
for (const [key, agent] of Object.entries(agents)) {
|
|
2788
|
+
if (agent.agentId !== void 0 && agent.agentId !== key) {
|
|
2789
|
+
throw new CopilotKitError2({
|
|
2790
|
+
message: `Agent ${key} has agentId ${agent.agentId} which does not match the key ${key}`,
|
|
2791
|
+
code: CopilotKitErrorCode.UNKNOWN
|
|
2792
|
+
});
|
|
2793
|
+
} else if (agent.agentId === void 0) {
|
|
2794
|
+
agent.agentId = key;
|
|
2795
|
+
}
|
|
2796
|
+
result.push(constructAgentWireRemoteAction({
|
|
2797
|
+
logger: logger2,
|
|
2798
|
+
messages,
|
|
2799
|
+
agentStates,
|
|
2800
|
+
agent
|
|
2801
|
+
}));
|
|
2802
|
+
}
|
|
2686
2803
|
return result.flat();
|
|
2687
2804
|
}
|
|
2688
2805
|
__name(setupRemoteActions, "setupRemoteActions");
|
|
@@ -2804,6 +2921,7 @@ __name(convertMCPToolsToActions, "convertMCPToolsToActions");
|
|
|
2804
2921
|
// src/lib/runtime/copilot-runtime.ts
|
|
2805
2922
|
var CopilotRuntime = class {
|
|
2806
2923
|
actions;
|
|
2924
|
+
agents;
|
|
2807
2925
|
remoteEndpointDefinitions;
|
|
2808
2926
|
langserve = [];
|
|
2809
2927
|
onBeforeRequest;
|
|
@@ -2834,6 +2952,7 @@ var CopilotRuntime = class {
|
|
|
2834
2952
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
2835
2953
|
this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
|
|
2836
2954
|
this.observability = params == null ? void 0 : params.observability_c;
|
|
2955
|
+
this.agents = (params == null ? void 0 : params.agents) ?? {};
|
|
2837
2956
|
this.mcpEndpointsConfig = params == null ? void 0 : params.mcpEndpoints;
|
|
2838
2957
|
this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
|
|
2839
2958
|
if (this.mcpEndpointsConfig && this.mcpEndpointsConfig.length > 0 && !this.createMCPClientImpl) {
|
|
@@ -3455,7 +3574,8 @@ please use an LLM adapter instead.`
|
|
|
3455
3574
|
graphqlContext,
|
|
3456
3575
|
messages: inputMessages,
|
|
3457
3576
|
agentStates,
|
|
3458
|
-
frontendUrl: url
|
|
3577
|
+
frontendUrl: url,
|
|
3578
|
+
agents: this.agents
|
|
3459
3579
|
});
|
|
3460
3580
|
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
3461
3581
|
properties: graphqlContext.properties,
|
|
@@ -4774,4 +4894,4 @@ export {
|
|
|
4774
4894
|
getCommonConfig,
|
|
4775
4895
|
copilotRuntimeNodeHttpEndpoint
|
|
4776
4896
|
};
|
|
4777
|
-
//# sourceMappingURL=chunk-
|
|
4897
|
+
//# sourceMappingURL=chunk-Q4KJZACA.mjs.map
|