@copilotkit/runtime 1.9.2-next.24 → 1.9.2-next.25
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/dist/{chunk-FR4C3TPU.mjs → chunk-3JXN25PL.mjs} +2 -2
- package/dist/{chunk-ECQRTXJX.mjs → chunk-BNLL5CH2.mjs} +2 -2
- package/dist/{chunk-S2YGYQDH.mjs → chunk-DOXGUQKL.mjs} +2 -2
- package/dist/{chunk-TBVA4IGX.mjs → chunk-GJWXNXSA.mjs} +2 -2
- package/dist/{chunk-GAUZHH2X.mjs → chunk-YKYBGYYL.mjs} +79 -33
- package/dist/chunk-YKYBGYYL.mjs.map +1 -0
- package/dist/{groq-adapter-098f97f6.d.ts → groq-adapter-742818f2.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +71 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{langserve-fc5cac89.d.ts → langserve-3e8d0e06.d.ts} +6 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +71 -25
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 -4
- package/dist/{shared-6b6dbf8b.d.ts → shared-96b46379.d.ts} +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/copilot-runtime.ts +32 -19
- package/src/service-adapters/events.ts +40 -1
- package/dist/chunk-GAUZHH2X.mjs.map +0 -1
- /package/dist/{chunk-FR4C3TPU.mjs.map → chunk-3JXN25PL.mjs.map} +0 -0
- /package/dist/{chunk-ECQRTXJX.mjs.map → chunk-BNLL5CH2.mjs.map} +0 -0
- /package/dist/{chunk-S2YGYQDH.mjs.map → chunk-DOXGUQKL.mjs.map} +0 -0
- /package/dist/{chunk-TBVA4IGX.mjs.map → chunk-GJWXNXSA.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomEventNames,
|
|
3
3
|
LangGraphAgent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DOXGUQKL.mjs";
|
|
5
5
|
import {
|
|
6
6
|
config,
|
|
7
7
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
8
8
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GJWXNXSA.mjs";
|
|
10
10
|
import {
|
|
11
11
|
copilotRuntimeNestEndpoint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BNLL5CH2.mjs";
|
|
13
13
|
import {
|
|
14
14
|
copilotRuntimeNodeExpressEndpoint
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3JXN25PL.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CopilotRuntime,
|
|
18
18
|
addCustomHeaderPlugin,
|
|
@@ -28,7 +28,8 @@ import {
|
|
|
28
28
|
getCommonConfig,
|
|
29
29
|
langGraphPlatformEndpoint,
|
|
30
30
|
resolveEndpointType
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YKYBGYYL.mjs";
|
|
32
|
+
import "./chunk-SHBDMA63.mjs";
|
|
32
33
|
import {
|
|
33
34
|
AnthropicAdapter,
|
|
34
35
|
BedrockAdapter,
|
|
@@ -51,7 +52,6 @@ import {
|
|
|
51
52
|
import {
|
|
52
53
|
convertServiceAdapterError
|
|
53
54
|
} from "./chunk-AMUJQ6IR.mjs";
|
|
54
|
-
import "./chunk-SHBDMA63.mjs";
|
|
55
55
|
import "./chunk-2OZAGFV3.mjs";
|
|
56
56
|
import "./chunk-FHD4JECV.mjs";
|
|
57
57
|
|
|
@@ -146,6 +146,12 @@ declare class RuntimeEventSubject extends ReplaySubject<RuntimeEvent> {
|
|
|
146
146
|
declare class RuntimeEventSource {
|
|
147
147
|
private eventStream$;
|
|
148
148
|
private callback;
|
|
149
|
+
private errorHandler?;
|
|
150
|
+
private errorContext?;
|
|
151
|
+
constructor(params?: {
|
|
152
|
+
errorHandler?: (error: any, context: any) => Promise<void>;
|
|
153
|
+
errorContext?: any;
|
|
154
|
+
});
|
|
149
155
|
stream(callback: EventSourceCallback): Promise<void>;
|
|
150
156
|
sendErrorMessageToChat(message?: string): void;
|
|
151
157
|
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, threadId, }: {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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-
|
|
2
|
-
export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from '../shared-
|
|
1
|
+
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-742818f2.js';
|
|
2
|
+
export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from '../shared-96b46379.js';
|
|
3
3
|
export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './integrations/index.js';
|
|
4
4
|
export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
|
|
5
5
|
export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
|
|
@@ -9,7 +9,7 @@ import { TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, To
|
|
|
9
9
|
import { LangGraphAgent as LangGraphAgent$1, LangGraphAgentConfig, ProcessedEvents, SchemaKeys } from '@ag-ui/langgraph';
|
|
10
10
|
import { Message } from '@langchain/langgraph-sdk/dist/types.messages';
|
|
11
11
|
import 'openai';
|
|
12
|
-
import '../langserve-
|
|
12
|
+
import '../langserve-3e8d0e06.js';
|
|
13
13
|
import '../index-d4614f9b.js';
|
|
14
14
|
import '../graphql/types/base/index.js';
|
|
15
15
|
import '@copilotkit/shared';
|
package/dist/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.9.2-next.
|
|
47
|
+
version: "1.9.2-next.25",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -4394,30 +4394,30 @@ var CopilotRuntime = class {
|
|
|
4394
4394
|
async processRuntimeRequest(request) {
|
|
4395
4395
|
var _a, _b, _c, _d, _e;
|
|
4396
4396
|
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey } = request;
|
|
4397
|
-
const eventSource = new RuntimeEventSource(
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
await this.error("request", {
|
|
4401
|
-
threadId,
|
|
4402
|
-
runId,
|
|
4403
|
-
source: "runtime",
|
|
4404
|
-
request: {
|
|
4405
|
-
operation: "processRuntimeRequest",
|
|
4406
|
-
method: "POST",
|
|
4407
|
-
url,
|
|
4408
|
-
startTime: requestStartTime
|
|
4409
|
-
},
|
|
4410
|
-
agent: agentSession ? {
|
|
4411
|
-
name: agentSession.agentName
|
|
4412
|
-
} : void 0,
|
|
4413
|
-
messages: {
|
|
4414
|
-
input: rawMessages,
|
|
4415
|
-
messageCount: rawMessages.length
|
|
4397
|
+
const eventSource = new RuntimeEventSource({
|
|
4398
|
+
errorHandler: async (error, context) => {
|
|
4399
|
+
await this.error("error", context, error, publicApiKey);
|
|
4416
4400
|
},
|
|
4417
|
-
|
|
4418
|
-
|
|
4401
|
+
errorContext: {
|
|
4402
|
+
threadId,
|
|
4403
|
+
runId,
|
|
4404
|
+
source: "runtime",
|
|
4405
|
+
request: {
|
|
4406
|
+
operation: "processRuntimeRequest",
|
|
4407
|
+
method: "POST",
|
|
4408
|
+
url,
|
|
4409
|
+
startTime: Date.now()
|
|
4410
|
+
},
|
|
4411
|
+
agent: agentSession ? {
|
|
4412
|
+
name: agentSession.agentName
|
|
4413
|
+
} : void 0,
|
|
4414
|
+
technical: {
|
|
4415
|
+
environment: process.env.NODE_ENV
|
|
4416
|
+
}
|
|
4419
4417
|
}
|
|
4420
|
-
}
|
|
4418
|
+
});
|
|
4419
|
+
const requestStartTime = Date.now();
|
|
4420
|
+
const streamedChunks = [];
|
|
4421
4421
|
try {
|
|
4422
4422
|
if (Object.keys(this.agents).length && (agentSession == null ? void 0 : agentSession.agentName) && !this.delegateAgentProcessingToServiceAdapter) {
|
|
4423
4423
|
this.agents = {
|
|
@@ -4909,7 +4909,27 @@ please use an LLM adapter instead.`
|
|
|
4909
4909
|
properties: graphqlContext.properties
|
|
4910
4910
|
}));
|
|
4911
4911
|
try {
|
|
4912
|
-
const eventSource = new RuntimeEventSource(
|
|
4912
|
+
const eventSource = new RuntimeEventSource({
|
|
4913
|
+
errorHandler: async (error, context) => {
|
|
4914
|
+
await this.error("error", context, error, publicApiKey);
|
|
4915
|
+
},
|
|
4916
|
+
errorContext: {
|
|
4917
|
+
threadId,
|
|
4918
|
+
source: "agent",
|
|
4919
|
+
request: {
|
|
4920
|
+
operation: "processAgentRequest",
|
|
4921
|
+
method: "POST",
|
|
4922
|
+
startTime: requestStartTime
|
|
4923
|
+
},
|
|
4924
|
+
agent: {
|
|
4925
|
+
name: agentName,
|
|
4926
|
+
nodeName
|
|
4927
|
+
},
|
|
4928
|
+
technical: {
|
|
4929
|
+
environment: process.env.NODE_ENV
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
});
|
|
4913
4933
|
const stream = await currentAgent.remoteAgentHandler({
|
|
4914
4934
|
name: agentName,
|
|
4915
4935
|
threadId,
|
|
@@ -6210,6 +6230,12 @@ __name(RuntimeEventSubject, "RuntimeEventSubject");
|
|
|
6210
6230
|
var RuntimeEventSource = class {
|
|
6211
6231
|
eventStream$ = new RuntimeEventSubject();
|
|
6212
6232
|
callback;
|
|
6233
|
+
errorHandler;
|
|
6234
|
+
errorContext;
|
|
6235
|
+
constructor(params) {
|
|
6236
|
+
this.errorHandler = params == null ? void 0 : params.errorHandler;
|
|
6237
|
+
this.errorContext = params == null ? void 0 : params.errorContext;
|
|
6238
|
+
}
|
|
6213
6239
|
async stream(callback) {
|
|
6214
6240
|
this.callback = callback;
|
|
6215
6241
|
}
|
|
@@ -6224,8 +6250,15 @@ var RuntimeEventSource = class {
|
|
|
6224
6250
|
}
|
|
6225
6251
|
}
|
|
6226
6252
|
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, threadId }) {
|
|
6227
|
-
this.callback(this.eventStream$).catch((error) => {
|
|
6253
|
+
this.callback(this.eventStream$).catch(async (error) => {
|
|
6228
6254
|
const structuredError = (0, import_shared24.ensureStructuredError)(error, convertStreamingErrorToStructured2);
|
|
6255
|
+
if (this.errorHandler && this.errorContext) {
|
|
6256
|
+
try {
|
|
6257
|
+
await this.errorHandler(structuredError, this.errorContext);
|
|
6258
|
+
} catch (errorHandlerError) {
|
|
6259
|
+
console.error("Error in streaming error handler:", errorHandlerError);
|
|
6260
|
+
}
|
|
6261
|
+
}
|
|
6229
6262
|
this.eventStream$.error(structuredError);
|
|
6230
6263
|
this.eventStream$.complete();
|
|
6231
6264
|
});
|
|
@@ -6264,6 +6297,19 @@ var RuntimeEventSource = class {
|
|
|
6264
6297
|
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
6265
6298
|
return (0, import_rxjs3.concat)((0, import_rxjs3.of)(eventWithState.event), toolCallEventStream$).pipe((0, import_rxjs3.catchError)((error) => {
|
|
6266
6299
|
const structuredError = (0, import_shared24.ensureStructuredError)(error, convertStreamingErrorToStructured2);
|
|
6300
|
+
if (this.errorHandler && this.errorContext) {
|
|
6301
|
+
(0, import_rxjs3.from)(this.errorHandler(structuredError, {
|
|
6302
|
+
...this.errorContext,
|
|
6303
|
+
action: {
|
|
6304
|
+
name: eventWithState.action.name,
|
|
6305
|
+
executionId: eventWithState.actionExecutionId
|
|
6306
|
+
}
|
|
6307
|
+
})).subscribe({
|
|
6308
|
+
error: (errorHandlerError) => {
|
|
6309
|
+
console.error("Error in action execution error handler:", errorHandlerError);
|
|
6310
|
+
}
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6267
6313
|
toolCallEventStream$.sendActionExecutionResult({
|
|
6268
6314
|
actionExecutionId: eventWithState.actionExecutionId,
|
|
6269
6315
|
actionName: eventWithState.action.name,
|