@copilotkit/runtime 1.50.0-beta.8 → 1.50.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 +168 -0
- package/dist/chunk-27JKTS6P.mjs +1704 -0
- package/dist/chunk-27JKTS6P.mjs.map +1 -0
- package/dist/chunk-2GPTVDTO.mjs +25 -0
- package/dist/chunk-2GPTVDTO.mjs.map +1 -0
- package/dist/chunk-2OZAGFV3.mjs +43 -0
- package/dist/chunk-2OZAGFV3.mjs.map +1 -0
- package/dist/chunk-3AJVKDZX.mjs +3097 -0
- package/dist/chunk-3AJVKDZX.mjs.map +1 -0
- package/dist/chunk-45RCC3ZS.mjs +25 -0
- package/dist/chunk-45RCC3ZS.mjs.map +1 -0
- package/dist/chunk-4EHJ4XFJ.mjs +25 -0
- package/dist/chunk-4EHJ4XFJ.mjs.map +1 -0
- package/dist/chunk-4IANB4TC.mjs +25 -0
- package/dist/chunk-4IANB4TC.mjs.map +1 -0
- package/dist/chunk-4KES76K3.mjs +74 -0
- package/dist/chunk-4KES76K3.mjs.map +1 -0
- package/dist/chunk-4OGE3SLW.mjs +3100 -0
- package/dist/chunk-4OGE3SLW.mjs.map +1 -0
- package/dist/chunk-54YJBMCP.mjs +3097 -0
- package/dist/chunk-54YJBMCP.mjs.map +1 -0
- package/dist/chunk-62NE5S6M.mjs +226 -0
- package/dist/chunk-62NE5S6M.mjs.map +1 -0
- package/dist/chunk-6ER4SZYH.mjs +74 -0
- package/dist/chunk-6ER4SZYH.mjs.map +1 -0
- package/dist/chunk-6TNSLHVR.mjs +74 -0
- package/dist/chunk-6TNSLHVR.mjs.map +1 -0
- package/dist/chunk-6XRUR5UK.mjs +1 -0
- package/dist/chunk-6XRUR5UK.mjs.map +1 -0
- package/dist/chunk-7V4BK7TZ.mjs +25 -0
- package/dist/chunk-7V4BK7TZ.mjs.map +1 -0
- package/dist/chunk-7YZIEXD2.mjs +74 -0
- package/dist/chunk-7YZIEXD2.mjs.map +1 -0
- package/dist/chunk-A4XHOAFU.mjs +25 -0
- package/dist/chunk-A4XHOAFU.mjs.map +1 -0
- package/dist/chunk-A555KEAD.mjs +6020 -0
- package/dist/chunk-A555KEAD.mjs.map +1 -0
- package/dist/chunk-AF73TFTX.mjs +74 -0
- package/dist/chunk-AF73TFTX.mjs.map +1 -0
- package/dist/chunk-AMUJQ6IR.mjs +50 -0
- package/dist/chunk-AMUJQ6IR.mjs.map +1 -0
- package/dist/chunk-AQG2SVCA.mjs +25 -0
- package/dist/chunk-AQG2SVCA.mjs.map +1 -0
- package/dist/chunk-BJZHMXND.mjs +74 -0
- package/dist/chunk-BJZHMXND.mjs.map +1 -0
- package/dist/chunk-CB2OJXF6.mjs +25 -0
- package/dist/chunk-CB2OJXF6.mjs.map +1 -0
- package/dist/chunk-CEOMFPJU.mjs +6020 -0
- package/dist/chunk-CEOMFPJU.mjs.map +1 -0
- package/dist/chunk-CZVLR7CC.mjs +175 -0
- package/dist/chunk-CZVLR7CC.mjs.map +1 -0
- package/dist/chunk-DCEEHMLJ.mjs +1127 -0
- package/dist/chunk-DCEEHMLJ.mjs.map +1 -0
- package/dist/chunk-DE3CLKUG.mjs +25 -0
- package/dist/chunk-DE3CLKUG.mjs.map +1 -0
- package/dist/chunk-DTPRUTNV.mjs +25 -0
- package/dist/chunk-DTPRUTNV.mjs.map +1 -0
- package/dist/chunk-ERUOA47O.mjs +626 -0
- package/dist/chunk-ERUOA47O.mjs.map +1 -0
- package/dist/chunk-ESSRC64W.mjs +74 -0
- package/dist/chunk-ESSRC64W.mjs.map +1 -0
- package/dist/chunk-FHD4JECV.mjs +33 -0
- package/dist/chunk-FHD4JECV.mjs.map +1 -0
- package/dist/chunk-GRAN6K6N.mjs +25 -0
- package/dist/chunk-GRAN6K6N.mjs.map +1 -0
- package/dist/chunk-I27F2UPA.mjs +175 -0
- package/dist/chunk-I27F2UPA.mjs.map +1 -0
- package/dist/chunk-IAZKTOQW.mjs +25 -0
- package/dist/chunk-IAZKTOQW.mjs.map +1 -0
- package/dist/chunk-J6XZ5MFB.mjs +25 -0
- package/dist/chunk-J6XZ5MFB.mjs.map +1 -0
- package/dist/chunk-JJ32MA4C.mjs +73 -0
- package/dist/chunk-JJ32MA4C.mjs.map +1 -0
- package/dist/chunk-JJY4ZTHQ.mjs +25 -0
- package/dist/chunk-JJY4ZTHQ.mjs.map +1 -0
- package/dist/chunk-KEYLBFU2.mjs +3117 -0
- package/dist/chunk-KEYLBFU2.mjs.map +1 -0
- package/dist/chunk-KQ53L4WZ.mjs +3094 -0
- package/dist/chunk-KQ53L4WZ.mjs.map +1 -0
- package/dist/chunk-KTELVQ67.mjs +3098 -0
- package/dist/chunk-KTELVQ67.mjs.map +1 -0
- package/dist/chunk-LPEPX6NH.mjs +25 -0
- package/dist/chunk-LPEPX6NH.mjs.map +1 -0
- package/dist/chunk-MDXE55DK.mjs +3117 -0
- package/dist/chunk-MDXE55DK.mjs.map +1 -0
- package/dist/chunk-MMFUVOXH.mjs +73 -0
- package/dist/chunk-MMFUVOXH.mjs.map +1 -0
- package/dist/chunk-N3Y4U66N.mjs +253 -0
- package/dist/chunk-N3Y4U66N.mjs.map +1 -0
- package/dist/chunk-O7UYB4MH.mjs +25 -0
- package/dist/chunk-O7UYB4MH.mjs.map +1 -0
- package/dist/chunk-OFNVQHNM.mjs +3089 -0
- package/dist/chunk-OFNVQHNM.mjs.map +1 -0
- package/dist/chunk-OFSV5GET.mjs +3074 -0
- package/dist/chunk-OFSV5GET.mjs.map +1 -0
- package/dist/chunk-OMRST67R.mjs +25 -0
- package/dist/chunk-OMRST67R.mjs.map +1 -0
- package/dist/chunk-OWIGJONH.mjs +275 -0
- package/dist/chunk-OWIGJONH.mjs.map +1 -0
- package/dist/chunk-PRZHE74A.mjs +25 -0
- package/dist/chunk-PRZHE74A.mjs.map +1 -0
- package/dist/chunk-PTYRVXXP.mjs +80 -0
- package/dist/chunk-PTYRVXXP.mjs.map +1 -0
- package/dist/chunk-R22B5CCO.mjs +25 -0
- package/dist/chunk-R22B5CCO.mjs.map +1 -0
- package/dist/chunk-SHBDMA63.mjs +141 -0
- package/dist/chunk-SHBDMA63.mjs.map +1 -0
- package/dist/chunk-SPVXBPRA.mjs +74 -0
- package/dist/chunk-SPVXBPRA.mjs.map +1 -0
- package/dist/chunk-T72G46ME.mjs +25 -0
- package/dist/chunk-T72G46ME.mjs.map +1 -0
- package/dist/chunk-TGELROPU.mjs +25 -0
- package/dist/chunk-TGELROPU.mjs.map +1 -0
- package/dist/chunk-UNX4IAAD.mjs +25 -0
- package/dist/chunk-UNX4IAAD.mjs.map +1 -0
- package/dist/chunk-V4DHVC7M.mjs +3085 -0
- package/dist/chunk-V4DHVC7M.mjs.map +1 -0
- package/dist/chunk-VVRFOB66.mjs +25 -0
- package/dist/chunk-VVRFOB66.mjs.map +1 -0
- package/dist/chunk-W6NVBYM6.mjs +80 -0
- package/dist/chunk-W6NVBYM6.mjs.map +1 -0
- package/dist/chunk-W7MBACGC.mjs +74 -0
- package/dist/chunk-W7MBACGC.mjs.map +1 -0
- package/dist/chunk-WMD4XZZS.mjs +25 -0
- package/dist/chunk-WMD4XZZS.mjs.map +1 -0
- package/dist/chunk-WX2ZNCRT.mjs +74 -0
- package/dist/chunk-WX2ZNCRT.mjs.map +1 -0
- package/dist/chunk-XWBDEXDA.mjs +153 -0
- package/dist/chunk-XWBDEXDA.mjs.map +1 -0
- package/dist/chunk-Y2Z62E2T.mjs +74 -0
- package/dist/chunk-Y2Z62E2T.mjs.map +1 -0
- package/dist/chunk-YO4I6RVI.mjs +25 -0
- package/dist/chunk-YO4I6RVI.mjs.map +1 -0
- package/dist/chunk-Z6Q5IW6I.mjs +3098 -0
- package/dist/chunk-Z6Q5IW6I.mjs.map +1 -0
- package/dist/chunk-Z726O3G2.mjs +25 -0
- package/dist/chunk-Z726O3G2.mjs.map +1 -0
- package/dist/chunk-ZE4SMZZR.mjs +3097 -0
- package/dist/chunk-ZE4SMZZR.mjs.map +1 -0
- package/dist/chunk-ZULZB33C.mjs +73 -0
- package/dist/chunk-ZULZB33C.mjs.map +1 -0
- package/dist/chunk-ZVRGXMY7.mjs +25 -0
- package/dist/chunk-ZVRGXMY7.mjs.map +1 -0
- package/dist/chunk-ZZ35WBYQ.mjs +25 -0
- package/dist/chunk-ZZ35WBYQ.mjs.map +1 -0
- package/dist/graphql/message-conversion/index.d.ts +18 -0
- package/dist/graphql/message-conversion/index.js +725 -0
- package/dist/graphql/message-conversion/index.js.map +1 -0
- package/dist/graphql/message-conversion/index.mjs +245 -0
- package/dist/graphql/message-conversion/index.mjs.map +1 -0
- package/dist/graphql/types/base/index.d.ts +6 -0
- package/dist/graphql/types/base/index.js +63 -0
- package/dist/graphql/types/base/index.js.map +1 -0
- package/dist/graphql/types/base/index.mjs +8 -0
- package/dist/graphql/types/base/index.mjs.map +1 -0
- package/dist/graphql/types/converted/index.d.ts +2 -0
- package/dist/graphql/types/converted/index.js +200 -0
- package/dist/graphql/types/converted/index.js.map +1 -0
- package/dist/graphql/types/converted/index.mjs +19 -0
- package/dist/graphql/types/converted/index.mjs.map +1 -0
- package/dist/groq-adapter-540da9c3.d.ts +331 -0
- package/dist/groq-adapter-a6f5e9d2.d.ts +331 -0
- package/dist/groq-adapter-c8aec5c5.d.ts +321 -0
- package/dist/index-96b330da.d.ts +119 -0
- package/dist/index-adbd78f1.d.ts +154 -0
- package/dist/index.d.ts +67 -8
- package/dist/index.js +118 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -31
- package/dist/index.mjs.map +1 -1
- package/dist/langserve-0c6100e3.d.ts +257 -0
- package/dist/langserve-978d5790.d.ts +243 -0
- package/dist/langserve-9fc76ce5.d.ts +243 -0
- package/dist/lib/cloud/index.d.ts +6 -0
- package/dist/lib/cloud/index.js +18 -0
- package/dist/lib/cloud/index.js.map +1 -0
- package/dist/lib/cloud/index.mjs +1 -0
- package/dist/lib/cloud/index.mjs.map +1 -0
- package/dist/lib/index.d.ts +212 -0
- package/dist/lib/index.js +7843 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/index.mjs +76 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/integrations/index.d.ts +34 -0
- package/dist/lib/integrations/index.js +3052 -0
- package/dist/lib/integrations/index.js.map +1 -0
- package/dist/lib/integrations/index.mjs +37 -0
- package/dist/lib/integrations/index.mjs.map +1 -0
- package/dist/lib/integrations/nest/index.d.ts +15 -0
- package/dist/lib/integrations/nest/index.js +2959 -0
- package/dist/lib/integrations/nest/index.js.map +1 -0
- package/dist/lib/integrations/nest/index.mjs +14 -0
- package/dist/lib/integrations/nest/index.mjs.map +1 -0
- package/dist/lib/integrations/node-express/index.d.ts +15 -0
- package/dist/lib/integrations/node-express/index.js +2959 -0
- package/dist/lib/integrations/node-express/index.js.map +1 -0
- package/dist/lib/integrations/node-express/index.mjs +14 -0
- package/dist/lib/integrations/node-express/index.mjs.map +1 -0
- package/dist/lib/integrations/node-http/index.d.ts +15 -0
- package/dist/lib/integrations/node-http/index.js +2945 -0
- package/dist/lib/integrations/node-http/index.js.map +1 -0
- package/dist/lib/integrations/node-http/index.mjs +13 -0
- package/dist/lib/integrations/node-http/index.mjs.map +1 -0
- package/dist/service-adapters/index.d.ts +162 -0
- package/dist/service-adapters/index.js +1787 -0
- package/dist/service-adapters/index.js.map +1 -0
- package/dist/service-adapters/index.mjs +34 -0
- package/dist/service-adapters/index.mjs.map +1 -0
- package/dist/service-adapters/shared/index.d.ts +9 -0
- package/dist/service-adapters/shared/index.js +72 -0
- package/dist/service-adapters/shared/index.js.map +1 -0
- package/dist/service-adapters/shared/index.mjs +8 -0
- package/dist/service-adapters/shared/index.mjs.map +1 -0
- package/dist/shared-0a7346ce.d.ts +466 -0
- package/dist/shared-35c6eb04.d.ts +448 -0
- package/dist/shared-9ed1dc31.d.ts +414 -0
- package/dist/shared-da5708fe.d.ts +449 -0
- package/dist/utils/index.d.ts +65 -0
- package/dist/utils/index.js +175 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +12 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +14 -20
- package/src/lib/index.ts +7 -6
- package/src/lib/runtime/copilot-runtime.ts +62 -26
- package/src/lib/runtime/telemetry-agent-runner.ts +139 -0
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { TelemetryClient, CopilotKitLowLevelError, CopilotKitErrorCode, randomUUID, randomId, CopilotKitMisuseError, getZodParameters, readBody, CopilotKitError, CopilotKitAgentDiscoveryError, parseJson, convertJsonSchemaToZodSchema } from '@copilotkit/shared';
|
|
2
|
+
import { TelemetryClient, CopilotKitLowLevelError, CopilotKitErrorCode, randomUUID, randomId, isTelemetryDisabled, CopilotKitMisuseError, getZodParameters, readBody, CopilotKitError, CopilotKitAgentDiscoveryError, parseJson, convertJsonSchemaToZodSchema } from '@copilotkit/shared';
|
|
3
3
|
import { HumanMessage, AIMessage, SystemMessage, ToolMessage } from '@langchain/core/messages';
|
|
4
4
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
5
5
|
import { registerEnumType, Field, InputType, ObjectType, createUnionType, InterfaceType, Query, Ctx, Mutation, Arg, Resolver, buildSchemaSync } from 'type-graphql';
|
|
6
|
-
import {
|
|
6
|
+
import { tap, catchError, finalize, ReplaySubject, shareReplay, firstValueFrom, skipWhile, takeWhile, filter, Subject, take } from 'rxjs';
|
|
7
7
|
import { GraphQLJSON, GraphQLJSONObject } from 'graphql-scalars';
|
|
8
8
|
import { Repeater } from 'graphql-yoga';
|
|
9
9
|
import { plainToInstance } from 'class-transformer';
|
|
@@ -65,7 +65,7 @@ var require_package = __commonJS({
|
|
|
65
65
|
publishConfig: {
|
|
66
66
|
access: "public"
|
|
67
67
|
},
|
|
68
|
-
version: "1.50.0
|
|
68
|
+
version: "1.50.0",
|
|
69
69
|
sideEffects: false,
|
|
70
70
|
main: "./dist/index.js",
|
|
71
71
|
module: "./dist/index.mjs",
|
|
@@ -116,12 +116,14 @@ var require_package = __commonJS({
|
|
|
116
116
|
vitest: "^3.2.4"
|
|
117
117
|
},
|
|
118
118
|
dependencies: {
|
|
119
|
+
"@ag-ui/client": "^0.0.42",
|
|
120
|
+
"@ag-ui/core": "^0.0.42",
|
|
121
|
+
"@ag-ui/langgraph": "^0.0.20",
|
|
119
122
|
"@copilotkit/shared": "workspace:*",
|
|
120
|
-
"@copilotkitnext/agent": "0.0.
|
|
121
|
-
"@copilotkitnext/runtime": "0.0.
|
|
123
|
+
"@copilotkitnext/agent": "0.0.31",
|
|
124
|
+
"@copilotkitnext/runtime": "0.0.31",
|
|
122
125
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
123
126
|
"@hono/node-server": "^1.13.5",
|
|
124
|
-
"@langchain/core": "^0.3.38",
|
|
125
127
|
"@scarf/scarf": "^1.3.0",
|
|
126
128
|
"class-transformer": "^0.5.1",
|
|
127
129
|
"class-validator": "^0.14.1",
|
|
@@ -129,7 +131,6 @@ var require_package = __commonJS({
|
|
|
129
131
|
"graphql-scalars": "^1.23.0",
|
|
130
132
|
"graphql-yoga": "^5.3.1",
|
|
131
133
|
hono: "^4.10.3",
|
|
132
|
-
langchain: "^0.3.3",
|
|
133
134
|
openai: "^4.85.1",
|
|
134
135
|
"partial-json": "^0.1.7",
|
|
135
136
|
pino: "^9.2.0",
|
|
@@ -141,27 +142,20 @@ var require_package = __commonJS({
|
|
|
141
142
|
},
|
|
142
143
|
peerDependencies: {
|
|
143
144
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
144
|
-
"@
|
|
145
|
-
"@
|
|
146
|
-
"@
|
|
147
|
-
"@
|
|
148
|
-
"@
|
|
149
|
-
"@langchain/
|
|
150
|
-
"@langchain/community": "^0.3.58",
|
|
151
|
-
"@langchain/google-gauth": "^0.1.0",
|
|
152
|
-
"@langchain/langgraph-sdk": "^0.0.70",
|
|
153
|
-
"@langchain/openai": "^0.4.2",
|
|
145
|
+
"@langchain/aws": ">=0.1.9",
|
|
146
|
+
"@langchain/core": ">=0.3.66",
|
|
147
|
+
"@langchain/community": ">=0.3.58",
|
|
148
|
+
"@langchain/google-gauth": ">=0.1.0",
|
|
149
|
+
"@langchain/langgraph-sdk": ">=0.1.2",
|
|
150
|
+
"@langchain/openai": ">=0.4.2",
|
|
154
151
|
"groq-sdk": ">=0.3.0 <1.0.0",
|
|
155
|
-
langchain: "
|
|
152
|
+
langchain: ">=0.3.3",
|
|
156
153
|
openai: "^4.85.1"
|
|
157
154
|
},
|
|
158
155
|
peerDependenciesMeta: {
|
|
159
156
|
"@anthropic-ai/sdk": {
|
|
160
157
|
optional: true
|
|
161
158
|
},
|
|
162
|
-
"@ag-ui/langgraph": {
|
|
163
|
-
optional: true
|
|
164
|
-
},
|
|
165
159
|
"@langchain/aws": {
|
|
166
160
|
optional: true
|
|
167
161
|
},
|
|
@@ -3233,6 +3227,82 @@ function aguiMessageWithImageToGQLMessage(message) {
|
|
|
3233
3227
|
});
|
|
3234
3228
|
}
|
|
3235
3229
|
__name(aguiMessageWithImageToGQLMessage, "aguiMessageWithImageToGQLMessage");
|
|
3230
|
+
var TelemetryAgentRunner = class {
|
|
3231
|
+
_runner;
|
|
3232
|
+
hashedLgcKey;
|
|
3233
|
+
constructor(config2) {
|
|
3234
|
+
this._runner = (config2 == null ? void 0 : config2.runner) ?? new InMemoryAgentRunner();
|
|
3235
|
+
this.hashedLgcKey = (config2 == null ? void 0 : config2.langsmithApiKey) ? createHash("sha256").update(config2.langsmithApiKey).digest("hex") : void 0;
|
|
3236
|
+
}
|
|
3237
|
+
/**
|
|
3238
|
+
* Runs an agent with telemetry tracking.
|
|
3239
|
+
* Wraps the underlying runner's Observable stream with telemetry events.
|
|
3240
|
+
*/
|
|
3241
|
+
run(...args) {
|
|
3242
|
+
const streamInfo = {
|
|
3243
|
+
hashedLgcKey: this.hashedLgcKey
|
|
3244
|
+
};
|
|
3245
|
+
let streamErrored = false;
|
|
3246
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
|
|
3247
|
+
hashedLgcKey: this.hashedLgcKey
|
|
3248
|
+
});
|
|
3249
|
+
return this._runner.run(...args).pipe(
|
|
3250
|
+
// Extract metadata from events if available
|
|
3251
|
+
tap((event) => {
|
|
3252
|
+
var _a;
|
|
3253
|
+
const rawEvent = event.rawEvent;
|
|
3254
|
+
if (rawEvent == null ? void 0 : rawEvent.data) {
|
|
3255
|
+
const data = rawEvent.data;
|
|
3256
|
+
if ((_a = data == null ? void 0 : data.output) == null ? void 0 : _a.model) {
|
|
3257
|
+
streamInfo.model = data.output.model;
|
|
3258
|
+
streamInfo.provider = data.output.model;
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
if (rawEvent == null ? void 0 : rawEvent.metadata) {
|
|
3262
|
+
const metadata = rawEvent.metadata;
|
|
3263
|
+
if (metadata == null ? void 0 : metadata.langgraph_host) {
|
|
3264
|
+
streamInfo.langGraphHost = metadata.langgraph_host;
|
|
3265
|
+
}
|
|
3266
|
+
if (metadata == null ? void 0 : metadata.langgraph_version) {
|
|
3267
|
+
streamInfo.langGraphVersion = metadata.langgraph_version;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
}),
|
|
3271
|
+
catchError((error) => {
|
|
3272
|
+
streamErrored = true;
|
|
3273
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
|
|
3274
|
+
...streamInfo,
|
|
3275
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3276
|
+
});
|
|
3277
|
+
throw error;
|
|
3278
|
+
}),
|
|
3279
|
+
finalize(() => {
|
|
3280
|
+
if (!streamErrored) {
|
|
3281
|
+
telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
|
|
3282
|
+
}
|
|
3283
|
+
})
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
/**
|
|
3287
|
+
* Delegates to the underlying runner's connect method
|
|
3288
|
+
*/
|
|
3289
|
+
connect(...args) {
|
|
3290
|
+
return this._runner.connect(...args);
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* Delegates to the underlying runner's isRunning method
|
|
3294
|
+
*/
|
|
3295
|
+
isRunning(...args) {
|
|
3296
|
+
return this._runner.isRunning(...args);
|
|
3297
|
+
}
|
|
3298
|
+
/**
|
|
3299
|
+
* Delegates to the underlying runner's stop method
|
|
3300
|
+
*/
|
|
3301
|
+
stop(...args) {
|
|
3302
|
+
return this._runner.stop(...args);
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
__name(TelemetryAgentRunner, "TelemetryAgentRunner");
|
|
3236
3306
|
|
|
3237
3307
|
// src/lib/runtime/types.ts
|
|
3238
3308
|
var EndpointType;
|
|
@@ -3386,12 +3456,16 @@ var CopilotRuntime = class {
|
|
|
3386
3456
|
constructor(params) {
|
|
3387
3457
|
const agents = (params == null ? void 0 : params.agents) ?? {};
|
|
3388
3458
|
const endpointAgents = this.assignEndpointsToAgents((params == null ? void 0 : params.remoteEndpoints) ?? []);
|
|
3459
|
+
const baseRunner = (params == null ? void 0 : params.runner) ?? new InMemoryAgentRunner();
|
|
3460
|
+
const runner = isTelemetryDisabled() ? baseRunner : new TelemetryAgentRunner({
|
|
3461
|
+
runner: baseRunner
|
|
3462
|
+
});
|
|
3389
3463
|
this.runtimeArgs = {
|
|
3390
3464
|
agents: {
|
|
3391
3465
|
...endpointAgents,
|
|
3392
3466
|
...agents
|
|
3393
3467
|
},
|
|
3394
|
-
runner
|
|
3468
|
+
runner,
|
|
3395
3469
|
// TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
|
|
3396
3470
|
// transcriptionService: params?.transcriptionService,
|
|
3397
3471
|
beforeRequestMiddleware: this.createOnBeforeRequestHandler(params).bind(this),
|
|
@@ -3417,6 +3491,7 @@ var CopilotRuntime = class {
|
|
|
3417
3491
|
}
|
|
3418
3492
|
handleServiceAdapter(serviceAdapter) {
|
|
3419
3493
|
this.runtimeArgs.agents = Promise.resolve(this.runtimeArgs.agents ?? {}).then(async (agents) => {
|
|
3494
|
+
var _a;
|
|
3420
3495
|
let agentsList = agents;
|
|
3421
3496
|
const isAgentsListEmpty = !Object.keys(agents).length;
|
|
3422
3497
|
const hasServiceAdapter = Boolean(serviceAdapter);
|
|
@@ -3434,10 +3509,11 @@ var CopilotRuntime = class {
|
|
|
3434
3509
|
model: `${serviceAdapter.provider}/${serviceAdapter.model}`
|
|
3435
3510
|
});
|
|
3436
3511
|
}
|
|
3437
|
-
|
|
3512
|
+
const actions = (_a = this.params) == null ? void 0 : _a.actions;
|
|
3513
|
+
if (actions) {
|
|
3438
3514
|
const mcpTools = await this.getToolsFromMCP();
|
|
3439
3515
|
agentsList = this.assignToolsToAgents(agents, [
|
|
3440
|
-
...this.getToolsFromActions(
|
|
3516
|
+
...this.getToolsFromActions(actions),
|
|
3441
3517
|
...mcpTools
|
|
3442
3518
|
]);
|
|
3443
3519
|
}
|
|
@@ -3484,11 +3560,24 @@ var CopilotRuntime = class {
|
|
|
3484
3560
|
}
|
|
3485
3561
|
createOnBeforeRequestHandler(params) {
|
|
3486
3562
|
return async (hookParams) => {
|
|
3487
|
-
var _a, _b;
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3563
|
+
var _a, _b, _c, _d;
|
|
3564
|
+
const { request } = hookParams;
|
|
3565
|
+
const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
|
|
3566
|
+
const body = await readBody(request);
|
|
3567
|
+
const forwardedProps = body.forwardedProps;
|
|
3568
|
+
const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
|
|
3569
|
+
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
3570
|
+
"cloud.guardrails.enabled": ((_a = forwardedProps == null ? void 0 : forwardedProps.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
3571
|
+
requestType: ((_b = forwardedProps == null ? void 0 : forwardedProps.metadata) == null ? void 0 : _b.requestType) ?? "unknown",
|
|
3572
|
+
"cloud.api_key_provided": !!publicApiKey,
|
|
3573
|
+
...publicApiKey ? {
|
|
3574
|
+
"cloud.public_api_key": publicApiKey
|
|
3575
|
+
} : {},
|
|
3576
|
+
"cloud.base_url": cloudBaseUrl
|
|
3577
|
+
});
|
|
3578
|
+
(_c = params == null ? void 0 : params.beforeRequestMiddleware) == null ? void 0 : _c.call(params, hookParams);
|
|
3579
|
+
if ((_d = params == null ? void 0 : params.middleware) == null ? void 0 : _d.onBeforeRequest) {
|
|
3580
|
+
const { request: request2, runtime, path } = hookParams;
|
|
3492
3581
|
const gqlMessages = aguiToGQL(body.messages).reduce((acc, msg) => {
|
|
3493
3582
|
if ("role" in msg && msg.role === "user") {
|
|
3494
3583
|
acc.inputMessages.push(msg);
|
|
@@ -3506,7 +3595,7 @@ var CopilotRuntime = class {
|
|
|
3506
3595
|
runId: body.runId,
|
|
3507
3596
|
inputMessages,
|
|
3508
3597
|
properties: body.forwardedProps,
|
|
3509
|
-
url:
|
|
3598
|
+
url: request2.url
|
|
3510
3599
|
});
|
|
3511
3600
|
}
|
|
3512
3601
|
};
|
|
@@ -5469,6 +5558,6 @@ var EmptyAdapter = class {
|
|
|
5469
5558
|
__name(EmptyAdapter, "EmptyAdapter");
|
|
5470
5559
|
var ExperimentalEmptyAdapter = EmptyAdapter;
|
|
5471
5560
|
|
|
5472
|
-
export { AnthropicAdapter, BedrockAdapter, CopilotRuntime, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GroqAdapter, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAssistantAdapter, RemoteChain, UnifyAdapter, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, readableStreamToNodeStream, resolveEndpointType };
|
|
5561
|
+
export { AnthropicAdapter, BedrockAdapter, CopilotRuntime, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, GoogleGenerativeAIAdapter, GroqAdapter, GuardrailsValidationFailureResponse, LangChainAdapter, LangGraphAgent, LangGraphHttpAgent, MessageStreamInterruptedResponse, OpenAIAdapter, OpenAIAssistantAdapter, RemoteChain, TelemetryAgentRunner, UnifyAdapter, UnknownErrorResponse, addCustomHeaderPlugin, buildSchema, config, convertMCPToolsToActions, convertServiceAdapterError, copilotKitEndpoint, copilotRuntimeNestEndpoint, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint, copilotRuntimeNodeExpressEndpoint, copilotRuntimeNodeHttpEndpoint, createContext, createLogger, extractParametersFromSchema, generateMcpToolInstructions, getCommonConfig, langGraphPlatformEndpoint, readableStreamToNodeStream, resolveEndpointType };
|
|
5473
5562
|
//# sourceMappingURL=out.js.map
|
|
5474
5563
|
//# sourceMappingURL=index.mjs.map
|