@copilotkit/runtime 1.5.15-next.6 → 1.5.15-next.7

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 (29) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-OI2VCNPX.mjs → chunk-65VBDTR4.mjs} +2 -2
  3. package/dist/{chunk-MKC4PI66.mjs → chunk-BUEAVIXA.mjs} +2 -2
  4. package/dist/{chunk-AJWO2KBE.mjs → chunk-F4WILQ32.mjs} +2 -2
  5. package/dist/{chunk-EMZY3B5S.mjs → chunk-OMS5GY45.mjs} +15 -11
  6. package/dist/{chunk-EMZY3B5S.mjs.map → chunk-OMS5GY45.mjs.map} +1 -1
  7. package/dist/index.js +14 -10
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +14 -10
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/index.mjs +4 -4
  13. package/dist/lib/integrations/index.js +1 -1
  14. package/dist/lib/integrations/index.js.map +1 -1
  15. package/dist/lib/integrations/index.mjs +4 -4
  16. package/dist/lib/integrations/nest/index.js +1 -1
  17. package/dist/lib/integrations/nest/index.js.map +1 -1
  18. package/dist/lib/integrations/nest/index.mjs +2 -2
  19. package/dist/lib/integrations/node-express/index.js +1 -1
  20. package/dist/lib/integrations/node-express/index.js.map +1 -1
  21. package/dist/lib/integrations/node-express/index.mjs +2 -2
  22. package/dist/lib/integrations/node-http/index.js +1 -1
  23. package/dist/lib/integrations/node-http/index.js.map +1 -1
  24. package/dist/lib/integrations/node-http/index.mjs +1 -1
  25. package/package.json +2 -2
  26. package/src/lib/runtime/copilot-runtime.ts +18 -9
  27. /package/dist/{chunk-OI2VCNPX.mjs.map → chunk-65VBDTR4.mjs.map} +0 -0
  28. /package/dist/{chunk-MKC4PI66.mjs.map → chunk-BUEAVIXA.mjs.map} +0 -0
  29. /package/dist/{chunk-AJWO2KBE.mjs.map → chunk-F4WILQ32.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-EMZY3B5S.mjs";
3
+ } from "../../../chunk-OMS5GY45.mjs";
4
4
  import "../../../chunk-S3KKBII4.mjs";
5
5
  import "../../../chunk-U3V2BCGI.mjs";
6
6
  import "../../../chunk-HNUNXFTW.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.5.15-next.6",
12
+ "version": "1.5.15-next.7",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -58,7 +58,7 @@
58
58
  "rxjs": "^7.8.1",
59
59
  "type-graphql": "2.0.0-rc.1",
60
60
  "zod": "^3.23.3",
61
- "@copilotkit/shared": "1.5.15-next.6"
61
+ "@copilotkit/shared": "1.5.15-next.7"
62
62
  },
63
63
  "keywords": [
64
64
  "copilotkit",
@@ -478,24 +478,33 @@ please use an LLM adapter instead.`,
478
478
 
479
479
  const messages = convertGqlInputToMessages(rawMessages);
480
480
 
481
- const agent = serverSideActions.find(
481
+ const currentAgent = serverSideActions.find(
482
482
  (action) => action.name === agentName && isLangGraphAgentAction(action),
483
483
  ) as LangGraphAgentAction;
484
484
 
485
- if (!agent) {
485
+ if (!currentAgent) {
486
486
  throw new CopilotKitAgentDiscoveryError({ agentName });
487
487
  }
488
488
 
489
- const serverSideActionsInput: ActionInput[] = serverSideActions
490
- .filter((action) => !isLangGraphAgentAction(action))
489
+ // Filter actions to include:
490
+ // 1. Regular (non-agent) actions
491
+ // 2. Other agents' actions (but prevent self-calls to avoid infinite loops)
492
+ const availableActionsForCurrentAgent: ActionInput[] = serverSideActions
493
+ .filter(
494
+ (action) =>
495
+ // Case 1: Keep all regular (non-agent) actions
496
+ !isLangGraphAgentAction(action) ||
497
+ // Case 2: For agent actions, keep all except self (prevent infinite loops)
498
+ (isLangGraphAgentAction(action) && action.name !== agentName) /* prevent self-calls */,
499
+ )
491
500
  .map((action) => ({
492
501
  name: action.name,
493
502
  description: action.description,
494
503
  jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),
495
504
  }));
496
505
 
497
- const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
498
- ...serverSideActionsInput,
506
+ const allAvailableActions = flattenToolCallsNoDuplicates([
507
+ ...availableActionsForCurrentAgent,
499
508
  ...request.actions,
500
509
  ]);
501
510
 
@@ -507,12 +516,12 @@ please use an LLM adapter instead.`,
507
516
  });
508
517
  try {
509
518
  const eventSource = new RuntimeEventSource();
510
- const stream = await agent.langGraphAgentHandler({
519
+ const stream = await currentAgent.langGraphAgentHandler({
511
520
  name: agentName,
512
521
  threadId,
513
522
  nodeName,
514
- actionInputsWithoutAgents,
515
523
  metaEvents,
524
+ actionInputsWithoutAgents: allAvailableActions,
516
525
  });
517
526
 
518
527
  eventSource.stream(async (eventStream$) => {
@@ -544,7 +553,7 @@ please use an LLM adapter instead.`,
544
553
  runId: undefined,
545
554
  eventSource,
546
555
  serverSideActions: [],
547
- actionInputsWithoutAgents,
556
+ actionInputsWithoutAgents: allAvailableActions,
548
557
  };
549
558
  } catch (error) {
550
559
  console.error("Error getting response:", error);