@copilotkit/runtime 1.55.0-next.8 → 1.55.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 (345) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/agent/index.cjs +101 -12
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts.map +1 -1
  5. package/dist/agent/index.d.mts.map +1 -1
  6. package/dist/agent/index.mjs +102 -13
  7. package/dist/agent/index.mjs.map +1 -1
  8. package/dist/lib/runtime/agent-integrations/langgraph/agent.cjs.map +1 -1
  9. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts +4 -841
  10. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts.map +1 -1
  11. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.mts +4 -841
  12. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.mts.map +1 -1
  13. package/dist/lib/runtime/agent-integrations/langgraph/agent.mjs.map +1 -1
  14. package/dist/lib/runtime/copilot-runtime.cjs +3 -2
  15. package/dist/lib/runtime/copilot-runtime.cjs.map +1 -1
  16. package/dist/lib/runtime/copilot-runtime.d.cts +1 -1
  17. package/dist/lib/runtime/copilot-runtime.d.cts.map +1 -1
  18. package/dist/lib/runtime/copilot-runtime.d.mts +3 -3
  19. package/dist/lib/runtime/copilot-runtime.d.mts.map +1 -1
  20. package/dist/lib/runtime/copilot-runtime.mjs +3 -2
  21. package/dist/lib/runtime/copilot-runtime.mjs.map +1 -1
  22. package/dist/package.cjs +70 -47
  23. package/dist/package.mjs +70 -47
  24. package/dist/v2/express.cjs +8 -0
  25. package/dist/v2/express.d.cts +5 -0
  26. package/dist/v2/express.d.mts +5 -0
  27. package/dist/v2/express.mjs +5 -0
  28. package/dist/v2/hono.cjs +9 -0
  29. package/dist/v2/hono.d.cts +5 -0
  30. package/dist/v2/hono.d.mts +5 -0
  31. package/dist/v2/hono.mjs +5 -0
  32. package/dist/v2/index.cjs +8 -3
  33. package/dist/v2/index.d.cts +8 -5
  34. package/dist/v2/index.d.mts +8 -5
  35. package/dist/v2/index.mjs +5 -4
  36. package/dist/v2/node.cjs +8 -0
  37. package/dist/v2/node.d.cts +5 -0
  38. package/dist/v2/node.d.mts +5 -0
  39. package/dist/v2/node.mjs +5 -0
  40. package/dist/v2/runtime/core/fetch-cors.cjs +72 -0
  41. package/dist/v2/runtime/core/fetch-cors.cjs.map +1 -0
  42. package/dist/v2/runtime/core/fetch-cors.d.cts +20 -0
  43. package/dist/v2/runtime/core/fetch-cors.d.cts.map +1 -0
  44. package/dist/v2/runtime/core/fetch-cors.d.mts +20 -0
  45. package/dist/v2/runtime/core/fetch-cors.d.mts.map +1 -0
  46. package/dist/v2/runtime/core/fetch-cors.mjs +70 -0
  47. package/dist/v2/runtime/core/fetch-cors.mjs.map +1 -0
  48. package/dist/v2/runtime/core/fetch-handler.cjs +232 -0
  49. package/dist/v2/runtime/core/fetch-handler.cjs.map +1 -0
  50. package/dist/v2/runtime/core/fetch-handler.d.cts +40 -0
  51. package/dist/v2/runtime/core/fetch-handler.d.cts.map +1 -0
  52. package/dist/v2/runtime/core/fetch-handler.d.mts +40 -0
  53. package/dist/v2/runtime/core/fetch-handler.d.mts.map +1 -0
  54. package/dist/v2/runtime/core/fetch-handler.mjs +231 -0
  55. package/dist/v2/runtime/core/fetch-handler.mjs.map +1 -0
  56. package/dist/v2/runtime/core/fetch-router.cjs +68 -0
  57. package/dist/v2/runtime/core/fetch-router.cjs.map +1 -0
  58. package/dist/v2/runtime/core/fetch-router.mjs +67 -0
  59. package/dist/v2/runtime/core/fetch-router.mjs.map +1 -0
  60. package/dist/v2/runtime/core/hooks.cjs +29 -0
  61. package/dist/v2/runtime/core/hooks.cjs.map +1 -0
  62. package/dist/v2/runtime/core/hooks.d.cts +78 -0
  63. package/dist/v2/runtime/core/hooks.d.cts.map +1 -0
  64. package/dist/v2/runtime/core/hooks.d.mts +78 -0
  65. package/dist/v2/runtime/core/hooks.d.mts.map +1 -0
  66. package/dist/v2/runtime/core/hooks.mjs +25 -0
  67. package/dist/v2/runtime/core/hooks.mjs.map +1 -0
  68. package/dist/v2/runtime/{middleware-sse-parser.cjs → core/middleware-sse-parser.cjs} +2 -2
  69. package/dist/v2/runtime/core/middleware-sse-parser.cjs.map +1 -0
  70. package/dist/v2/runtime/{middleware-sse-parser.d.cts → core/middleware-sse-parser.d.cts} +1 -1
  71. package/dist/v2/runtime/core/middleware-sse-parser.d.cts.map +1 -0
  72. package/dist/v2/runtime/{middleware-sse-parser.d.mts → core/middleware-sse-parser.d.mts} +1 -1
  73. package/dist/v2/runtime/core/middleware-sse-parser.d.mts.map +1 -0
  74. package/dist/v2/runtime/{middleware-sse-parser.mjs → core/middleware-sse-parser.mjs} +1 -1
  75. package/dist/v2/runtime/core/middleware-sse-parser.mjs.map +1 -0
  76. package/dist/v2/runtime/{middleware.cjs → core/middleware.cjs} +2 -2
  77. package/dist/v2/runtime/core/middleware.cjs.map +1 -0
  78. package/dist/v2/runtime/{middleware.d.cts → core/middleware.d.cts} +1 -1
  79. package/dist/v2/runtime/core/middleware.d.cts.map +1 -0
  80. package/dist/v2/runtime/{middleware.d.mts → core/middleware.d.mts} +1 -1
  81. package/dist/v2/runtime/core/middleware.d.mts.map +1 -0
  82. package/dist/v2/runtime/{middleware.mjs → core/middleware.mjs} +1 -1
  83. package/dist/v2/runtime/core/middleware.mjs.map +1 -0
  84. package/dist/v2/runtime/{runtime.cjs → core/runtime.cjs} +35 -10
  85. package/dist/v2/runtime/core/runtime.cjs.map +1 -0
  86. package/dist/v2/runtime/{runtime.d.cts → core/runtime.d.cts} +41 -7
  87. package/dist/v2/runtime/core/runtime.d.cts.map +1 -0
  88. package/dist/v2/runtime/{runtime.d.mts → core/runtime.d.mts} +42 -8
  89. package/dist/v2/runtime/core/runtime.d.mts.map +1 -0
  90. package/dist/v2/runtime/{runtime.mjs → core/runtime.mjs} +36 -11
  91. package/dist/v2/runtime/core/runtime.mjs.map +1 -0
  92. package/dist/v2/runtime/endpoints/express-fetch-bridge.cjs +83 -0
  93. package/dist/v2/runtime/endpoints/express-fetch-bridge.cjs.map +1 -0
  94. package/dist/v2/runtime/endpoints/express-fetch-bridge.mjs +82 -0
  95. package/dist/v2/runtime/endpoints/express-fetch-bridge.mjs.map +1 -0
  96. package/dist/v2/runtime/endpoints/express-single.cjs +35 -181
  97. package/dist/v2/runtime/endpoints/express-single.cjs.map +1 -1
  98. package/dist/v2/runtime/endpoints/express-single.d.cts +35 -2
  99. package/dist/v2/runtime/endpoints/express-single.d.cts.map +1 -1
  100. package/dist/v2/runtime/endpoints/express-single.d.mts +35 -2
  101. package/dist/v2/runtime/endpoints/express-single.d.mts.map +1 -1
  102. package/dist/v2/runtime/endpoints/express-single.mjs +35 -178
  103. package/dist/v2/runtime/endpoints/express-single.mjs.map +1 -1
  104. package/dist/v2/runtime/endpoints/express.cjs +41 -195
  105. package/dist/v2/runtime/endpoints/express.cjs.map +1 -1
  106. package/dist/v2/runtime/endpoints/express.d.cts +26 -4
  107. package/dist/v2/runtime/endpoints/express.d.cts.map +1 -1
  108. package/dist/v2/runtime/endpoints/express.d.mts +26 -4
  109. package/dist/v2/runtime/endpoints/express.d.mts.map +1 -1
  110. package/dist/v2/runtime/endpoints/express.mjs +41 -195
  111. package/dist/v2/runtime/endpoints/express.mjs.map +1 -1
  112. package/dist/v2/runtime/endpoints/hono-single.cjs +11 -123
  113. package/dist/v2/runtime/endpoints/hono-single.cjs.map +1 -1
  114. package/dist/v2/runtime/endpoints/hono-single.d.cts +14 -11
  115. package/dist/v2/runtime/endpoints/hono-single.d.cts.map +1 -1
  116. package/dist/v2/runtime/endpoints/hono-single.d.mts +14 -11
  117. package/dist/v2/runtime/endpoints/hono-single.d.mts.map +1 -1
  118. package/dist/v2/runtime/endpoints/hono-single.mjs +11 -123
  119. package/dist/v2/runtime/endpoints/hono-single.mjs.map +1 -1
  120. package/dist/v2/runtime/endpoints/hono.cjs +23 -237
  121. package/dist/v2/runtime/endpoints/hono.cjs.map +1 -1
  122. package/dist/v2/runtime/endpoints/hono.d.cts +29 -120
  123. package/dist/v2/runtime/endpoints/hono.d.cts.map +1 -1
  124. package/dist/v2/runtime/endpoints/hono.d.mts +29 -120
  125. package/dist/v2/runtime/endpoints/hono.d.mts.map +1 -1
  126. package/dist/v2/runtime/endpoints/hono.mjs +22 -238
  127. package/dist/v2/runtime/endpoints/hono.mjs.map +1 -1
  128. package/dist/v2/runtime/endpoints/index.d.cts +2 -2
  129. package/dist/v2/runtime/endpoints/index.d.mts +2 -2
  130. package/dist/v2/runtime/endpoints/node-fetch-handler.cjs +26 -0
  131. package/dist/v2/runtime/endpoints/node-fetch-handler.cjs.map +1 -0
  132. package/dist/v2/runtime/endpoints/node-fetch-handler.d.cts +12 -0
  133. package/dist/v2/runtime/endpoints/node-fetch-handler.d.cts.map +1 -0
  134. package/dist/v2/runtime/endpoints/node-fetch-handler.d.mts +12 -0
  135. package/dist/v2/runtime/endpoints/node-fetch-handler.d.mts.map +1 -0
  136. package/dist/v2/runtime/endpoints/node-fetch-handler.mjs +24 -0
  137. package/dist/v2/runtime/endpoints/node-fetch-handler.mjs.map +1 -0
  138. package/dist/v2/runtime/endpoints/node.cjs +30 -0
  139. package/dist/v2/runtime/endpoints/node.cjs.map +1 -0
  140. package/dist/v2/runtime/endpoints/node.d.cts +27 -0
  141. package/dist/v2/runtime/endpoints/node.d.cts.map +1 -0
  142. package/dist/v2/runtime/endpoints/node.d.mts +27 -0
  143. package/dist/v2/runtime/endpoints/node.d.mts.map +1 -0
  144. package/dist/v2/runtime/endpoints/node.mjs +30 -0
  145. package/dist/v2/runtime/endpoints/node.mjs.map +1 -0
  146. package/dist/v2/runtime/express.d.cts +3 -0
  147. package/dist/v2/runtime/express.d.mts +3 -0
  148. package/dist/v2/runtime/handlers/get-runtime-info.cjs +2 -1
  149. package/dist/v2/runtime/handlers/get-runtime-info.cjs.map +1 -1
  150. package/dist/v2/runtime/handlers/get-runtime-info.mjs +2 -1
  151. package/dist/v2/runtime/handlers/get-runtime-info.mjs.map +1 -1
  152. package/dist/v2/runtime/handlers/handle-connect.cjs +6 -3
  153. package/dist/v2/runtime/handlers/handle-connect.cjs.map +1 -1
  154. package/dist/v2/runtime/handlers/handle-connect.mjs +6 -3
  155. package/dist/v2/runtime/handlers/handle-connect.mjs.map +1 -1
  156. package/dist/v2/runtime/handlers/handle-run.cjs +6 -3
  157. package/dist/v2/runtime/handlers/handle-run.cjs.map +1 -1
  158. package/dist/v2/runtime/handlers/handle-run.mjs +6 -3
  159. package/dist/v2/runtime/handlers/handle-run.mjs.map +1 -1
  160. package/dist/v2/runtime/handlers/handle-stop.cjs.map +1 -1
  161. package/dist/v2/runtime/handlers/handle-stop.mjs.map +1 -1
  162. package/dist/v2/runtime/handlers/handle-transcribe.cjs.map +1 -1
  163. package/dist/v2/runtime/handlers/handle-transcribe.mjs.map +1 -1
  164. package/dist/v2/runtime/handlers/intelligence/connect.cjs.map +1 -1
  165. package/dist/v2/runtime/handlers/intelligence/connect.mjs.map +1 -1
  166. package/dist/v2/runtime/handlers/intelligence/run.cjs +22 -1
  167. package/dist/v2/runtime/handlers/intelligence/run.cjs.map +1 -1
  168. package/dist/v2/runtime/handlers/intelligence/run.mjs +22 -1
  169. package/dist/v2/runtime/handlers/intelligence/run.mjs.map +1 -1
  170. package/dist/v2/runtime/handlers/intelligence/thread-names.cjs +1 -1
  171. package/dist/v2/runtime/handlers/intelligence/thread-names.cjs.map +1 -1
  172. package/dist/v2/runtime/handlers/intelligence/thread-names.mjs +1 -1
  173. package/dist/v2/runtime/handlers/intelligence/thread-names.mjs.map +1 -1
  174. package/dist/v2/runtime/handlers/shared/agent-utils.cjs +21 -6
  175. package/dist/v2/runtime/handlers/shared/agent-utils.cjs.map +1 -1
  176. package/dist/v2/runtime/handlers/shared/agent-utils.mjs +21 -6
  177. package/dist/v2/runtime/handlers/shared/agent-utils.mjs.map +1 -1
  178. package/dist/v2/runtime/handlers/shared/json-response.cjs +4 -1
  179. package/dist/v2/runtime/handlers/shared/json-response.cjs.map +1 -1
  180. package/dist/v2/runtime/handlers/shared/json-response.mjs +4 -1
  181. package/dist/v2/runtime/handlers/shared/json-response.mjs.map +1 -1
  182. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -1
  183. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
  184. package/dist/v2/runtime/handlers/sse/connect.cjs.map +1 -1
  185. package/dist/v2/runtime/handlers/sse/connect.mjs.map +1 -1
  186. package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -1
  187. package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -1
  188. package/dist/v2/runtime/hono.d.cts +3 -0
  189. package/dist/v2/runtime/hono.d.mts +3 -0
  190. package/dist/v2/runtime/index.d.cts +16 -4
  191. package/dist/v2/runtime/index.d.cts.map +1 -0
  192. package/dist/v2/runtime/index.d.mts +16 -4
  193. package/dist/v2/runtime/index.d.mts.map +1 -0
  194. package/dist/v2/runtime/intelligence-platform/client.cjs +10 -1
  195. package/dist/v2/runtime/intelligence-platform/client.cjs.map +1 -1
  196. package/dist/v2/runtime/intelligence-platform/client.d.cts +22 -0
  197. package/dist/v2/runtime/intelligence-platform/client.d.cts.map +1 -1
  198. package/dist/v2/runtime/intelligence-platform/client.d.mts +22 -0
  199. package/dist/v2/runtime/intelligence-platform/client.d.mts.map +1 -1
  200. package/dist/v2/runtime/intelligence-platform/client.mjs +10 -1
  201. package/dist/v2/runtime/intelligence-platform/client.mjs.map +1 -1
  202. package/dist/v2/runtime/node.d.cts +3 -0
  203. package/dist/v2/runtime/node.d.mts +3 -0
  204. package/dist/v2/runtime/open-generative-ui-middleware.cjs +282 -0
  205. package/dist/v2/runtime/open-generative-ui-middleware.cjs.map +1 -0
  206. package/dist/v2/runtime/open-generative-ui-middleware.mjs +280 -0
  207. package/dist/v2/runtime/open-generative-ui-middleware.mjs.map +1 -0
  208. package/dist/v2/runtime/runner/intelligence.cjs +4 -4
  209. package/dist/v2/runtime/runner/intelligence.cjs.map +1 -1
  210. package/dist/v2/runtime/runner/intelligence.d.cts +6 -2
  211. package/dist/v2/runtime/runner/intelligence.d.cts.map +1 -1
  212. package/dist/v2/runtime/runner/intelligence.d.mts +6 -2
  213. package/dist/v2/runtime/runner/intelligence.d.mts.map +1 -1
  214. package/dist/v2/runtime/runner/intelligence.mjs +4 -4
  215. package/dist/v2/runtime/runner/intelligence.mjs.map +1 -1
  216. package/dist/v2/runtime/telemetry/telemetry-client.cjs +37 -0
  217. package/dist/v2/runtime/telemetry/telemetry-client.cjs.map +1 -1
  218. package/dist/v2/runtime/telemetry/telemetry-client.mjs +36 -0
  219. package/dist/v2/runtime/telemetry/telemetry-client.mjs.map +1 -1
  220. package/dist/v2/runtime/telemetry/utils.cjs +15 -0
  221. package/dist/v2/runtime/telemetry/utils.cjs.map +1 -0
  222. package/dist/v2/runtime/telemetry/utils.mjs +14 -0
  223. package/dist/v2/runtime/telemetry/utils.mjs.map +1 -0
  224. package/package.json +81 -48
  225. package/src/agent/__tests__/multimodal.test.ts +176 -0
  226. package/src/agent/index.ts +130 -19
  227. package/src/lib/runtime/agent-integrations/langgraph/agent.ts +3 -3
  228. package/src/lib/runtime/copilot-runtime.ts +1 -0
  229. package/src/v2/express.ts +1 -0
  230. package/src/v2/hono.ts +1 -0
  231. package/src/v2/node.ts +1 -0
  232. package/src/v2/runtime/__tests__/backward-compat.test.ts +261 -0
  233. package/src/v2/runtime/__tests__/code-review-fixes.test.ts +500 -0
  234. package/src/v2/runtime/__tests__/cors-credentials.test.ts +2 -2
  235. package/src/v2/runtime/__tests__/express-adapter.test.ts +188 -0
  236. package/src/v2/runtime/__tests__/express-body-order.test.ts +1 -1
  237. package/src/v2/runtime/__tests__/express-fetch-bridge.test.ts +344 -0
  238. package/src/v2/runtime/__tests__/express-single-sse.test.ts +1 -1
  239. package/src/v2/runtime/__tests__/fetch-cors.test.ts +205 -0
  240. package/src/v2/runtime/__tests__/fetch-handler-validation.test.ts +372 -0
  241. package/src/v2/runtime/__tests__/fetch-handler.test.ts +456 -0
  242. package/src/v2/runtime/__tests__/fetch-router.test.ts +132 -0
  243. package/src/v2/runtime/__tests__/get-runtime-info.test.ts +4 -1
  244. package/src/v2/runtime/__tests__/handle-connect.test.ts +15 -13
  245. package/src/v2/runtime/__tests__/handle-run.test.ts +21 -17
  246. package/src/v2/runtime/__tests__/handle-threads.test.ts +1 -1
  247. package/src/v2/runtime/__tests__/handle-transcribe.test.ts +1 -1
  248. package/src/v2/runtime/__tests__/hono-adapter.test.ts +150 -0
  249. package/src/v2/runtime/__tests__/hooks-edge-cases.test.ts +457 -0
  250. package/src/v2/runtime/__tests__/hooks.test.ts +557 -0
  251. package/src/v2/runtime/__tests__/integration/bun/bun-servers.integration.test.ts +27 -0
  252. package/src/v2/runtime/__tests__/integration/bun/elysia-multi.ts +32 -0
  253. package/src/v2/runtime/__tests__/integration/bun/elysia-single.ts +33 -0
  254. package/src/v2/runtime/__tests__/integration/bun/hono-bun-multi.ts +25 -0
  255. package/src/v2/runtime/__tests__/integration/bun/hono-bun-single.ts +32 -0
  256. package/src/v2/runtime/__tests__/integration/helpers/create-test-runtime.ts +15 -0
  257. package/src/v2/runtime/__tests__/integration/helpers/sse-reader.ts +45 -0
  258. package/src/v2/runtime/__tests__/integration/helpers/test-agent.ts +58 -0
  259. package/src/v2/runtime/__tests__/integration/node-servers.integration.test.ts +39 -0
  260. package/src/v2/runtime/__tests__/integration/servers/express-multi.ts +35 -0
  261. package/src/v2/runtime/__tests__/integration/servers/express-single.ts +36 -0
  262. package/src/v2/runtime/__tests__/integration/servers/fetch-direct.ts +39 -0
  263. package/src/v2/runtime/__tests__/integration/servers/hono-multi.ts +30 -0
  264. package/src/v2/runtime/__tests__/integration/servers/hono-single.ts +37 -0
  265. package/src/v2/runtime/__tests__/integration/servers/node-multi.ts +45 -0
  266. package/src/v2/runtime/__tests__/integration/servers/node-single.ts +46 -0
  267. package/src/v2/runtime/__tests__/integration/servers/types.ts +18 -0
  268. package/src/v2/runtime/__tests__/integration/suites/multi-endpoint.suite.ts +358 -0
  269. package/src/v2/runtime/__tests__/integration/suites/single-endpoint.suite.ts +363 -0
  270. package/src/v2/runtime/__tests__/middleware-express.test.ts +25 -23
  271. package/src/v2/runtime/__tests__/middleware-single-express.test.ts +25 -23
  272. package/src/v2/runtime/__tests__/middleware-single.test.ts +1 -1
  273. package/src/v2/runtime/__tests__/middleware-sse-parser.test.ts +1 -1
  274. package/src/v2/runtime/__tests__/middleware.test.ts +1 -2
  275. package/src/v2/runtime/__tests__/node-fetch-handler.test.ts +157 -0
  276. package/src/v2/runtime/__tests__/open-generative-ui-middleware.e2e.test.ts +728 -0
  277. package/src/v2/runtime/__tests__/router-edge-cases.test.ts +217 -0
  278. package/src/v2/runtime/__tests__/routing-express.test.ts +1 -1
  279. package/src/v2/runtime/__tests__/routing-single-express.test.ts +1 -1
  280. package/src/v2/runtime/__tests__/routing-single.test.ts +1 -1
  281. package/src/v2/runtime/__tests__/routing.test.ts +1 -1
  282. package/src/v2/runtime/__tests__/runtime.test.ts +110 -1
  283. package/src/v2/runtime/__tests__/telemetry.test.ts +62 -1
  284. package/src/v2/runtime/core/fetch-cors.ts +136 -0
  285. package/src/v2/runtime/core/fetch-handler.ts +415 -0
  286. package/src/v2/runtime/core/fetch-router.ts +112 -0
  287. package/src/v2/runtime/core/hooks.ts +151 -0
  288. package/src/v2/runtime/{runtime.ts → core/runtime.ts} +79 -10
  289. package/src/v2/runtime/endpoints/express-fetch-bridge.ts +137 -0
  290. package/src/v2/runtime/endpoints/express-single.ts +42 -219
  291. package/src/v2/runtime/endpoints/express.ts +128 -230
  292. package/src/v2/runtime/endpoints/hono-single.ts +19 -171
  293. package/src/v2/runtime/endpoints/hono.ts +45 -270
  294. package/src/v2/runtime/endpoints/node-fetch-handler.ts +48 -0
  295. package/src/v2/runtime/endpoints/node.ts +28 -0
  296. package/src/v2/runtime/handlers/get-runtime-info.ts +3 -2
  297. package/src/v2/runtime/handlers/handle-connect.ts +7 -4
  298. package/src/v2/runtime/handlers/handle-run.ts +7 -4
  299. package/src/v2/runtime/handlers/handle-stop.ts +1 -1
  300. package/src/v2/runtime/handlers/handle-transcribe.ts +1 -1
  301. package/src/v2/runtime/handlers/intelligence/connect.ts +1 -1
  302. package/src/v2/runtime/handlers/intelligence/run.ts +31 -1
  303. package/src/v2/runtime/handlers/intelligence/thread-names.ts +2 -2
  304. package/src/v2/runtime/handlers/intelligence/threads.ts +1 -1
  305. package/src/v2/runtime/handlers/shared/agent-utils.ts +29 -10
  306. package/src/v2/runtime/handlers/shared/json-response.ts +4 -1
  307. package/src/v2/runtime/handlers/shared/resolve-intelligence-user.ts +1 -1
  308. package/src/v2/runtime/handlers/sse/connect.ts +1 -1
  309. package/src/v2/runtime/handlers/sse/run.ts +1 -1
  310. package/src/v2/runtime/hono.ts +2 -0
  311. package/src/v2/runtime/index.ts +27 -1
  312. package/src/v2/runtime/intelligence-platform/client.ts +50 -1
  313. package/src/v2/runtime/node.ts +6 -0
  314. package/src/v2/runtime/open-generative-ui-middleware.ts +373 -0
  315. package/src/v2/runtime/runner/intelligence.ts +14 -4
  316. package/src/v2/runtime/telemetry/telemetry-client.ts +56 -0
  317. package/src/v2/runtime/telemetry/utils.ts +15 -0
  318. package/tsdown.config.ts +8 -1
  319. package/vitest.config.mjs +2 -5
  320. package/.eslintrc.js +0 -7
  321. package/dist/v2/runtime/endpoints/express-utils.cjs +0 -119
  322. package/dist/v2/runtime/endpoints/express-utils.cjs.map +0 -1
  323. package/dist/v2/runtime/endpoints/express-utils.mjs +0 -117
  324. package/dist/v2/runtime/endpoints/express-utils.mjs.map +0 -1
  325. package/dist/v2/runtime/handlers/intelligence/threads.cjs +0 -159
  326. package/dist/v2/runtime/handlers/intelligence/threads.cjs.map +0 -1
  327. package/dist/v2/runtime/handlers/intelligence/threads.mjs +0 -154
  328. package/dist/v2/runtime/handlers/intelligence/threads.mjs.map +0 -1
  329. package/dist/v2/runtime/middleware-sse-parser.cjs.map +0 -1
  330. package/dist/v2/runtime/middleware-sse-parser.d.cts.map +0 -1
  331. package/dist/v2/runtime/middleware-sse-parser.d.mts.map +0 -1
  332. package/dist/v2/runtime/middleware-sse-parser.mjs.map +0 -1
  333. package/dist/v2/runtime/middleware.cjs.map +0 -1
  334. package/dist/v2/runtime/middleware.d.cts.map +0 -1
  335. package/dist/v2/runtime/middleware.d.mts.map +0 -1
  336. package/dist/v2/runtime/middleware.mjs.map +0 -1
  337. package/dist/v2/runtime/runtime.cjs.map +0 -1
  338. package/dist/v2/runtime/runtime.d.cts.map +0 -1
  339. package/dist/v2/runtime/runtime.d.mts.map +0 -1
  340. package/dist/v2/runtime/runtime.mjs.map +0 -1
  341. package/src/v2/runtime/__tests__/express-abort-signal.test.ts +0 -25
  342. package/src/v2/runtime/endpoints/express-utils.ts +0 -182
  343. package/src/v2/runtime/handler.ts +0 -3
  344. /package/src/v2/runtime/{middleware-sse-parser.ts → core/middleware-sse-parser.ts} +0 -0
  345. /package/src/v2/runtime/{middleware.ts → core/middleware.ts} +0 -0
