@copilotkit/runtime 1.9.2-next.12 → 1.9.2-next.14

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{chunk-26EZI2OL.mjs → chunk-55VUNE6C.mjs} +2 -2
  3. package/dist/{chunk-67FD4ROM.mjs → chunk-J7IKWG2M.mjs} +24 -24
  4. package/dist/chunk-J7IKWG2M.mjs.map +1 -0
  5. package/dist/{chunk-GS7DO47Q.mjs → chunk-JTFQ5GIL.mjs} +1 -25
  6. package/dist/chunk-JTFQ5GIL.mjs.map +1 -0
  7. package/dist/{chunk-QYYJ4HZT.mjs → chunk-LHHL56Z2.mjs} +2 -2
  8. package/dist/{chunk-XRRSRDZR.mjs → chunk-LLFNFIOQ.mjs} +2 -2
  9. package/dist/{chunk-5242BPKE.mjs → chunk-OXUJLGHK.mjs} +2 -2
  10. package/dist/index.js +22 -46
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +6 -6
  13. package/dist/lib/index.js +22 -46
  14. package/dist/lib/index.js.map +1 -1
  15. package/dist/lib/index.mjs +6 -6
  16. package/dist/lib/integrations/index.js +1 -1
  17. package/dist/lib/integrations/index.js.map +1 -1
  18. package/dist/lib/integrations/index.mjs +5 -5
  19. package/dist/lib/integrations/nest/index.js +1 -1
  20. package/dist/lib/integrations/nest/index.js.map +1 -1
  21. package/dist/lib/integrations/nest/index.mjs +3 -3
  22. package/dist/lib/integrations/node-express/index.js +1 -1
  23. package/dist/lib/integrations/node-express/index.js.map +1 -1
  24. package/dist/lib/integrations/node-express/index.mjs +3 -3
  25. package/dist/lib/integrations/node-http/index.js +1 -1
  26. package/dist/lib/integrations/node-http/index.js.map +1 -1
  27. package/dist/lib/integrations/node-http/index.mjs +2 -2
  28. package/dist/service-adapters/index.js +0 -24
  29. package/dist/service-adapters/index.js.map +1 -1
  30. package/dist/service-adapters/index.mjs +1 -1
  31. package/package.json +2 -2
  32. package/src/lib/runtime/copilot-runtime.ts +21 -20
  33. package/src/service-adapters/openai/openai-adapter.ts +0 -14
  34. package/dist/chunk-67FD4ROM.mjs.map +0 -1
  35. package/dist/chunk-GS7DO47Q.mjs.map +0 -1
  36. /package/dist/{chunk-26EZI2OL.mjs.map → chunk-55VUNE6C.mjs.map} +0 -0
  37. /package/dist/{chunk-QYYJ4HZT.mjs.map → chunk-LHHL56Z2.mjs.map} +0 -0
  38. /package/dist/{chunk-XRRSRDZR.mjs.map → chunk-LLFNFIOQ.mjs.map} +0 -0
  39. /package/dist/{chunk-5242BPKE.mjs.map → chunk-OXUJLGHK.mjs.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  OpenAIAssistantAdapter,
12
12
  RemoteChain,
13
13
  UnifyAdapter
14
- } from "../chunk-GS7DO47Q.mjs";
14
+ } from "../chunk-JTFQ5GIL.mjs";
15
15
  import {
16
16
  convertServiceAdapterError
17
17
  } from "../chunk-AMUJQ6IR.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.9.2-next.12",
12
+ "version": "1.9.2-next.14",
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.12"
69
+ "@copilotkit/shared": "1.9.2-next.14"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@ag-ui/client": ">=0.0.28",
@@ -884,10 +884,10 @@ please use an LLM adapter instead.`,
884
884
  }
885
885
 
886
886
  discoverAgentsFromAgui(): Agent[] {
887
- return Object.values(this.agents ?? []).map((agent: LangGraphAgent) => ({
888
- name: agent.agentName,
889
- id: agent.agentId,
890
- description: "",
887
+ return Object.entries(this.agents ?? []).map(([key, agent]: [string, AbstractAgent]) => ({
888
+ name: (agent as any).agentName ?? key,
889
+ id: agent.agentId ?? key,
890
+ description: agent.description ?? "",
891
891
  }));
892
892
  }
893
893
 
@@ -963,24 +963,25 @@ please use an LLM adapter instead.`,
963
963
  ? { authorization: `Bearer ${graphqlContext.properties.authorization}` }
964
964
  : null;
965
965
 
966
- let client: LangGraphClient;
967
- if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
968
- client = new LangGraphClient({
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;
980
- }
981
966
  let state: any = {};
982
967
  try {
983
- state = (await client.threads.getState(threadId)).values as any;
968
+ let client: LangGraphClient | null;
969
+ if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
970
+ client = new LangGraphClient({
971
+ apiUrl: agent.endpoint.deploymentUrl,
972
+ apiKey: agent.endpoint.langsmithApiKey,
973
+ defaultHeaders: { ...propertyHeaders },
974
+ });
975
+ } else {
976
+ const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name] as LangGraphAgent;
977
+ if (!aguiAgent) {
978
+ throw new Error(`Agent: ${agent.name} could not be resolved`);
979
+ }
980
+ // @ts-expect-error -- both clients are the same
981
+ client = aguiAgent.client ?? null;
982
+ }
983
+
984
+ state = client ? ((await client.threads.getState(threadId)).values as any) : {};
984
985
  } catch (error) {
985
986
  // All errors from agent state loading are user configuration issues
986
987
  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,