@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
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  config,
4
4
  copilotRuntimeNextJSAppRouterEndpoint,
5
5
  copilotRuntimeNextJSPagesRouterEndpoint
6
- } from "./chunk-OI2VCNPX.mjs";
6
+ } from "./chunk-65VBDTR4.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-MKC4PI66.mjs";
9
+ } from "./chunk-BUEAVIXA.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-AJWO2KBE.mjs";
12
+ } from "./chunk-F4WILQ32.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  buildSchema,
@@ -20,7 +20,7 @@ import {
20
20
  getCommonConfig,
21
21
  langGraphPlatformEndpoint,
22
22
  resolveEndpointType
23
- } from "./chunk-EMZY3B5S.mjs";
23
+ } from "./chunk-OMS5GY45.mjs";
24
24
  import {
25
25
  AnthropicAdapter,
26
26
  EmptyAdapter,
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.5.15-next.6",
47
+ version: "1.5.15-next.7",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -3221,19 +3221,23 @@ please use an LLM adapter instead.`
3221
3221
  const threadId = threadIdFromRequest ?? agentSession.threadId;
3222
3222
  const serverSideActions = await this.getServerSideActions(request);
3223
3223
  const messages = convertGqlInputToMessages(rawMessages);
3224
- const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
3225
- if (!agent) {
3224
+ const currentAgent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
3225
+ if (!currentAgent) {
3226
3226
  throw new import_shared13.CopilotKitAgentDiscoveryError({
3227
3227
  agentName
3228
3228
  });
3229
3229
  }
3230
- const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
3230
+ const availableActionsForCurrentAgent = serverSideActions.filter((action) => (
3231
+ // Case 1: Keep all regular (non-agent) actions
3232
+ !isLangGraphAgentAction(action) || // Case 2: For agent actions, keep all except self (prevent infinite loops)
3233
+ isLangGraphAgentAction(action) && action.name !== agentName
3234
+ )).map((action) => ({
3231
3235
  name: action.name,
3232
3236
  description: action.description,
3233
3237
  jsonSchema: JSON.stringify((0, import_shared13.actionParametersToJsonSchema)(action.parameters))
3234
3238
  }));
3235
- const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
3236
- ...serverSideActionsInput,
3239
+ const allAvailableActions = flattenToolCallsNoDuplicates([
3240
+ ...availableActionsForCurrentAgent,
3237
3241
  ...request.actions
3238
3242
  ]);
3239
3243
  await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
@@ -3244,12 +3248,12 @@ please use an LLM adapter instead.`
3244
3248
  }));
3245
3249
  try {
3246
3250
  const eventSource = new RuntimeEventSource();
3247
- const stream = await agent.langGraphAgentHandler({
3251
+ const stream = await currentAgent.langGraphAgentHandler({
3248
3252
  name: agentName,
3249
3253
  threadId,
3250
3254
  nodeName,
3251
- actionInputsWithoutAgents,
3252
- metaEvents
3255
+ metaEvents,
3256
+ actionInputsWithoutAgents: allAvailableActions
3253
3257
  });
3254
3258
  eventSource.stream(async (eventStream$) => {
3255
3259
  (0, import_rxjs3.from)(stream).subscribe({
@@ -3278,7 +3282,7 @@ please use an LLM adapter instead.`
3278
3282
  runId: void 0,
3279
3283
  eventSource,
3280
3284
  serverSideActions: [],
3281
- actionInputsWithoutAgents
3285
+ actionInputsWithoutAgents: allAvailableActions
3282
3286
  };
3283
3287
  } catch (error) {
3284
3288
  console.error("Error getting response:", error);