@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
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  CustomEventNames,
3
3
  LangGraphAgent
4
- } from "./chunk-26EZI2OL.mjs";
4
+ } from "./chunk-55VUNE6C.mjs";
5
5
  import {
6
6
  config,
7
7
  copilotRuntimeNextJSAppRouterEndpoint,
8
8
  copilotRuntimeNextJSPagesRouterEndpoint
9
- } from "./chunk-XRRSRDZR.mjs";
9
+ } from "./chunk-LLFNFIOQ.mjs";
10
10
  import {
11
11
  copilotRuntimeNestEndpoint
12
- } from "./chunk-QYYJ4HZT.mjs";
12
+ } from "./chunk-LHHL56Z2.mjs";
13
13
  import {
14
14
  copilotRuntimeNodeExpressEndpoint
15
- } from "./chunk-5242BPKE.mjs";
15
+ } from "./chunk-OXUJLGHK.mjs";
16
16
  import {
17
17
  CopilotRuntime,
18
18
  addCustomHeaderPlugin,
@@ -28,7 +28,7 @@ import {
28
28
  getCommonConfig,
29
29
  langGraphPlatformEndpoint,
30
30
  resolveEndpointType
31
- } from "./chunk-67FD4ROM.mjs";
31
+ } from "./chunk-J7IKWG2M.mjs";
32
32
  import "./chunk-SHBDMA63.mjs";
33
33
  import {
34
34
  AnthropicAdapter,
@@ -43,7 +43,7 @@ import {
43
43
  OpenAIAssistantAdapter,
44
44
  RemoteChain,
45
45
  UnifyAdapter
46
- } from "./chunk-GS7DO47Q.mjs";
46
+ } from "./chunk-JTFQ5GIL.mjs";
47
47
  import {
48
48
  GuardrailsValidationFailureResponse,
49
49
  MessageStreamInterruptedResponse,
package/dist/lib/index.js CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.9.2-next.12",
47
+ version: "1.9.2-next.14",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -420,7 +420,6 @@ var OpenAIAdapter = class {
420
420
  const { threadId: threadIdFromRequest, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
421
421
  const tools = actions.map(convertActionInputToOpenAITool);
422
422
  const threadId = threadIdFromRequest ?? (0, import_shared3.randomUUID)();
423
- console.log("messages", messages);
424
423
  const validToolUseIds = /* @__PURE__ */ new Set();
425
424
  for (const message of messages) {
426
425
  if (message.isActionExecutionMessage()) {
@@ -450,29 +449,6 @@ var OpenAIAdapter = class {
450
449
  }
451
450
  };
452
451
  }
453
- console.log("INPUT", {
454
- model,
455
- stream: true,
456
- messages: openaiMessages,
457
- ...tools.length > 0 && {
458
- tools
459
- },
460
- ...(forwardedParameters == null ? void 0 : forwardedParameters.maxTokens) && {
461
- max_tokens: forwardedParameters.maxTokens
462
- },
463
- ...(forwardedParameters == null ? void 0 : forwardedParameters.stop) && {
464
- stop: forwardedParameters.stop
465
- },
466
- ...toolChoice && {
467
- tool_choice: toolChoice
468
- },
469
- ...this.disableParallelToolCalls && {
470
- parallel_tool_calls: false
471
- },
472
- ...(forwardedParameters == null ? void 0 : forwardedParameters.temperature) && {
473
- temperature: forwardedParameters.temperature
474
- }
475
- });
476
452
  try {
477
453
  const stream = this.openai.beta.chat.completions.stream({
478
454
  model,
@@ -4705,10 +4681,10 @@ please use an LLM adapter instead.`
4705
4681
  return agents;
4706
4682
  }
4707
4683
  discoverAgentsFromAgui() {
4708
- return Object.values(this.agents ?? []).map((agent) => ({
4709
- name: agent.agentName,
4710
- id: agent.agentId,
4711
- description: ""
4684
+ return Object.entries(this.agents ?? []).map(([key, agent]) => ({
4685
+ name: agent.agentName ?? key,
4686
+ id: agent.agentId ?? key,
4687
+ description: agent.description ?? ""
4712
4688
  }));
4713
4689
  }
4714
4690
  async loadAgentState(graphqlContext, threadId, agentName) {
@@ -4771,25 +4747,25 @@ please use an LLM adapter instead.`
4771
4747
  const propertyHeaders = graphqlContext.properties.authorization ? {
4772
4748
  authorization: `Bearer ${graphqlContext.properties.authorization}`
4773
4749
  } : null;
4774
- let client;
4775
- if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
4776
- client = new import_langgraph_sdk2.Client({
4777
- apiUrl: agent.endpoint.deploymentUrl,
4778
- apiKey: agent.endpoint.langsmithApiKey,
4779
- defaultHeaders: {
4780
- ...propertyHeaders
4781
- }
4782
- });
4783
- } else {
4784
- const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name];
4785
- if (!aguiAgent) {
4786
- throw new Error(`Agent: ${agent.name} could not be resolved`);
4787
- }
4788
- client = aguiAgent.client;
4789
- }
4790
4750
  let state = {};
4791
4751
  try {
4792
- state = (await client.threads.getState(threadId)).values;
4752
+ let client;
4753
+ if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
4754
+ client = new import_langgraph_sdk2.Client({
4755
+ apiUrl: agent.endpoint.deploymentUrl,
4756
+ apiKey: agent.endpoint.langsmithApiKey,
4757
+ defaultHeaders: {
4758
+ ...propertyHeaders
4759
+ }
4760
+ });
4761
+ } else {
4762
+ const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name];
4763
+ if (!aguiAgent) {
4764
+ throw new Error(`Agent: ${agent.name} could not be resolved`);
4765
+ }
4766
+ client = aguiAgent.client ?? null;
4767
+ }
4768
+ state = client ? (await client.threads.getState(threadId)).values : {};
4793
4769
  } catch (error) {
4794
4770
  const errorMessage = error instanceof Error ? error.message : String(error);
4795
4771
  console.debug(`Agent '${agentName}' configuration issue: ${errorMessage}`);