@copilotkit/runtime 2.0.0-next.1 → 2.0.0-rc.1

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 (623) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +135 -1
  3. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  5. package/dist/agent/converters/aisdk.cjs +355 -0
  6. package/dist/agent/converters/aisdk.cjs.map +1 -0
  7. package/dist/agent/converters/aisdk.d.cts +22 -0
  8. package/dist/agent/converters/aisdk.d.cts.map +1 -0
  9. package/dist/agent/converters/aisdk.d.mts +22 -0
  10. package/dist/agent/converters/aisdk.d.mts.map +1 -0
  11. package/dist/agent/converters/aisdk.mjs +351 -0
  12. package/dist/agent/converters/aisdk.mjs.map +1 -0
  13. package/dist/agent/converters/index.d.mts +2 -0
  14. package/dist/agent/converters/tanstack.cjs +374 -0
  15. package/dist/agent/converters/tanstack.cjs.map +1 -0
  16. package/dist/agent/converters/tanstack.d.cts +83 -0
  17. package/dist/agent/converters/tanstack.d.cts.map +1 -0
  18. package/dist/agent/converters/tanstack.d.mts +83 -0
  19. package/dist/agent/converters/tanstack.d.mts.map +1 -0
  20. package/dist/agent/converters/tanstack.mjs +372 -0
  21. package/dist/agent/converters/tanstack.mjs.map +1 -0
  22. package/dist/agent/converters/usage.cjs +68 -0
  23. package/dist/agent/converters/usage.cjs.map +1 -0
  24. package/dist/agent/converters/usage.d.cts +19 -0
  25. package/dist/agent/converters/usage.d.cts.map +1 -0
  26. package/dist/agent/converters/usage.d.mts +19 -0
  27. package/dist/agent/converters/usage.d.mts.map +1 -0
  28. package/dist/agent/converters/usage.mjs +62 -0
  29. package/dist/agent/converters/usage.mjs.map +1 -0
  30. package/dist/agent/index.cjs +1328 -0
  31. package/dist/agent/index.cjs.map +1 -0
  32. package/dist/agent/index.d.cts +467 -0
  33. package/dist/agent/index.d.cts.map +1 -0
  34. package/dist/agent/index.d.mts +468 -0
  35. package/dist/agent/index.d.mts.map +1 -0
  36. package/dist/agent/index.mjs +1318 -0
  37. package/dist/agent/index.mjs.map +1 -0
  38. package/dist/agent/learned-skills.cjs +76 -0
  39. package/dist/agent/learned-skills.cjs.map +1 -0
  40. package/dist/agent/learned-skills.d.cts +15 -0
  41. package/dist/agent/learned-skills.d.cts.map +1 -0
  42. package/dist/agent/learned-skills.d.mts +15 -0
  43. package/dist/agent/learned-skills.d.mts.map +1 -0
  44. package/dist/agent/learned-skills.mjs +74 -0
  45. package/dist/agent/learned-skills.mjs.map +1 -0
  46. package/dist/agent/mcp-tool-names.cjs +82 -0
  47. package/dist/agent/mcp-tool-names.cjs.map +1 -0
  48. package/dist/agent/mcp-tool-names.mjs +80 -0
  49. package/dist/agent/mcp-tool-names.mjs.map +1 -0
  50. package/dist/agent/state-delta.cjs +321 -0
  51. package/dist/agent/state-delta.cjs.map +1 -0
  52. package/dist/agent/state-delta.mjs +320 -0
  53. package/dist/agent/state-delta.mjs.map +1 -0
  54. package/dist/agent/url-download.cjs +503 -0
  55. package/dist/agent/url-download.cjs.map +1 -0
  56. package/dist/agent/url-download.d.cts +79 -0
  57. package/dist/agent/url-download.d.cts.map +1 -0
  58. package/dist/agent/url-download.d.mts +79 -0
  59. package/dist/agent/url-download.d.mts.map +1 -0
  60. package/dist/agent/url-download.mjs +500 -0
  61. package/dist/agent/url-download.mjs.map +1 -0
  62. package/dist/index.cjs +75 -0
  63. package/dist/index.d.cts +24 -0
  64. package/dist/index.d.mts +24 -0
  65. package/dist/index.mjs +17 -5598
  66. package/dist/internal/learned-skills.cjs +21 -0
  67. package/dist/internal/learned-skills.d.cts +9 -0
  68. package/dist/internal/learned-skills.d.mts +9 -0
  69. package/dist/internal/learned-skills.mjs +9 -0
  70. package/dist/node.cjs +7 -0
  71. package/dist/node.d.cts +4 -0
  72. package/dist/node.d.mts +4 -0
  73. package/dist/node.mjs +4 -0
  74. package/dist/runtime/core/channel-activation-config.cjs +87 -0
  75. package/dist/runtime/core/channel-activation-config.cjs.map +1 -0
  76. package/dist/runtime/core/channel-activation-config.d.cts +39 -0
  77. package/dist/runtime/core/channel-activation-config.d.cts.map +1 -0
  78. package/dist/runtime/core/channel-activation-config.d.mts +39 -0
  79. package/dist/runtime/core/channel-activation-config.d.mts.map +1 -0
  80. package/dist/runtime/core/channel-activation-config.mjs +85 -0
  81. package/dist/runtime/core/channel-activation-config.mjs.map +1 -0
  82. package/dist/runtime/core/channel-manager.cjs +973 -0
  83. package/dist/runtime/core/channel-manager.cjs.map +1 -0
  84. package/dist/runtime/core/channel-manager.d.cts +166 -0
  85. package/dist/runtime/core/channel-manager.d.cts.map +1 -0
  86. package/dist/runtime/core/channel-manager.d.mts +167 -0
  87. package/dist/runtime/core/channel-manager.d.mts.map +1 -0
  88. package/dist/runtime/core/channel-manager.mjs +972 -0
  89. package/dist/runtime/core/channel-manager.mjs.map +1 -0
  90. package/dist/runtime/core/debug-event-bus.cjs +57 -0
  91. package/dist/runtime/core/debug-event-bus.cjs.map +1 -0
  92. package/dist/runtime/core/debug-event-bus.d.cts +18 -0
  93. package/dist/runtime/core/debug-event-bus.d.cts.map +1 -0
  94. package/dist/runtime/core/debug-event-bus.d.mts +18 -0
  95. package/dist/runtime/core/debug-event-bus.d.mts.map +1 -0
  96. package/dist/runtime/core/debug-event-bus.mjs +55 -0
  97. package/dist/runtime/core/debug-event-bus.mjs.map +1 -0
  98. package/dist/runtime/core/fetch-cors.cjs +71 -0
  99. package/dist/runtime/core/fetch-cors.cjs.map +1 -0
  100. package/dist/runtime/core/fetch-cors.d.cts +19 -0
  101. package/dist/runtime/core/fetch-cors.d.cts.map +1 -0
  102. package/dist/runtime/core/fetch-cors.d.mts +19 -0
  103. package/dist/runtime/core/fetch-cors.d.mts.map +1 -0
  104. package/dist/runtime/core/fetch-cors.mjs +69 -0
  105. package/dist/runtime/core/fetch-cors.mjs.map +1 -0
  106. package/dist/runtime/core/fetch-handler.cjs +539 -0
  107. package/dist/runtime/core/fetch-handler.cjs.map +1 -0
  108. package/dist/runtime/core/fetch-handler.d.cts +99 -0
  109. package/dist/runtime/core/fetch-handler.d.cts.map +1 -0
  110. package/dist/runtime/core/fetch-handler.d.mts +99 -0
  111. package/dist/runtime/core/fetch-handler.d.mts.map +1 -0
  112. package/dist/runtime/core/fetch-handler.mjs +538 -0
  113. package/dist/runtime/core/fetch-handler.mjs.map +1 -0
  114. package/dist/runtime/core/fetch-router.cjs +141 -0
  115. package/dist/runtime/core/fetch-router.cjs.map +1 -0
  116. package/dist/runtime/core/fetch-router.mjs +140 -0
  117. package/dist/runtime/core/fetch-router.mjs.map +1 -0
  118. package/dist/runtime/core/hooks.cjs +28 -0
  119. package/dist/runtime/core/hooks.cjs.map +1 -0
  120. package/dist/runtime/core/hooks.d.cts +121 -0
  121. package/dist/runtime/core/hooks.d.cts.map +1 -0
  122. package/dist/runtime/core/hooks.d.mts +121 -0
  123. package/dist/runtime/core/hooks.d.mts.map +1 -0
  124. package/dist/runtime/core/hooks.mjs +24 -0
  125. package/dist/runtime/core/hooks.mjs.map +1 -0
  126. package/dist/runtime/core/learning.cjs +61 -0
  127. package/dist/runtime/core/learning.cjs.map +1 -0
  128. package/dist/runtime/core/learning.d.cts +61 -0
  129. package/dist/runtime/core/learning.d.cts.map +1 -0
  130. package/dist/runtime/core/learning.d.mts +61 -0
  131. package/dist/runtime/core/learning.d.mts.map +1 -0
  132. package/dist/runtime/core/learning.mjs +56 -0
  133. package/dist/runtime/core/learning.mjs.map +1 -0
  134. package/dist/runtime/core/logger.cjs +21 -0
  135. package/dist/runtime/core/logger.cjs.map +1 -0
  136. package/dist/runtime/core/logger.d.cts +12 -0
  137. package/dist/runtime/core/logger.d.cts.map +1 -0
  138. package/dist/runtime/core/logger.d.mts +12 -0
  139. package/dist/runtime/core/logger.d.mts.map +1 -0
  140. package/dist/runtime/core/logger.mjs +18 -0
  141. package/dist/runtime/core/logger.mjs.map +1 -0
  142. package/dist/runtime/core/middleware-sse-parser.cjs +149 -0
  143. package/dist/runtime/core/middleware-sse-parser.cjs.map +1 -0
  144. package/dist/runtime/core/middleware-sse-parser.d.cts +21 -0
  145. package/dist/runtime/core/middleware-sse-parser.d.cts.map +1 -0
  146. package/dist/runtime/core/middleware-sse-parser.d.mts +21 -0
  147. package/dist/runtime/core/middleware-sse-parser.d.mts.map +1 -0
  148. package/dist/runtime/core/middleware-sse-parser.mjs +148 -0
  149. package/dist/runtime/core/middleware-sse-parser.mjs.map +1 -0
  150. package/dist/runtime/core/middleware.cjs +34 -0
  151. package/dist/runtime/core/middleware.cjs.map +1 -0
  152. package/dist/runtime/core/middleware.d.cts +31 -0
  153. package/dist/runtime/core/middleware.d.cts.map +1 -0
  154. package/dist/runtime/core/middleware.d.mts +31 -0
  155. package/dist/runtime/core/middleware.d.mts.map +1 -0
  156. package/dist/runtime/core/middleware.mjs +32 -0
  157. package/dist/runtime/core/middleware.mjs.map +1 -0
  158. package/dist/runtime/core/package-info.cjs +9 -0
  159. package/dist/runtime/core/package-info.cjs.map +1 -0
  160. package/dist/runtime/core/package-info.mjs +7 -0
  161. package/dist/runtime/core/package-info.mjs.map +1 -0
  162. package/dist/runtime/core/runtime-error-reporter.cjs +21 -0
  163. package/dist/runtime/core/runtime-error-reporter.cjs.map +1 -0
  164. package/dist/runtime/core/runtime-error-reporter.mjs +18 -0
  165. package/dist/runtime/core/runtime-error-reporter.mjs.map +1 -0
  166. package/dist/runtime/core/runtime.cjs +256 -0
  167. package/dist/runtime/core/runtime.cjs.map +1 -0
  168. package/dist/runtime/core/runtime.d.cts +481 -0
  169. package/dist/runtime/core/runtime.d.cts.map +1 -0
  170. package/dist/runtime/core/runtime.d.mts +481 -0
  171. package/dist/runtime/core/runtime.d.mts.map +1 -0
  172. package/dist/runtime/core/runtime.mjs +249 -0
  173. package/dist/runtime/core/runtime.mjs.map +1 -0
  174. package/dist/runtime/endpoints/auto-start-channels.cjs +46 -0
  175. package/dist/runtime/endpoints/auto-start-channels.cjs.map +1 -0
  176. package/dist/runtime/endpoints/auto-start-channels.mjs +45 -0
  177. package/dist/runtime/endpoints/auto-start-channels.mjs.map +1 -0
  178. package/dist/runtime/endpoints/node-fetch-handler.cjs +75 -0
  179. package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -0
  180. package/dist/runtime/endpoints/node-fetch-handler.d.cts +11 -0
  181. package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -0
  182. package/dist/runtime/endpoints/node-fetch-handler.d.mts +11 -0
  183. package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -0
  184. package/dist/runtime/endpoints/node-fetch-handler.mjs +73 -0
  185. package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -0
  186. package/dist/runtime/endpoints/node.cjs +16 -0
  187. package/dist/runtime/endpoints/node.cjs.map +1 -0
  188. package/dist/runtime/endpoints/node.d.cts +104 -0
  189. package/dist/runtime/endpoints/node.d.cts.map +1 -0
  190. package/dist/runtime/endpoints/node.d.mts +104 -0
  191. package/dist/runtime/endpoints/node.d.mts.map +1 -0
  192. package/dist/runtime/endpoints/node.mjs +16 -0
  193. package/dist/runtime/endpoints/node.mjs.map +1 -0
  194. package/dist/runtime/endpoints/single-route-helpers.cjs +130 -0
  195. package/dist/runtime/endpoints/single-route-helpers.cjs.map +1 -0
  196. package/dist/runtime/endpoints/single-route-helpers.mjs +125 -0
  197. package/dist/runtime/endpoints/single-route-helpers.mjs.map +1 -0
  198. package/dist/runtime/generative-ui/generative-ui-middleware.cjs +393 -0
  199. package/dist/runtime/generative-ui/generative-ui-middleware.cjs.map +1 -0
  200. package/dist/runtime/generative-ui/generative-ui-middleware.d.cts +20 -0
  201. package/dist/runtime/generative-ui/generative-ui-middleware.d.cts.map +1 -0
  202. package/dist/runtime/generative-ui/generative-ui-middleware.d.mts +20 -0
  203. package/dist/runtime/generative-ui/generative-ui-middleware.d.mts.map +1 -0
  204. package/dist/runtime/generative-ui/generative-ui-middleware.mjs +392 -0
  205. package/dist/runtime/generative-ui/generative-ui-middleware.mjs.map +1 -0
  206. package/dist/runtime/generative-ui/index.d.cts +2 -0
  207. package/dist/runtime/generative-ui/index.d.mts +2 -0
  208. package/dist/runtime/generative-ui/surface-writer.cjs +85 -0
  209. package/dist/runtime/generative-ui/surface-writer.cjs.map +1 -0
  210. package/dist/runtime/generative-ui/surface-writer.d.cts +32 -0
  211. package/dist/runtime/generative-ui/surface-writer.d.cts.map +1 -0
  212. package/dist/runtime/generative-ui/surface-writer.d.mts +32 -0
  213. package/dist/runtime/generative-ui/surface-writer.d.mts.map +1 -0
  214. package/dist/runtime/generative-ui/surface-writer.mjs +84 -0
  215. package/dist/runtime/generative-ui/surface-writer.mjs.map +1 -0
  216. package/dist/runtime/handlers/get-runtime-info.cjs +140 -0
  217. package/dist/runtime/handlers/get-runtime-info.cjs.map +1 -0
  218. package/dist/runtime/handlers/get-runtime-info.mjs +140 -0
  219. package/dist/runtime/handlers/get-runtime-info.mjs.map +1 -0
  220. package/dist/runtime/handlers/handle-connect.cjs +62 -0
  221. package/dist/runtime/handlers/handle-connect.cjs.map +1 -0
  222. package/dist/runtime/handlers/handle-connect.mjs +62 -0
  223. package/dist/runtime/handlers/handle-connect.mjs.map +1 -0
  224. package/dist/runtime/handlers/handle-debug-events.cjs +33 -0
  225. package/dist/runtime/handlers/handle-debug-events.cjs.map +1 -0
  226. package/dist/runtime/handlers/handle-debug-events.mjs +33 -0
  227. package/dist/runtime/handlers/handle-debug-events.mjs.map +1 -0
  228. package/dist/runtime/handlers/handle-inspector-learning.cjs +56 -0
  229. package/dist/runtime/handlers/handle-inspector-learning.cjs.map +1 -0
  230. package/dist/runtime/handlers/handle-inspector-learning.mjs +55 -0
  231. package/dist/runtime/handlers/handle-inspector-learning.mjs.map +1 -0
  232. package/dist/runtime/handlers/handle-inspector-metadata.cjs +36 -0
  233. package/dist/runtime/handlers/handle-inspector-metadata.cjs.map +1 -0
  234. package/dist/runtime/handlers/handle-inspector-metadata.mjs +35 -0
  235. package/dist/runtime/handlers/handle-inspector-metadata.mjs.map +1 -0
  236. package/dist/runtime/handlers/handle-run.cjs +111 -0
  237. package/dist/runtime/handlers/handle-run.cjs.map +1 -0
  238. package/dist/runtime/handlers/handle-run.mjs +110 -0
  239. package/dist/runtime/handlers/handle-run.mjs.map +1 -0
  240. package/dist/runtime/handlers/handle-stop.cjs +102 -0
  241. package/dist/runtime/handlers/handle-stop.cjs.map +1 -0
  242. package/dist/runtime/handlers/handle-stop.mjs +101 -0
  243. package/dist/runtime/handlers/handle-stop.mjs.map +1 -0
  244. package/dist/runtime/handlers/handle-suggest.cjs +83 -0
  245. package/dist/runtime/handlers/handle-suggest.cjs.map +1 -0
  246. package/dist/runtime/handlers/handle-suggest.mjs +82 -0
  247. package/dist/runtime/handlers/handle-suggest.mjs.map +1 -0
  248. package/dist/runtime/handlers/handle-trajectory-connect.cjs +40 -0
  249. package/dist/runtime/handlers/handle-trajectory-connect.cjs.map +1 -0
  250. package/dist/runtime/handlers/handle-trajectory-connect.mjs +39 -0
  251. package/dist/runtime/handlers/handle-trajectory-connect.mjs.map +1 -0
  252. package/dist/runtime/handlers/handle-transcribe.cjs +112 -0
  253. package/dist/runtime/handlers/handle-transcribe.cjs.map +1 -0
  254. package/dist/runtime/handlers/handle-transcribe.mjs +111 -0
  255. package/dist/runtime/handlers/handle-transcribe.mjs.map +1 -0
  256. package/dist/runtime/handlers/header-utils.cjs +185 -0
  257. package/dist/runtime/handlers/header-utils.cjs.map +1 -0
  258. package/dist/runtime/handlers/header-utils.d.cts +53 -0
  259. package/dist/runtime/handlers/header-utils.d.cts.map +1 -0
  260. package/dist/runtime/handlers/header-utils.d.mts +53 -0
  261. package/dist/runtime/handlers/header-utils.d.mts.map +1 -0
  262. package/dist/runtime/handlers/header-utils.mjs +183 -0
  263. package/dist/runtime/handlers/header-utils.mjs.map +1 -0
  264. package/dist/runtime/handlers/intelligence/annotate.cjs +83 -0
  265. package/dist/runtime/handlers/intelligence/annotate.cjs.map +1 -0
  266. package/dist/runtime/handlers/intelligence/annotate.mjs +82 -0
  267. package/dist/runtime/handlers/intelligence/annotate.mjs.map +1 -0
  268. package/dist/runtime/handlers/intelligence/connect.cjs +68 -0
  269. package/dist/runtime/handlers/intelligence/connect.cjs.map +1 -0
  270. package/dist/runtime/handlers/intelligence/connect.mjs +68 -0
  271. package/dist/runtime/handlers/intelligence/connect.mjs.map +1 -0
  272. package/dist/runtime/handlers/intelligence/memories.cjs +260 -0
  273. package/dist/runtime/handlers/intelligence/memories.cjs.map +1 -0
  274. package/dist/runtime/handlers/intelligence/memories.mjs +254 -0
  275. package/dist/runtime/handlers/intelligence/memories.mjs.map +1 -0
  276. package/dist/runtime/handlers/intelligence/run.cjs +283 -0
  277. package/dist/runtime/handlers/intelligence/run.cjs.map +1 -0
  278. package/dist/runtime/handlers/intelligence/run.mjs +282 -0
  279. package/dist/runtime/handlers/intelligence/run.mjs.map +1 -0
  280. package/dist/runtime/handlers/intelligence/thread-names.cjs +172 -0
  281. package/dist/runtime/handlers/intelligence/thread-names.cjs.map +1 -0
  282. package/dist/runtime/handlers/intelligence/thread-names.mjs +171 -0
  283. package/dist/runtime/handlers/intelligence/thread-names.mjs.map +1 -0
  284. package/dist/runtime/handlers/intelligence/threads.cjs +399 -0
  285. package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -0
  286. package/dist/runtime/handlers/intelligence/threads.mjs +390 -0
  287. package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -0
  288. package/dist/runtime/handlers/shared/agent-utils.cjs +267 -0
  289. package/dist/runtime/handlers/shared/agent-utils.cjs.map +1 -0
  290. package/dist/runtime/handlers/shared/agent-utils.mjs +262 -0
  291. package/dist/runtime/handlers/shared/agent-utils.mjs.map +1 -0
  292. package/dist/runtime/handlers/shared/cloud-telemetry.cjs +30 -0
  293. package/dist/runtime/handlers/shared/cloud-telemetry.cjs.map +1 -0
  294. package/dist/runtime/handlers/shared/cloud-telemetry.mjs +29 -0
  295. package/dist/runtime/handlers/shared/cloud-telemetry.mjs.map +1 -0
  296. package/dist/runtime/handlers/shared/describe-endpoint.cjs +25 -0
  297. package/dist/runtime/handlers/shared/describe-endpoint.cjs.map +1 -0
  298. package/dist/runtime/handlers/shared/describe-endpoint.mjs +24 -0
  299. package/dist/runtime/handlers/shared/describe-endpoint.mjs.map +1 -0
  300. package/dist/runtime/handlers/shared/intelligence-utils.cjs +24 -0
  301. package/dist/runtime/handlers/shared/intelligence-utils.cjs.map +1 -0
  302. package/dist/runtime/handlers/shared/intelligence-utils.mjs +23 -0
  303. package/dist/runtime/handlers/shared/intelligence-utils.mjs.map +1 -0
  304. package/dist/runtime/handlers/shared/json-response.cjs +14 -0
  305. package/dist/runtime/handlers/shared/json-response.cjs.map +1 -0
  306. package/dist/runtime/handlers/shared/json-response.mjs +12 -0
  307. package/dist/runtime/handlers/shared/json-response.mjs.map +1 -0
  308. package/dist/runtime/handlers/shared/mcp-apps-servers.cjs +22 -0
  309. package/dist/runtime/handlers/shared/mcp-apps-servers.cjs.map +1 -0
  310. package/dist/runtime/handlers/shared/mcp-apps-servers.mjs +22 -0
  311. package/dist/runtime/handlers/shared/mcp-apps-servers.mjs.map +1 -0
  312. package/dist/runtime/handlers/shared/memory-policy.cjs +78 -0
  313. package/dist/runtime/handlers/shared/memory-policy.cjs.map +1 -0
  314. package/dist/runtime/handlers/shared/memory-policy.mjs +77 -0
  315. package/dist/runtime/handlers/shared/memory-policy.mjs.map +1 -0
  316. package/dist/runtime/handlers/shared/platform-error.cjs +39 -0
  317. package/dist/runtime/handlers/shared/platform-error.cjs.map +1 -0
  318. package/dist/runtime/handlers/shared/platform-error.mjs +39 -0
  319. package/dist/runtime/handlers/shared/platform-error.mjs.map +1 -0
  320. package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs +50 -0
  321. package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -0
  322. package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs +49 -0
  323. package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -0
  324. package/dist/runtime/handlers/shared/sse-keep-alive.cjs +68 -0
  325. package/dist/runtime/handlers/shared/sse-keep-alive.cjs.map +1 -0
  326. package/dist/runtime/handlers/shared/sse-keep-alive.mjs +66 -0
  327. package/dist/runtime/handlers/shared/sse-keep-alive.mjs.map +1 -0
  328. package/dist/runtime/handlers/shared/sse-response.cjs +237 -0
  329. package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -0
  330. package/dist/runtime/handlers/shared/sse-response.mjs +236 -0
  331. package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -0
  332. package/dist/runtime/handlers/shared/thread-access.cjs +137 -0
  333. package/dist/runtime/handlers/shared/thread-access.cjs.map +1 -0
  334. package/dist/runtime/handlers/shared/thread-access.d.cts +28 -0
  335. package/dist/runtime/handlers/shared/thread-access.d.cts.map +1 -0
  336. package/dist/runtime/handlers/shared/thread-access.d.mts +28 -0
  337. package/dist/runtime/handlers/shared/thread-access.d.mts.map +1 -0
  338. package/dist/runtime/handlers/shared/thread-access.mjs +132 -0
  339. package/dist/runtime/handlers/shared/thread-access.mjs.map +1 -0
  340. package/dist/runtime/handlers/sse/connect.cjs +23 -0
  341. package/dist/runtime/handlers/sse/connect.cjs.map +1 -0
  342. package/dist/runtime/handlers/sse/connect.mjs +23 -0
  343. package/dist/runtime/handlers/sse/connect.mjs.map +1 -0
  344. package/dist/runtime/handlers/sse/run.cjs +44 -0
  345. package/dist/runtime/handlers/sse/run.cjs.map +1 -0
  346. package/dist/runtime/handlers/sse/run.mjs +44 -0
  347. package/dist/runtime/handlers/sse/run.mjs.map +1 -0
  348. package/dist/runtime/index.d.cts +29 -0
  349. package/dist/runtime/index.d.cts.map +1 -0
  350. package/dist/runtime/index.d.mts +29 -0
  351. package/dist/runtime/index.d.mts.map +1 -0
  352. package/dist/runtime/intelligence-platform/client.cjs +1338 -0
  353. package/dist/runtime/intelligence-platform/client.cjs.map +1 -0
  354. package/dist/runtime/intelligence-platform/client.d.cts +824 -0
  355. package/dist/runtime/intelligence-platform/client.d.cts.map +1 -0
  356. package/dist/runtime/intelligence-platform/client.d.mts +824 -0
  357. package/dist/runtime/intelligence-platform/client.d.mts.map +1 -0
  358. package/dist/runtime/intelligence-platform/client.mjs +1334 -0
  359. package/dist/runtime/intelligence-platform/client.mjs.map +1 -0
  360. package/dist/runtime/intelligence-platform/experimental.d.cts +26 -0
  361. package/dist/runtime/intelligence-platform/experimental.d.cts.map +1 -0
  362. package/dist/runtime/intelligence-platform/experimental.d.mts +26 -0
  363. package/dist/runtime/intelligence-platform/experimental.d.mts.map +1 -0
  364. package/dist/runtime/intelligence-platform/index.d.cts +3 -0
  365. package/dist/runtime/intelligence-platform/index.d.mts +3 -0
  366. package/dist/runtime/intelligence-platform/learned-skills.cjs +95 -0
  367. package/dist/runtime/intelligence-platform/learned-skills.cjs.map +1 -0
  368. package/dist/runtime/intelligence-platform/learned-skills.d.cts +43 -0
  369. package/dist/runtime/intelligence-platform/learned-skills.d.cts.map +1 -0
  370. package/dist/runtime/intelligence-platform/learned-skills.d.mts +43 -0
  371. package/dist/runtime/intelligence-platform/learned-skills.d.mts.map +1 -0
  372. package/dist/runtime/intelligence-platform/learned-skills.mjs +92 -0
  373. package/dist/runtime/intelligence-platform/learned-skills.mjs.map +1 -0
  374. package/dist/runtime/intelligence-platform/learning-management.cjs +203 -0
  375. package/dist/runtime/intelligence-platform/learning-management.cjs.map +1 -0
  376. package/dist/runtime/intelligence-platform/learning-management.d.cts +111 -0
  377. package/dist/runtime/intelligence-platform/learning-management.d.cts.map +1 -0
  378. package/dist/runtime/intelligence-platform/learning-management.d.mts +111 -0
  379. package/dist/runtime/intelligence-platform/learning-management.d.mts.map +1 -0
  380. package/dist/runtime/intelligence-platform/learning-management.mjs +193 -0
  381. package/dist/runtime/intelligence-platform/learning-management.mjs.map +1 -0
  382. package/dist/runtime/intelligence-platform/skill-registry/archive.cjs +131 -0
  383. package/dist/runtime/intelligence-platform/skill-registry/archive.cjs.map +1 -0
  384. package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts +10 -0
  385. package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts.map +1 -0
  386. package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts +10 -0
  387. package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts.map +1 -0
  388. package/dist/runtime/intelligence-platform/skill-registry/archive.mjs +127 -0
  389. package/dist/runtime/intelligence-platform/skill-registry/archive.mjs.map +1 -0
  390. package/dist/runtime/intelligence-platform/skill-registry/config.cjs +65 -0
  391. package/dist/runtime/intelligence-platform/skill-registry/config.cjs.map +1 -0
  392. package/dist/runtime/intelligence-platform/skill-registry/config.d.cts +47 -0
  393. package/dist/runtime/intelligence-platform/skill-registry/config.d.cts.map +1 -0
  394. package/dist/runtime/intelligence-platform/skill-registry/config.d.mts +47 -0
  395. package/dist/runtime/intelligence-platform/skill-registry/config.d.mts.map +1 -0
  396. package/dist/runtime/intelligence-platform/skill-registry/config.mjs +65 -0
  397. package/dist/runtime/intelligence-platform/skill-registry/config.mjs.map +1 -0
  398. package/dist/runtime/intelligence-platform/skill-registry/errors.cjs +10 -0
  399. package/dist/runtime/intelligence-platform/skill-registry/errors.cjs.map +1 -0
  400. package/dist/runtime/intelligence-platform/skill-registry/errors.d.cts +7 -0
  401. package/dist/runtime/intelligence-platform/skill-registry/errors.d.cts.map +1 -0
  402. package/dist/runtime/intelligence-platform/skill-registry/errors.d.mts +7 -0
  403. package/dist/runtime/intelligence-platform/skill-registry/errors.d.mts.map +1 -0
  404. package/dist/runtime/intelligence-platform/skill-registry/errors.mjs +10 -0
  405. package/dist/runtime/intelligence-platform/skill-registry/errors.mjs.map +1 -0
  406. package/dist/runtime/intelligence-platform/skill-registry/index.d.cts +7 -0
  407. package/dist/runtime/intelligence-platform/skill-registry/index.d.mts +7 -0
  408. package/dist/runtime/intelligence-platform/skill-registry/registry.cjs +247 -0
  409. package/dist/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -0
  410. package/dist/runtime/intelligence-platform/skill-registry/registry.d.cts +36 -0
  411. package/dist/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -0
  412. package/dist/runtime/intelligence-platform/skill-registry/registry.d.mts +36 -0
  413. package/dist/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -0
  414. package/dist/runtime/intelligence-platform/skill-registry/registry.mjs +246 -0
  415. package/dist/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -0
  416. package/dist/runtime/intelligence-platform/skill-registry/skill-content.cjs +41 -0
  417. package/dist/runtime/intelligence-platform/skill-registry/skill-content.cjs.map +1 -0
  418. package/dist/runtime/intelligence-platform/skill-registry/skill-content.d.cts +12 -0
  419. package/dist/runtime/intelligence-platform/skill-registry/skill-content.d.cts.map +1 -0
  420. package/dist/runtime/intelligence-platform/skill-registry/skill-content.d.mts +12 -0
  421. package/dist/runtime/intelligence-platform/skill-registry/skill-content.d.mts.map +1 -0
  422. package/dist/runtime/intelligence-platform/skill-registry/skill-content.mjs +38 -0
  423. package/dist/runtime/intelligence-platform/skill-registry/skill-content.mjs.map +1 -0
  424. package/dist/runtime/intelligence-platform/skill-registry/snapshot.cjs +92 -0
  425. package/dist/runtime/intelligence-platform/skill-registry/snapshot.cjs.map +1 -0
  426. package/dist/runtime/intelligence-platform/skill-registry/snapshot.d.cts +27 -0
  427. package/dist/runtime/intelligence-platform/skill-registry/snapshot.d.cts.map +1 -0
  428. package/dist/runtime/intelligence-platform/skill-registry/snapshot.d.mts +27 -0
  429. package/dist/runtime/intelligence-platform/skill-registry/snapshot.d.mts.map +1 -0
  430. package/dist/runtime/intelligence-platform/skill-registry/snapshot.mjs +91 -0
  431. package/dist/runtime/intelligence-platform/skill-registry/snapshot.mjs.map +1 -0
  432. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs +142 -0
  433. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs.map +1 -0
  434. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs +141 -0
  435. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs.map +1 -0
  436. package/dist/runtime/intelligence-platform/trajectories.cjs +95 -0
  437. package/dist/runtime/intelligence-platform/trajectories.cjs.map +1 -0
  438. package/dist/runtime/intelligence-platform/trajectories.d.cts +11 -0
  439. package/dist/runtime/intelligence-platform/trajectories.d.cts.map +1 -0
  440. package/dist/runtime/intelligence-platform/trajectories.d.mts +11 -0
  441. package/dist/runtime/intelligence-platform/trajectories.d.mts.map +1 -0
  442. package/dist/runtime/intelligence-platform/trajectories.mjs +91 -0
  443. package/dist/runtime/intelligence-platform/trajectories.mjs.map +1 -0
  444. package/dist/runtime/node.d.cts +2 -0
  445. package/dist/runtime/node.d.mts +2 -0
  446. package/dist/runtime/runner/agent-runner.cjs +82 -0
  447. package/dist/runtime/runner/agent-runner.cjs.map +1 -0
  448. package/dist/runtime/runner/agent-runner.d.cts +151 -0
  449. package/dist/runtime/runner/agent-runner.d.cts.map +1 -0
  450. package/dist/runtime/runner/agent-runner.d.mts +151 -0
  451. package/dist/runtime/runner/agent-runner.d.mts.map +1 -0
  452. package/dist/runtime/runner/agent-runner.mjs +73 -0
  453. package/dist/runtime/runner/agent-runner.mjs.map +1 -0
  454. package/dist/runtime/runner/in-memory.cjs +741 -0
  455. package/dist/runtime/runner/in-memory.cjs.map +1 -0
  456. package/dist/runtime/runner/in-memory.d.cts +427 -0
  457. package/dist/runtime/runner/in-memory.d.cts.map +1 -0
  458. package/dist/runtime/runner/in-memory.d.mts +427 -0
  459. package/dist/runtime/runner/in-memory.d.mts.map +1 -0
  460. package/dist/runtime/runner/in-memory.mjs +734 -0
  461. package/dist/runtime/runner/in-memory.mjs.map +1 -0
  462. package/dist/runtime/runner/index.d.cts +5 -0
  463. package/dist/runtime/runner/index.d.mts +5 -0
  464. package/dist/runtime/runner/index.mjs +6 -0
  465. package/dist/runtime/runner/intelligence.cjs +617 -0
  466. package/dist/runtime/runner/intelligence.cjs.map +1 -0
  467. package/dist/runtime/runner/intelligence.d.cts +104 -0
  468. package/dist/runtime/runner/intelligence.d.cts.map +1 -0
  469. package/dist/runtime/runner/intelligence.d.mts +104 -0
  470. package/dist/runtime/runner/intelligence.d.mts.map +1 -0
  471. package/dist/runtime/runner/intelligence.mjs +616 -0
  472. package/dist/runtime/runner/intelligence.mjs.map +1 -0
  473. package/dist/runtime/telemetry/disclosure.cjs +25 -0
  474. package/dist/runtime/telemetry/disclosure.cjs.map +1 -0
  475. package/dist/runtime/telemetry/disclosure.mjs +24 -0
  476. package/dist/runtime/telemetry/disclosure.mjs.map +1 -0
  477. package/dist/runtime/telemetry/events.d.cts +66 -0
  478. package/dist/runtime/telemetry/events.d.cts.map +1 -0
  479. package/dist/runtime/telemetry/events.d.mts +66 -0
  480. package/dist/runtime/telemetry/events.d.mts.map +1 -0
  481. package/dist/runtime/telemetry/instance-created.cjs +34 -0
  482. package/dist/runtime/telemetry/instance-created.cjs.map +1 -0
  483. package/dist/runtime/telemetry/instance-created.mjs +34 -0
  484. package/dist/runtime/telemetry/instance-created.mjs.map +1 -0
  485. package/dist/runtime/telemetry/telemetry-client.cjs +108 -0
  486. package/dist/runtime/telemetry/telemetry-client.cjs.map +1 -0
  487. package/dist/runtime/telemetry/telemetry-client.d.cts +10 -0
  488. package/dist/runtime/telemetry/telemetry-client.d.cts.map +1 -0
  489. package/dist/runtime/telemetry/telemetry-client.d.mts +10 -0
  490. package/dist/runtime/telemetry/telemetry-client.d.mts.map +1 -0
  491. package/dist/runtime/telemetry/telemetry-client.mjs +107 -0
  492. package/dist/runtime/telemetry/telemetry-client.mjs.map +1 -0
  493. package/dist/runtime/telemetry/telemetry-identity.cjs +12 -0
  494. package/dist/runtime/telemetry/telemetry-identity.cjs.map +1 -0
  495. package/dist/runtime/telemetry/telemetry-identity.mjs +11 -0
  496. package/dist/runtime/telemetry/telemetry-identity.mjs.map +1 -0
  497. package/dist/runtime/transcription-service/transcription-service.cjs +7 -0
  498. package/dist/runtime/transcription-service/transcription-service.cjs.map +1 -0
  499. package/dist/runtime/transcription-service/transcription-service.d.cts +14 -0
  500. package/dist/runtime/transcription-service/transcription-service.d.cts.map +1 -0
  501. package/dist/runtime/transcription-service/transcription-service.d.mts +14 -0
  502. package/dist/runtime/transcription-service/transcription-service.d.mts.map +1 -0
  503. package/dist/runtime/transcription-service/transcription-service.mjs +6 -0
  504. package/dist/runtime/transcription-service/transcription-service.mjs.map +1 -0
  505. package/package.json +104 -105
  506. package/.eslintrc.js +0 -7
  507. package/CHANGELOG.md +0 -2920
  508. package/__snapshots__/schema/schema.graphql +0 -371
  509. package/dist/index.d.ts +0 -1494
  510. package/dist/index.js +0 -5641
  511. package/dist/index.js.map +0 -1
  512. package/dist/index.mjs.map +0 -1
  513. package/dist/langgraph.d.ts +0 -284
  514. package/dist/langgraph.js +0 -211
  515. package/dist/langgraph.js.map +0 -1
  516. package/dist/langgraph.mjs +0 -206
  517. package/dist/langgraph.mjs.map +0 -1
  518. package/dist/v2/index.d.ts +0 -2
  519. package/dist/v2/index.js +0 -22
  520. package/dist/v2/index.js.map +0 -1
  521. package/dist/v2/index.mjs +0 -5
  522. package/dist/v2/index.mjs.map +0 -1
  523. package/jest.config.js +0 -10
  524. package/scripts/generate-gql-schema.ts +0 -13
  525. package/src/agents/langgraph/event-source.ts +0 -329
  526. package/src/agents/langgraph/events.ts +0 -377
  527. package/src/graphql/inputs/action.input.ts +0 -16
  528. package/src/graphql/inputs/agent-session.input.ts +0 -13
  529. package/src/graphql/inputs/agent-state.input.ts +0 -13
  530. package/src/graphql/inputs/cloud-guardrails.input.ts +0 -16
  531. package/src/graphql/inputs/cloud.input.ts +0 -8
  532. package/src/graphql/inputs/context-property.input.ts +0 -10
  533. package/src/graphql/inputs/copilot-context.input.ts +0 -10
  534. package/src/graphql/inputs/custom-property.input.ts +0 -15
  535. package/src/graphql/inputs/extensions.input.ts +0 -21
  536. package/src/graphql/inputs/forwarded-parameters.input.ts +0 -22
  537. package/src/graphql/inputs/frontend.input.ts +0 -14
  538. package/src/graphql/inputs/generate-copilot-response.input.ts +0 -59
  539. package/src/graphql/inputs/load-agent-state.input.ts +0 -10
  540. package/src/graphql/inputs/message.input.ts +0 -110
  541. package/src/graphql/inputs/meta-event.input.ts +0 -18
  542. package/src/graphql/message-conversion/agui-to-gql.test.ts +0 -1263
  543. package/src/graphql/message-conversion/agui-to-gql.ts +0 -333
  544. package/src/graphql/message-conversion/gql-to-agui.test.ts +0 -1580
  545. package/src/graphql/message-conversion/gql-to-agui.ts +0 -278
  546. package/src/graphql/message-conversion/index.ts +0 -2
  547. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +0 -526
  548. package/src/graphql/resolvers/copilot.resolver.ts +0 -708
  549. package/src/graphql/resolvers/state.resolver.ts +0 -27
  550. package/src/graphql/types/agents-response.type.ts +0 -19
  551. package/src/graphql/types/base/index.ts +0 -10
  552. package/src/graphql/types/converted/index.ts +0 -176
  553. package/src/graphql/types/copilot-response.type.ts +0 -138
  554. package/src/graphql/types/enums.ts +0 -38
  555. package/src/graphql/types/extensions-response.type.ts +0 -23
  556. package/src/graphql/types/guardrails-result.type.ts +0 -20
  557. package/src/graphql/types/load-agent-state-response.type.ts +0 -17
  558. package/src/graphql/types/message-status.type.ts +0 -42
  559. package/src/graphql/types/meta-events.type.ts +0 -71
  560. package/src/graphql/types/response-status.type.ts +0 -66
  561. package/src/index.ts +0 -4
  562. package/src/langgraph.ts +0 -1
  563. package/src/lib/cloud/index.ts +0 -4
  564. package/src/lib/error-messages.ts +0 -200
  565. package/src/lib/index.ts +0 -52
  566. package/src/lib/integrations/index.ts +0 -6
  567. package/src/lib/integrations/nest/index.ts +0 -14
  568. package/src/lib/integrations/nextjs/app-router.ts +0 -38
  569. package/src/lib/integrations/nextjs/pages-router.ts +0 -39
  570. package/src/lib/integrations/node-express/index.ts +0 -14
  571. package/src/lib/integrations/node-http/index.ts +0 -143
  572. package/src/lib/integrations/node-http/request-handler.ts +0 -111
  573. package/src/lib/integrations/shared.ts +0 -161
  574. package/src/lib/logger.ts +0 -28
  575. package/src/lib/observability.ts +0 -160
  576. package/src/lib/runtime/__tests__/copilot-runtime-error.test.ts +0 -169
  577. package/src/lib/runtime/__tests__/mcp-tools-utils.test.ts +0 -464
  578. package/src/lib/runtime/agent-integrations/langgraph/agent.ts +0 -209
  579. package/src/lib/runtime/agent-integrations/langgraph/consts.ts +0 -34
  580. package/src/lib/runtime/agent-integrations/langgraph/index.ts +0 -2
  581. package/src/lib/runtime/copilot-runtime.ts +0 -710
  582. package/src/lib/runtime/mcp-tools-utils.ts +0 -254
  583. package/src/lib/runtime/retry-utils.ts +0 -96
  584. package/src/lib/runtime/telemetry-agent-runner.ts +0 -139
  585. package/src/lib/runtime/types.ts +0 -49
  586. package/src/lib/runtime/utils.ts +0 -87
  587. package/src/lib/streaming.ts +0 -202
  588. package/src/lib/telemetry-client.ts +0 -64
  589. package/src/service-adapters/anthropic/anthropic-adapter.ts +0 -452
  590. package/src/service-adapters/anthropic/utils.ts +0 -152
  591. package/src/service-adapters/bedrock/bedrock-adapter.ts +0 -73
  592. package/src/service-adapters/conversion.ts +0 -67
  593. package/src/service-adapters/empty/empty-adapter.ts +0 -38
  594. package/src/service-adapters/events.ts +0 -294
  595. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +0 -84
  596. package/src/service-adapters/google/google-genai-adapter.test.ts +0 -104
  597. package/src/service-adapters/google/google-genai-adapter.ts +0 -88
  598. package/src/service-adapters/groq/groq-adapter.ts +0 -203
  599. package/src/service-adapters/index.ts +0 -18
  600. package/src/service-adapters/langchain/langchain-adapter.ts +0 -111
  601. package/src/service-adapters/langchain/langserve.ts +0 -88
  602. package/src/service-adapters/langchain/types.ts +0 -14
  603. package/src/service-adapters/langchain/utils.ts +0 -313
  604. package/src/service-adapters/openai/openai-adapter.ts +0 -283
  605. package/src/service-adapters/openai/openai-assistant-adapter.ts +0 -344
  606. package/src/service-adapters/openai/utils.ts +0 -199
  607. package/src/service-adapters/service-adapter.ts +0 -41
  608. package/src/service-adapters/shared/error-utils.ts +0 -61
  609. package/src/service-adapters/shared/index.ts +0 -1
  610. package/src/service-adapters/unify/unify-adapter.ts +0 -151
  611. package/src/utils/failed-response-status-reasons.ts +0 -70
  612. package/src/utils/index.ts +0 -1
  613. package/src/v2/index.ts +0 -3
  614. package/tests/global.d.ts +0 -13
  615. package/tests/service-adapters/anthropic/allowlist-approach.test.ts +0 -226
  616. package/tests/service-adapters/anthropic/anthropic-adapter.test.ts +0 -389
  617. package/tests/service-adapters/openai/allowlist-approach.test.ts +0 -238
  618. package/tests/service-adapters/openai/openai-adapter.test.ts +0 -301
  619. package/tests/setup.jest.ts +0 -21
  620. package/tests/tsconfig.json +0 -10
  621. package/tsconfig.json +0 -13
  622. package/tsup.config.ts +0 -20
  623. package/typedoc.json +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-download.mjs","names":["readBody"],"sources":["../../src/agent/url-download.ts"],"sourcesContent":["/**\n * Server-side download of URL attachments (image/file parts) for BuiltInAgent.\n *\n * The AI SDK downloads any URL attachment that the model cannot take as a URL\n * and puts the bytes into the prompt. The URL comes from the request, so the\n * default downloader lets a caller make the server fetch internal addresses.\n * The AI SDK's own check rejects literal private IPs and the names\n * `localhost`, `*.local` and `*.localhost`, but it compares the literal text\n * and never resolves DNS: a hostname that resolves to a private address, or a\n * spelling such as `localhost.`, gets through.\n *\n * This downloader:\n * - leaves `data:` URLs to the AI SDK, which decodes them without a fetch;\n * - accepts only http and https URLs without credentials;\n * - resolves the hostname and rejects any non-public address;\n * - connects only to the addresses it checked (no second DNS lookup);\n * - checks every redirect target the same way, and refuses https to http;\n * - limits the size and time of each download, and the number and total\n * size of the downloads for one model call;\n * - stops when the run is aborted (BuiltInAgent, or the `signal` given to\n * `createSafeUrlDownload`), or when another download of the same call fails.\n *\n * The client gets the same message whether a host did not resolve or resolved\n * to a non-public address, and the reason is only logged on the server. Two\n * residual signals are accepted: the time to fail can differ between the two\n * cases, and a DNS lookup that hangs (for example in an internal zone) ends\n * with the timeout message instead.\n */\nimport type * as DnsPromises from \"node:dns/promises\";\nimport type * as Http from \"node:http\";\nimport type { IncomingMessage } from \"node:http\";\nimport type * as Https from \"node:https\";\nimport type * as Net from \"node:net\";\nimport type { LookupAddress } from \"node:dns\";\nimport type { LookupFunction } from \"node:net\";\nimport { COPILOTKIT_VERSION } from \"@copilotkit/shared\";\nimport { DownloadError } from \"ai\";\nimport type { Experimental_DownloadFunction as DownloadFunction } from \"ai\";\n\n/** Options for the default, public-network-only URL downloader. */\nexport interface SafeUrlDownloadOptions {\n /**\n * Hostnames that may be downloaded. When omitted, any hostname is allowed.\n * Every resolved address must be public in both cases, and every redirect\n * target must match as well.\n *\n * - `cdn.example.com` matches exactly that host.\n * - `*.example.com` matches any subdomain (`a.example.com`,\n * `a.b.example.com`) but not `example.com` itself; list both if needed.\n *\n * Matching ignores case and a trailing dot. Unicode names match their\n * punycode form, and an IPv6 address may be given with or without\n * brackets. An entry with a scheme, port, path or user, and a wildcard over\n * an IP address (`*.1.2.3.4`), are rejected when the downloader is created.\n * An empty list refuses every server-side download; `data:` URLs and URLs\n * that the model takes directly are not downloaded, so they still pass.\n */\n allowedHosts?: string[];\n /** Largest response body to accept, in bytes (at least 1). Default: 20 MiB. */\n maxBytes?: number;\n /**\n * Time limit for one download, including redirects, in ms. From 1 to\n * 2147483647 (the largest delay `setTimeout` supports). Default: 30000.\n */\n timeoutMs?: number;\n /** Largest number of redirects to follow; 0 follows none. Default: 3. */\n maxRedirects?: number;\n /**\n * Largest number of distinct URLs to download for one model call (at\n * least 1); a URL that appears twice is downloaded once. The AI SDK\n * downloads the attachments of every user message again for each step of\n * a multi-step run. Default: 20.\n */\n maxDownloads?: number;\n /**\n * Largest number of bytes to download for one model call, over all its\n * URLs (at least 1). Default: 50 MiB.\n */\n maxTotalBytes?: number;\n}\n\n/** @internal Test seams. Not part of the public API. */\nexport interface UrlDownloadInternals {\n resolveHost?: (hostname: string) => Promise<LookupAddress[]>;\n /**\n * Replaces the address policy. It has the shape of the exported\n * {@link isPublicAddress}; an async answer is awaited.\n */\n isPublicAddress?: (address: string) => boolean | Promise<boolean>;\n /** CA certificates to trust for https instead of the default ones. */\n ca?: string;\n}\n\nconst DEFAULT_MAX_BYTES = 20 * 1024 * 1024;\nconst DEFAULT_TIMEOUT_MS = 30_000;\nconst DEFAULT_MAX_REDIRECTS = 3;\nconst DEFAULT_MAX_DOWNLOADS = 20;\nconst DEFAULT_MAX_TOTAL_BYTES = 50 * 1024 * 1024;\n// One message for both cases, so that the error does not reveal whether an\n// internal name exists. The reason is logged on the server only. (A lookup\n// that hangs ends with the timeout message instead; see the file header.)\nconst HOST_REFUSED =\n \"The URL host is not a public address, or it could not be resolved.\";\n// For a network, TLS or response stream error. The cause, which can name a\n// resolved address, is only logged.\nconst DOWNLOAD_FAILED = \"The download failed.\";\nconst USER_AGENT = `CopilotKit-Runtime/${COPILOTKIT_VERSION}`;\nconst REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);\n\ntype NodeModules = {\n dns: typeof DnsPromises;\n http: typeof Http;\n https: typeof Https;\n net: typeof Net;\n};\n\nlet nodeModules: Promise<NodeModules> | undefined;\n\n// Loaded on first use so that importing the agent does not require Node\n// networking modules. Where they are not available (for example on an edge\n// runtime), downloads fail closed and the log says how to configure them.\nfunction loadNodeModules(): Promise<NodeModules> {\n nodeModules ??= Promise.all([\n import(\"node:dns/promises\"),\n import(\"node:http\"),\n import(\"node:https\"),\n import(\"node:net\"),\n ])\n .then(([dns, http, https, net]) => ({ dns, http, https, net }))\n .catch((error: unknown) => {\n // Try again on the next download instead of failing forever.\n nodeModules = undefined;\n throw error;\n });\n return nodeModules;\n}\n\ntype AddressPolicy = (address: string) => boolean;\nlet defaultPolicy: AddressPolicy | undefined;\n\nfunction buildAddressPolicy(net: NodeModules[\"net\"]): AddressPolicy {\n const nonPublicV4 = new net.BlockList();\n for (const [address, prefix] of [\n [\"0.0.0.0\", 8],\n [\"10.0.0.0\", 8],\n [\"100.64.0.0\", 10], // Carrier-grade NAT.\n [\"127.0.0.0\", 8],\n [\"169.254.0.0\", 16], // Link-local, including cloud metadata.\n [\"172.16.0.0\", 12],\n [\"192.0.0.0\", 24],\n [\"192.0.2.0\", 24],\n [\"192.88.99.0\", 24],\n [\"192.168.0.0\", 16],\n [\"198.18.0.0\", 15],\n [\"198.51.100.0\", 24],\n [\"203.0.113.0\", 24],\n [\"224.0.0.0\", 4],\n [\"240.0.0.0\", 4],\n ] as const) {\n nonPublicV4.addSubnet(address, prefix, \"ipv4\");\n }\n\n // Only global unicast IPv6 (2000::/3) is public. This also rejects ::1,\n // fc00::/7, fe80::/10, IPv4-mapped (::ffff:0:0/96) and NAT64 (64:ff9b::/96).\n const globalV6 = new net.BlockList();\n globalV6.addSubnet(\"2000::\", 3, \"ipv6\");\n const nonPublicV6 = new net.BlockList();\n for (const [address, prefix] of [\n // IANA special-purpose block, including Teredo (2001::/32). A few ranges\n // inside it are globally reachable (for example AS112, 2001:4:112::/48);\n // the whole /23 is refused on purpose, failing closed.\n [\"2001::\", 23],\n [\"2001:db8::\", 32], // Documentation.\n [\"2002::\", 16], // 6to4.\n [\"3fff::\", 20], // Documentation.\n ] as const) {\n nonPublicV6.addSubnet(address, prefix, \"ipv6\");\n }\n\n return (address) => {\n const family = net.isIP(address);\n if (family === 4) return !nonPublicV4.check(address, \"ipv4\");\n if (family !== 6 || address.includes(\"%\")) return false;\n return (\n globalV6.check(address, \"ipv6\") && !nonPublicV6.check(address, \"ipv6\")\n );\n };\n}\n\n/** Returns true only for a public unicast IPv4 or IPv6 address. */\nexport async function isPublicAddress(address: string): Promise<boolean> {\n const { net } = await loadNodeModules();\n defaultPolicy ??= buildAddressPolicy(net);\n return defaultPolicy(address);\n}\n\n/**\n * True when the server must not fetch this URL itself and returns `null` so\n * the AI SDK handles it: the provider takes the URL as-is, or it is a `data:`\n * URL, which the AI SDK decodes locally without any network request.\n */\nfunction leftToAiSdk({\n url,\n isUrlSupportedByModel,\n}: {\n url: URL;\n isUrlSupportedByModel: boolean;\n}): boolean {\n return isUrlSupportedByModel || url.protocol === \"data:\";\n}\n\n/** The URL without its query and fragment, which can hold credentials. */\nfunction urlForLog(url: URL | string): string {\n try {\n const parsed = new URL(String(url));\n return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;\n } catch {\n return \"(invalid URL)\";\n }\n}\n\n/** `text` with the query and fragment removed from every URL in it. */\nfunction redactUrls(text: string): string {\n return text.replace(\n /\\b([a-z][a-z0-9+.-]*:\\/\\/[^\\s?#\"'`<>]*)[?#][^\\s\"'`<>]*/gi,\n \"$1\",\n );\n}\n\n// Errors that this module has already logged, so that BuiltInAgent's model\n// call error handler does not log them a second time.\nconst loggedErrors = new WeakSet<object>();\n\n/**\n * Returns the error for a failed or refused download and logs it on the\n * server. `detail` goes only to the log: the client sees `message`, which\n * never holds the URL's query, a resolved address or a raw network error.\n * For a refused host, `message` is the same whether the name did not resolve\n * or resolved to a non-public address, so that it does not reveal internal\n * DNS names.\n */\nfunction refuse(\n url: URL | string,\n message: string,\n detail?: string,\n statusCode?: number,\n): DownloadError {\n console.warn(\n redactUrls(\n `[BuiltInAgent] URL download failed for ${urlForLog(url)}: ${message}${detail ? ` (${detail})` : \"\"}`,\n ),\n );\n const error = new DownloadError({ url: urlForLog(url), message, statusCode });\n loggedErrors.add(error);\n return error;\n}\n\n/**\n * @internal BuiltInAgent's `onError` for its `streamText` call. The AI SDK's\n * default handler prints the whole error, which for a download error holds\n * the URL with its query. This logs an error once, with the same detail\n * (for a provider API error, its status code and response body) but with the\n * query and fragment removed from every URL, and skips the download errors\n * that were already logged here.\n */\nexport function logModelCallError(error: unknown): void {\n if (typeof error === \"object\" && error !== null && loggedErrors.has(error)) {\n return;\n }\n const frames =\n error instanceof Error && error.stack\n ? error.stack\n .split(\"\\n\")\n .filter((line) => /^\\s+at /.test(line))\n .join(\"\\n\")\n : \"\";\n console.error(\n redactUrls(\n `[BuiltInAgent] The model call failed: ${describeModelError(error)}${frames ? `\\n${frames}` : \"\"}`,\n ),\n );\n}\n\n// Longest text logged for one field of a model call error. A field such as\n// `requestBodyValues` can hold the whole prompt.\nconst MAX_LOGGED_FIELD_LENGTH = 2000;\n\nfunction truncateForLog(text: string): string {\n return text.length > MAX_LOGGED_FIELD_LENGTH\n ? `${text.slice(0, MAX_LOGGED_FIELD_LENGTH)}… (${text.length} characters)`\n : text;\n}\n\n/**\n * {@link describeError}, followed by the other fields of the error, such as\n * the `statusCode`, `responseBody` and `url` of the AI SDK's APICallError. A\n * value that is not an Error, such as the plain object that a provider\n * stream sends as its error, is logged as JSON.\n */\nfunction describeModelError(error: unknown): string {\n if (!(error instanceof Error)) return truncateForLog(describeValue(error));\n const fields = Object.entries(error)\n .filter(\n ([key]) => ![\"name\", \"message\", \"stack\", \"cause\", \"code\"].includes(key),\n )\n .map(([key, value]) => {\n const text =\n value instanceof Error\n ? describeError(value)\n : typeof value === \"string\"\n ? value\n : describeValue(value);\n return `${key}: ${truncateForLog(text)}`;\n });\n const name = error.name && error.name !== \"Error\" ? `${error.name}: ` : \"\";\n return `${name}${describeError(error)}${fields.length > 0 ? ` {${fields.join(\"; \")}}` : \"\"}`;\n}\n\n/** Message, error code and causes of an error, for the server log. */\nfunction describeError(error: unknown, depth = 0): string {\n if (typeof error === \"string\") return error;\n if (!(error instanceof Error)) return truncateForLog(describeValue(error));\n const code = (error as { code?: unknown }).code;\n const text =\n typeof code === \"string\" && !error.message.includes(code)\n ? `${code}: ${error.message}`\n : error.message;\n return error.cause !== undefined && depth < 3\n ? `${text}; caused by ${describeError(error.cause, depth + 1)}`\n : text;\n}\n\n/**\n * A printable form of a configuration value for an error message. Unlike\n * `JSON.stringify`, it never throws (BigInt) and never gives `undefined`\n * (Symbol, function).\n */\nfunction describeValue(value: unknown): string {\n if (typeof value === \"bigint\") return `${value}n`;\n if (typeof value === \"function\") return \"a function\";\n try {\n const text = JSON.stringify(value);\n if (text !== undefined) return text;\n } catch {\n // Not serializable, for example a cycle or a nested BigInt.\n }\n try {\n return String(value);\n } catch {\n return Object.prototype.toString.call(value);\n }\n}\n\n/**\n * The form in which hostnames are compared: a URL hostname (lowercase ASCII,\n * IDNA as punycode, IPv6 in canonical form) without IPv6 brackets and without\n * one trailing dot.\n */\nfunction comparableHost(hostname: string): string {\n return hostname.replace(/^\\[(.*)\\]$/, \"$1\").replace(/\\.$/, \"\");\n}\n\n/**\n * Validates one `allowedHosts` entry and returns it in comparable form: an\n * exact host, or `*.` followed by a host suffix.\n */\nfunction normalizeAllowedHost(entry: unknown): string {\n const invalid = (reason: string) =>\n new Error(\n `urlDownload.allowedHosts entry ${describeValue(entry)} is invalid: ${reason}`,\n );\n if (typeof entry !== \"string\" || entry === \"\") {\n throw invalid(\"it must be a non-empty hostname\");\n }\n if (/[\\s/?#@\\\\]/.test(entry)) {\n throw invalid(\"give only a hostname, without a scheme, path or user\");\n }\n const wildcard = entry.startsWith(\"*.\");\n const host = wildcard ? entry.slice(2) : entry;\n if (host === \"\" || host === \".\" || host.includes(\"*\")) {\n throw invalid('\"*\" is allowed only as a leading \"*.\" label');\n }\n // `host:port` (one \":\" and no brackets) or `[ipv6]:port`. An IPv6 address\n // without brackets always has at least two \":\".\n if (/^[^:[\\]]*:\\d*$/.test(host) || /^\\[.*\\]:\\d*$/.test(host)) {\n throw invalid(\"give only a hostname, without a port\");\n }\n const bare = host.replace(/^\\[(.*)\\]$/, \"$1\");\n // Any \":\" left belongs to an IPv6 address, which the URL parser needs in\n // brackets.\n const authority = bare.includes(\":\") ? `[${bare}]` : host;\n let parsed: URL;\n try {\n parsed = new URL(`http://${authority}/`);\n } catch {\n throw invalid(\"it is not a valid hostname\");\n }\n const normalized = comparableHost(parsed.hostname);\n // The URL parser turns a name whose last label is a number into an IPv4\n // address (`*.0.1` becomes `0.0.0.1`), and no hostname can end in one.\n if (\n wildcard &&\n (normalized.includes(\":\") || /^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(normalized))\n ) {\n throw invalid(\"a wildcard needs a hostname suffix, not an IP address\");\n }\n return (wildcard ? \"*.\" : \"\") + normalized;\n}\n\nfunction normalizeAllowedHosts(entries: unknown): string[] | undefined {\n if (entries === undefined) return undefined;\n if (!Array.isArray(entries)) {\n throw new Error(\"urlDownload.allowedHosts must be an array of hostnames\");\n }\n return entries.map(normalizeAllowedHost);\n}\n\nfunction hostAllowed(hostname: string, allowedHosts?: string[]): boolean {\n if (!allowedHosts) return true;\n const host = comparableHost(hostname);\n return allowedHosts.some((pattern) =>\n pattern.startsWith(\"*.\")\n ? host.endsWith(pattern.slice(1)) && host.length > pattern.length - 1\n : host === pattern,\n );\n}\n\nfunction checkUrl(url: URL, allowedHosts?: string[]): void {\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n throw refuse(url, \"Only http and https URLs can be downloaded.\");\n }\n if (url.username !== \"\" || url.password !== \"\") {\n throw refuse(url, \"URLs with credentials cannot be downloaded.\");\n }\n if (!hostAllowed(url.hostname, allowedHosts)) {\n throw refuse(url, \"The URL host is not in the allowed hosts list.\");\n }\n}\n\n/**\n * Waits for `work`, or rejects with the abort reason when `signal` aborts.\n * The handlers are attached to `work` first, so that a later rejection of\n * `work` is always handled: an unhandled rejection ends a Node process in\n * the default mode.\n */\nfunction withDeadline<T>(work: Promise<T>, signal: AbortSignal): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const onAbort = () => reject(signal.reason);\n work.then(resolve, reject).finally(() => {\n signal.removeEventListener(\"abort\", onAbort);\n });\n if (signal.aborted) return onAbort();\n signal.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n\nasync function requestPinned(\n modules: NodeModules,\n url: URL,\n addresses: LookupAddress[],\n signal: AbortSignal,\n ca: string | undefined,\n): Promise<IncomingMessage> {\n // Answer the socket's lookup with the checked addresses only, so a second\n // DNS answer (DNS rebinding) can never pick the destination.\n const lookup: LookupFunction = (_hostname, options, callback) => {\n const wanted = typeof options === \"number\" ? options : options?.family;\n const available =\n wanted === 4 || wanted === 6\n ? addresses.filter((a) => a.family === wanted)\n : addresses;\n if (available.length === 0) {\n callback(\n refuse(url, \"No checked address is available for this URL.\"),\n \"\",\n 4,\n );\n } else if (typeof options === \"object\" && options?.all) {\n callback(null, available);\n } else {\n callback(null, available[0]!.address, available[0]!.family);\n }\n };\n const isHttps = url.protocol === \"https:\";\n const transport = isHttps ? modules.https : modules.http;\n // A new agent per request: no pooled socket and no proxy can bypass the\n // pinned lookup.\n const agent = isHttps\n ? new modules.https.Agent({ keepAlive: false, maxCachedSessions: 0 })\n : new modules.http.Agent({ keepAlive: false });\n const hostname = url.hostname.replace(/^\\[|\\]$/g, \"\");\n\n return new Promise<IncomingMessage>((resolve, reject) => {\n const request = transport.request(\n {\n protocol: url.protocol,\n hostname,\n // SNI must not carry the trailing dot of a fully qualified name.\n servername:\n isHttps && modules.net.isIP(hostname) === 0\n ? hostname.replace(/\\.$/, \"\")\n : undefined,\n port: url.port || (isHttps ? 443 : 80),\n path: url.pathname + url.search,\n method: \"GET\",\n // Some hosts refuse a request without a User-Agent.\n headers: { \"accept-encoding\": \"identity\", \"user-agent\": USER_AGENT },\n lookup,\n agent,\n signal,\n ...(isHttps && ca !== undefined ? { ca } : {}),\n },\n (response) => {\n response.once(\"close\", () => agent.destroy());\n resolve(response);\n },\n );\n // `on`, not `once`: an error after the first one (for example from the\n // socket while it is torn down) must not go unhandled. Rejecting twice\n // is harmless.\n request.on(\"error\", (error) => {\n agent.destroy();\n reject(error);\n });\n request.once(\"upgrade\", (_response, socket) => {\n socket.destroy();\n agent.destroy();\n reject(refuse(url, \"Protocol upgrade refused.\"));\n });\n request.end();\n });\n}\n\n/**\n * Bytes still allowed for all the downloads of one model call, the current\n * one included. Shared by them and decreased as their bodies stream in.\n */\ntype ByteBudget = { remaining: number; readonly limit: number };\n\ntype ResolvedOptions = {\n allowedHosts: string[] | undefined;\n maxBytes: number;\n timeoutMs: number;\n maxRedirects: number;\n maxDownloads: number;\n maxTotalBytes: number;\n};\n\nasync function readBody(\n url: URL,\n response: IncomingMessage,\n maxBytes: number,\n budget: ByteBudget,\n): Promise<Uint8Array> {\n const tooLarge = () =>\n refuse(url, `The response is larger than the ${maxBytes}-byte limit.`);\n const overBudget = () =>\n refuse(\n url,\n `The downloads are larger than the ${budget.limit}-byte total limit.`,\n );\n const declared = Number(response.headers[\"content-length\"]);\n if (Number.isFinite(declared) && declared > maxBytes) throw tooLarge();\n if (Number.isFinite(declared) && declared > budget.remaining) {\n throw overBudget();\n }\n const encoding = response.headers[\"content-encoding\"];\n if (encoding && encoding !== \"identity\") {\n throw refuse(url, \"Compressed responses are not accepted.\");\n }\n const chunks: Buffer[] = [];\n let total = 0;\n for await (const chunk of response) {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n total += buffer.byteLength;\n if (total > maxBytes) throw tooLarge();\n budget.remaining -= buffer.byteLength;\n if (budget.remaining < 0) throw overBudget();\n chunks.push(buffer);\n }\n return new Uint8Array(Buffer.concat(chunks, total));\n}\n\nasync function downloadOne(\n original: URL,\n options: ResolvedOptions,\n internals: UrlDownloadInternals,\n outer: AbortSignal,\n budget: ByteBudget,\n): Promise<{ data: Uint8Array; mediaType: string | undefined }> {\n const modules = await loadNodeModules().catch((error: unknown) => {\n throw refuse(\n original,\n \"URL download needs Node.js networking modules, which are not available here.\",\n `loading them failed: ${describeError(error)}. On a runtime without them, set urlDownload to \"disabled\" or to your own download function`,\n );\n });\n defaultPolicy ??= buildAddressPolicy(modules.net);\n const isPublic = internals.isPublicAddress ?? defaultPolicy;\n const resolveHost =\n internals.resolveHost ??\n ((hostname: string) =>\n modules.dns.lookup(hostname, { all: true, verbatim: true }));\n\n // The URL of the current hop, so that a timeout names the hop that hung.\n let url = original;\n const controller = new AbortController();\n const timer = setTimeout(\n () =>\n controller.abort(\n refuse(\n url,\n `The download timed out after ${options.timeoutMs} ms (timeoutMs).`,\n ),\n ),\n options.timeoutMs,\n );\n // The run was aborted, or another download in the same call failed.\n const onOuterAbort = () => controller.abort(outer.reason);\n if (outer.aborted) onOuterAbort();\n else outer.addEventListener(\"abort\", onOuterAbort, { once: true });\n const { signal } = controller;\n try {\n for (let hop = 0; ; hop++) {\n // An aborted download does nothing more, not even a DNS query for a\n // name that the request chose.\n signal.throwIfAborted();\n checkUrl(url, options.allowedHosts);\n const hostname = url.hostname.replace(/^\\[|\\]$/g, \"\");\n const literalFamily = modules.net.isIP(hostname);\n let addresses: LookupAddress[];\n try {\n signal.throwIfAborted();\n addresses = literalFamily\n ? [{ address: hostname, family: literalFamily }]\n : await withDeadline(resolveHost(hostname), signal);\n } catch (error) {\n if (signal.aborted) throw signal.reason;\n throw refuse(\n url,\n HOST_REFUSED,\n `DNS lookup failed: ${describeError(error)}`,\n );\n }\n const verdicts = await Promise.all(\n addresses.map(\n async ({ address, family }) =>\n (family === 4 || family === 6) &&\n (await isPublic(address)) === true,\n ),\n );\n const rejected = addresses.filter((_address, i) => !verdicts[i]);\n if (addresses.length === 0 || rejected.length > 0) {\n throw refuse(\n url,\n HOST_REFUSED,\n addresses.length === 0\n ? \"DNS lookup returned no addresses\"\n : `non-public address: ${rejected.map((a) => a.address).join(\", \")}`,\n );\n }\n\n let response: IncomingMessage;\n try {\n response = await requestPinned(\n modules,\n url,\n addresses,\n signal,\n internals.ca,\n );\n } catch (error) {\n if (signal.aborted) throw signal.reason;\n if (DownloadError.isInstance(error)) throw error;\n throw refuse(url, DOWNLOAD_FAILED, describeError(error));\n }\n try {\n const status = response.statusCode ?? 0;\n if (REDIRECT_STATUSES.has(status)) {\n if (hop >= options.maxRedirects) {\n throw refuse(\n url,\n `Too many redirects: the limit is ${options.maxRedirects} (maxRedirects).`,\n );\n }\n const location = response.headers.location;\n if (!location) throw refuse(url, \"Redirect without a location.\");\n let next: URL;\n try {\n next = new URL(location, url);\n } catch (error) {\n throw refuse(\n url,\n \"Redirect to an invalid URL.\",\n `Location ${JSON.stringify(location.slice(0, 200))}: ${describeError(error)}`,\n );\n }\n // Bytes fetched over plain http could be changed in transit.\n if (url.protocol === \"https:\" && next.protocol === \"http:\") {\n throw refuse(url, \"A redirect from https to http is refused.\");\n }\n url = next;\n continue;\n }\n if (status < 200 || status >= 300) {\n throw refuse(\n url,\n `The server answered with HTTP status ${status}.`,\n response.statusMessage,\n status,\n );\n }\n const data = await readBody(url, response, options.maxBytes, budget);\n const contentType = response.headers[\"content-type\"];\n return { data, mediaType: contentType || undefined };\n } catch (error) {\n if (signal.aborted) throw signal.reason;\n if (DownloadError.isInstance(error)) throw error;\n throw refuse(url, DOWNLOAD_FAILED, describeError(error));\n } finally {\n response.destroy();\n }\n }\n } finally {\n clearTimeout(timer);\n outer.removeEventListener(\"abort\", onOuterAbort);\n controller.abort();\n }\n}\n\n// setTimeout clamps a longer delay to 1 ms, so a larger limit would end every\n// download at once.\nconst MAX_TIMEOUT_MS = 2_147_483_647;\n\n/** Returns `value` (or `fallback`) if it is an integer from `min` to `max`. */\nfunction integerOption(\n name: string,\n value: number | undefined,\n fallback: number,\n min: number,\n max = Number.MAX_SAFE_INTEGER,\n): number {\n const result = value ?? fallback;\n if (!Number.isSafeInteger(result) || result < min || result > max) {\n const range =\n max === Number.MAX_SAFE_INTEGER\n ? `an integer of at least ${min}`\n : `an integer from ${min} to ${max}`;\n throw new Error(\n `urlDownload.${name} must be ${range}, got ${describeValue(value)}`,\n );\n }\n return result;\n}\n\n// Every option name, so that a mistyped name fails instead of being ignored:\n// a mistyped `allowedHosts` would otherwise allow every public host.\nconst OPTION_NAMES: Record<keyof SafeUrlDownloadOptions, true> = {\n allowedHosts: true,\n maxBytes: true,\n timeoutMs: true,\n maxRedirects: true,\n maxDownloads: true,\n maxTotalBytes: true,\n};\n\nfunction checkOptionsObject(options: unknown): asserts options is object {\n if (\n typeof options !== \"object\" ||\n options === null ||\n Array.isArray(options)\n ) {\n throw new Error(\n `urlDownload options must be an object, got ${describeValue(options)}`,\n );\n }\n}\n\nfunction checkOptionNames(options: unknown): void {\n checkOptionsObject(options);\n for (const name of Object.keys(options)) {\n if (!Object.prototype.hasOwnProperty.call(OPTION_NAMES, name)) {\n throw new Error(\n `urlDownload has an unknown option ${describeValue(name)}; the valid options are ${Object.keys(OPTION_NAMES).join(\", \")}`,\n );\n }\n }\n}\n\n/** A download function that can also be tied to a run's abort signal. */\nexport type GuardedUrlDownload = DownloadFunction & {\n /** The same download function, aborted when `signal` aborts. */\n forRun(signal: AbortSignal): DownloadFunction;\n};\n\n/** @internal Factory with test seams; use {@link createSafeUrlDownload}. */\nexport function createGuardedUrlDownload(\n options: SafeUrlDownloadOptions = {},\n internals: UrlDownloadInternals = {},\n): GuardedUrlDownload {\n checkOptionNames(options);\n const resolved: ResolvedOptions = {\n allowedHosts: normalizeAllowedHosts(options.allowedHosts),\n maxBytes: integerOption(\"maxBytes\", options.maxBytes, DEFAULT_MAX_BYTES, 1),\n timeoutMs: integerOption(\n \"timeoutMs\",\n options.timeoutMs,\n DEFAULT_TIMEOUT_MS,\n 1,\n MAX_TIMEOUT_MS,\n ),\n maxRedirects: integerOption(\n \"maxRedirects\",\n options.maxRedirects,\n DEFAULT_MAX_REDIRECTS,\n 0,\n ),\n maxDownloads: integerOption(\n \"maxDownloads\",\n options.maxDownloads,\n DEFAULT_MAX_DOWNLOADS,\n 1,\n ),\n maxTotalBytes: integerOption(\n \"maxTotalBytes\",\n options.maxTotalBytes,\n DEFAULT_MAX_TOTAL_BYTES,\n 1,\n ),\n };\n const downloadAll = async (\n requests: Parameters<DownloadFunction>[0],\n runSignal?: AbortSignal,\n ) => {\n // Aborted when the run aborts, or when one download fails, so that the\n // other downloads in this call stop as well.\n const batch = new AbortController();\n const onRunAbort = () => batch.abort(runSignal?.reason);\n if (runSignal?.aborted) onRunAbort();\n else runSignal?.addEventListener(\"abort\", onRunAbort, { once: true });\n try {\n // One download per distinct URL; duplicates share its result.\n const pending = new Map<string, URL>();\n for (const request of requests) {\n if (!leftToAiSdk(request)) pending.set(request.url.href, request.url);\n }\n if (pending.size > resolved.maxDownloads) {\n throw refuse(\n [...pending.values()][resolved.maxDownloads]!,\n `A model call can have at most ${resolved.maxDownloads} URL downloads; this one has ${pending.size}.`,\n );\n }\n const budget: ByteBudget = {\n remaining: resolved.maxTotalBytes,\n limit: resolved.maxTotalBytes,\n };\n const downloads = new Map(\n [...pending].map(([href, url]) => [\n href,\n downloadOne(url, resolved, internals, batch.signal, budget).catch(\n (error: unknown) => {\n batch.abort(error);\n throw error;\n },\n ),\n ]),\n );\n return await Promise.all(\n requests.map((request) =>\n leftToAiSdk(request) ? null : downloads.get(request.url.href)!,\n ),\n );\n } finally {\n runSignal?.removeEventListener(\"abort\", onRunAbort);\n batch.abort();\n }\n };\n return Object.assign(\n (requests: Parameters<DownloadFunction>[0]) => downloadAll(requests),\n {\n forRun:\n (signal: AbortSignal): DownloadFunction =>\n (requests) =>\n downloadAll(requests, signal),\n },\n );\n}\n\n/**\n * @internal Resolves BuiltInAgent's `urlDownload` setting once, so that an\n * invalid setting fails when the agent is constructed. The result gives the\n * download function for one run; the default downloader stops when the run\n * is aborted.\n */\nexport function resolveUrlDownloadSetting(\n setting:\n | \"disabled\"\n | SafeUrlDownloadOptions\n | DownloadFunction\n | null\n | undefined,\n): (runSignal: AbortSignal) => DownloadFunction {\n if (setting === \"disabled\") return () => disabledUrlDownload;\n if (typeof setting === \"function\") return () => setting;\n if (setting === undefined || setting === null) {\n return createGuardedUrlDownload().forRun;\n }\n if (typeof setting === \"object\" && !Array.isArray(setting)) {\n return createGuardedUrlDownload(setting).forRun;\n }\n throw new Error(\n `urlDownload must be \"disabled\", an options object or a download function, got ${describeValue(setting)}`,\n );\n}\n\n/** Options for {@link createSafeUrlDownload}. */\nexport interface CreateSafeUrlDownloadOptions extends SafeUrlDownloadOptions {\n /**\n * Stops every download of this function when it aborts, for example the\n * run's `ctx.abortSignal` in BuiltInAgent's factory mode. Without it, a\n * download that is running when the run is aborted goes on until it ends\n * or reaches `timeoutMs`.\n */\n signal?: AbortSignal;\n}\n\n/**\n * Creates an AI SDK download function (`experimental_download`) that only\n * fetches public internet addresses, with the same checks and limits as\n * BuiltInAgent's default downloader. Pass it to `streamText` yourself when\n * you use BuiltInAgent's AI SDK factory mode. Create it in the factory with\n * the run's abort signal, so that an aborted run stops its downloads:\n *\n * ```ts\n * import { createSafeUrlDownload } from \"@copilotkit/runtime\";\n *\n * factory: (ctx) =>\n * streamText({\n * model,\n * messages,\n * abortSignal: ctx.abortSignal,\n * experimental_download: createSafeUrlDownload({ signal: ctx.abortSignal }),\n * }),\n * ```\n *\n * Invalid options throw here, when the function is created.\n */\nexport function createSafeUrlDownload(\n options: CreateSafeUrlDownloadOptions = {},\n): DownloadFunction {\n checkOptionsObject(options);\n const { signal, ...downloadOptions } = options;\n if (signal !== undefined && !(signal instanceof AbortSignal)) {\n throw new Error(\n `urlDownload signal must be an AbortSignal, got ${describeValue(signal)}`,\n );\n }\n const download = createGuardedUrlDownload(downloadOptions);\n return signal ? download.forRun(signal) : download;\n}\n\n/**\n * A download function that never fetches from the network. URLs that the\n * model takes as-is and `data:` URLs are left to the AI SDK; any other URL,\n * whatever its scheme, fails the run.\n */\nexport const disabledUrlDownload: DownloadFunction = async (requests) =>\n requests.map((request) => {\n if (leftToAiSdk(request)) return null;\n throw refuse(\n request.url,\n 'Server-side URL download is disabled (urlDownload: \"disabled\").',\n );\n });\n"],"mappings":";;;;AA6FA,MAAM,oBAAoB,KAAK,OAAO;AACtC,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,0BAA0B,KAAK,OAAO;AAI5C,MAAM,eACJ;AAGF,MAAM,kBAAkB;AACxB,MAAM,aAAa,sBAAsB;AACzC,MAAM,oBAAoB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAK;CAAI,CAAC;AAS5D,IAAI;AAKJ,SAAS,kBAAwC;AAC/C,iBAAgB,QAAQ,IAAI;EAC1B,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACR,CAAC,CACC,MAAM,CAAC,K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C,KAAI,OAAO,YAAY,WAAY,cAAa;AAChD,KAAI,YAAY,UAAa,YAAY,KACvC,QAAO,0BAA0B,CAAC;AAEpC,KAAI,OAAO,YAAY,YAAY,CAAC,MAAM,QAAQ,QAAQ,CACxD,QAAO,yBAAyB,QAAQ,CAAC;AAE3C,OAAM,IAAI,MACR,iFAAiF,cAAc,QAAQ,GACxG;;;;;;;;;;;;;;;;;;;;;;;AAmCH,SAAgB,sBACd,UAAwC,EAAE,EACxB;AAClB,oBAAmB,QAAQ;CAC3B,MAAM,EAAE,QAAQ,GAAG,oBAAoB;AACvC,KAAI,WAAW,UAAa,EAAE,kBAAkB,aAC9C,OAAM,IAAI,MACR,kDAAkD,cAAc,OAAO,GACxE;CAEH,MAAM,WAAW,yBAAyB,gBAAgB;AAC1D,QAAO,SAAS,SAAS,OAAO,OAAO,GAAG;;;;;;;AAQ5C,MAAa,sBAAwC,OAAO,aAC1D,SAAS,KAAK,YAAY;AACxB,KAAI,YAAY,QAAQ,CAAE,QAAO;AACjC,OAAM,OACJ,QAAQ,KACR,oEACD;EACD"}
