@copilotkit/runtime 2.0.0-rc.4 → 2.0.0-rc.40

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 (300) hide show
  1. package/README.md +28 -3
  2. package/dist/agent/{url-download.cjs → ai-sdk/url-download.cjs} +19 -76
  3. package/dist/agent/ai-sdk/url-download.cjs.map +1 -0
  4. package/dist/agent/{url-download.d.cts → ai-sdk/url-download.d.cts} +11 -8
  5. package/dist/agent/ai-sdk/url-download.d.cts.map +1 -0
  6. package/dist/agent/{url-download.d.mts → ai-sdk/url-download.d.mts} +11 -8
  7. package/dist/agent/ai-sdk/url-download.d.mts.map +1 -0
  8. package/dist/agent/{url-download.mjs → ai-sdk/url-download.mjs} +20 -74
  9. package/dist/agent/ai-sdk/url-download.mjs.map +1 -0
  10. package/dist/agent/ai-sdk.cjs +425 -0
  11. package/dist/agent/ai-sdk.cjs.map +1 -0
  12. package/dist/agent/ai-sdk.d.cts +119 -0
  13. package/dist/agent/ai-sdk.d.cts.map +1 -0
  14. package/dist/agent/ai-sdk.d.mts +119 -0
  15. package/dist/agent/ai-sdk.d.mts.map +1 -0
  16. package/dist/agent/ai-sdk.mjs +419 -0
  17. package/dist/agent/ai-sdk.mjs.map +1 -0
  18. package/dist/agent/classic-tools.cjs +185 -0
  19. package/dist/agent/classic-tools.cjs.map +1 -0
  20. package/dist/agent/classic-tools.mjs +183 -0
  21. package/dist/agent/classic-tools.mjs.map +1 -0
  22. package/dist/agent/converters/aisdk.cjs +16 -3
  23. package/dist/agent/converters/aisdk.cjs.map +1 -1
  24. package/dist/agent/converters/aisdk.d.cts.map +1 -1
  25. package/dist/agent/converters/aisdk.d.mts.map +1 -1
  26. package/dist/agent/converters/aisdk.mjs +18 -2
  27. package/dist/agent/converters/aisdk.mjs.map +1 -1
  28. package/dist/agent/converters/tanstack.cjs +201 -29
  29. package/dist/agent/converters/tanstack.cjs.map +1 -1
  30. package/dist/agent/converters/tanstack.d.cts +90 -6
  31. package/dist/agent/converters/tanstack.d.cts.map +1 -1
  32. package/dist/agent/converters/tanstack.d.mts +90 -6
  33. package/dist/agent/converters/tanstack.d.mts.map +1 -1
  34. package/dist/agent/converters/tanstack.mjs +201 -28
  35. package/dist/agent/converters/tanstack.mjs.map +1 -1
  36. package/dist/agent/learned-skills.cjs +15 -17
  37. package/dist/agent/learned-skills.cjs.map +1 -1
  38. package/dist/agent/learned-skills.d.cts +9 -3
  39. package/dist/agent/learned-skills.d.cts.map +1 -1
  40. package/dist/agent/learned-skills.d.mts +9 -3
  41. package/dist/agent/learned-skills.d.mts.map +1 -1
  42. package/dist/agent/learned-skills.mjs +15 -16
  43. package/dist/agent/learned-skills.mjs.map +1 -1
  44. package/dist/agent/model.cjs +42 -0
  45. package/dist/agent/model.cjs.map +1 -0
  46. package/dist/agent/model.d.cts +19 -0
  47. package/dist/agent/model.d.cts.map +1 -0
  48. package/dist/agent/model.d.mts +19 -0
  49. package/dist/agent/model.d.mts.map +1 -0
  50. package/dist/agent/model.mjs +41 -0
  51. package/dist/agent/model.mjs.map +1 -0
  52. package/dist/agent/state-delta.cjs +0 -1
  53. package/dist/agent/state-delta.cjs.map +1 -1
  54. package/dist/agent.cjs +558 -0
  55. package/dist/agent.cjs.map +1 -0
  56. package/dist/agent.d.cts +455 -0
  57. package/dist/agent.d.cts.map +1 -0
  58. package/dist/agent.d.mts +455 -0
  59. package/dist/agent.d.mts.map +1 -0
  60. package/dist/agent.mjs +551 -0
  61. package/dist/agent.mjs.map +1 -0
  62. package/dist/index.cjs +21 -27
  63. package/dist/index.d.cts +9 -11
  64. package/dist/index.d.mts +9 -11
  65. package/dist/index.mjs +5 -6
  66. package/dist/internal/learned-skills.d.cts +1 -1
  67. package/dist/internal/learned-skills.d.mts +1 -1
  68. package/dist/node.cjs +1 -2
  69. package/dist/node.d.cts +2 -2
  70. package/dist/node.d.mts +2 -2
  71. package/dist/node.mjs +2 -2
  72. package/dist/runtime/core/channel-manager.cjs +10 -2
  73. package/dist/runtime/core/channel-manager.cjs.map +1 -1
  74. package/dist/runtime/core/channel-manager.d.cts +1 -1
  75. package/dist/runtime/core/channel-manager.d.mts +1 -1
  76. package/dist/runtime/core/channel-manager.mjs +10 -1
  77. package/dist/runtime/core/channel-manager.mjs.map +1 -1
  78. package/dist/runtime/core/debug-event-bus.cjs +0 -1
  79. package/dist/runtime/core/debug-event-bus.cjs.map +1 -1
  80. package/dist/runtime/core/debug-event-bus.d.cts +1 -1
  81. package/dist/runtime/core/fetch-handler.cjs +7 -5
  82. package/dist/runtime/core/fetch-handler.cjs.map +1 -1
  83. package/dist/runtime/core/fetch-handler.d.cts +8 -0
  84. package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
  85. package/dist/runtime/core/fetch-handler.d.mts +8 -0
  86. package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
  87. package/dist/runtime/core/fetch-handler.mjs +4 -1
  88. package/dist/runtime/core/fetch-handler.mjs.map +1 -1
  89. package/dist/runtime/core/learning.d.cts +1 -1
  90. package/dist/runtime/core/logger.cjs +85 -13
  91. package/dist/runtime/core/logger.cjs.map +1 -1
  92. package/dist/runtime/core/logger.d.cts +21 -8
  93. package/dist/runtime/core/logger.d.cts.map +1 -1
  94. package/dist/runtime/core/logger.d.mts +21 -8
  95. package/dist/runtime/core/logger.d.mts.map +1 -1
  96. package/dist/runtime/core/logger.mjs +85 -10
  97. package/dist/runtime/core/logger.mjs.map +1 -1
  98. package/dist/runtime/core/middleware-sse-parser.cjs +0 -1
  99. package/dist/runtime/core/middleware-sse-parser.cjs.map +1 -1
  100. package/dist/runtime/core/middleware.cjs +0 -1
  101. package/dist/runtime/core/middleware.cjs.map +1 -1
  102. package/dist/runtime/core/package-info.cjs +1 -1
  103. package/dist/runtime/core/package-info.mjs +1 -1
  104. package/dist/runtime/core/runtime.cjs +0 -1
  105. package/dist/runtime/core/runtime.cjs.map +1 -1
  106. package/dist/runtime/core/runtime.d.cts +3 -3
  107. package/dist/runtime/core/runtime.d.mts +3 -3
  108. package/dist/runtime/endpoints/auto-start-channels.cjs +0 -1
  109. package/dist/runtime/endpoints/auto-start-channels.cjs.map +1 -1
  110. package/dist/runtime/endpoints/node-fetch-handler.cjs +0 -4
  111. package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -1
  112. package/dist/runtime/endpoints/node-fetch-handler.d.cts +1 -3
  113. package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -1
  114. package/dist/runtime/endpoints/node-fetch-handler.d.mts +1 -3
  115. package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -1
  116. package/dist/runtime/endpoints/node-fetch-handler.mjs +1 -3
  117. package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -1
  118. package/dist/runtime/event-transforms/index.d.cts +4 -0
  119. package/dist/runtime/event-transforms/index.d.mts +4 -0
  120. package/dist/runtime/event-transforms/index.mjs +5 -0
  121. package/dist/runtime/event-transforms/open-generative-ui-middleware.cjs +277 -0
  122. package/dist/runtime/event-transforms/open-generative-ui-middleware.cjs.map +1 -0
  123. package/dist/runtime/event-transforms/open-generative-ui-middleware.d.cts +61 -0
  124. package/dist/runtime/event-transforms/open-generative-ui-middleware.d.cts.map +1 -0
  125. package/dist/runtime/event-transforms/open-generative-ui-middleware.d.mts +61 -0
  126. package/dist/runtime/event-transforms/open-generative-ui-middleware.d.mts.map +1 -0
  127. package/dist/runtime/event-transforms/open-generative-ui-middleware.mjs +276 -0
  128. package/dist/runtime/event-transforms/open-generative-ui-middleware.mjs.map +1 -0
  129. package/dist/runtime/event-transforms/recorded-events.cjs +58 -0
  130. package/dist/runtime/event-transforms/recorded-events.cjs.map +1 -0
  131. package/dist/runtime/event-transforms/recorded-events.d.cts +23 -0
  132. package/dist/runtime/event-transforms/recorded-events.d.cts.map +1 -0
  133. package/dist/runtime/event-transforms/recorded-events.d.mts +23 -0
  134. package/dist/runtime/event-transforms/recorded-events.d.mts.map +1 -0
  135. package/dist/runtime/event-transforms/recorded-events.mjs +58 -0
  136. package/dist/runtime/event-transforms/recorded-events.mjs.map +1 -0
  137. package/dist/runtime/event-transforms/streaming-json-scanner.cjs +289 -0
  138. package/dist/runtime/event-transforms/streaming-json-scanner.cjs.map +1 -0
  139. package/dist/runtime/event-transforms/streaming-json-scanner.mjs +288 -0
  140. package/dist/runtime/event-transforms/streaming-json-scanner.mjs.map +1 -0
  141. package/dist/runtime/generative-ui/generative-ui-middleware.cjs +0 -1
  142. package/dist/runtime/generative-ui/generative-ui-middleware.cjs.map +1 -1
  143. package/dist/runtime/generative-ui/surface-writer.cjs +4 -5
  144. package/dist/runtime/generative-ui/surface-writer.cjs.map +1 -1
  145. package/dist/runtime/generative-ui/surface-writer.d.cts +1 -1
  146. package/dist/runtime/generative-ui/surface-writer.d.cts.map +1 -1
  147. package/dist/runtime/generative-ui/surface-writer.d.mts.map +1 -1
  148. package/dist/runtime/generative-ui/surface-writer.mjs +5 -5
  149. package/dist/runtime/generative-ui/surface-writer.mjs.map +1 -1
  150. package/dist/runtime/handlers/handle-connect.cjs.map +1 -1
  151. package/dist/runtime/handlers/handle-connect.mjs.map +1 -1
  152. package/dist/runtime/handlers/handle-inspector-learning.cjs +2 -3
  153. package/dist/runtime/handlers/handle-inspector-learning.cjs.map +1 -1
  154. package/dist/runtime/handlers/handle-inspector-metadata.cjs +2 -3
  155. package/dist/runtime/handlers/handle-inspector-metadata.cjs.map +1 -1
  156. package/dist/runtime/handlers/handle-run.cjs +8 -6
  157. package/dist/runtime/handlers/handle-run.cjs.map +1 -1
  158. package/dist/runtime/handlers/handle-run.mjs +5 -2
  159. package/dist/runtime/handlers/handle-run.mjs.map +1 -1
  160. package/dist/runtime/handlers/handle-stop.cjs +3 -4
  161. package/dist/runtime/handlers/handle-stop.cjs.map +1 -1
  162. package/dist/runtime/handlers/handle-suggest.cjs +4 -3
  163. package/dist/runtime/handlers/handle-suggest.cjs.map +1 -1
  164. package/dist/runtime/handlers/handle-suggest.mjs +4 -2
  165. package/dist/runtime/handlers/handle-suggest.mjs.map +1 -1
  166. package/dist/runtime/handlers/handle-transcribe.cjs +0 -1
  167. package/dist/runtime/handlers/handle-transcribe.cjs.map +1 -1
  168. package/dist/runtime/handlers/intelligence/annotate.cjs +2 -3
  169. package/dist/runtime/handlers/intelligence/annotate.cjs.map +1 -1
  170. package/dist/runtime/handlers/intelligence/memories.cjs +7 -8
  171. package/dist/runtime/handlers/intelligence/memories.cjs.map +1 -1
  172. package/dist/runtime/handlers/intelligence/run.cjs +24 -18
  173. package/dist/runtime/handlers/intelligence/run.cjs.map +1 -1
  174. package/dist/runtime/handlers/intelligence/run.mjs +24 -17
  175. package/dist/runtime/handlers/intelligence/run.mjs.map +1 -1
  176. package/dist/runtime/handlers/intelligence/thread-names.cjs +0 -1
  177. package/dist/runtime/handlers/intelligence/thread-names.cjs.map +1 -1
  178. package/dist/runtime/handlers/intelligence/threads.cjs +6 -7
  179. package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -1
  180. package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -1
  181. package/dist/runtime/handlers/shared/agent-utils.cjs +9 -9
  182. package/dist/runtime/handlers/shared/agent-utils.cjs.map +1 -1
  183. package/dist/runtime/handlers/shared/agent-utils.mjs +2 -1
  184. package/dist/runtime/handlers/shared/agent-utils.mjs.map +1 -1
  185. package/dist/runtime/handlers/shared/cloud-telemetry.cjs +0 -1
  186. package/dist/runtime/handlers/shared/cloud-telemetry.cjs.map +1 -1
  187. package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs +1 -1
  188. package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -1
  189. package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs +1 -1
  190. package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
  191. package/dist/runtime/handlers/shared/sse-response.cjs +72 -64
  192. package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -1
  193. package/dist/runtime/handlers/shared/sse-response.mjs +72 -63
  194. package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -1
  195. package/dist/runtime/handlers/sse/run.cjs.map +1 -1
  196. package/dist/runtime/handlers/sse/run.mjs.map +1 -1
  197. package/dist/runtime/index.d.cts +8 -15
  198. package/dist/runtime/index.d.mts +8 -15
  199. package/dist/runtime/intelligence-platform/analytics-context.cjs +84 -0
  200. package/dist/runtime/intelligence-platform/analytics-context.cjs.map +1 -0
  201. package/dist/runtime/intelligence-platform/analytics-context.mjs +83 -0
  202. package/dist/runtime/intelligence-platform/analytics-context.mjs.map +1 -0
  203. package/dist/runtime/intelligence-platform/client.cjs +27 -1
  204. package/dist/runtime/intelligence-platform/client.cjs.map +1 -1
  205. package/dist/runtime/intelligence-platform/client.d.cts +24 -1
  206. package/dist/runtime/intelligence-platform/client.d.cts.map +1 -1
  207. package/dist/runtime/intelligence-platform/client.d.mts +24 -1
  208. package/dist/runtime/intelligence-platform/client.d.mts.map +1 -1
  209. package/dist/runtime/intelligence-platform/client.mjs +27 -0
  210. package/dist/runtime/intelligence-platform/client.mjs.map +1 -1
  211. package/dist/runtime/intelligence-platform/learning-management.cjs +7 -8
  212. package/dist/runtime/intelligence-platform/learning-management.cjs.map +1 -1
  213. package/dist/runtime/intelligence-platform/learning-management.mjs +7 -7
  214. package/dist/runtime/intelligence-platform/learning-management.mjs.map +1 -1
  215. package/dist/runtime/intelligence-platform/skill-registry/archive.cjs +104 -110
  216. package/dist/runtime/intelligence-platform/skill-registry/archive.cjs.map +1 -1
  217. package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts +8 -2
  218. package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts.map +1 -1
  219. package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts +8 -2
  220. package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts.map +1 -1
  221. package/dist/runtime/intelligence-platform/skill-registry/archive.mjs +104 -109
  222. package/dist/runtime/intelligence-platform/skill-registry/archive.mjs.map +1 -1
  223. package/dist/runtime/intelligence-platform/skill-registry/config.cjs +0 -1
  224. package/dist/runtime/intelligence-platform/skill-registry/config.cjs.map +1 -1
  225. package/dist/runtime/intelligence-platform/skill-registry/index.d.cts +1 -1
  226. package/dist/runtime/intelligence-platform/skill-registry/index.d.mts +1 -1
  227. package/dist/runtime/intelligence-platform/skill-registry/registry.cjs +22 -19
  228. package/dist/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -1
  229. package/dist/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -1
  230. package/dist/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -1
  231. package/dist/runtime/intelligence-platform/skill-registry/registry.mjs +22 -19
  232. package/dist/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -1
  233. package/dist/runtime/intelligence-platform/stop-run.cjs +50 -0
  234. package/dist/runtime/intelligence-platform/stop-run.cjs.map +1 -0
  235. package/dist/runtime/intelligence-platform/stop-run.mjs +50 -0
  236. package/dist/runtime/intelligence-platform/stop-run.mjs.map +1 -0
  237. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs +0 -1
  238. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs.map +1 -1
  239. package/dist/runtime/intelligence-platform/trajectories.cjs +2 -3
  240. package/dist/runtime/intelligence-platform/trajectories.cjs.map +1 -1
  241. package/dist/runtime/intelligence-platform/trajectories.mjs +2 -2
  242. package/dist/runtime/intelligence-platform/trajectories.mjs.map +1 -1
  243. package/dist/runtime/node.d.cts +1 -1
  244. package/dist/runtime/node.d.mts +1 -1
  245. package/dist/runtime/runner/agent-runner.cjs +0 -1
  246. package/dist/runtime/runner/agent-runner.cjs.map +1 -1
  247. package/dist/runtime/runner/agent-runner.d.cts +9 -0
  248. package/dist/runtime/runner/agent-runner.d.cts.map +1 -1
  249. package/dist/runtime/runner/agent-runner.d.mts +9 -0
  250. package/dist/runtime/runner/agent-runner.d.mts.map +1 -1
  251. package/dist/runtime/runner/agent-runner.mjs.map +1 -1
  252. package/dist/runtime/runner/in-memory.cjs +0 -1
  253. package/dist/runtime/runner/in-memory.cjs.map +1 -1
  254. package/dist/runtime/runner/index.d.cts +1 -1
  255. package/dist/runtime/runner/index.d.mts +1 -1
  256. package/dist/runtime/runner/index.mjs +1 -1
  257. package/dist/runtime/runner/intelligence.cjs +50 -6
  258. package/dist/runtime/runner/intelligence.cjs.map +1 -1
  259. package/dist/runtime/runner/intelligence.d.cts +8 -1
  260. package/dist/runtime/runner/intelligence.d.cts.map +1 -1
  261. package/dist/runtime/runner/intelligence.d.mts +8 -1
  262. package/dist/runtime/runner/intelligence.d.mts.map +1 -1
  263. package/dist/runtime/runner/intelligence.mjs +50 -6
  264. package/dist/runtime/runner/intelligence.mjs.map +1 -1
  265. package/dist/runtime/telemetry/disclosure.cjs +0 -1
  266. package/dist/runtime/telemetry/disclosure.cjs.map +1 -1
  267. package/dist/runtime/telemetry/disclosure.mjs.map +1 -1
  268. package/dist/runtime/telemetry/events.d.cts +1 -1
  269. package/dist/runtime/telemetry/events.d.mts +1 -1
  270. package/dist/runtime/telemetry/instance-created.cjs +33 -12
  271. package/dist/runtime/telemetry/instance-created.cjs.map +1 -1
  272. package/dist/runtime/telemetry/instance-created.mjs +33 -12
  273. package/dist/runtime/telemetry/instance-created.mjs.map +1 -1
  274. package/dist/runtime/telemetry/telemetry-client.cjs +0 -5
  275. package/dist/runtime/telemetry/telemetry-client.cjs.map +1 -1
  276. package/dist/runtime/telemetry/telemetry-client.mjs +0 -4
  277. package/dist/runtime/telemetry/telemetry-client.mjs.map +1 -1
  278. package/dist/runtime/telemetry/telemetry-identity.cjs +0 -1
  279. package/dist/runtime/telemetry/telemetry-identity.cjs.map +1 -1
  280. package/package.json +56 -27
  281. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  282. package/dist/agent/converters/index.d.mts +0 -2
  283. package/dist/agent/index.cjs +0 -1328
  284. package/dist/agent/index.cjs.map +0 -1
  285. package/dist/agent/index.d.cts +0 -467
  286. package/dist/agent/index.d.cts.map +0 -1
  287. package/dist/agent/index.d.mts +0 -468
  288. package/dist/agent/index.d.mts.map +0 -1
  289. package/dist/agent/index.mjs +0 -1318
  290. package/dist/agent/index.mjs.map +0 -1
  291. package/dist/agent/mcp-tool-names.cjs +0 -82
  292. package/dist/agent/mcp-tool-names.cjs.map +0 -1
  293. package/dist/agent/mcp-tool-names.mjs +0 -80
  294. package/dist/agent/mcp-tool-names.mjs.map +0 -1
  295. package/dist/agent/url-download.cjs.map +0 -1
  296. package/dist/agent/url-download.d.cts.map +0 -1
  297. package/dist/agent/url-download.d.mts.map +0 -1
  298. package/dist/agent/url-download.mjs.map +0 -1
  299. package/dist/runtime/index.d.cts.map +0 -1
  300. package/dist/runtime/index.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-client.mjs","names":[],"sources":["../../../src/runtime/telemetry/telemetry-client.ts"],"sourcesContent":["import type { AnalyticsEvents } from \"./events\";\nimport {\n lambdaClient,\n parseAndWarnTelemetryId,\n computeSamplingMeta,\n TELEMETRY_EMITTER_V2,\n TELEMETRY_SURFACE_V2,\n processEnv,\n} from \"@copilotkit/shared\";\nimport {\n RUNTIME_PACKAGE_NAME,\n RUNTIME_PACKAGE_VERSION,\n} from \"../core/package-info\";\nimport { firstNonBlankTelemetryId } from \"./telemetry-identity\";\n\n/** Transport identity and sampling authority resolved for one runtime. */\nexport interface TelemetryIdentity {\n telemetryId?: string;\n licenseToken?: string;\n}\n\n/** Capture-only telemetry client bound to one runtime identity. */\nexport interface TelemetryCapture {\n capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void>;\n}\n\ninterface ResolvedTelemetryIdentity {\n telemetryId: string | null;\n licenseToken: string | null;\n licenseTelemetryId: string | null;\n}\n\nexport function isTelemetryDisabled(): boolean {\n return (\n processEnv().COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n processEnv().COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n processEnv().DO_NOT_TRACK === \"true\" ||\n processEnv().DO_NOT_TRACK === \"1\"\n );\n}\n\nexport class TelemetryClient {\n private telemetryDisabled: boolean = false;\n // Opt-down for anonymous events, defaulting to 1: the sink is ours, so a\n // real count beats one extrapolated from a fraction of the population.\n // It stays configurable because it is the cross-SDK lever for reducing or\n // stopping anonymous volume — the Go, Python, Ruby, and .NET runtimes all\n // expose it, and the cross-language conformance suite drives it to 0 to\n // assert silence. Identified callers bypass it.\n private sampleRate: number = 1;\n // EIP / Intelligence license token (Ed25519-signed JWT). Kept separate\n // from standalone identity so the transport receives only the selected\n // identity source.\n private licenseToken: string | null = null;\n // Standalone identity sent as a transport claim. It does not make an\n // event identified.\n private telemetryId: string | null = null;\n // License-derived identity. This client sends every event either way;\n // the id is what sets telemetry_identified on the sampling block, which\n // is how the two populations stay separable downstream.\n private licenseTelemetryId: string | null = null;\n // Properties merged into every event this client sends.\n //\n // For facts about the caller that are true for the whole process rather than\n // for one event: which product is embedding the runtime, for instance. A\n // distribution built on top of this can then be told apart in the existing\n // events instead of sending its own, which is the difference between one\n // extra field and a second pipeline nobody asked for.\n //\n // Sent as `global_properties`, a field of its own, so these stay separable\n // from an event's own properties all the way to the sink.\n //\n // Do not reuse a key an event already sets: the fanout spreads this bag last\n // for `oss.runtime.*`, so a collision resolves in favour of the global and\n // does so silently. Names here should describe the caller, not the call.\n private globalProperties: Record<string, unknown> = {};\n\n constructor({\n telemetryDisabled,\n sampleRate,\n }: {\n telemetryDisabled?: boolean;\n sampleRate?: number;\n } = {}) {\n this.telemetryDisabled = telemetryDisabled || isTelemetryDisabled();\n this.setSampleRate(sampleRate);\n }\n\n private shouldSendEvent() {\n if (this.sampleRate >= 1) return true;\n return Math.random() < this.sampleRate;\n }\n\n /**\n * Add properties carried by every subsequent event.\n *\n * Merged rather than replaced, so two callers setting different fields do not\n * erase each other. Set once at runtime construction in practice; nothing\n * here is per-request.\n */\n setGlobalProperties(properties: Record<string, unknown>) {\n this.globalProperties = { ...this.globalProperties, ...properties };\n }\n\n /** Atomically replace the process-wide telemetry identity. */\n setTelemetryIdentity(identity: TelemetryIdentity): void {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n this.telemetryId = resolvedIdentity.telemetryId;\n this.licenseToken = resolvedIdentity.licenseToken;\n this.licenseTelemetryId = resolvedIdentity.licenseTelemetryId;\n }\n\n /** @deprecated Prefer {@link setTelemetryIdentity}. */\n setLicenseToken(licenseToken: string): void {\n this.setTelemetryIdentity({ licenseToken });\n }\n\n /** Create an immutable capture scope for one Runtime instance. */\n createScope(identity: TelemetryIdentity): TelemetryCapture {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n return {\n capture: <K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ) => this.captureWithIdentity(event, properties, resolvedIdentity),\n };\n }\n\n async capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void> {\n return this.captureWithIdentity(event, properties, {\n telemetryId: this.telemetryId,\n licenseToken: this.licenseToken,\n licenseTelemetryId: this.licenseTelemetryId,\n });\n }\n\n private async captureWithIdentity<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n identity: ResolvedTelemetryIdentity,\n ): Promise<void> {\n // Re-read the environment: an opt-out set after import (for example a\n // dotenv call below the imports) must still stop events.\n if (this.telemetryDisabled || isTelemetryDisabled()) return;\n // Nothing is gated at the default rate of 1. A caller who dialled it\n // down means it, and identified callers are exempt either way.\n if (!identity.licenseTelemetryId && !this.shouldSendEvent()) return;\n\n await lambdaClient.send({\n event,\n properties: properties as Record<string, unknown>,\n // Its own field on the wire rather than folded into `properties`, which\n // is what the sink expects: for `oss.runtime.*` the fanout treats\n // `global_properties` as the SDK's pass-through bag and spreads it into\n // the analytics event, and v1's client sends package name and version the\n // same way. Folding it in would work and would put a process-level fact\n // in the per-event slot, where nothing downstream expects to find one.\n // Sampling metadata rides in the same slot, as it does in v1. It\n // reads 1/1 unless a caller dialled the rate down, and is stamped\n // either way: a consumer summing sampleWeight across emitters must\n // not find the field missing on a quarter of the rows, which is the\n // state that made ~24% of runtime volume unweightable (OSS-1017).\n globalProperties: {\n ...this.globalProperties,\n ...computeSamplingMeta({\n telemetryId: identity.licenseTelemetryId,\n sampleRate: this.sampleRate,\n }),\n telemetry_emitter: TELEMETRY_EMITTER_V2,\n // Constant here: a v1 request never reaches this client. The v1\n // entrypoint hands its own capture scope to the V2 runtime it\n // builds, so v1 traffic is emitted by the v1 client and stamped\n // v1 there — which is also what keeps it on the Segment wire.\n telemetry_surface: TELEMETRY_SURFACE_V2,\n // This client has one transport, so the marker is constant here. It\n // is stamped anyway so the property means the same thing on every\n // event whichever client produced it (OSS-1019).\n telemetry_transport: \"lambda\",\n },\n packageName: RUNTIME_PACKAGE_NAME,\n packageVersion: RUNTIME_PACKAGE_VERSION,\n telemetryId: identity.telemetryId ?? undefined,\n licenseToken: identity.licenseToken ?? undefined,\n });\n }\n\n private resolveTelemetryIdentity(\n identity: TelemetryIdentity,\n ): ResolvedTelemetryIdentity {\n const telemetryId = firstNonBlankTelemetryId(identity.telemetryId);\n if (telemetryId !== undefined) {\n return {\n telemetryId,\n licenseToken: null,\n licenseTelemetryId: null,\n };\n }\n\n return {\n telemetryId: null,\n licenseToken: identity.licenseToken ?? null,\n licenseTelemetryId: identity.licenseToken\n ? parseAndWarnTelemetryId(identity.licenseToken)\n : null,\n };\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 1;\n\n if (processEnv().COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n _sampleRate = parseFloat(processEnv().COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n // Number.isNaN guards against parseFloat(\"nonsense\") slipping past the\n // range check (all NaN comparisons are false), which would silently\n // drop every anonymous event with no signal.\n if (Number.isNaN(_sampleRate) || _sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n }\n}\n\nconst telemetry = new TelemetryClient();\nexport default telemetry;\n"],"mappings":";;;;;AAmCA,SAAgB,sBAA+B;AAC7C,QACE,YAAY,CAAC,kCAAkC,UAC/C,YAAY,CAAC,kCAAkC,OAC/C,YAAY,CAAC,iBAAiB,UAC9B,YAAY,CAAC,iBAAiB;;AAIlC,IAAa,kBAAb,MAA6B;CAoC3B,YAAY,EACV,mBACA,eAIE,EAAE,EAAE;2BAzC6B;oBAOR;sBAIS;qBAGD;4BAIO;0BAeQ,EAAE;AASpD,OAAK,oBAAoB,qBAAqB,qBAAqB;AACnE,OAAK,cAAc,WAAW;;CAGhC,AAAQ,kBAAkB;AACxB,MAAI,KAAK,cAAc,EAAG,QAAO;AACjC,SAAO,KAAK,QAAQ,GAAG,KAAK;;;;;;;;;CAU9B,oBAAoB,YAAqC;AACvD,OAAK,mBAAmB;GAAE,GAAG,KAAK;GAAkB,GAAG;GAAY;;;CAIrE,qBAAqB,UAAmC;EACtD,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAChE,OAAK,cAAc,iBAAiB;AACpC,OAAK,eAAe,iBAAiB;AACrC,OAAK,qBAAqB,iBAAiB;;;CAI7C,gBAAgB,cAA4B;AAC1C,OAAK,qBAAqB,EAAE,cAAc,CAAC;;;CAI7C,YAAY,UAA+C;EACzD,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAChE,SAAO,EACL,UACE,OACA,eACG,KAAK,oBAAoB,OAAO,YAAY,iBAAiB,EACnE;;CAGH,MAAM,QACJ,OACA,YACe;AACf,SAAO,KAAK,oBAAoB,OAAO,YAAY;GACjD,aAAa,KAAK;GAClB,cAAc,KAAK;GACnB,oBAAoB,KAAK;GAC1B,CAAC;;CAGJ,MAAc,oBACZ,OACA,YACA,UACe;AAGf,MAAI,KAAK,qBAAqB,qBAAqB,CAAE;AAGrD,MAAI,CAAC,SAAS,sBAAsB,CAAC,KAAK,iBAAiB,CAAE;AAE7D,QAAM,aAAa,KAAK;GACtB;GACY;GAYZ,kBAAkB;IAChB,GAAG,KAAK;IACR,GAAG,oBAAoB;KACrB,aAAa,SAAS;KACtB,YAAY,KAAK;KAClB,CAAC;IACF,mBAAmB;IAKnB,mBAAmB;IAInB,qBAAqB;IACtB;GACD,aAAa;GACb,gBAAgB;GAChB,aAAa,SAAS,eAAe;GACrC,cAAc,SAAS,gBAAgB;GACxC,CAAC;;CAGJ,AAAQ,yBACN,UAC2B;EAC3B,MAAM,cAAc,yBAAyB,SAAS,YAAY;AAClE,MAAI,gBAAgB,OAClB,QAAO;GACL;GACA,cAAc;GACd,oBAAoB;GACrB;AAGH,SAAO;GACL,aAAa;GACb,cAAc,SAAS,gBAAgB;GACvC,oBAAoB,SAAS,eACzB,wBAAwB,SAAS,aAAa,GAC9C;GACL;;CAGH,AAAQ,cAAc,YAAgC;EACpD,IAAI;AAEJ,gBAAc,cAAc;AAE5B,MAAI,YAAY,CAAC,iCACf,eAAc,WAAW,YAAY,CAAC,iCAAiC;AAMzE,MAAI,OAAO,MAAM,YAAY,IAAI,cAAc,KAAK,cAAc,EAChE,OAAM,IAAI,MAAM,sCAAsC;AAGxD,OAAK,aAAa;;;AAItB,MAAM,YAAY,IAAI,iBAAiB"}