package/package.json CHANGED
@@ -1,15 +1,25 @@
1
1
  {
2
2
  "name": "@copilotkit/runtime",
3
+ "version": "1.55.0",
3
4
  "private": false,
5
+ "keywords": [
6
+ "ai",
7
+ "assistant",
8
+ "automation",
9
+ "copilot",
10
+ "copilotkit",
11
+ "javascript",
12
+ "nextjs",
13
+ "nodejs",
14
+ "react",
15
+ "textarea"
16
+ ],
4
17
  "homepage": "https://github.com/CopilotKit/CopilotKit",
18
+ "license": "MIT",
5
19
  "repository": {
6
20
  "type": "git",
7
21
  "url": "https://github.com/CopilotKit/CopilotKit.git"
8
22
  },
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "version": "1.55.0-next.8",
13
23
  "sideEffects": [
14
24
  "./dist/index.mjs",
15
25
  "./dist/index.cjs",
@@ -18,6 +28,23 @@
18
28
  ],
19
29
  "main": "./dist/index.cjs",
20
30
  "module": "./dist/index.mjs",
31
+ "types": "./dist/index.d.cts",
32
+ "typesVersions": {
33
+ "*": {
34
+ "v2": [
35
+ "./dist/v2/index.d.cts"
36
+ ],
37
+ "v2/express": [
38
+ "./dist/v2/express.d.cts"
39
+ ],
40
+ "v2/hono": [
41
+ "./dist/v2/hono.d.cts"
42
+ ],
43
+ "v2/node": [
44
+ "./dist/v2/node.d.cts"
45
+ ]
46
+ }
47
+ },
21
48
  "exports": {
22
49
  ".": {
23
50
  "import": "./dist/index.mjs",
@@ -31,47 +58,44 @@
31
58
  "import": "./dist/v2/index.mjs",
32
59
  "require": "./dist/v2/index.cjs"
33
60
  },
61
+ "./v2/express": {
62
+ "import": "./dist/v2/express.mjs",
63
+ "require": "./dist/v2/express.cjs"
64
+ },
65
+ "./v2/hono": {
66
+ "import": "./dist/v2/hono.mjs",
67
+ "require": "./dist/v2/hono.cjs"
68
+ },
69
+ "./v2/node": {
70
+ "import": "./dist/v2/node.mjs",
71
+ "require": "./dist/v2/node.cjs"
72
+ },
34
73
  "./package.json": "./package.json"
35
74
  },
36
- "types": "./dist/index.d.cts",
37
- "license": "MIT",
38
- "devDependencies": {
39
- "@swc/core": "1.5.28",
40
- "@types/cors": "^2.8.17",
41
- "@types/express": "^4.17.21",
42
- "@types/node": "^18.11.17",
43
- "@types/phoenix": "^1.6.6",
44
- "@valibot/to-json-schema": "^1.5.0",
45
- "@vitest/coverage-v8": "^3.2.4",
46
- "@whatwg-node/server": "^0.9.34",
47
- "arktype": "^2.1.29",
48
- "eslint": "^8.56.0",
49
- "nodemon": "^3.1.3",
50
- "supertest": "^7.1.1",
51
- "ts-node": "^10.9.2",
52
- "tsdown": "^0.20.3",
53
- "typescript": "^5.2.3",
54
- "valibot": "^1.2.0",
55
- "vitest": "^3.2.4",
56
- "eslint-config-custom": "1.4.12",
57
- "tsconfig": "1.4.12"
75
+ "publishConfig": {
76
+ "access": "public"
58
77
  },
59
78
  "dependencies": {
60
- "@ag-ui/a2ui-middleware": "0.0.2",
61
- "@ag-ui/client": "^0.0.48",
62
- "@ag-ui/core": "^0.0.48",
63
- "@ag-ui/encoder": "0.0.47",
64
- "@ag-ui/langgraph": "^0.0.25",
65
- "@ag-ui/mcp-apps-middleware": "0.0.2",
79
+ "@ag-ui/a2ui-middleware": "0.0.3",
80
+ "@ag-ui/client": "0.0.52",
81
+ "@ag-ui/core": "0.0.52",
82
+ "@ag-ui/encoder": "0.0.52",
83
+ "@ag-ui/langgraph": "0.0.27",
84
+ "@ag-ui/mcp-apps-middleware": "0.0.3",
66
85
  "@ai-sdk/anthropic": "^3.0.49",
67
86
  "@ai-sdk/google": "^3.0.33",
68
87
  "@ai-sdk/google-vertex": "^3.0.97",
69
88
  "@ai-sdk/mcp": "^1.0.21",
70
89
  "@ai-sdk/openai": "^3.0.36",
71
- "@modelcontextprotocol/sdk": "^1.18.2",
90
+ "@copilotkit/license-verifier": "0.0.1-a1",
72
91
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
73
92
  "@hono/node-server": "^1.13.5",
93
+ "@modelcontextprotocol/sdk": "^1.18.2",
94
+ "@remix-run/node-fetch-server": "^0.13.0",
74
95
  "@scarf/scarf": "^1.3.0",
96
+ "@segment/analytics-node": "^2.1.2",
97
+ "ai": "^6.0.104",
98
+ "clarinet": "^0.12.4",
75
99
  "class-transformer": "^0.5.1",
76
100
  "class-validator": "^0.14.1",
77
101
  "cors": "^2.8.5",
@@ -79,7 +103,6 @@
79
103
  "graphql": "^16.8.1",
80
104
  "graphql-scalars": "^1.23.0",
81
105
  "graphql-yoga": "^5.3.1",
82
- "ai": "^6.0.104",
83
106
  "hono": "^4.11.4",
84
107
  "openai": "^4.85.1",
85
108
  "partial-json": "^0.1.7",
@@ -89,15 +112,37 @@
89
112
  "reflect-metadata": "^0.2.2",
90
113
  "rxjs": "7.8.1",
91
114
  "type-graphql": "2.0.0-rc.1",
115
+ "uuid": "^10.0.0",
92
116
  "ws": "^8.18.0",
93
117
  "zod": "^3.23.3",
94
- "@copilotkit/shared": "1.55.0-next.8"
118
+ "@copilotkit/shared": "1.55.0"
119
+ },
120
+ "devDependencies": {
121
+ "@swc/core": "1.5.28",
122
+ "@types/cors": "^2.8.17",
123
+ "@types/express": "^4.17.21",
124
+ "@types/node": "^18.11.17",
125
+ "@types/phoenix": "^1.6.6",
126
+ "@valibot/to-json-schema": "^1.5.0",
127
+ "@vitest/coverage-v8": "^3.2.4",
128
+ "@whatwg-node/server": "^0.9.34",
129
+ "arktype": "^2.1.29",
130
+ "elysia": "^1.2.25",
131
+ "eslint": "^8.56.0",
132
+ "nodemon": "^3.1.3",
133
+ "supertest": "^7.1.1",
134
+ "ts-node": "^10.9.2",
135
+ "tsdown": "^0.20.3",
136
+ "typescript": "^5.2.3",
137
+ "valibot": "^1.2.0",
138
+ "vitest": "^3.2.4",
139
+ "tsconfig": "1.4.12"
95
140
  },
96
141
  "peerDependencies": {
97
142
  "@anthropic-ai/sdk": "^0.57.0",
98
143
  "@langchain/aws": ">=0.1.9",
99
- "@langchain/core": ">=0.3.66",
100
144
  "@langchain/community": ">=0.3.58",
145
+ "@langchain/core": ">=0.3.66",
101
146
  "@langchain/google-gauth": ">=0.1.0",
102
147
  "@langchain/langgraph-sdk": ">=0.1.2",
103
148
  "@langchain/openai": ">=0.4.2",
@@ -143,18 +188,6 @@
143
188
  }
144
189
  }
145
190
  },
