@copilotkit/runtime 1.4.0-pre-1-4-0.12 → 1.4.0-pre-1-4-0.13

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 (42) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{chunk-JFLWUR62.mjs → chunk-AQBZWBJD.mjs} +2 -2
  3. package/dist/{chunk-JFIBAURX.mjs → chunk-CBZV4PPM.mjs} +2 -2
  4. package/dist/{chunk-YZ3VKKSM.mjs → chunk-NKGWZWKJ.mjs} +18 -18
  5. package/dist/chunk-NKGWZWKJ.mjs.map +1 -0
  6. package/dist/{chunk-TZ7RGXQ6.mjs → chunk-P4EZLCB6.mjs} +2 -2
  7. package/dist/{copilot-runtime-dbe5fa02.d.ts → copilot-runtime-d9ef5d8c.d.ts} +7 -7
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +19 -19
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +6 -6
  12. package/dist/lib/index.d.ts +1 -1
  13. package/dist/lib/index.js +19 -19
  14. package/dist/lib/index.js.map +1 -1
  15. package/dist/lib/index.mjs +6 -6
  16. package/dist/lib/integrations/index.d.ts +2 -2
  17. package/dist/lib/integrations/index.js +4 -4
  18. package/dist/lib/integrations/index.js.map +1 -1
  19. package/dist/lib/integrations/index.mjs +4 -4
  20. package/dist/lib/integrations/nest/index.d.ts +1 -1
  21. package/dist/lib/integrations/nest/index.js +4 -4
  22. package/dist/lib/integrations/nest/index.js.map +1 -1
  23. package/dist/lib/integrations/nest/index.mjs +2 -2
  24. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  25. package/dist/lib/integrations/node-express/index.js +4 -4
  26. package/dist/lib/integrations/node-express/index.js.map +1 -1
  27. package/dist/lib/integrations/node-express/index.mjs +2 -2
  28. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  29. package/dist/lib/integrations/node-http/index.js +4 -4
  30. package/dist/lib/integrations/node-http/index.js.map +1 -1
  31. package/dist/lib/integrations/node-http/index.mjs +1 -1
  32. package/package.json +4 -4
  33. package/src/agents/langgraph/event-source.ts +2 -2
  34. package/src/lib/runtime/copilot-runtime.ts +6 -6
  35. package/src/lib/runtime/remote-action-constructors.ts +7 -7
  36. package/src/lib/runtime/remote-actions.ts +9 -9
  37. package/src/lib/runtime/{remote-lg-cloud-action.ts → remote-lg-action.ts} +18 -18
  38. package/src/lib/telemetry-client.ts +3 -3
  39. package/dist/chunk-YZ3VKKSM.mjs.map +0 -1
  40. /package/dist/{chunk-JFLWUR62.mjs.map → chunk-AQBZWBJD.mjs.map} +0 -0
  41. /package/dist/{chunk-JFIBAURX.mjs.map → chunk-CBZV4PPM.mjs.map} +0 -0
  42. /package/dist/{chunk-TZ7RGXQ6.mjs.map → chunk-P4EZLCB6.mjs.map} +0 -0
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.4.0-pre-1-4-0.12",
12
+ "version": "1.4.0-pre-1-4-0.13",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -32,8 +32,8 @@
32
32
  "tsup": "^6.7.0",
33
33
  "typescript": "^5.2.3",
34
34
  "zod-to-json-schema": "^3.23.5",
35
- "eslint-config-custom": "1.4.0-pre-1-4-0.12",
36
- "tsconfig": "1.4.0-pre-1-4-0.12"
35
+ "eslint-config-custom": "1.4.0-pre-1-4-0.13",
36
+ "tsconfig": "1.4.0-pre-1-4-0.13"
37
37
  },
38
38
  "dependencies": {
39
39
  "@anthropic-ai/sdk": "^0.27.3",
@@ -58,7 +58,7 @@
58
58
  "rxjs": "^7.8.1",
59
59
  "type-graphql": "2.0.0-rc.1",
60
60
  "zod": "^3.23.3",
61
- "@copilotkit/shared": "1.4.0-pre-1-4-0.12"
61
+ "@copilotkit/shared": "1.4.0-pre-1-4-0.13"
62
62
  },
