@copilotkit/runtime 1.54.1 → 1.55.0-next.7

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 (337) hide show
  1. package/.eslintrc.js +4 -4
  2. package/CHANGELOG.md +113 -113
  3. package/dist/_virtual/_rolldown/runtime.mjs +25 -1
  4. package/dist/agent/index.cjs +643 -0
  5. package/dist/agent/index.cjs.map +1 -0
  6. package/dist/agent/index.d.cts +263 -0
  7. package/dist/agent/index.d.cts.map +1 -0
  8. package/dist/agent/index.d.mts +263 -0
  9. package/dist/agent/index.d.mts.map +1 -0
  10. package/dist/agent/index.mjs +635 -0
  11. package/dist/agent/index.mjs.map +1 -0
  12. package/dist/graphql/message-conversion/agui-to-gql.cjs.map +1 -1
  13. package/dist/graphql/message-conversion/agui-to-gql.mjs.map +1 -1
  14. package/dist/lib/integrations/nextjs/app-router.cjs +2 -2
  15. package/dist/lib/integrations/nextjs/app-router.cjs.map +1 -1
  16. package/dist/lib/integrations/nextjs/app-router.mjs +1 -1
  17. package/dist/lib/integrations/nextjs/app-router.mjs.map +1 -1
  18. package/dist/lib/integrations/node-http/index.cjs +2 -3
  19. package/dist/lib/integrations/node-http/index.cjs.map +1 -1
  20. package/dist/lib/integrations/node-http/index.mjs +1 -1
  21. package/dist/lib/integrations/node-http/index.mjs.map +1 -1
  22. package/dist/lib/runtime/agent-integrations/langgraph/agent.cjs +1 -1
  23. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts +2 -2
  24. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts.map +1 -1
  25. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.mts +3 -3
  26. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.mts.map +1 -1
  27. package/dist/lib/runtime/agent-integrations/langgraph/agent.mjs +1 -1
  28. package/dist/lib/runtime/copilot-runtime.cjs +7 -5
  29. package/dist/lib/runtime/copilot-runtime.cjs.map +1 -1
  30. package/dist/lib/runtime/copilot-runtime.d.cts +10 -8
  31. package/dist/lib/runtime/copilot-runtime.d.cts.map +1 -1
  32. package/dist/lib/runtime/copilot-runtime.d.mts +10 -8
  33. package/dist/lib/runtime/copilot-runtime.d.mts.map +1 -1
  34. package/dist/lib/runtime/copilot-runtime.mjs +7 -5
  35. package/dist/lib/runtime/copilot-runtime.mjs.map +1 -1
  36. package/dist/lib/runtime/telemetry-agent-runner.cjs +2 -2
  37. package/dist/lib/runtime/telemetry-agent-runner.cjs.map +1 -1
  38. package/dist/lib/runtime/telemetry-agent-runner.d.cts +2 -1
  39. package/dist/lib/runtime/telemetry-agent-runner.d.cts.map +1 -1
  40. package/dist/lib/runtime/telemetry-agent-runner.d.mts +2 -1
  41. package/dist/lib/runtime/telemetry-agent-runner.d.mts.map +1 -1
  42. package/dist/lib/runtime/telemetry-agent-runner.mjs +1 -1
  43. package/dist/lib/runtime/telemetry-agent-runner.mjs.map +1 -1
  44. package/dist/lib/telemetry-client.cjs +1 -1
  45. package/dist/lib/telemetry-client.mjs +1 -1
  46. package/dist/package.cjs +21 -4
  47. package/dist/package.mjs +21 -4
  48. package/dist/service-adapters/anthropic/anthropic-adapter.d.mts +1 -1
  49. package/dist/v2/index.cjs +41 -15
  50. package/dist/v2/index.d.cts +14 -2
  51. package/dist/v2/index.d.mts +14 -2
  52. package/dist/v2/index.mjs +13 -4
  53. package/dist/v2/runtime/endpoints/express-single.cjs +190 -0
  54. package/dist/v2/runtime/endpoints/express-single.cjs.map +1 -0
  55. package/dist/v2/runtime/endpoints/express-single.d.cts +16 -0
  56. package/dist/v2/runtime/endpoints/express-single.d.cts.map +1 -0
  57. package/dist/v2/runtime/endpoints/express-single.d.mts +16 -0
  58. package/dist/v2/runtime/endpoints/express-single.d.mts.map +1 -0
  59. package/dist/v2/runtime/endpoints/express-single.mjs +187 -0
  60. package/dist/v2/runtime/endpoints/express-single.mjs.map +1 -0
  61. package/dist/v2/runtime/endpoints/express-utils.cjs +119 -0
  62. package/dist/v2/runtime/endpoints/express-utils.cjs.map +1 -0
  63. package/dist/v2/runtime/endpoints/express-utils.mjs +117 -0
  64. package/dist/v2/runtime/endpoints/express-utils.mjs.map +1 -0
  65. package/dist/v2/runtime/endpoints/express.cjs +217 -0
  66. package/dist/v2/runtime/endpoints/express.cjs.map +1 -0
  67. package/dist/v2/runtime/endpoints/express.d.cts +16 -0
  68. package/dist/v2/runtime/endpoints/express.d.cts.map +1 -0
  69. package/dist/v2/runtime/endpoints/express.d.mts +16 -0
  70. package/dist/v2/runtime/endpoints/express.d.mts.map +1 -0
  71. package/dist/v2/runtime/endpoints/express.mjs +214 -0
  72. package/dist/v2/runtime/endpoints/express.mjs.map +1 -0
  73. package/dist/v2/runtime/endpoints/hono-single.cjs +141 -0
  74. package/dist/v2/runtime/endpoints/hono-single.cjs.map +1 -0
  75. package/dist/v2/runtime/endpoints/hono-single.d.cts +41 -0
  76. package/dist/v2/runtime/endpoints/hono-single.d.cts.map +1 -0
  77. package/dist/v2/runtime/endpoints/hono-single.d.mts +41 -0
  78. package/dist/v2/runtime/endpoints/hono-single.d.mts.map +1 -0
  79. package/dist/v2/runtime/endpoints/hono-single.mjs +140 -0
  80. package/dist/v2/runtime/endpoints/hono-single.mjs.map +1 -0
  81. package/dist/v2/runtime/endpoints/hono.cjs +248 -0
  82. package/dist/v2/runtime/endpoints/hono.cjs.map +1 -0
  83. package/dist/v2/runtime/endpoints/hono.d.cts +164 -0
  84. package/dist/v2/runtime/endpoints/hono.d.cts.map +1 -0
  85. package/dist/v2/runtime/endpoints/hono.d.mts +164 -0
  86. package/dist/v2/runtime/endpoints/hono.d.mts.map +1 -0
  87. package/dist/v2/runtime/endpoints/hono.mjs +247 -0
  88. package/dist/v2/runtime/endpoints/hono.mjs.map +1 -0
  89. package/dist/v2/runtime/endpoints/index.d.cts +5 -0
  90. package/dist/v2/runtime/endpoints/index.d.mts +5 -0
  91. package/dist/v2/runtime/endpoints/single-route-helpers.cjs +68 -0
  92. package/dist/v2/runtime/endpoints/single-route-helpers.cjs.map +1 -0
  93. package/dist/v2/runtime/endpoints/single-route-helpers.mjs +65 -0
  94. package/dist/v2/runtime/endpoints/single-route-helpers.mjs.map +1 -0
  95. package/dist/v2/runtime/handlers/get-runtime-info.cjs +51 -0
  96. package/dist/v2/runtime/handlers/get-runtime-info.cjs.map +1 -0
  97. package/dist/v2/runtime/handlers/get-runtime-info.mjs +51 -0
  98. package/dist/v2/runtime/handlers/get-runtime-info.mjs.map +1 -0
  99. package/dist/v2/runtime/handlers/handle-connect.cjs +49 -0
  100. package/dist/v2/runtime/handlers/handle-connect.cjs.map +1 -0
  101. package/dist/v2/runtime/handlers/handle-connect.mjs +49 -0
  102. package/dist/v2/runtime/handlers/handle-connect.mjs.map +1 -0
  103. package/dist/v2/runtime/handlers/handle-run.cjs +61 -0
  104. package/dist/v2/runtime/handlers/handle-run.cjs.map +1 -0
  105. package/dist/v2/runtime/handlers/handle-run.mjs +61 -0
  106. package/dist/v2/runtime/handlers/handle-run.mjs.map +1 -0
  107. package/dist/v2/runtime/handlers/handle-stop.cjs +47 -0
  108. package/dist/v2/runtime/handlers/handle-stop.cjs.map +1 -0
  109. package/dist/v2/runtime/handlers/handle-stop.mjs +46 -0
  110. package/dist/v2/runtime/handlers/handle-stop.mjs.map +1 -0
  111. package/dist/v2/runtime/handlers/handle-transcribe.cjs +112 -0
  112. package/dist/v2/runtime/handlers/handle-transcribe.cjs.map +1 -0
  113. package/dist/v2/runtime/handlers/handle-transcribe.mjs +111 -0
  114. package/dist/v2/runtime/handlers/handle-transcribe.mjs.map +1 -0
  115. package/dist/v2/runtime/handlers/header-utils.cjs +26 -0
  116. package/dist/v2/runtime/handlers/header-utils.cjs.map +1 -0
  117. package/dist/v2/runtime/handlers/header-utils.mjs +25 -0
  118. package/dist/v2/runtime/handlers/header-utils.mjs.map +1 -0
  119. package/dist/v2/runtime/handlers/intelligence/connect.cjs +37 -0
  120. package/dist/v2/runtime/handlers/intelligence/connect.cjs.map +1 -0
  121. package/dist/v2/runtime/handlers/intelligence/connect.mjs +37 -0
  122. package/dist/v2/runtime/handlers/intelligence/connect.mjs.map +1 -0
  123. package/dist/v2/runtime/handlers/intelligence/run.cjs +89 -0
  124. package/dist/v2/runtime/handlers/intelligence/run.cjs.map +1 -0
  125. package/dist/v2/runtime/handlers/intelligence/run.mjs +88 -0
  126. package/dist/v2/runtime/handlers/intelligence/run.mjs.map +1 -0
  127. package/dist/v2/runtime/handlers/intelligence/thread-names.cjs +146 -0
  128. package/dist/v2/runtime/handlers/intelligence/thread-names.cjs.map +1 -0
  129. package/dist/v2/runtime/handlers/intelligence/thread-names.mjs +145 -0
  130. package/dist/v2/runtime/handlers/intelligence/thread-names.mjs.map +1 -0
  131. package/dist/v2/runtime/handlers/intelligence/threads.cjs +159 -0
  132. package/dist/v2/runtime/handlers/intelligence/threads.cjs.map +1 -0
  133. package/dist/v2/runtime/handlers/intelligence/threads.mjs +154 -0
  134. package/dist/v2/runtime/handlers/intelligence/threads.mjs.map +1 -0
  135. package/dist/v2/runtime/handlers/shared/agent-utils.cjs +74 -0
  136. package/dist/v2/runtime/handlers/shared/agent-utils.cjs.map +1 -0
  137. package/dist/v2/runtime/handlers/shared/agent-utils.mjs +70 -0
  138. package/dist/v2/runtime/handlers/shared/agent-utils.mjs.map +1 -0
  139. package/dist/v2/runtime/handlers/shared/intelligence-utils.cjs +21 -0
  140. package/dist/v2/runtime/handlers/shared/intelligence-utils.cjs.map +1 -0
  141. package/dist/v2/runtime/handlers/shared/intelligence-utils.mjs +20 -0
  142. package/dist/v2/runtime/handlers/shared/intelligence-utils.mjs.map +1 -0
  143. package/dist/v2/runtime/handlers/shared/json-response.cjs +12 -0
  144. package/dist/v2/runtime/handlers/shared/json-response.cjs.map +1 -0
  145. package/dist/v2/runtime/handlers/shared/json-response.mjs +10 -0
  146. package/dist/v2/runtime/handlers/shared/json-response.mjs.map +1 -0
  147. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.cjs +20 -0
  148. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -0
  149. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.mjs +20 -0
  150. package/dist/v2/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -0
  151. package/dist/v2/runtime/handlers/shared/sse-response.cjs +69 -0
  152. package/dist/v2/runtime/handlers/shared/sse-response.cjs.map +1 -0
  153. package/dist/v2/runtime/handlers/shared/sse-response.mjs +68 -0
  154. package/dist/v2/runtime/handlers/shared/sse-response.mjs.map +1 -0
  155. package/dist/v2/runtime/handlers/sse/connect.cjs +18 -0
  156. package/dist/v2/runtime/handlers/sse/connect.cjs.map +1 -0
  157. package/dist/v2/runtime/handlers/sse/connect.mjs +18 -0
  158. package/dist/v2/runtime/handlers/sse/connect.mjs.map +1 -0
  159. package/dist/v2/runtime/handlers/sse/run.cjs +18 -0
  160. package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -0
  161. package/dist/v2/runtime/handlers/sse/run.mjs +18 -0
  162. package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -0
  163. package/dist/v2/runtime/index.d.cts +13 -0
  164. package/dist/v2/runtime/index.d.mts +14 -0
  165. package/dist/v2/runtime/intelligence-platform/client.cjs +333 -0
  166. package/dist/v2/runtime/intelligence-platform/client.cjs.map +1 -0
  167. package/dist/v2/runtime/intelligence-platform/client.d.cts +336 -0
  168. package/dist/v2/runtime/intelligence-platform/client.d.cts.map +1 -0
  169. package/dist/v2/runtime/intelligence-platform/client.d.mts +336 -0
  170. package/dist/v2/runtime/intelligence-platform/client.d.mts.map +1 -0
  171. package/dist/v2/runtime/intelligence-platform/client.mjs +331 -0
  172. package/dist/v2/runtime/intelligence-platform/client.mjs.map +1 -0
  173. package/dist/v2/runtime/intelligence-platform/index.d.mts +2 -0
  174. package/dist/v2/runtime/middleware-sse-parser.cjs +138 -0
  175. package/dist/v2/runtime/middleware-sse-parser.cjs.map +1 -0
  176. package/dist/v2/runtime/middleware-sse-parser.d.cts +22 -0
  177. package/dist/v2/runtime/middleware-sse-parser.d.cts.map +1 -0
  178. package/dist/v2/runtime/middleware-sse-parser.d.mts +22 -0
  179. package/dist/v2/runtime/middleware-sse-parser.d.mts.map +1 -0
  180. package/dist/v2/runtime/middleware-sse-parser.mjs +137 -0
  181. package/dist/v2/runtime/middleware-sse-parser.mjs.map +1 -0
  182. package/dist/v2/runtime/middleware.cjs +35 -0
  183. package/dist/v2/runtime/middleware.cjs.map +1 -0
  184. package/dist/v2/runtime/middleware.d.cts +32 -0
  185. package/dist/v2/runtime/middleware.d.cts.map +1 -0
  186. package/dist/v2/runtime/middleware.d.mts +32 -0
  187. package/dist/v2/runtime/middleware.d.mts.map +1 -0
  188. package/dist/v2/runtime/middleware.mjs +33 -0
  189. package/dist/v2/runtime/middleware.mjs.map +1 -0
  190. package/dist/v2/runtime/runner/agent-runner.cjs +8 -0
  191. package/dist/v2/runtime/runner/agent-runner.cjs.map +1 -0
  192. package/dist/v2/runtime/runner/agent-runner.d.cts +32 -0
  193. package/dist/v2/runtime/runner/agent-runner.d.cts.map +1 -0
  194. package/dist/v2/runtime/runner/agent-runner.d.mts +32 -0
  195. package/dist/v2/runtime/runner/agent-runner.d.mts.map +1 -0
  196. package/dist/v2/runtime/runner/agent-runner.mjs +7 -0
  197. package/dist/v2/runtime/runner/agent-runner.mjs.map +1 -0
  198. package/dist/v2/runtime/runner/in-memory.cjs +223 -0
  199. package/dist/v2/runtime/runner/in-memory.cjs.map +1 -0
  200. package/dist/v2/runtime/runner/in-memory.d.cts +15 -0
  201. package/dist/v2/runtime/runner/in-memory.d.cts.map +1 -0
  202. package/dist/v2/runtime/runner/in-memory.d.mts +15 -0
  203. package/dist/v2/runtime/runner/in-memory.d.mts.map +1 -0
  204. package/dist/v2/runtime/runner/in-memory.mjs +222 -0
  205. package/dist/v2/runtime/runner/in-memory.mjs.map +1 -0
  206. package/dist/v2/runtime/runner/index.d.cts +6 -0
  207. package/dist/v2/runtime/runner/index.d.mts +6 -0
  208. package/dist/v2/runtime/runner/index.mjs +7 -0
  209. package/dist/v2/runtime/runner/intelligence.cjs +246 -0
  210. package/dist/v2/runtime/runner/intelligence.cjs.map +1 -0
  211. package/dist/v2/runtime/runner/intelligence.d.cts +57 -0
  212. package/dist/v2/runtime/runner/intelligence.d.cts.map +1 -0
  213. package/dist/v2/runtime/runner/intelligence.d.mts +57 -0
  214. package/dist/v2/runtime/runner/intelligence.d.mts.map +1 -0
  215. package/dist/v2/runtime/runner/intelligence.mjs +245 -0
  216. package/dist/v2/runtime/runner/intelligence.mjs.map +1 -0
  217. package/dist/v2/runtime/runtime.cjs +101 -0
  218. package/dist/v2/runtime/runtime.cjs.map +1 -0
  219. package/dist/v2/runtime/runtime.d.cts +132 -0
  220. package/dist/v2/runtime/runtime.d.cts.map +1 -0
  221. package/dist/v2/runtime/runtime.d.mts +133 -0
  222. package/dist/v2/runtime/runtime.d.mts.map +1 -0
  223. package/dist/v2/runtime/runtime.mjs +97 -0
  224. package/dist/v2/runtime/runtime.mjs.map +1 -0
  225. package/dist/v2/runtime/telemetry/scarf-client.cjs +32 -0
  226. package/dist/v2/runtime/telemetry/scarf-client.cjs.map +1 -0
  227. package/dist/v2/runtime/telemetry/scarf-client.mjs +32 -0
  228. package/dist/v2/runtime/telemetry/scarf-client.mjs.map +1 -0
  229. package/dist/v2/runtime/telemetry/telemetry-client.cjs +35 -0
  230. package/dist/v2/runtime/telemetry/telemetry-client.cjs.map +1 -0
  231. package/dist/v2/runtime/telemetry/telemetry-client.mjs +35 -0
  232. package/dist/v2/runtime/telemetry/telemetry-client.mjs.map +1 -0
  233. package/dist/v2/runtime/transcription-service/transcription-service.cjs +8 -0
  234. package/dist/v2/runtime/transcription-service/transcription-service.cjs.map +1 -0
  235. package/dist/v2/runtime/transcription-service/transcription-service.d.cts +15 -0
  236. package/dist/v2/runtime/transcription-service/transcription-service.d.cts.map +1 -0
  237. package/dist/v2/runtime/transcription-service/transcription-service.d.mts +15 -0
  238. package/dist/v2/runtime/transcription-service/transcription-service.d.mts.map +1 -0
  239. package/dist/v2/runtime/transcription-service/transcription-service.mjs +7 -0
  240. package/dist/v2/runtime/transcription-service/transcription-service.mjs.map +1 -0
  241. package/package.json +24 -7
  242. package/src/agent/__tests__/ai-sdk-v6-compat.test.ts +116 -0
  243. package/src/agent/__tests__/basic-agent.test.ts +1248 -0
  244. package/src/agent/__tests__/config-tools-execution.test.ts +516 -0
  245. package/src/agent/__tests__/mcp-clients.test.ts +260 -0
  246. package/src/agent/__tests__/property-overrides.test.ts +598 -0
  247. package/src/agent/__tests__/standard-schema-tools.test.ts +313 -0
  248. package/src/agent/__tests__/standard-schema-types.test.ts +158 -0
  249. package/src/agent/__tests__/state-tools.test.ts +436 -0
  250. package/src/agent/__tests__/test-helpers.ts +178 -0
  251. package/src/agent/__tests__/utils.test.ts +536 -0
  252. package/src/agent/__tests__/zod-regression.test.ts +350 -0
  253. package/src/agent/index.ts +1305 -0
  254. package/src/graphql/message-conversion/agui-to-gql.test.ts +1 -1
  255. package/src/graphql/message-conversion/agui-to-gql.ts +1 -1
  256. package/src/graphql/message-conversion/gql-to-agui.ts +1 -1
  257. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +1 -1
  258. package/src/lib/integrations/nextjs/app-router.ts +2 -2
  259. package/src/lib/integrations/node-http/index.ts +2 -2
  260. package/src/lib/runtime/copilot-runtime.ts +3 -5
  261. package/src/lib/runtime/telemetry-agent-runner.ts +1 -1
  262. package/src/service-adapters/conversion.test.ts +1 -1
  263. package/src/service-adapters/conversion.ts +1 -28
  264. package/src/v2/index.ts +5 -2
  265. package/src/v2/runtime/__tests__/cors-credentials.test.ts +320 -0
  266. package/src/v2/runtime/__tests__/express-abort-signal.test.ts +25 -0
  267. package/src/v2/runtime/__tests__/express-body-order.test.ts +76 -0
  268. package/src/v2/runtime/__tests__/express-single-sse.test.ts +122 -0
  269. package/src/v2/runtime/__tests__/get-runtime-info.test.ts +141 -0
  270. package/src/v2/runtime/__tests__/handle-connect.test.ts +423 -0
  271. package/src/v2/runtime/__tests__/handle-run.test.ts +910 -0
  272. package/src/v2/runtime/__tests__/handle-threads.test.ts +388 -0
  273. package/src/v2/runtime/__tests__/handle-transcribe.test.ts +301 -0
  274. package/src/v2/runtime/__tests__/header-utils.test.ts +88 -0
  275. package/src/v2/runtime/__tests__/in-process-agent-runner-messages.test.ts +230 -0
  276. package/src/v2/runtime/__tests__/in-process-agent-runner.test.ts +1030 -0
  277. package/src/v2/runtime/__tests__/middleware-express.test.ts +206 -0
  278. package/src/v2/runtime/__tests__/middleware-single-express.test.ts +211 -0
  279. package/src/v2/runtime/__tests__/middleware-single.test.ts +225 -0
  280. package/src/v2/runtime/__tests__/middleware-sse-parser.test.ts +187 -0
  281. package/src/v2/runtime/__tests__/middleware.test.ts +251 -0
  282. package/src/v2/runtime/__tests__/routing-express.test.ts +174 -0
  283. package/src/v2/runtime/__tests__/routing-single-express.test.ts +168 -0
  284. package/src/v2/runtime/__tests__/routing-single.test.ts +193 -0
  285. package/src/v2/runtime/__tests__/routing.test.ts +257 -0
  286. package/src/v2/runtime/__tests__/runtime.test.ts +123 -0
  287. package/src/v2/runtime/__tests__/telemetry.test.ts +167 -0
  288. package/src/v2/runtime/__tests__/thread-names.test.ts +188 -0
  289. package/src/v2/runtime/endpoints/express-single.ts +231 -0
  290. package/src/v2/runtime/endpoints/express-utils.ts +182 -0
  291. package/src/v2/runtime/endpoints/express.ts +275 -0
  292. package/src/v2/runtime/endpoints/hono-single.ts +212 -0
  293. package/src/v2/runtime/endpoints/hono.ts +314 -0
  294. package/src/v2/runtime/endpoints/index.ts +4 -0
  295. package/src/v2/runtime/endpoints/single-route-helpers.ts +125 -0
  296. package/src/v2/runtime/express.ts +2 -0
  297. package/src/v2/runtime/handler.ts +3 -0
  298. package/src/v2/runtime/handlers/get-runtime-info.ts +79 -0
  299. package/src/v2/runtime/handlers/handle-connect.ts +76 -0
  300. package/src/v2/runtime/handlers/handle-run.ts +89 -0
  301. package/src/v2/runtime/handlers/handle-stop.ts +76 -0
  302. package/src/v2/runtime/handlers/handle-threads.ts +7 -0
  303. package/src/v2/runtime/handlers/handle-transcribe.ts +256 -0
  304. package/src/v2/runtime/handlers/header-utils.ts +24 -0
  305. package/src/v2/runtime/handlers/intelligence/connect.ts +65 -0
  306. package/src/v2/runtime/handlers/intelligence/run.ts +152 -0
  307. package/src/v2/runtime/handlers/intelligence/thread-names.ts +246 -0
  308. package/src/v2/runtime/handlers/intelligence/threads.ts +233 -0
  309. package/src/v2/runtime/handlers/shared/agent-utils.ts +136 -0
  310. package/src/v2/runtime/handlers/shared/intelligence-utils.ts +21 -0
  311. package/src/v2/runtime/handlers/shared/json-response.ts +6 -0
  312. package/src/v2/runtime/handlers/shared/resolve-intelligence-user.ts +25 -0
  313. package/src/v2/runtime/handlers/shared/sse-response.ts +100 -0
  314. package/src/v2/runtime/handlers/sse/connect.ts +24 -0
  315. package/src/v2/runtime/handlers/sse/run.ts +27 -0
  316. package/src/v2/runtime/index.ts +20 -0
  317. package/src/v2/runtime/intelligence-platform/__tests__/client.test.ts +605 -0
  318. package/src/v2/runtime/intelligence-platform/client.ts +659 -0
  319. package/src/v2/runtime/intelligence-platform/index.ts +10 -0
  320. package/src/v2/runtime/middleware-sse-parser.ts +200 -0
  321. package/src/v2/runtime/middleware.ts +115 -0
  322. package/src/v2/runtime/runner/__tests__/finalize-events.test.ts +109 -0
  323. package/src/v2/runtime/runner/__tests__/in-memory-runner.e2e.test.ts +775 -0
  324. package/src/v2/runtime/runner/__tests__/in-memory-runner.test.ts +363 -0
  325. package/src/v2/runtime/runner/__tests__/intelligence-runner.test.ts +981 -0
  326. package/src/v2/runtime/runner/agent-runner.ts +36 -0
  327. package/src/v2/runtime/runner/in-memory.ts +381 -0
  328. package/src/v2/runtime/runner/index.ts +4 -0
  329. package/src/v2/runtime/runner/intelligence.ts +429 -0
  330. package/src/v2/runtime/runtime.ts +260 -0
  331. package/src/v2/runtime/telemetry/events.ts +35 -0
  332. package/src/v2/runtime/telemetry/index.ts +7 -0
  333. package/src/v2/runtime/telemetry/scarf-client.ts +39 -0
  334. package/src/v2/runtime/telemetry/telemetry-client.ts +70 -0
  335. package/src/v2/runtime/transcription-service/transcription-service.ts +11 -0
  336. package/tsconfig.json +9 -2
  337. package/tsdown.config.ts +1 -0