1
+ {"version":3,"file":"telemetry-client.mjs","names":[],"sources":["../../../src/runtime/telemetry/telemetry-client.ts"],"sourcesContent":["import type { AnalyticsEvents } from \"./events\";\nimport {\n lambdaClient,\n parseAndWarnTelemetryId,\n computeSamplingMeta,\n TELEMETRY_EMITTER_V2,\n TELEMETRY_SURFACE_V2,\n processEnv,\n} from \"@copilotkit/shared\";\nimport {\n RUNTIME_PACKAGE_NAME,\n RUNTIME_PACKAGE_VERSION,\n} from \"../core/package-info\";\nimport { firstNonBlankTelemetryId } from \"./telemetry-identity\";\n\n/** Transport identity and sampling authority resolved for one runtime. */\nexport interface TelemetryIdentity {\n telemetryId?: string;\n licenseToken?: string;\n}\n\n/** Capture-only telemetry client bound to one runtime identity. */\nexport interface TelemetryCapture {\n capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void>;\n}\n\ninterface ResolvedTelemetryIdentity {\n telemetryId: string | null;\n licenseToken: string | null;\n licenseTelemetryId: string | null;\n}\n\nexport function isTelemetryDisabled(): boolean {\n return (\n processEnv().COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n processEnv().COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n processEnv().DO_NOT_TRACK === \"true\" ||\n processEnv().DO_NOT_TRACK === \"1\"\n );\n}\n\nexport class TelemetryClient {\n private telemetryDisabled: boolean = false;\n // Opt-down for anonymous events, defaulting to 1: the sink is ours, so a\n // real count beats one extrapolated from a fraction of the population.\n // It stays configurable because it is the cross-SDK lever for reducing or\n // stopping anonymous volume — the Go, Python, Ruby, and .NET runtimes all\n // expose it, and the cross-language conformance suite drives it to 0 to\n // assert silence. Identified callers bypass it.\n private sampleRate: number = 1;\n // EIP / Intelligence license token (Ed25519-signed JWT). Kept separate\n // from standalone identity so the transport receives only the selected\n // identity source.\n private licenseToken: string | null = null;\n // Standalone identity sent as a transport claim. It does not make an\n // event identified.\n private telemetryId: string | null = null;\n // License-derived identity. This client sends every event either way;\n // the id is what sets telemetry_identified on the sampling block, which\n // is how the two populations stay separable downstream.\n private licenseTelemetryId: string | null = null;\n // Properties merged into every event this client sends.\n //\n // For facts about the caller that are true for the whole process rather than\n // for one event: which product is embedding the runtime, for instance. A\n // distribution built on top of this can then be told apart in the existing\n // events instead of sending its own, which is the difference between one\n // extra field and a second pipeline nobody asked for.\n //\n // Sent as `global_properties`, a field of its own, so these stay separable\n // from an event's own properties all the way to the sink.\n //\n // Do not reuse a key an event already sets: the fanout spreads this bag last\n // for `oss.runtime.*`, so a collision resolves in favour of the global and\n // does so silently. Names here should describe the caller, not the call.\n private globalProperties: Record<string, unknown> = {};\n\n constructor({\n telemetryDisabled,\n sampleRate,\n }: {\n telemetryDisabled?: boolean;\n sampleRate?: number;\n } = {}) {\n this.telemetryDisabled = telemetryDisabled || isTelemetryDisabled();\n this.setSampleRate(sampleRate);\n }\n\n private shouldSendEvent() {\n if (this.sampleRate >= 1) return true;\n return Math.random() < this.sampleRate;\n }\n\n /**\n * Add properties carried by every subsequent event.\n *\n * Merged rather than replaced, so two callers setting different fields do not\n * erase each other. Set once at runtime construction in practice; nothing\n * here is per-request.\n */\n setGlobalProperties(properties: Record<string, unknown>) {\n this.globalProperties = { ...this.globalProperties, ...properties };\n }\n\n /** Atomically replace the process-wide telemetry identity. */\n setTelemetryIdentity(identity: TelemetryIdentity): void {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n this.telemetryId = resolvedIdentity.telemetryId;\n this.licenseToken = resolvedIdentity.licenseToken;\n this.licenseTelemetryId = resolvedIdentity.licenseTelemetryId;\n }\n\n /** Create an immutable capture scope for one Runtime instance. */\n createScope(identity: TelemetryIdentity): TelemetryCapture {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n return {\n capture: <K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ) => this.captureWithIdentity(event, properties, resolvedIdentity),\n };\n }\n\n async capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void> {\n return this.captureWithIdentity(event, properties, {\n telemetryId: this.telemetryId,\n licenseToken: this.licenseToken,\n licenseTelemetryId: this.licenseTelemetryId,\n });\n }\n\n private async captureWithIdentity<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n identity: ResolvedTelemetryIdentity,\n ): Promise<void> {\n // Re-read the environment: an opt-out set after import (for example a\n // dotenv call below the imports) must still stop events.\n if (this.telemetryDisabled || isTelemetryDisabled()) return;\n // Nothing is gated at the default rate of 1. A caller who dialled it\n // down means it, and identified callers are exempt either way.\n if (!identity.licenseTelemetryId && !this.shouldSendEvent()) return;\n\n await lambdaClient.send({\n event,\n properties: properties as Record<string, unknown>,\n // Its own field on the wire rather than folded into `properties`, which\n // is what the sink expects: for `oss.runtime.*` the fanout treats\n // `global_properties` as the SDK's pass-through bag and spreads it into\n // the analytics event, and v1's client sends package name and version the\n // same way. Folding it in would work and would put a process-level fact\n // in the per-event slot, where nothing downstream expects to find one.\n // Sampling metadata rides in the same slot, as it does in v1. It\n // reads 1/1 unless a caller dialled the rate down, and is stamped\n // either way: a consumer summing sampleWeight across emitters must\n // not find the field missing on a quarter of the rows, which is the\n // state that made ~24% of runtime volume unweightable (OSS-1017).\n globalProperties: {\n ...this.globalProperties,\n ...computeSamplingMeta({\n telemetryId: identity.licenseTelemetryId,\n sampleRate: this.sampleRate,\n }),\n telemetry_emitter: TELEMETRY_EMITTER_V2,\n // Constant here: a v1 request never reaches this client. The v1\n // entrypoint hands its own capture scope to the V2 runtime it\n // builds, so v1 traffic is emitted by the v1 client and stamped\n // v1 there — which is also what keeps it on the Segment wire.\n telemetry_surface: TELEMETRY_SURFACE_V2,\n // This client has one transport, so the marker is constant here. It\n // is stamped anyway so the property means the same thing on every\n // event whichever client produced it (OSS-1019).\n telemetry_transport: \"lambda\",\n },\n packageName: RUNTIME_PACKAGE_NAME,\n packageVersion: RUNTIME_PACKAGE_VERSION,\n telemetryId: identity.telemetryId ?? undefined,\n licenseToken: identity.licenseToken ?? undefined,\n });\n }\n\n private resolveTelemetryIdentity(\n identity: TelemetryIdentity,\n ): ResolvedTelemetryIdentity {\n const telemetryId = firstNonBlankTelemetryId(identity.telemetryId);\n if (telemetryId !== undefined) {\n return {\n telemetryId,\n licenseToken: null,\n licenseTelemetryId: null,\n };\n }\n\n return {\n telemetryId: null,\n licenseToken: identity.licenseToken ?? null,\n licenseTelemetryId: identity.licenseToken\n ? parseAndWarnTelemetryId(identity.licenseToken)\n : null,\n };\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 1;\n\n if (processEnv().COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n _sampleRate = parseFloat(processEnv().COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n // Number.isNaN guards against parseFloat(\"nonsense\") slipping past the\n // range check (all NaN comparisons are false), which would silently\n // drop every anonymous event with no signal.\n if (Number.isNaN(_sampleRate) || _sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n }\n}\n\nconst telemetry = new TelemetryClient();\nexport default telemetry;\n"],"mappings":";;;;;AAmCA,SAAgB,sBAA+B;AAC7C,QACE,YAAY,CAAC,kCAAkC,UAC/C,YAAY,CAAC,kCAAkC,OAC/C,YAAY,CAAC,iBAAiB,UAC9B,YAAY,CAAC,iBAAiB;;AAIlC,IAAa,kBAAb,MAA6B;CAoC3B,YAAY,EACV,mBACA,eAIE,EAAE,EAAE;2BAzC6B;oBAOR;sBAIS;qBAGD;4BAIO;0BAeQ,EAAE;AASpD,OAAK,oBAAoB,qBAAqB,qBAAqB;AACnE,OAAK,cAAc,WAAW;;CAGhC,AAAQ,kBAAkB;AACxB,MAAI,KAAK,cAAc,EAAG,QAAO;AACjC,SAAO,KAAK,QAAQ,GAAG,KAAK;;;;;;;;;CAU9B,oBAAoB,YAAqC;AACvD,OAAK,mBAAmB;GAAE,GAAG,KAAK;GAAkB,GAAG;GAAY;;;CAIrE,qBAAqB,UAAmC;EACtD,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAChE,OAAK,cAAc,iBAAiB;AACpC,OAAK,eAAe,iBAAiB;AACrC,OAAK,qBAAqB,iBAAiB;;;CAI7C,YAAY,UAA+C;EACzD,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAChE,SAAO,EACL,UACE,OACA,eACG,KAAK,oBAAoB,OAAO,YAAY,iBAAiB,EACnE;;CAGH,MAAM,QACJ,OACA,YACe;AACf,SAAO,KAAK,oBAAoB,OAAO,YAAY;GACjD,aAAa,KAAK;GAClB,cAAc,KAAK;GACnB,oBAAoB,KAAK;GAC1B,CAAC;;CAGJ,MAAc,oBACZ,OACA,YACA,UACe;AAGf,MAAI,KAAK,qBAAqB,qBAAqB,CAAE;AAGrD,MAAI,CAAC,SAAS,sBAAsB,CAAC,KAAK,iBAAiB,CAAE;AAE7D,QAAM,aAAa,KAAK;GACtB;GACY;GAYZ,kBAAkB;IAChB,GAAG,KAAK;IACR,GAAG,oBAAoB;KACrB,aAAa,SAAS;KACtB,YAAY,KAAK;KAClB,CAAC;IACF,mBAAmB;IAKnB,mBAAmB;IAInB,qBAAqB;IACtB;GACD,aAAa;GACb,gBAAgB;GAChB,aAAa,SAAS,eAAe;GACrC,cAAc,SAAS,gBAAgB;GACxC,CAAC;;CAGJ,AAAQ,yBACN,UAC2B;EAC3B,MAAM,cAAc,yBAAyB,SAAS,YAAY;AAClE,MAAI,gBAAgB,OAClB,QAAO;GACL;GACA,cAAc;GACd,oBAAoB;GACrB;AAGH,SAAO;GACL,aAAa;GACb,cAAc,SAAS,gBAAgB;GACvC,oBAAoB,SAAS,eACzB,wBAAwB,SAAS,aAAa,GAC9C;GACL;;CAGH,AAAQ,cAAc,YAAgC;EACpD,IAAI;AAEJ,gBAAc,cAAc;AAE5B,MAAI,YAAY,CAAC,iCACf,eAAc,WAAW,YAAY,CAAC,iCAAiC;AAMzE,MAAI,OAAO,MAAM,YAAY,IAAI,cAAc,KAAK,cAAc,EAChE,OAAM,IAAI,MAAM,sCAAsC;AAGxD,OAAK,aAAa;;;AAItB,MAAM,YAAY,IAAI,iBAAiB"}
@@ -1,4 +1,3 @@
1
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
1
  let _copilotkit_shared = require("@copilotkit/shared");
