@copilotkit/runtime 1.6.0-next.8 → 1.6.0-next.9

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 (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-CC5KHDCV.mjs → chunk-4HQ5OZXN.mjs} +2 -2
  3. package/dist/{chunk-LR7HA4X5.mjs → chunk-5ZBUMQE2.mjs} +2 -2
  4. package/dist/{chunk-DI2VJM3I.mjs → chunk-7BCFHZLY.mjs} +2 -2
  5. package/dist/{chunk-C7VKUXWC.mjs → chunk-L7OTGCAG.mjs} +12 -8
  6. package/dist/chunk-L7OTGCAG.mjs.map +1 -0
  7. package/dist/index.js +11 -7
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +11 -7
  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/agents/langgraph/event-source.ts +13 -4
  27. package/src/lib/runtime/copilot-runtime.ts +1 -1
  28. package/dist/chunk-C7VKUXWC.mjs.map +0 -1
  29. /package/dist/{chunk-CC5KHDCV.mjs.map → chunk-4HQ5OZXN.mjs.map} +0 -0
  30. /package/dist/{chunk-LR7HA4X5.mjs.map → chunk-5ZBUMQE2.mjs.map} +0 -0
  31. /package/dist/{chunk-DI2VJM3I.mjs.map → chunk-7BCFHZLY.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-C7VKUXWC.mjs";
3
+ } from "../../../chunk-L7OTGCAG.mjs";
4
4
  import "../../../chunk-FZJAYGIR.mjs";
5
5
  import "../../../chunk-5BIEM2UU.mjs";
6
6
  import "../../../chunk-RTFJTJMA.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.6.0-next.8",
12
+ "version": "1.6.0-next.9",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -59,7 +59,7 @@
59
59
  "rxjs": "^7.8.1",
60
60
  "type-graphql": "2.0.0-rc.1",
61
61
  "zod": "^3.23.3",
62
- "@copilotkit/shared": "1.6.0-next.8"
62
+ "@copilotkit/shared": "1.6.0-next.9"
63
63
  },
64
64
  "keywords": [
65
65
  "copilotkit",
@@ -87,11 +87,20 @@ export class RemoteLangGraphEventSource {
87
87
  acc.lastMessageId = this.getCurrentMessageId(event) ?? acc.lastMessageId;
88
88
  const toolCallChunks = this.getCurrentToolCallChunks(event) ?? [];
89
89
  const responseMetadata = this.getResponseMetadata(event);
90
+ // Check if a given event is a tool call
91
+ const toolCallCheck = toolCallChunks && toolCallChunks.length > 0;
92
+ let isToolCallEnd = responseMetadata?.finish_reason === "tool_calls";
90
93
 
91
94
  acc.isToolCallStart = toolCallChunks.some((chunk: any) => chunk.name && chunk.id);
92
95
  acc.isMessageStart = prevMessageId !== acc.lastMessageId && !acc.isToolCallStart;
93
- acc.isToolCall = toolCallChunks && toolCallChunks.length > 0;
94
- acc.isToolCallEnd = responseMetadata?.finish_reason === "tool_calls";
96
+
97
+ // Previous "acc.isToolCall" was set but now it won't pass the check, it means the tool call just ended.
98
+ if (acc.isToolCall && !toolCallCheck) {
99
+ isToolCallEnd = true;
100
+ }
101
+
102
+ acc.isToolCall = toolCallCheck;
103
+ acc.isToolCallEnd = isToolCallEnd;
95
104
  acc.isMessageEnd = responseMetadata?.finish_reason === "stop";
96
105
  ({ name: acc.lastToolCallName, id: acc.lastToolCallId } = toolCallChunks.find(
97
106
  (chunk: any) => chunk.name && chunk.id,
@@ -148,7 +157,7 @@ export class RemoteLangGraphEventSource {
148
157
 
149
158
  // Tool call ended: emit ActionExecutionEnd
150
159
  if (
151
- responseMetadata?.finish_reason === "tool_calls" &&
160
+ acc.isToolCallEnd &&
152
161
  this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)
153
162
  ) {
154
163
  events.push({
@@ -158,7 +167,7 @@ export class RemoteLangGraphEventSource {
158
167
  }
159
168
 
160
169
  // Message ended: emit TextMessageEnd
161
- if (responseMetadata?.finish_reason === "stop" && shouldEmitMessages) {
170
+ else if (responseMetadata?.finish_reason === "stop" && shouldEmitMessages) {
162
171
  events.push({
163
172
  type: RuntimeEventTypes.TextMessageEnd,
164
173
  messageId: acc.lastMessageId,
@@ -572,7 +572,7 @@ please use an LLM adapter instead.`,
572
572
  threadId,
573
573
  runId: undefined,
574
574
  eventSource,
575
- serverSideActions: [],
575
+ serverSideActions,
576
576
  actionInputsWithoutAgents: allAvailableActions,
577
577
  };
578
578
  } catch (error) {