@copilotkit/runtime 1.4.0-pre-1-4-0.13 → 1.4.0-pre.16
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 +32 -0
- package/dist/{chunk-AQBZWBJD.mjs → chunk-2MEJMEYX.mjs} +2 -2
- package/dist/{chunk-CBZV4PPM.mjs → chunk-5HOOAMQI.mjs} +2 -2
- package/dist/{chunk-P4EZLCB6.mjs → chunk-BNSMQJEH.mjs} +2 -2
- package/dist/{chunk-NKGWZWKJ.mjs → chunk-SQKHB55U.mjs} +33 -76
- package/dist/chunk-SQKHB55U.mjs.map +1 -0
- package/dist/{chunk-56IQ6PGC.mjs → chunk-ZOC3UIQP.mjs} +56 -213
- package/dist/chunk-ZOC3UIQP.mjs.map +1 -0
- package/dist/{copilot-runtime-d9ef5d8c.d.ts → copilot-runtime-335a610d.d.ts} +1 -1
- package/dist/{groq-adapter-192d2413.d.ts → groq-adapter-b6c2b7ec.d.ts} +6 -16
- package/dist/index.d.ts +3 -3
- package/dist/index.js +85 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{langserve-878c62b9.d.ts → langserve-cc06e76e.d.ts} +9 -45
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +79 -264
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +3 -11
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.d.ts +2 -2
- package/dist/lib/integrations/nest/index.js +3 -11
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.d.ts +2 -2
- package/dist/lib/integrations/node-express/index.js +3 -11
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +3 -11
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.d.ts +4 -6
- package/dist/service-adapters/index.js +55 -212
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +4 -4
- package/src/agents/langgraph/event-source.ts +0 -12
- package/src/graphql/resolvers/copilot.resolver.ts +2 -28
- package/src/service-adapters/anthropic/anthropic-adapter.ts +7 -18
- package/src/service-adapters/events.ts +35 -73
- package/src/service-adapters/experimental/ollama/ollama-adapter.ts +3 -7
- package/src/service-adapters/google/google-genai-adapter.ts +1 -3
- package/src/service-adapters/groq/groq-adapter.ts +9 -25
- package/src/service-adapters/langchain/langchain-adapter.ts +1 -3
- package/src/service-adapters/langchain/utils.ts +31 -47
- package/src/service-adapters/openai/openai-adapter.ts +11 -27
- package/src/service-adapters/openai/openai-assistant-adapter.ts +9 -24
- package/src/service-adapters/unify/unify-adapter.ts +11 -28
- package/dist/chunk-56IQ6PGC.mjs.map +0 -1
- package/dist/chunk-NKGWZWKJ.mjs.map +0 -1
- /package/dist/{chunk-AQBZWBJD.mjs.map → chunk-2MEJMEYX.mjs.map} +0 -0
- /package/dist/{chunk-CBZV4PPM.mjs.map → chunk-5HOOAMQI.mjs.map} +0 -0
- /package/dist/{chunk-P4EZLCB6.mjs.map → chunk-BNSMQJEH.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
+
## 1.4.0-pre.16
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- lgc and lgjs alpha
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @copilotkit/shared@1.4.0-pre.16
|
|
13
|
+
|
|
14
|
+
## 1.4.0-pre.15
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- No changes
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @copilotkit/shared@1.4.0-pre.15
|
|
21
|
+
|
|
22
|
+
## 1.4.0-pre-1-4-0.14
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- lgc & lgjs alpha release
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- a5efccd: Revert rxjs changes
|
|
31
|
+
- Updated dependencies [a5efccd]
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
- @copilotkit/shared@1.4.0-pre-1-4-0.14
|
|
34
|
+
|
|
3
35
|
## 1.4.0-pre-1-4-0.13
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SQKHB55U.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
config,
|
|
78
78
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-2MEJMEYX.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SQKHB55U.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNodeExpressEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-5HOOAMQI.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SQKHB55U.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNestEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-BNSMQJEH.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RemoteChain,
|
|
3
3
|
streamLangChainResponse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZOC3UIQP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
GuardrailsValidationFailureResponse,
|
|
7
7
|
MessageStreamInterruptedResponse,
|
|
@@ -37,7 +37,7 @@ var require_package = __commonJS({
|
|
|
37
37
|
publishConfig: {
|
|
38
38
|
access: "public"
|
|
39
39
|
},
|
|
40
|
-
version: "1.4.0-pre
|
|
40
|
+
version: "1.4.0-pre.16",
|
|
41
41
|
sideEffects: false,
|
|
42
42
|
main: "./dist/index.js",
|
|
43
43
|
module: "./dist/index.mjs",
|
|
@@ -122,7 +122,7 @@ import { buildSchemaSync } from "type-graphql";
|
|
|
122
122
|
|
|
123
123
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
124
124
|
import { Arg, Ctx, Mutation, Query, Resolver } from "type-graphql";
|
|
125
|
-
import { ReplaySubject as ReplaySubject3, Subject,
|
|
125
|
+
import { ReplaySubject as ReplaySubject3, Subject, finalize, firstValueFrom as firstValueFrom2, shareReplay, skipWhile, take, takeWhile, tap } from "rxjs";
|
|
126
126
|
|
|
127
127
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
128
128
|
import { Field as Field9, InputType as InputType9 } from "type-graphql";
|
|
@@ -1143,14 +1143,12 @@ var RemoteLangGraphEventSource = class {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
if (eventWithState.prevToolCallMessageId !== null && eventWithState.prevToolCallMessageId !== eventWithState.toolCallMessageId && this.shouldEmitToolCall(shouldEmitToolCalls, eventWithState.toolCallName)) {
|
|
1145
1145
|
events.push({
|
|
1146
|
-
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1147
|
-
actionExecutionId: eventWithState.prevToolCallMessageId
|
|
1146
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1148
1147
|
});
|
|
1149
1148
|
}
|
|
1150
1149
|
if (eventWithState.prevMessageId !== null && eventWithState.prevMessageId !== eventWithState.messageId && shouldEmitMessages) {
|
|
1151
1150
|
events.push({
|
|
1152
|
-
type: RuntimeEventTypes.TextMessageEnd
|
|
1153
|
-
messageId: eventWithState.prevMessageId
|
|
1151
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1154
1152
|
});
|
|
1155
1153
|
}
|
|
1156
1154
|
switch (eventWithState.event.event) {
|
|
@@ -1162,12 +1160,10 @@ var RemoteLangGraphEventSource = class {
|
|
|
1162
1160
|
});
|
|
1163
1161
|
events.push({
|
|
1164
1162
|
type: RuntimeEventTypes.TextMessageContent,
|
|
1165
|
-
messageId: eventWithState.event.data.message_id,
|
|
1166
1163
|
content: eventWithState.event.data.message
|
|
1167
1164
|
});
|
|
1168
1165
|
events.push({
|
|
1169
|
-
type: RuntimeEventTypes.TextMessageEnd
|
|
1170
|
-
messageId: eventWithState.event.data.message_id
|
|
1166
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1171
1167
|
});
|
|
1172
1168
|
} else if (eventWithState.event.name === CustomEventNames.CopilotKitManuallyEmitToolCall) {
|
|
1173
1169
|
events.push({
|
|
@@ -1177,12 +1173,10 @@ var RemoteLangGraphEventSource = class {
|
|
|
1177
1173
|
});
|
|
1178
1174
|
events.push({
|
|
1179
1175
|
type: RuntimeEventTypes.ActionExecutionArgs,
|
|
1180
|
-
actionExecutionId: eventWithState.event.data.id,
|
|
1181
1176
|
args: JSON.stringify(eventWithState.event.data.args)
|
|
1182
1177
|
});
|
|
1183
1178
|
events.push({
|
|
1184
|
-
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1185
|
-
actionExecutionId: eventWithState.event.data.id
|
|
1179
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1186
1180
|
});
|
|
1187
1181
|
}
|
|
1188
1182
|
break;
|
|
@@ -1226,7 +1220,6 @@ var RemoteLangGraphEventSource = class {
|
|
|
1226
1220
|
if (this.shouldEmitToolCall(shouldEmitToolCalls, eventWithState.toolCallName)) {
|
|
1227
1221
|
events.push({
|
|
1228
1222
|
type: RuntimeEventTypes.ActionExecutionArgs,
|
|
1229
|
-
actionExecutionId: eventWithState.toolCallMessageId,
|
|
1230
1223
|
args
|
|
1231
1224
|
});
|
|
1232
1225
|
}
|
|
@@ -1234,7 +1227,6 @@ var RemoteLangGraphEventSource = class {
|
|
|
1234
1227
|
if (shouldEmitMessages) {
|
|
1235
1228
|
events.push({
|
|
1236
1229
|
type: RuntimeEventTypes.TextMessageContent,
|
|
1237
|
-
messageId: eventWithState.messageId,
|
|
1238
1230
|
content
|
|
1239
1231
|
});
|
|
1240
1232
|
}
|
|
@@ -1247,14 +1239,12 @@ var RemoteLangGraphEventSource = class {
|
|
|
1247
1239
|
const events = [];
|
|
1248
1240
|
if (lastEventWithState == null ? void 0 : lastEventWithState.messageId) {
|
|
1249
1241
|
events.push({
|
|
1250
|
-
type: RuntimeEventTypes.TextMessageEnd
|
|
1251
|
-
messageId: lastEventWithState.messageId
|
|
1242
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1252
1243
|
});
|
|
1253
1244
|
}
|
|
1254
1245
|
if (lastEventWithState == null ? void 0 : lastEventWithState.toolCallMessageId) {
|
|
1255
1246
|
events.push({
|
|
1256
|
-
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1257
|
-
actionExecutionId: lastEventWithState.toolCallMessageId
|
|
1247
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1258
1248
|
});
|
|
1259
1249
|
}
|
|
1260
1250
|
const messageId = randomId();
|
|
@@ -1264,12 +1254,10 @@ var RemoteLangGraphEventSource = class {
|
|
|
1264
1254
|
});
|
|
1265
1255
|
events.push({
|
|
1266
1256
|
type: RuntimeEventTypes.TextMessageContent,
|
|
1267
|
-
messageId,
|
|
1268
1257
|
content: "\u274C An error occurred. Please try again."
|
|
1269
1258
|
});
|
|
1270
1259
|
events.push({
|
|
1271
|
-
type: RuntimeEventTypes.TextMessageEnd
|
|
1272
|
-
messageId
|
|
1260
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1273
1261
|
});
|
|
1274
1262
|
return events;
|
|
1275
1263
|
}));
|
|
@@ -2380,71 +2368,52 @@ var RuntimeEventSubject = class extends ReplaySubject2 {
|
|
|
2380
2368
|
constructor() {
|
|
2381
2369
|
super();
|
|
2382
2370
|
}
|
|
2383
|
-
sendTextMessageStart(
|
|
2371
|
+
sendTextMessageStart(messageId) {
|
|
2384
2372
|
this.next({
|
|
2385
2373
|
type: "TextMessageStart",
|
|
2386
2374
|
messageId
|
|
2387
2375
|
});
|
|
2388
2376
|
}
|
|
2389
|
-
sendTextMessageContent(
|
|
2377
|
+
sendTextMessageContent(content) {
|
|
2390
2378
|
this.next({
|
|
2391
2379
|
type: "TextMessageContent",
|
|
2392
|
-
content
|
|
2393
|
-
messageId
|
|
2380
|
+
content
|
|
2394
2381
|
});
|
|
2395
2382
|
}
|
|
2396
|
-
sendTextMessageEnd(
|
|
2383
|
+
sendTextMessageEnd() {
|
|
2397
2384
|
this.next({
|
|
2398
|
-
type: "TextMessageEnd"
|
|
2399
|
-
messageId
|
|
2385
|
+
type: "TextMessageEnd"
|
|
2400
2386
|
});
|
|
2401
2387
|
}
|
|
2402
2388
|
sendTextMessage(messageId, content) {
|
|
2403
|
-
this.sendTextMessageStart(
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
this.sendTextMessageContent({
|
|
2407
|
-
messageId,
|
|
2408
|
-
content
|
|
2409
|
-
});
|
|
2410
|
-
this.sendTextMessageEnd({
|
|
2411
|
-
messageId
|
|
2412
|
-
});
|
|
2389
|
+
this.sendTextMessageStart(messageId);
|
|
2390
|
+
this.sendTextMessageContent(content);
|
|
2391
|
+
this.sendTextMessageEnd();
|
|
2413
2392
|
}
|
|
2414
|
-
sendActionExecutionStart(
|
|
2393
|
+
sendActionExecutionStart(actionExecutionId, actionName) {
|
|
2415
2394
|
this.next({
|
|
2416
2395
|
type: "ActionExecutionStart",
|
|
2417
2396
|
actionExecutionId,
|
|
2418
2397
|
actionName
|
|
2419
2398
|
});
|
|
2420
2399
|
}
|
|
2421
|
-
sendActionExecutionArgs(
|
|
2400
|
+
sendActionExecutionArgs(args) {
|
|
2422
2401
|
this.next({
|
|
2423
2402
|
type: "ActionExecutionArgs",
|
|
2424
|
-
args
|
|
2425
|
-
actionExecutionId
|
|
2403
|
+
args
|
|
2426
2404
|
});
|
|
2427
2405
|
}
|
|
2428
|
-
sendActionExecutionEnd(
|
|
2406
|
+
sendActionExecutionEnd() {
|
|
2429
2407
|
this.next({
|
|
2430
|
-
type: "ActionExecutionEnd"
|
|
2431
|
-
actionExecutionId
|
|
2408
|
+
type: "ActionExecutionEnd"
|
|
2432
2409
|
});
|
|
2433
2410
|
}
|
|
2434
|
-
sendActionExecution(
|
|
2435
|
-
this.sendActionExecutionStart(
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
});
|
|
2439
|
-
this.sendActionExecutionArgs({
|
|
2440
|
-
actionExecutionId,
|
|
2441
|
-
args
|
|
2442
|
-
});
|
|
2443
|
-
this.sendActionExecutionEnd({
|
|
2444
|
-
actionExecutionId
|
|
2445
|
-
});
|
|
2411
|
+
sendActionExecution(actionExecutionId, toolName, args) {
|
|
2412
|
+
this.sendActionExecutionStart(actionExecutionId, toolName);
|
|
2413
|
+
this.sendActionExecutionArgs(args);
|
|
2414
|
+
this.sendActionExecutionEnd();
|
|
2446
2415
|
}
|
|
2447
|
-
sendActionExecutionResult(
|
|
2416
|
+
sendActionExecutionResult(actionExecutionId, actionName, result) {
|
|
2448
2417
|
this.next({
|
|
2449
2418
|
type: "ActionExecutionResult",
|
|
2450
2419
|
actionName,
|
|
@@ -2452,7 +2421,7 @@ var RuntimeEventSubject = class extends ReplaySubject2 {
|
|
|
2452
2421
|
result
|
|
2453
2422
|
});
|
|
2454
2423
|
}
|
|
2455
|
-
sendAgentStateMessage(
|
|
2424
|
+
sendAgentStateMessage(threadId, agentName, nodeName, runId, active, role, state, running) {
|
|
2456
2425
|
this.next({
|
|
2457
2426
|
type: "AgentStateMessage",
|
|
2458
2427
|
threadId,
|
|
@@ -2558,11 +2527,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
2558
2527
|
}
|
|
2559
2528
|
}
|
|
2560
2529
|
if (isLangGraphAgentAction(action)) {
|
|
2561
|
-
eventStream$.sendActionExecutionResult({
|
|
2562
|
-
actionExecutionId,
|
|
2563
|
-
actionName: action.name,
|
|
2564
|
-
result: `${action.name} agent started`
|
|
2565
|
-
});
|
|
2530
|
+
eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
|
|
2566
2531
|
const stream = await action.langGraphAgentHandler({
|
|
2567
2532
|
name: action.name,
|
|
2568
2533
|
actionInputsWithoutAgents
|
|
@@ -2800,9 +2765,7 @@ var CopilotResolver = class {
|
|
|
2800
2765
|
// skip until this message start event
|
|
2801
2766
|
skipWhile((e) => e !== event),
|
|
2802
2767
|
// take until the message end event
|
|
2803
|
-
takeWhile((e) =>
|
|
2804
|
-
// filter out any other message events or message ids
|
|
2805
|
-
filter((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
|
|
2768
|
+
takeWhile((e) => e.type != RuntimeEventTypes.TextMessageEnd)
|
|
2806
2769
|
);
|
|
2807
2770
|
const streamingTextStatus = new Subject();
|
|
2808
2771
|
const messageId = event.messageId;
|
|
@@ -2866,13 +2829,7 @@ var CopilotResolver = class {
|
|
|
2866
2829
|
break;
|
|
2867
2830
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
2868
2831
|
logger2.debug("Action execution start event received");
|
|
2869
|
-
const actionExecutionArgumentStream = eventStream.pipe(
|
|
2870
|
-
skipWhile((e) => e !== event),
|
|
2871
|
-
// take until the action execution end event
|
|
2872
|
-
takeWhile((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
|
|
2873
|
-
// filter out any other action execution events or action execution ids
|
|
2874
|
-
filter((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
|
|
2875
|
-
);
|
|
2832
|
+
const actionExecutionArgumentStream = eventStream.pipe(skipWhile((e) => e !== event), takeWhile((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
|
|
2876
2833
|
const streamingArgumentsStatus = new Subject();
|
|
2877
2834
|
pushMessage({
|
|
2878
2835
|
id: event.actionExecutionId,
|
|
@@ -3167,4 +3124,4 @@ export {
|
|
|
3167
3124
|
getCommonConfig,
|
|
3168
3125
|
copilotRuntimeNodeHttpEndpoint
|
|
3169
3126
|
};
|
|
3170
|
-
//# sourceMappingURL=chunk-
|
|
3127
|
+
//# sourceMappingURL=chunk-SQKHB55U.mjs.map
|