@copilotkit/runtime 1.6.0-next.8 → 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 +45 -0
  2. package/dist/{chunk-CC5KHDCV.mjs → chunk-2RP2NR4F.mjs} +2 -2
  3. package/dist/{chunk-C7VKUXWC.mjs → chunk-DUW72ZZB.mjs} +25 -12
  4. package/dist/chunk-DUW72ZZB.mjs.map +1 -0
  5. package/dist/{chunk-LR7HA4X5.mjs → chunk-MPI4JZZR.mjs} +2 -2
  6. package/dist/{chunk-DI2VJM3I.mjs → chunk-WUMAYJP3.mjs} +2 -2
  7. package/dist/index.js +24 -11
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +24 -11
  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 +21 -5
  27. package/src/lib/runtime/copilot-runtime.ts +10 -4
  28. package/src/lib/telemetry-client.ts +3 -1
  29. package/dist/chunk-C7VKUXWC.mjs.map +0 -1
  30. /package/dist/{chunk-CC5KHDCV.mjs.map → chunk-2RP2NR4F.mjs.map} +0 -0
  31. /package/dist/{chunk-LR7HA4X5.mjs.map → chunk-MPI4JZZR.mjs.map} +0 -0
  32. /package/dist/{chunk-DI2VJM3I.mjs.map → chunk-WUMAYJP3.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fea916f: - feat: support input and output schema of langgraph
8
+ - docs: add input output schema docs
9
+ - 7d061d9: - feat(configurable): execute langgraph with user config
10
+
11
+ ### Patch Changes
12
+
13
+ - 543f703: - fix: refrain from processing same tool end several times
14
+ - fix: do not register runtime set action when there are remote endpoints
15
+ - 090203d: - fix: use tryMap method to filter out possibly invalid items
16
+ - 1bb9ca2: - fix(coagents): don't fail when LangSmith API key is missing
17
+ - fix(coagents): don't check for langsmithApiKey in resolveEndpointType
18
+ - 4ddb6d2: - fix: add class validator to dependencies
19
+ - d07f49c: - fix(runtime): fix execution of runtime set backend action handlers
20
+ - 45a3e10: - feat: support latest openai api
21
+ - chore: update all openai dependencies to use latest
22
+ - feat: update adapters using openai API
23
+ - 68f7b65: - handle parsing in fail-safe fashion
24
+ - Updated dependencies [090203d]
25
+ - @copilotkit/shared@1.6.0
26
+
27
+ ## 1.6.0-next.11
28
+
29
+ ### Patch Changes
30
+
31
+ - @copilotkit/shared@1.6.0-next.11
32
+
33
+ ## 1.6.0-next.10
34
+
35
+ ### Patch Changes
36
+
37
+ - 543f703: - fix: refrain from processing same tool end several times
38
+ - fix: do not register runtime set action when there are remote endpoints
39
+ - @copilotkit/shared@1.6.0-next.10
40
+
41
+ ## 1.6.0-next.9
42
+
43
+ ### Patch Changes
44
+
45
+ - d07f49c: - fix(runtime): fix execution of runtime set backend action handlers
46
+ - @copilotkit/shared@1.6.0-next.9
47
+
3
48
  ## 1.6.0-next.8
4
49
 
5
50
  ### Minor Changes
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-C7VKUXWC.mjs";
5
+ } from "./chunk-DUW72ZZB.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-CC5KHDCV.mjs.map
25
+ //# sourceMappingURL=chunk-2RP2NR4F.mjs.map
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  publishConfig: {
40
40
  access: "public"
41
41
  },
42
- version: "1.6.0-next.8",
42
+ version: "1.6.0",
43
43
  sideEffects: false,
44
44
  main: "./dist/index.js",
45
45
  module: "./dist/index.mjs",
