@copilotkit/runtime 1.8.9 → 1.8.10-next.0
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 +8 -0
- package/__snapshots__/schema/schema.graphql +1 -1
- package/dist/{chunk-4KLOSPKW.mjs → chunk-2ICQTCH3.mjs} +34 -17
- package/dist/chunk-2ICQTCH3.mjs.map +1 -0
- package/dist/{chunk-W7BXDLO4.mjs → chunk-F2DLMRBK.mjs} +2 -2
- package/dist/{chunk-JXLF6SJU.mjs → chunk-MSBLW6TU.mjs} +2 -2
- package/dist/{chunk-75TKODO4.mjs → chunk-PRF2YJTA.mjs} +2 -2
- package/dist/{groq-adapter-53d3fa48.d.ts → groq-adapter-4848f8e8.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +33 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{langserve-c9a20fe9.d.ts → langserve-4a5c9217.d.ts} +1 -1
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +33 -16
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +3 -3
- 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 -2
- package/dist/lib/integrations/nest/index.js +3 -3
- 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 -2
- package/dist/lib/integrations/node-express/index.js +3 -3
- 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 -2
- package/dist/lib/integrations/node-http/index.js +3 -3
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.d.ts +3 -3
- package/dist/{shared-df478d34.d.ts → shared-a7b30781.d.ts} +1 -1
- package/package.json +2 -2
- package/src/graphql/inputs/agent-state.input.ts +1 -1
- package/src/lib/runtime/remote-action-constructors.ts +6 -6
- package/src/lib/runtime/remote-lg-action.ts +39 -7
- package/dist/chunk-4KLOSPKW.mjs.map +0 -1
- /package/dist/{chunk-W7BXDLO4.mjs.map → chunk-F2DLMRBK.mjs.map} +0 -0
- /package/dist/{chunk-JXLF6SJU.mjs.map → chunk-MSBLW6TU.mjs.map} +0 -0
- /package/dist/{chunk-75TKODO4.mjs.map → chunk-PRF2YJTA.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-
|
|
2
|
-
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-
|
|
3
|
-
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-
|
|
1
|
+
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-4a5c9217.js';
|
|
2
|
+
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-4a5c9217.js';
|
|
3
|
+
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-4848f8e8.js';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
5
|
import '../index-d4614f9b.js';
|
|
6
6
|
import '../graphql/types/base/index.js';
|
|
@@ -2,7 +2,7 @@ import * as graphql from 'graphql';
|
|
|
2
2
|
import * as pino from 'pino';
|
|
3
3
|
import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
4
4
|
import { Parameter, Action } from '@copilotkit/shared';
|
|
5
|
-
import { b as CopilotServiceAdapter, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, R as RemoteChainParameters, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-
|
|
5
|
+
import { b as CopilotServiceAdapter, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, R as RemoteChainParameters, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-4a5c9217.js';
|
|
6
6
|
import { M as MessageInput, a as Message } from './index-d4614f9b.js';
|
|
7
7
|
import { CopilotCloudOptions } from './lib/cloud/index.js';
|
|
8
8
|
import { AbstractAgent } from '@agentwire/client';
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.8.
|
|
12
|
+
"version": "1.8.10-next.0",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"rxjs": "^7.8.1",
|
|
64
64
|
"type-graphql": "2.0.0-rc.1",
|
|
65
65
|
"zod": "^3.23.3",
|
|
66
|
-
"@copilotkit/shared": "1.8.
|
|
66
|
+
"@copilotkit/shared": "1.8.10-next.0"
|
|
67
67
|
},
|
|
68
68
|
"keywords": [
|
|
69
69
|
"copilotkit",
|
|
@@ -57,12 +57,12 @@ export function constructLGCRemoteAction({
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
let state = {};
|
|
60
|
-
let
|
|
60
|
+
let config = {};
|
|
61
61
|
if (agentStates) {
|
|
62
62
|
const jsonState = agentStates.find((state) => state.agentName === name);
|
|
63
63
|
if (jsonState) {
|
|
64
64
|
state = parseJson(jsonState.state, {});
|
|
65
|
-
|
|
65
|
+
config = parseJson(jsonState.config, {});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -76,7 +76,7 @@ export function constructLGCRemoteAction({
|
|
|
76
76
|
nodeName,
|
|
77
77
|
messages: [...messages, ...additionalMessages],
|
|
78
78
|
state,
|
|
79
|
-
|
|
79
|
+
config,
|
|
80
80
|
properties: graphqlContext.properties,
|
|
81
81
|
actions: tryMap(actionInputsWithoutAgents, (action: ActionInput) => ({
|
|
82
82
|
name: action.name,
|
|
@@ -206,12 +206,12 @@ export function constructRemoteActions({
|
|
|
206
206
|
});
|
|
207
207
|
|
|
208
208
|
let state = {};
|
|
209
|
-
let
|
|
209
|
+
let config = {};
|
|
210
210
|
if (agentStates) {
|
|
211
211
|
const jsonState = agentStates.find((state) => state.agentName === name);
|
|
212
212
|
if (jsonState) {
|
|
213
213
|
state = parseJson(jsonState.state, {});
|
|
214
|
-
|
|
214
|
+
config = parseJson(jsonState.config, {});
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -226,7 +226,7 @@ export function constructRemoteActions({
|
|
|
226
226
|
nodeName,
|
|
227
227
|
messages: [...messages, ...additionalMessages],
|
|
228
228
|
state,
|
|
229
|
-
|
|
229
|
+
config,
|
|
230
230
|
properties: graphqlContext.properties,
|
|
231
231
|
actions: tryMap(actionInputsWithoutAgents, (action: ActionInput) => ({
|
|
232
232
|
name: action.name,
|
|
@@ -26,7 +26,10 @@ interface ExecutionArgs extends Omit<LangGraphPlatformEndpoint, "agents"> {
|
|
|
26
26
|
nodeName: string;
|
|
27
27
|
messages: Message[];
|
|
28
28
|
state: State;
|
|
29
|
-
|
|
29
|
+
config?: {
|
|
30
|
+
configurable?: Record<string, any>;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
30
33
|
properties: CopilotRequestContextProperties;
|
|
31
34
|
actions: ExecutionAction[];
|
|
32
35
|
logger: Logger;
|
|
@@ -119,7 +122,7 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
119
122
|
agent,
|
|
120
123
|
nodeName: initialNodeName,
|
|
121
124
|
state: initialState,
|
|
122
|
-
|
|
125
|
+
config: explicitConfig,
|
|
123
126
|
messages,
|
|
124
127
|
actions,
|
|
125
128
|
logger,
|
|
@@ -234,11 +237,40 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
234
237
|
const graphInfo = await client.assistants.getGraph(assistantId);
|
|
235
238
|
const graphSchema = await client.assistants.getSchemas(assistantId);
|
|
236
239
|
const schemaKeys = getSchemaKeys(graphSchema);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
|
|
241
|
+
if (explicitConfig) {
|
|
242
|
+
let filteredConfigurable = retrievedAssistant.config.configurable;
|
|
243
|
+
if (explicitConfig.configurable) {
|
|
244
|
+
filteredConfigurable = schemaKeys?.config
|
|
245
|
+
? filterObjectBySchemaKeys(explicitConfig?.configurable, schemaKeys?.config)
|
|
246
|
+
: explicitConfig?.configurable;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const newConfig = {
|
|
250
|
+
...retrievedAssistant.config,
|
|
251
|
+
...explicitConfig,
|
|
252
|
+
configurable: filteredConfigurable,
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// LG does not return recursion limit if it's the default, therefore we check: if no recursion limit is currently set, and the user asked for 25, there is no change.
|
|
256
|
+
const isRecursionLimitSetToDefault =
|
|
257
|
+
retrievedAssistant.config.recursion_limit == null && explicitConfig.recursion_limit === 25;
|
|
258
|
+
// Deep compare configs to avoid unnecessary update calls
|
|
259
|
+
const configsAreDifferent =
|
|
260
|
+
JSON.stringify(newConfig) !== JSON.stringify(retrievedAssistant.config);
|
|
261
|
+
|
|
262
|
+
// Check if the only difference is the recursion_limit being set to default
|
|
263
|
+
const isOnlyRecursionLimitDifferent =
|
|
264
|
+
isRecursionLimitSetToDefault &&
|
|
265
|
+
JSON.stringify({ ...newConfig, recursion_limit: null }) ===
|
|
266
|
+
JSON.stringify({ ...retrievedAssistant.config, recursion_limit: null });
|
|
267
|
+
|
|
268
|
+
// If configs are different, we further check: Is the only diff a request to set the recursion limit to its already default?
|
|
269
|
+
if (configsAreDifferent && !isOnlyRecursionLimitDifferent) {
|
|
270
|
+
await client.assistants.update(assistantId, {
|
|
271
|
+
config: newConfig,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
242
274
|
}
|
|
243
275
|
|
|
244
276
|
// Do not input keys that are not part of the input schema
|