63
63
  "keywords": [
64
64
  "copilotkit",
@@ -37,7 +37,7 @@ export class RemoteLangGraphEventSource {
37
37
  scan(
38
38
  (acc, event) => {
39
39
  if (event.event === LangGraphEventTypes.OnChatModelStream) {
40
- // @ts-expect-error -- LangGraph Cloud implementation stores data outside of kwargs
40
+ // @ts-expect-error -- LangGraph Platform implementation stores data outside of kwargs
41
41
  const content = event.data?.chunk?.kwargs?.content ?? event.data?.chunk?.content;
42
42
 
43
43
  if (typeof content === "string") {
@@ -49,7 +49,7 @@ export class RemoteLangGraphEventSource {
49
49
  }
50
50
 
51
51
  const toolCallChunks =
52
- // @ts-expect-error -- LangGraph Cloud implementation stores data outside of kwargs
52
+ // @ts-expect-error -- LangGraph Platform implementation stores data outside of kwargs
53
53
  event.data?.chunk?.kwargs?.tool_call_chunks ?? event.data?.chunk?.tool_call_chunks;
54
54
 
55
55
  const toolCallMessageId =
@@ -27,7 +27,7 @@ import {
27
27
  setupRemoteActions,
28
28
  EndpointDefinition,
29
29
  CopilotKitEndpoint,
30
- LangGraphCloudEndpoint,
30
+ LangGraphPlatformEndpoint,
31
31
  } from "./remote-actions";
32
32
  import { GraphQLContext } from "../integrations/shared";
33
33
  import { AgentSessionInput } from "../../graphql/inputs/agent-session.input";
@@ -392,19 +392,19 @@ export function copilotKitEndpoint(config: Omit<CopilotKitEndpoint, "type">): Co
392
392
  };
393
393
  }
394
394
 
395
- export function langGraphCloudEndpoint(
396
- config: Omit<LangGraphCloudEndpoint, "type">,
397
- ): LangGraphCloudEndpoint {
395
+ export function langGraphPlatformEndpoint(
396
+ config: Omit<LangGraphPlatformEndpoint, "type">,
397
+ ): LangGraphPlatformEndpoint {
398
398
  return {
399
399
  ...config,
400
- type: EndpointType.LangGraphCloud,
400
+ type: EndpointType.LangGraphPlatform,
401
401
  };
402
402
  }
403
403
 
404
404
  export function resolveEndpointType(endpoint: EndpointDefinition) {
405
405
  if (!endpoint.type) {
406
406
  if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
407
- return EndpointType.LangGraphCloud;
407
+ return EndpointType.LangGraphPlatform;
408
408
  } else {
409
409
  return EndpointType.CopilotKit;
410
410
  }
@@ -3,7 +3,7 @@ import {
3
3
  CopilotKitEndpoint,
4
4
  LangGraphAgentHandlerParams,
5
5
  RemoteActionInfoResponse,
6
- LangGraphCloudEndpoint,
6
+ LangGraphPlatformEndpoint,
7
7
  } from "./remote-actions";
8
8
  import { GraphQLContext } from "../integrations";
9
9
  import { Logger } from "pino";
@@ -15,7 +15,7 @@ import telemetry from "../telemetry-client";
15
15
  import { RemoteLangGraphEventSource } from "../../agents/langgraph/event-source";
16
16
  import { Action } from "@copilotkit/shared";
17
17
  import { LangGraphEvent } from "../../agents/langgraph/events";
18
- import { execute } from "./remote-lg-cloud-action";
18
+ import { execute } from "./remote-lg-action";
19
19
 
20
20
  export function constructLGCRemoteAction({
21
21
  endpoint,
@@ -24,7 +24,7 @@ export function constructLGCRemoteAction({
24
24
  messages,
25
25
  agentStates,
26
26
  }: {
27
- endpoint: LangGraphCloudEndpoint;
27
+ endpoint: LangGraphPlatformEndpoint;
28
28
  graphqlContext: GraphQLContext;
29
29
  logger: Logger;
30
30
  messages: Message[];
@@ -41,11 +41,11 @@ export function constructLGCRemoteAction({
41
41
  threadId,
42
42
  nodeName,
43
43
  }: LangGraphAgentHandlerParams): Promise<Observable<RuntimeEvent>> => {
44
- logger.debug({ actionName: agent.name }, "Executing LangGraph Cloud agent");
44
+ logger.debug({ actionName: agent.name }, "Executing LangGraph Platform agent");
45
45
 
46
46
  telemetry.capture("oss.runtime.remote_action_executed", {
47
47
  agentExecution: true,
48
- type: "langgraph-cloud",
48
+ type: "langgraph-platform",
49
49
  agentsAmount: endpoint.agents.length,
50
50
  hashedLgcKey: createHash("sha256").update(endpoint.langsmithApiKey).digest("hex"),
51
51
  });
@@ -82,9 +82,9 @@ export function constructLGCRemoteAction({
82
82
  } catch (error) {
83
83
  logger.error(
84
84
  { url: endpoint.deploymentUrl, status: 500, body: error.message },
85
- "Failed to execute LangGraph Cloud agent",
85
+ "Failed to execute LangGraph Platform agent",
86
86
  );
87
- throw new Error("Failed to execute LangGraph Cloud agent");
87
+ throw new Error("Failed to execute LangGraph Platform agent");
88
88
  }
89
89
  },
90
90
  }));
@@ -12,11 +12,11 @@ import {
12
12
  createHeaders,
13
13
  } from "./remote-action-constructors";
14
14
 
15
- export type EndpointDefinition = CopilotKitEndpoint | LangGraphCloudEndpoint;
15
+ export type EndpointDefinition = CopilotKitEndpoint | LangGraphPlatformEndpoint;
16
16
 
17
17
  export enum EndpointType {
18
18
  CopilotKit = "copilotKit",
19
- LangGraphCloud = "langgraph-cloud",
19
+ LangGraphPlatform = "langgraph-platform",
20
20
  }
21
21
 
22
22
  export interface BaseEndpointDefinition<TActionType extends EndpointType> {
@@ -30,17 +30,17 @@ export interface CopilotKitEndpoint extends BaseEndpointDefinition<EndpointType.
30
30
  };
31
31
  }
32
32
 
33
- export interface LangGraphCloudAgent {
33
+ export interface LangGraphPlatformAgent {
34
34
  name: string;
35
35
  description: string;
36
36
  assistantId?: string;
37
37
  }
38
38
 
39
- export interface LangGraphCloudEndpoint
40
- extends BaseEndpointDefinition<EndpointType.LangGraphCloud> {
39
+ export interface LangGraphPlatformEndpoint
40
+ extends BaseEndpointDefinition<EndpointType.LangGraphPlatform> {
41
41
  deploymentUrl: string;
42
42
  langsmithApiKey: string;
43
- agents: LangGraphCloudAgent[];
43
+ agents: LangGraphPlatformAgent[];
44
44
  }
45
45
 
46
46
  export type RemoteActionInfoResponse = {
@@ -127,7 +127,7 @@ export async function setupRemoteActions({
127
127
 
128
128
  // Remove duplicates of remoteEndpointDefinitions.url
129
129
  const filtered = remoteEndpointDefinitions.filter((value, index, self) => {
130
- if (value.type === EndpointType.LangGraphCloud) {
130
+ if (value.type === EndpointType.LangGraphPlatform) {
131
131
  return value;
132
132
  }
133
133
  return index === self.findIndex((t: CopilotKitEndpoint) => t.url === value.url);
@@ -135,8 +135,8 @@ export async function setupRemoteActions({
135
135
 
136
136
  const result = await Promise.all(
137
137
  filtered.map(async (endpoint) => {
138
- // Check for properties that can distinguish LG cloud from other actions
139
- if (endpoint.type === EndpointType.LangGraphCloud) {
138
+ // Check for properties that can distinguish LG platform from other actions
139
+ if (endpoint.type === EndpointType.LangGraphPlatform) {
140
140
  return constructLGCRemoteAction({
141
141
  endpoint,
142
142
  messages,
@@ -3,7 +3,7 @@ import { createHash, randomUUID } from "node:crypto";
3
3
  import { parse as parsePartialJson } from "partial-json";
4
4
  import { Logger } from "pino";
5
5
  import { ActionInput } from "../../graphql/inputs/action.input";
6
- import { LangGraphCloudAgent, LangGraphCloudEndpoint } from "./remote-actions";
6
+ import { LangGraphPlatformAgent, LangGraphPlatformEndpoint } from "./remote-actions";
7
7
  import { CopilotRequestContextProperties } from "../integrations";
8
8
  import { Message, MessageType } from "../../graphql/types/converted";
9
9
  import { MessageRole } from "../../graphql/types/enums";
@@ -14,8 +14,8 @@ type State = Record<string, any>;
14
14
 
15
15
  type ExecutionAction = Pick<ActionInput, "name" | "description"> & { parameters: string };
16
16
 
17
- interface ExecutionArgs extends Omit<LangGraphCloudEndpoint, "agents"> {
18
- agent: LangGraphCloudAgent;
17
+ interface ExecutionArgs extends Omit<LangGraphPlatformEndpoint, "agents"> {
18
+ agent: LangGraphPlatformAgent;
19
19
  threadId: string;
20
20
  nodeName: string;
21
21
  messages: Message[];
@@ -25,14 +25,14 @@ interface ExecutionArgs extends Omit<LangGraphCloudEndpoint, "agents"> {
25
25
  logger: Logger;
26
26
  }
27
27
 
28
- // The following types are our own definition to the messages accepted by LangGraph cloud, enhanced with some of our extra data.
28
+ // The following types are our own definition to the messages accepted by LangGraph Platform, enhanced with some of our extra data.
29
29
  interface ToolCall {
30
30
  id: string;
31
31
  name: string;
32
32
  args: Record<string, unknown>;
33
33
  }
34
34
 
35
- type BaseLangGraphCloudMessage = Omit<
35
+ type BaseLangGraphPlatformMessage = Omit<
36
36
  Message,
37
37
  | "isResultMessage"
38
38
  | "isTextMessage"
@@ -47,19 +47,19 @@ type BaseLangGraphCloudMessage = Omit<
47
47
  type: MessageType;
48
48
  };
49
49
 
50
- interface LangGraphCloudResultMessage extends BaseLangGraphCloudMessage {
50
+ interface LangGraphPlatformResultMessage extends BaseLangGraphPlatformMessage {
51
51
  tool_call_id: string;
52
52
  name: string;
53
53
  }
54
54
 
55
- interface LangGraphCloudActionExecutionMessage extends BaseLangGraphCloudMessage {
55
+ interface LangGraphPlatformActionExecutionMessage extends BaseLangGraphPlatformMessage {
56
56
  tool_calls: ToolCall[];
57
57
  }
58
58
 
59
- type LangGraphCloudMessage =
60
- | LangGraphCloudActionExecutionMessage
61
- | LangGraphCloudResultMessage
62
- | BaseLangGraphCloudMessage;
59
+ type LangGraphPlatformMessage =
60
+ | LangGraphPlatformActionExecutionMessage
61
+ | LangGraphPlatformResultMessage
62
+ | BaseLangGraphPlatformMessage;
63
63
 
64
64
  export async function execute(args: ExecutionArgs): Promise<ReadableStream<Uint8Array>> {
65
65
  return new ReadableStream({
@@ -128,7 +128,7 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
128
128
  if (!assistantId) {
129
129
  console.error(`
130
130
  No agent found for the agent name specified in CopilotKit provider
131
- Please check your available agents or provide an agent ID in the LangGraph Cloud endpoint definition.\n
131
+ Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.\n
132
132
 
133
133
  These are the available agents: [${assistants.map((a) => `${a.name} (ID: ${a.assistant_id})`).join(", ")}]
134
134
  `);
@@ -439,7 +439,7 @@ class StreamingStateExtractor {
439
439
  // Start of Selection
440
440
  function langGraphDefaultMergeState(
441
441
  state: State,
442
- messages: LangGraphCloudMessage[],
442
+ messages: LangGraphPlatformMessage[],
443
443
  actions: ExecutionAction[],
444
444
  agentName: string,
445
445
  ): State {
@@ -449,7 +449,7 @@ function langGraphDefaultMergeState(
449
449
  }
450
450
 
451
451
  // merge with existing messages
452
- const mergedMessages: LangGraphCloudMessage[] = state.messages || [];
452
+ const mergedMessages: LangGraphPlatformMessage[] = state.messages || [];
453
453
  const existingMessageIds = new Set(mergedMessages.map((message) => message.id));
454
454
  const existingToolCallResults = new Set<string>();
455
455
 
@@ -515,7 +515,7 @@ function langGraphDefaultMergeState(
515
515
  }
516
516
 
517
517
  // try to auto-correct and log alignment issues
518
- const correctedMessages: LangGraphCloudMessage[] = [];
518
+ const correctedMessages: LangGraphPlatformMessage[] = [];
519
519
 
520
520
  for (let i = 0; i < mergedMessages.length; i++) {
521
521
  const currentMessage = mergedMessages[i];
@@ -586,7 +586,7 @@ function langGraphDefaultMergeState(
586
586
  };
587
587
  }
588
588
 
589
- function formatMessages(messages: Message[]): LangGraphCloudMessage[] {
589
+ function formatMessages(messages: Message[]): LangGraphPlatformMessage[] {
590
590
  return messages.map((message) => {
591
591
  if (message.isTextMessage() && message.role === "assistant") {
592
592
  return message;
@@ -609,7 +609,7 @@ function formatMessages(messages: Message[]): LangGraphCloudMessage[] {
609
609
  tool_calls: [toolCall],
610
610
  role: MessageRole.assistant,
611
611
  id: message.id,
612
- } satisfies LangGraphCloudActionExecutionMessage;
612
+ } satisfies LangGraphPlatformActionExecutionMessage;
613
613
  }
614
614
  if (message.isResultMessage()) {
615
615
  return {
@@ -619,7 +619,7 @@ function formatMessages(messages: Message[]): LangGraphCloudMessage[] {
619
619
  tool_call_id: message.actionExecutionId,
620
620
  name: message.actionName,
621
621
  role: MessageRole.tool,
622
- } satisfies LangGraphCloudResultMessage;
622
+ } satisfies LangGraphPlatformResultMessage;
623
623
  }
624
624
 
625
625
  throw new Error(`Unknown message type ${message.type}`);
@@ -1,5 +1,5 @@
1
1
  import { TelemetryClient } from "@copilotkit/shared";
2
- import { EndpointType, LangGraphCloudEndpoint } from "./runtime/remote-actions";
2
+ import { EndpointType, LangGraphPlatformEndpoint } from "./runtime/remote-actions";
3
3
  import { createHash } from "node:crypto";
4
4
  import { CopilotRuntime, resolveEndpointType } from "./runtime/copilot-runtime";
5
5
  import { RuntimeInstanceCreatedInfo } from "@copilotkit/shared/src/telemetry/events";
@@ -25,9 +25,9 @@ export function getRuntimeInstanceTelemetryInfo(
25
25
  };
26
26
  }
27
27
 
28
- if (endpointType === EndpointType.LangGraphCloud) {
28
+ if (endpointType === EndpointType.LangGraphPlatform) {
29
29
  // When type is resolved, recreating a const with casting of type
30
- const ep = endpoint as LangGraphCloudEndpoint;
30
+ const ep = endpoint as LangGraphPlatformEndpoint;
31
31
  info = {
32
32
  ...info,
33
33
  agentsAmount: ep.agents.length,