@@ -1499,10 +1499,16 @@ var RemoteLangGraphEventSource = class {
1499
1499
  acc.lastMessageId = this.getCurrentMessageId(event) ?? acc.lastMessageId;
1500
1500
  const toolCallChunks = this.getCurrentToolCallChunks(event) ?? [];
1501
1501
  const responseMetadata = this.getResponseMetadata(event);
1502
+ const toolCallCheck = toolCallChunks && toolCallChunks.length > 0;
1503
+ let isToolCallEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls";
1502
1504
  acc.isToolCallStart = toolCallChunks.some((chunk) => chunk.name && chunk.id);
1503
1505
  acc.isMessageStart = prevMessageId !== acc.lastMessageId && !acc.isToolCallStart;
1504
- acc.isToolCall = toolCallChunks && toolCallChunks.length > 0;
1505
- acc.isToolCallEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls";
1506
+ let previousRoundHadToolCall = acc.isToolCall;
1507
+ acc.isToolCall = toolCallCheck;
1508
+ if (previousRoundHadToolCall && !toolCallCheck) {
1509
+ isToolCallEnd = true;
1510
+ }
1511
+ acc.isToolCallEnd = isToolCallEnd;
1506
1512
  acc.isMessageEnd = (responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop";
1507
1513
  ({ name: acc.lastToolCallName, id: acc.lastToolCallId } = toolCallChunks.find((chunk) => chunk.name && chunk.id) ?? {
1508
1514
  name: acc.lastToolCallName,
@@ -1522,7 +1528,8 @@ var RemoteLangGraphEventSource = class {
1522
1528
  lastMessageId: null,
1523
1529
  lastToolCallId: null,
1524
1530
  lastToolCallName: null,
1525
- currentContent: null
1531
+ currentContent: null,
1532
+ processedToolCallIds: /* @__PURE__ */ new Set()
1526
1533
  }), mergeMap((acc) => {
1527
1534
  const events = [];
1528
1535
  let shouldEmitMessages = true;
@@ -1550,13 +1557,13 @@ var RemoteLangGraphEventSource = class {
1550
1557
  });
1551
1558
  }
1552
1559
  const responseMetadata = this.getResponseMetadata(acc.event);
1553
- if ((responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls" && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
1560
+ if (acc.isToolCallEnd && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName) && acc.lastToolCallId && !acc.processedToolCallIds.has(acc.lastToolCallId)) {
1561
+ acc.processedToolCallIds.add(acc.lastToolCallId);
1554
1562
  events.push({
1555
1563
  type: RuntimeEventTypes.ActionExecutionEnd,
1556
1564
  actionExecutionId: acc.lastToolCallId
1557
1565
  });
1558
- }
1559
- if ((responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop" && shouldEmitMessages) {
1566
+ } else if ((responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "stop" && shouldEmitMessages) {
1560
1567
  events.push({
1561
1568
  type: RuntimeEventTypes.TextMessageEnd,
1562
1569
  messageId: acc.lastMessageId
@@ -1618,6 +1625,7 @@ var RemoteLangGraphEventSource = class {
1618
1625
  parentMessageId: acc.lastMessageId
1619
1626
  });
1620
1627
  } else if (acc.isMessageStart && shouldEmitMessages) {
1628
+ acc.processedToolCallIds.clear();
1621
1629
  events.push({
1622
1630
  type: RuntimeEventTypes.TextMessageStart,
1623
1631
  messageId: acc.lastMessageId
@@ -2689,7 +2697,12 @@ var CopilotRuntime = class {
2689
2697
  delegateAgentProcessingToServiceAdapter;
2690
2698
  constructor(params) {
2691
2699
  var _a, _b;
2692
- this.actions = (params == null ? void 0 : params.actions) || [];
2700
+ if ((params == null ? void 0 : params.actions) && (params == null ? void 0 : params.remoteEndpoints)) {
2701
+ console.warn("Actions set in runtime instance will be ignored when remote endpoints are set");
2702
+ this.actions = [];
2703
+ } else {
2704
+ this.actions = (params == null ? void 0 : params.actions) || [];
2705
+ }
2693
2706
  for (const chain of (params == null ? void 0 : params.langserve) || []) {
2694
2707
  const remoteChain = new RemoteChain(chain);
2695
2708
  this.langserve.push(remoteChain.toAction());
@@ -3001,7 +3014,7 @@ please use an LLM adapter instead.`
3001
3014
  threadId,
3002
3015
  runId: void 0,
3003
3016
  eventSource,
3004
- serverSideActions: [],
3017
+ serverSideActions,
3005
3018
  actionInputsWithoutAgents: allAvailableActions
3006
3019
  };
3007
3020
  } catch (error) {
@@ -3072,7 +3085,7 @@ function langGraphPlatformEndpoint(config) {
3072
3085
  __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
3073
3086
  function resolveEndpointType(endpoint) {
3074
3087
  if (!endpoint.type) {
3075
- if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
3088
+ if ("deploymentUrl" in endpoint && "agents" in endpoint) {
3076
3089
  return EndpointType.LangGraphPlatform;
3077
3090
  } else {
3078
3091
  return EndpointType.CopilotKit;
@@ -3108,7 +3121,7 @@ function getRuntimeInstanceTelemetryInfo(runtime) {
3108
3121
  info = {
3109
3122
  ...info,
3110
3123
  agentsAmount: ep.agents.length,
3111
- hashedKey: createHash3("sha256").update(ep.langsmithApiKey).digest("hex")
3124
+ hashedKey: ep.langsmithApiKey ? createHash3("sha256").update(ep.langsmithApiKey).digest("hex") : null
3112
3125
  };
3113
3126
  }
3114
3127
  return info;
@@ -4292,4 +4305,4 @@ export {
4292
4305
  getCommonConfig,
4293
4306
  copilotRuntimeNodeHttpEndpoint
4294
4307
  };
4295
- //# sourceMappingURL=chunk-C7VKUXWC.mjs.map
4308
+ //# sourceMappingURL=chunk-DUW72ZZB.mjs.map