@copilotkit/runtime 1.10.0-next.8 → 1.10.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.
- package/CHANGELOG.md +55 -0
- package/dist/{chunk-TCZ4SLBS.mjs → chunk-IP22MV6G.mjs} +2 -2
- package/dist/{chunk-5T75KY3E.mjs → chunk-ODQCOZ55.mjs} +2 -2
- package/dist/{chunk-ZER62NUN.mjs → chunk-QBCAKCOM.mjs} +2 -2
- package/dist/{chunk-6QPAMPDT.mjs → chunk-RODRL3FY.mjs} +35 -29
- package/dist/chunk-RODRL3FY.mjs.map +1 -0
- package/dist/{chunk-QHHLM3PY.mjs → chunk-SNCAMGEK.mjs} +2 -2
- package/dist/index.js +40 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/lib/index.js +40 -34
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.js +2 -2
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.js +2 -2
- 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.js +2 -2
- 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.js +2 -2
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/package.json +3 -3
- package/src/lib/runtime/agui-action.ts +15 -6
- package/dist/chunk-6QPAMPDT.mjs.map +0 -1
- /package/dist/{chunk-TCZ4SLBS.mjs.map → chunk-IP22MV6G.mjs.map} +0 -0
- /package/dist/{chunk-5T75KY3E.mjs.map → chunk-ODQCOZ55.mjs.map} +0 -0
- /package/dist/{chunk-ZER62NUN.mjs.map → chunk-QBCAKCOM.mjs.map} +0 -0
- /package/dist/{chunk-QHHLM3PY.mjs.map → chunk-SNCAMGEK.mjs.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RODRL3FY.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-
|
|
80
|
+
//# sourceMappingURL=chunk-SNCAMGEK.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.10.0
|
|
47
|
+
version: "1.10.0",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -85,7 +85,7 @@ var require_package = __commonJS({
|
|
|
85
85
|
"@ag-ui/client": "0.0.35",
|
|
86
86
|
"@ag-ui/core": "0.0.35",
|
|
87
87
|
"@ag-ui/encoder": "0.0.35",
|
|
88
|
-
"@ag-ui/langgraph": "0.0.
|
|
88
|
+
"@ag-ui/langgraph": "0.0.8",
|
|
89
89
|
"@ag-ui/proto": "0.0.35",
|
|
90
90
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
91
91
|
"@copilotkit/shared": "workspace:*",
|
|
@@ -1313,7 +1313,7 @@ var import_type_graphql26 = require("type-graphql");
|
|
|
1313
1313
|
|
|
1314
1314
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
1315
1315
|
var import_type_graphql20 = require("type-graphql");
|
|
1316
|
-
var
|
|
1316
|
+
var import_rxjs5 = require("rxjs");
|
|
1317
1317
|
|
|
1318
1318
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
1319
1319
|
var import_type_graphql18 = require("type-graphql");
|
|
@@ -2803,7 +2803,7 @@ var import_graphql_yoga = require("graphql-yoga");
|
|
|
2803
2803
|
// src/service-adapters/events.ts
|
|
2804
2804
|
var import_shared27 = require("@copilotkit/shared");
|
|
2805
2805
|
var import_class_transformer2 = require("class-transformer");
|
|
2806
|
-
var
|
|
2806
|
+
var import_rxjs4 = require("rxjs");
|
|
2807
2807
|
|
|
2808
2808
|
// src/graphql/types/converted/index.ts
|
|
2809
2809
|
var Message = class extends BaseMessageInput {
|
|
@@ -6401,6 +6401,7 @@ __name(createHeaders, "createHeaders");
|
|
|
6401
6401
|
var import_shared26 = require("@copilotkit/shared");
|
|
6402
6402
|
|
|
6403
6403
|
// src/lib/runtime/agui-action.ts
|
|
6404
|
+
var import_rxjs3 = require("rxjs");
|
|
6404
6405
|
var import_shared24 = require("@copilotkit/shared");
|
|
6405
6406
|
function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, agent, metaEvents, threadMetadata, nodeName, graphqlContext }) {
|
|
6406
6407
|
const action = {
|
|
@@ -6458,7 +6459,12 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
|
|
|
6458
6459
|
return agent.legacy_to_be_removed_runAgentBridged({
|
|
6459
6460
|
tools,
|
|
6460
6461
|
forwardedProps
|
|
6461
|
-
})
|
|
6462
|
+
}).pipe((0, import_rxjs3.catchError)((err) => {
|
|
6463
|
+
throw new import_shared24.CopilotKitError({
|
|
6464
|
+
message: err.message,
|
|
6465
|
+
code: import_shared24.CopilotKitErrorCode.UNKNOWN
|
|
6466
|
+
});
|
|
6467
|
+
}));
|
|
6462
6468
|
}
|
|
6463
6469
|
};
|
|
6464
6470
|
return [
|
|
@@ -6662,7 +6668,7 @@ var RuntimeMetaEventName;
|
|
|
6662
6668
|
RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
|
|
6663
6669
|
RuntimeMetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
|
|
6664
6670
|
})(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
|
|
6665
|
-
var RuntimeEventSubject = class extends
|
|
6671
|
+
var RuntimeEventSubject = class extends import_rxjs4.ReplaySubject {
|
|
6666
6672
|
constructor() {
|
|
6667
6673
|
super();
|
|
6668
6674
|
}
|
|
@@ -6793,7 +6799,7 @@ var RuntimeEventSource = class {
|
|
|
6793
6799
|
});
|
|
6794
6800
|
return this.eventStream$.pipe(
|
|
6795
6801
|
// track state
|
|
6796
|
-
(0,
|
|
6802
|
+
(0, import_rxjs4.scan)((acc, event) => {
|
|
6797
6803
|
acc = {
|
|
6798
6804
|
...acc
|
|
6799
6805
|
};
|
|
@@ -6818,16 +6824,16 @@ var RuntimeEventSource = class {
|
|
|
6818
6824
|
action: null,
|
|
6819
6825
|
actionExecutionParentMessageId: null
|
|
6820
6826
|
}),
|
|
6821
|
-
(0,
|
|
6827
|
+
(0, import_rxjs4.concatMap)((eventWithState) => {
|
|
6822
6828
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
6823
6829
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
6824
6830
|
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionParentMessageId, eventWithState.actionExecutionId, actionInputsWithoutAgents, threadId).catch((error) => {
|
|
6825
6831
|
});
|
|
6826
6832
|
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
6827
|
-
return (0,
|
|
6833
|
+
return (0, import_rxjs4.concat)((0, import_rxjs4.of)(eventWithState.event), toolCallEventStream$).pipe((0, import_rxjs4.catchError)((error) => {
|
|
6828
6834
|
const structuredError = (0, import_shared27.ensureStructuredError)(error, convertStreamingErrorToStructured2);
|
|
6829
6835
|
if (this.errorHandler && this.errorContext) {
|
|
6830
|
-
(0,
|
|
6836
|
+
(0, import_rxjs4.from)(this.errorHandler(structuredError, {
|
|
6831
6837
|
...this.errorContext,
|
|
6832
6838
|
action: {
|
|
6833
6839
|
name: eventWithState.action.name,
|
|
@@ -6847,10 +6853,10 @@ var RuntimeEventSource = class {
|
|
|
6847
6853
|
message: structuredError.message
|
|
6848
6854
|
}
|
|
6849
6855
|
});
|
|
6850
|
-
return
|
|
6856
|
+
return import_rxjs4.EMPTY;
|
|
6851
6857
|
}));
|
|
6852
6858
|
} else {
|
|
6853
|
-
return (0,
|
|
6859
|
+
return (0, import_rxjs4.of)(eventWithState.event);
|
|
6854
6860
|
}
|
|
6855
6861
|
})
|
|
6856
6862
|
);
|
|
@@ -6860,7 +6866,7 @@ __name(RuntimeEventSource, "RuntimeEventSource");
|
|
|
6860
6866
|
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionParentMessageId, actionExecutionId, actionInputsWithoutAgents, threadId) {
|
|
6861
6867
|
var _a;
|
|
6862
6868
|
if (guardrailsResult$) {
|
|
6863
|
-
const { status } = await (0,
|
|
6869
|
+
const { status } = await (0, import_rxjs4.firstValueFrom)(guardrailsResult$);
|
|
6864
6870
|
if (status === "denied") {
|
|
6865
6871
|
eventStream$.complete();
|
|
6866
6872
|
return;
|
|
@@ -6915,7 +6921,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
6915
6921
|
agentExecutionResult
|
|
6916
6922
|
]
|
|
6917
6923
|
});
|
|
6918
|
-
(0,
|
|
6924
|
+
(0, import_rxjs4.from)(stream).subscribe({
|
|
6919
6925
|
next: (event) => eventStream$.next(event),
|
|
6920
6926
|
error: (err) => {
|
|
6921
6927
|
const structuredError = (0, import_shared27.ensureStructuredError)(err, convertStreamingErrorToStructured2);
|
|
@@ -7206,9 +7212,9 @@ var CopilotResolver = class {
|
|
|
7206
7212
|
});
|
|
7207
7213
|
}
|
|
7208
7214
|
logger2.debug("Setting up subjects");
|
|
7209
|
-
const responseStatus$ = new
|
|
7210
|
-
const interruptStreaming$ = new
|
|
7211
|
-
const guardrailsResult$ = new
|
|
7215
|
+
const responseStatus$ = new import_rxjs5.ReplaySubject();
|
|
7216
|
+
const interruptStreaming$ = new import_rxjs5.ReplaySubject();
|
|
7217
|
+
const guardrailsResult$ = new import_rxjs5.ReplaySubject();
|
|
7212
7218
|
let outputMessages = [];
|
|
7213
7219
|
let resolveOutputMessagesPromise;
|
|
7214
7220
|
let rejectOutputMessagesPromise;
|
|
@@ -7263,15 +7269,15 @@ var CopilotResolver = class {
|
|
|
7263
7269
|
}).pipe(
|
|
7264
7270
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
7265
7271
|
// just the events that were emitted after the subscriber was added.
|
|
7266
|
-
(0,
|
|
7267
|
-
(0,
|
|
7272
|
+
(0, import_rxjs5.shareReplay)(),
|
|
7273
|
+
(0, import_rxjs5.finalize)(() => {
|
|
7268
7274
|
logger2.debug("Event stream finalized");
|
|
7269
7275
|
})
|
|
7270
7276
|
);
|
|
7271
7277
|
const response = {
|
|
7272
7278
|
threadId,
|
|
7273
7279
|
runId,
|
|
7274
|
-
status: (0,
|
|
7280
|
+
status: (0, import_rxjs5.firstValueFrom)(responseStatus$),
|
|
7275
7281
|
extensions,
|
|
7276
7282
|
metaEvents: new import_graphql_yoga.Repeater(async (push, stop) => {
|
|
7277
7283
|
let eventStreamSubscription;
|
|
@@ -7415,25 +7421,25 @@ var CopilotResolver = class {
|
|
|
7415
7421
|
case RuntimeEventTypes.TextMessageStart:
|
|
7416
7422
|
const textMessageContentStream = eventStream.pipe(
|
|
7417
7423
|
// skip until this message start event
|
|
7418
|
-
(0,
|
|
7424
|
+
(0, import_rxjs5.skipWhile)((e) => e !== event),
|
|
7419
7425
|
// take until the message end event
|
|
7420
|
-
(0,
|
|
7426
|
+
(0, import_rxjs5.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
|
|
7421
7427
|
// filter out any other message events or message ids
|
|
7422
|
-
(0,
|
|
7428
|
+
(0, import_rxjs5.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
|
|
7423
7429
|
);
|
|
7424
|
-
const streamingTextStatus = new
|
|
7430
|
+
const streamingTextStatus = new import_rxjs5.Subject();
|
|
7425
7431
|
const messageId = event.messageId;
|
|
7426
7432
|
pushMessage({
|
|
7427
7433
|
id: messageId,
|
|
7428
7434
|
parentMessageId: event.parentMessageId,
|
|
7429
|
-
status: (0,
|
|
7435
|
+
status: (0, import_rxjs5.firstValueFrom)(streamingTextStatus),
|
|
7430
7436
|
createdAt: /* @__PURE__ */ new Date(),
|
|
7431
7437
|
role: MessageRole.assistant,
|
|
7432
7438
|
content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
7433
7439
|
logger2.debug("Text message content repeater created");
|
|
7434
7440
|
const textChunks = [];
|
|
7435
7441
|
let textSubscription;
|
|
7436
|
-
interruptStreaming$.pipe((0,
|
|
7442
|
+
interruptStreaming$.pipe((0, import_rxjs5.shareReplay)(), (0, import_rxjs5.take)(1), (0, import_rxjs5.tap)(({ reason, messageId: messageId2 }) => {
|
|
7437
7443
|
logger2.debug({
|
|
7438
7444
|
reason,
|
|
7439
7445
|
messageId: messageId2
|
|
@@ -7485,17 +7491,17 @@ var CopilotResolver = class {
|
|
|
7485
7491
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
7486
7492
|
logger2.debug("Action execution start event received");
|
|
7487
7493
|
const actionExecutionArgumentStream = eventStream.pipe(
|
|
7488
|
-
(0,
|
|
7494
|
+
(0, import_rxjs5.skipWhile)((e) => e !== event),
|
|
7489
7495
|
// take until the action execution end event
|
|
7490
|
-
(0,
|
|
7496
|
+
(0, import_rxjs5.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
|
|
7491
7497
|
// filter out any other action execution events or action execution ids
|
|
7492
|
-
(0,
|
|
7498
|
+
(0, import_rxjs5.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
|
|
7493
7499
|
);
|
|
7494
|
-
const streamingArgumentsStatus = new
|
|
7500
|
+
const streamingArgumentsStatus = new import_rxjs5.Subject();
|
|
7495
7501
|
pushMessage({
|
|
7496
7502
|
id: event.actionExecutionId,
|
|
7497
7503
|
parentMessageId: event.parentMessageId,
|
|
7498
|
-
status: (0,
|
|
7504
|
+
status: (0, import_rxjs5.firstValueFrom)(streamingArgumentsStatus),
|
|
7499
7505
|
createdAt: /* @__PURE__ */ new Date(),
|
|
7500
7506
|
name: event.actionName,
|
|
7501
7507
|
arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
|
|
@@ -7619,7 +7625,7 @@ var CopilotResolver = class {
|
|
|
7619
7625
|
logger2.debug("Event stream completed");
|
|
7620
7626
|
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
7621
7627
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
7622
|
-
await (0,
|
|
7628
|
+
await (0, import_rxjs5.firstValueFrom)(guardrailsResult$);
|
|
7623
7629
|
}
|
|
7624
7630
|
responseStatus$.next(new SuccessResponseStatus());
|
|
7625
7631
|
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
@@ -8064,7 +8070,7 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
8064
8070
|
|
|
8065
8071
|
// src/lib/runtime/langgraph/langgraph-agent.ts
|
|
8066
8072
|
var import_client = require("@ag-ui/client");
|
|
8067
|
-
var
|
|
8073
|
+
var import_rxjs6 = require("rxjs");
|
|
8068
8074
|
var import_langgraph = require("@ag-ui/langgraph");
|
|
8069
8075
|
var CustomEventNames2;
|
|
8070
8076
|
(function(CustomEventNames3) {
|
|
@@ -8161,7 +8167,7 @@ var LangGraphAgent = class extends import_langgraph.LangGraphAgent {
|
|
|
8161
8167
|
}
|
|
8162
8168
|
// @ts-ignore
|
|
8163
8169
|
run(input) {
|
|
8164
|
-
return super.run(input).pipe((0,
|
|
8170
|
+
return super.run(input).pipe((0, import_rxjs6.map)((processedEvent) => {
|
|
8165
8171
|
var _a, _b, _c, _d, _e;
|
|
8166
8172
|
if (processedEvent.type === import_client.EventType.RAW) {
|
|
8167
8173
|
const event = processedEvent.event ?? processedEvent.rawEvent;
|