@copilotkit/runtime 1.9.2-next.12 → 1.9.2-next.13
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-5242BPKE.mjs → chunk-6V6X7HZO.mjs} +2 -2
- package/dist/{chunk-67FD4ROM.mjs → chunk-CSXEYW65.mjs} +19 -19
- package/dist/chunk-CSXEYW65.mjs.map +1 -0
- package/dist/{chunk-GS7DO47Q.mjs → chunk-JTFQ5GIL.mjs} +1 -25
- package/dist/chunk-JTFQ5GIL.mjs.map +1 -0
- package/dist/{chunk-QYYJ4HZT.mjs → chunk-LNXBP675.mjs} +2 -2
- package/dist/{chunk-XRRSRDZR.mjs → chunk-NV2UY5BF.mjs} +2 -2
- package/dist/{chunk-26EZI2OL.mjs → chunk-WY337BWR.mjs} +2 -2
- package/dist/index.js +17 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/lib/index.js +17 -41
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- package/dist/service-adapters/index.js +0 -24
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/copilot-runtime.ts +17 -15
- package/src/service-adapters/openai/openai-adapter.ts +0 -14
- package/dist/chunk-67FD4ROM.mjs.map +0 -1
- package/dist/chunk-GS7DO47Q.mjs.map +0 -1
- /package/dist/{chunk-5242BPKE.mjs.map → chunk-6V6X7HZO.mjs.map} +0 -0
- /package/dist/{chunk-QYYJ4HZT.mjs.map → chunk-LNXBP675.mjs.map} +0 -0
- /package/dist/{chunk-XRRSRDZR.mjs.map → chunk-NV2UY5BF.mjs.map} +0 -0
- /package/dist/{chunk-26EZI2OL.mjs.map → chunk-WY337BWR.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.9.2-next.
|
|
12
|
+
"version": "1.9.2-next.13",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"rxjs": "7.8.1",
|
|
67
67
|
"type-graphql": "2.0.0-rc.1",
|
|
68
68
|
"zod": "^3.23.3",
|
|
69
|
-
"@copilotkit/shared": "1.9.2-next.
|
|
69
|
+
"@copilotkit/shared": "1.9.2-next.13"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@ag-ui/client": ">=0.0.28",
|
|
@@ -963,24 +963,26 @@ please use an LLM adapter instead.`,
|
|
|
963
963
|
? { authorization: `Bearer ${graphqlContext.properties.authorization}` }
|
|
964
964
|
: null;
|
|
965
965
|
|
|
966
|
-
|
|
967
|
-
if (
|
|
968
|
-
|
|
969
|
-
apiUrl: agent.endpoint.deploymentUrl,
|
|
970
|
-
apiKey: agent.endpoint.langsmithApiKey,
|
|
971
|
-
defaultHeaders: { ...propertyHeaders },
|
|
972
|
-
});
|
|
973
|
-
} else {
|
|
974
|
-
const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name] as LangGraphAgent;
|
|
975
|
-
if (!aguiAgent) {
|
|
976
|
-
throw new Error(`Agent: ${agent.name} could not be resolved`);
|
|
977
|
-
}
|
|
978
|
-
// @ts-expect-error -- both clients are the same
|
|
979
|
-
client = aguiAgent.client;
|
|
966
|
+
const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name] as LangGraphAgent;
|
|
967
|
+
if (!aguiAgent) {
|
|
968
|
+
throw new Error(`Agent: ${agent.name} could not be resolved`);
|
|
980
969
|
}
|
|
970
|
+
|
|
981
971
|
let state: any = {};
|
|
982
972
|
try {
|
|
983
|
-
|
|
973
|
+
let client: LangGraphClient | null;
|
|
974
|
+
if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
975
|
+
client = new LangGraphClient({
|
|
976
|
+
apiUrl: agent.endpoint.deploymentUrl,
|
|
977
|
+
apiKey: agent.endpoint.langsmithApiKey,
|
|
978
|
+
defaultHeaders: { ...propertyHeaders },
|
|
979
|
+
});
|
|
980
|
+
} else {
|
|
981
|
+
// @ts-expect-error -- both clients are the same
|
|
982
|
+
client = aguiAgent.client ?? null;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
state = client ? ((await client.threads.getState(threadId)).values as any) : {};
|
|
984
986
|
} catch (error) {
|
|
985
987
|
// All errors from agent state loading are user configuration issues
|
|
986
988
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -129,8 +129,6 @@ export class OpenAIAdapter implements CopilotServiceAdapter {
|
|
|
129
129
|
const tools = actions.map(convertActionInputToOpenAITool);
|
|
130
130
|
const threadId = threadIdFromRequest ?? randomUUID();
|
|
131
131
|
|
|
132
|
-
console.log("messages", messages);
|
|
133
|
-
|
|
134
132
|
// ALLOWLIST APPROACH: Only include tool_result messages that correspond to valid tool_calls
|
|
135
133
|
// Step 1: Extract valid tool_call IDs
|
|
136
134
|
const validToolUseIds = new Set<string>();
|
|
@@ -171,18 +169,6 @@ export class OpenAIAdapter implements CopilotServiceAdapter {
|
|
|
171
169
|
};
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
console.log("INPUT", {
|
|
175
|
-
model: model,
|
|
176
|
-
stream: true,
|
|
177
|
-
messages: openaiMessages,
|
|
178
|
-
...(tools.length > 0 && { tools }),
|
|
179
|
-
...(forwardedParameters?.maxTokens && { max_tokens: forwardedParameters.maxTokens }),
|
|
180
|
-
...(forwardedParameters?.stop && { stop: forwardedParameters.stop }),
|
|
181
|
-
...(toolChoice && { tool_choice: toolChoice }),
|
|
182
|
-
...(this.disableParallelToolCalls && { parallel_tool_calls: false }),
|
|
183
|
-
...(forwardedParameters?.temperature && { temperature: forwardedParameters.temperature }),
|
|
184
|
-
});
|
|
185
|
-
|
|
186
172
|
try {
|
|
187
173
|
const stream = this.openai.beta.chat.completions.stream({
|
|
188
174
|
model: model,
|