@copilotkit/runtime 1.50.0-beta.9 → 1.50.1-next.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/dist/chunk-27JKTS6P.mjs +1704 -0
  3. package/dist/chunk-27JKTS6P.mjs.map +1 -0
  4. package/dist/{chunk-FMU55SEU.mjs → chunk-2GPTVDTO.mjs} +2 -2
  5. package/dist/chunk-3AJVKDZX.mjs +3097 -0
  6. package/dist/chunk-3AJVKDZX.mjs.map +1 -0
  7. package/dist/{chunk-BJEYMRDD.mjs → chunk-45RCC3ZS.mjs} +2 -2
  8. package/dist/chunk-4EHJ4XFJ.mjs +25 -0
  9. package/dist/chunk-4EHJ4XFJ.mjs.map +1 -0
  10. package/dist/chunk-4IANB4TC.mjs +25 -0
  11. package/dist/chunk-4IANB4TC.mjs.map +1 -0
  12. package/dist/{chunk-Z752VE75.mjs → chunk-4KES76K3.mjs} +2 -2
  13. package/dist/chunk-4OGE3SLW.mjs +3100 -0
  14. package/dist/chunk-4OGE3SLW.mjs.map +1 -0
  15. package/dist/chunk-54YJBMCP.mjs +3097 -0
  16. package/dist/chunk-54YJBMCP.mjs.map +1 -0
  17. package/dist/chunk-6ER4SZYH.mjs +74 -0
  18. package/dist/chunk-6ER4SZYH.mjs.map +1 -0
  19. package/dist/chunk-6TNSLHVR.mjs +74 -0
  20. package/dist/chunk-6TNSLHVR.mjs.map +1 -0
  21. package/dist/chunk-7V4BK7TZ.mjs +25 -0
  22. package/dist/chunk-7V4BK7TZ.mjs.map +1 -0
  23. package/dist/chunk-7YZIEXD2.mjs +74 -0
  24. package/dist/chunk-7YZIEXD2.mjs.map +1 -0
  25. package/dist/chunk-A4XHOAFU.mjs +25 -0
  26. package/dist/chunk-A4XHOAFU.mjs.map +1 -0
  27. package/dist/chunk-A555KEAD.mjs +6020 -0
  28. package/dist/chunk-A555KEAD.mjs.map +1 -0
  29. package/dist/chunk-AF73TFTX.mjs +74 -0
  30. package/dist/chunk-AF73TFTX.mjs.map +1 -0
  31. package/dist/chunk-AQG2SVCA.mjs +25 -0
  32. package/dist/chunk-AQG2SVCA.mjs.map +1 -0
  33. package/dist/chunk-BJZHMXND.mjs +74 -0
  34. package/dist/chunk-BJZHMXND.mjs.map +1 -0
  35. package/dist/chunk-CB2OJXF6.mjs +25 -0
  36. package/dist/chunk-CB2OJXF6.mjs.map +1 -0
  37. package/dist/chunk-CEOMFPJU.mjs +6020 -0
  38. package/dist/chunk-CEOMFPJU.mjs.map +1 -0
  39. package/dist/chunk-CZVLR7CC.mjs +175 -0
  40. package/dist/chunk-CZVLR7CC.mjs.map +1 -0
  41. package/dist/{chunk-SBCOROE4.mjs → chunk-DCEEHMLJ.mjs} +16 -1
  42. package/dist/chunk-DCEEHMLJ.mjs.map +1 -0
  43. package/dist/chunk-DE3CLKUG.mjs +25 -0
  44. package/dist/chunk-DE3CLKUG.mjs.map +1 -0
  45. package/dist/chunk-DTPRUTNV.mjs +25 -0
  46. package/dist/chunk-DTPRUTNV.mjs.map +1 -0
  47. package/dist/{chunk-TTUAEJLD.mjs → chunk-ERUOA47O.mjs} +11 -2
  48. package/dist/chunk-ERUOA47O.mjs.map +1 -0
  49. package/dist/chunk-ESSRC64W.mjs +74 -0
  50. package/dist/chunk-ESSRC64W.mjs.map +1 -0
  51. package/dist/chunk-GRAN6K6N.mjs +25 -0
  52. package/dist/chunk-GRAN6K6N.mjs.map +1 -0
  53. package/dist/chunk-I27F2UPA.mjs +175 -0
  54. package/dist/chunk-I27F2UPA.mjs.map +1 -0
  55. package/dist/chunk-IAZKTOQW.mjs +25 -0
  56. package/dist/chunk-IAZKTOQW.mjs.map +1 -0
  57. package/dist/chunk-J6XZ5MFB.mjs +25 -0
  58. package/dist/chunk-J6XZ5MFB.mjs.map +1 -0
  59. package/dist/chunk-JJ32MA4C.mjs +73 -0
  60. package/dist/chunk-JJ32MA4C.mjs.map +1 -0
  61. package/dist/chunk-JJY4ZTHQ.mjs +25 -0
  62. package/dist/chunk-JJY4ZTHQ.mjs.map +1 -0
  63. package/dist/chunk-KEYLBFU2.mjs +3117 -0
  64. package/dist/chunk-KEYLBFU2.mjs.map +1 -0
  65. package/dist/chunk-KQ53L4WZ.mjs +3094 -0
  66. package/dist/chunk-KQ53L4WZ.mjs.map +1 -0
  67. package/dist/chunk-KTELVQ67.mjs +3098 -0
  68. package/dist/chunk-KTELVQ67.mjs.map +1 -0
  69. package/dist/chunk-LPEPX6NH.mjs +25 -0
  70. package/dist/chunk-LPEPX6NH.mjs.map +1 -0
  71. package/dist/chunk-MDXE55DK.mjs +3117 -0
  72. package/dist/chunk-MDXE55DK.mjs.map +1 -0
  73. package/dist/chunk-MMFUVOXH.mjs +73 -0
  74. package/dist/chunk-MMFUVOXH.mjs.map +1 -0
  75. package/dist/chunk-N3Y4U66N.mjs +253 -0
  76. package/dist/chunk-N3Y4U66N.mjs.map +1 -0
  77. package/dist/chunk-O7UYB4MH.mjs +25 -0
  78. package/dist/chunk-O7UYB4MH.mjs.map +1 -0
  79. package/dist/chunk-OFNVQHNM.mjs +3089 -0
  80. package/dist/chunk-OFNVQHNM.mjs.map +1 -0
  81. package/dist/{chunk-DZV4ZIAR.mjs → chunk-OFSV5GET.mjs} +17 -6
  82. package/dist/chunk-OFSV5GET.mjs.map +1 -0
  83. package/dist/chunk-OMRST67R.mjs +25 -0
  84. package/dist/chunk-OMRST67R.mjs.map +1 -0
  85. package/dist/chunk-PRZHE74A.mjs +25 -0
  86. package/dist/chunk-PRZHE74A.mjs.map +1 -0
  87. package/dist/chunk-PTYRVXXP.mjs +80 -0
  88. package/dist/chunk-PTYRVXXP.mjs.map +1 -0
  89. package/dist/chunk-R22B5CCO.mjs +25 -0
  90. package/dist/chunk-R22B5CCO.mjs.map +1 -0
  91. package/dist/chunk-SHBDMA63.mjs +141 -0
  92. package/dist/chunk-SHBDMA63.mjs.map +1 -0
  93. package/dist/chunk-SPVXBPRA.mjs +74 -0
  94. package/dist/chunk-SPVXBPRA.mjs.map +1 -0
  95. package/dist/chunk-T72G46ME.mjs +25 -0
  96. package/dist/chunk-T72G46ME.mjs.map +1 -0
  97. package/dist/chunk-TGELROPU.mjs +25 -0
  98. package/dist/chunk-TGELROPU.mjs.map +1 -0
  99. package/dist/chunk-UNX4IAAD.mjs +25 -0
  100. package/dist/chunk-UNX4IAAD.mjs.map +1 -0
  101. package/dist/chunk-V4DHVC7M.mjs +3085 -0
  102. package/dist/chunk-V4DHVC7M.mjs.map +1 -0
  103. package/dist/chunk-VVRFOB66.mjs +25 -0
  104. package/dist/chunk-VVRFOB66.mjs.map +1 -0
  105. package/dist/chunk-W6NVBYM6.mjs +80 -0
  106. package/dist/chunk-W6NVBYM6.mjs.map +1 -0
  107. package/dist/chunk-W7MBACGC.mjs +74 -0
  108. package/dist/chunk-W7MBACGC.mjs.map +1 -0
  109. package/dist/chunk-WMD4XZZS.mjs +25 -0
  110. package/dist/chunk-WMD4XZZS.mjs.map +1 -0
  111. package/dist/chunk-WX2ZNCRT.mjs +74 -0
  112. package/dist/chunk-WX2ZNCRT.mjs.map +1 -0
  113. package/dist/chunk-Y2Z62E2T.mjs +74 -0
  114. package/dist/chunk-Y2Z62E2T.mjs.map +1 -0
  115. package/dist/chunk-YO4I6RVI.mjs +25 -0
  116. package/dist/chunk-YO4I6RVI.mjs.map +1 -0
  117. package/dist/chunk-Z6Q5IW6I.mjs +3098 -0
  118. package/dist/chunk-Z6Q5IW6I.mjs.map +1 -0
  119. package/dist/chunk-Z726O3G2.mjs +25 -0
  120. package/dist/chunk-Z726O3G2.mjs.map +1 -0
  121. package/dist/chunk-ZE4SMZZR.mjs +3097 -0
  122. package/dist/chunk-ZE4SMZZR.mjs.map +1 -0
  123. package/dist/chunk-ZULZB33C.mjs +73 -0
  124. package/dist/chunk-ZULZB33C.mjs.map +1 -0
  125. package/dist/chunk-ZVRGXMY7.mjs +25 -0
  126. package/dist/chunk-ZVRGXMY7.mjs.map +1 -0
  127. package/dist/chunk-ZZ35WBYQ.mjs +25 -0
  128. package/dist/chunk-ZZ35WBYQ.mjs.map +1 -0
  129. package/dist/graphql/types/converted/index.d.ts +1 -1
  130. package/dist/graphql/types/converted/index.js +16 -110
  131. package/dist/graphql/types/converted/index.js.map +1 -1
  132. package/dist/graphql/types/converted/index.mjs +2 -3
  133. package/dist/{groq-adapter-50bc6e4a.d.ts → groq-adapter-540da9c3.d.ts} +6 -1
  134. package/dist/groq-adapter-a6f5e9d2.d.ts +331 -0
  135. package/dist/groq-adapter-c8aec5c5.d.ts +321 -0
  136. package/dist/index-96b330da.d.ts +119 -0
  137. package/dist/index.d.ts +72 -9
  138. package/dist/index.js +127 -31
  139. package/dist/index.js.map +1 -1
  140. package/dist/index.mjs +129 -34
  141. package/dist/index.mjs.map +1 -1
  142. package/dist/langserve-0c6100e3.d.ts +257 -0
  143. package/dist/langserve-978d5790.d.ts +243 -0
  144. package/dist/{langserve-74a52292.d.ts → langserve-9fc76ce5.d.ts} +1 -0
  145. package/dist/lib/index.d.ts +5 -59
  146. package/dist/lib/index.js +3702 -803
  147. package/dist/lib/index.js.map +1 -1
  148. package/dist/lib/index.mjs +20 -18
  149. package/dist/lib/integrations/index.d.ts +15 -9
  150. package/dist/lib/integrations/index.js +215 -187
  151. package/dist/lib/integrations/index.js.map +1 -1
  152. package/dist/lib/integrations/index.mjs +8 -7
  153. package/dist/lib/integrations/nest/index.d.ts +5 -6
  154. package/dist/lib/integrations/nest/index.js +197 -175
  155. package/dist/lib/integrations/nest/index.js.map +1 -1
  156. package/dist/lib/integrations/nest/index.mjs +6 -5
  157. package/dist/lib/integrations/node-express/index.d.ts +5 -6
  158. package/dist/lib/integrations/node-express/index.js +197 -175
  159. package/dist/lib/integrations/node-express/index.js.map +1 -1
  160. package/dist/lib/integrations/node-express/index.mjs +6 -5
  161. package/dist/lib/integrations/node-http/index.d.ts +5 -6
  162. package/dist/lib/integrations/node-http/index.js +197 -175
  163. package/dist/lib/integrations/node-http/index.js.map +1 -1
  164. package/dist/lib/integrations/node-http/index.mjs +5 -4
  165. package/dist/service-adapters/index.d.ts +7 -11
  166. package/dist/service-adapters/index.js +8 -21
  167. package/dist/service-adapters/index.js.map +1 -1
  168. package/dist/service-adapters/index.mjs +2 -4
  169. package/dist/shared-0a7346ce.d.ts +466 -0
  170. package/dist/{shared-f6d43ef8.d.ts → shared-35c6eb04.d.ts} +3 -1
  171. package/dist/shared-9ed1dc31.d.ts +414 -0
  172. package/dist/shared-da5708fe.d.ts +449 -0
  173. package/package.json +14 -20
  174. package/src/lib/index.ts +7 -6
  175. package/src/lib/runtime/copilot-runtime.ts +62 -26
  176. package/src/lib/runtime/telemetry-agent-runner.ts +139 -0
  177. package/src/service-adapters/google/google-genai-adapter.ts +19 -4
  178. package/dist/chunk-DZV4ZIAR.mjs.map +0 -1
  179. package/dist/chunk-SBCOROE4.mjs.map +0 -1
  180. package/dist/chunk-TTUAEJLD.mjs.map +0 -1
  181. /package/dist/{chunk-FMU55SEU.mjs.map → chunk-2GPTVDTO.mjs.map} +0 -0
  182. /package/dist/{chunk-BJEYMRDD.mjs.map → chunk-45RCC3ZS.mjs.map} +0 -0
  183. /package/dist/{chunk-Z752VE75.mjs.map → chunk-4KES76K3.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ var require_package = __commonJS({
72
72
  publishConfig: {
73
73
  access: "public"
74
74
  },
75
- version: "1.50.0-beta.9",
75
+ version: "1.50.1-next.0",
76
76
  sideEffects: false,
77
77
  main: "./dist/index.js",
78
78
  module: "./dist/index.mjs",
@@ -123,12 +123,14 @@ var require_package = __commonJS({
123
123
  vitest: "^3.2.4"
124
124
  },
125
125
  dependencies: {
126
+ "@ag-ui/client": "^0.0.42",
127
+ "@ag-ui/core": "^0.0.42",
128
+ "@ag-ui/langgraph": "^0.0.20",
126
129
  "@copilotkit/shared": "workspace:*",
127
- "@copilotkitnext/agent": "0.0.28",
128
- "@copilotkitnext/runtime": "0.0.28",
130
+ "@copilotkitnext/agent": "0.0.31",
131
+ "@copilotkitnext/runtime": "0.0.31",
129
132
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
130
133
  "@hono/node-server": "^1.13.5",
131
- "@langchain/core": "^0.3.38",
132
134
  "@scarf/scarf": "^1.3.0",
133
135
  "class-transformer": "^0.5.1",
134
136
  "class-validator": "^0.14.1",
@@ -136,7 +138,6 @@ var require_package = __commonJS({
136
138
  "graphql-scalars": "^1.23.0",
137
139
  "graphql-yoga": "^5.3.1",
138
140
  hono: "^4.10.3",
139
- langchain: "^0.3.3",
140
141
  openai: "^4.85.1",
141
142
  "partial-json": "^0.1.7",
142
143
  pino: "^9.2.0",
@@ -148,27 +149,20 @@ var require_package = __commonJS({
148
149
  },
149
150
  peerDependencies: {
150
151
  "@anthropic-ai/sdk": "^0.57.0",
151
- "@ag-ui/client": "^0.0.42",
152
- "@ag-ui/core": ">=0.0.42",
153
- "@ag-ui/encoder": ">=0.0.42",
154
- "@ag-ui/langgraph": ">=0.0.20",
155
- "@ag-ui/proto": ">=0.0.42",
156
- "@langchain/aws": "^0.1.9",
157
- "@langchain/community": "^0.3.58",
158
- "@langchain/google-gauth": "^0.1.0",
159
- "@langchain/langgraph-sdk": "^0.0.70",
160
- "@langchain/openai": "^0.4.2",
152
+ "@langchain/aws": ">=0.1.9",
153
+ "@langchain/core": ">=0.3.66",
154
+ "@langchain/community": ">=0.3.58",
155
+ "@langchain/google-gauth": ">=0.1.0",
156
+ "@langchain/langgraph-sdk": ">=0.1.2",
157
+ "@langchain/openai": ">=0.4.2",
161
158
  "groq-sdk": ">=0.3.0 <1.0.0",
162
- langchain: "^0.3.3",
159
+ langchain: ">=0.3.3",
163
160
  openai: "^4.85.1"
164
161
  },
165
162
  peerDependenciesMeta: {
166
163
  "@anthropic-ai/sdk": {
167
164
  optional: true
168
165
  },
169
- "@ag-ui/langgraph": {
170
- optional: true
171
- },
172
166
  "@langchain/aws": {
173
167
  optional: true
174
168
  },
@@ -862,11 +856,17 @@ var LangChainAdapter = class {
862
856
  __name(LangChainAdapter, "LangChainAdapter");
863
857
 
864
858
  // src/service-adapters/google/google-genai-adapter.ts
865
- var DEFAULT_MODEL2 = "gemini-1.5-pro";
859
+ var DEFAULT_MODEL2 = "gemini-2.5-flash";
860
+ var DEFAULT_API_VERSION = "v1";
861
+ var hasWarnedDefaultGoogleModel = false;
866
862
  var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
867
863
  provider = "google";
868
864
  model = DEFAULT_MODEL2;
869
865
  constructor(options) {
866
+ if (!hasWarnedDefaultGoogleModel && !(options == null ? void 0 : options.model) && !(options == null ? void 0 : options.apiVersion)) {
867
+ console.warn(`You are using the GoogleGenerativeAIAdapter without explicitly setting a model or apiVersion. CopilotKit will default to apiVersion="v1" and model="${DEFAULT_MODEL2}". To silence this warning, pass model and apiVersion when constructing the adapter.`);
868
+ hasWarnedDefaultGoogleModel = true;
869
+ }
870
870
  super({
871
871
  chainFn: async ({ messages, tools, threadId }) => {
872
872
  const { ChatGoogle } = __require("@langchain/google-gauth");
@@ -878,11 +878,11 @@ var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
878
878
  const aiMsg = message;
879
879
  return aiMsg.content && String(aiMsg.content).trim().length > 0 || aiMsg.tool_calls && aiMsg.tool_calls.length > 0;
880
880
  });
881
- this.model = (options == null ? void 0 : options.model) ?? "gemini-1.5-pro";
881
+ this.model = (options == null ? void 0 : options.model) ?? DEFAULT_MODEL2;
882
882
  const model = new ChatGoogle({
883
883
  apiKey: (options == null ? void 0 : options.apiKey) ?? process.env.GOOGLE_API_KEY,
884
884
  modelName: this.model,
885
- apiVersion: "v1beta"
885
+ apiVersion: (options == null ? void 0 : options.apiVersion) ?? DEFAULT_API_VERSION
886
886
  }).bindTools(tools);
887
887
  return model.stream(filteredMessages, {
888
888
  metadata: {
@@ -3240,6 +3240,82 @@ function aguiMessageWithImageToGQLMessage(message) {
3240
3240
  });
3241
3241
  }
3242
3242
  __name(aguiMessageWithImageToGQLMessage, "aguiMessageWithImageToGQLMessage");
3243
+ var TelemetryAgentRunner = class {
3244
+ _runner;
3245
+ hashedLgcKey;
3246
+ constructor(config2) {
3247
+ this._runner = (config2 == null ? void 0 : config2.runner) ?? new runtime.InMemoryAgentRunner();
3248
+ this.hashedLgcKey = (config2 == null ? void 0 : config2.langsmithApiKey) ? crypto.createHash("sha256").update(config2.langsmithApiKey).digest("hex") : void 0;
3249
+ }
3250
+ /**
3251
+ * Runs an agent with telemetry tracking.
3252
+ * Wraps the underlying runner's Observable stream with telemetry events.
3253
+ */
3254
+ run(...args) {
3255
+ const streamInfo = {
3256
+ hashedLgcKey: this.hashedLgcKey
3257
+ };
3258
+ let streamErrored = false;
3259
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
3260
+ hashedLgcKey: this.hashedLgcKey
3261
+ });
3262
+ return this._runner.run(...args).pipe(
3263
+ // Extract metadata from events if available
3264
+ rxjs.tap((event) => {
3265
+ var _a;
3266
+ const rawEvent = event.rawEvent;
3267
+ if (rawEvent == null ? void 0 : rawEvent.data) {
3268
+ const data = rawEvent.data;
3269
+ if ((_a = data == null ? void 0 : data.output) == null ? void 0 : _a.model) {
3270
+ streamInfo.model = data.output.model;
3271
+ streamInfo.provider = data.output.model;
3272
+ }
3273
+ }
3274
+ if (rawEvent == null ? void 0 : rawEvent.metadata) {
3275
+ const metadata = rawEvent.metadata;
3276
+ if (metadata == null ? void 0 : metadata.langgraph_host) {
3277
+ streamInfo.langGraphHost = metadata.langgraph_host;
3278
+ }
3279
+ if (metadata == null ? void 0 : metadata.langgraph_version) {
3280
+ streamInfo.langGraphVersion = metadata.langgraph_version;
3281
+ }
3282
+ }
3283
+ }),
3284
+ rxjs.catchError((error) => {
3285
+ streamErrored = true;
3286
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
3287
+ ...streamInfo,
3288
+ error: error instanceof Error ? error.message : String(error)
3289
+ });
3290
+ throw error;
3291
+ }),
3292
+ rxjs.finalize(() => {
3293
+ if (!streamErrored) {
3294
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
3295
+ }
3296
+ })
3297
+ );
3298
+ }
3299
+ /**
3300
+ * Delegates to the underlying runner's connect method
3301
+ */
3302
+ connect(...args) {
3303
+ return this._runner.connect(...args);
3304
+ }
3305
+ /**
3306
+ * Delegates to the underlying runner's isRunning method
3307
+ */
3308
+ isRunning(...args) {
3309
+ return this._runner.isRunning(...args);
3310
+ }
3311
+ /**
3312
+ * Delegates to the underlying runner's stop method
3313
+ */
3314
+ stop(...args) {
3315
+ return this._runner.stop(...args);
3316
+ }
3317
+ };
3318
+ __name(TelemetryAgentRunner, "TelemetryAgentRunner");
3243
3319
 
3244
3320
  // src/lib/runtime/types.ts
3245
3321
  var EndpointType;
@@ -3393,12 +3469,16 @@ var CopilotRuntime = class {
3393
3469
  constructor(params) {
3394
3470
  const agents = (params == null ? void 0 : params.agents) ?? {};
3395
3471
  const endpointAgents = this.assignEndpointsToAgents((params == null ? void 0 : params.remoteEndpoints) ?? []);
3472
+ const baseRunner = (params == null ? void 0 : params.runner) ?? new runtime.InMemoryAgentRunner();
3473
+ const runner = shared.isTelemetryDisabled() ? baseRunner : new TelemetryAgentRunner({
3474
+ runner: baseRunner
3475
+ });
3396
3476
  this.runtimeArgs = {
3397
3477
  agents: {
3398
3478
  ...endpointAgents,
3399
3479
  ...agents
3400
3480
  },
3401
- runner: (params == null ? void 0 : params.runner) ?? new runtime.InMemoryAgentRunner(),
3481
+ runner,
3402
3482
  // TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
3403
3483
  // transcriptionService: params?.transcriptionService,
3404
3484
  beforeRequestMiddleware: this.createOnBeforeRequestHandler(params).bind(this),
@@ -3424,6 +3504,7 @@ var CopilotRuntime = class {
3424
3504
  }
3425
3505
  handleServiceAdapter(serviceAdapter) {
3426
3506
  this.runtimeArgs.agents = Promise.resolve(this.runtimeArgs.agents ?? {}).then(async (agents) => {
3507
+ var _a;
3427
3508
  let agentsList = agents;
3428
3509
  const isAgentsListEmpty = !Object.keys(agents).length;
3429
3510
  const hasServiceAdapter = Boolean(serviceAdapter);
@@ -3441,10 +3522,11 @@ var CopilotRuntime = class {
3441
3522
  model: `${serviceAdapter.provider}/${serviceAdapter.model}`
3442
3523
  });
3443
3524
  }
3444
- if (this.params.actions) {
3525
+ const actions = (_a = this.params) == null ? void 0 : _a.actions;
3526
+ if (actions) {
3445
3527
  const mcpTools = await this.getToolsFromMCP();
3446
3528
  agentsList = this.assignToolsToAgents(agents, [
3447
- ...this.getToolsFromActions(this.params.actions),
3529
+ ...this.getToolsFromActions(actions),
3448
3530
  ...mcpTools
3449
3531
  ]);
3450
3532
  }
@@ -3491,11 +3573,24 @@ var CopilotRuntime = class {
3491
3573
  }
3492
3574
  createOnBeforeRequestHandler(params) {
3493
3575
  return async (hookParams) => {
3494
- var _a, _b;
3495
- (_a = params == null ? void 0 : params.beforeRequestMiddleware) == null ? void 0 : _a.call(params, hookParams);
3496
- if ((_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onBeforeRequest) {
3497
- const { request, runtime, path } = hookParams;
3498
- const body = await shared.readBody(request);
3576
+ var _a, _b, _c, _d;
3577
+ const { request } = hookParams;
3578
+ const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
3579
+ const body = await shared.readBody(request);
3580
+ const forwardedProps = body.forwardedProps;
3581
+ const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
3582
+ telemetry_client_default.capture("oss.runtime.copilot_request_created", {
3583
+ "cloud.guardrails.enabled": ((_a = forwardedProps == null ? void 0 : forwardedProps.cloud) == null ? void 0 : _a.guardrails) !== void 0,
3584
+ requestType: ((_b = forwardedProps == null ? void 0 : forwardedProps.metadata) == null ? void 0 : _b.requestType) ?? "unknown",
3585
+ "cloud.api_key_provided": !!publicApiKey,
3586
+ ...publicApiKey ? {
3587
+ "cloud.public_api_key": publicApiKey
3588
+ } : {},
3589
+ "cloud.base_url": cloudBaseUrl
3590
+ });
3591
+ (_c = params == null ? void 0 : params.beforeRequestMiddleware) == null ? void 0 : _c.call(params, hookParams);
3592
+ if ((_d = params == null ? void 0 : params.middleware) == null ? void 0 : _d.onBeforeRequest) {
3593
+ const { request: request2, runtime, path } = hookParams;
3499
3594
  const gqlMessages = aguiToGQL(body.messages).reduce((acc, msg) => {
3500
3595
  if ("role" in msg && msg.role === "user") {
3501
3596
  acc.inputMessages.push(msg);
@@ -3513,7 +3608,7 @@ var CopilotRuntime = class {
3513
3608
  runId: body.runId,
3514
3609
  inputMessages,
3515
3610
  properties: body.forwardedProps,
3516
- url: request.url
3611
+ url: request2.url
3517
3612
  });
3518
3613
  }
3519
3614
  };
@@ -5492,6 +5587,7 @@ exports.MessageStreamInterruptedResponse = MessageStreamInterruptedResponse;
5492
5587
  exports.OpenAIAdapter = OpenAIAdapter;
5493
5588
  exports.OpenAIAssistantAdapter = OpenAIAssistantAdapter;
5494
5589
  exports.RemoteChain = RemoteChain;
5590
+ exports.TelemetryAgentRunner = TelemetryAgentRunner;
5495
5591
  exports.UnifyAdapter = UnifyAdapter;
5496
5592
  exports.UnknownErrorResponse = UnknownErrorResponse;
5497
5593
  exports.addCustomHeaderPlugin = addCustomHeaderPlugin;