@@ -1,6 +1,6 @@
1
1
  import { vi } from "vitest";
2
2
  import * as gql from "../types/converted/index";
3
- import agui from "@copilotkit/shared";
3
+ import * as agui from "@copilotkit/shared";
4
4
  import {
5
5
  aguiToGQL,
6
6
  aguiTextMessageToGQLMessage,
@@ -1,6 +1,6 @@
1
1
  import * as gql from "../types/converted/index";
2
2
  import { MessageRole } from "../types/enums";
3
- import agui from "@copilotkit/shared"; // named agui for clarity, but this only includes agui message types
3
+ import * as agui from "@copilotkit/shared"; // named agui for clarity, but this only includes agui message types
4
4
 
5
5
  // Helper function to extract agent name from message
6
6
  function extractAgentName(message: agui.Message): string {
@@ -1,5 +1,5 @@
1
1
  import * as gql from "../types/converted/index";
2
- import agui from "@copilotkit/shared";
2
+ import * as agui from "@copilotkit/shared";
3
3
  import { MessageStatusCode } from "../types/message-status.type";
4
4
 
5
5
  // Define valid image formats based on the supported formats in the codebase
@@ -1,6 +1,6 @@
1
1
  import { vi } from "vitest";
2
2
  import * as gql from "../types/converted/index";
3
- import agui from "@copilotkit/shared";
3
+ import * as agui from "@copilotkit/shared";
4
4
  import { aguiToGQL } from "./agui-to-gql";
5
5
  import { gqlToAGUI } from "./gql-to-agui";
6
6
 
@@ -1,4 +1,4 @@
1
- import { createCopilotEndpointSingleRoute } from "@copilotkitnext/runtime";
1
+ import { createCopilotEndpointSingleRoute } from "../../../v2/runtime";
2
2
  import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
3
3
  import telemetry, {
4
4
  getRuntimeInstanceTelemetryInfo,
@@ -35,7 +35,7 @@ export function copilotRuntimeNextJSAppRouterEndpoint(
35
35
  options.runtime.handleServiceAdapter(serviceAdapter);
36
36
  }
37
37
 
38
- // Note: cors option requires @copilotkitnext/runtime with credentials support
38
+ // Note: cors option requires @copilotkit/runtime with credentials support
39
39
  const copilotRoute = createCopilotEndpointSingleRoute({
40
40
  runtime: options.runtime.instance,
41
41
  basePath: options.baseUrl ?? options.endpoint,
@@ -2,7 +2,7 @@ import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
2
2
  import telemetry, {
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  } from "../../telemetry-client";
5
- import { createCopilotEndpointSingleRoute } from "@copilotkitnext/runtime";
5
+ import { createCopilotEndpointSingleRoute } from "../../../v2/runtime";
6
6
  import type { IncomingMessage, ServerResponse } from "node:http";
7
7
  import {
8
8
  getFullUrl,
@@ -45,7 +45,7 @@ export function copilotRuntimeNodeHttpEndpoint(
45
45
  options.runtime.handleServiceAdapter(serviceAdapter);
46
46
  }
47
47
 
48
- // Note: cors option requires @copilotkitnext/runtime with credentials support
48
+ // Note: cors option requires @copilotkit/runtime with credentials support
49
49
  const honoApp = createCopilotEndpointSingleRoute({
50
50
  runtime: options.runtime.instance,
51
51
  basePath: options.baseUrl ?? options.endpoint,
@@ -36,7 +36,7 @@ import {
36
36
  type CopilotRuntimeOptions as CopilotRuntimeOptionsVNext,
37
37
  type AgentRunner,
38
38
  InMemoryAgentRunner,
39
- } from "@copilotkitnext/runtime";
39
+ } from "../../v2/runtime";
40
40
  import { TelemetryAgentRunner } from "./telemetry-agent-runner";
41
41
  import telemetry from "../telemetry-client";
42
42
 
@@ -64,10 +64,7 @@ import {
64
64
  type MCPTool,
65
65
  extractParametersFromSchema,
66
66
  } from "./mcp-tools-utils";
67
- import {
68
- BuiltInAgent,
69
- type BuiltInAgentConfiguration,
70
- } from "@copilotkitnext/agent";
67
+ import { BuiltInAgent, type BuiltInAgentConfiguration } from "../../agent";
71
68
  // Define the function type alias here or import if defined elsewhere
72
69
  type CreateMCPClientFunction = (
73
70
  config: MCPEndpointConfig,
@@ -358,6 +355,7 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
358
355
  this.runtimeArgs = {
359
356
  agents: { ...endpointAgents, ...agents },
360
357
  runner,
358
+ licenseToken: params?.licenseToken,
361
359
  // TODO: add support for transcriptionService from CopilotRuntimeOptionsVNext once it is ready
362
360
  // transcriptionService: params?.transcriptionService,
363
361
 
@@ -8,7 +8,7 @@
8
8
  * - oss.runtime.agent_execution_stream_errored - when an agent execution fails
9
9
  */
10
10
 
11
- import { type AgentRunner, InMemoryAgentRunner } from "@copilotkitnext/runtime";
11
+ import { type AgentRunner, InMemoryAgentRunner } from "../../v2/runtime";
12
12
  import { createHash } from "node:crypto";
13
13
  import { tap, catchError, finalize } from "rxjs";
14
14
  import telemetry from "../telemetry-client";
@@ -3,7 +3,7 @@ import { describe, it, expect } from "vitest";
3
3
  /**
4
4
  * safeParseToolArgs is a private (non-exported) function in conversion.ts.
5
5
  * We duplicate its logic here to unit-test the algorithm in isolation.
6
- * This mirrors the shared safeParseToolArgs in @copilotkitnext/shared.
6
+ * This mirrors the shared safeParseToolArgs in @copilotkit/shared.
7
7
  */
8
8
  function safeParseToolArgs(raw: string): Record<string, unknown> {
9
9
  try {
@@ -8,7 +8,7 @@ import {
8
8
  } from "../graphql/types/converted";
9
9
  import { MessageInput } from "../graphql/inputs/message.input";
10
10
  import { plainToInstance } from "class-transformer";
11
- import { tryMap } from "@copilotkit/shared";
11
+ import { tryMap, safeParseToolArgs } from "@copilotkit/shared";
12
12
 
13
13
  export function convertGqlInputToMessages(
14
14
  inputMessages: MessageInput[],
@@ -67,30 +67,3 @@ export function convertGqlInputToMessages(
67
67
 
68
68
  return messages.filter((m) => m);
69
69
  }
70
-
71
- /**
72
- * Safely parses a JSON string into a plain object for tool arguments.
73
- * Mirrors the shared safeParseToolArgs in @copilotkitnext/shared (v2).
74
- * Kept as a local copy because v1 does not import from v2 shared.
75
- */
76
- function safeParseToolArgs(raw: string): Record<string, unknown> {
77
- try {
78
- const parsed = JSON.parse(raw);
79
- if (
80
- typeof parsed === "object" &&
81
- parsed !== null &&
82
- !Array.isArray(parsed)
83
- ) {
84
- return parsed as Record<string, unknown>;
85
- }
86
- console.warn(
87
- `[CopilotKit] Tool arguments parsed to non-object (${typeof parsed}), falling back to empty object`,
88
- );
89
- return {};
90
- } catch {
91
- console.warn(
92
- "[CopilotKit] Failed to parse tool arguments, falling back to empty object",
93
- );
94
- return {};
95
- }
96
- }
package/src/v2/index.ts CHANGED
@@ -1,2 +1,5 @@
1
- export * from "@copilotkitnext/runtime";
2
- export * from "@copilotkitnext/agent";
1
+ // V2 runtime (moved from @copilotkit/runtime/v2)
2
+ export * from "./runtime";
3
+
4
+ // Agent (merged into runtime)
5
+ export * from "../agent";
@@ -0,0 +1,320 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import {
3
+ createCopilotEndpoint,
4
+ createCopilotEndpointSingleRoute,
5
+ } from "../endpoints";
6
+ import { CopilotRuntime } from "../runtime";
7
+ import type { AbstractAgent } from "@ag-ui/client";
8
+
9
+ const createMockRuntime = (options: { beforeRequestMiddleware?: any } = {}) => {
10
+ const createMockAgent = () => {
11
+ const agent: unknown = {
12
+ execute: async () => ({ events: [] }),
13
+ };
14
+ (agent as { clone: () => unknown }).clone = () => createMockAgent();
15
+ return agent as AbstractAgent;
16
+ };
17
+
18
+ return new CopilotRuntime({
19
+ agents: { default: createMockAgent() },
20
+ ...options,
21
+ });
22
+ };
23
+
24
+ describe("CORS credentials configuration", () => {
25
+ describe("createCopilotEndpoint", () => {
26
+ it("sets Access-Control-Allow-Credentials header when credentials is true", async () => {
27
+ const runtime = createMockRuntime();
28
+ const endpoint = createCopilotEndpoint({
29
+ runtime,
30
+ basePath: "/",
31
+ cors: {
32
+ origin: "https://myapp.com",
33
+ credentials: true,
34
+ },
35
+ });
36
+
37
+ // Make a preflight OPTIONS request
38
+ const request = new Request("https://example.com/info", {
39
+ method: "OPTIONS",
40
+ headers: {
41
+ Origin: "https://myapp.com",
42
+ "Access-Control-Request-Method": "GET",
43
+ },
44
+ });
45
+
46
+ const response = await endpoint.fetch(request);
47
+
48
+ expect(response.headers.get("Access-Control-Allow-Credentials")).toBe(
49
+ "true",
50
+ );
51
+ expect(response.headers.get("Access-Control-Allow-Origin")).toBe(
52
+ "https://myapp.com",
53
+ );
54
+ });
55
+
56
+ it("does not set Access-Control-Allow-Credentials header when credentials is false", async () => {
57
+ const runtime = createMockRuntime();
58
+ const endpoint = createCopilotEndpoint({
59
+ runtime,
60
+ basePath: "/",
61
+ cors: {
62
+ origin: "https://myapp.com",
63
+ credentials: false,
64
+ },
65
+ });
66
+
67
+ const request = new Request("https://example.com/info", {
68
+ method: "OPTIONS",
69
+ headers: {
70
+ Origin: "https://myapp.com",
71
+ "Access-Control-Request-Method": "GET",
72
+ },
73
+ });
74
+
75
+ const response = await endpoint.fetch(request);
76
+
77
+ // When credentials is false, the header should not be present or be "false"
78
+ const credentialsHeader = response.headers.get(
79
+ "Access-Control-Allow-Credentials",
80
+ );
81
+ expect(credentialsHeader === null || credentialsHeader === "false").toBe(
82
+ true,
83
+ );
84
+ });
85
+
86
+ it("defaults to no credentials when cors config is not provided", async () => {
87
+ const runtime = createMockRuntime();
88
+ const endpoint = createCopilotEndpoint({
89
+ runtime,
90
+ basePath: "/",
91
+ // No cors config - should default to origin: "*" without credentials
92
+ });
93
+
94
+ const request = new Request("https://example.com/info", {
95
+ method: "OPTIONS",
96
+ headers: {
97
+ Origin: "https://somesite.com",
98
+ "Access-Control-Request-Method": "GET",
99
+ },
100
+ });
101
+
102
+ const response = await endpoint.fetch(request);
103
+
104
+ // Should allow any origin but not credentials
105
+ expect(response.headers.get("Access-Control-Allow-Origin")).toBe("*");
106
+ const credentialsHeader = response.headers.get(
107
+ "Access-Control-Allow-Credentials",
108
+ );
109
+ expect(credentialsHeader === null || credentialsHeader === "false").toBe(
110
+ true,
111
+ );
112
+ });
113
+
114
+ it("receives cookies in request when client sends them", async () => {
115
+ const receivedCookies: string[] = [];
116
+
117
+ const runtime = createMockRuntime({
118
+ beforeRequestMiddleware: async ({ request }: { request: Request }) => {
119
+ const cookie = request.headers.get("Cookie");
120
+ if (cookie) {
121
+ receivedCookies.push(cookie);
122
+ }
123
+ return undefined; // Don't modify the request
124
+ },
125
+ });
126
+
127
+ const endpoint = createCopilotEndpoint({
128
+ runtime,
129
+ basePath: "/",
130
+ cors: {
131
+ origin: "https://myapp.com",
132
+ credentials: true,
133
+ },
134
+ });
135
+
136
+ // Simulate a request with cookies (as a browser would send with credentials: "include")
137
+ const request = new Request("https://example.com/info", {
138
+ method: "GET",
139
+ headers: {
140
+ Origin: "https://myapp.com",
141
+ Cookie: "session=abc123; user=john",
142
+ },
143
+ });
144
+
145
+ const response = await endpoint.fetch(request);
146
+
147
+ expect(response.status).toBe(200);
148
+ expect(receivedCookies).toContain("session=abc123; user=john");
149
+ });
150
+ });
151
+
152
+ describe("createCopilotEndpointSingleRoute", () => {
153
+ it("sets Access-Control-Allow-Credentials header when credentials is true", async () => {
154
+ const runtime = createMockRuntime();
155
+ const endpoint = createCopilotEndpointSingleRoute({
156
+ runtime,
157
+ basePath: "/api/copilotkit",
158
+ cors: {
159
+ origin: "https://myapp.com",
160
+ credentials: true,
161
+ },
162
+ });
163
+
164
+ const request = new Request("https://example.com/api/copilotkit", {
165
+ method: "OPTIONS",
166
+ headers: {
167
+ Origin: "https://myapp.com",
168
+ "Access-Control-Request-Method": "POST",
169
+ },
170
+ });
171
+
172
+ const response = await endpoint.fetch(request);
173
+
174
+ expect(response.headers.get("Access-Control-Allow-Credentials")).toBe(
175
+ "true",
176
+ );
177
+ expect(response.headers.get("Access-Control-Allow-Origin")).toBe(
178
+ "https://myapp.com",
179
+ );
180
+ });
181
+
182
+ it("receives cookies in POST request body", async () => {
183
+ const receivedCookies: string[] = [];
184
+
185
+ const runtime = createMockRuntime({
186
+ beforeRequestMiddleware: async ({ request }: { request: Request }) => {
187
+ const cookie = request.headers.get("Cookie");
188
+ if (cookie) {
189
+ receivedCookies.push(cookie);
190
+ }
191
+ return undefined;
192
+ },
193
+ });
194
+
195
+ const endpoint = createCopilotEndpointSingleRoute({
196
+ runtime,
197
+ basePath: "/api/copilotkit",
198
+ cors: {
199
+ origin: "https://myapp.com",
200
+ credentials: true,
201
+ },
202
+ });
203
+
204
+ const request = new Request("https://example.com/api/copilotkit", {
205
+ method: "POST",
206
+ headers: {
207
+ Origin: "https://myapp.com",
208
+ "Content-Type": "application/json",
209
+ Cookie: "auth_token=xyz789",
210
+ },
211
+ body: JSON.stringify({ method: "info" }),
212
+ });
213
+
214
+ const response = await endpoint.fetch(request);
215
+
216
+ expect(response.status).toBe(200);
217
+ expect(receivedCookies).toContain("auth_token=xyz789");
218
+ });
219
+ });
220
+
221
+ describe("origin configuration", () => {
222
+ it("supports string origin", async () => {
223
+ const runtime = createMockRuntime();
224
+ const endpoint = createCopilotEndpoint({
225
+ runtime,
226
+ basePath: "/",
227
+ cors: {
228
+ origin: "https://specific-origin.com",
229
+ credentials: true,
230
+ },
231
+ });
232
+
233
+ const request = new Request("https://example.com/info", {
234
+ method: "OPTIONS",
235
+ headers: {
236
+ Origin: "https://specific-origin.com",
237
+ "Access-Control-Request-Method": "GET",
238
+ },
239
+ });
240
+
241
+ const response = await endpoint.fetch(request);
242
+
243
+ expect(response.headers.get("Access-Control-Allow-Origin")).toBe(
244
+ "https://specific-origin.com",
245
+ );
246
+ });
247
+
248
+ it("supports array of origins", async () => {
249
+ const runtime = createMockRuntime();
250
+ const endpoint = createCopilotEndpoint({
251
+ runtime,
252
+ basePath: "/",
253
+ cors: {
254
+ origin: ["https://app1.com", "https://app2.com"],
255
+ credentials: true,
256
+ },
257
+ });
258
+
259
+ // Request from first allowed origin
260
+ const request1 = new Request("https://example.com/info", {
261
+ method: "OPTIONS",
262
+ headers: {
263
+ Origin: "https://app1.com",
264
+ "Access-Control-Request-Method": "GET",
265
+ },
266
+ });
267
+
268
+ const response1 = await endpoint.fetch(request1);
269
+ expect(response1.headers.get("Access-Control-Allow-Origin")).toBe(
270
+ "https://app1.com",
271
+ );
272
+
273
+ // Request from second allowed origin
274
+ const request2 = new Request("https://example.com/info", {
275
+ method: "OPTIONS",
276
+ headers: {
277
+ Origin: "https://app2.com",
278
+ "Access-Control-Request-Method": "GET",
279
+ },
280
+ });
281
+
282
+ const response2 = await endpoint.fetch(request2);
283
+ expect(response2.headers.get("Access-Control-Allow-Origin")).toBe(
284
+ "https://app2.com",
285
+ );
286
+ });
287
+
288
+ it("supports function origin for dynamic resolution", async () => {
289
+ const runtime = createMockRuntime();
290
+ const endpoint = createCopilotEndpoint({
291
+ runtime,
292
+ basePath: "/",
293
+ cors: {
294
+ origin: (origin: string) => {
295
+ // Only allow origins ending with .mycompany.com
296
+ if (origin.endsWith(".mycompany.com")) {
297
+ return origin;
298
+ }
299
+ return null;
300
+ },
301
+ credentials: true,
302
+ },
303
+ });
304
+
305
+ // Allowed origin
306
+ const request1 = new Request("https://example.com/info", {
307
+ method: "OPTIONS",
308
+ headers: {
309
+ Origin: "https://app.mycompany.com",
310
+ "Access-Control-Request-Method": "GET",
311
+ },
312
+ });
313
+
314
+ const response1 = await endpoint.fetch(request1);
315
+ expect(response1.headers.get("Access-Control-Allow-Origin")).toBe(
316
+ "https://app.mycompany.com",
317
+ );
318
+ });
319
+ });
320
+ });
@@ -0,0 +1,25 @@
1
+ import express from "express";
2
+ import request from "supertest";
3
+ import { describe, expect, it } from "vitest";
4
+
5
+ import { createFetchRequestFromExpress } from "../endpoints/express-utils";
6
+
7
+ describe("createFetchRequestFromExpress abort behavior", () => {
8
+ it("does not abort when the request ends normally", async () => {
9
+ const app = express();
10
+
11
+ app.post("/check", async (req, res) => {
12
+ const request = createFetchRequestFromExpress(req);
13
+ await new Promise((resolve) => setTimeout(resolve, 20));
14
+ res.json({ aborted: request.signal.aborted });
15
+ });
16
+
17
+ const response = await request(app)
18
+ .post("/check")
19
+ .set("Content-Type", "application/json")
20
+ .send({ hello: "world" });
21
+
22
+ expect(response.status).toBe(200);
23
+ expect(response.body).toEqual({ aborted: false });
24
+ });
25
+ });
@@ -0,0 +1,76 @@
1
+ import express from "express";
2
+ import request from "supertest";
3
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4
+ import type { AbstractAgent } from "@ag-ui/client";
5
+
6
+ import { createCopilotEndpointExpress } from "../express";
7
+ import { CopilotRuntime } from "../runtime";
8
+
9
+ const handleRunAgentMock = vi.fn();
10
+
11
+ vi.mock("../handlers/handle-run", () => ({
12
+ handleRunAgent: (...args: unknown[]) => handleRunAgentMock(...args),
13
+ }));
14
+
15
+ const createRuntime = () =>
16
+ new CopilotRuntime({
17
+ agents: {
18
+ agent: {
19
+ clone: () => ({
20
+ execute: async () => ({ events: [] }),
21
+ }),
22
+ } as unknown as AbstractAgent,
23
+ },
24
+ });
25
+
26
+ describe("createCopilotEndpointExpress with body parsers", () => {
27
+ beforeEach(() => {
28
+ handleRunAgentMock.mockReset();
29
+ handleRunAgentMock.mockImplementation(
30
+ async ({ request }: { request: Request }) => {
31
+ const body = await request.json();
32
+ return new Response(JSON.stringify({ body }), {
33
+ headers: { "content-type": "application/json" },
34
+ });
35
+ },
36
+ );
37
+ });
38
+
39
+ afterEach(() => {
40
+ vi.clearAllMocks();
41
+ });
42
+
43
+ const sendRunRequest = (app: express.Express) =>
44
+ request(app)
45
+ .post("/agent/agent/run")
46
+ .set("Content-Type", "application/json")
47
+ .send({ hello: "world" });
48
+
49
+ it("handles requests when CopilotKit router is registered before express.json()", async () => {
50
+ const app = express();
51
+ app.use(
52
+ createCopilotEndpointExpress({ runtime: createRuntime(), basePath: "/" }),
53
+ );
54
+ app.use(express.json());
55
+
56
+ const response = await sendRunRequest(app);
57
+
58
+ expect(response.status).toBe(200);
59
+ expect(response.body).toEqual({ body: { hello: "world" } });
60
+ expect(handleRunAgentMock).toHaveBeenCalledTimes(1);
61
+ });
62
+
63
+ it("handles requests when express.json() runs before the CopilotKit router", async () => {
64
+ const app = express();
65
+ app.use(express.json());
66
+ app.use(
67
+ createCopilotEndpointExpress({ runtime: createRuntime(), basePath: "/" }),
68
+ );
69
+
70
+ const response = await sendRunRequest(app);
71
+
72
+ expect(response.status).toBe(200);
73
+ expect(response.body).toEqual({ body: { hello: "world" } });
74
+ expect(handleRunAgentMock).toHaveBeenCalledTimes(1);
75
+ });
76
+ });