146
- "keywords": [
147
- "copilotkit",
148
- "copilot",
149
- "react",
150
- "nextjs",
151
- "nodejs",
152
- "ai",
153
- "assistant",
154
- "javascript",
155
- "automation",
156
- "textarea"
157
- ],
158
191
  "scripts": {
159
192
  "build": "tsdown",
160
193
  "dev": "tsdown --watch",
@@ -0,0 +1,176 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { convertMessagesToVercelAISDKMessages } from "../index";
3
+ import type { Message, InputContent } from "@ag-ui/client";
4
+ import type { UserModelMessage } from "ai";
5
+
6
+ /**
7
+ * Helper: build a user message with the given content parts and convert it.
8
+ * Returns the converted UserModelMessage for assertion.
9
+ */
10
+ function convertUserContent(content: string | InputContent[]) {
11
+ const messages: Message[] = [{ id: "1", role: "user", content }];
12
+ const result = convertMessagesToVercelAISDKMessages(messages);
13
+ return result[0] as UserModelMessage;
14
+ }
15
+
16
+ /** Shorthand factories for AG-UI input parts */
17
+ function dataSource(value: string, mimeType: string) {
18
+ return { type: "data" as const, value, mimeType };
19
+ }
20
+
21
+ function urlSource(value: string, mimeType?: string) {
22
+ return { type: "url" as const, value, ...(mimeType ? { mimeType } : {}) };
23
+ }
24
+
25
+ describe("convertMessagesToVercelAISDKMessages — multimodal", () => {
26
+ it("passes through plain string user content", () => {
27
+ const result = convertUserContent("Hello");
28
+ expect(result).toEqual({ role: "user", content: "Hello" });
29
+ });
30
+
31
+ it("converts text-only InputContent[] to parts array", () => {
32
+ const result = convertUserContent([{ type: "text", text: "Hello world" }]);
33
+ expect(result.role).toBe("user");
34
+ expect(result.content).toEqual([{ type: "text", text: "Hello world" }]);
35
+ });
36
+
37
+ it("converts ImageInputPart with data source to ImagePart", () => {
38
+ const result = convertUserContent([
39
+ { type: "text", text: "What is this?" },
40
+ { type: "image", source: dataSource("iVBORw0KGgo=", "image/png") },
41
+ ]);
42
+ expect(result.content).toEqual([
43
+ { type: "text", text: "What is this?" },
44
+ { type: "image", image: "iVBORw0KGgo=", mediaType: "image/png" },
45
+ ]);
46
+ });
47
+
48
+ it("converts ImageInputPart with url source to ImagePart with URL", () => {
49
+ const result = convertUserContent([
50
+ {
51
+ type: "image",
52
+ source: urlSource("https://example.com/photo.jpg", "image/jpeg"),
53
+ },
54
+ ]);
55
+ expect(result.content).toEqual([
56
+ {
57
+ type: "image",
58
+ image: new URL("https://example.com/photo.jpg"),
59
+ mediaType: "image/jpeg",
60
+ },
61
+ ]);
62
+ });
63
+
64
+ it("converts AudioInputPart to FilePart", () => {
65
+ const result = convertUserContent([
66
+ { type: "audio", source: dataSource("base64audiodata", "audio/mp3") },
67
+ ]);
68
+ expect(result.content).toEqual([
69
+ { type: "file", data: "base64audiodata", mediaType: "audio/mp3" },
70
+ ]);
71
+ });
72
+
73
+ it("converts VideoInputPart with url source to FilePart", () => {
74
+ const result = convertUserContent([
75
+ {
76
+ type: "video",
77
+ source: urlSource("https://example.com/video.mp4", "video/mp4"),
78
+ },
79
+ ]);
80
+ expect(result.content).toEqual([
81
+ {
82
+ type: "file",
83
+ data: new URL("https://example.com/video.mp4"),
84
+ mediaType: "video/mp4",
85
+ },
86
+ ]);
87
+ });
88
+
89
+ it("converts DocumentInputPart to FilePart", () => {
90
+ const result = convertUserContent([
91
+ {
92
+ type: "document",
93
+ source: dataSource("base64pdfdata", "application/pdf"),
94
+ },
95
+ ]);
96
+ expect(result.content).toEqual([
97
+ { type: "file", data: "base64pdfdata", mediaType: "application/pdf" },
98
+ ]);
99
+ });
100
+
101
+ it("handles mixed text and multimodal parts", () => {
102
+ const result = convertUserContent([
103
+ { type: "text", text: "Analyze these:" },
104
+ { type: "image", source: dataSource("imgdata", "image/png") },
105
+ { type: "document", source: dataSource("docdata", "application/pdf") },
106
+ ]);
107
+ expect(result.content).toEqual([
108
+ { type: "text", text: "Analyze these:" },
109
+ { type: "image", image: "imgdata", mediaType: "image/png" },
110
+ { type: "file", data: "docdata", mediaType: "application/pdf" },
111
+ ]);
112
+ });
113
+
114
+ it("returns empty string for empty content array", () => {
115
+ const result = convertUserContent([]);
116
+ expect(result.content).toBe("");
117
+ });
118
+
119
+ it("skips image parts with malformed URLs without crashing", () => {
120
+ const result = convertUserContent([
121
+ { type: "text", text: "check this" },
122
+ { type: "image", source: { type: "url", value: "not-a-url" } },
123
+ ]);
124
+ // Malformed URL part is skipped, text part preserved
125
+ expect(result.content).toEqual([{ type: "text", text: "check this" }]);
126
+ });
127
+
128
+ // Legacy backward compat — BinaryInputContent is not in the current schema
129
+ // but older clients may still send it. We intentionally construct untyped
130
+ // objects here to simulate that scenario.
131
+ describe("legacy BinaryInputContent backward compat", () => {
132
+ it("converts binary with image mimeType and data to ImagePart", () => {
133
+ const legacyPart = {
134
+ type: "binary",
135
+ mimeType: "image/jpeg",
136
+ data: "legacybase64",
137
+ };
138
+ const messages: Message[] = [
139
+ {
140
+ id: "1",
141
+ role: "user",
142
+ content: [legacyPart] as unknown as InputContent[],
143
+ },
144
+ ];
145
+ const result = convertMessagesToVercelAISDKMessages(messages);
146
+ const userMsg = result[0] as UserModelMessage;
147
+ expect(userMsg.content).toEqual([
148
+ { type: "image", image: "legacybase64", mediaType: "image/jpeg" },
149
+ ]);
150
+ });
151
+
152
+ it("converts binary with non-image mimeType and url to FilePart", () => {
153
+ const legacyPart = {
154
+ type: "binary",
155
+ mimeType: "application/pdf",
156
+ url: "https://example.com/doc.pdf",
157
+ };
158
+ const messages: Message[] = [
159
+ {
160
+ id: "1",
161
+ role: "user",
162
+ content: [legacyPart] as unknown as InputContent[],
163
+ },
164
+ ];
165
+ const result = convertMessagesToVercelAISDKMessages(messages);
166
+ const userMsg = result[0] as UserModelMessage;
167
+ expect(userMsg.content).toEqual([
168
+ {
169
+ type: "file",
170
+ data: new URL("https://example.com/doc.pdf"),
171
+ mediaType: "application/pdf",
172
+ },
173
+ ]);
174
+ });
175
+ });
176
+ });
@@ -31,6 +31,8 @@ import {
31
31
  ToolCallPart,
32
32
  ToolResultPart,
33
33
  TextPart,
34
+ ImagePart,
35
+ FilePart,
34
36
  tool as createVercelAISDKTool,
35
37
  ToolChoice,
36
38
  ToolSet,
@@ -42,7 +44,6 @@ import { createOpenAI } from "@ai-sdk/openai";
42
44
  import { createAnthropic } from "@ai-sdk/anthropic";
43
45
  import { createGoogleGenerativeAI } from "@ai-sdk/google";
44
46
  import { createVertex } from "@ai-sdk/google-vertex";
45
- import { randomUUID } from "crypto";
46
47
  import { safeParseToolArgs } from "@copilotkit/shared";
47
48
  import { z } from "zod";
48
49
  import type { StandardSchemaV1, InferSchemaOutput } from "@copilotkit/shared";
@@ -53,6 +54,7 @@ import {
53
54
  StreamableHTTPClientTransportOptions,
54
55
  } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
55
56
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
57
+ import { randomUUID } from "@copilotkit/shared";
56
58
 
57
59
  /**
58
60
  * Properties that can be overridden by forwardedProps
@@ -279,9 +281,14 @@ export function defineTool<TParameters extends StandardSchemaV1>(config: {
279
281
 
280
282
  type AGUIUserMessage = Extract<Message, { role: "user" }>;
281
283
 
282
- function flattenUserMessageContent(
283
- content?: AGUIUserMessage["content"],
284
- ): string {
284
+ /**
285
+ * Converts AG-UI user message content to Vercel AI SDK UserContent format.
286
+ * Handles plain strings, new modality-specific parts (image/audio/video/document),
287
+ * and legacy BinaryInputContent for backward compatibility.
288
+ */
289
+ function convertUserMessageContent(
290
+ content: AGUIUserMessage["content"],
291
+ ): string | Array<TextPart | ImagePart | FilePart> {
285
292
  if (!content) {
286
293
  return "";
287
294
  }
@@ -290,21 +297,125 @@ function flattenUserMessageContent(
290
297
  return content;
291
298
  }
292
299
 
293
- return content
294
- .map((part) => {
295
- if (
296
- part &&
297
- typeof part === "object" &&
298
- "type" in part &&
299
- (part as { type?: unknown }).type === "text" &&
300
- typeof (part as { text?: unknown }).text === "string"
301
- ) {
302
- return (part as { text: string }).text;
300
+ const parts: Array<TextPart | ImagePart | FilePart> = [];
301
+
302
+ for (const part of content) {
303
+ if (!part || typeof part !== "object" || !("type" in part)) {
304
+ continue;
305
+ }
306
+
307
+ switch (part.type) {
308
+ case "text": {
309
+ const text = (part as { text?: string }).text;
310
+ if (text) {
311
+ parts.push({ type: "text", text });
312
+ }
313
+ break;
314
+ }
315
+
316
+ case "image": {
317
+ const source = (part as { source?: any }).source;
318
+ if (!source) break;
319
+ if (source.type === "data") {
320
+ parts.push({
321
+ type: "image",
322
+ image: source.value,
323
+ mediaType: source.mimeType,
324
+ });
325
+ } else if (source.type === "url") {
326
+ try {
327
+ parts.push({
328
+ type: "image",
329
+ image: new URL(source.value),
330
+ mediaType: source.mimeType,
331
+ });
332
+ } catch {
333
+ console.error(
334
+ `[CopilotKit] convertUserMessageContent: invalid URL "${source.value}" in image part — skipping`,
335
+ );
336
+ }
337
+ }
338
+ break;
339
+ }
340
+
341
+ case "audio":
342
+ case "video":
343
+ case "document": {
344
+ const source = (part as { source?: any }).source;
345
+ if (!source) break;
346
+ if (source.type === "data") {
347
+ parts.push({
348
+ type: "file",
349
+ data: source.value,
350
+ mediaType: source.mimeType,
351
+ });
352
+ } else if (source.type === "url") {
353
+ try {
354
+ parts.push({
355
+ type: "file",
356
+ data: new URL(source.value),
357
+ mediaType: source.mimeType ?? "application/octet-stream",
358
+ });
359
+ } catch {
360
+ console.error(
361
+ `[CopilotKit] convertUserMessageContent: invalid URL "${source.value}" in ${part.type} part — skipping`,
362
+ );
363
+ }
364
+ }
365
+ break;
366
+ }
367
+
368
+ // Legacy BinaryInputContent backward compatibility
369
+ case "binary": {
370
+ const legacy = part as {
371
+ mimeType?: string;
372
+ data?: string;
373
+ url?: string;
374
+ };
375
+ const mimeType = legacy.mimeType ?? "application/octet-stream";
376
+ const isImage = mimeType.startsWith("image/");
377
+
378
+ if (legacy.data) {
379
+ if (isImage) {
380
+ parts.push({
381
+ type: "image",
382
+ image: legacy.data,
383
+ mediaType: mimeType,
384
+ });
385
+ } else {
386
+ parts.push({
387
+ type: "file",
388
+ data: legacy.data,
389
+ mediaType: mimeType,
390
+ });
391
+ }
392
+ } else if (legacy.url) {
393
+ try {
394
+ const url = new URL(legacy.url);
395
+ if (isImage) {
396
+ parts.push({ type: "image", image: url, mediaType: mimeType });
397
+ } else {
398
+ parts.push({ type: "file", data: url, mediaType: mimeType });
399
+ }
400
+ } catch {
401
+ console.error(
402
+ `[CopilotKit] convertUserMessageContent: invalid URL "${legacy.url}" in binary part — skipping`,
403
+ );
404
+ }
405
+ }
406
+ break;
407
+ }
408
+
409
+ default: {
410
+ console.error(
411
+ `[CopilotKit] convertUserMessageContent: unrecognized content part type "${(part as { type: string }).type}" — skipping`,
412
+ );
413
+ break;
303
414
  }
304
- return "";
305
- })
306
- .filter((text) => text.length > 0)
307
- .join("\n");
415
+ }
416
+ }
417
+
418
+ return parts.length > 0 ? parts : "";
308
419
  }
309
420
 
310
421
  /**
@@ -363,7 +474,7 @@ export function convertMessagesToVercelAISDKMessages(
363
474
  } else if (message.role === "user") {
364
475
  const userMsg: UserModelMessage = {
365
476
  role: "user",
366
- content: flattenUserMessageContent(message.content),
477
+ content: convertUserMessageContent(message.content),
367
478
  };
368
479
  result.push(userMsg);
369
480
  } else if (message.role === "tool") {
@@ -1,6 +1,6 @@
1
- import { map } from "rxjs";
1
+ import { map, Observable } from "rxjs";
2
2
  import { LangGraphEventTypes } from "../../../../agents/langgraph/events";
3
- import { RawEvent } from "@ag-ui/core";
3
+ import { BaseEvent, RawEvent } from "@ag-ui/core";
4
4
  import {
5
5
  LangGraphAgent as AGUILangGraphAgent,
6
6
  LangGraphHttpAgent,
@@ -153,7 +153,7 @@ export class LangGraphAgent extends AGUILangGraphAgent {
153
153
  }
154
154
 
155
155
  // @ts-ignore
156
- run(input: RunAgentInput) {
156
+ run(input: RunAgentInput): Observable<BaseEvent> {
157
157
  return super.run(input).pipe(
158
158
  map((processedEvent) => {
159
159
  // Turn raw event into emit state snapshot from tool call event
@@ -369,6 +369,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
369
369
  : {}),
370
370
  a2ui: params?.a2ui,
371
371
  mcpApps: params?.mcpApps,
372
+ openGenerativeUI: params?.openGenerativeUI,
372
373
  };
373
374
  this.params = params;
374
375
  this.observability = params?.observability_c;
@@ -0,0 +1 @@
1
+ export * from "./runtime/express";
package/src/v2/hono.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./runtime/hono";
package/src/v2/node.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./runtime/node";