@copilotkit/runtime 1.5.15-next.7 → 1.5.15-next.8
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.
- package/CHANGELOG.md +9 -0
- package/__snapshots__/schema/schema.graphql +14 -1
- package/dist/{chunk-F4WILQ32.mjs → chunk-253HES6R.mjs} +2 -2
- package/dist/{chunk-BUEAVIXA.mjs → chunk-5EJIMI36.mjs} +2 -2
- package/dist/{chunk-OMS5GY45.mjs → chunk-HG6ZQKQW.mjs} +538 -416
- package/dist/chunk-HG6ZQKQW.mjs.map +1 -0
- package/dist/{chunk-65VBDTR4.mjs → chunk-R7GOSVTA.mjs} +2 -2
- package/dist/{copilot-runtime-a113045f.d.ts → copilot-runtime-3e7f1c7b.d.ts} +5 -4
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/{groq-adapter-248058e8.d.ts → groq-adapter-3b894689.d.ts} +1 -1
- package/dist/{index-a7f37670.d.ts → index-f6d1f30b.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1283 -1161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{langserve-9580bd66.d.ts → langserve-3a591089.d.ts} +11 -3
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +1283 -1161
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +4 -4
- package/dist/lib/integrations/index.js +493 -400
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +3 -3
- package/dist/lib/integrations/nest/index.js +493 -400
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +3 -3
- package/dist/lib/integrations/node-express/index.js +493 -400
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +3 -3
- package/dist/lib/integrations/node-http/index.js +493 -400
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.d.ts +4 -4
- package/package.json +2 -2
- package/src/agents/langgraph/event-source.ts +7 -0
- package/src/agents/langgraph/events.ts +11 -1
- package/src/graphql/inputs/meta-event.input.ts +4 -3
- package/src/graphql/resolvers/copilot.resolver.ts +44 -1
- package/src/graphql/types/copilot-response.type.ts +1 -3
- package/src/graphql/types/meta-events.type.ts +41 -1
- package/src/lib/runtime/remote-lg-action.ts +44 -19
- package/src/service-adapters/events.ts +8 -2
- package/dist/chunk-OMS5GY45.mjs.map +0 -1
- /package/dist/{chunk-F4WILQ32.mjs.map → chunk-253HES6R.mjs.map} +0 -0
- /package/dist/{chunk-BUEAVIXA.mjs.map → chunk-5EJIMI36.mjs.map} +0 -0
- /package/dist/{chunk-65VBDTR4.mjs.map → chunk-R7GOSVTA.mjs.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-
|
|
2
|
-
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-
|
|
3
|
-
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-
|
|
1
|
+
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-3a591089.js';
|
|
2
|
+
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-3a591089.js';
|
|
3
|
+
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-3b894689.js';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
|
-
import '../index-
|
|
5
|
+
import '../index-f6d1f30b.js';
|
|
6
6
|
import '../graphql/types/base/index.js';
|
|
7
7
|
import 'rxjs';
|
|
8
8
|
import '@copilotkit/shared';
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.5.15-next.
|
|
12
|
+
"version": "1.5.15-next.8",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -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.5.15-next.
|
|
61
|
+
"@copilotkit/shared": "1.5.15-next.8"
|
|
62
62
|
},
|
|
63
63
|
"keywords": [
|
|
64
64
|
"copilotkit",
|
|
@@ -136,6 +136,13 @@ export class RemoteLangGraphEventSource {
|
|
|
136
136
|
value: acc.event.value,
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
+
if (acc.event.event === LangGraphEventTypes.OnCopilotKitInterrupt) {
|
|
140
|
+
events.push({
|
|
141
|
+
type: RuntimeEventTypes.MetaEvent,
|
|
142
|
+
name: RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent,
|
|
143
|
+
data: acc.event.data,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
139
146
|
|
|
140
147
|
const responseMetadata = this.getResponseMetadata(acc.event);
|
|
141
148
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ActionExecutionMessage, ResultMessage, TextMessage } from "../../graphql/types/converted";
|
|
2
|
+
|
|
1
3
|
export enum LangGraphEventTypes {
|
|
2
4
|
OnChainStart = "on_chain_start",
|
|
3
5
|
OnChainStream = "on_chain_stream",
|
|
@@ -12,10 +14,12 @@ export enum LangGraphEventTypes {
|
|
|
12
14
|
OnCopilotKitEmitToolCall = "on_copilotkit_emit_tool_call",
|
|
13
15
|
OnCustomEvent = "on_custom_event",
|
|
14
16
|
OnInterrupt = "on_interrupt",
|
|
17
|
+
OnCopilotKitInterrupt = "on_copilotkit_interrupt",
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export enum MetaEventNames {
|
|
18
21
|
LangGraphInterruptEvent = "LangGraphInterruptEvent",
|
|
22
|
+
CopilotKitLangGraphInterruptEvent = "CopilotKitLangGraphInterruptEvent",
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export enum CustomEventNames {
|
|
@@ -335,6 +339,11 @@ interface LangGraphInterruptEvent {
|
|
|
335
339
|
value: string;
|
|
336
340
|
}
|
|
337
341
|
|
|
342
|
+
interface CopilotKitLangGraphInterruptEvent {
|
|
343
|
+
event: LangGraphEventTypes.OnCopilotKitInterrupt;
|
|
344
|
+
data: { value: string; messages: (TextMessage | ActionExecutionMessage | ResultMessage)[] };
|
|
345
|
+
}
|
|
346
|
+
|
|
338
347
|
export type LangGraphEvent =
|
|
339
348
|
| LangGraphOnChainStartEvent
|
|
340
349
|
| LangGraphOnChainStreamEvent
|
|
@@ -346,4 +355,5 @@ export type LangGraphEvent =
|
|
|
346
355
|
| LangGraphOnToolEndEvent
|
|
347
356
|
| LangGraphOnCopilotKitStateSyncEvent
|
|
348
357
|
| LangGraphOnCustomEvent
|
|
349
|
-
| LangGraphInterruptEvent
|
|
358
|
+
| LangGraphInterruptEvent
|
|
359
|
+
| CopilotKitLangGraphInterruptEvent;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Field, InputType } from "type-graphql";
|
|
2
2
|
import { MetaEventName } from "../types/meta-events.type";
|
|
3
|
+
import { MessageInput } from "./message.input";
|
|
3
4
|
|
|
4
5
|
@InputType()
|
|
5
6
|
export class MetaEventInput {
|
|
6
|
-
@Field(() => String)
|
|
7
|
-
type: "MetaEvent" = "MetaEvent";
|
|
8
|
-
|
|
9
7
|
@Field(() => MetaEventName)
|
|
10
8
|
name: MetaEventName;
|
|
11
9
|
|
|
@@ -14,4 +12,7 @@ export class MetaEventInput {
|
|
|
14
12
|
|
|
15
13
|
@Field(() => String, { nullable: true })
|
|
16
14
|
response?: string;
|
|
15
|
+
|
|
16
|
+
@Field(() => [MessageInput], { nullable: true })
|
|
17
|
+
messages?: MessageInput[];
|
|
17
18
|
}
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
} from "rxjs";
|
|
15
15
|
import { GenerateCopilotResponseInput } from "../inputs/generate-copilot-response.input";
|
|
16
16
|
import { CopilotResponse } from "../types/copilot-response.type";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
CopilotKitLangGraphInterruptEvent,
|
|
19
|
+
LangGraphInterruptEvent,
|
|
20
|
+
} from "../types/meta-events.type";
|
|
18
21
|
import { ActionInputAvailability, MessageRole } from "../types/enums";
|
|
19
22
|
import { Repeater } from "graphql-yoga";
|
|
20
23
|
import type { CopilotRequestContextProperties, GraphQLContext } from "../../lib/integrations";
|
|
@@ -25,6 +28,7 @@ import {
|
|
|
25
28
|
} from "../../service-adapters/events";
|
|
26
29
|
import {
|
|
27
30
|
FailedMessageStatus,
|
|
31
|
+
MessageStatusCode,
|
|
28
32
|
MessageStatusUnion,
|
|
29
33
|
SuccessMessageStatus,
|
|
30
34
|
} from "../types/message-status.type";
|
|
@@ -42,6 +46,7 @@ import {
|
|
|
42
46
|
ActionExecutionMessage,
|
|
43
47
|
AgentStateMessage,
|
|
44
48
|
Message,
|
|
49
|
+
MessageType,
|
|
45
50
|
ResultMessage,
|
|
46
51
|
TextMessage,
|
|
47
52
|
} from "../types/converted";
|
|
@@ -263,6 +268,44 @@ export class CopilotResolver {
|
|
|
263
268
|
}),
|
|
264
269
|
);
|
|
265
270
|
break;
|
|
271
|
+
case RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent:
|
|
272
|
+
push(
|
|
273
|
+
plainToInstance(CopilotKitLangGraphInterruptEvent, {
|
|
274
|
+
type: event.type,
|
|
275
|
+
name: event.name,
|
|
276
|
+
data: {
|
|
277
|
+
value:
|
|
278
|
+
typeof event.data.value === "string"
|
|
279
|
+
? event.data.value
|
|
280
|
+
: JSON.stringify(event.data.value),
|
|
281
|
+
messages: event.data.messages.map((message) => {
|
|
282
|
+
if (
|
|
283
|
+
message.type === "TextMessage" ||
|
|
284
|
+
("content" in message && "role" in message)
|
|
285
|
+
) {
|
|
286
|
+
return plainToInstance(TextMessage, {
|
|
287
|
+
id: message.id,
|
|
288
|
+
createdAt: new Date(),
|
|
289
|
+
content: [(message as TextMessage).content],
|
|
290
|
+
role: (message as TextMessage).role,
|
|
291
|
+
status: new SuccessMessageStatus(),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if ("arguments" in message) {
|
|
295
|
+
return plainToInstance(ActionExecutionMessage, {
|
|
296
|
+
name: message.name,
|
|
297
|
+
id: message.id,
|
|
298
|
+
arguments: [JSON.stringify(message.arguments)],
|
|
299
|
+
createdAt: new Date(),
|
|
300
|
+
status: new SuccessMessageStatus(),
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
throw new Error("Unknown message in metaEvents copilot resolver");
|
|
304
|
+
}),
|
|
305
|
+
},
|
|
306
|
+
}),
|
|
307
|
+
);
|
|
308
|
+
break;
|
|
266
309
|
}
|
|
267
310
|
},
|
|
268
311
|
error: (err) => {
|
|
@@ -3,7 +3,7 @@ import { MessageRole } from "./enums";
|
|
|
3
3
|
import { MessageStatusUnion } from "./message-status.type";
|
|
4
4
|
import { ResponseStatusUnion } from "./response-status.type";
|
|
5
5
|
import { ExtensionsResponse } from "./extensions-response.type";
|
|
6
|
-
import { BaseMetaEvent
|
|
6
|
+
import { BaseMetaEvent } from "./meta-events.type";
|
|
7
7
|
|
|
8
8
|
@InterfaceType({
|
|
9
9
|
resolveType(value) {
|
|
@@ -15,8 +15,6 @@ import { BaseMetaEvent, LangGraphInterruptEvent, MetaEventName } from "./meta-ev
|
|
|
15
15
|
return ResultMessageOutput;
|
|
16
16
|
} else if (value.hasOwnProperty("state")) {
|
|
17
17
|
return AgentStateMessageOutput;
|
|
18
|
-
} else if (value.name === MetaEventName.LangGraphInterruptEvent) {
|
|
19
|
-
return LangGraphInterruptEvent;
|
|
20
18
|
}
|
|
21
19
|
return undefined;
|
|
22
20
|
},
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { Field, InterfaceType, ObjectType, registerEnumType } from "type-graphql";
|
|
1
|
+
import { createUnionType, Field, InterfaceType, ObjectType, registerEnumType } from "type-graphql";
|
|
2
|
+
import {
|
|
3
|
+
ActionExecutionMessageOutput,
|
|
4
|
+
AgentStateMessageOutput,
|
|
5
|
+
BaseMessageOutput,
|
|
6
|
+
ResultMessageOutput,
|
|
7
|
+
TextMessageOutput,
|
|
8
|
+
} from "./copilot-response.type";
|
|
2
9
|
|
|
3
10
|
export enum MetaEventName {
|
|
4
11
|
LangGraphInterruptEvent = "LangGraphInterruptEvent",
|
|
12
|
+
CopilotKitLangGraphInterruptEvent = "CopilotKitLangGraphInterruptEvent",
|
|
5
13
|
}
|
|
6
14
|
|
|
7
15
|
registerEnumType(MetaEventName, {
|
|
@@ -9,6 +17,16 @@ registerEnumType(MetaEventName, {
|
|
|
9
17
|
description: "Meta event types",
|
|
10
18
|
});
|
|
11
19
|
|
|
20
|
+
@InterfaceType({
|
|
21
|
+
resolveType(value) {
|
|
22
|
+
if (value.name === MetaEventName.LangGraphInterruptEvent) {
|
|
23
|
+
return LangGraphInterruptEvent;
|
|
24
|
+
} else if (value.name === MetaEventName.CopilotKitLangGraphInterruptEvent) {
|
|
25
|
+
return CopilotKitLangGraphInterruptEvent;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
},
|
|
29
|
+
})
|
|
12
30
|
@InterfaceType()
|
|
13
31
|
export abstract class BaseMetaEvent {
|
|
14
32
|
@Field(() => String)
|
|
@@ -18,6 +36,15 @@ export abstract class BaseMetaEvent {
|
|
|
18
36
|
name: MetaEventName;
|
|
19
37
|
}
|
|
20
38
|
|
|
39
|
+
@ObjectType()
|
|
40
|
+
export class CopilotKitLangGraphInterruptEventData {
|
|
41
|
+
@Field(() => String)
|
|
42
|
+
value: string;
|
|
43
|
+
|
|
44
|
+
@Field(() => [BaseMessageOutput])
|
|
45
|
+
messages: (typeof BaseMessageOutput)[];
|
|
46
|
+
}
|
|
47
|
+
|
|
21
48
|
@ObjectType({ implements: BaseMetaEvent })
|
|
22
49
|
export class LangGraphInterruptEvent {
|
|
23
50
|
@Field(() => MetaEventName)
|
|
@@ -29,3 +56,16 @@ export class LangGraphInterruptEvent {
|
|
|
29
56
|
@Field(() => String, { nullable: true })
|
|
30
57
|
response?: string;
|
|
31
58
|
}
|
|
59
|
+
|
|
60
|
+
@ObjectType({ implements: BaseMetaEvent })
|
|
61
|
+
export class CopilotKitLangGraphInterruptEvent {
|
|
62
|
+
@Field(() => MetaEventName)
|
|
63
|
+
name: MetaEventName.CopilotKitLangGraphInterruptEvent =
|
|
64
|
+
MetaEventName.CopilotKitLangGraphInterruptEvent;
|
|
65
|
+
|
|
66
|
+
@Field(() => CopilotKitLangGraphInterruptEventData)
|
|
67
|
+
data: CopilotKitLangGraphInterruptEventData;
|
|
68
|
+
|
|
69
|
+
@Field(() => String, { nullable: true })
|
|
70
|
+
response?: string;
|
|
71
|
+
}
|
|
@@ -66,6 +66,8 @@ type LangGraphPlatformMessage =
|
|
|
66
66
|
| LangGraphPlatformResultMessage
|
|
67
67
|
| BaseLangGraphPlatformMessage;
|
|
68
68
|
|
|
69
|
+
let activeInterruptEvent = false;
|
|
70
|
+
|
|
69
71
|
export async function execute(args: ExecutionArgs): Promise<ReadableStream<Uint8Array>> {
|
|
70
72
|
return new ReadableStream({
|
|
71
73
|
async start(controller) {
|
|
@@ -144,11 +146,25 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
144
146
|
}
|
|
145
147
|
state = langGraphDefaultMergeState(state, formattedMessages, actions, name);
|
|
146
148
|
|
|
147
|
-
const
|
|
149
|
+
const streamInput = mode === "start" ? state : null;
|
|
150
|
+
|
|
151
|
+
const payload: RunsStreamPayload = {
|
|
152
|
+
input: streamInput,
|
|
153
|
+
streamMode: ["events", "values", "updates"],
|
|
154
|
+
command: undefined,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const lgInterruptMetaEvent = metaEvents?.find(
|
|
148
158
|
(ev) => ev.name === MetaEventName.LangGraphInterruptEvent,
|
|
149
159
|
);
|
|
160
|
+
if (activeInterruptEvent && !lgInterruptMetaEvent) {
|
|
161
|
+
payload.command = { resume: formattedMessages[formattedMessages.length - 1] };
|
|
162
|
+
}
|
|
163
|
+
if (lgInterruptMetaEvent?.response) {
|
|
164
|
+
payload.command = { resume: lgInterruptMetaEvent.response };
|
|
165
|
+
}
|
|
150
166
|
|
|
151
|
-
if (mode === "continue" && !
|
|
167
|
+
if (mode === "continue" && !activeInterruptEvent) {
|
|
152
168
|
await client.threads.updateState(threadId, { values: state, asNode: nodeName });
|
|
153
169
|
}
|
|
154
170
|
|
|
@@ -181,7 +197,6 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
181
197
|
const assistantId = retrievedAssistant.assistant_id;
|
|
182
198
|
|
|
183
199
|
const graphInfo = await client.assistants.getGraph(assistantId);
|
|
184
|
-
const streamInput = mode === "start" ? state : null;
|
|
185
200
|
|
|
186
201
|
let streamingStateExtractor = new StreamingStateExtractor([]);
|
|
187
202
|
let prevNodeName = null;
|
|
@@ -189,15 +204,6 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
189
204
|
let shouldExit = false;
|
|
190
205
|
let externalRunId = null;
|
|
191
206
|
|
|
192
|
-
const payload: RunsStreamPayload = {
|
|
193
|
-
input: streamInput,
|
|
194
|
-
streamMode: ["events", "values", "updates"],
|
|
195
|
-
command: undefined,
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
if (lgInterruptEvent?.response) {
|
|
199
|
-
payload.command = { resume: lgInterruptEvent.response };
|
|
200
|
-
}
|
|
201
207
|
const streamResponse = client.runs.stream(threadId, assistantId, payload);
|
|
202
208
|
|
|
203
209
|
const emit = (message: string) => controller.enqueue(new TextEncoder().encode(message));
|
|
@@ -208,6 +214,7 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
208
214
|
// Therefore, this value should either hold null, or the only edition of state that should be used.
|
|
209
215
|
let manuallyEmittedState = null;
|
|
210
216
|
|
|
217
|
+
activeInterruptEvent = false;
|
|
211
218
|
try {
|
|
212
219
|
telemetry.capture("oss.runtime.agent_execution_stream_started", {
|
|
213
220
|
hashedLgcKey: streamInfo.hashedLgcKey,
|
|
@@ -219,13 +226,31 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
|
|
|
219
226
|
throw new Error(`Error event thrown: ${chunk.data.message}`);
|
|
220
227
|
}
|
|
221
228
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
const interruptEvents = chunk.data?.__interrupt__;
|
|
230
|
+
if (interruptEvents?.length) {
|
|
231
|
+
activeInterruptEvent = true;
|
|
232
|
+
const interruptValue = interruptEvents?.[0].value;
|
|
233
|
+
if (
|
|
234
|
+
typeof interruptValue != "string" &&
|
|
235
|
+
"__copilotkit_interrupt_value__" in interruptValue
|
|
236
|
+
) {
|
|
237
|
+
emit(
|
|
238
|
+
JSON.stringify({
|
|
239
|
+
event: LangGraphEventTypes.OnCopilotKitInterrupt,
|
|
240
|
+
data: {
|
|
241
|
+
value: interruptValue.__copilotkit_interrupt_value__,
|
|
242
|
+
messages: langchainMessagesToCopilotKit(interruptValue.__copilotkit_messages__),
|
|
243
|
+
},
|
|
244
|
+
}) + "\n",
|
|
245
|
+
);
|
|
246
|
+
} else {
|
|
247
|
+
emit(
|
|
248
|
+
JSON.stringify({
|
|
249
|
+
event: LangGraphEventTypes.OnInterrupt,
|
|
250
|
+
value: interruptValue,
|
|
251
|
+
}) + "\n",
|
|
252
|
+
);
|
|
253
|
+
}
|
|
229
254
|
continue;
|
|
230
255
|
}
|
|
231
256
|
if (chunk.event === "updates") continue;
|
|
@@ -16,7 +16,7 @@ import { GuardrailsResult } from "../graphql/types/guardrails-result.type";
|
|
|
16
16
|
import telemetry from "../lib/telemetry-client";
|
|
17
17
|
import { isLangGraphAgentAction } from "../lib/runtime/remote-actions";
|
|
18
18
|
import { ActionInput } from "../graphql/inputs/action.input";
|
|
19
|
-
import { ActionExecutionMessage, ResultMessage } from "../graphql/types/converted";
|
|
19
|
+
import { ActionExecutionMessage, ResultMessage, TextMessage } from "../graphql/types/converted";
|
|
20
20
|
import { plainToInstance } from "class-transformer";
|
|
21
21
|
|
|
22
22
|
export enum RuntimeEventTypes {
|
|
@@ -34,6 +34,7 @@ export enum RuntimeEventTypes {
|
|
|
34
34
|
export enum RuntimeMetaEventName {
|
|
35
35
|
LangGraphInterruptEvent = "LangGraphInterruptEvent",
|
|
36
36
|
LangGraphInterruptResumeEvent = "LangGraphInterruptResumeEvent",
|
|
37
|
+
CopilotKitLangGraphInterruptEvent = "CopilotKitLangGraphInterruptEvent",
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export type RunTimeMetaEvent =
|
|
@@ -42,10 +43,15 @@ export type RunTimeMetaEvent =
|
|
|
42
43
|
name: RuntimeMetaEventName.LangGraphInterruptEvent;
|
|
43
44
|
value: string;
|
|
44
45
|
}
|
|
46
|
+
| {
|
|
47
|
+
type: RuntimeEventTypes.MetaEvent;
|
|
48
|
+
name: RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent;
|
|
49
|
+
data: { value: string; messages: (TextMessage | ActionExecutionMessage | ResultMessage)[] };
|
|
50
|
+
}
|
|
45
51
|
| {
|
|
46
52
|
type: RuntimeEventTypes.MetaEvent;
|
|
47
53
|
name: RuntimeMetaEventName.LangGraphInterruptResumeEvent;
|
|
48
|
-
|
|
54
|
+
data: string;
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
export type RuntimeEvent =
|