@copilotkit/runtime 1.50.1-next.2 → 1.50.1
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 +16 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/lib/runtime/copilot-runtime.ts +11 -11
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.50.1
|
|
12
|
+
"version": "1.50.1",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@ag-ui/client": "^0.0.42",
|
|
54
54
|
"@ag-ui/core": "^0.0.42",
|
|
55
55
|
"@ag-ui/langgraph": "^0.0.20",
|
|
56
|
-
"@copilotkitnext/agent": "0.0.
|
|
57
|
-
"@copilotkitnext/runtime": "0.0.
|
|
56
|
+
"@copilotkitnext/agent": "0.0.33",
|
|
57
|
+
"@copilotkitnext/runtime": "0.0.33",
|
|
58
58
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
59
59
|
"@hono/node-server": "^1.13.5",
|
|
60
60
|
"@scarf/scarf": "^1.3.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"rxjs": "7.8.1",
|
|
73
73
|
"type-graphql": "2.0.0-rc.1",
|
|
74
74
|
"zod": "^3.23.3",
|
|
75
|
-
"@copilotkit/shared": "1.50.1
|
|
75
|
+
"@copilotkit/shared": "1.50.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
type MCPTool,
|
|
57
57
|
extractParametersFromSchema,
|
|
58
58
|
} from "./mcp-tools-utils";
|
|
59
|
-
import {
|
|
59
|
+
import { BuiltInAgent, type BuiltInAgentConfiguration } from "@copilotkitnext/agent";
|
|
60
60
|
// Define the function type alias here or import if defined elsewhere
|
|
61
61
|
type CreateMCPClientFunction = (config: MCPEndpointConfig) => Promise<MCPClient>;
|
|
62
62
|
|
|
@@ -301,7 +301,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
301
301
|
params?: CopilotRuntimeConstructorParams<T>;
|
|
302
302
|
private observability?: CopilotObservabilityConfig;
|
|
303
303
|
// Cache MCP tools per endpoint to avoid re-fetching repeatedly
|
|
304
|
-
private mcpToolsCache: Map<string,
|
|
304
|
+
private mcpToolsCache: Map<string, BuiltInAgentConfiguration["tools"]> = new Map();
|
|
305
305
|
private runtimeArgs: CopilotRuntimeOptions;
|
|
306
306
|
private _instance: CopilotRuntimeVNext;
|
|
307
307
|
|
|
@@ -380,7 +380,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
if (isAgentsListEmpty) {
|
|
383
|
-
agentsList.default = new
|
|
383
|
+
agentsList.default = new BuiltInAgent({
|
|
384
384
|
model: `${serviceAdapter.provider}/${serviceAdapter.model}`,
|
|
385
385
|
});
|
|
386
386
|
}
|
|
@@ -402,7 +402,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
402
402
|
// Receive this.params.action and turn it into the AbstractAgent tools
|
|
403
403
|
private getToolsFromActions(
|
|
404
404
|
actions: ActionsConfiguration<any>,
|
|
405
|
-
):
|
|
405
|
+
): BuiltInAgentConfiguration["tools"] {
|
|
406
406
|
// Resolve actions to an array (handle function case)
|
|
407
407
|
const actionsArray =
|
|
408
408
|
typeof actions === "function" ? actions({ properties: {}, url: undefined }) : actions;
|
|
@@ -423,7 +423,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
423
423
|
|
|
424
424
|
private assignToolsToAgents(
|
|
425
425
|
agents: Record<string, AbstractAgent>,
|
|
426
|
-
tools:
|
|
426
|
+
tools: BuiltInAgentConfiguration["tools"],
|
|
427
427
|
): Record<string, AbstractAgent> {
|
|
428
428
|
if (!tools?.length) {
|
|
429
429
|
return agents;
|
|
@@ -432,10 +432,10 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
432
432
|
const enrichedAgents: Record<string, AbstractAgent> = { ...agents };
|
|
433
433
|
|
|
434
434
|
for (const [agentId, agent] of Object.entries(enrichedAgents)) {
|
|
435
|
-
const existingConfig = (Reflect.get(agent, "config") ?? {}) as
|
|
435
|
+
const existingConfig = (Reflect.get(agent, "config") ?? {}) as BuiltInAgentConfiguration;
|
|
436
436
|
const existingTools = existingConfig.tools ?? [];
|
|
437
437
|
|
|
438
|
-
const updatedConfig:
|
|
438
|
+
const updatedConfig: BuiltInAgentConfiguration = {
|
|
439
439
|
...existingConfig,
|
|
440
440
|
tools: [...existingTools, ...tools],
|
|
441
441
|
};
|
|
@@ -588,11 +588,11 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
// Resolve MCP tools to
|
|
591
|
+
// Resolve MCP tools to BuiltInAgent tool definitions
|
|
592
592
|
// Optionally accepts request-scoped properties to merge request-provided mcpServers
|
|
593
593
|
private async getToolsFromMCP(options?: {
|
|
594
594
|
properties?: Record<string, unknown>;
|
|
595
|
-
}): Promise<
|
|
595
|
+
}): Promise<BuiltInAgentConfiguration["tools"]> {
|
|
596
596
|
const runtimeMcpServers = (this.params?.mcpServers ?? []) as MCPEndpointConfig[];
|
|
597
597
|
const createMCPClient = this.params?.createMCPClient as CreateMCPClientFunction | undefined;
|
|
598
598
|
|
|
@@ -629,7 +629,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
629
629
|
return Array.from(byUrl.values());
|
|
630
630
|
})();
|
|
631
631
|
|
|
632
|
-
const allTools:
|
|
632
|
+
const allTools: BuiltInAgentConfiguration["tools"] = [];
|
|
633
633
|
|
|
634
634
|
for (const config of effectiveEndpoints) {
|
|
635
635
|
const endpointUrl = config.endpoint;
|
|
@@ -644,7 +644,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
|
644
644
|
const client = await createMCPClient(config);
|
|
645
645
|
const toolsMap = await client.tools();
|
|
646
646
|
|
|
647
|
-
const toolDefs:
|
|
647
|
+
const toolDefs: BuiltInAgentConfiguration["tools"] = Object.entries(toolsMap).map(
|
|
648
648
|
([toolName, tool]: [string, MCPTool]) => {
|
|
649
649
|
const params: Parameter[] = extractParametersFromSchema(tool);
|
|
650
650
|
const zodSchema = getZodParameters(params);
|