package/dist/index.cjs ADDED
@@ -0,0 +1,75 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_agent_runner = require('./runtime/runner/agent-runner.cjs');
4
+ const require_learned_skills = require('./runtime/intelligence-platform/learned-skills.cjs');
5
+ const require_client = require('./runtime/intelligence-platform/client.cjs');
6
+ const require_in_memory = require('./runtime/runner/in-memory.cjs');
7
+ const require_intelligence = require('./runtime/runner/intelligence.cjs');
8
+ const require_runtime$1 = require('./runtime/core/runtime.cjs');
9
+ const require_generative_ui_middleware = require('./runtime/generative-ui/generative-ui-middleware.cjs');
10
+ const require_surface_writer = require('./runtime/generative-ui/surface-writer.cjs');
11
+ const require_transcription_service = require('./runtime/transcription-service/transcription-service.cjs');
12
+ const require_fetch_handler = require('./runtime/core/fetch-handler.cjs');
13
+ const require_url_download = require('./agent/url-download.cjs');
14
+ const require_aisdk = require('./agent/converters/aisdk.cjs');
15
+ const require_tanstack = require('./agent/converters/tanstack.cjs');
16
+ const require_index = require('./agent/index.cjs');
17
+ let _copilotkit_shared = require("@copilotkit/shared");
18
+
19
+ exports.AgentRunner = require_agent_runner.AgentRunner;
20
+ exports.BasicAgent = require_index.BasicAgent;
21
+ exports.BuiltInAgent = require_index.BuiltInAgent;
22
+ exports.CopilotIntelligenceRuntime = require_runtime$1.CopilotIntelligenceRuntime;
23
+ exports.CopilotKitIntelligence = require_client.CopilotKitIntelligence;
24
+ exports.CopilotRuntime = require_runtime$1.CopilotRuntime;
25
+ exports.CopilotSseRuntime = require_runtime$1.CopilotSseRuntime;
26
+ exports.GenerativeUIMiddleware = require_generative_ui_middleware.GenerativeUIMiddleware;
27
+ exports.InMemoryAgentRunner = require_in_memory.InMemoryAgentRunner;
28
+ exports.IntelligenceAgentRunner = require_intelligence.IntelligenceAgentRunner;
29
+ exports.InterruptSignal = require_index.InterruptSignal;
30
+ exports.LearnedSkillsError = require_learned_skills.LearnedSkillsError;
31
+ exports.PlatformRequestError = require_client.PlatformRequestError;
32
+ exports.THREAD_ACCESS_DENIED_ERROR_CODE = require_agent_runner.THREAD_ACCESS_DENIED_ERROR_CODE;
33
+ exports.ThreadAccessDeniedError = require_agent_runner.ThreadAccessDeniedError;
34
+ exports.ThreadAlreadyRunningError = require_agent_runner.ThreadAlreadyRunningError;
35
+ exports.TranscriptionService = require_transcription_service.TranscriptionService;
36
+ exports.VERSION = require_runtime$1.VERSION;
37
+ exports.classifyModelSpec = require_index.classifyModelSpec;
38
+ exports.convertAISDKStream = require_aisdk.convertAISDKStream;
39
+ exports.convertInputToTanStackAI = require_tanstack.convertInputToTanStackAI;
40
+ exports.convertJsonSchemaToZodSchema = require_index.convertJsonSchemaToZodSchema;
41
+ exports.convertMessagesToVercelAISDKMessages = require_index.convertMessagesToVercelAISDKMessages;
42
+ exports.convertTanStackStream = require_tanstack.convertTanStackStream;
43
+ exports.convertToolDefinitionsToVercelAITools = require_index.convertToolDefinitionsToVercelAITools;
44
+ exports.convertToolsToVercelAITools = require_index.convertToolsToVercelAITools;
45
+ exports.createCopilotRuntimeHandler = require_fetch_handler.createCopilotRuntimeHandler;
46
+ Object.defineProperty(exports, 'createRunEventFinalizer', {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _copilotkit_shared.createRunEventFinalizer;
50
+ }
51
+ });
52
+ exports.createSafeUrlDownload = require_url_download.createSafeUrlDownload;
53
+ exports.createSurfaceWriter = require_surface_writer.createSurfaceWriter;
54
+ exports.defineTool = require_index.defineTool;
55
+ exports.enforcesThreadOwnership = require_agent_runner.enforcesThreadOwnership;
56
+ Object.defineProperty(exports, 'finalizeRunEvents', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return _copilotkit_shared.finalizeRunEvents;
60
+ }
61
+ });
62
+ exports.isA2UIEnabled = require_runtime$1.isA2UIEnabled;
63
+ exports.isIntelligenceRuntime = require_runtime$1.isIntelligenceRuntime;
64
+ exports.isThreadAccessDeniedError = require_agent_runner.isThreadAccessDeniedError;
65
+ exports.resolveAgents = require_runtime$1.resolveAgents;
66
+ exports.resolveModel = require_index.resolveModel;
67
+ exports.supportsLocalThreadEndpoints = require_agent_runner.supportsLocalThreadEndpoints;
68
+ exports.ɵBoundedThreadStore = require_in_memory.ɵBoundedThreadStore;
69
+ exports.ɵGLOBAL_STORE = require_in_memory.ɵGLOBAL_STORE;
70
+ exports.ɵINMEMORY_DEFAULTS = require_in_memory.ɵINMEMORY_DEFAULTS;
71
+ exports.ɵOWNER_RETENTION_DEFAULTS = require_in_memory.ɵOWNER_RETENTION_DEFAULTS;
72
+ exports.ɵSERVER_THREAD_OWNER = require_agent_runner.ɵSERVER_THREAD_OWNER;
73
+ exports.ɵestimateBytes = require_in_memory.ɵestimateBytes;
74
+ exports.ɵnormalizeLimits = require_in_memory.ɵnormalizeLimits;
75
+ exports.ɵresolveThreadOwner = require_agent_runner.ɵresolveThreadOwner;
@@ -0,0 +1,24 @@
1
+ import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, LocalThreadEndpointScope, THREAD_ACCESS_DENIED_ERROR_CODE, ThreadAccessDeniedError, ThreadAlreadyRunningError, ThreadOwnershipRunner, enforcesThreadOwnership, isThreadAccessDeniedError, supportsLocalThreadEndpoints, ɵSERVER_THREAD_OWNER, ɵresolveThreadOwner } from "./runtime/runner/agent-runner.cjs";
2
+ import { ThreadAccessMode, ThreadsConfig } from "./runtime/handlers/shared/thread-access.cjs";
3
+ import { TranscribeFileOptions, TranscriptionService } from "./runtime/transcription-service/transcription-service.cjs";
4
+ import { experimental_d_exports } from "./runtime/intelligence-platform/experimental.cjs";
5
+ import { CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeUser, GetLearningContainerId, GetTrajectoryLearningContainerIds, LearningContainerSelectorInput, TrajectoryLearningContainerSelectorInput } from "./runtime/core/learning.cjs";
6
+ import { GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult } from "./runtime/intelligence-platform/learned-skills.cjs";
7
+ import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, PlatformRequestError, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./runtime/intelligence-platform/client.cjs";
8
+ import { AgentFactoryContext, AgentsConfig, AgentsFactory, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeLike, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, OpenGenerativeUIConfig, OpenGenerativeUIOptions, RuntimeWithDeclaredChannels, VERSION, isA2UIEnabled, isIntelligenceRuntime, resolveAgents } from "./runtime/core/runtime.cjs";
9
+ import { GenerativeUIMiddleware } from "./runtime/generative-ui/generative-ui-middleware.cjs";
10
+ import { GenerativeUISurfaceWriter, createSurfaceWriter } from "./runtime/generative-ui/surface-writer.cjs";
11
+ import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵestimateBytes, ɵnormalizeLimits } from "./runtime/runner/in-memory.cjs";
12
+ import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary } from "./runtime/runner/intelligence.cjs";
13
+ import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./runtime/runner/index.cjs";
14
+ import { ChannelStatus, ChannelsControl } from "./runtime/core/channel-manager.cjs";
15
+ import { CopilotRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./runtime/core/hooks.cjs";
16
+ import { CopilotCorsConfig } from "./runtime/core/fetch-cors.cjs";
17
+ import { CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, createCopilotRuntimeHandler } from "./runtime/core/fetch-handler.cjs";
18
+ import { CopilotKitRequestHandler, MCPClient, MCPTransport } from "./runtime/index.cjs";
19
+ import { CreateSafeUrlDownloadOptions, SafeUrlDownloadOptions, createSafeUrlDownload } from "./agent/url-download.cjs";
20
+ import { BuiltInAgentLearnedSkills, BuiltInAgentLearnedSkillsOptions } from "./agent/learned-skills.cjs";
21
+ import { convertAISDKStream } from "./agent/converters/aisdk.cjs";
22
+ import { TanStackChatMessage, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./agent/converters/tanstack.cjs";
23
+ import { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentFactoryContext, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, classifyModelSpec, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel } from "./agent/index.cjs";
24
+ export { type AgentFactoryContext, AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, AgentsConfig, AgentsFactory, BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentFactoryContext, BuiltInAgentLearnedSkills, BuiltInAgentLearnedSkillsOptions, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, ChannelStatus, ChannelsControl, CopilotCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, CopilotKitIntelligenceConfig, CopilotKitRequestHandler, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, CopilotRuntimeHooks, CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeLike, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, CreateSafeUrlDownloadOptions, CreateThreadRequest, ErrorHookContext, FinalizeRunOptions, GenerativeUIMiddleware, GenerativeUISurfaceWriter, GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, GetLearningContainerId, GetTrajectoryLearningContainerIds, HandlerHookContext, HookContext, IdentifyUserCallback, InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, InterruptSignal, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult, LearningContainerSelectorInput, ListThreadsResponse, LocalThreadEndpointRecord, LocalThreadEndpointRunner, LocalThreadEndpointScope, MCPClient, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MCPTransport, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, MessageConversionOptions, ModelSpecifier, OpenGenerativeUIConfig, OpenGenerativeUIOptions, OverridableProperty, PlatformRequestError, ResponseHookContext, RouteInfo, RunEventFinalizer, RunnerStartupBoundary, RuntimeWithDeclaredChannels, SafeUrlDownloadOptions, SubscribeToThreadsRequest, SubscribeToThreadsResponse, THREAD_ACCESS_DENIED_ERROR_CODE, TanStackChatMessage, TanStackInputResult, ThreadAccessDeniedError, ThreadAccessMode, ThreadAlreadyRunningError, ThreadOwnershipRunner, ThreadSummary, ThreadsConfig, ToolDefinition, TrajectoryLearningContainerSelectorInput, TranscribeFileOptions, TranscriptionService, UpdateThreadRequest, VERSION, classifyModelSpec, convertAISDKStream, convertInputToTanStackAI, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertTanStackStream, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, createCopilotRuntimeHandler, createRunEventFinalizer, createSafeUrlDownload, createSurfaceWriter, defineTool, enforcesThreadOwnership, experimental_d_exports as experimental, finalizeRunEvents, isA2UIEnabled, isIntelligenceRuntime, isThreadAccessDeniedError, resolveAgents, resolveModel, supportsLocalThreadEndpoints, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵSERVER_THREAD_OWNER, ɵestimateBytes, ɵnormalizeLimits, ɵresolveThreadOwner };
@@ -0,0 +1,24 @@
1
+ import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, LocalThreadEndpointScope, THREAD_ACCESS_DENIED_ERROR_CODE, ThreadAccessDeniedError, ThreadAlreadyRunningError, ThreadOwnershipRunner, enforcesThreadOwnership, isThreadAccessDeniedError, supportsLocalThreadEndpoints, ɵSERVER_THREAD_OWNER, ɵresolveThreadOwner } from "./runtime/runner/agent-runner.mjs";
2
+ import { ThreadAccessMode, ThreadsConfig } from "./runtime/handlers/shared/thread-access.mjs";
3
+ import { TranscribeFileOptions, TranscriptionService } from "./runtime/transcription-service/transcription-service.mjs";
4
+ import { experimental_d_exports } from "./runtime/intelligence-platform/experimental.mjs";
5
+ import { CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeUser, GetLearningContainerId, GetTrajectoryLearningContainerIds, LearningContainerSelectorInput, TrajectoryLearningContainerSelectorInput } from "./runtime/core/learning.mjs";
6
+ import { GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult } from "./runtime/intelligence-platform/learned-skills.mjs";
7
+ import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, PlatformRequestError, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./runtime/intelligence-platform/client.mjs";
8
+ import { AgentFactoryContext, AgentsConfig, AgentsFactory, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeLike, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, OpenGenerativeUIConfig, OpenGenerativeUIOptions, RuntimeWithDeclaredChannels, VERSION, isA2UIEnabled, isIntelligenceRuntime, resolveAgents } from "./runtime/core/runtime.mjs";
9
+ import { GenerativeUIMiddleware } from "./runtime/generative-ui/generative-ui-middleware.mjs";
10
+ import { GenerativeUISurfaceWriter, createSurfaceWriter } from "./runtime/generative-ui/surface-writer.mjs";
11
+ import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵestimateBytes, ɵnormalizeLimits } from "./runtime/runner/in-memory.mjs";
12
+ import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary } from "./runtime/runner/intelligence.mjs";
13
+ import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./runtime/runner/index.mjs";
14
+ import { ChannelStatus, ChannelsControl } from "./runtime/core/channel-manager.mjs";
15
+ import { CopilotRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./runtime/core/hooks.mjs";
16
+ import { CopilotCorsConfig } from "./runtime/core/fetch-cors.mjs";
17
+ import { CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, createCopilotRuntimeHandler } from "./runtime/core/fetch-handler.mjs";
18
+ import { CopilotKitRequestHandler, MCPClient, MCPTransport } from "./runtime/index.mjs";
19
+ import { CreateSafeUrlDownloadOptions, SafeUrlDownloadOptions, createSafeUrlDownload } from "./agent/url-download.mjs";
20
+ import { BuiltInAgentLearnedSkills, BuiltInAgentLearnedSkillsOptions } from "./agent/learned-skills.mjs";
21
+ import { convertAISDKStream } from "./agent/converters/aisdk.mjs";
22
+ import { TanStackChatMessage, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./agent/converters/tanstack.mjs";
23
+ import { BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentFactoryContext, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, InterruptSignal, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MessageConversionOptions, ModelSpecifier, OverridableProperty, ToolDefinition, classifyModelSpec, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, defineTool, resolveModel } from "./agent/index.mjs";
24
+ export { type AgentFactoryContext, AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, AgentsConfig, AgentsFactory, BasicAgent, BasicAgentConfiguration, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentFactoryContext, BuiltInAgentLearnedSkills, BuiltInAgentLearnedSkillsOptions, BuiltInAgentModel, BuiltInAgentTanStackFactoryConfig, ChannelStatus, ChannelsControl, CopilotCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotKitIntelligence, CopilotKitIntelligenceConfig, CopilotKitRequestHandler, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, CopilotRuntimeHooks, CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeLike, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, CreateSafeUrlDownloadOptions, CreateThreadRequest, ErrorHookContext, FinalizeRunOptions, GenerativeUIMiddleware, GenerativeUISurfaceWriter, GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, GetLearningContainerId, GetTrajectoryLearningContainerIds, HandlerHookContext, HookContext, IdentifyUserCallback, InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, InterruptSignal, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult, LearningContainerSelectorInput, ListThreadsResponse, LocalThreadEndpointRecord, LocalThreadEndpointRunner, LocalThreadEndpointScope, MCPClient, MCPClientConfig, MCPClientConfigHTTP, MCPClientConfigSSE, MCPClientProvider, MCPTransport, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, MessageConversionOptions, ModelSpecifier, OpenGenerativeUIConfig, OpenGenerativeUIOptions, OverridableProperty, PlatformRequestError, ResponseHookContext, RouteInfo, RunEventFinalizer, RunnerStartupBoundary, RuntimeWithDeclaredChannels, SafeUrlDownloadOptions, SubscribeToThreadsRequest, SubscribeToThreadsResponse, THREAD_ACCESS_DENIED_ERROR_CODE, TanStackChatMessage, TanStackInputResult, ThreadAccessDeniedError, ThreadAccessMode, ThreadAlreadyRunningError, ThreadOwnershipRunner, ThreadSummary, ThreadsConfig, ToolDefinition, TrajectoryLearningContainerSelectorInput, TranscribeFileOptions, TranscriptionService, UpdateThreadRequest, VERSION, classifyModelSpec, convertAISDKStream, convertInputToTanStackAI, convertJsonSchemaToZodSchema, convertMessagesToVercelAISDKMessages, convertTanStackStream, convertToolDefinitionsToVercelAITools, convertToolsToVercelAITools, createCopilotRuntimeHandler, createRunEventFinalizer, createSafeUrlDownload, createSurfaceWriter, defineTool, enforcesThreadOwnership, experimental_d_exports as experimental, finalizeRunEvents, isA2UIEnabled, isIntelligenceRuntime, isThreadAccessDeniedError, resolveAgents, resolveModel, supportsLocalThreadEndpoints, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵSERVER_THREAD_OWNER, ɵestimateBytes, ɵnormalizeLimits, ɵresolveThreadOwner };