@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
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-L7OTGCAG.mjs";
5
+ } from "./chunk-DUW72ZZB.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-5ZBUMQE2.mjs.map
25
+ //# sourceMappingURL=chunk-MPI4JZZR.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-L7OTGCAG.mjs";
5
+ } from "./chunk-DUW72ZZB.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-7BCFHZLY.mjs.map
80
+ //# sourceMappingURL=chunk-WUMAYJP3.mjs.map
package/dist/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",
@@ -1697,10 +1697,11 @@ var RemoteLangGraphEventSource = class {
1697
1697
  let isToolCallEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls";
1698
1698
  acc.isToolCallStart = toolCallChunks.some((chunk) => chunk.name && chunk.id);
1699
1699
  acc.isMessageStart = prevMessageId !== acc.lastMessageId && !acc.isToolCallStart;
1700
- if (acc.isToolCall && !toolCallCheck) {
1700
+ let previousRoundHadToolCall = acc.isToolCall;
1701
+ acc.isToolCall = toolCallCheck;
1702
+ if (previousRoundHadToolCall && !toolCallCheck) {
1701
1703
  isToolCallEnd = true;
1702
1704
  }
1703
- acc.isToolCall = toolCallCheck;
1704
1705
  acc.isToolCallEnd = isToolCallEnd;
1705
1706
  acc.isMessageEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop";
1706
1707
  ({ name: acc.lastToolCallName, id: acc.lastToolCallId } = toolCallChunks.find((chunk) => chunk.name && chunk.id) ?? {
@@ -1721,7 +1722,8 @@ var RemoteLangGraphEventSource = class {
1721
1722
  lastMessageId: null,
1722
1723
  lastToolCallId: null,
1723
1724
  lastToolCallName: null,
1724
- currentContent: null
1725
+ currentContent: null,
1726
+ processedToolCallIds: /* @__PURE__ */ new Set()
1725
1727
  }), (0, import_rxjs.mergeMap)((acc) => {
1726
1728
  const events = [];
1727
1729
  let shouldEmitMessages = true;
@@ -1749,7 +1751,8 @@ var RemoteLangGraphEventSource = class {
1749
1751
  });
1750
1752
  }
1751
1753
  const responseMetadata = this.getResponseMetadata(acc.event);
1752
- if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
1754
+ if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName) && acc.lastToolCallId && !acc.processedToolCallIds.has(acc.lastToolCallId)) {
1755
+ acc.processedToolCallIds.add(acc.lastToolCallId);
1753
1756
  events.push({
1754
1757
  type: RuntimeEventTypes.ActionExecutionEnd,
1755
1758
  actionExecutionId: acc.lastToolCallId
@@ -1816,6 +1819,7 @@ var RemoteLangGraphEventSource = class {
1816
1819
  parentMessageId: acc.lastMessageId
1817
1820
  });
1818
1821
  } else if (acc.isMessageStart && shouldEmitMessages) {
1822
+ acc.processedToolCallIds.clear();
1819
1823
  events.push({
1820
1824
  type: RuntimeEventTypes.TextMessageStart,
1821
1825
  messageId: acc.lastMessageId
@@ -3474,7 +3478,7 @@ function getRuntimeInstanceTelemetryInfo(runtime) {
3474
3478
  info = {
3475
3479
  ...info,
3476
3480
  agentsAmount: ep.agents.length,
3477
- hashedKey: (0, import_node_crypto3.createHash)("sha256").update(ep.langsmithApiKey).digest("hex")
3481
+ hashedKey: ep.langsmithApiKey ? (0, import_node_crypto3.createHash)("sha256").update(ep.langsmithApiKey).digest("hex") : null
3478
3482
  };
3479
3483
  }
3480
3484
  return info;
@@ -3989,7 +3993,12 @@ var CopilotRuntime = class {
3989
3993
  delegateAgentProcessingToServiceAdapter;
3990
3994
  constructor(params) {
3991
3995
  var _a, _b;
3992
- this.actions = (params == null ? void 0 : params.actions) || [];
3996
+ if ((params == null ? void 0 : params.actions) && (params == null ? void 0 : params.remoteEndpoints)) {
3997
+ console.warn("Actions set in runtime instance will be ignored when remote endpoints are set");
3998
+ this.actions = [];
3999
+ } else {
4000
+ this.actions = (params == null ? void 0 : params.actions) || [];
4001
+ }
3993
4002
  for (const chain of (params == null ? void 0 : params.langserve) || []) {
3994
4003
  const remoteChain = new RemoteChain(chain);
3995
4004
  this.langserve.push(remoteChain.toAction());
@@ -4372,7 +4381,7 @@ function langGraphPlatformEndpoint(config2) {
4372
4381
  __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
4373
4382
  function resolveEndpointType(endpoint) {
4374
4383
  if (!endpoint.type) {
4375
- if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
4384
+ if ("deploymentUrl" in endpoint && "agents" in endpoint) {
4376
4385
  return EndpointType.LangGraphPlatform;
4377
4386
  } else {
4378
4387
  return EndpointType.CopilotKit;