3
2
 
4
3
  //#region src/runtime/telemetry/telemetry-identity.ts
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-identity.cjs","names":[],"sources":["../../../src/runtime/telemetry/telemetry-identity.ts"],"sourcesContent":["export { firstNonBlankTelemetryId } from \"@copilotkit/shared\";\n\n/** Return the first configured license token without forwarding blank values. */\nexport function firstNonBlankLicenseToken(\n ...candidates: ReadonlyArray<string | undefined>\n): string | undefined {\n return candidates.find((candidate) => candidate?.trim());\n}\n"],"mappings":";;;;;AAGA,SAAgB,0BACd,GAAG,YACiB;AACpB,QAAO,WAAW,MAAM,cAAc,WAAW,MAAM,CAAC"}
1
+ {"version":3,"file":"telemetry-identity.cjs","names":[],"sources":["../../../src/runtime/telemetry/telemetry-identity.ts"],"sourcesContent":["export { firstNonBlankTelemetryId } from \"@copilotkit/shared\";\n\n/** Return the first configured license token without forwarding blank values. */\nexport function firstNonBlankLicenseToken(\n ...candidates: ReadonlyArray<string | undefined>\n): string | undefined {\n return candidates.find((candidate) => candidate?.trim());\n}\n"],"mappings":";;;;AAGA,SAAgB,0BACd,GAAG,YACiB;AACpB,QAAO,WAAW,MAAM,cAAc,WAAW,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/runtime",
3
- "version": "2.0.0-rc.4",
3
+ "version": "2.0.0-rc.40",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -33,11 +33,35 @@
33
33
  "main": "./dist/index.cjs",
34
34
  "module": "./dist/index.mjs",
35
35
  "types": "./dist/index.d.cts",
36
+ "typesVersions": {
37
+ "*": {
38
+ "agent": [
39
+ "./dist/agent.d.cts"
40
+ ],
41
+ "agent/ai-sdk": [
42
+ "./dist/agent/ai-sdk.d.cts"
43
+ ],
44
+ "internal/learned-skills": [
45
+ "./dist/internal/learned-skills.d.cts"
46
+ ],
47
+ "node": [
48
+ "./dist/node.d.cts"
49
+ ]
50
+ }
51
+ },
36
52
  "exports": {
37
53
  ".": {
38
54
  "import": "./dist/index.mjs",
39
55
  "require": "./dist/index.cjs"
40
56
  },
57
+ "./agent": {
58
+ "import": "./dist/agent.mjs",
59
+ "require": "./dist/agent.cjs"
60
+ },
61
+ "./agent/ai-sdk": {
62
+ "import": "./dist/agent/ai-sdk.mjs",
63
+ "require": "./dist/agent/ai-sdk.cjs"
64
+ },
41
65
  "./internal/learned-skills": {
42
66
  "import": "./dist/internal/learned-skills.mjs",
43
67
  "require": "./dist/internal/learned-skills.cjs"
@@ -53,37 +77,32 @@
53
77
  },
54
78
  "dependencies": {
55
79
  "@ag-ui/a2ui-middleware": "0.0.10",
56
- "@ag-ui/client": "1.0.2",
57
- "@ag-ui/core": "1.0.2",
58
- "@ag-ui/encoder": "1.0.2",
80
+ "@ag-ui/client": "1.0.4",
81
+ "@ag-ui/core": "1.0.4",
82
+ "@ag-ui/encoder": "1.0.4",
59
83
  "@ag-ui/mcp-apps-middleware": "^0.1.1",
60
84
  "@ag-ui/mcp-middleware": "0.0.2",
61
- "@ai-sdk/anthropic": "^3.0.49",
62
- "@ai-sdk/google": "^3.0.33",
63
- "@ai-sdk/google-vertex": "^3.0.97",
64
- "@ai-sdk/mcp": "^1.0.21",
65
- "@ai-sdk/openai": "^3.0.36",
66
85
  "@cfworker/json-schema": "^4.1.1",
67
86
  "@copilotkit/license-verifier": "~0.5.0",
68
- "@copilotkit/shared": "2.0.0-rc.4",
69
- "@modelcontextprotocol/sdk": "^1.18.2",
87
+ "@copilotkit/shared": "2.0.0-rc.40",
88
+ "@modelcontextprotocol/sdk": "^1.29.0",
70
89
  "@remix-run/node-fetch-server": "^0.13.0",
71
- "@scarf/scarf": "^1.3.0",
72
- "ai": "^6.0.104",
73
- "openai": "^4.85.1 || >=5.0.0",
90
+ "fflate": "0.8.2",
74
91
  "phoenix": "^1.8.4",
75
- "pino": "^10.1.1",
76
- "pino-pretty": "^11.2.1",
77
92
  "rxjs": "7.8.1",
78
- "ws": "^8.18.0",
79
- "zod": "^3.25.18",
80
- "yauzl": "2.10.0",
93
+ "zod": "^4.2.0",
81
94
  "@copilotkit/channels-intelligence": "^0.12.0",
82
95
  "@copilotkit/channels-core": "^0.12.0"
83
96
  },
84
97
  "devDependencies": {
85
98
  "@copilotkit/aimock": "latest",
99
+ "@hono/node-server": "^1.13.5",
100
+ "@stryker-mutator/core": "10.1.1",
101
+ "@stryker-mutator/vitest-runner": "10.1.1",
86
102
  "@swc/core": "1.5.28",
103
+ "@tanstack/ai": "^1.2.0",
104
+ "@tanstack/ai-mcp": "^1.1.0",
105
+ "@tanstack/ai-openai": "^1.1.1",
87
106
  "@tanstack/intent": "^0.0.29",
88
107
  "@types/express": "^4.17.21",
89
108
  "@types/express-v5": "npm:@types/express@^5.0.0",
@@ -92,10 +111,12 @@
92
111
  "@valibot/to-json-schema": "^1.5.0",
93
112
  "@vitest/coverage-v8": "^3.2.4",
94
113
  "@whatwg-node/server": "^0.9.34",
114
+ "ai": "^6.0.104",
95
115
  "arktype": "^2.1.29",
96
116
  "elysia": "^1.2.25",
97
117
  "eslint": "^8.56.0",
98
118
  "express": "^4.18.0 || ^5.0.0",
119
+ "hono": "^4.11.4",
99
120
  "nodemon": "^3.1.3",
100
121
  "supertest": "^7.1.1",
101
122
  "ts-node": "^10.9.2",
@@ -103,14 +124,9 @@
103
124
  "typescript": "^5.2.3",
104
125
  "valibot": "^1.2.0",
105
126
  "vitest": "^3.2.4",
106
- "@types/yauzl": "2.10.3",
107
- "hono": "^4.11.4",
108
- "@hono/node-server": "^1.13.5",
127
+ "ws": "^8.18.0",
109
128
  "@copilotkit/channels": "0.12.0",
110
- "tsconfig": "1.4.12"
111
- },
112
- "peerDependencies": {
113
- "openai": "^4.85.1 || >=5.0.0"
129
+ "@copilotkit/typescript-config": "1.55.0-next.8"
114
130
  },
115
131
  "nx": {
116
132
  "targets": {
@@ -124,15 +140,28 @@
124
140
  "engines": {
125
141
  "node": "^20.19.3 || >=22.13.0"
126
142
  },
143
+ "peerDependencies": {
144
+ "@tanstack/ai": "^1.2.0",
145
+ "ai": ">=6.0.104"
146
+ },
147
+ "peerDependenciesMeta": {
148
+ "@tanstack/ai": {
149
+ "optional": true
150
+ },
151
+ "ai": {
152
+ "optional": true
153
+ }
154
+ },
127
155
  "scripts": {
128
156
  "build": "tsdown",
129
157
  "dev": "tsdown --watch",
130
158
  "test": "vitest run",
131
159
  "test:watch": "vitest",
160
+ "test:mutation": "stryker run",
132
161
  "check-types": "tsc --noEmit",
133
162
  "link:global": "pnpm link --global",
134
163
  "unlink:global": "pnpm unlink --global",
135
- "check-dts": "tsx ../../scripts/validate-dts-ambient.ts dist && tsx ../../scripts/validate-dts-imports.ts dist && tsx ../../scripts/validate-optional-peer-entries.ts . && tsx ../../scripts/validate-module-scope-create-require.ts . && tsc --noEmit -p type-fixtures/express4/tsconfig.json && tsc --noEmit -p type-fixtures/express5/tsconfig.json && tsc --noEmit -p type-fixtures/learning-management/tsconfig.json",
164
+ "check-dts": "tsx ../../scripts/validate-dts-ambient.ts dist && tsx ../../scripts/validate-dts-imports.ts dist && tsx ../../scripts/validate-optional-peer-entries.ts . && tsx ../../scripts/validate-module-scope-create-require.ts . && tsc --noEmit -p type-fixtures/express4/tsconfig.json && tsc --noEmit -p type-fixtures/express5/tsconfig.json && tsc --noEmit -p type-fixtures/learning-management/tsconfig.json && tsc --noEmit -p type-fixtures/agent/tsconfig.json",
136
165
  "publint": "publint .",
137
166
  "attw": "attw --pack . --profile node16"
138
167
  }
@@ -1,29 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1,2 +0,0 @@
1
- import { convertAISDKStream } from "./aisdk.mjs";
2
- import { TanStackChatMessage, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./tanstack.mjs";