@copilotkit/runtime 1.6.0-next.9 → 1.6.0

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 (32) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/{chunk-4HQ5OZXN.mjs → chunk-2RP2NR4F.mjs} +2 -2
  3. package/dist/{chunk-L7OTGCAG.mjs → chunk-DUW72ZZB.mjs} +18 -9
  4. package/dist/chunk-DUW72ZZB.mjs.map +1 -0
  5. package/dist/{chunk-5ZBUMQE2.mjs → chunk-MPI4JZZR.mjs} +2 -2
  6. package/dist/{chunk-7BCFHZLY.mjs → chunk-WUMAYJP3.mjs} +2 -2
  7. package/dist/index.js +17 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +17 -8
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/index.mjs +4 -4
  13. package/dist/lib/integrations/index.js +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +11 -4
  27. package/src/lib/runtime/copilot-runtime.ts +9 -3
  28. package/src/lib/telemetry-client.ts +3 -1
  29. package/dist/chunk-L7OTGCAG.mjs.map +0 -1
  30. /package/dist/{chunk-4HQ5OZXN.mjs.map → chunk-2RP2NR4F.mjs.map} +0 -0
  31. /package/dist/{chunk-5ZBUMQE2.mjs.map → chunk-MPI4JZZR.mjs.map} +0 -0
  32. /package/dist/{chunk-7BCFHZLY.mjs.map → chunk-WUMAYJP3.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-7BCFHZLY.mjs";
6
+ } from "./chunk-WUMAYJP3.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-5ZBUMQE2.mjs";
9
+ } from "./chunk-MPI4JZZR.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-4HQ5OZXN.mjs";
12
+ } from "./chunk-2RP2NR4F.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  addCustomHeaderPlugin,
@@ -21,7 +21,7 @@ import {
21
21
  getCommonConfig,
22
22
  langGraphPlatformEndpoint,
23
23
  resolveEndpointType
24
- } from "./chunk-L7OTGCAG.mjs";
24
+ } from "./chunk-DUW72ZZB.mjs";
25
25
  import {
26
26
  AnthropicAdapter,
27
27
  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.6.0-next.9",
47
+ version: "1.6.0",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1361,10 +1361,11 @@ var RemoteLangGraphEventSource = class {
1361
1361
  let isToolCallEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls";
1362
1362
  acc.isToolCallStart = toolCallChunks.some((chunk) => chunk.name && chunk.id);
1363
1363
  acc.isMessageStart = prevMessageId !== acc.lastMessageId && !acc.isToolCallStart;
1364
- if (acc.isToolCall && !toolCallCheck) {
1364
+ let previousRoundHadToolCall = acc.isToolCall;
1365
+ acc.isToolCall = toolCallCheck;
1366
+ if (previousRoundHadToolCall && !toolCallCheck) {
1365
1367
  isToolCallEnd = true;
1366
1368
  }
1367
- acc.isToolCall = toolCallCheck;
1368
1369
  acc.isToolCallEnd = isToolCallEnd;
1369
1370
  acc.isMessageEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop";
1370
1371
  ({ name: acc.lastToolCallName, id: acc.lastToolCallId } = toolCallChunks.find((chunk) => chunk.name && chunk.id) ?? {
@@ -1385,7 +1386,8 @@ var RemoteLangGraphEventSource = class {
1385
1386
  lastMessageId: null,
1386
1387
  lastToolCallId: null,
1387
1388
  lastToolCallName: null,
1388
- currentContent: null
1389
+ currentContent: null,
1390
+ processedToolCallIds: /* @__PURE__ */ new Set()
1389
1391
  }), (0, import_rxjs.mergeMap)((acc) => {
1390
1392
  const events = [];
1391
1393
  let shouldEmitMessages = true;
@@ -1413,7 +1415,8 @@ var RemoteLangGraphEventSource = class {
1413
1415
  });
1414
1416
  }
1415
1417
  const responseMetadata = this.getResponseMetadata(acc.event);
1416
- if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
1418
+ if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName) && acc.lastToolCallId && !acc.processedToolCallIds.has(acc.lastToolCallId)) {
1419
+ acc.processedToolCallIds.add(acc.lastToolCallId);
1417
1420
  events.push({
1418
1421
  type: RuntimeEventTypes.ActionExecutionEnd,
1419
1422
  actionExecutionId: acc.lastToolCallId
@@ -1480,6 +1483,7 @@ var RemoteLangGraphEventSource = class {
1480
1483
  parentMessageId: acc.lastMessageId
1481
1484
  });
1482
1485
  } else if (acc.isMessageStart && shouldEmitMessages) {
1486
+ acc.processedToolCallIds.clear();
1483
1487
  events.push({
1484
1488
  type: RuntimeEventTypes.TextMessageStart,
1485
1489
  messageId: acc.lastMessageId
@@ -3138,7 +3142,7 @@ function getRuntimeInstanceTelemetryInfo(runtime) {
3138
3142
  info = {
3139
3143
  ...info,
3140
3144
  agentsAmount: ep.agents.length,
3141
- hashedKey: (0, import_node_crypto3.createHash)("sha256").update(ep.langsmithApiKey).digest("hex")
3145
+ hashedKey: ep.langsmithApiKey ? (0, import_node_crypto3.createHash)("sha256").update(ep.langsmithApiKey).digest("hex") : null
3142
3146
  };
3143
3147
  }
3144
3148
  return info;
@@ -3653,7 +3657,12 @@ var CopilotRuntime = class {
3653
3657
  delegateAgentProcessingToServiceAdapter;
3654
3658
  constructor(params) {
3655
3659
  var _a, _b;
3656
- this.actions = (params == null ? void 0 : params.actions) || [];
3660
+ if ((params == null ? void 0 : params.actions) && (params == null ? void 0 : params.remoteEndpoints)) {
3661
+ console.warn("Actions set in runtime instance will be ignored when remote endpoints are set");
3662
+ this.actions = [];
3663
+ } else {
3664
+ this.actions = (params == null ? void 0 : params.actions) || [];
3665
+ }
3657
3666
  for (const chain of (params == null ? void 0 : params.langserve) || []) {
3658
3667
  const remoteChain = new RemoteChain(chain);
3659
3668
  this.langserve.push(remoteChain.toAction());
@@ -4036,7 +4045,7 @@ function langGraphPlatformEndpoint(config2) {
4036
4045
  __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
4037
4046
  function resolveEndpointType(endpoint) {
4038
4047
  if (!endpoint.type) {
4039
- if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
4048
+ if ("deploymentUrl" in endpoint && "agents" in endpoint) {
4040
4049
  return EndpointType.LangGraphPlatform;
4041
4050
  } else {
4042
4051
  return EndpointType.CopilotKit;