@shipit-ai/cli 1.167.1 → 1.169.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/antigravity.json +1 -1
  2. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/bash.json +1 -0
  3. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/cursor-cli.json +1 -1
  4. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/cursor.json +1 -1
  5. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/fish.json +1 -0
  6. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/powershell.json +1 -0
  7. package/dist/packages/core/src/infrastructure/services/tool-installer/tools/zsh.json +1 -0
  8. package/dist/src/presentation/web/app/layout.d.ts.map +1 -1
  9. package/dist/src/presentation/web/app/layout.js +15 -2
  10. package/dist/src/presentation/web/components/common/base-drawer/base-drawer.d.ts.map +1 -1
  11. package/dist/src/presentation/web/components/common/base-drawer/base-drawer.js +4 -1
  12. package/dist/src/presentation/web/components/common/page-header/page-header.d.ts +3 -1
  13. package/dist/src/presentation/web/components/common/page-header/page-header.d.ts.map +1 -1
  14. package/dist/src/presentation/web/components/common/page-header/page-header.js +8 -2
  15. package/dist/src/presentation/web/components/common/repository-node/repository-node.d.ts.map +1 -1
  16. package/dist/src/presentation/web/components/common/repository-node/repository-node.js +6 -1
  17. package/dist/src/presentation/web/components/common/shipit-ai-logo/shipit-ai-logo.d.ts +9 -1
  18. package/dist/src/presentation/web/components/common/shipit-ai-logo/shipit-ai-logo.d.ts.map +1 -1
  19. package/dist/src/presentation/web/components/common/shipit-ai-logo/shipit-ai-logo.js +12 -6
  20. package/dist/src/presentation/web/components/common/sidebar-collapse-toggle/sidebar-collapse-toggle.d.ts.map +1 -1
  21. package/dist/src/presentation/web/components/common/sidebar-collapse-toggle/sidebar-collapse-toggle.js +5 -1
  22. package/dist/src/presentation/web/components/common/sidebar-nav-item/sidebar-nav-item.d.ts.map +1 -1
  23. package/dist/src/presentation/web/components/common/sidebar-nav-item/sidebar-nav-item.js +15 -0
  24. package/dist/src/presentation/web/components/features/chat/ChatSheet.d.ts.map +1 -1
  25. package/dist/src/presentation/web/components/features/chat/ChatSheet.js +18 -5
  26. package/dist/src/presentation/web/components/features/control-center/control-center-empty-state.d.ts.map +1 -1
  27. package/dist/src/presentation/web/components/features/control-center/control-center-empty-state.js +1 -1
  28. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts.map +1 -1
  29. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.js +5 -1
  30. package/dist/src/presentation/web/components/features/settings/agent-settings-section.d.ts +3 -3
  31. package/dist/src/presentation/web/components/features/settings/agent-settings-section.d.ts.map +1 -1
  32. package/dist/src/presentation/web/components/features/settings/agent-settings-section.js +23 -102
  33. package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.d.ts +2 -3
  34. package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.d.ts.map +1 -1
  35. package/dist/src/presentation/web/components/features/settings/agent-settings-section.stories.js +18 -22
  36. package/dist/src/presentation/web/components/features/settings/ci-settings-section.d.ts.map +1 -1
  37. package/dist/src/presentation/web/components/features/settings/ci-settings-section.js +14 -5
  38. package/dist/src/presentation/web/components/features/settings/database-settings-section.d.ts.map +1 -1
  39. package/dist/src/presentation/web/components/features/settings/database-settings-section.js +14 -4
  40. package/dist/src/presentation/web/components/features/settings/environment-settings-section.d.ts +9 -3
  41. package/dist/src/presentation/web/components/features/settings/environment-settings-section.d.ts.map +1 -1
  42. package/dist/src/presentation/web/components/features/settings/environment-settings-section.js +75 -65
  43. package/dist/src/presentation/web/components/features/settings/environment-settings-section.stories.d.ts.map +1 -1
  44. package/dist/src/presentation/web/components/features/settings/environment-settings-section.stories.js +20 -18
  45. package/dist/src/presentation/web/components/features/settings/fab-layout-settings-section.d.ts.map +1 -1
  46. package/dist/src/presentation/web/components/features/settings/fab-layout-settings-section.js +1 -1
  47. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.d.ts +3 -3
  48. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.d.ts.map +1 -1
  49. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.js +48 -50
  50. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.stories.d.ts.map +1 -1
  51. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.stories.js +25 -25
  52. package/dist/src/presentation/web/components/features/settings/interactive-agent-settings-section.d.ts.map +1 -1
  53. package/dist/src/presentation/web/components/features/settings/interactive-agent-settings-section.js +3 -3
  54. package/dist/src/presentation/web/components/features/settings/notification-settings-section.d.ts +3 -3
  55. package/dist/src/presentation/web/components/features/settings/notification-settings-section.d.ts.map +1 -1
  56. package/dist/src/presentation/web/components/features/settings/notification-settings-section.js +64 -47
  57. package/dist/src/presentation/web/components/features/settings/notification-settings-section.stories.d.ts.map +1 -1
  58. package/dist/src/presentation/web/components/features/settings/notification-settings-section.stories.js +32 -24
  59. package/dist/src/presentation/web/components/features/settings/settings-page-client.d.ts.map +1 -1
  60. package/dist/src/presentation/web/components/features/settings/settings-page-client.js +28 -381
  61. package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.d.ts +2 -0
  62. package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.d.ts.map +1 -1
  63. package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.js +13 -0
  64. package/dist/src/presentation/web/components/features/settings/settings-section-utils.d.ts +13 -10
  65. package/dist/src/presentation/web/components/features/settings/settings-section-utils.d.ts.map +1 -1
  66. package/dist/src/presentation/web/components/features/settings/settings-section-utils.js +10 -10
  67. package/dist/src/presentation/web/components/features/settings/settings-section-utils.stories.d.ts +1 -1
  68. package/dist/src/presentation/web/components/features/settings/settings-section-utils.stories.d.ts.map +1 -1
  69. package/dist/src/presentation/web/components/features/settings/settings-section-utils.stories.js +7 -7
  70. package/dist/src/presentation/web/components/features/settings/stage-timeouts-settings-section.d.ts.map +1 -1
  71. package/dist/src/presentation/web/components/features/settings/stage-timeouts-settings-section.js +1 -1
  72. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.d.ts +3 -3
  73. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.d.ts.map +1 -1
  74. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.js +118 -165
  75. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.stories.d.ts +1 -1
  76. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.stories.d.ts.map +1 -1
  77. package/dist/src/presentation/web/components/features/settings/workflow-settings-section.stories.js +26 -64
  78. package/dist/src/presentation/web/components/features/skills/category-filter.d.ts.map +1 -1
  79. package/dist/src/presentation/web/components/features/skills/category-filter.js +12 -2
  80. package/dist/src/presentation/web/components/features/skills/skill-card.d.ts.map +1 -1
  81. package/dist/src/presentation/web/components/features/skills/skill-card.js +3 -3
  82. package/dist/src/presentation/web/components/features/skills/skill-detail-drawer.d.ts.map +1 -1
  83. package/dist/src/presentation/web/components/features/skills/skill-detail-drawer.js +27 -1
  84. package/dist/src/presentation/web/components/features/skills/skill-list.js +2 -2
  85. package/dist/src/presentation/web/components/features/skills/skills-page-client.d.ts.map +1 -1
  86. package/dist/src/presentation/web/components/features/skills/skills-page-client.js +2 -2
  87. package/dist/src/presentation/web/components/features/tools/tool-card.d.ts.map +1 -1
  88. package/dist/src/presentation/web/components/features/tools/tool-card.js +20 -11
  89. package/dist/src/presentation/web/components/features/tools/tool-detail-drawer.js +1 -1
  90. package/dist/src/presentation/web/components/features/tools/tools-page-client.d.ts.map +1 -1
  91. package/dist/src/presentation/web/components/features/tools/tools-page-client.js +6 -1
  92. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.d.ts.map +1 -1
  93. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.js +39 -43
  94. package/dist/src/presentation/web/components/ui/card.d.ts.map +1 -1
  95. package/dist/src/presentation/web/components/ui/card.js +9 -1
  96. package/dist/src/presentation/web/components/ui/drawer.d.ts.map +1 -1
  97. package/dist/src/presentation/web/components/ui/drawer.js +8 -2
  98. package/dist/src/presentation/web/components/ui/tooltip.d.ts.map +1 -1
  99. package/dist/src/presentation/web/components/ui/tooltip.js +3 -3
  100. package/dist/translations/ar/web.json +1 -0
  101. package/dist/translations/de/web.json +1 -0
  102. package/dist/translations/en/web.json +1 -0
  103. package/dist/translations/es/web.json +1 -0
  104. package/dist/translations/fr/web.json +1 -0
  105. package/dist/translations/he/web.json +1 -0
  106. package/dist/translations/pt/web.json +1 -0
  107. package/dist/translations/ru/web.json +1 -0
  108. package/dist/tsconfig.build.tsbuildinfo +1 -1
  109. package/package.json +1 -1
  110. package/web/.next/BUILD_ID +1 -1
  111. package/web/.next/build-manifest.json +3 -3
  112. package/web/.next/fallback-build-manifest.json +3 -3
  113. package/web/.next/prerender-manifest.json +3 -3
  114. package/web/.next/required-server-files.js +2 -2
  115. package/web/.next/required-server-files.json +2 -2
  116. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/next-font-manifest.json +6 -2
  117. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +29 -29
  118. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +1 -1
  119. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  120. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  121. package/web/.next/server/app/(dashboard)/@drawer/chat/page/next-font-manifest.json +6 -2
  122. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +27 -27
  123. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js +1 -1
  124. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  125. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  126. package/web/.next/server/app/(dashboard)/@drawer/create/page/next-font-manifest.json +6 -2
  127. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +31 -31
  128. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +1 -1
  129. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  130. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  131. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/next-font-manifest.json +6 -2
  132. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +37 -37
  133. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +2 -2
  134. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  135. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  136. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/next-font-manifest.json +6 -2
  137. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +37 -37
  138. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +2 -2
  139. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  140. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  141. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/next-font-manifest.json +6 -2
  142. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  143. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js +1 -1
  144. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  145. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  146. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/next-font-manifest.json +6 -2
  147. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  148. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +1 -1
  149. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  150. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  151. package/web/.next/server/app/(dashboard)/chat/page/next-font-manifest.json +6 -2
  152. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +27 -27
  153. package/web/.next/server/app/(dashboard)/chat/page.js +1 -1
  154. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  155. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  156. package/web/.next/server/app/(dashboard)/create/page/next-font-manifest.json +6 -2
  157. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +31 -31
  158. package/web/.next/server/app/(dashboard)/create/page.js +1 -1
  159. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  160. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  161. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/next-font-manifest.json +6 -2
  162. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +37 -37
  163. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +2 -2
  164. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  165. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  166. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/next-font-manifest.json +6 -2
  167. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +37 -37
  168. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +2 -2
  169. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  170. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  171. package/web/.next/server/app/(dashboard)/page/next-font-manifest.json +6 -2
  172. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +27 -27
  173. package/web/.next/server/app/(dashboard)/page.js +1 -1
  174. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  175. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  176. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/next-font-manifest.json +6 -2
  177. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +28 -28
  178. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js +1 -1
  179. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  180. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  181. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/next-font-manifest.json +6 -2
  182. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +28 -28
  183. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +1 -1
  184. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  185. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  186. package/web/.next/server/app/_global-error.html +1 -1
  187. package/web/.next/server/app/_global-error.rsc +1 -1
  188. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  189. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  190. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  191. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  192. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  193. package/web/.next/server/app/_not-found/page/next-font-manifest.json +6 -2
  194. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +6 -6
  195. package/web/.next/server/app/_not-found/page.js +1 -1
  196. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  197. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  198. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  199. package/web/.next/server/app/api/dialog/pick-files/route.js.nft.json +1 -1
  200. package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
  201. package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
  202. package/web/.next/server/app/api/interactive/chat/[featureId]/messages/route.js.nft.json +1 -1
  203. package/web/.next/server/app/settings/page/next-font-manifest.json +6 -2
  204. package/web/.next/server/app/settings/page/server-reference-manifest.json +11 -11
  205. package/web/.next/server/app/settings/page.js +1 -1
  206. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  207. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  208. package/web/.next/server/app/skills/page/next-font-manifest.json +6 -2
  209. package/web/.next/server/app/skills/page/server-reference-manifest.json +11 -11
  210. package/web/.next/server/app/skills/page.js +1 -1
  211. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  212. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  213. package/web/.next/server/app/tools/page/next-font-manifest.json +6 -2
  214. package/web/.next/server/app/tools/page/server-reference-manifest.json +11 -11
  215. package/web/.next/server/app/tools/page.js +1 -1
  216. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  217. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  218. package/web/.next/server/app/version/page/next-font-manifest.json +6 -2
  219. package/web/.next/server/app/version/page/server-reference-manifest.json +6 -6
  220. package/web/.next/server/app/version/page.js +1 -1
  221. package/web/.next/server/app/version/page.js.nft.json +1 -1
  222. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  223. package/web/.next/server/chunks/[root-of-the-server]__0tb~wwk._.js +1 -1
  224. package/web/.next/server/chunks/ssr/08qz_lucide-react_dist_esm_icons_0c0dui7._.js +3 -0
  225. package/web/.next/server/chunks/ssr/08qz_lucide-react_dist_esm_icons_0c0dui7._.js.map +1 -0
  226. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_create-drawer-client_tsx_0g70fc5._.js +1 -1
  227. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_create-drawer-client_tsx_0g70fc5._.js.map +1 -1
  228. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_feature-drawer-client_tsx_104cna.._.js +2 -2
  229. package/web/.next/server/chunks/ssr/0j.8_web_components_common_control-center-drawer_feature-drawer-client_tsx_104cna.._.js.map +1 -1
  230. package/web/.next/server/chunks/ssr/0ukq_presentation_web_components_features_settings_settings-page-client_tsx_0j1uius._.js +1 -1
  231. package/web/.next/server/chunks/ssr/0ukq_presentation_web_components_features_settings_settings-page-client_tsx_0j1uius._.js.map +1 -1
  232. package/web/.next/server/chunks/ssr/11y9_components_common_control-center-drawer_repository-drawer-client_tsx_09z.znp._.js +1 -1
  233. package/web/.next/server/chunks/ssr/11y9_components_common_control-center-drawer_repository-drawer-client_tsx_09z.znp._.js.map +1 -1
  234. package/web/.next/server/chunks/ssr/[root-of-the-server]__05_qc0n._.js +1 -1
  235. package/web/.next/server/chunks/ssr/[root-of-the-server]__05_qc0n._.js.map +1 -1
  236. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0uy_5rw._.js → [root-of-the-server]__0ge~xny._.js} +2 -2
  237. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0uy_5rw._.js.map → [root-of-the-server]__0ge~xny._.js.map} +1 -1
  238. package/web/.next/server/chunks/ssr/[root-of-the-server]__0jy4nha._.js +3 -0
  239. package/web/.next/server/chunks/ssr/[root-of-the-server]__0jy4nha._.js.map +1 -0
  240. package/web/.next/server/chunks/ssr/{_0e5cv3q._.js → [root-of-the-server]__0n~o-g-._.js} +2 -2
  241. package/web/.next/server/chunks/ssr/[root-of-the-server]__0n~o-g-._.js.map +1 -0
  242. package/web/.next/server/chunks/ssr/{[root-of-the-server]__02.89uf._.js → [root-of-the-server]__0qda~yi._.js} +2 -2
  243. package/web/.next/server/chunks/ssr/{[root-of-the-server]__02.89uf._.js.map → [root-of-the-server]__0qda~yi._.js.map} +1 -1
  244. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0c0xoi_._.js → [root-of-the-server]__0qxd563._.js} +2 -2
  245. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0c0xoi_._.js.map → [root-of-the-server]__0qxd563._.js.map} +1 -1
  246. package/web/.next/server/chunks/ssr/[root-of-the-server]__0rv1gci._.js +1 -1
  247. package/web/.next/server/chunks/ssr/[root-of-the-server]__0rvrr1j._.js +1 -1
  248. package/web/.next/server/chunks/ssr/[root-of-the-server]__0rvrr1j._.js.map +1 -1
  249. package/web/.next/server/chunks/ssr/[root-of-the-server]__0tq2syh._.js +1 -1
  250. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0r5zhk.._.js → [root-of-the-server]__0t~u8sd._.js} +2 -2
  251. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0r5zhk.._.js.map → [root-of-the-server]__0t~u8sd._.js.map} +1 -1
  252. package/web/.next/server/chunks/ssr/{[root-of-the-server]__04rq9lr._.js → [root-of-the-server]__10tll_l._.js} +2 -2
  253. package/web/.next/server/chunks/ssr/{[root-of-the-server]__04rq9lr._.js.map → [root-of-the-server]__10tll_l._.js.map} +1 -1
  254. package/web/.next/server/chunks/ssr/[root-of-the-server]__12j29w-._.js +1 -1
  255. package/web/.next/server/chunks/ssr/[root-of-the-server]__12j29w-._.js.map +1 -1
  256. package/web/.next/server/chunks/ssr/_0-09vq7._.js +1 -1
  257. package/web/.next/server/chunks/ssr/_0-09vq7._.js.map +1 -1
  258. package/web/.next/server/chunks/ssr/{_138qywk._.js → _01qdxy2._.js} +2 -2
  259. package/web/.next/server/chunks/ssr/{_138qywk._.js.map → _01qdxy2._.js.map} +1 -1
  260. package/web/.next/server/chunks/ssr/_01sesw0._.js +1 -1
  261. package/web/.next/server/chunks/ssr/_01sesw0._.js.map +1 -1
  262. package/web/.next/server/chunks/ssr/_069y.js._.js +2 -2
  263. package/web/.next/server/chunks/ssr/_069y.js._.js.map +1 -1
  264. package/web/.next/server/chunks/ssr/_09r54oy._.js +7 -0
  265. package/web/.next/server/chunks/ssr/_09r54oy._.js.map +1 -0
  266. package/web/.next/server/chunks/ssr/_0__4si~._.js +1 -1
  267. package/web/.next/server/chunks/ssr/_0__4si~._.js.map +1 -1
  268. package/web/.next/server/chunks/ssr/_0_m17kl._.js +1 -1
  269. package/web/.next/server/chunks/ssr/_0_m17kl._.js.map +1 -1
  270. package/web/.next/server/chunks/ssr/_0a_8rlj._.js +3 -0
  271. package/web/.next/server/chunks/ssr/_0a_8rlj._.js.map +1 -0
  272. package/web/.next/server/chunks/ssr/_0d4miu.._.js +1 -1
  273. package/web/.next/server/chunks/ssr/_0d4miu.._.js.map +1 -1
  274. package/web/.next/server/chunks/ssr/_0dy8.0k._.js +3 -0
  275. package/web/.next/server/chunks/ssr/_0dy8.0k._.js.map +1 -0
  276. package/web/.next/server/chunks/ssr/_0e8ern9._.js +1 -1
  277. package/web/.next/server/chunks/ssr/_0e8ern9._.js.map +1 -1
  278. package/web/.next/server/chunks/ssr/_0l2~~pi._.js +3 -0
  279. package/web/.next/server/chunks/ssr/_0l2~~pi._.js.map +1 -0
  280. package/web/.next/server/chunks/ssr/_0n.magx._.js +1 -1
  281. package/web/.next/server/chunks/ssr/_0p3~u8u._.js +2 -2
  282. package/web/.next/server/chunks/ssr/_0p3~u8u._.js.map +1 -1
  283. package/web/.next/server/chunks/ssr/{_00k65h-._.js → _0pa1dkv._.js} +2 -2
  284. package/web/.next/server/chunks/ssr/_0pa1dkv._.js.map +1 -0
  285. package/web/.next/server/chunks/ssr/_0r.3n~3._.js +1 -1
  286. package/web/.next/server/chunks/ssr/_0r.3n~3._.js.map +1 -1
  287. package/web/.next/server/chunks/ssr/_0t59q8r._.js +1 -1
  288. package/web/.next/server/chunks/ssr/_0t59q8r._.js.map +1 -1
  289. package/web/.next/server/chunks/ssr/_0vjw-e_._.js +7 -0
  290. package/web/.next/server/chunks/ssr/_0vjw-e_._.js.map +1 -0
  291. package/web/.next/server/chunks/ssr/_0vyfc4b._.js +1 -1
  292. package/web/.next/server/chunks/ssr/_0vyfc4b._.js.map +1 -1
  293. package/web/.next/server/chunks/ssr/_0w-_hww._.js +1 -1
  294. package/web/.next/server/chunks/ssr/_0w-_hww._.js.map +1 -1
  295. package/web/.next/server/chunks/ssr/{_0-.ckn5._.js → _0wor25i._.js} +2 -2
  296. package/web/.next/server/chunks/ssr/{_0-.ckn5._.js.map → _0wor25i._.js.map} +1 -1
  297. package/web/.next/server/chunks/ssr/_0zk-h5w._.js +1 -1
  298. package/web/.next/server/chunks/ssr/_0zk-h5w._.js.map +1 -1
  299. package/web/.next/server/chunks/ssr/{_0hwjfpu._.js → _0~0jkp_._.js} +2 -2
  300. package/web/.next/server/chunks/ssr/_0~0jkp_._.js.map +1 -0
  301. package/web/.next/server/chunks/ssr/_0~7lwu_._.js +1 -1
  302. package/web/.next/server/chunks/ssr/_0~7lwu_._.js.map +1 -1
  303. package/web/.next/server/chunks/ssr/_1161g9x._.js +1 -1
  304. package/web/.next/server/chunks/ssr/_1161g9x._.js.map +1 -1
  305. package/web/.next/server/chunks/ssr/src_presentation_web_0y11iiz._.js +1 -1
  306. package/web/.next/server/chunks/ssr/src_presentation_web_0y11iiz._.js.map +1 -1
  307. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_05m2q~u.js +1 -1
  308. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_05m2q~u.js.map +1 -1
  309. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_0.6zk.t.js +1 -1
  310. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_0.6zk.t.js.map +1 -1
  311. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_approve-feature_ts_0pjb_re._.js +1 -1
  312. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_0w2wqvu._.js +1 -1
  313. package/web/.next/server/chunks/ssr/src_presentation_web_components_0sk2qdt._.js +1 -1
  314. package/web/.next/server/chunks/ssr/src_presentation_web_components_0sk2qdt._.js.map +1 -1
  315. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_0l3oxx9._.js +1 -1
  316. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_0l3oxx9._.js.map +1 -1
  317. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_tools_tools-page-client_tsx_0aji.op._.js +1 -1
  318. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_tools_tools-page-client_tsx_0aji.op._.js.map +1 -1
  319. package/web/.next/server/middleware-build-manifest.js +3 -3
  320. package/web/.next/server/next-font-manifest.js +1 -1
  321. package/web/.next/server/next-font-manifest.json +60 -2
  322. package/web/.next/server/pages/500.html +1 -1
  323. package/web/.next/server/server-reference-manifest.js +1 -1
  324. package/web/.next/server/server-reference-manifest.json +50 -50
  325. package/web/.next/static/chunks/{05enics63g._-.js → 0-ud~1jj7chzu.js} +4 -4
  326. package/web/.next/static/chunks/00m_fbc2z1gyi.js +5 -0
  327. package/web/.next/static/chunks/{0q7ohuqneuur4.js → 09f2lesd_dd3~.js} +1 -1
  328. package/web/.next/static/chunks/0c0dau5pmseko.js +1 -0
  329. package/web/.next/static/chunks/{0ps5sykbi-z5-.js → 0dq50gtgaj63f.js} +1 -1
  330. package/web/.next/static/chunks/{11bi612fz8agh.js → 0in4l8mne5y~_.js} +1 -1
  331. package/web/.next/static/chunks/0inayq2zzadja.js +1 -0
  332. package/web/.next/static/chunks/{0t3xjndx2s1_j.css → 0j.1nx3ly591i.css} +1 -0
  333. package/web/.next/static/chunks/{0-woqr2brccx_.js → 0k0j7anrbg-of.js} +1 -1
  334. package/web/.next/static/chunks/{0ma7k9iohb3bb.js → 0o33urrd3lk~u.js} +1 -1
  335. package/web/.next/static/chunks/0o4m0k3642219.js +1 -0
  336. package/web/.next/static/chunks/0pt-d18f7zxvv.js +1 -0
  337. package/web/.next/static/chunks/{0ls0v8h_qbctm.js → 0u_27fdqa2jeg.js} +1 -1
  338. package/web/.next/static/chunks/0udlnp30o1kjd.js +5 -0
  339. package/web/.next/static/chunks/0xwh.0u-dexsl.js +1 -0
  340. package/web/.next/static/chunks/0yibymrb2j05t.css +1 -0
  341. package/web/.next/static/chunks/103xnw203o9k1.js +1 -0
  342. package/web/.next/static/chunks/{022nrd6snse79.js → 11vbir.u7_zf7.js} +1 -1
  343. package/web/.next/static/chunks/{02phgt~f2c-2q.js → 121v1_d_dfk2k.js} +1 -1
  344. package/web/.next/static/chunks/{0q8ax~44oybo2.js → 12axopx66pocj.js} +1 -1
  345. package/web/.next/static/chunks/12pd180jp8zu..js +5 -0
  346. package/web/.next/static/chunks/13fcwhkw7dle2.js +1 -0
  347. package/web/.next/static/chunks/13q1peb_t9vj8.js +1 -0
  348. package/web/.next/static/chunks/183ehj-b80a~o.js +1 -0
  349. package/web/.next/static/chunks/{0j.wph28jrce1.js → 1874_wt9rit96.js} +1 -1
  350. package/web/.next/static/media/1bffadaabf893a1e-s.16ipb6fqu393i.woff2 +0 -0
  351. package/web/.next/static/media/2bbe8d2671613f1f-s.067x_6k0k23tk.woff2 +0 -0
  352. package/web/.next/static/media/2c55a0e60120577a-s.0bjc5tiuqdqro.woff2 +0 -0
  353. package/web/.next/static/media/5476f68d60460930-s.0wxq9webf.ew4.woff2 +0 -0
  354. package/web/.next/static/media/83afe278b6a6bb3c-s.p.0q-301v4kxxnr.woff2 +0 -0
  355. package/web/.next/static/media/9c72aa0f40e4eef8-s.0m6w47a4e5dy9.woff2 +0 -0
  356. package/web/.next/static/media/ad66f9afd8947f86-s.11u06r12fd6v_.woff2 +0 -0
  357. package/web/package.json +2 -2
  358. package/web/public/favicon.svg +10 -0
  359. package/web/public/icons/tools/antigravity.svg +1 -0
  360. package/web/public/icons/tools/bash.svg +38 -0
  361. package/web/public/icons/tools/cursor-cli.svg +12 -0
  362. package/web/public/icons/tools/cursor.svg +1 -0
  363. package/web/public/icons/tools/fish.svg +153 -0
  364. package/web/public/icons/tools/powershell.svg +29 -0
  365. package/web/public/icons/tools/zsh.svg +1 -0
  366. package/web/.next/server/chunks/ssr/08qz_lucide-react_dist_esm_icons_0zwb4s4._.js +0 -3
  367. package/web/.next/server/chunks/ssr/08qz_lucide-react_dist_esm_icons_0zwb4s4._.js.map +0 -1
  368. package/web/.next/server/chunks/ssr/[root-of-the-server]__0lslgap._.js +0 -7
  369. package/web/.next/server/chunks/ssr/[root-of-the-server]__0lslgap._.js.map +0 -1
  370. package/web/.next/server/chunks/ssr/_00k65h-._.js.map +0 -1
  371. package/web/.next/server/chunks/ssr/_08i-c2n._.js +0 -3
  372. package/web/.next/server/chunks/ssr/_08i-c2n._.js.map +0 -1
  373. package/web/.next/server/chunks/ssr/_0aaotn-._.js +0 -3
  374. package/web/.next/server/chunks/ssr/_0aaotn-._.js.map +0 -1
  375. package/web/.next/server/chunks/ssr/_0e5cv3q._.js.map +0 -1
  376. package/web/.next/server/chunks/ssr/_0hwjfpu._.js.map +0 -1
  377. package/web/.next/server/chunks/ssr/_0phryzt._.js +0 -3
  378. package/web/.next/server/chunks/ssr/_0phryzt._.js.map +0 -1
  379. package/web/.next/server/chunks/ssr/_12un22l._.js +0 -7
  380. package/web/.next/server/chunks/ssr/_12un22l._.js.map +0 -1
  381. package/web/.next/static/chunks/0-lu0b1ewsb0_.js +0 -1
  382. package/web/.next/static/chunks/01~dudieyb7wl.js +0 -5
  383. package/web/.next/static/chunks/02kpdawdtqcxm.js +0 -1
  384. package/web/.next/static/chunks/03s7z6w1lj0w~.js +0 -1
  385. package/web/.next/static/chunks/04~sw.nhpwy6s.css +0 -1
  386. package/web/.next/static/chunks/08611baheit.t.js +0 -1
  387. package/web/.next/static/chunks/0_9k2ybutuphq.js +0 -1
  388. package/web/.next/static/chunks/0m5~9kij3s~81.js +0 -1
  389. package/web/.next/static/chunks/0q~uf2s33.48w.js +0 -1
  390. package/web/.next/static/chunks/15m2wfd5k_7fj.js +0 -1
  391. package/web/.next/static/chunks/15rbgqykl.er8.js +0 -1
  392. package/web/.next/static/chunks/164dnpi666fv_.js +0 -5
  393. package/web/.next/static/chunks/17z2sq7c5z8cr.js +0 -5
  394. /package/web/.next/static/{GSG_c1emY-f_AA00vD56y → SNdaKJ9fpre8tUMRe1jlA}/_buildManifest.js +0 -0
  395. /package/web/.next/static/{GSG_c1emY-f_AA00vD56y → SNdaKJ9fpre8tUMRe1jlA}/_clientMiddlewareManifest.js +0 -0
  396. /package/web/.next/static/{GSG_c1emY-f_AA00vD56y → SNdaKJ9fpre8tUMRe1jlA}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../node_modules/.pnpm/lucide-react%401.7.0_react%4019.2.4/node_modules/lucide-react/src/icons/maximize-2.ts","../../../../../../../node_modules/.pnpm/zustand%405.0.12_%40types%2Breact%4019.2.14_react%4019.2.4_use-sync-external-store%401.6.0_react%4019.2.4_/node_modules/zustand/esm/vanilla.mjs","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/context.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-reducer.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/helpers/execution-context.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/attachTransformScopes.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-memo.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/withKey.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/ReadonlyStore.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/tapClientLookup.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/helpers/env.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/types/events.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/clients/model-context-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/composer-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-resources.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/message-part-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-effect-event.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/react-assistant-context.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/message-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/useAui.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/splitClients.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-resource.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/tapClientResource.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/thread-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/thread-list-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/clients/suggestions.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/NotificationManager.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/react/use-resource.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/clients/runtime-adapter.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/tapResourceRoot.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/thread-list-item-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/client/Tools.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-effect.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/ResourceFiber.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/proxied-assistant-state.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/RuntimeAdapter.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/AssistantProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/stores/ThreadViewport.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/utils/createContextHook.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/attachment-runtime-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/ThreadViewportContext.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/tap-assistant-context.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/utils/depsShallowEqual.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-state.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/utils/composite-context-provider.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/runtime-clients/tap-subscribable.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/helpers/commit.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/client/DataRenderers.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-callback.ts","../../../../../../../node_modules/.pnpm/zustand%405.0.12_%40types%2Breact%4019.2.14_react%4019.2.4_use-sync-external-store%401.6.0_react%4019.2.4_/node_modules/zustand/esm/react.mjs","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/tap-const.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/scheduler.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/tap-client-stack-context.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/hooks/utils/tapHook.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/legacy-runtime/AssistantRuntimeProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/providers/ThreadViewportProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/model-context/types.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/utils/createContextStoreHook.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/utils/BaseProxyHandler.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/wrapperResource.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/tap/src/core/helpers/root.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/Derived.ts","../../../../../../../node_modules/.pnpm/lucide-react%401.7.0_react%4019.2.4/node_modules/lucide-react/src/icons/cpu.ts","../../../../../../../node_modules/.pnpm/%40babel%2Bruntime%407.29.2/node_modules/%40babel/runtime/helpers/esm/extends.js","../../../../../../../node_modules/.pnpm/%40babel%2Bruntime%407.29.2/node_modules/%40babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../../../../node_modules/.pnpm/zustand%405.0.12_%40types%2Breact%4019.2.14_react%4019.2.4_use-sync-external-store%401.6.0_react%4019.2.4_/node_modules/zustand/esm/vanilla/shallow.mjs","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/utils/ensureBinding.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/utils/getMessageQuote.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/composer/ComposerIf.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useMessageError.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/RenderChildrenWithAccessor.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/useThreadViewportAutoScroll.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message/MessageError.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/Primitive.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/utils/createStateHookForRuntime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/AttachmentByIndexProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/SuggestionByIndexProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/QueueItemByIndexProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/MessageByIndexProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/PartByIndexProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/smooth/useSmooth.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar.ts","../../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-slot%401.2.4_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40radix-ui/react-slot/dist/index.mjs","../../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-primitive%402.1.4_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Bre_0243fb2db8a1fb85ca77b8d9e5c2d650/node_modules/%40radix-ui/react-primitive/dist/index.mjs","../../../../../../../node_modules/.pnpm/use-composed-ref%401.4.0_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/use-composed-ref/dist/use-composed-ref.esm.js","../../../../../../../node_modules/.pnpm/use-isomorphic-layout-effect%401.2.1_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js","../../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-primitive%402.1.4_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Bre_0243fb2db8a1fb85ca77b8d9e5c2d650/node_modules/%40radix-ui/react-primitive/src/primitive.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/context/react/utils/useRuntimeState.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadIf.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/TextMessagePartProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerStopDictation.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/useAuiEvent.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarRoot.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/hooks/useOnScrollToBottom.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/ComposerMentionItems.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerQuote.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/ComposerMentionCategories.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadRoot.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerDictationTranscript.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/ComposerMentionPopover.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message/MessageRoot.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message/MessageIf.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/ComposerMentionBack.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/messagePart/MessagePartImage.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/createActionButton.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarCopy.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/messagePart/MessagePartText.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarExportMarkdown.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarStopSpeaking.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarFeedbackNegative.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarFeedbackPositive.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerAttachmentDropzone.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/hooks/useManagedRef.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useActionBarEdit.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useSuggestionTrigger.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useActionBarCopy.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerCancel.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarSpeak.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarInteractionContext.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadViewport.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadViewportFooter.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadSuggestion.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerDictate.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/smooth/SmoothContext.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarReload.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/message/MessageParts.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/ComposerMentionContext.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/composer/ComposerQueue.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/thread/ThreadMessages.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/message/MessageAttachments.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/thread/ThreadSuggestions.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/composer/ComposerAttachments.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breact%4019.2.14_react%4019.2.4__%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40assistant-ui/store/src/useAuiState.ts","../../../../../../../node_modules/.pnpm/zustand%405.0.12_%40types%2Breact%4019.2.14_react%4019.2.4_use-sync-external-store%401.6.0_react%4019.2.4_/node_modules/zustand/esm/react/shallow.mjs","../../../../../../../node_modules/.pnpm/use-latest%401.3.0_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/use-latest/dist/use-latest.esm.js","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/useActionBarFloatStatus.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/adapters/mention.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/legacy-runtime/hooks/MessageContext.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/providers/ChainOfThoughtByIndicesProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message/MessageParts.tsx","../../../../../../../node_modules/.pnpm/use-effect-event%402.0.3_react%4019.2.4/node_modules/use-effect-event/src/useEffectEvent.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadScrollToBottom.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/messagePart/useMessagePartImage.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useComposerAddAttachment.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useComposerDictate.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useComposerSend.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/store/clients/chain-of-thought-client.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/messagePart/MessagePartInProgress.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerAddAttachment.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitive-hooks/useActionBarFeedback.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/MentionResource.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerInput.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/message/MessagePartsGrouped.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/messagePart/useMessagePartText.ts","../../../../../../../node_modules/.pnpm/react-textarea-autosize%408.5.9_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/react-textarea-autosize/dist/react-textarea-autosize.esm.js","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/thread/ThreadViewportSlack.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/hooks/useOnResizeContent.ts","../../../../../../../node_modules/.pnpm/lucide-react%401.7.0_react%4019.2.4/node_modules/lucide-react/src/icons/circle-stop.ts","../../../../../../../node_modules/.pnpm/lucide-react%401.7.0_react%4019.2.4/node_modules/lucide-react/src/icons/send-horizontal.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/mention/detectMentionTrigger.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/utils/hooks/useSizeHandle.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/primitives/message/MessageQuote.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerRoot.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/composer/ComposerSend.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Breact%400.12.22_%40types%2Breact-dom%4019.2.3_%40types%2Breact%4019.2.14__%40types%2Breact%40_fe5ee3893a3d3914cc14c9fc16f48ee8/node_modules/%40assistant-ui/react/src/primitives/actionBar/ActionBarEdit.ts","../../../../../../../node_modules/.pnpm/%40radix-ui%2Breact-slot%401.2.4_%40types%2Breact%4019.2.14_react%4019.2.4/node_modules/%40radix-ui/react-slot/src/slot.tsx","../../../../../../../node_modules/.pnpm/secure-json-parse%404.1.0/node_modules/secure-json-parse/index.js","../../../../../../../node_modules/.pnpm/%40tanstack%2Bquery-core%405.96.2/node_modules/%40tanstack/query-core/src/mutation.ts","../../../../../../../node_modules/.pnpm/nanoid%405.1.7/node_modules/nanoid/non-secure/index.js","../../../../../../../src/presentation/web/components/assistant-ui/thread.tsx","../../../../../../../src/presentation/web/components/features/chat/ChatTab.tsx","../../../../../../../node_modules/.pnpm/%40tanstack%2Bquery-core%405.96.2/node_modules/%40tanstack/query-core/build/modern/mutationObserver.js","../../../../../../../node_modules/.pnpm/%40tanstack%2Breact-query%405.96.2_react%4019.2.4/node_modules/%40tanstack/react-query/build/modern/useMutation.js","../../../../../../../src/presentation/web/components/features/chat/useChatRuntime.ts","../../../../../../../src/presentation/web/components/features/chat/ChatComposer.tsx","../../../../../../../src/presentation/web/hooks/use-attachments.ts","../../../../../../../node_modules/.pnpm/assistant-stream%400.3.9/node_modules/assistant-stream/src/core/tool/ToolResponse.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtimes/external-store/external-store-thread-list-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/message-part-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/utils/message-repository.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/utils/auto-status.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/utils/id.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtimes/external-store/external-store-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtimes/external-store/external-store-thread-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/base/base-assistant-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtimes/external-store/thread-message-converter.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/utils/text.ts","../../../../../../../node_modules/.pnpm/assistant-stream%400.3.9/node_modules/assistant-stream/src/utils/json/parse-partial-json-object.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/thread-list-item-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/runtimes/useExternalStoreRuntime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/base/base-thread-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/utils/thread-message-like.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/thread-list-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/message-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/composer-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/base/default-edit-composer-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40tanstack%2Bquery-core%405.96.2/node_modules/%40tanstack/query-core/src/mutationObserver.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/react/runtimes/RuntimeAdapterProvider.tsx","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/thread-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/utils/external-store-message.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/assistant-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/adapters/attachment.ts","../../../../../../../node_modules/.pnpm/assistant-stream%400.3.9/node_modules/assistant-stream/src/utils/json/fix-json.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/base/default-thread-composer-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/api/attachment-runtime.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/runtime/base/base-composer-runtime-core.ts","../../../../../../../node_modules/.pnpm/%40assistant-ui%2Bcore%400.1.10_%40assistant-ui%2Bstore%400.2.6_%40assistant-ui%2Btap%400.5.6_%40types%2Breac_842ab41b926a8de7cb0f7d26686614dd/node_modules/%40assistant-ui/core/src/subscribable/subscribable.ts","../../../../../../../src/presentation/web/app/actions/compose-user-input.ts","../../../../../../../node_modules/.pnpm/%40tanstack%2Breact-query%405.96.2_react%4019.2.4/node_modules/%40tanstack/react-query/src/useMutation.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['path', { d: 'M15 3h6v6', key: '1q9fwt' }],\n ['path', { d: 'm21 3-7 7', key: '1l2asr' }],\n ['path', { d: 'm3 21 7-7', key: 'tjx5ai' }],\n ['path', { d: 'M9 21H3v-6', key: 'wtvkvv' }],\n];\n\n/**\n * @component @name Maximize2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgM2g2djYiIC8+CiAgPHBhdGggZD0ibTIxIDMtNyA3IiAvPgogIDxwYXRoIGQ9Im0zIDIxIDctNyIgLz4KICA8cGF0aCBkPSJNOSAyMUgzdi02IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/maximize-2\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Maximize2 = createLucideIcon('maximize-2', __iconNode);\n\nexport default Maximize2;\n","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","const contextValue: unique symbol = Symbol(\"tap.Context\");\ntype Context<T> = {\n [contextValue]: T;\n};\n\nexport const createResourceContext = <T>(defaultValue: T): Context<T> => {\n return {\n [contextValue]: defaultValue,\n };\n};\n\nexport const withContextProvider = <T, TResult>(\n context: Context<T>,\n value: T,\n fn: () => TResult,\n) => {\n const previousValue = context[contextValue];\n context[contextValue] = value;\n try {\n return fn();\n } finally {\n context[contextValue] = previousValue;\n }\n};\n\nexport const tap = <T>(context: Context<T>) => {\n return context[contextValue];\n};\n","import { isDevelopment } from \"../core/helpers/env\";\nimport { getCurrentResourceFiber } from \"../core/helpers/execution-context\";\nimport { ReducerQueueEntry, ResourceFiber } from \"../core/types\";\nimport { markCellDirty } from \"../core/helpers/root\";\nimport { tapHook } from \"./utils/tapHook\";\n\ntype Dispatch<A> = (action: A) => void;\n\nconst dispatchOnFiber = (\n fiber: ResourceFiber<any, any>,\n callback: () => (() => void) | null,\n): void => {\n if (fiber.renderContext) {\n throw new Error(\"Resource updated during render\");\n }\n if (fiber.isNeverMounted) {\n throw new Error(\"Resource updated before mount\");\n }\n\n fiber.root.dispatchUpdate(() => {\n const result = callback();\n if (result) {\n result();\n fiber.root.changelog.push(result);\n return true;\n }\n return false;\n });\n};\n\nfunction tapReducerImpl<S, A, I, R extends S>(\n reducer: (state: S, action: A) => S,\n getDerivedState: ((state: S) => R) | undefined,\n initialArg: S | I,\n initFn: ((arg: I) => S) | undefined,\n): [R, Dispatch<A>] {\n const cell = tapHook(\"reducer\", () => {\n const fiber = getCurrentResourceFiber();\n\n // First render: compute initial state\n const initialState = initFn ? initFn(initialArg as I) : initialArg;\n\n if (isDevelopment && fiber.devStrictMode && initFn) {\n void initFn(initialArg as I);\n }\n\n return {\n type: \"reducer\",\n queue: new Set(),\n dirty: false,\n workInProgress: initialState,\n current: initialState,\n reducer,\n dispatch: (action: A) => {\n const entry: ReducerQueueEntry = {\n action,\n hasEagerState: false,\n eagerState: undefined,\n };\n\n dispatchOnFiber(fiber, () => {\n if (fiber.root.dirtyCells.length === 0 && !entry.hasEagerState) {\n entry.eagerState = reducer(cell.workInProgress, action);\n entry.hasEagerState = true;\n\n if (Object.is(cell.current, entry.eagerState)) return null;\n }\n\n return () => {\n markCellDirty(fiber, cell);\n cell.queue.add(entry);\n };\n });\n },\n };\n });\n\n const fiber = getCurrentResourceFiber();\n const sameReducer = reducer === cell.reducer;\n cell.reducer = reducer;\n\n for (const item of cell.queue) {\n if (!item.hasEagerState || !sameReducer) {\n item.eagerState = reducer(cell.workInProgress, item.action);\n item.hasEagerState = true;\n }\n\n if (isDevelopment && fiber.devStrictMode) {\n void reducer(cell.workInProgress, item.action);\n }\n\n cell.workInProgress = item.eagerState;\n }\n cell.queue.clear();\n\n if (getDerivedState) {\n const derived = getDerivedState(cell.workInProgress);\n\n if (!Object.is(derived, cell.workInProgress)) {\n markCellDirty(fiber, cell);\n cell.workInProgress = derived;\n }\n }\n\n return [cell.workInProgress, cell.dispatch];\n}\n\nexport function tapReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initialState: S,\n): [S, Dispatch<A>];\nexport function tapReducer<S, A, I>(\n reducer: (state: S, action: A) => S,\n initialArg: I,\n init: (arg: I) => S,\n): [S, Dispatch<A>];\nexport function tapReducer<S, A, I>(\n reducer: (state: S, action: A) => S,\n initialArg: S | I,\n init?: (arg: I) => S,\n): [S, Dispatch<A>] {\n return tapReducerImpl(\n reducer,\n undefined,\n initialArg as S,\n init as ((arg: S) => S) | undefined,\n );\n}\n\nexport function tapReducerWithDerivedState<S, A, R extends S>(\n reducer: (state: S, action: A) => S,\n getDerivedState: (state: S) => R,\n initialState: S,\n): [R, Dispatch<A>];\nexport function tapReducerWithDerivedState<S, A, I, R extends S>(\n reducer: (state: S, action: A) => S,\n getDerivedState: (state: S) => R,\n initialArg: I,\n init: (arg: I) => S,\n): [R, Dispatch<A>];\nexport function tapReducerWithDerivedState<S, A, I, R extends S>(\n reducer: (state: S, action: A) => S,\n getDerivedState: (state: S) => R,\n initialArg: I,\n init?: (arg: I) => S,\n): [R, Dispatch<A>] {\n return tapReducerImpl(reducer, getDerivedState, initialArg, init);\n}\n","import { isDevelopment } from \"./env\";\nimport { ResourceFiber } from \"../types\";\n\nlet currentResourceFiber: ResourceFiber<any, any> | null = null;\n\nexport function withResourceFiber<R, P>(\n fiber: ResourceFiber<R, P>,\n fn: () => void,\n): void {\n fiber.currentIndex = 0;\n\n const previousContext = currentResourceFiber;\n currentResourceFiber = fiber;\n try {\n fn();\n\n fiber.isFirstRender = false;\n\n // ensure hook count matches\n if (fiber.cells.length !== fiber.currentIndex) {\n throw new Error(\n `Rendered ${fiber.currentIndex} hooks but expected ${fiber.cells.length}. ` +\n \"Hooks must be called in the exact same order in every render.\",\n );\n }\n } finally {\n currentResourceFiber = previousContext;\n }\n}\nexport function getCurrentResourceFiber(): ResourceFiber<unknown, unknown> {\n if (!currentResourceFiber) {\n throw new Error(\"No resource fiber available\");\n }\n return currentResourceFiber;\n}\n\nexport function getDevStrictMode(enable: boolean) {\n if (!isDevelopment) return null;\n if (currentResourceFiber?.devStrictMode)\n return currentResourceFiber.isFirstRender ? \"child\" : \"root\";\n\n return enable ? \"root\" : null;\n}\n","import type { ResourceElement } from \"@assistant-ui/tap\";\nimport type {\n AssistantClient,\n ClientElement,\n ClientNames,\n} from \"./types/client\";\nimport type { DerivedElement } from \"./Derived\";\n\nconst TRANSFORM_SCOPES = Symbol(\"assistant-ui.transform-scopes\");\n\nexport type ScopesConfig = {\n [K in ClientNames]?: ClientElement<K> | DerivedElement<K>;\n};\n\ntype TransformScopesFn = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n) => void;\n\ntype ResourceWithTransformScopes = {\n [TRANSFORM_SCOPES]?: TransformScopesFn;\n};\n\nexport function attachTransformScopes<\n T extends (...args: any[]) => ResourceElement<any>,\n>(resource: T, transform: TransformScopesFn): void {\n const r = resource as T & ResourceWithTransformScopes;\n if (r[TRANSFORM_SCOPES]) {\n throw new Error(\"transformScopes is already attached to this resource\");\n }\n r[TRANSFORM_SCOPES] = transform;\n}\n\nexport function forwardTransformScopes<\n T extends (...args: any[]) => ResourceElement<any>,\n S extends (...args: any[]) => ResourceElement<any>,\n>(target: T, source: S): void {\n const sourceTransform = getTransformScopes(source);\n if (!sourceTransform) return;\n\n const r = target as T & ResourceWithTransformScopes;\n const existingTransform = r[TRANSFORM_SCOPES];\n if (existingTransform) {\n r[TRANSFORM_SCOPES] = (scopes, parent) => {\n sourceTransform(scopes, parent);\n existingTransform(scopes, parent);\n };\n } else {\n r[TRANSFORM_SCOPES] = sourceTransform;\n }\n}\n\nexport function getTransformScopes<\n T extends (...args: any[]) => ResourceElement<any>,\n>(resource: T): TransformScopesFn | undefined {\n return (resource as T & ResourceWithTransformScopes)[TRANSFORM_SCOPES];\n}\n","import { isDevelopment } from \"../core/helpers/env\";\nimport { getCurrentResourceFiber } from \"../core/helpers/execution-context\";\nimport { tapReducerWithDerivedState } from \"./tap-reducer\";\nimport { depsShallowEqual } from \"./utils/depsShallowEqual\";\n\nconst memoReducer = () => {\n throw new Error(\"Memo reducer should not be called\");\n};\n\ntype MemoState<T> = { value: T; deps: readonly unknown[] };\n\nexport const tapMemo = <T>(fn: () => T, deps: readonly unknown[]): T => {\n const fiber = getCurrentResourceFiber();\n const [state] = tapReducerWithDerivedState(\n memoReducer,\n (state: MemoState<T> | null): MemoState<T> => {\n if (state && depsShallowEqual(state.deps, deps)) return state;\n\n const value = fn();\n\n if (isDevelopment && fiber.devStrictMode) {\n void fn();\n }\n\n return { value, deps };\n },\n null,\n );\n return state.value;\n};\n","import { ResourceElement } from \"./types\";\n\nexport function withKey<E extends ResourceElement<any, any>>(\n key: string | number,\n element: E,\n): E {\n return { ...element, key };\n}\n","import type { StoreApi } from \"zustand\";\n\nexport type ReadonlyStore<T> = Omit<StoreApi<T>, \"setState\" | \"destroy\">;\n\nexport const writableStore = <T>(store: ReadonlyStore<T> | undefined) => {\n return store as unknown as StoreApi<T>;\n};\n","import {\n tapMemo,\n tapResource,\n tapResources,\n type ResourceElement,\n} from \"@assistant-ui/tap\";\nimport type { ClientMethods } from \"./types/client\";\nimport { ClientResource } from \"./tapClientResource\";\nimport { wrapperResource } from \"./wrapperResource\";\n\ntype InferClientState<TMethods> = TMethods extends {\n getState: () => infer S;\n}\n ? S\n : unknown;\n\nconst ClientResourceWithKey = wrapperResource(\n <TMethods extends ClientMethods>(el: ResourceElement<TMethods>) => {\n if (el.key === undefined) {\n throw new Error(\"tapClientResource: Element has no key\");\n }\n return tapResource(ClientResource(el)) as {\n methods: TMethods;\n state: InferClientState<TMethods>;\n key: string | number;\n };\n },\n);\n\nexport function tapClientLookup<TMethods extends ClientMethods>(\n getElements: () => readonly ResourceElement<TMethods>[],\n getElementsDeps: readonly unknown[],\n): {\n state: InferClientState<TMethods>[];\n get: (lookup: { index: number } | { key: string }) => TMethods;\n} {\n const resources = tapResources(\n () => getElements().map((el) => ClientResourceWithKey(el)),\n // biome-ignore lint/correctness/useExhaustiveDependencies: getElementsDeps is passed through from caller\n getElementsDeps,\n );\n\n const keys = tapMemo(() => Object.keys(resources), [resources]);\n\n // For arrays, track element key -> index mapping\n const keyToIndex = tapMemo(() => {\n return resources.reduce(\n (acc, resource, index) => {\n acc[resource.key] = index;\n return acc;\n },\n {} as Record<string, number>,\n );\n }, [resources]);\n\n const state = tapMemo(() => {\n return resources.map((r) => r.state);\n }, [resources]);\n\n return {\n state,\n get: (lookup: { index: number } | { key: string }) => {\n if (\"index\" in lookup) {\n if (lookup.index < 0 || lookup.index >= keys.length) {\n throw new Error(\n `tapClientLookup: Index ${lookup.index} out of bounds (length: ${keys.length})`,\n );\n }\n return resources[lookup.index]!.methods;\n }\n\n const index = keyToIndex[lookup.key];\n if (index === undefined) {\n throw new Error(`tapClientLookup: Key \"${lookup.key}\" not found`);\n }\n return resources[index]!.methods;\n },\n };\n}\n","export const isDevelopment =\n typeof process !== \"undefined\" &&\n (process.env.NODE_ENV === \"development\" || process.env.NODE_ENV === \"test\");\n","import type {\n AssistantClientAccessor,\n ClientEvents,\n ClientNames,\n} from \"./client\";\n\n// --- Event Map Construction ---\ntype UnionToIntersection<U> = (\n U extends unknown\n ? (x: U) => void\n : never\n) extends (x: infer I) => void\n ? I\n : never;\n\ntype ClientEventMap = UnionToIntersection<\n { [K in ClientNames]: ClientEvents<K> }[ClientNames]\n>;\n\n// --- Core Types ---\n\ntype WildcardPayload = {\n [K in keyof ClientEventMap]: { event: K; payload: ClientEventMap[K] };\n}[keyof ClientEventMap];\n\nexport type AssistantEventPayload = ClientEventMap & { \"*\": WildcardPayload };\n\nexport type AssistantEventName = keyof AssistantEventPayload;\n\ntype EventSource<T extends AssistantEventName> =\n T extends `${infer Source}.${string}` ? Source : never;\n\n// --- Scoping ---\n\ntype ParentOf<K extends ClientNames> =\n AssistantClientAccessor<K> extends { source: infer S }\n ? S extends ClientNames\n ? S\n : never\n : never;\n\ntype AncestorsOf<\n K extends ClientNames,\n Seen extends ClientNames = never,\n> = K extends Seen\n ? never\n : ParentOf<K> extends never\n ? never\n : ParentOf<K> | AncestorsOf<ParentOf<K>, Seen | K>;\n\n/** Valid scopes: `\"*\"` | event source | ancestors of event source */\nexport type AssistantEventScope<TEvent extends AssistantEventName> =\n | \"*\"\n | EventSource<TEvent>\n | (EventSource<TEvent> extends ClientNames\n ? AncestorsOf<EventSource<TEvent>>\n : never);\n\n// --- Selection & Callbacks ---\n\nexport type AssistantEventSelector<TEvent extends AssistantEventName> =\n | TEvent\n | { scope: AssistantEventScope<TEvent>; event: TEvent };\n\nexport const normalizeEventSelector = <TEvent extends AssistantEventName>(\n selector: AssistantEventSelector<TEvent>,\n) => {\n if (typeof selector === \"string\") {\n const source = selector.split(\".\")[0] as AssistantEventScope<TEvent>;\n return { scope: source, event: selector };\n }\n return { scope: selector.scope, event: selector.event };\n};\n\nexport type AssistantEventCallback<TEvent extends AssistantEventName> = (\n payload: AssistantEventPayload[TEvent],\n) => void;\n","import { resource, tapMemo, tapState } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { CompositeContextProvider } from \"../../utils/composite-context-provider\";\nimport type { ModelContextState } from \"../scopes/model-context\";\n\nconst version = 1;\n\nexport const ModelContext = resource((): ClientOutput<\"modelContext\"> => {\n const [state] = tapState<ModelContextState>(\n () => ({ version: version + 1 }) as unknown as ModelContextState,\n );\n const composite = tapMemo(() => new CompositeContextProvider(), []);\n\n return {\n getState: () => state,\n getModelContext: () => composite.getModelContext(),\n subscribe: (callback) => composite.subscribe(callback),\n register: (provider) => composite.registerModelContextProvider(provider),\n };\n});\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport {\n resource,\n tapMemo,\n tapEffect,\n tapResource,\n type tapRef,\n withKey,\n} from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n tapAssistantEmit,\n tapClientLookup,\n} from \"@assistant-ui/store\";\nimport {\n ComposerRuntime,\n EditComposerRuntime,\n} from \"../../runtime/api/composer-runtime\";\nimport { ComposerState } from \"../scopes/composer\";\nimport { AttachmentRuntimeClient } from \"./attachment-runtime-client\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nconst ComposerAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: ComposerRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n\n return tapResource(\n AttachmentRuntimeClient({\n runtime: attachmentRuntime,\n }),\n );\n },\n);\n\nexport const ComposerClient = resource(\n ({\n threadIdRef,\n messageIdRef,\n runtime,\n }: {\n threadIdRef: tapRef.RefObject<string>;\n messageIdRef?: tapRef.RefObject<string>;\n runtime: ComposerRuntime;\n }): ClientOutput<\"composer\"> => {\n const runtimeState = tapSubscribable(runtime);\n const emit = tapAssistantEmit();\n\n // Bind composer events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to composer events\n for (const event of [\"send\", \"attachmentAdd\"] as const) {\n const unsubscribe = runtime.unstable_on(event, () => {\n emit(`composer.${event}`, {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n // attachmentAddError carries the failed attachment ID\n unsubscribers.push(\n runtime.unstable_on(\"attachmentAddError\", () => {\n const errorAttachment = runtime\n .getState()\n .attachments.findLast(\n (a) =>\n a.status.type === \"incomplete\" && a.status.reason === \"error\",\n );\n emit(\"composer.attachmentAddError\", {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n ...(errorAttachment && { attachmentId: errorAttachment.id }),\n });\n }),\n );\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, emit, threadIdRef, messageIdRef]);\n\n const attachments = tapClientLookup(\n () =>\n runtimeState.attachments.map((attachment, idx) =>\n withKey(\n attachment.id,\n ComposerAttachmentClientByIndex({\n runtime,\n index: idx,\n }),\n ),\n ),\n [runtimeState.attachments, runtime],\n );\n\n const state = tapMemo<ComposerState>(() => {\n return {\n text: runtimeState.text,\n role: runtimeState.role,\n attachments: attachments.state,\n runConfig: runtimeState.runConfig,\n isEditing: runtimeState.isEditing,\n canCancel: runtimeState.canCancel,\n attachmentAccept: runtimeState.attachmentAccept,\n isEmpty: runtimeState.isEmpty,\n type: runtimeState.type ?? \"thread\",\n dictation: runtimeState.dictation,\n quote: runtimeState.quote,\n queue: [],\n };\n }, [runtimeState, attachments.state]);\n\n return {\n getState: () => state,\n setText: runtime.setText,\n setRole: runtime.setRole,\n setRunConfig: runtime.setRunConfig,\n addAttachment: runtime.addAttachment,\n reset: runtime.reset,\n clearAttachments: runtime.clearAttachments,\n send: runtime.send,\n cancel: runtime.cancel,\n beginEdit:\n (runtime as EditComposerRuntime).beginEdit ??\n (() => {\n throw new Error(\"beginEdit is not supported in this runtime\");\n }),\n startDictation: runtime.startDictation,\n stopDictation: runtime.stopDictation,\n setQuote: runtime.setQuote,\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n queueItem: () => {\n throw new Error(\"Queue is not supported in this runtime\");\n },\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","import {\n ExtractResourceReturnType,\n RenderResult,\n ResourceElement,\n ResourceFiber,\n} from \"../core/types\";\nimport { tapEffect } from \"./tap-effect\";\nimport { tapMemo } from \"./tap-memo\";\nimport { tapCallback } from \"./tap-callback\";\nimport {\n createResourceFiber,\n unmountResourceFiber,\n renderResourceFiber,\n commitResourceFiber,\n} from \"../core/ResourceFiber\";\nimport { tapConst } from \"./tap-const\";\nimport { tapRef } from \"./tap-ref\";\nimport { getCurrentResourceFiber } from \"../core/helpers/execution-context\";\n\ntype FiberState = {\n fiber: ResourceFiber<unknown, unknown>;\n next:\n | RenderResult\n | [ResourceFiber<unknown, unknown>, RenderResult]\n | \"delete\";\n};\n\nexport function tapResources<E extends ResourceElement<any, any>>(\n getElements: () => readonly E[],\n getElementsDeps?: readonly unknown[],\n): ExtractResourceReturnType<E>[] {\n const versionRef = tapRef(0);\n const version = versionRef.current;\n\n const parentFiber = tapConst(getCurrentResourceFiber, []);\n const markDirty = tapConst(\n () => () => {\n versionRef.current++;\n parentFiber.markDirty?.();\n },\n [],\n );\n const fibers = tapConst(() => new Map<string | number, FiberState>(), []);\n\n const getElementsMemo = getElementsDeps\n ? // biome-ignore lint/correctness/useExhaustiveDependencies: library code\n tapCallback(getElements, getElementsDeps)\n : getElements;\n\n // Process each element\n\n const res = tapMemo(() => {\n void version;\n\n const elementsArray = getElementsMemo();\n const seenKeys = new Set<string | number>();\n const results: any[] = [];\n let newCount = 0;\n\n // Create/update fibers and render\n for (let i = 0; i < elementsArray.length; i++) {\n const element = elementsArray[i]!;\n\n const elementKey = element.key;\n if (elementKey === undefined) {\n throw new Error(\n `tapResources did not provide a key for array at index ${i}`,\n );\n }\n\n if (seenKeys.has(elementKey))\n throw new Error(`Duplicate key ${elementKey} in tapResources`);\n seenKeys.add(elementKey);\n\n let state = fibers.get(elementKey);\n if (!state) {\n const fiber = createResourceFiber(\n element.type,\n parentFiber.root,\n markDirty,\n );\n const result = renderResourceFiber(fiber, element.props);\n state = {\n fiber,\n next: result,\n };\n newCount++;\n fibers.set(elementKey, state);\n results.push(result.output);\n } else if (state.fiber.type !== element.type) {\n const fiber = createResourceFiber(\n element.type,\n parentFiber.root,\n markDirty,\n );\n const result = renderResourceFiber(fiber, element.props);\n state.next = [fiber, result];\n results.push(result.output);\n } else {\n state.next = renderResourceFiber(state.fiber, element.props);\n results.push(state.next.output);\n }\n }\n\n // Clean up removed fibers (only if there might be stale ones)\n if (fibers.size > results.length - newCount) {\n for (const key of fibers.keys()) {\n if (!seenKeys.has(key)) {\n fibers.get(key)!.next = \"delete\";\n }\n }\n }\n\n return results;\n }, [getElementsMemo, version]);\n\n // Cleanup on unmount\n tapEffect(() => {\n return () => {\n for (const key of fibers.keys()) {\n const fiber = fibers.get(key)!.fiber;\n unmountResourceFiber(fiber);\n }\n };\n }, []);\n\n tapEffect(() => {\n res; // as a performance optimization, we only run if the results have changed\n\n for (const [key, state] of fibers.entries()) {\n if (state.next === \"delete\") {\n if (state.fiber.isMounted) {\n unmountResourceFiber(state.fiber);\n }\n\n fibers.delete(key);\n } else if (Array.isArray(state.next)) {\n unmountResourceFiber(state.fiber);\n state.fiber = state.next[0];\n commitResourceFiber(state.fiber, state.next[1]);\n } else {\n commitResourceFiber(state.fiber, state.next);\n }\n }\n }, [res]);\n\n return res;\n}\n","import { resource } from \"@assistant-ui/tap\";\nimport { type ClientOutput } from \"@assistant-ui/store\";\nimport { MessagePartRuntime } from \"../../runtime/api/message-part-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nexport const MessagePartClient = resource(\n ({ runtime }: { runtime: MessagePartRuntime }): ClientOutput<\"part\"> => {\n const state = tapSubscribable(runtime);\n\n return {\n getState: () => state,\n addToolResult: (result) => runtime.addToolResult(result),\n resumeToolCall: (payload) => runtime.resumeToolCall(payload),\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","import { tapRef } from \"./tap-ref\";\nimport { tapEffect } from \"./tap-effect\";\nimport { isDevelopment } from \"../core/helpers/env\";\nimport { tapCallback } from \"./tap-callback\";\nimport { getCurrentResourceFiber } from \"../core/helpers/execution-context\";\n\n/**\n * Creates a stable function reference that always calls the most recent version of the callback.\n * Similar to React's useEffectEvent hook.\n *\n * @param callback - The callback function to wrap\n * @returns A stable function reference that always calls the latest callback\n *\n * @example\n * ```typescript\n * const handleClick = tapEffectEvent((value: string) => {\n * console.log(value);\n * });\n * // handleClick reference is stable, but always calls the latest version\n * ```\n */\nexport function tapEffectEvent<T extends (...args: any[]) => any>(\n callback: T,\n): T {\n const callbackRef = tapRef(callback);\n\n // TODO this effect needs to run before all userland effects\n tapEffect(() => {\n callbackRef.current = callback;\n });\n\n if (isDevelopment) {\n const fiber = getCurrentResourceFiber();\n return tapCallback(\n ((...args: Parameters<T>) => {\n if (fiber.renderContext)\n throw new Error(\"tapEffectEvent cannot be called during render\");\n return callbackRef.current(...args);\n }) as T,\n [fiber],\n );\n }\n\n return callbackRef.current;\n}\n","import React, { createContext, useContext } from \"react\";\nimport type { AssistantClient, AssistantClientAccessor } from \"../types/client\";\nimport {\n createProxiedAssistantState,\n PROXIED_ASSISTANT_STATE_SYMBOL,\n} from \"./proxied-assistant-state\";\nimport { BaseProxyHandler, handleIntrospectionProp } from \"./BaseProxyHandler\";\n\nconst NO_OP_SUBSCRIBE = () => () => {};\n\nconst createErrorClientField = (\n message: string,\n): AssistantClientAccessor<never> => {\n const fn = (() => {\n throw new Error(message);\n }) as AssistantClientAccessor<never>;\n fn.source = null;\n fn.query = null;\n return fn;\n};\n\nclass DefaultAssistantClientProxyHandler\n extends BaseProxyHandler\n implements ProxyHandler<AssistantClient>\n{\n get(_: unknown, prop: string | symbol) {\n if (prop === \"subscribe\") return NO_OP_SUBSCRIBE;\n if (prop === \"on\") return NO_OP_SUBSCRIBE;\n if (prop === PROXIED_ASSISTANT_STATE_SYMBOL)\n return DefaultAssistantClientProxiedAssistantState;\n const introspection = handleIntrospectionProp(\n prop,\n \"DefaultAssistantClient\",\n );\n if (introspection !== false) return introspection;\n return createErrorClientField(\n \"You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.\",\n );\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return [\"subscribe\", \"on\", PROXIED_ASSISTANT_STATE_SYMBOL];\n }\n\n has(_: unknown, prop: string | symbol): boolean {\n return (\n prop === \"subscribe\" ||\n prop === \"on\" ||\n prop === PROXIED_ASSISTANT_STATE_SYMBOL\n );\n }\n}\n/** Default context value - throws \"wrap in AuiProvider\" error */\nexport const DefaultAssistantClient: AssistantClient =\n new Proxy<AssistantClient>(\n {} as AssistantClient,\n new DefaultAssistantClientProxyHandler(),\n );\n\nconst DefaultAssistantClientProxiedAssistantState = createProxiedAssistantState(\n DefaultAssistantClient,\n);\n\n/** Root prototype for created clients - throws \"scope not defined\" error */\nexport const createRootAssistantClient = (): AssistantClient =>\n new Proxy<AssistantClient>({} as AssistantClient, {\n get(_: AssistantClient, prop: string | symbol) {\n const introspection = handleIntrospectionProp(prop, \"AssistantClient\");\n if (introspection !== false) return introspection;\n\n return createErrorClientField(\n `The current scope does not have a \"${String(prop)}\" property.`,\n );\n },\n });\n\n/**\n * React Context for the AssistantClient\n */\nconst AssistantContext = createContext<AssistantClient>(DefaultAssistantClient);\n\nexport const useAssistantContextValue = (): AssistantClient => {\n return useContext(AssistantContext);\n};\n\n/**\n * Provider component for AssistantClient\n *\n * @example\n * ```typescript\n * <AuiProvider value={aui}>\n * <YourApp />\n * </AuiProvider>\n * ```\n */\nexport const AuiProvider = ({\n value,\n children,\n}: {\n value: AssistantClient;\n children: React.ReactNode;\n}): React.ReactElement => {\n return (\n <AssistantContext.Provider value={value}>\n {children}\n </AssistantContext.Provider>\n );\n};\n","import {\n withKey,\n resource,\n tapResource,\n tapMemo,\n tapState,\n type tapRef,\n} from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n tapClientLookup,\n tapClientResource,\n} from \"@assistant-ui/store\";\nimport { MessageRuntime } from \"../../runtime/api/message-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\nimport { ComposerClient } from \"./composer-runtime-client\";\nimport { MessagePartClient } from \"./message-part-runtime-client\";\nimport { MessageState } from \"../scopes/message\";\nimport { AttachmentRuntimeClient } from \"./attachment-runtime-client\";\n\nconst MessageAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n return tapResource(AttachmentRuntimeClient({ runtime: attachmentRuntime }));\n },\n);\n\nconst MessagePartByIndex = resource(\n ({ runtime, index }: { runtime: MessageRuntime; index: number }) => {\n const partRuntime = tapMemo(\n () => runtime.getMessagePartByIndex(index),\n [runtime, index],\n );\n return tapResource(MessagePartClient({ runtime: partRuntime }));\n },\n);\n\nexport const MessageClient = resource(\n ({\n runtime,\n threadIdRef,\n }: {\n runtime: MessageRuntime;\n threadIdRef: tapRef.RefObject<string>;\n }): ClientOutput<\"message\"> => {\n const runtimeState = tapSubscribable(runtime);\n\n const [isCopiedState, setIsCopied] = tapState(false);\n const [isHoveringState, setIsHovering] = tapState(false);\n\n const messageIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState().id;\n },\n }),\n [runtime],\n );\n\n const composer = tapClientResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n messageIdRef,\n }),\n );\n const parts = tapClientLookup(\n () =>\n runtimeState.content.map((part, idx) =>\n withKey(\n \"toolCallId\" in part && part.toolCallId != null\n ? `toolCallId-${part.toolCallId}`\n : `index-${idx}`,\n MessagePartByIndex({ runtime, index: idx }),\n ),\n ),\n [runtimeState.content, runtime],\n );\n\n const attachments = tapClientLookup(\n () =>\n (runtimeState.attachments ?? []).map((attachment, idx) =>\n withKey(\n attachment.id,\n MessageAttachmentClientByIndex({ runtime, index: idx }),\n ),\n ),\n [runtimeState.attachments, runtime],\n );\n\n const state = tapMemo<MessageState>(() => {\n return {\n ...(runtimeState as MessageState),\n\n parts: parts.state,\n composer: composer.state,\n\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n runtimeState,\n parts.state,\n composer.state,\n isCopiedState,\n isHoveringState,\n ]);\n\n return {\n getState: () => state,\n\n composer: () => composer.methods,\n\n reload: (config) => runtime.reload(config),\n speak: () => runtime.speak(),\n stopSpeaking: () => runtime.stopSpeaking(),\n submitFeedback: (feedback) => runtime.submitFeedback(feedback),\n switchToBranch: (options) => runtime.switchToBranch(options),\n getCopyText: () => runtime.unstable_getCopyText(),\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.get({ index: selector.index });\n } else {\n return parts.get({ key: `toolCallId-${selector.toolCallId}` });\n }\n },\n\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n\n setIsCopied,\n setIsHovering,\n\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","\"use client\";\n\nimport { useResource } from \"@assistant-ui/tap/react\";\nimport {\n resource,\n tapMemo,\n tapResources,\n tapEffectEvent,\n tapEffect,\n tapRef,\n tapResource,\n withKey,\n tapResourceRoot,\n} from \"@assistant-ui/tap\";\nimport type {\n AssistantClient,\n AssistantClientAccessor,\n ClientNames,\n ClientElement,\n ClientMeta,\n} from \"./types/client\";\nimport { Derived, DerivedElement } from \"./Derived\";\nimport {\n useAssistantContextValue,\n DefaultAssistantClient,\n createRootAssistantClient,\n} from \"./utils/react-assistant-context\";\nimport {\n DerivedClients,\n RootClients,\n tapSplitClients,\n} from \"./utils/splitClients\";\nimport {\n normalizeEventSelector,\n type AssistantEventName,\n type AssistantEventCallback,\n type AssistantEventSelector,\n} from \"./types/events\";\nimport { NotificationManager } from \"./utils/NotificationManager\";\nimport { withAssistantTapContextProvider } from \"./utils/tap-assistant-context\";\nimport { tapClientResource } from \"./tapClientResource\";\nimport { getClientIndex } from \"./utils/tap-client-stack-context\";\nimport {\n PROXIED_ASSISTANT_STATE_SYMBOL,\n createProxiedAssistantState,\n} from \"./utils/proxied-assistant-state\";\n\nconst tapShallowMemoArray = <T>(array: readonly T[]) => {\n // biome-ignore lint/correctness/useExhaustiveDependencies: shallow memo\n return tapMemo(() => array, array);\n};\n\nconst RootClientResource = resource(\n <K extends ClientNames>({\n element,\n emit,\n clientRef,\n }: {\n element: ClientElement<K>;\n emit: NotificationManager[\"emit\"];\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n }) => {\n const { methods, state } = withAssistantTapContextProvider(\n { clientRef, emit },\n () => tapClientResource(element),\n );\n return tapMemo(() => ({ state, methods }), [methods, state]);\n },\n);\n\nconst RootClientAccessorResource = resource(\n <K extends ClientNames>({\n element,\n notifications,\n clientRef,\n name,\n }: {\n element: ClientElement<K>;\n notifications: NotificationManager;\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n name: K;\n }): AssistantClientAccessor<K> => {\n const store = tapResourceRoot(\n RootClientResource({ element, emit: notifications.emit, clientRef }),\n );\n\n tapEffect(() => {\n return store.subscribe(notifications.notifySubscribers);\n }, [store, notifications]);\n\n return tapMemo(() => {\n const clientFunction = () => store.getValue().methods;\n Object.defineProperties(clientFunction, {\n source: {\n value: \"root\" as const,\n writable: false,\n },\n query: {\n value: {} as Record<string, never>,\n writable: false,\n },\n name: {\n value: name,\n configurable: true,\n },\n });\n return clientFunction as AssistantClientAccessor<K>;\n }, [store, name]);\n },\n);\n\nconst NoOpRootClientsAccessorsResource = resource(() => {\n return tapMemo(\n () => ({\n clients: [] as AssistantClientAccessor<ClientNames>[],\n subscribe: undefined,\n on: undefined,\n }),\n [],\n );\n});\n\nconst RootClientsAccessorsResource = resource(\n ({\n clients: inputClients,\n clientRef,\n }: {\n clients: RootClients;\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n }) => {\n const notifications = tapResource(NotificationManager());\n\n tapEffect(\n () => clientRef.parent.subscribe(notifications.notifySubscribers),\n [clientRef, notifications],\n );\n\n const results = tapShallowMemoArray(\n tapResources(\n () =>\n Object.keys(inputClients).map((key) =>\n withKey(\n key,\n RootClientAccessorResource({\n element: inputClients[key as keyof typeof inputClients]!,\n notifications,\n clientRef,\n name: key as keyof typeof inputClients,\n }),\n ),\n ),\n [inputClients, notifications, clientRef],\n ),\n );\n\n return tapMemo(() => {\n return {\n clients: results,\n subscribe: notifications.subscribe,\n on: function <TEvent extends AssistantEventName>(\n this: AssistantClient,\n selector: AssistantEventSelector<TEvent>,\n callback: AssistantEventCallback<TEvent>,\n ) {\n if (!this) {\n throw new Error(\n \"const { on } = useAui() is not supported. Use aui.on() instead.\",\n );\n }\n\n const { scope, event } = normalizeEventSelector(selector);\n\n if (scope !== \"*\") {\n const source = this[scope as ClientNames].source;\n if (source === null) {\n throw new Error(\n `Scope \"${scope}\" is not available. Use { scope: \"*\", event: \"${event}\" } to listen globally.`,\n );\n }\n }\n\n const localUnsub = notifications.on(event, (payload, clientStack) => {\n if (scope === \"*\") {\n callback(payload);\n return;\n }\n\n const scopeClient = this[scope as ClientNames]();\n const index = getClientIndex(scopeClient);\n if (scopeClient === clientStack[index]) {\n callback(payload);\n }\n });\n if (\n scope !== \"*\" &&\n clientRef.parent[scope as ClientNames].source === null\n )\n return localUnsub;\n\n const parentUnsub = clientRef.parent.on(selector, callback);\n\n return () => {\n localUnsub();\n parentUnsub();\n };\n },\n };\n }, [results, notifications, clientRef]);\n },\n);\n\ntype MetaMemo<K extends ClientNames> = {\n meta?: ClientMeta<K>;\n dep?: unknown;\n};\n\nconst getMeta = <K extends ClientNames>(\n props: Derived.Props<K>,\n clientRef: { parent: AssistantClient; current: AssistantClient | null },\n memo: MetaMemo<K>,\n): ClientMeta<K> => {\n if (\"source\" in props && \"query\" in props) return props;\n if (memo.dep === props) return memo.meta!;\n const meta = props.getMeta(clientRef.current!);\n memo.meta = meta;\n memo.dep = props;\n return meta;\n};\n\nconst DerivedClientAccessorResource = resource(\n <K extends ClientNames>({\n element,\n clientRef,\n name,\n }: {\n element: DerivedElement<K>;\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n name: K;\n }) => {\n const get = tapEffectEvent(() => element.props);\n\n return tapMemo(() => {\n const clientFunction = () => get().get(clientRef.current!);\n const metaMemo = {};\n Object.defineProperties(clientFunction, {\n source: {\n get: () => getMeta(get(), clientRef, metaMemo).source,\n },\n query: {\n get: () => getMeta(get(), clientRef, metaMemo).query,\n },\n name: {\n value: name,\n configurable: true,\n },\n });\n return clientFunction as AssistantClientAccessor<K>;\n }, [clientRef, name]);\n },\n);\n\nconst DerivedClientsAccessorsResource = resource(\n ({\n clients,\n clientRef,\n }: {\n clients: DerivedClients;\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n }) => {\n return tapShallowMemoArray(\n tapResources(\n () =>\n Object.keys(clients).map((key) =>\n withKey(\n key,\n DerivedClientAccessorResource({\n element: clients[key as keyof typeof clients]!,\n clientRef,\n name: key as keyof typeof clients,\n }),\n ),\n ),\n [clients, clientRef],\n ),\n );\n },\n);\n\n/**\n * Resource that creates an extended AssistantClient.\n */\nexport const AssistantClientResource = resource(\n ({\n parent,\n clients,\n }: {\n parent: AssistantClient;\n clients: useAui.Props;\n }): AssistantClient => {\n const { rootClients, derivedClients } = tapSplitClients(clients, parent);\n\n const clientRef = tapRef({\n parent: parent,\n current: null as AssistantClient | null,\n }).current;\n\n tapEffect(() => {\n // if (clientRef.current && clientRef.current !== client)\n // throw new Error(\"clientRef.current !== client\");\n\n clientRef.current = client;\n });\n\n const rootFields = tapResource(\n Object.keys(rootClients).length > 0\n ? RootClientsAccessorsResource({ clients: rootClients, clientRef })\n : NoOpRootClientsAccessorsResource(),\n );\n\n const derivedFields = tapResource(\n DerivedClientsAccessorsResource({ clients: derivedClients, clientRef }),\n );\n\n const client = tapMemo(() => {\n // Swap DefaultAssistantClient -> createRootAssistantClient at root to change error message\n const proto =\n parent === DefaultAssistantClient\n ? createRootAssistantClient()\n : parent;\n\n const client = Object.create(proto) as AssistantClient;\n Object.assign(client, {\n subscribe: rootFields.subscribe ?? parent.subscribe,\n on: rootFields.on ?? parent.on,\n [PROXIED_ASSISTANT_STATE_SYMBOL]: createProxiedAssistantState(client),\n });\n\n for (const field of rootFields.clients) {\n (client as any)[field.name] = field;\n }\n for (const field of derivedFields) {\n (client as any)[field.name] = field;\n }\n\n return client;\n }, [parent, rootFields, derivedFields]);\n\n if (clientRef.current === null) {\n clientRef.current = client;\n }\n\n return client;\n },\n);\n\nexport namespace useAui {\n export type Props = {\n [K in ClientNames]?: ClientElement<K> | DerivedElement<K>;\n };\n}\n\nexport function useAui(): AssistantClient;\nexport function useAui(clients: useAui.Props): AssistantClient;\nexport function useAui(\n clients: useAui.Props,\n config: { parent: null | AssistantClient },\n): AssistantClient;\n/** @deprecated This API is highly experimental and may be changed in a minor release */\nexport function useAui(\n clients?: useAui.Props,\n { parent }: { parent: null | AssistantClient } = {\n parent: useAssistantContextValue(),\n },\n): AssistantClient {\n if (clients) {\n return useResource(\n AssistantClientResource({\n parent: parent ?? DefaultAssistantClient,\n clients,\n }),\n );\n }\n if (parent === null)\n throw new Error(\"received null parent, this usage is not allowed\");\n return parent;\n}\n","import { Derived, DerivedElement } from \"../Derived\";\nimport type {\n AssistantClient,\n ClientElement,\n ClientNames,\n} from \"../types/client\";\nimport { getTransformScopes } from \"../attachTransformScopes\";\nimport type { useAui } from \"../useAui\";\nimport { tapMemo } from \"@assistant-ui/tap\";\n\nexport type RootClients = Partial<\n Record<ClientNames, ClientElement<ClientNames>>\n>;\nexport type DerivedClients = Partial<\n Record<ClientNames, DerivedElement<ClientNames>>\n>;\n\n/**\n * Splits a clients object into root clients and derived clients,\n * applying transformScopes from root client elements.\n */\nfunction splitClients(clients: useAui.Props, baseClient: AssistantClient) {\n // 1. Collect transforms from root elements and run them iteratively\n const scopes = { ...clients } as Record<\n string,\n ClientElement<ClientNames> | DerivedElement<ClientNames>\n >;\n const visited = new Set<(...args: any[]) => any>();\n\n let changed = true;\n while (changed) {\n changed = false;\n for (const clientElement of Object.values(scopes)) {\n if (clientElement.type === (Derived as unknown)) continue;\n if (visited.has(clientElement.type)) continue;\n visited.add(clientElement.type);\n\n const transform = getTransformScopes(clientElement.type);\n if (transform) {\n transform(scopes, baseClient);\n changed = true;\n break; // restart iteration since scopes may have new root elements\n }\n }\n }\n\n // 2. Split result into root/derived\n const rootClients: RootClients = {};\n const derivedClients: DerivedClients = {};\n\n for (const [key, clientElement] of Object.entries(scopes) as [\n ClientNames,\n ClientElement<ClientNames> | DerivedElement<ClientNames>,\n ][]) {\n if (clientElement.type === (Derived as unknown)) {\n derivedClients[key] = clientElement as DerivedElement<ClientNames>;\n } else {\n rootClients[key] = clientElement as ClientElement<ClientNames>;\n }\n }\n\n return { rootClients, derivedClients };\n}\n\nconst tapShallowMemoObject = <T extends object>(object: T) => {\n // biome-ignore lint/correctness/useExhaustiveDependencies: shallow memo\n return tapMemo(() => object, [...Object.entries(object).flat()]);\n};\n\nexport const tapSplitClients = (\n clients: useAui.Props,\n baseClient: AssistantClient,\n) => {\n const { rootClients, derivedClients } = splitClients(clients, baseClient);\n\n return {\n rootClients: tapShallowMemoObject(rootClients),\n derivedClients: tapShallowMemoObject(derivedClients),\n };\n};\n","import { ExtractResourceReturnType, ResourceElement } from \"../core/types\";\nimport { tapEffect } from \"./tap-effect\";\nimport {\n createResourceFiber,\n unmountResourceFiber,\n renderResourceFiber,\n commitResourceFiber,\n} from \"../core/ResourceFiber\";\nimport { tapMemo } from \"./tap-memo\";\nimport { tapRef } from \"./tap-ref\";\nimport { getCurrentResourceFiber } from \"../core/helpers/execution-context\";\n\nexport function tapResource<E extends ResourceElement<any, any>>(\n element: E,\n): ExtractResourceReturnType<E>;\nexport function tapResource<E extends ResourceElement<any, any>>(\n element: E,\n propsDeps: readonly unknown[],\n): ExtractResourceReturnType<E>;\nexport function tapResource<E extends ResourceElement<any, any>>(\n element: E,\n propsDeps?: readonly unknown[],\n): ExtractResourceReturnType<E> {\n const parentFiber = getCurrentResourceFiber();\n const versionRef = tapRef(0);\n const fiber = tapMemo(() => {\n void element.key;\n return createResourceFiber(element.type, parentFiber.root, () => {\n versionRef.current++;\n parentFiber.markDirty?.();\n });\n }, [element.type, element.key, parentFiber]);\n\n const result = propsDeps\n ? // biome-ignore lint/correctness/useExhaustiveDependencies: user provided deps instead of prop identity\n tapMemo(\n () => renderResourceFiber(fiber, element.props),\n [fiber, ...propsDeps, versionRef.current],\n )\n : renderResourceFiber(fiber, element.props);\n\n tapEffect(() => () => unmountResourceFiber(fiber), [fiber]);\n tapEffect(() => {\n commitResourceFiber(fiber, result);\n }, [fiber, result]);\n\n return result.output;\n}\n","import {\n tapEffect,\n tapMemo,\n tapRef,\n type ResourceElement,\n tapResource,\n} from \"@assistant-ui/tap\";\nimport type { ClientMethods } from \"./types/client\";\nimport {\n tapClientStack,\n tapWithClientStack,\n SYMBOL_CLIENT_INDEX,\n} from \"./utils/tap-client-stack-context\";\nimport {\n BaseProxyHandler,\n handleIntrospectionProp,\n} from \"./utils/BaseProxyHandler\";\nimport { wrapperResource } from \"./wrapperResource\";\n\n/**\n * Symbol used internally to get state from ClientProxy.\n * This allows getState() to be optional in the user-facing client.\n */\nconst SYMBOL_GET_OUTPUT = Symbol(\"assistant-ui.store.getValue\");\n\ntype ClientInternal = {\n [SYMBOL_GET_OUTPUT]: ClientMethods;\n};\n\nexport const getClientState = (client: ClientMethods) => {\n const output = (client as unknown as ClientInternal)[SYMBOL_GET_OUTPUT];\n if (!output) {\n throw new Error(\n \"Client scope contains a non-client resource. \" +\n \"Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.\",\n );\n }\n return (output as any).getState?.();\n};\n\n// Global cache for function templates by field name\nconst fieldAccessFns = new Map<\n string | symbol,\n (this: unknown, ...args: unknown[]) => unknown\n>();\n\nfunction getOrCreateProxyFn(prop: string | symbol) {\n let template = fieldAccessFns.get(prop);\n if (!template) {\n template = function (this: unknown, ...args: unknown[]) {\n if (!this || typeof this !== \"object\") {\n throw new Error(\n `Method \"${String(prop)}\" called without proper context. ` +\n `This may indicate the function was called incorrectly.`,\n );\n }\n\n const output = (this as ClientInternal)[SYMBOL_GET_OUTPUT];\n if (!output) {\n throw new Error(\n `Method \"${String(prop)}\" called on invalid client proxy. ` +\n `Ensure you are calling this method on a valid client instance.`,\n );\n }\n\n const method = output[prop];\n if (!method)\n throw new Error(`Method \"${String(prop)}\" is not implemented.`);\n if (typeof method !== \"function\")\n throw new Error(`\"${String(prop)}\" is not a function.`);\n return method(...args);\n };\n fieldAccessFns.set(prop, template);\n }\n return template;\n}\n\nclass ClientProxyHandler\n extends BaseProxyHandler\n implements ProxyHandler<object>\n{\n private boundFns: Map<string | symbol, Function> | undefined;\n private cachedReceiver: unknown;\n\n constructor(\n private readonly outputRef: {\n current: ClientMethods;\n },\n private readonly index: number,\n ) {\n super();\n }\n\n get(_: unknown, prop: string | symbol, receiver: unknown) {\n if (prop === SYMBOL_GET_OUTPUT) return this.outputRef.current;\n if (prop === SYMBOL_CLIENT_INDEX) return this.index;\n const introspection = handleIntrospectionProp(prop, \"ClientProxy\");\n if (introspection !== false) return introspection;\n const value = this.outputRef.current[prop];\n if (typeof value === \"function\") {\n if (this.cachedReceiver !== receiver) {\n this.boundFns = new Map();\n this.cachedReceiver = receiver;\n }\n let bound = this.boundFns!.get(prop);\n if (!bound) {\n bound = getOrCreateProxyFn(prop).bind(receiver);\n this.boundFns!.set(prop, bound);\n }\n return bound;\n }\n return value;\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return Object.keys(this.outputRef.current);\n }\n\n has(_: unknown, prop: string | symbol) {\n if (prop === SYMBOL_GET_OUTPUT) return true;\n if (prop === SYMBOL_CLIENT_INDEX) return true;\n return prop in this.outputRef.current;\n }\n}\n\n/**\n * Resource that wraps a plain resource element to create a stable client proxy.\n *\n * Takes a ResourceElement that returns methods (with optional getState()) and\n * wraps it to produce a stable client proxy. This adds the client to the\n * client stack, enabling event scoping.\n *\n * @internal\n */\nexport const ClientResource = wrapperResource(\n <TMethods extends ClientMethods>(\n element: ResourceElement<TMethods>,\n ): {\n methods: TMethods;\n state: unknown;\n key: string | number | undefined;\n } => {\n const valueRef = tapRef(null as unknown as TMethods);\n\n const index = tapClientStack().length;\n const methods = tapMemo(\n () =>\n new Proxy<TMethods>(\n {} as TMethods,\n new ClientProxyHandler(valueRef, index),\n ),\n [index],\n );\n\n const value = tapWithClientStack(methods, () => tapResource(element));\n if (!valueRef.current) {\n valueRef.current = value;\n }\n\n tapEffect(() => {\n valueRef.current = value;\n });\n\n const state = (value as any).getState?.();\n return { methods, state, key: element.key };\n },\n);\n\ntype InferClientState<TMethods> = TMethods extends {\n getState: () => infer S;\n}\n ? S\n : undefined;\n\nexport const tapClientResource = <TMethods extends ClientMethods>(\n element: ResourceElement<TMethods>,\n): {\n state: InferClientState<TMethods>;\n methods: TMethods;\n key: string | number | undefined;\n} => {\n return tapResource(ClientResource(element)) as {\n state: InferClientState<TMethods>;\n methods: TMethods;\n key: string | number | undefined;\n };\n};\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport { ThreadRuntimeEventType } from \"../../runtime/interfaces/thread-runtime-core\";\nimport { ThreadRuntime } from \"../../runtime/api/thread-runtime\";\nimport {\n resource,\n tapResource,\n tapMemo,\n tapEffect,\n type tapRef,\n withKey,\n} from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n tapAssistantEmit,\n tapClientLookup,\n tapClientResource,\n} from \"@assistant-ui/store\";\nimport { ComposerClient } from \"./composer-runtime-client\";\nimport { MessageClient } from \"./message-runtime-client\";\nimport { tapSubscribable } from \"./tap-subscribable\";\nimport { ThreadState } from \"../scopes/thread\";\n\nconst MessageClientById = resource(\n ({\n runtime,\n id,\n threadIdRef,\n }: {\n runtime: ThreadRuntime;\n id: string;\n threadIdRef: tapRef.RefObject<string>;\n }) => {\n const messageRuntime = tapMemo(\n () => runtime.getMessageById(id),\n [runtime, id],\n );\n\n return tapResource(MessageClient({ runtime: messageRuntime, threadIdRef }));\n },\n);\n\nexport const ThreadClient = resource(\n ({ runtime }: { runtime: ThreadRuntime }): ClientOutput<\"thread\"> => {\n const runtimeState = tapSubscribable(runtime);\n const emit = tapAssistantEmit();\n\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n const threadEvents: ThreadRuntimeEventType[] = [\n \"runStart\",\n \"runEnd\",\n \"initialize\",\n \"modelContextUpdate\",\n ];\n\n for (const event of threadEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n const threadId = runtime.getState()?.threadId || \"unknown\";\n emit(`thread.${event}`, {\n threadId,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, emit]);\n\n const threadIdRef = tapMemo(\n () => ({\n get current() {\n return runtime.getState()!.threadId;\n },\n }),\n [runtime],\n );\n\n const composer = tapClientResource(\n ComposerClient({\n runtime: runtime.composer,\n threadIdRef,\n }),\n );\n const messages = tapClientLookup(\n () =>\n runtimeState.messages.map((m) =>\n withKey(m.id, MessageClientById({ runtime, id: m.id, threadIdRef })),\n ),\n [runtimeState.messages, runtime, threadIdRef],\n );\n\n const state = tapMemo<ThreadState>(() => {\n return {\n isEmpty: messages.state.length === 0 && !runtimeState.isLoading,\n isDisabled: runtimeState.isDisabled,\n isLoading: runtimeState.isLoading,\n isRunning: runtimeState.isRunning,\n capabilities: runtimeState.capabilities,\n state: runtimeState.state,\n suggestions: runtimeState.suggestions,\n extras: runtimeState.extras,\n speech: runtimeState.speech,\n voice: runtimeState.voice,\n\n composer: composer.state,\n messages: messages.state,\n };\n }, [runtimeState, messages, composer.state]);\n\n return {\n getState: () => state,\n composer: () => composer.methods,\n append: runtime.append,\n startRun: runtime.startRun,\n resumeRun: runtime.resumeRun,\n unstable_resumeRun: runtime.resumeRun,\n cancelRun: runtime.cancelRun,\n getModelContext: runtime.getModelContext,\n export: runtime.export,\n import: runtime.import,\n reset: runtime.reset,\n stopSpeaking: runtime.stopSpeaking,\n connectVoice: runtime.connectVoice,\n disconnectVoice: runtime.disconnectVoice,\n getVoiceVolume: runtime.getVoiceVolume,\n subscribeVoiceVolume: runtime.subscribeVoiceVolume,\n muteVoice: runtime.muteVoice,\n unmuteVoice: runtime.unmuteVoice,\n message: (selector) => {\n if (\"id\" in selector) {\n return messages.get({ key: selector.id });\n } else {\n return messages.get(selector);\n }\n },\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","import { withKey, resource, tapResource, tapMemo } from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n tapClientLookup,\n tapClientResource,\n} from \"@assistant-ui/store\";\nimport { ThreadListRuntime } from \"../../runtime/api/thread-list-runtime\";\nimport { AssistantRuntime } from \"../../runtime/api/assistant-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\nimport { ThreadListItemClient } from \"./thread-list-item-runtime-client\";\nimport { ThreadClient } from \"./thread-runtime-client\";\nimport { ThreadsState } from \"../scopes/threads\";\n\nconst ThreadListItemClientById = resource(\n ({ runtime, id }: { runtime: ThreadListRuntime; id: string }) => {\n const threadListItemRuntime = tapMemo(\n () => runtime.getItemById(id),\n [runtime, id],\n );\n return tapResource(\n ThreadListItemClient({\n runtime: threadListItemRuntime,\n }),\n );\n },\n);\n\nexport const ThreadListClient = resource(\n ({\n runtime,\n __internal_assistantRuntime,\n }: {\n runtime: ThreadListRuntime;\n __internal_assistantRuntime: AssistantRuntime;\n }): ClientOutput<\"threads\"> => {\n const runtimeState = tapSubscribable(runtime);\n\n const main = tapClientResource(\n ThreadClient({\n runtime: runtime.main,\n }),\n );\n const threadItems = tapClientLookup(\n () =>\n Object.keys(runtimeState.threadItems).map((id) =>\n withKey(id, ThreadListItemClientById({ runtime, id })),\n ),\n [runtimeState.threadItems, runtime],\n );\n\n const state = tapMemo<ThreadsState>(() => {\n return {\n mainThreadId: runtimeState.mainThreadId,\n newThreadId: runtimeState.newThreadId ?? null,\n isLoading: runtimeState.isLoading,\n threadIds: runtimeState.threadIds,\n archivedThreadIds: runtimeState.archivedThreadIds,\n threadItems: threadItems.state,\n\n main: main.state,\n };\n }, [runtimeState, threadItems.state, main.state]);\n\n return {\n getState: () => state,\n thread: () => main.methods,\n item: (threadIdOrOptions) => {\n if (threadIdOrOptions === \"main\") {\n return threadItems.get({ key: state.mainThreadId });\n }\n\n if (\"id\" in threadIdOrOptions) {\n return threadItems.get({ key: threadIdOrOptions.id });\n }\n\n const { index, archived = false } = threadIdOrOptions;\n const id = archived\n ? state.archivedThreadIds[index]!\n : state.threadIds[index]!;\n return threadItems.get({ key: id });\n },\n switchToThread: async (threadId) => {\n await runtime.switchToThread(threadId);\n },\n switchToNewThread: async () => {\n await runtime.switchToNewThread();\n },\n __internal_getAssistantRuntime: () => __internal_assistantRuntime,\n };\n },\n);\n","import { resource, tapState, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { tapClientLookup } from \"@assistant-ui/store\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst SuggestionClient = resource(\n (state: SuggestionState): ClientOutput<\"suggestion\"> => {\n return {\n getState: () => state,\n };\n },\n);\n\nconst SuggestionsResource = resource(\n (suggestions?: SuggestionConfig[]): ClientOutput<\"suggestions\"> => {\n const [state] = tapState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n const suggestionClients = tapClientLookup(\n () =>\n state.suggestions.map((suggestion, index) =>\n withKey(index, SuggestionClient(suggestion)),\n ),\n [state.suggestions],\n );\n\n return {\n getState: () => state,\n suggestion: ({ index }: { index: number }) => {\n return suggestionClients.get({ index });\n },\n };\n },\n);\n\nexport const Suggestions: {\n (): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n undefined\n >;\n (\n suggestions: SuggestionConfig[],\n ): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n SuggestionConfig[]\n >;\n} = SuggestionsResource as any;\n","import { resource } from \"@assistant-ui/tap\";\nimport type { ClientStack } from \"./tap-client-stack-context\";\nimport type {\n AssistantEventName,\n AssistantEventPayload,\n} from \"../types/events\";\nimport { Unsubscribe } from \"../types/client\";\nimport { tapConst } from \"@assistant-ui/tap\";\n\ntype InternalCallback = (payload: unknown, clientStack: ClientStack) => void;\n\nexport type NotificationManager = {\n on<TEvent extends AssistantEventName>(\n event: TEvent,\n callback: (\n payload: AssistantEventPayload[TEvent],\n clientStack: ClientStack,\n ) => void,\n ): Unsubscribe;\n emit<TEvent extends Exclude<AssistantEventName, \"*\">>(\n event: TEvent,\n payload: AssistantEventPayload[TEvent],\n clientStack: ClientStack,\n ): void;\n subscribe(callback: () => void): Unsubscribe;\n notifySubscribers(): void;\n};\n\nexport const NotificationManager = resource((): NotificationManager => {\n return tapConst(() => {\n const listeners = new Map<string, Set<InternalCallback>>();\n const wildcardListeners = new Set<InternalCallback>();\n const subscribers = new Set<() => void>();\n\n return {\n on(event, callback) {\n const cb = callback as InternalCallback;\n if (event === \"*\") {\n wildcardListeners.add(cb);\n return () => wildcardListeners.delete(cb);\n }\n\n let set = listeners.get(event);\n if (!set) {\n set = new Set();\n listeners.set(event, set);\n }\n set.add(cb);\n\n return () => {\n set!.delete(cb);\n if (set!.size === 0) listeners.delete(event);\n };\n },\n\n emit(event, payload, clientStack) {\n const eventListeners = listeners.get(event);\n if (!eventListeners && wildcardListeners.size === 0) return;\n\n queueMicrotask(() => {\n const errors = [];\n if (eventListeners) {\n for (const cb of eventListeners) {\n try {\n cb(payload, clientStack);\n } catch (e) {\n errors.push(e);\n }\n }\n }\n if (wildcardListeners.size > 0) {\n const wrapped = { event, payload };\n for (const cb of wildcardListeners) {\n try {\n cb(wrapped, clientStack);\n } catch (e) {\n errors.push(e);\n }\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(\n errors,\n \"Errors occurred during event emission\",\n );\n }\n }\n });\n },\n\n subscribe(callback) {\n subscribers.add(callback);\n return () => subscribers.delete(callback);\n },\n\n notifySubscribers() {\n for (const cb of subscribers) {\n try {\n cb();\n } catch (e) {\n console.error(\"NotificationManager: subscriber callback error\", e);\n }\n }\n },\n };\n }, []);\n});\n","import { useLayoutEffect, useMemo, useReducer, useRef, useState } from \"react\";\nimport {\n ResourceFiberRoot,\n type ExtractResourceReturnType,\n type ResourceElement,\n} from \"../core/types\";\nimport {\n createResourceFiber,\n unmountResourceFiber,\n renderResourceFiber,\n commitResourceFiber,\n} from \"../core/ResourceFiber\";\nimport { isDevelopment } from \"../core/helpers/env\";\nimport {\n commitRoot,\n createResourceFiberRoot,\n setRootVersion,\n} from \"../core/helpers/root\";\n\nconst useDevStrictMode = () => {\n if (!isDevelopment) return null;\n\n const count = useRef(0);\n const isFirstRender = count.current === 0;\n useState(() => count.current++);\n if (count.current !== 2) return null;\n return isFirstRender ? (\"child\" as const) : (\"root\" as const);\n};\n\nexport function useResource<E extends ResourceElement<any, any>>(\n element: E,\n): ExtractResourceReturnType<E> {\n const root = useMemo<ResourceFiberRoot>(() => {\n return createResourceFiberRoot((cb) => dispatch(cb));\n }, []);\n\n const [version, dispatch] = useReducer((v: number, cb: () => boolean) => {\n setRootVersion(root, v);\n return v + (cb() ? 1 : 0);\n }, 0);\n setRootVersion(root, version);\n\n const devStrictMode = useDevStrictMode();\n const fiber = useMemo(() => {\n void element.key;\n return createResourceFiber(element.type, root, undefined, devStrictMode);\n }, [element.type, element.key, root, devStrictMode]);\n\n const result = renderResourceFiber(fiber, element.props);\n useLayoutEffect(() => {\n return () => unmountResourceFiber(fiber);\n }, [fiber]);\n useLayoutEffect(() => {\n commitRoot(root);\n commitResourceFiber(fiber, result);\n });\n\n return result.output;\n}\n","import { resource, tapEffect, tapResource } from \"@assistant-ui/tap\";\nimport type { AssistantRuntime } from \"../../runtime/api/assistant-runtime\";\nimport { ThreadListClient } from \"../runtime-clients/thread-list-runtime-client\";\nimport {\n tapAssistantClientRef,\n Derived,\n type ScopesConfig,\n type AssistantClient,\n} from \"@assistant-ui/store\";\nimport { ModelContext } from \"./model-context-client\";\nimport { Suggestions } from \"./suggestions\";\n\nexport const RuntimeAdapterResource = resource((runtime: AssistantRuntime) => {\n const clientRef = tapAssistantClientRef();\n\n tapEffect(() => {\n return runtime.registerModelContextProvider(\n clientRef.current!.modelContext(),\n );\n }, [runtime, clientRef]);\n\n return tapResource(\n ThreadListClient({\n runtime: runtime.threads,\n __internal_assistantRuntime: runtime,\n }),\n );\n});\n\nexport const baseRuntimeAdapterTransformScopes = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n): void => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n};\n","import {\n commitResourceFiber,\n createResourceFiber,\n renderResourceFiber,\n unmountResourceFiber,\n} from \"./core/ResourceFiber\";\nimport { UpdateScheduler } from \"./core/scheduler\";\nimport { tapConst } from \"./hooks/tap-const\";\nimport { tapMemo } from \"./hooks/tap-memo\";\nimport { tapEffect } from \"./hooks/tap-effect\";\nimport { tapEffectEvent } from \"./hooks/tap-effect-event\";\nimport { tapRef } from \"./hooks/tap-ref\";\nimport { RenderResult, ResourceElement } from \"./core/types\";\nimport { isDevelopment } from \"./core/helpers/env\";\nimport {\n commitRoot,\n createResourceFiberRoot,\n setRootVersion,\n} from \"./core/helpers/root\";\n\nexport namespace tapResourceRoot {\n export type Unsubscribe = () => void;\n\n export interface SubscribableResource<TState> {\n /**\n * Get the current state of the store.\n */\n getValue(): TState;\n\n /**\n * Subscribe to the store.\n */\n subscribe(listener: () => void): Unsubscribe;\n }\n}\n\n// currently we never reset the root, because rollbakcs are not supported in tapResourceRoot\n\nexport const tapResourceRoot = <TState>(\n element: ResourceElement<TState>,\n): tapResourceRoot.SubscribableResource<TState> => {\n const scheduler = tapConst(\n () => new UpdateScheduler(() => handleUpdate(null)),\n [],\n );\n const queue = tapConst(() => [] as (() => void)[], []);\n\n const fiber = tapMemo(() => {\n void element.key;\n\n return createResourceFiber(\n element.type,\n createResourceFiberRoot((callback) => {\n if (!scheduler.isDirty && !callback()) return;\n queue.push(callback);\n scheduler.markDirty();\n }),\n );\n }, [element.type, element.key]);\n\n setRootVersion(fiber.root, fiber.root.committedVersion);\n const render = renderResourceFiber(fiber, element.props);\n\n const isMountedRef = tapRef(false);\n const committedPropsRef = tapRef(element.props);\n const valueRef = tapRef<TState>(render.output);\n const subscribers = tapConst(() => new Set<() => void>(), []);\n const handleUpdate = tapEffectEvent((render: RenderResult | null) => {\n if (render === null) {\n setRootVersion(fiber.root, 2);\n setRootVersion(fiber.root, 1);\n\n queue.forEach((callback) => {\n if (isDevelopment && fiber.devStrictMode) {\n callback();\n }\n\n callback();\n });\n\n if (isDevelopment && fiber.devStrictMode) {\n void renderResourceFiber(fiber, committedPropsRef.current);\n }\n\n render = renderResourceFiber(fiber, committedPropsRef.current);\n }\n\n if (scheduler.isDirty)\n throw new Error(\"Scheduler is dirty, this should never happen\");\n\n commitRoot(fiber.root);\n queue.length = 0;\n\n if (isMountedRef.current) {\n commitResourceFiber(fiber, render);\n }\n\n if (scheduler.isDirty || valueRef.current === render.output) return;\n valueRef.current = render.output;\n subscribers.forEach((callback) => callback());\n });\n\n tapEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n unmountResourceFiber(fiber);\n };\n }, [fiber]);\n\n tapEffect(() => {\n committedPropsRef.current = render.props;\n commitRoot(fiber.root);\n commitResourceFiber(fiber, render);\n\n if (scheduler.isDirty || valueRef.current === render.output) return;\n valueRef.current = render.output;\n subscribers.forEach((callback) => callback());\n });\n\n return tapMemo(\n () => ({\n getValue: () => valueRef.current,\n subscribe: (listener: () => void) => {\n subscribers.add(listener);\n return () => subscribers.delete(listener);\n },\n }),\n [],\n );\n};\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport { resource, tapEffect } from \"@assistant-ui/tap\";\nimport { type ClientOutput, tapAssistantEmit } from \"@assistant-ui/store\";\nimport {\n ThreadListItemEventType,\n ThreadListItemRuntime,\n} from \"../../runtime/api/thread-list-item-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nexport const ThreadListItemClient = resource(\n ({\n runtime,\n }: {\n runtime: ThreadListItemRuntime;\n }): ClientOutput<\"threadListItem\"> => {\n const state = tapSubscribable(runtime);\n const emit = tapAssistantEmit();\n\n // Bind thread list item events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to thread list item events\n const threadListItemEvents: ThreadListItemEventType[] = [\n \"switchedTo\",\n \"switchedAway\",\n ];\n\n for (const event of threadListItemEvents) {\n const unsubscribe = runtime.unstable_on(event, () => {\n emit(`threadListItem.${event}`, {\n threadId: runtime.getState()!.id,\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, emit]);\n\n return {\n getState: () => state,\n switchTo: runtime.switchTo,\n rename: runtime.rename,\n archive: runtime.archive,\n unarchive: runtime.unarchive,\n delete: runtime.delete,\n generateTitle: runtime.generateTitle,\n initialize: runtime.initialize,\n detach: runtime.detach,\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","import { resource, tapState, tapEffect, tapCallback } from \"@assistant-ui/tap\";\nimport {\n tapAssistantClientRef,\n type ClientOutput,\n attachTransformScopes,\n} from \"@assistant-ui/store\";\nimport { ToolsState } from \"../types/scopes/tools\";\nimport type { Tool } from \"assistant-stream\";\nimport { type Toolkit } from \"../model-context/toolbox\";\nimport { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\nimport { ModelContext } from \"../../store\";\n\nexport const Tools = resource(\n ({ toolkit }: { toolkit?: Toolkit }): ClientOutput<\"tools\"> => {\n const [state, setState] = tapState<ToolsState>(() => ({\n tools: {},\n }));\n\n const clientRef = tapAssistantClientRef();\n\n const setToolUI = tapCallback(\n (toolName: string, render: ToolCallMessagePartComponent) => {\n setState((prev) => {\n return {\n ...prev,\n tools: {\n ...prev.tools,\n [toolName]: [...(prev.tools[toolName] ?? []), render],\n },\n };\n });\n\n return () => {\n setState((prev) => {\n return {\n ...prev,\n tools: {\n ...prev.tools,\n [toolName]:\n prev.tools[toolName]?.filter((r) => r !== render) ?? [],\n },\n };\n });\n };\n },\n [],\n );\n\n tapEffect(() => {\n if (!toolkit) return;\n const unsubscribes: (() => void)[] = [];\n\n // Register tool UIs (exclude symbols)\n for (const [toolName, tool] of Object.entries(toolkit)) {\n if (tool.render) {\n unsubscribes.push(setToolUI(toolName, tool.render));\n }\n }\n\n // Register tools with model context (exclude symbols)\n const toolsWithoutRender = Object.entries(toolkit).reduce(\n (acc, [name, tool]) => {\n const { render, ...rest } = tool;\n acc[name] = rest;\n return acc;\n },\n {} as Record<string, Tool<any, any>>,\n );\n\n const modelContextProvider = {\n getModelContext: () => ({\n tools: toolsWithoutRender,\n }),\n };\n\n unsubscribes.push(\n clientRef.current!.modelContext().register(modelContextProvider),\n );\n\n return () => {\n unsubscribes.forEach((fn) => fn());\n };\n }, [toolkit, setToolUI, clientRef]);\n\n return {\n getState: () => state,\n setToolUI,\n };\n },\n);\n\nattachTransformScopes(Tools, (scopes, parent) => {\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n});\n","import { Cell } from \"../core/types\";\nimport { depsShallowEqual } from \"./utils/depsShallowEqual\";\nimport { tapHook, registerRenderMountTask } from \"./utils/tapHook\";\n\nconst newEffect = (): Cell & { type: \"effect\" } => ({\n type: \"effect\",\n cleanup: undefined,\n deps: null, // null means the effect has never been run\n});\n\nexport namespace tapEffect {\n export type Destructor = () => void;\n export type EffectCallback = () => void | Destructor;\n}\n\nexport function tapEffect(effect: tapEffect.EffectCallback): void;\nexport function tapEffect(\n effect: tapEffect.EffectCallback,\n deps: readonly unknown[],\n): void;\nexport function tapEffect(\n effect: tapEffect.EffectCallback,\n deps?: readonly unknown[],\n): void {\n const cell = tapHook(\"effect\", newEffect);\n\n if (deps && cell.deps && depsShallowEqual(cell.deps, deps)) return;\n if (cell.deps !== null && !!deps !== !!cell.deps)\n throw new Error(\n \"tapEffect called with and without dependencies across re-renders\",\n );\n\n registerRenderMountTask(() => {\n const errors: unknown[] = [];\n\n try {\n cell.cleanup?.();\n } catch (error) {\n errors.push(error);\n } finally {\n cell.cleanup = undefined;\n }\n\n try {\n const cleanup = effect();\n\n if (cleanup !== undefined && typeof cleanup !== \"function\") {\n throw new Error(\n \"An effect function must either return a cleanup function or nothing. \" +\n `Received: ${typeof cleanup}`,\n );\n }\n\n cell.cleanup = cleanup;\n } catch (error) {\n errors.push(error);\n }\n\n cell.deps = deps;\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(errors, \"Errors during commit\");\n }\n }\n });\n}\n","import {\n ResourceFiber,\n RenderResult,\n Resource,\n ResourceFiberRoot,\n} from \"./types\";\nimport { commitAllEffects, cleanupAllEffects } from \"./helpers/commit\";\nimport {\n getDevStrictMode,\n withResourceFiber,\n} from \"./helpers/execution-context\";\nimport { callResourceFn } from \"./helpers/callResourceFn\";\nimport { isDevelopment } from \"./helpers/env\";\n\nexport function createResourceFiber<R, P>(\n type: Resource<R, P>,\n root: ResourceFiberRoot,\n markDirty: (() => void) | undefined = undefined,\n strictMode: \"root\" | \"child\" | null = getDevStrictMode(false),\n): ResourceFiber<R, P> {\n return {\n type,\n root,\n markDirty,\n devStrictMode: strictMode,\n cells: [],\n currentIndex: 0,\n renderContext: undefined,\n isFirstRender: true,\n isMounted: false,\n isNeverMounted: true,\n };\n}\n\nexport function unmountResourceFiber<R, P>(fiber: ResourceFiber<R, P>): void {\n if (!fiber.isMounted)\n throw new Error(\"Tried to unmount a fiber that is already unmounted\");\n\n fiber.isMounted = false;\n cleanupAllEffects(fiber);\n}\n\nexport function renderResourceFiber<R, P>(\n fiber: ResourceFiber<R, P>,\n props: P,\n): RenderResult {\n const result = {\n effectTasks: [],\n props,\n output: undefined as R | undefined,\n };\n\n withResourceFiber(fiber, () => {\n fiber.renderContext = result;\n try {\n result.output = callResourceFn(fiber.type, props);\n } finally {\n fiber.renderContext = undefined;\n }\n });\n\n return result;\n}\n\nexport function commitResourceFiber<R, P>(\n fiber: ResourceFiber<R, P>,\n result: RenderResult,\n): void {\n fiber.isMounted = true;\n\n if (isDevelopment && fiber.isNeverMounted && fiber.devStrictMode === \"root\") {\n fiber.isNeverMounted = false;\n\n commitAllEffects(result);\n cleanupAllEffects(fiber);\n }\n\n fiber.isNeverMounted = false;\n commitAllEffects(result);\n}\n","\"use client\";\nimport { getClientState } from \"../tapClientResource\";\nimport type { AssistantClient, AssistantState } from \"../types/client\";\nimport { BaseProxyHandler, handleIntrospectionProp } from \"./BaseProxyHandler\";\n\nexport const PROXIED_ASSISTANT_STATE_SYMBOL = Symbol(\n \"assistant-ui.store.proxiedAssistantState\",\n);\n\nconst isIgnoredKey = (key: string | symbol): key is \"on\" | \"subscribe\" => {\n return key === \"on\" || key === \"subscribe\" || typeof key === \"symbol\";\n};\n\n/**\n * Proxied state that lazily accesses scope states\n */\nexport const createProxiedAssistantState = (\n client: AssistantClient,\n): AssistantState => {\n class ProxiedAssistantStateProxyHandler\n extends BaseProxyHandler\n implements ProxyHandler<AssistantState>\n {\n get(_: unknown, prop: string | symbol) {\n const introspection = handleIntrospectionProp(prop, \"AssistantState\");\n if (introspection !== false) return introspection;\n const scope = prop as keyof AssistantClient;\n if (isIgnoredKey(scope)) return undefined;\n return getClientState(client[scope]());\n }\n\n ownKeys(): ArrayLike<string | symbol> {\n return Object.keys(client).filter((key) => !isIgnoredKey(key));\n }\n\n has(_: unknown, prop: string | symbol): boolean {\n return !isIgnoredKey(prop) && prop in client;\n }\n }\n\n return new Proxy<AssistantState>(\n {} as AssistantState,\n new ProxiedAssistantStateProxyHandler(),\n );\n};\n\nexport const getProxiedAssistantState = (\n client: AssistantClient,\n): AssistantState => {\n return (\n client as unknown as { [PROXIED_ASSISTANT_STATE_SYMBOL]: AssistantState }\n )[PROXIED_ASSISTANT_STATE_SYMBOL];\n};\n","import { resource, tapResource } from \"@assistant-ui/tap\";\nimport type { AssistantRuntime } from \"..\";\nimport {\n RuntimeAdapterResource,\n baseRuntimeAdapterTransformScopes,\n} from \"../store/internal\";\nimport { attachTransformScopes } from \"@assistant-ui/store\";\nimport { DataRenderers } from \"./client/DataRenderers\";\nimport { Tools } from \"./client/Tools\";\n\nexport const RuntimeAdapter = resource((runtime: AssistantRuntime) =>\n tapResource(RuntimeAdapterResource(runtime)),\n);\n\nattachTransformScopes(RuntimeAdapter, (scopes, parent) => {\n baseRuntimeAdapterTransformScopes(scopes, parent);\n\n if (!scopes.tools && parent.tools.source === null) {\n scopes.tools = Tools({});\n }\n\n if (!scopes.dataRenderers && parent.dataRenderers.source === null) {\n scopes.dataRenderers = DataRenderers();\n }\n});\n","import {\n memo,\n type ComponentType,\n type FC,\n type PropsWithChildren,\n} from \"react\";\nimport { useAui, AuiProvider, type AssistantClient } from \"@assistant-ui/store\";\nimport type { AssistantRuntime } from \"../runtime/api/assistant-runtime\";\nimport type { AssistantRuntimeCore } from \"../runtime/interfaces/assistant-runtime-core\";\nimport { RuntimeAdapter } from \"./RuntimeAdapter\";\n\nexport const getRenderComponent = (runtime: AssistantRuntime) => {\n return (runtime as { _core?: AssistantRuntimeCore })._core?.RenderComponent as\n | ComponentType\n | undefined;\n};\n\nexport type AssistantProviderBaseProps = PropsWithChildren<{\n runtime: AssistantRuntime;\n aui?: AssistantClient | null;\n}>;\n\nexport const AssistantProviderBase: FC<AssistantProviderBaseProps> = memo(\n ({ runtime, aui: parent = null, children }) => {\n const aui = useAui({ threads: RuntimeAdapter(runtime) }, { parent });\n const RenderComponent = getRenderComponent(runtime);\n return (\n <AuiProvider value={aui}>\n {RenderComponent && <RenderComponent />}\n {children}\n </AuiProvider>\n );\n },\n);\n","\"use client\";\n\nimport { create } from \"zustand\";\nimport type { Unsubscribe } from \"@assistant-ui/core\";\n\nexport type SizeHandle = {\n /** Update the height */\n setHeight: (height: number) => void;\n /** Unregister this handle */\n unregister: Unsubscribe;\n};\n\ntype SizeRegistry = {\n register: () => SizeHandle;\n};\n\nconst createSizeRegistry = (\n onChange: (total: number) => void,\n): SizeRegistry => {\n const entries = new Map<symbol, number>();\n\n const recalculate = () => {\n let total = 0;\n for (const height of entries.values()) {\n total += height;\n }\n onChange(total);\n };\n\n return {\n register: () => {\n const id = Symbol();\n entries.set(id, 0);\n\n return {\n setHeight: (height: number) => {\n if (entries.get(id) !== height) {\n entries.set(id, height);\n recalculate();\n }\n },\n unregister: () => {\n entries.delete(id);\n recalculate();\n },\n };\n },\n };\n};\n\nexport type ThreadViewportState = {\n readonly isAtBottom: boolean;\n readonly scrollToBottom: (config?: {\n behavior?: ScrollBehavior | undefined;\n }) => void;\n readonly onScrollToBottom: (\n callback: ({ behavior }: { behavior: ScrollBehavior }) => void,\n ) => Unsubscribe;\n\n /** Controls scroll anchoring: \"top\" anchors user messages at top, \"bottom\" is classic behavior */\n readonly turnAnchor: \"top\" | \"bottom\";\n\n /** Raw height values from registered elements */\n readonly height: {\n /** Total viewport height */\n readonly viewport: number;\n /** Total content inset height (footer, anchor message, etc.) */\n readonly inset: number;\n /** Height of the anchor user message (full height) */\n readonly userMessage: number;\n };\n\n /** Register a viewport and get a handle to update its height */\n readonly registerViewport: () => SizeHandle;\n\n /** Register a content inset (footer, anchor message, etc.) and get a handle to update its height */\n readonly registerContentInset: () => SizeHandle;\n\n /** Register the anchor user message height */\n readonly registerUserMessageHeight: () => SizeHandle;\n};\n\nexport type ThreadViewportStoreOptions = {\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n};\n\nexport const makeThreadViewportStore = (\n options: ThreadViewportStoreOptions = {},\n) => {\n const scrollToBottomListeners = new Set<\n (config: { behavior: ScrollBehavior }) => void\n >();\n\n const viewportRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n viewport: total,\n },\n });\n });\n const insetRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n inset: total,\n },\n });\n });\n const userMessageRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n userMessage: total,\n },\n });\n });\n\n const store = create<ThreadViewportState>(() => ({\n isAtBottom: true,\n scrollToBottom: ({ behavior = \"auto\" } = {}) => {\n for (const listener of scrollToBottomListeners) {\n listener({ behavior });\n }\n },\n onScrollToBottom: (callback) => {\n scrollToBottomListeners.add(callback);\n return () => {\n scrollToBottomListeners.delete(callback);\n };\n },\n\n turnAnchor: options.turnAnchor ?? \"bottom\",\n\n height: {\n viewport: 0,\n inset: 0,\n userMessage: 0,\n },\n\n registerViewport: viewportRegistry.register,\n registerContentInset: insetRegistry.register,\n registerUserMessageHeight: userMessageRegistry.register,\n }));\n\n return store;\n};\n","\"use client\";\n\nimport { useContext, Context } from \"react\";\n\n/**\n * Creates a context hook with optional support.\n * @param context - The React context to consume.\n * @param providerName - The name of the provider for error messages.\n * @returns A hook function that provides the context value.\n */\nexport function createContextHook<T>(\n context: Context<T | null>,\n providerName: string,\n) {\n function useContextHook(options?: {\n optional?: boolean | undefined;\n }): T | null {\n const contextValue = useContext(context);\n if (!options?.optional && !contextValue) {\n throw new Error(`This component must be used within ${providerName}.`);\n }\n return contextValue;\n }\n\n return useContextHook;\n}\n","import { resource } from \"@assistant-ui/tap\";\nimport { type ClientOutput } from \"@assistant-ui/store\";\nimport { AttachmentRuntime } from \"../../runtime/api/attachment-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nexport const AttachmentRuntimeClient = resource(\n ({ runtime }: { runtime: AttachmentRuntime }): ClientOutput<\"attachment\"> => {\n const state = tapSubscribable(runtime);\n\n return {\n getState: () => state,\n remove: runtime.remove,\n __internal_getRuntime: () => runtime,\n };\n },\n);\n","\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { ThreadViewportState } from \"../stores/ThreadViewport\";\n\nexport type ThreadViewportContextValue = {\n useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;\n};\n\nexport const ThreadViewportContext =\n createContext<ThreadViewportContextValue | null>(null);\n\nconst useThreadViewportContext = createContextHook(\n ThreadViewportContext,\n \"ThreadPrimitive.Viewport\",\n);\n\nexport const { useThreadViewport, useThreadViewportStore } =\n createContextStoreHook(useThreadViewportContext, \"useThreadViewport\");\n","import {\n createResourceContext,\n tap,\n withContextProvider,\n tapEffectEvent,\n} from \"@assistant-ui/tap\";\nimport type {\n AssistantEventName,\n AssistantEventPayload,\n} from \"../types/events\";\nimport type { AssistantClient } from \"../types/client\";\nimport { tapClientStack, type ClientStack } from \"./tap-client-stack-context\";\n\ntype EmitFn = <TEvent extends Exclude<AssistantEventName, \"*\">>(\n event: TEvent,\n payload: AssistantEventPayload[TEvent],\n clientStack: ClientStack,\n) => void;\n\nexport type AssistantTapContextValue = {\n clientRef: { parent: AssistantClient; current: AssistantClient | null };\n emit: EmitFn;\n};\n\nconst AssistantTapContext =\n createResourceContext<AssistantTapContextValue | null>(null);\n\nexport const withAssistantTapContextProvider = <TResult>(\n value: AssistantTapContextValue,\n fn: () => TResult,\n) => {\n return withContextProvider(AssistantTapContext, value, fn);\n};\n\nconst tapAssistantTapContext = () => {\n const ctx = tap(AssistantTapContext);\n if (!ctx) throw new Error(\"AssistantTapContext is not available\");\n\n return ctx;\n};\n\nexport const tapAssistantClientRef = () => {\n return tapAssistantTapContext().clientRef;\n};\n\nexport const tapAssistantEmit = () => {\n const { emit } = tapAssistantTapContext();\n const clientStack = tapClientStack();\n\n return tapEffectEvent(\n <TEvent extends Exclude<AssistantEventName, \"*\">>(\n event: TEvent,\n payload: AssistantEventPayload[TEvent],\n ) => {\n emit(event, payload, clientStack);\n },\n );\n};\n","export const depsShallowEqual = (\n a: readonly unknown[],\n b: readonly unknown[],\n) => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return false;\n }\n return true;\n};\n","import { tapReducer } from \"./tap-reducer\";\n\nexport namespace tapState {\n export type StateUpdater<S> = S | ((prev: S) => S);\n}\n\nconst stateReducer = <S>(\n state: S | undefined,\n action: tapState.StateUpdater<S>,\n): S =>\n typeof action === \"function\"\n ? (action as (prev: S | undefined) => S)(state)\n : action;\n\nconst stateInit = <S>(initial: S | (() => S)): S =>\n typeof initial === \"function\" ? (initial as () => S)() : initial;\n\nexport function tapState<S = undefined>(): [\n S | undefined,\n (updater: tapState.StateUpdater<S>) => void,\n];\nexport function tapState<S>(\n initial: S | (() => S),\n): [S, (updater: tapState.StateUpdater<S>) => void];\nexport function tapState<S>(\n initial?: S | (() => S),\n): [S | undefined, (updater: tapState.StateUpdater<S>) => void] {\n return tapReducer(stateReducer, initial, stateInit);\n}\n","import {\n type ModelContextProvider,\n mergeModelContexts,\n} from \"../model-context/types\";\n\nexport class CompositeContextProvider implements ModelContextProvider {\n private _providers = new Set<ModelContextProvider>();\n\n getModelContext() {\n return mergeModelContexts(this._providers);\n }\n\n registerModelContextProvider(provider: ModelContextProvider) {\n this._providers.add(provider);\n const unsubscribe = provider.subscribe?.(() => {\n this.notifySubscribers();\n });\n this.notifySubscribers();\n return () => {\n this._providers.delete(provider);\n unsubscribe?.();\n this.notifySubscribers();\n };\n }\n\n private _subscribers = new Set<() => void>();\n\n notifySubscribers() {\n for (const callback of this._subscribers) callback();\n }\n\n subscribe(callback: () => void) {\n this._subscribers.add(callback);\n return () => this._subscribers.delete(callback);\n }\n}\n","import { tapState, tapEffect } from \"@assistant-ui/tap\";\nimport type { SubscribableWithState } from \"../../subscribable/subscribable\";\n\nexport const tapSubscribable = <T>(\n subscribable: Omit<SubscribableWithState<T, any>, \"path\">,\n) => {\n const [, setState] = tapState(subscribable.getState);\n tapEffect(() => {\n setState(subscribable.getState());\n return subscribable.subscribe(() => {\n setState(subscribable.getState());\n });\n }, [subscribable]);\n\n return subscribable.getState();\n};\n","import { ResourceFiber, RenderResult } from \"../types\";\n\nexport function commitAllEffects(renderResult: RenderResult): void {\n const errors: unknown[] = [];\n\n for (const task of renderResult.effectTasks) {\n try {\n task();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(errors, \"Errors during commit\");\n }\n }\n}\n\nexport function cleanupAllEffects<R, P>(executionContext: ResourceFiber<R, P>) {\n const errors: unknown[] = [];\n for (const cell of executionContext.cells) {\n if (cell?.type === \"effect\") {\n cell.deps = null; // Reset deps so effect runs again on next mount\n\n if (cell.cleanup) {\n try {\n cell.cleanup?.();\n } catch (e) {\n errors.push(e);\n } finally {\n cell.cleanup = undefined;\n }\n }\n }\n }\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(errors, \"Errors during cleanup\");\n }\n }\n}\n","import { resource, tapState, tapCallback } from \"@assistant-ui/tap\";\nimport { type ClientOutput } from \"@assistant-ui/store\";\nimport { DataRenderersState } from \"../types/scopes/dataRenderers\";\nimport { DataMessagePartComponent } from \"../types/MessagePartComponentTypes\";\n\nexport const DataRenderers = resource((): ClientOutput<\"dataRenderers\"> => {\n const [state, setState] = tapState<DataRenderersState>(() => ({\n renderers: {},\n }));\n\n const setDataUI = tapCallback(\n (name: string, render: DataMessagePartComponent) => {\n setState((prev) => {\n return {\n ...prev,\n renderers: {\n ...prev.renderers,\n [name]: [...(prev.renderers[name] ?? []), render],\n },\n };\n });\n\n return () => {\n setState((prev) => {\n return {\n ...prev,\n renderers: {\n ...prev.renderers,\n [name]: prev.renderers[name]?.filter((r) => r !== render) ?? [],\n },\n };\n });\n };\n },\n [],\n );\n\n return {\n getState: () => state,\n setDataUI,\n };\n});\n","import { tapMemo } from \"./tap-memo\";\n\nexport const tapCallback = <T extends (...args: any[]) => any>(\n fn: T,\n deps: readonly unknown[],\n): T => {\n // biome-ignore lint/correctness/useExhaustiveDependencies: user provided deps instead of callback identity\n return tapMemo(() => fn, deps);\n};\n","import React from 'react';\nimport { createStore } from 'zustand/vanilla';\n\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity) {\n const slice = React.useSyncExternalStore(\n api.subscribe,\n React.useCallback(() => selector(api.getState()), [api, selector]),\n React.useCallback(() => selector(api.getInitialState()), [api, selector])\n );\n React.useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n const api = createStore(createState);\n const useBoundStore = (selector) => useStore(api, selector);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = ((createState) => createState ? createImpl(createState) : createImpl);\n\nexport { create, useStore };\n","import { tapState } from \"./tap-state\";\n\nexport function tapConst<T>(getValue: () => T, _deps: readonly never[]): T {\n const [state] = tapState(getValue);\n return state;\n}\n","type Task = () => void;\n\ntype GlobalFlushState = {\n schedulers: Set<UpdateScheduler>;\n isScheduled: boolean;\n};\n\nconst MAX_FLUSH_LIMIT = 50;\nlet flushState: GlobalFlushState = {\n schedulers: new Set([]),\n isScheduled: false,\n};\n\nexport class UpdateScheduler {\n private _isDirty = false;\n\n constructor(private readonly _task: Task) {}\n\n get isDirty() {\n return this._isDirty;\n }\n\n markDirty() {\n this._isDirty = true;\n\n flushState.schedulers.add(this);\n scheduleFlush();\n }\n\n runTask() {\n this._isDirty = false;\n this._task();\n }\n}\n\nconst scheduleFlush = () => {\n if (flushState.isScheduled) return;\n flushState.isScheduled = true;\n scheduleMacrotask();\n};\n\nconst flushScheduled = () => {\n try {\n const errors = [];\n let flushDepth = 0;\n\n for (const scheduler of flushState.schedulers) {\n flushState.schedulers.delete(scheduler);\n if (!scheduler.isDirty) continue;\n\n flushDepth++;\n\n if (flushDepth > MAX_FLUSH_LIMIT) {\n throw new Error(\n `Maximum update depth exceeded. This can happen when a resource ` +\n `repeatedly calls setState inside tapEffect.`,\n );\n }\n\n try {\n scheduler.runTask();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(errors, \"Errors occurred during flushSync\");\n }\n }\n } finally {\n flushState.schedulers.clear();\n flushState.isScheduled = false;\n }\n};\n\n// Use MessageChannel to schedule flushes as macrotasks (like React's scheduler).\n// This allows more state updates to batch into a single re-render.\nconst scheduleMacrotask = (() => {\n if (typeof MessageChannel !== \"undefined\") {\n const channel = new MessageChannel();\n channel.port1.onmessage = flushScheduled;\n return () => channel.port2.postMessage(null);\n }\n // Fallback for environments without MessageChannel\n return () => setTimeout(flushScheduled, 0);\n})();\n\nexport const flushResourcesSync = <T>(callback: () => T): T => {\n const prev = flushState;\n flushState = {\n schedulers: new Set([]),\n isScheduled: true,\n };\n\n try {\n const result = callback();\n flushScheduled();\n\n return result;\n } finally {\n flushState = prev;\n }\n};\n","import {\n createResourceContext,\n tap,\n withContextProvider,\n tapMemo,\n} from \"@assistant-ui/tap\";\nimport type { ClientMethods } from \"../types/client\";\n\n/**\n * Symbol used to get the client index from a ClientProxy.\n */\nexport const SYMBOL_CLIENT_INDEX = Symbol(\"assistant-ui.store.clientIndex\");\n\n/**\n * Get the index of a client (its position in the client stack when created).\n */\nexport const getClientIndex = (client: ClientMethods): number => {\n return (client as unknown as { [SYMBOL_CLIENT_INDEX]: number })[\n SYMBOL_CLIENT_INDEX\n ];\n};\n\n/**\n * The client stack - an array of clients representing the current hierarchy.\n */\nexport type ClientStack = readonly ClientMethods[];\n\nconst ClientStackContext = createResourceContext<ClientStack>([]);\n\n/**\n * Get the current client stack inside a tap resource.\n */\nexport const tapClientStack = (): ClientStack => {\n return tap(ClientStackContext);\n};\n\n/**\n * Execute a callback with a client pushed onto the stack.\n * The stack is duplicated, not mutated.\n */\nexport const tapWithClientStack = <T>(\n client: ClientMethods,\n callback: () => T,\n): T => {\n const currentStack = tapClientStack();\n const newStack = tapMemo(\n () => [...currentStack, client],\n [currentStack, client],\n );\n return withContextProvider(ClientStackContext, newStack, callback);\n};\n","import { getCurrentResourceFiber } from \"../../core/helpers/execution-context\";\nimport { Cell } from \"../../core/types\";\n\nexport const tapHook = <T extends Cell[\"type\"]>(\n type: T,\n init: () => Cell,\n): Cell & { type: T } => {\n const fiber = getCurrentResourceFiber();\n const index = fiber.currentIndex++;\n\n if (!fiber.isFirstRender && index >= fiber.cells.length) {\n // Check if we're trying to use more hooks than in previous renders\n throw new Error(\n \"Rendered more hooks than during the previous render. \" +\n \"Hooks must be called in the exact same order in every render.\",\n );\n }\n\n let cell = fiber.cells[index];\n if (!cell) {\n cell = init();\n fiber.cells[index] = cell;\n }\n\n if (cell.type !== type) {\n throw new Error(\"Hook order changed between renders\");\n }\n\n return cell as Cell & { type: T };\n};\n\nexport const registerRenderMountTask = (task: () => void) => {\n const fiber = getCurrentResourceFiber();\n fiber.renderContext!.effectTasks.push(task);\n};\n","\"use client\";\n\nimport { FC, memo, PropsWithChildren, useEffect } from \"react\";\nimport { AssistantClient, useAui } from \"@assistant-ui/store\";\nimport { AssistantRuntime } from \"./runtime/AssistantRuntime\";\nimport { AssistantProviderBase } from \"@assistant-ui/core/react\";\nimport { ThreadPrimitiveViewportProvider } from \"../context/providers/ThreadViewportProvider\";\nimport { DevToolsProviderApi } from \"../devtools/DevToolsHooks\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n\n /**\n * The aui instance to extend. If not provided, a new aui instance will be created.\n */\n aui?: AssistantClient;\n }>;\n}\n\nconst DevToolsRegistration: FC = () => {\n const aui = useAui();\n useEffect(() => {\n if (typeof process === \"undefined\" || process.env.NODE_ENV === \"production\")\n return;\n return DevToolsProviderApi.register(aui);\n }, [aui]);\n return null;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, aui, runtime }) => {\n return (\n <AssistantProviderBase runtime={runtime} aui={aui ?? null}>\n <DevToolsRegistration />\n {/* TODO temporarily allow accessing viewport state from outside the viewport */}\n {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}\n <ThreadPrimitiveViewportProvider>\n {children}\n </ThreadPrimitiveViewportProvider>\n </AssistantProviderBase>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n","\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport {\n makeThreadViewportStore,\n type ThreadViewportStoreOptions,\n} from \"../stores/ThreadViewport\";\nimport {\n ThreadViewportContext,\n ThreadViewportContextValue,\n useThreadViewportStore,\n} from \"../react/ThreadViewportContext\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport type ThreadViewportProviderProps = PropsWithChildren<{\n options?: ThreadViewportStoreOptions;\n}>;\n\nconst useThreadViewportStoreValue = (options: ThreadViewportStoreOptions) => {\n const outerViewport = useThreadViewportStore({ optional: true });\n const [store] = useState(() => makeThreadViewportStore(options));\n\n // Forward scrollToBottom from outer viewport to inner viewport\n useEffect(() => {\n return outerViewport?.getState().onScrollToBottom(() => {\n store.getState().scrollToBottom();\n });\n }, [outerViewport, store]);\n\n useEffect(() => {\n if (!outerViewport) return;\n return store.subscribe((state) => {\n if (outerViewport.getState().isAtBottom !== state.isAtBottom) {\n writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });\n }\n });\n }, [store, outerViewport]);\n\n // Sync options to store when they change\n useEffect(() => {\n const nextState = {\n turnAnchor: options.turnAnchor ?? \"bottom\",\n };\n\n const currentState = store.getState();\n if (currentState.turnAnchor !== nextState.turnAnchor) {\n writableStore(store).setState(nextState);\n }\n }, [store, options.turnAnchor]);\n\n return store;\n};\n\nexport const ThreadPrimitiveViewportProvider: FC<\n ThreadViewportProviderProps\n> = ({ children, options = {} }) => {\n const useThreadViewport = useThreadViewportStoreValue(options);\n\n const [context] = useState<ThreadViewportContextValue>(() => {\n return {\n useThreadViewport,\n };\n });\n\n return (\n <ThreadViewportContext.Provider value={context}>\n {children}\n </ThreadViewportContext.Provider>\n );\n};\n","import type { Unsubscribe } from \"../types/unsubscribe\";\nimport { Tool } from \"assistant-stream\";\n\n// =============================================================================\n// Language Model Settings\n// =============================================================================\n\nexport type LanguageModelV1CallSettings = {\n maxTokens?: number;\n temperature?: number;\n topP?: number;\n presencePenalty?: number;\n frequencyPenalty?: number;\n seed?: number;\n headers?: Record<string, string | undefined>;\n};\n\nexport type LanguageModelConfig = {\n apiKey?: string;\n baseUrl?: string;\n modelName?: string;\n};\n\n// =============================================================================\n// Model Context\n// =============================================================================\n\nexport type ModelContext = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelContextProvider = {\n getModelContext: () => ModelContext;\n subscribe?: (callback: () => void) => Unsubscribe;\n};\n\n// =============================================================================\n// Tool & Instruction Config\n// =============================================================================\n\nexport type AssistantToolProps<\n TArgs extends Record<string, unknown>,\n TResult,\n> = Tool<TArgs, TResult> & {\n toolName: string;\n render?: unknown;\n};\n\nexport type AssistantInstructionsConfig = {\n disabled?: boolean | undefined;\n instruction: string;\n};\n\nexport type AssistantContextConfig = {\n getContext: () => string;\n disabled?: boolean | undefined;\n};\n\n// =============================================================================\n// Merging\n// =============================================================================\n\nexport const mergeModelContexts = (\n configSet: Set<ModelContextProvider>,\n): ModelContext => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelContext())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n const existing = acc.tools?.[name];\n if (existing && existing !== tool) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelContext);\n};\n","import { UseBoundStore } from \"zustand\";\nimport { ReadonlyStore } from \"../../ReadonlyStore\";\n\n/**\n * Creates hooks for accessing a store within a context.\n * @param contextHook - The hook to access the context.\n * @param contextKey - The key of the store in the context.\n * @returns An object containing the hooks: `use...` and `use...Store`.\n */\nexport function createContextStoreHook<T, K extends keyof T & string>(\n contextHook: (options?: { optional?: boolean }) => T | null,\n contextKey: K,\n) {\n type StoreType = T[K];\n type StateType = StoreType extends ReadonlyStore<infer S> ? S : never;\n\n // Define useStoreStoreHook with overloads\n function useStoreStoreHook(): ReadonlyStore<StateType>;\n function useStoreStoreHook(options: {\n optional: true;\n }): ReadonlyStore<StateType> | null;\n function useStoreStoreHook(options?: {\n optional?: boolean;\n }): ReadonlyStore<StateType> | null {\n const context = contextHook(options);\n if (!context) return null;\n return context[contextKey] as ReadonlyStore<StateType>;\n }\n\n // Define useStoreHook with overloads\n function useStoreHook(): StateType;\n function useStoreHook<TSelected>(\n selector: (state: StateType) => TSelected,\n ): TSelected;\n function useStoreHook(options: { optional: true }): StateType | null;\n function useStoreHook<TSelected>(options: {\n optional: true;\n selector?: (state: StateType) => TSelected;\n }): TSelected | null;\n function useStoreHook<TSelected>(\n param?:\n | ((state: StateType) => TSelected)\n | {\n optional?: boolean;\n selector?: (state: StateType) => TSelected;\n },\n ): TSelected | StateType | null {\n let optional = false;\n let selector: ((state: StateType) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param && typeof param === \"object\") {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useStoreStoreHook({\n optional,\n } as any) as UseBoundStore<ReadonlyStore<StateType>>;\n if (!store) return null;\n return selector ? store(selector) : store();\n }\n\n // Return an object with keys based on contextKey\n return {\n [contextKey]: useStoreHook,\n [`${contextKey}Store`]: useStoreStoreHook,\n } as {\n [P in K]: typeof useStoreHook;\n } & {\n [P in `${K}Store`]: typeof useStoreStoreHook;\n };\n}\n","const INTROSPECTION_PROPS = new Set([\"$$typeof\", \"nodeType\", \"then\"]);\n\n/**\n * Handles common proxy introspection properties.\n * Returns the appropriate value for toStringTag, toJSON, and props that should return undefined.\n * Returns `false` if the prop should be handled by the subclass.\n */\nexport const handleIntrospectionProp = (\n prop: string | symbol,\n name: string,\n): unknown | false => {\n if (prop === Symbol.toStringTag) return name;\n if (typeof prop === \"symbol\") return undefined;\n if (prop === \"toJSON\") return () => name;\n if (INTROSPECTION_PROPS.has(prop)) return undefined;\n return false;\n};\n\nexport abstract class BaseProxyHandler implements ProxyHandler<object> {\n abstract get(_: unknown, prop: string | symbol, receiver?: unknown): unknown;\n abstract ownKeys(): ArrayLike<string | symbol>;\n abstract has(_: unknown, prop: string | symbol): boolean;\n\n getOwnPropertyDescriptor(_: unknown, prop: string | symbol) {\n const value = this.get(_, prop);\n if (value === undefined) return undefined;\n return {\n value,\n writable: false,\n enumerable: true,\n configurable: false,\n };\n }\n\n set() {\n return false;\n }\n setPrototypeOf() {\n return false;\n }\n defineProperty() {\n return false;\n }\n deleteProperty() {\n return false;\n }\n preventExtensions(): boolean {\n return false;\n }\n}\n","import {\n type ResourceElement,\n Resource,\n resource,\n withKey,\n} from \"@assistant-ui/tap\";\n\nexport const wrapperResource = <R, P>(\n fn: (props: ResourceElement<P>) => R,\n): Resource<R, ResourceElement<P>> => {\n const res = resource(fn);\n return (props: ResourceElement<P>) => {\n const el = res(props);\n if (props.key === undefined) return el;\n return withKey(props.key, el);\n };\n};\n","import { Cell, ResourceFiber, ResourceFiberRoot } from \"../types\";\n\nexport const createResourceFiberRoot = (\n dispatchUpdate: (cb: () => boolean) => void,\n): ResourceFiberRoot => {\n return {\n version: 0,\n committedVersion: 0,\n dispatchUpdate,\n changelog: [],\n dirtyCells: [],\n };\n};\n\nexport const commitRoot = (root: ResourceFiberRoot): void => {\n for (const cell of root.dirtyCells) {\n cell.dirty = false;\n cell.queue.clear();\n cell.current = cell.workInProgress;\n }\n root.committedVersion = root.version;\n root.changelog.length = 0;\n root.dirtyCells.length = 0;\n};\n\nexport const setRootVersion = (\n root: ResourceFiberRoot,\n version: number,\n): void => {\n const rollback = root.version > version;\n root.version = version;\n if (rollback) {\n for (const cell of root.dirtyCells) {\n cell.dirty = false;\n cell.queue.clear();\n cell.workInProgress = cell.current;\n }\n root.dirtyCells.length = 0;\n\n if (version === root.committedVersion) {\n root.changelog.length = 0;\n } else {\n // commit happened without a useEffect update (offscreen API)\n\n if (root.committedVersion > version)\n throw new Error(\"Version is less than committed version\");\n\n while (root.committedVersion + root.changelog.length > version) {\n root.changelog.pop();\n }\n\n root.changelog.forEach((apply) => apply());\n commitRoot(root);\n }\n }\n};\n\nexport const markCellDirty = (\n fiber: ResourceFiber<any, any>,\n cell: Cell & { type: \"reducer\" },\n): void => {\n if (!cell.dirty) {\n cell.dirty = true;\n fiber.markDirty?.();\n fiber.root.dirtyCells.push(cell);\n }\n};\n","import { resource, ResourceElement } from \"@assistant-ui/tap\";\nimport type {\n AssistantClient,\n ClientNames,\n AssistantClientAccessor,\n ClientMeta,\n} from \"./types/client\";\n\n/**\n * Creates a derived client field that references a client from a parent scope.\n * The get callback always calls the most recent version (useEffectEvent pattern).\n *\n * IMPORTANT: The `get` callback must return a client that was created via\n * `tapClientResource` (or `tapClientLookup`/`tapClientList` which use it internally).\n * This is required for event scoping to work correctly.\n *\n * @example\n * ```typescript\n * const aui = useAui({\n * message: Derived({\n * source: \"thread\",\n * query: { index: 0 },\n * get: (aui) => aui.thread().message({ index: 0 }),\n * }),\n * });\n * ```\n */\nexport const Derived = resource(\n <K extends ClientNames>(_config: Derived.Props<K>): null => {\n return null;\n },\n);\n\nexport type DerivedElement<K extends ClientNames> = ResourceElement<\n null,\n Derived.Props<K>\n>;\n\nexport namespace Derived {\n /**\n * Props passed to a derived client resource element.\n */\n export type Props<K extends ClientNames> = {\n get: (client: AssistantClient) => ReturnType<AssistantClientAccessor<K>>;\n } & (ClientMeta<K> | { getMeta: (client: AssistantClient) => ClientMeta<K> });\n}\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['path', { d: 'M12 20v2', key: '1lh1kg' }],\n ['path', { d: 'M12 2v2', key: 'tus03m' }],\n ['path', { d: 'M17 20v2', key: '1rnc9c' }],\n ['path', { d: 'M17 2v2', key: '11trls' }],\n ['path', { d: 'M2 12h2', key: '1t8f8n' }],\n ['path', { d: 'M2 17h2', key: '7oei6x' }],\n ['path', { d: 'M2 7h2', key: 'asdhe0' }],\n ['path', { d: 'M20 12h2', key: '1q8mjw' }],\n ['path', { d: 'M20 17h2', key: '1fpfkl' }],\n ['path', { d: 'M20 7h2', key: '1o8tra' }],\n ['path', { d: 'M7 20v2', key: '4gnj0m' }],\n ['path', { d: 'M7 2v2', key: '1i4yhu' }],\n ['rect', { x: '4', y: '4', width: '16', height: '16', rx: '2', key: '1vbyd7' }],\n ['rect', { x: '8', y: '8', width: '8', height: '8', rx: '1', key: 'z9xiuo' }],\n];\n\n/**\n * @component @name Cpu\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMjB2MiIgLz4KICA8cGF0aCBkPSJNMTIgMnYyIiAvPgogIDxwYXRoIGQ9Ik0xNyAyMHYyIiAvPgogIDxwYXRoIGQ9Ik0xNyAydjIiIC8+CiAgPHBhdGggZD0iTTIgMTJoMiIgLz4KICA8cGF0aCBkPSJNMiAxN2gyIiAvPgogIDxwYXRoIGQ9Ik0yIDdoMiIgLz4KICA8cGF0aCBkPSJNMjAgMTJoMiIgLz4KICA8cGF0aCBkPSJNMjAgMTdoMiIgLz4KICA8cGF0aCBkPSJNMjAgN2gyIiAvPgogIDxwYXRoIGQ9Ik03IDIwdjIiIC8+CiAgPHBhdGggZD0iTTcgMnYyIiAvPgogIDxyZWN0IHg9IjQiIHk9IjQiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgcng9IjIiIC8+CiAgPHJlY3QgeD0iOCIgeT0iOCIgd2lkdGg9IjgiIGhlaWdodD0iOCIgcng9IjEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/cpu\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Cpu = createLucideIcon('cpu', __iconNode);\n\nexport default Cpu;\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","const isIterable = (obj) => Symbol.iterator in obj;\nconst hasIterableEntries = (value) => (\n // HACK: avoid checking entries type\n \"entries\" in value\n);\nconst compareEntries = (valueA, valueB) => {\n const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());\n const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());\n if (mapA.size !== mapB.size) {\n return false;\n }\n for (const [key, value] of mapA) {\n if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {\n return false;\n }\n }\n return true;\n};\nconst compareIterables = (valueA, valueB) => {\n const iteratorA = valueA[Symbol.iterator]();\n const iteratorB = valueB[Symbol.iterator]();\n let nextA = iteratorA.next();\n let nextB = iteratorB.next();\n while (!nextA.done && !nextB.done) {\n if (!Object.is(nextA.value, nextB.value)) {\n return false;\n }\n nextA = iteratorA.next();\n nextB = iteratorB.next();\n }\n return !!nextA.done && !!nextB.done;\n};\nfunction shallow(valueA, valueB) {\n if (Object.is(valueA, valueB)) {\n return true;\n }\n if (typeof valueA !== \"object\" || valueA === null || typeof valueB !== \"object\" || valueB === null) {\n return false;\n }\n if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {\n return false;\n }\n if (isIterable(valueA) && isIterable(valueB)) {\n if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {\n return compareEntries(valueA, valueB);\n }\n return compareIterables(valueA, valueB);\n }\n return compareEntries(\n { entries: () => Object.entries(valueA) },\n { entries: () => Object.entries(valueB) }\n );\n}\n\nexport { shallow };\n","type Bindable = {\n __internal_bindMethods?: () => void;\n __isBound?: boolean;\n};\nconst debugVerifyPrototype = (\n runtime: Record<string, unknown>,\n prototype: any,\n) => {\n const unboundMethods = Object.getOwnPropertyNames(prototype).filter(\n (methodStr) => {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);\n const isMethod = descriptor && typeof descriptor.value === \"function\";\n if (!isMethod) return false;\n\n const methodName = methodStr as keyof typeof runtime | \"constructor\";\n return (\n isMethod &&\n !methodName.startsWith(\"_\") &&\n methodName !== \"constructor\" &&\n prototype[methodName] === runtime[methodName]\n );\n },\n );\n\n if (unboundMethods.length > 0) {\n throw new Error(\n `The following methods are not bound: ${JSON.stringify(unboundMethods)}`,\n );\n }\n\n const prototypePrototype = Object.getPrototypeOf(prototype);\n if (prototypePrototype && prototypePrototype !== Object.prototype) {\n debugVerifyPrototype(runtime, prototypePrototype);\n }\n};\nexport const ensureBinding = (r: unknown) => {\n const runtime = r as Bindable;\n if (runtime.__isBound) return;\n\n runtime.__internal_bindMethods?.();\n runtime.__isBound = true;\n\n if (process.env.NODE_ENV !== \"production\") {\n debugVerifyPrototype(runtime, Object.getPrototypeOf(runtime));\n }\n};\n","import type { QuoteInfo } from \"../../types/quote\";\n\ntype MessageQuoteState = {\n message: {\n metadata?: unknown;\n };\n};\n\nexport const getMessageQuote = (\n state: MessageQuoteState,\n): QuoteInfo | undefined => {\n const metadata = state.message.metadata;\n if (!metadata || typeof metadata !== \"object\") return undefined;\n\n return (metadata as { custom?: Record<string, unknown> }).custom?.quote as\n | QuoteInfo\n | undefined;\n};\n","import type { FC, PropsWithChildren } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\ntype ComposerIfFilters = {\n /** Whether the composer is in editing mode */\n editing: boolean | undefined;\n /** Whether dictation is currently active */\n dictation: boolean | undefined;\n};\n\nexport type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<\n T,\n Exclude<keyof T, Keys>\n> &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n\nexport type UseComposerIfProps = RequireAtLeastOne<ComposerIfFilters>;\n\nconst useComposerIf = (props: UseComposerIfProps) => {\n return useAuiState((s) => {\n if (props.editing === true && !s.composer.isEditing) return false;\n if (props.editing === false && s.composer.isEditing) return false;\n\n const isDictating = s.composer.dictation != null;\n if (props.dictation === true && !isDictating) return false;\n if (props.dictation === false && isDictating) return false;\n\n return true;\n });\n};\n\nexport namespace ComposerPrimitiveIf {\n export type Props = PropsWithChildren<UseComposerIfProps>;\n}\n\n/**\n * @deprecated Use `<AuiIf condition={(s) => s.composer...} />` instead.\n */\nexport const ComposerPrimitiveIf: FC<ComposerPrimitiveIf.Props> = ({\n children,\n ...query\n}) => {\n const result = useComposerIf(query);\n return result ? children : null;\n};\n\nComposerPrimitiveIf.displayName = \"ComposerPrimitive.If\";\n","import { useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessageError = () => {\n return useAuiState((s) =>\n s.message.status?.type === \"incomplete\" &&\n s.message.status.reason === \"error\"\n ? (s.message.status.error ?? \"An error occurred\")\n : undefined,\n );\n};\n","\"use client\";\n\nimport { type ReactNode, useMemo, useRef } from \"react\";\nimport type { AssistantClient } from \"./types/client\";\nimport { useAuiState } from \"./useAuiState\";\nimport { useAui } from \"./useAui\";\n\nexport const useGetItemAccessor = <T,>(\n getItemState: (aui: AssistantClient) => T,\n) => {\n const aui = useAui();\n\n // if the consumer never accesses the item, do not trigger rerenders\n const cacheRef = useRef<T | undefined>(undefined);\n useAuiState(() => {\n if (cacheRef.current === undefined) {\n cacheRef.current = getItemState(aui);\n }\n return cacheRef.current;\n });\n\n return () => {\n cacheRef.current = undefined; // clear the cache (rerender on next state change)\n\n return getItemState(aui);\n };\n};\n\nconst EMPTY_OBJECT = Object.freeze({});\n\n/**\n * Component that sets up a lazy item accessor and memoizes propless children.\n *\n * For the common pattern where children returns a component without props\n * (e.g. `<Foo />`), the output is memoized and not re-created on parent re-renders.\n *\n * @example\n * ```tsx\n * <RenderChildrenWithAccessor\n * getItemState={(aui) => aui.fooList().foo({ index }).getState()}\n * >\n * {() => <Foo />}\n * </RenderChildrenWithAccessor>\n * ```\n */\nexport function RenderChildrenWithAccessor<T>({\n getItemState,\n children,\n}: {\n getItemState: (aui: AssistantClient) => T;\n children: (getItem: () => T) => ReactNode;\n}): ReactNode {\n const getItem = useGetItemAccessor(getItemState);\n return useMemoizedProplessComponent(children(getItem));\n}\n\nconst useMemoizedProplessComponent = (node: ReactNode) => {\n const el =\n typeof node === \"object\" && node != null && \"type\" in node ? node : null;\n const resultType = el?.type;\n const resultKey = el?.key;\n const resultProps =\n typeof el?.props === \"object\" &&\n el.props != null &&\n Object.entries(el.props).length === 0\n ? EMPTY_OBJECT\n : el?.props;\n\n return (\n // biome-ignore lint/correctness/useExhaustiveDependencies: optimization\n useMemo(() => el, [resultType, resultKey, resultProps]) ?? node\n );\n};\n","\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallback, useRef, type RefCallback } from \"react\";\nimport { useAuiEvent } from \"@assistant-ui/store\";\nimport { useOnResizeContent } from \"../../utils/hooks/useOnResizeContent\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { writableStore } from \"../../context/ReadonlyStore\";\nimport { useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace useThreadViewportAutoScroll {\n export type Options = {\n /**\n * Whether to automatically scroll to the bottom when new messages are added.\n * When enabled, the viewport will automatically scroll to show the latest content.\n *\n * Default false if `turnAnchor` is \"top\", otherwise defaults to true.\n */\n autoScroll?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when a new run starts.\n *\n * Defaults to true.\n */\n scrollToBottomOnRunStart?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when thread history is first loaded.\n *\n * Defaults to true.\n */\n scrollToBottomOnInitialize?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when switching to a different thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n}\n\nexport const useThreadViewportAutoScroll = <TElement extends HTMLElement>({\n autoScroll,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: useThreadViewportAutoScroll.Options): RefCallback<TElement> => {\n const divRef = useRef<TElement>(null);\n\n const threadViewportStore = useThreadViewportStore();\n if (autoScroll === undefined) {\n autoScroll = threadViewportStore.getState().turnAnchor !== \"top\";\n }\n\n const lastScrollTop = useRef<number>(0);\n\n // bug: when ScrollToBottom's button changes its disabled state, the scroll stops\n // fix: delay the state change until the scroll is done\n // stores the scroll behavior to reuse during content resize, or null if not scrolling\n const scrollingToBottomBehaviorRef = useRef<ScrollBehavior | null>(null);\n\n const scrollToBottom = useCallback((behavior: ScrollBehavior) => {\n const div = divRef.current;\n if (!div) return;\n\n scrollingToBottomBehaviorRef.current = behavior;\n div.scrollTo({ top: div.scrollHeight, behavior });\n }, []);\n\n const handleScroll = () => {\n const div = divRef.current;\n if (!div) return;\n\n const isAtBottom = threadViewportStore.getState().isAtBottom;\n const newIsAtBottom =\n Math.abs(div.scrollHeight - div.scrollTop - div.clientHeight) < 1 ||\n div.scrollHeight <= div.clientHeight;\n\n if (!newIsAtBottom && lastScrollTop.current < div.scrollTop) {\n // ignore scroll down\n } else {\n if (newIsAtBottom) {\n scrollingToBottomBehaviorRef.current = null;\n }\n\n const shouldUpdate =\n newIsAtBottom || scrollingToBottomBehaviorRef.current === null;\n\n if (shouldUpdate && newIsAtBottom !== isAtBottom) {\n writableStore(threadViewportStore).setState({\n isAtBottom: newIsAtBottom,\n });\n }\n }\n\n lastScrollTop.current = div.scrollTop;\n };\n\n const resizeRef = useOnResizeContent(() => {\n const scrollBehavior = scrollingToBottomBehaviorRef.current;\n if (scrollBehavior) {\n scrollToBottom(scrollBehavior);\n } else if (autoScroll && threadViewportStore.getState().isAtBottom) {\n scrollToBottom(\"instant\");\n }\n\n handleScroll();\n });\n\n const scrollRef = useManagedRef<HTMLElement>((el) => {\n el.addEventListener(\"scroll\", handleScroll);\n return () => {\n el.removeEventListener(\"scroll\", handleScroll);\n };\n });\n\n useOnScrollToBottom(({ behavior }) => {\n scrollToBottom(behavior);\n });\n\n // autoscroll on run start\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n scrollingToBottomBehaviorRef.current = \"auto\";\n requestAnimationFrame(() => {\n scrollToBottom(\"auto\");\n });\n });\n\n // scroll to bottom instantly when thread history is first loaded\n useAuiEvent(\"thread.initialize\", () => {\n if (!scrollToBottomOnInitialize) return;\n scrollingToBottomBehaviorRef.current = \"instant\";\n requestAnimationFrame(() => {\n scrollToBottom(\"instant\");\n });\n });\n\n // scroll to bottom instantly when switching threads\n useAuiEvent(\"threadListItem.switchedTo\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n scrollingToBottomBehaviorRef.current = \"instant\";\n requestAnimationFrame(() => {\n scrollToBottom(\"instant\");\n });\n });\n\n const autoScrollRef = useComposedRefs<TElement>(resizeRef, scrollRef, divRef);\n return autoScrollRef as RefCallback<TElement>;\n};\n","\"use client\";\n\nimport { FC, PropsWithChildren } from \"react\";\nimport { useMessageError } from \"@assistant-ui/core/react\";\n\nexport const MessagePrimitiveError: FC<PropsWithChildren> = ({ children }) => {\n const error = useMessageError();\n return error !== undefined ? children : null;\n};\n\nMessagePrimitiveError.displayName = \"MessagePrimitive.Error\";\n","export { ThreadPrimitiveRoot as Root } from \"./thread/ThreadRoot\";\nexport { ThreadPrimitiveEmpty as Empty } from \"./thread/ThreadEmpty\";\nexport { ThreadPrimitiveIf as If } from \"./thread/ThreadIf\";\nexport { ThreadPrimitiveViewport as Viewport } from \"./thread/ThreadViewport\";\nexport { ThreadPrimitiveViewportProvider as ViewportProvider } from \"../context/providers/ThreadViewportProvider\";\nexport { ThreadPrimitiveViewportFooter as ViewportFooter } from \"./thread/ThreadViewportFooter\";\nexport { ThreadPrimitiveViewportSlack as ViewportSlack } from \"./thread/ThreadViewportSlack\";\nexport { ThreadPrimitiveMessages as Messages } from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveMessageByIndex as MessageByIndex } from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveScrollToBottom as ScrollToBottom } from \"./thread/ThreadScrollToBottom\";\nexport { ThreadPrimitiveSuggestion as Suggestion } from \"./thread/ThreadSuggestion\";\nexport {\n ThreadPrimitiveSuggestions as Suggestions,\n ThreadPrimitiveSuggestionByIndex as SuggestionByIndex,\n} from \"./thread/ThreadSuggestions\";\n","import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type ForwardRefExoticComponent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { Primitive as RadixPrimitive } from \"@radix-ui/react-primitive\";\n\n/**\n * Thin wrapper around `@radix-ui/react-primitive` that adds `render` prop support.\n *\n * When `render` is provided, it is converted to the equivalent `asChild` pattern:\n * render={<Comp props />} + children → asChild + <Comp props>{children}</Comp>\n *\n * All prop merging, ref composition, and event handler chaining remain handled\n * by Radix's battle-tested Slot implementation — we add zero custom logic for that.\n */\n\n// Match @radix-ui/react-primitive's full element set\nconst NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\",\n] as const;\ntype PrimitiveNode = (typeof NODES)[number];\n\ntype PrimitiveProps<E extends PrimitiveNode> = ComponentPropsWithoutRef<\n (typeof RadixPrimitive)[E]\n> & {\n render?: ReactElement | undefined;\n};\n\ntype PrimitiveRef<E extends PrimitiveNode> = ComponentRef<\n (typeof RadixPrimitive)[E]\n>;\n\nfunction createPrimitive<E extends PrimitiveNode>(node: E) {\n const RadixComp = RadixPrimitive[node];\n\n const Component = forwardRef<PrimitiveRef<E>, PrimitiveProps<E>>(\n ({ render, asChild, children, ...props }, ref) => {\n if (render && isValidElement(render)) {\n // render={<Comp p />} + children\n // → asChild + <Comp p>{children}</Comp>\n const renderChildren =\n children !== undefined\n ? children\n : ((render.props as Record<string, unknown>).children as ReactNode);\n return (\n <RadixComp asChild {...(props as any)} ref={ref}>\n {cloneElement(render, undefined, renderChildren)}\n </RadixComp>\n );\n }\n\n return (\n <RadixComp asChild={asChild} {...(props as any)} ref={ref}>\n {children}\n </RadixComp>\n );\n },\n );\n\n Component.displayName = `Primitive.${node}`;\n return Component as ForwardRefExoticComponent<\n PrimitiveProps<E> & RefAttributes<PrimitiveRef<E>>\n >;\n}\n\nconst Primitive = NODES.reduce(\n (acc, node) => {\n acc[node] = createPrimitive(node);\n return acc;\n },\n {} as {\n [K in PrimitiveNode]: ReturnType<typeof createPrimitive<K>>;\n },\n);\n\nexport { Primitive };\nexport type { PrimitiveProps };\n","import {\n SubscribableRuntime,\n useRuntimeStateInternal,\n} from \"./useRuntimeState\";\n\nexport function createStateHookForRuntime<TState>(\n useRuntime: (options: {\n optional: boolean | undefined;\n }) => SubscribableRuntime<TState> | null,\n) {\n // empty\n function useStoreHook(): TState;\n\n // selector\n function useStoreHook<TSelected>(\n selector: (state: TState) => TSelected,\n ): TSelected;\n\n // selector?\n function useStoreHook<TSelected>(\n selector: ((state: TState) => TSelected) | undefined,\n ): TSelected | TState;\n\n // optional=false\n function useStoreHook(options: { optional?: false | undefined }): TState;\n\n // optional?\n function useStoreHook(options: {\n optional?: boolean | undefined;\n }): TState | null;\n\n // optional=false, selector\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected;\n\n // optional=false, selector?\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState;\n\n // optional?, selector\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected | null;\n\n // optional?, selector?\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState | null;\n\n function useStoreHook<TSelected>(\n param?:\n | ((state: TState) => TSelected)\n | {\n optional?: boolean | undefined;\n selector?: ((state: TState) => TSelected) | undefined;\n },\n ): TSelected | TState | null {\n let optional = false;\n let selector: ((state: TState) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param) {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useRuntime({ optional });\n if (!store) return null;\n\n // it is ok to call useRuntimeStateInternal conditionally because it will never become null if its available\n return useRuntimeStateInternal(store, selector);\n }\n\n return useStoreHook;\n}\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const MessageAttachmentByIndexProvider: FC<\n PropsWithChildren<{\n index: number;\n }>\n> = ({ index, children }) => {\n const aui = useAui({\n attachment: Derived({\n source: \"message\",\n query: { type: \"index\", index },\n get: (aui) => aui.message().attachment({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n\nexport const ComposerAttachmentByIndexProvider: FC<\n PropsWithChildren<{\n index: number;\n }>\n> = ({ index, children }) => {\n const aui = useAui({\n attachment: Derived({\n source: \"composer\",\n query: { type: \"index\", index },\n get: (aui) => aui.composer().attachment({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { AuiProvider, Derived, useAui } from \"@assistant-ui/store\";\n\nexport type SuggestionByIndexProviderProps = PropsWithChildren<{\n index: number;\n}>;\n\nexport const SuggestionByIndexProvider: FC<SuggestionByIndexProviderProps> = ({\n index,\n children,\n}) => {\n const aui = useAui({\n suggestion: Derived({\n source: \"suggestions\",\n query: { index },\n get: (aui) => aui.suggestions().suggestion({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { AuiProvider, Derived, useAui } from \"@assistant-ui/store\";\n\nexport type QueueItemByIndexProviderProps = PropsWithChildren<{\n index: number;\n}>;\n\nexport const QueueItemByIndexProvider: FC<QueueItemByIndexProviderProps> = ({\n index,\n children,\n}) => {\n const aui = useAui({\n queueItem: Derived({\n source: \"composer\",\n query: { index },\n get: (aui) => aui.composer().queueItem({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const MessageByIndexProvider: FC<\n PropsWithChildren<{\n index: number;\n }>\n> = ({ index, children }) => {\n const aui = useAui({\n message: Derived({\n source: \"thread\",\n query: { type: \"index\", index },\n get: (aui) => aui.thread().message({ index }),\n }),\n composer: Derived({\n source: \"message\",\n query: {},\n get: (aui) => aui.thread().message({ index }).composer(),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const PartByIndexProvider: FC<\n PropsWithChildren<{\n index: number;\n }>\n> = ({ index, children }) => {\n const aui = useAui({\n part: Derived({\n source: \"message\",\n query: { type: \"index\", index },\n get: (aui) => aui.message().part({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type {\n MessagePartStatus,\n ReasoningMessagePart,\n TextMessagePart,\n MessagePartState,\n} from \"@assistant-ui/core\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useSmoothStatusStore } from \"./SmoothContext\";\nimport { writableStore } from \"../../context/ReadonlyStore\";\n\nclass TextStreamAnimator {\n private animationFrameId: number | null = null;\n private lastUpdateTime: number = Date.now();\n\n public targetText: string = \"\";\n\n constructor(\n public currentText: string,\n private setText: (newText: string) => void,\n ) {}\n\n start() {\n if (this.animationFrameId !== null) return;\n this.lastUpdateTime = Date.now();\n this.animate();\n }\n\n stop() {\n if (this.animationFrameId !== null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n }\n\n private animate = () => {\n const currentTime = Date.now();\n const deltaTime = currentTime - this.lastUpdateTime;\n let timeToConsume = deltaTime;\n\n const remainingChars = this.targetText.length - this.currentText.length;\n const baseTimePerChar = Math.min(5, 250 / remainingChars);\n\n let charsToAdd = 0;\n while (timeToConsume >= baseTimePerChar && charsToAdd < remainingChars) {\n charsToAdd++;\n timeToConsume -= baseTimePerChar;\n }\n\n if (charsToAdd !== remainingChars) {\n this.animationFrameId = requestAnimationFrame(this.animate);\n } else {\n this.animationFrameId = null;\n }\n if (charsToAdd === 0) return;\n\n this.currentText = this.targetText.slice(\n 0,\n this.currentText.length + charsToAdd,\n );\n this.lastUpdateTime = currentTime - timeToConsume;\n this.setText(this.currentText);\n };\n}\n\nconst SMOOTH_STATUS: MessagePartStatus = Object.freeze({\n type: \"running\",\n});\n\nexport const useSmooth = (\n state: MessagePartState & (TextMessagePart | ReasoningMessagePart),\n smooth: boolean = false,\n): MessagePartState & (TextMessagePart | ReasoningMessagePart) => {\n const { text } = state;\n const id = useAuiState((s) => s.message.id);\n\n const idRef = useRef(id);\n const [displayedText, setDisplayedText] = useState(\n state.status.type === \"running\" ? \"\" : text,\n );\n\n const smoothStatusStore = useSmoothStatusStore({ optional: true });\n const setText = useCallbackRef((text: string) => {\n setDisplayedText(text);\n if (smoothStatusStore) {\n const target =\n displayedText !== text || state.status.type === \"running\"\n ? SMOOTH_STATUS\n : state.status;\n writableStore(smoothStatusStore).setState(target, true);\n }\n });\n\n // TODO this is hacky\n useEffect(() => {\n if (smoothStatusStore) {\n const target =\n smooth && (displayedText !== text || state.status.type === \"running\")\n ? SMOOTH_STATUS\n : state.status;\n writableStore(smoothStatusStore).setState(target, true);\n }\n }, [smoothStatusStore, smooth, text, displayedText, state.status]);\n\n const [animatorRef] = useState<TextStreamAnimator>(\n new TextStreamAnimator(displayedText, setText),\n );\n\n useEffect(() => {\n if (!smooth) {\n animatorRef.stop();\n return;\n }\n\n if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {\n idRef.current = id;\n\n if (state.status.type === \"running\") {\n // New streaming message → animate from empty string\n setText(\"\");\n animatorRef.currentText = \"\";\n animatorRef.targetText = text;\n animatorRef.start();\n } else {\n // Completed message → display immediately\n setText(text);\n animatorRef.currentText = text;\n animatorRef.targetText = text;\n animatorRef.stop();\n }\n\n return;\n }\n\n animatorRef.targetText = text;\n animatorRef.start();\n }, [setText, animatorRef, id, smooth, text, state.status.type]);\n\n useEffect(() => {\n return () => {\n animatorRef.stop();\n };\n }, [animatorRef]);\n\n return useMemo(\n () =>\n smooth\n ? {\n type: \"text\",\n text: displayedText,\n status: text === displayedText ? state.status : SMOOTH_STATUS,\n }\n : state,\n [smooth, displayedText, state, text],\n );\n};\n","export { MessagePrimitiveRoot as Root } from \"./message/MessageRoot\";\nexport { MessagePrimitiveParts as Parts } from \"./message/MessageParts\";\nexport { MessagePrimitivePartByIndex as PartByIndex } from \"./message/MessageParts\";\nexport { MessagePrimitiveParts as Content } from \"./message/MessageParts\";\nexport { MessagePrimitiveIf as If } from \"./message/MessageIf\";\nexport { MessagePrimitiveAttachments as Attachments } from \"./message/MessageAttachments\";\nexport { MessagePrimitiveAttachmentByIndex as AttachmentByIndex } from \"./message/MessageAttachments\";\nexport { MessagePrimitiveQuote as Quote } from \"@assistant-ui/core/react\";\nexport { MessagePrimitiveError as Error } from \"./message/MessageError\";\nexport {\n MessagePrimitiveUnstable_PartsGrouped as Unstable_PartsGrouped,\n MessagePrimitiveUnstable_PartsGroupedByParentId as Unstable_PartsGroupedByParentId,\n} from \"./message/MessagePartsGrouped\";\n","export { ComposerPrimitiveRoot as Root } from \"./composer/ComposerRoot\";\nexport { ComposerPrimitiveInput as Input } from \"./composer/ComposerInput\";\nexport { ComposerPrimitiveSend as Send } from \"./composer/ComposerSend\";\nexport { ComposerPrimitiveCancel as Cancel } from \"./composer/ComposerCancel\";\nexport { ComposerPrimitiveAddAttachment as AddAttachment } from \"./composer/ComposerAddAttachment\";\nexport { ComposerPrimitiveAttachments as Attachments } from \"./composer/ComposerAttachments\";\nexport { ComposerPrimitiveAttachmentByIndex as AttachmentByIndex } from \"./composer/ComposerAttachments\";\nexport { ComposerPrimitiveAttachmentDropzone as AttachmentDropzone } from \"./composer/ComposerAttachmentDropzone\";\nexport { ComposerPrimitiveDictate as Dictate } from \"./composer/ComposerDictate\";\nexport { ComposerPrimitiveStopDictation as StopDictation } from \"./composer/ComposerStopDictation\";\nexport { ComposerPrimitiveDictationTranscript as DictationTranscript } from \"./composer/ComposerDictationTranscript\";\nexport { ComposerPrimitiveIf as If } from \"./composer/ComposerIf\";\nexport { ComposerPrimitiveQuote as Quote } from \"./composer/ComposerQuote\";\nexport { ComposerPrimitiveQuoteText as QuoteText } from \"./composer/ComposerQuote\";\nexport { ComposerPrimitiveQuoteDismiss as QuoteDismiss } from \"./composer/ComposerQuote\";\nexport { ComposerPrimitiveQueue as Queue } from \"./composer/ComposerQueue\";\nexport { ComposerPrimitiveMentionRoot as Unstable_MentionRoot } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionPopover as Unstable_MentionPopover } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionCategories as Unstable_MentionCategories } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionCategoryItem as Unstable_MentionCategoryItem } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionItems as Unstable_MentionItems } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionItem as Unstable_MentionItem } from \"./composer/mention\";\nexport { ComposerPrimitiveMentionBack as Unstable_MentionBack } from \"./composer/mention\";\nexport { useMentionContext as unstable_useMentionContext } from \"./composer/mention\";\nexport { useMentionContextOptional as unstable_useMentionContextOptional } from \"./composer/mention\";\n","export { ActionBarPrimitiveRoot as Root } from \"./actionBar/ActionBarRoot\";\nexport { ActionBarPrimitiveCopy as Copy } from \"./actionBar/ActionBarCopy\";\nexport { ActionBarPrimitiveReload as Reload } from \"./actionBar/ActionBarReload\";\nexport { ActionBarPrimitiveEdit as Edit } from \"./actionBar/ActionBarEdit\";\nexport { ActionBarPrimitiveSpeak as Speak } from \"./actionBar/ActionBarSpeak\";\nexport { ActionBarPrimitiveStopSpeaking as StopSpeaking } from \"./actionBar/ActionBarStopSpeaking\";\nexport { ActionBarPrimitiveFeedbackPositive as FeedbackPositive } from \"./actionBar/ActionBarFeedbackPositive\";\nexport { ActionBarPrimitiveFeedbackNegative as FeedbackNegative } from \"./actionBar/ActionBarFeedbackNegative\";\nexport { ActionBarPrimitiveExportMarkdown as ExportMarkdown } from \"./actionBar/ActionBarExportMarkdown\";\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","import React from 'react';\n\n// basically Exclude<React.ClassAttributes<T>[\"ref\"], string>\n\nvar updateRef = function updateRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n return;\n }\n ref.current = value;\n};\nvar useComposedRef = function useComposedRef(libRef, userRef) {\n var prevUserRef = React.useRef();\n return React.useCallback(function (instance) {\n libRef.current = instance;\n if (prevUserRef.current) {\n updateRef(prevUserRef.current, null);\n }\n prevUserRef.current = userRef;\n if (!userRef) {\n return;\n }\n updateRef(userRef, instance);\n }, [userRef]);\n};\n\nexport { useComposedRef as default };\n","import { useLayoutEffect } from 'react';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\nexport { index as default };\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { createSlot } from '@radix-ui/react-slot';\n\nconst NODES = [\n 'a',\n 'button',\n 'div',\n 'form',\n 'h2',\n 'h3',\n 'img',\n 'input',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'select',\n 'span',\n 'svg',\n 'ul',\n] as const;\n\ntype Primitives = { [E in (typeof NODES)[number]]: PrimitiveForwardRefComponent<E> };\ntype PrimitivePropsWithRef<E extends React.ElementType> = React.ComponentPropsWithRef<E> & {\n asChild?: boolean;\n};\n\ninterface PrimitiveForwardRefComponent<E extends React.ElementType>\n extends React.ForwardRefExoticComponent<PrimitivePropsWithRef<E>> {}\n\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/\n\nconst Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props: PrimitivePropsWithRef<typeof node>, forwardedRef: any) => {\n const { asChild, ...primitiveProps } = props;\n const Comp: any = asChild ? Slot : node;\n\n if (typeof window !== 'undefined') {\n (window as any)[Symbol.for('radix-ui')] = true;\n }\n\n return <Comp {...primitiveProps} ref={forwardedRef} />;\n });\n\n Node.displayName = `Primitive.${node}`;\n\n return { ...primitive, [node]: Node };\n}, {} as Primitives);\n\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not necessary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */\n\nfunction dispatchDiscreteCustomEvent<E extends CustomEvent>(target: E['target'], event: E) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = Primitive;\n\nexport {\n Primitive,\n //\n Root,\n //\n dispatchDiscreteCustomEvent,\n};\nexport type { PrimitivePropsWithRef };\n","import type { Unsubscribe } from \"@assistant-ui/core\";\nimport { useDebugValue, useSyncExternalStore } from \"react\";\nimport { ensureBinding } from \"./ensureBinding\";\n\nexport type SubscribableRuntime<TState> = {\n getState: () => TState;\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport function useRuntimeStateInternal<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected | TState) | undefined = identity,\n): TSelected | TState {\n // TODO move to useRuntimeState\n ensureBinding(runtime);\n\n const slice = useSyncExternalStore(\n runtime.subscribe,\n () => selector(runtime.getState()),\n () => selector(runtime.getState()),\n );\n useDebugValue(slice);\n return slice;\n}\n\nconst identity = <T>(arg: T): T => arg;\nexport function useRuntimeState<TState>(\n runtime: SubscribableRuntime<TState>,\n): TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: (state: TState) => TSelected,\n): TSelected;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected) | undefined,\n): TSelected | TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector?: ((state: TState) => TSelected) | undefined,\n): TSelected | TState {\n // ensure that the runtime is bound\n // ensureBinding(runtime);\n\n return useRuntimeStateInternal(runtime, selector);\n}\n","\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { RequireAtLeastOne } from \"../../utils/RequireAtLeastOne\";\n\ntype ThreadIfFilters = {\n empty: boolean | undefined;\n running: boolean | undefined;\n disabled: boolean | undefined;\n};\n\ntype UseThreadIfProps = RequireAtLeastOne<ThreadIfFilters>;\n\nconst useThreadIf = (props: UseThreadIfProps) => {\n return useAuiState((s) => {\n if (props.empty === true && !s.thread.isEmpty) return false;\n if (props.empty === false && s.thread.isEmpty) return false;\n\n if (props.running === true && !s.thread.isRunning) return false;\n if (props.running === false && s.thread.isRunning) return false;\n if (props.disabled === true && !s.thread.isDisabled) return false;\n if (props.disabled === false && s.thread.isDisabled) return false;\n\n return true;\n });\n};\n\nexport namespace ThreadPrimitiveIf {\n export type Props = PropsWithChildren<UseThreadIfProps>;\n}\n\n/**\n * @deprecated Use `<AuiIf condition={(s) => s.thread...} />` instead.\n */\nexport const ThreadPrimitiveIf: FC<ThreadPrimitiveIf.Props> = ({\n children,\n ...query\n}) => {\n const result = useThreadIf(query);\n return result ? children : null;\n};\n\nThreadPrimitiveIf.displayName = \"ThreadPrimitive.If\";\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, type ClientOutput } from \"@assistant-ui/store\";\nimport type { PartState } from \"../../store/scopes/part\";\nimport { resource, tapMemo } from \"@assistant-ui/tap\";\n\nconst TextMessagePartClient = resource(\n ({\n text,\n isRunning,\n }: {\n text: string;\n isRunning: boolean;\n }): ClientOutput<\"part\"> => {\n const state = tapMemo<PartState>(\n () => ({\n type: \"text\",\n text,\n status: isRunning ? { type: \"running\" } : { type: \"complete\" },\n }),\n [text, isRunning],\n );\n\n return {\n getState: () => state,\n addToolResult: () => {\n throw new Error(\"Not supported\");\n },\n resumeToolCall: () => {\n throw new Error(\"Not supported\");\n },\n };\n },\n);\n\nexport const TextMessagePartProvider: FC<\n PropsWithChildren<{\n text: string;\n isRunning?: boolean;\n }>\n> = ({ text, isRunning = false, children }) => {\n const aui = useAui({\n part: TextMessagePartClient({ text, isRunning }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","\"use client\";\n\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type {\n ActionButtonElement,\n ActionButtonProps,\n} from \"../../utils/createActionButton\";\nimport { createActionButton } from \"../../utils/createActionButton\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nconst useComposerStopDictation = () => {\n const aui = useAui();\n const isDictating = useAuiState((s) => s.composer.dictation != null);\n\n const callback = useCallback(() => {\n aui.composer().stopDictation();\n }, [aui]);\n\n if (!isDictating) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveStopDictation {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerStopDictation>;\n}\n\n/**\n * A button that stops the current dictation session.\n *\n * Only rendered when dictation is active.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.StopDictation>\n * <StopIcon />\n * </ComposerPrimitive.StopDictation>\n * ```\n */\nexport const ComposerPrimitiveStopDictation = createActionButton(\n \"ComposerPrimitive.StopDictation\",\n useComposerStopDictation,\n);\n","import { useEffect } from \"react\";\nimport { useEffectEvent } from \"use-effect-event\";\nimport { useAui } from \"./useAui\";\nimport type {\n AssistantEventName,\n AssistantEventCallback,\n AssistantEventSelector,\n} from \"./types/events\";\nimport { normalizeEventSelector } from \"./types/events\";\n\nexport const useAuiEvent = <TEvent extends AssistantEventName>(\n selector: AssistantEventSelector<TEvent>,\n callback: AssistantEventCallback<TEvent>,\n) => {\n const aui = useAui();\n const callbackRef = useEffectEvent(callback);\n\n const { scope, event } = normalizeEventSelector(selector);\n useEffect(\n () => aui.on({ scope, event }, callbackRef),\n [aui, scope, event, callbackRef],\n );\n};\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport {\n useActionBarFloatStatus,\n HideAndFloatStatus,\n} from \"./useActionBarFloatStatus\";\nimport { ActionBarInteractionContext } from \"./ActionBarInteractionContext\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ActionBarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps & {\n /**\n * Whether to hide the action bar when the thread is running.\n * @default false\n */\n hideWhenRunning?: boolean | undefined;\n /**\n * Controls when the action bar should automatically hide.\n * - \"always\": Always hide unless hovered\n * - \"not-last\": Hide unless this is the last message\n * - \"never\": Never auto-hide\n * @default \"never\"\n */\n autohide?: \"always\" | \"not-last\" | \"never\" | undefined;\n /**\n * Controls floating behavior when auto-hidden.\n * - \"always\": Always float when hidden\n * - \"single-branch\": Float only for single-branch messages\n * - \"never\": Never float\n * @default \"never\"\n */\n autohideFloat?: \"always\" | \"single-branch\" | \"never\" | undefined;\n };\n}\n\n/**\n * The root container for action bar components.\n *\n * This component provides intelligent visibility and floating behavior for action bars,\n * automatically hiding and showing based on message state, hover status, and configuration.\n * It supports floating mode for better UX when space is limited.\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Root\n * hideWhenRunning={true}\n * autohide=\"not-last\"\n * autohideFloat=\"single-branch\"\n * >\n * <ActionBarPrimitive.Copy />\n * <ActionBarPrimitive.Edit />\n * <ActionBarPrimitive.Reload />\n * </ActionBarPrimitive.Root>\n * ```\n */\nexport const ActionBarPrimitiveRoot = forwardRef<\n ActionBarPrimitiveRoot.Element,\n ActionBarPrimitiveRoot.Props\n>(({ hideWhenRunning, autohide, autohideFloat, ...rest }, ref) => {\n const [interactionCount, setInteractionCount] = useState(0);\n\n const acquireInteractionLock = useCallback(() => {\n let released = false;\n\n setInteractionCount((count) => count + 1);\n\n return () => {\n if (released) return;\n released = true;\n setInteractionCount((count) => Math.max(0, count - 1));\n };\n }, []);\n\n const interactionContext = useMemo(\n () => ({ acquireInteractionLock }),\n [acquireInteractionLock],\n );\n\n const hideAndfloatStatus = useActionBarFloatStatus({\n hideWhenRunning,\n autohide,\n autohideFloat,\n forceVisible: interactionCount > 0,\n });\n\n if (hideAndfloatStatus === HideAndFloatStatus.Hidden) return null;\n\n return (\n <ActionBarInteractionContext.Provider value={interactionContext}>\n <Primitive.div\n {...(hideAndfloatStatus === HideAndFloatStatus.Floating\n ? { \"data-floating\": \"true\" }\n : null)}\n {...rest}\n ref={ref}\n />\n </ActionBarInteractionContext.Provider>\n );\n});\n\nActionBarPrimitiveRoot.displayName = \"ActionBarPrimitive.Root\";\n","\"use client\";\n\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEffect } from \"react\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport const useOnScrollToBottom = (\n callback: (config: { behavior: ScrollBehavior }) => void,\n) => {\n const callbackRef = useCallbackRef(callback);\n const onScrollToBottom = useThreadViewport((vp) => vp.onScrollToBottom);\n\n useEffect(() => {\n return onScrollToBottom(callbackRef);\n }, [onScrollToBottom, callbackRef]);\n};\n","\"use client\";\n\nimport { Primitive } from \"../../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n useCallback,\n} from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useMentionContext } from \"./ComposerMentionContext\";\nimport type { Unstable_MentionItem } from \"@assistant-ui/core\";\n\n// =============================================================================\n// MentionItems — Renders the list of items within a category\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionItems {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.div>,\n \"children\"\n > & {\n /**\n * Render function that receives the filtered items and returns\n * the UI. A render-function pattern is used here (instead of a\n * `components` prop) to give consumers full control over list layout,\n * ordering, grouping, and empty states.\n */\n children: (items: readonly Unstable_MentionItem[]) => ReactNode;\n };\n}\n\nexport const ComposerPrimitiveMentionItems = forwardRef<\n ComposerPrimitiveMentionItems.Element,\n ComposerPrimitiveMentionItems.Props\n>(({ children, ...props }, forwardedRef) => {\n const { items, activeCategoryId, isSearchMode } = useMentionContext();\n\n if (!activeCategoryId && !isSearchMode) return null;\n\n return (\n <Primitive.div role=\"group\" {...props} ref={forwardedRef}>\n {children(items)}\n </Primitive.div>\n );\n});\n\nComposerPrimitiveMentionItems.displayName = \"ComposerPrimitive.MentionItems\";\n\n// =============================================================================\n// MentionItem — A single selectable mention item\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionItem {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button> & {\n item: Unstable_MentionItem;\n /** Position in the items list. Used for keyboard highlight matching. Falls back to findIndex by id. */\n index?: number | undefined;\n };\n}\n\n/**\n * A button that inserts the mention item into the composer.\n * Automatically receives `data-highlighted` when keyboard-navigated.\n */\nexport const ComposerPrimitiveMentionItem = forwardRef<\n ComposerPrimitiveMentionItem.Element,\n ComposerPrimitiveMentionItem.Props\n>(({ item, index: indexProp, onClick, ...props }, forwardedRef) => {\n const {\n selectItem,\n items,\n highlightedIndex,\n activeCategoryId,\n isSearchMode,\n } = useMentionContext();\n\n const handleClick = useCallback(() => {\n selectItem(item);\n }, [selectItem, item]);\n\n // Use explicit index prop if provided, fall back to findIndex\n const itemIndex = indexProp ?? items.findIndex((i) => i.id === item.id);\n const isHighlighted =\n (isSearchMode || activeCategoryId !== null) &&\n itemIndex === highlightedIndex;\n\n return (\n <Primitive.button\n type=\"button\"\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted ? \"\" : undefined}\n {...props}\n ref={forwardedRef}\n onClick={composeEventHandlers(onClick, handleClick)}\n />\n );\n});\n\nComposerPrimitiveMentionItem.displayName = \"ComposerPrimitive.MentionItem\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n forwardRef,\n useCallback,\n} from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\n\n// ---- Root ----\n\nexport namespace ComposerPrimitiveQuote {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * Renders a container for the quoted text preview in the composer.\n * Only renders when a quote is set.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Quote>\n * <ComposerPrimitive.QuoteText />\n * <ComposerPrimitive.QuoteDismiss>×</ComposerPrimitive.QuoteDismiss>\n * </ComposerPrimitive.Quote>\n * ```\n */\nexport const ComposerPrimitiveQuote = forwardRef<\n ComposerPrimitiveQuote.Element,\n ComposerPrimitiveQuote.Props\n>((props, forwardedRef) => {\n const quote = useAuiState((s) => s.composer.quote);\n if (!quote) return null;\n\n return <Primitive.div {...props} ref={forwardedRef} />;\n});\n\nComposerPrimitiveQuote.displayName = \"ComposerPrimitive.Quote\";\n\n// ---- QuoteText ----\n\nexport namespace ComposerPrimitiveQuoteText {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the quoted text content.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.QuoteText />\n * ```\n */\nexport const ComposerPrimitiveQuoteText = forwardRef<\n ComposerPrimitiveQuoteText.Element,\n ComposerPrimitiveQuoteText.Props\n>(({ children, ...props }, forwardedRef) => {\n const text = useAuiState((s) => s.composer.quote?.text);\n if (!text) return null;\n\n return (\n <Primitive.span {...props} ref={forwardedRef}>\n {children ?? text}\n </Primitive.span>\n );\n});\n\nComposerPrimitiveQuoteText.displayName = \"ComposerPrimitive.QuoteText\";\n\n// ---- QuoteDismiss ----\n\nexport namespace ComposerPrimitiveQuoteDismiss {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\n/**\n * A button that clears the current quote from the composer.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.QuoteDismiss>×</ComposerPrimitive.QuoteDismiss>\n * ```\n */\nexport const ComposerPrimitiveQuoteDismiss = forwardRef<\n ComposerPrimitiveQuoteDismiss.Element,\n ComposerPrimitiveQuoteDismiss.Props\n>(({ onClick, ...props }, forwardedRef) => {\n const aui = useAui();\n const handleDismiss = useCallback(() => {\n aui.composer().setQuote(undefined);\n }, [aui]);\n\n return (\n <Primitive.button\n type=\"button\"\n {...props}\n ref={forwardedRef}\n onClick={composeEventHandlers(onClick, handleDismiss)}\n />\n );\n});\n\nComposerPrimitiveQuoteDismiss.displayName = \"ComposerPrimitive.QuoteDismiss\";\n","\"use client\";\n\nimport { Primitive } from \"../../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n forwardRef,\n useCallback,\n} from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useMentionContext } from \"./ComposerMentionContext\";\nimport type { Unstable_MentionCategory } from \"@assistant-ui/core\";\n\n// =============================================================================\n// MentionCategories — Renders the list of categories\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionCategories {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.div>,\n \"children\"\n > & {\n /**\n * Render function that receives the filtered categories and returns\n * the UI. A render-function pattern is used here (instead of a\n * `components` prop) to give consumers full control over list layout,\n * ordering, grouping, and empty states.\n */\n children: (categories: readonly Unstable_MentionCategory[]) => ReactNode;\n };\n}\n\nexport const ComposerPrimitiveMentionCategories = forwardRef<\n ComposerPrimitiveMentionCategories.Element,\n ComposerPrimitiveMentionCategories.Props\n>(({ children, ...props }, forwardedRef) => {\n const { categories, activeCategoryId, isSearchMode } = useMentionContext();\n\n if (activeCategoryId || isSearchMode) return null;\n\n return (\n <Primitive.div role=\"group\" {...props} ref={forwardedRef}>\n {children(categories)}\n </Primitive.div>\n );\n});\n\nComposerPrimitiveMentionCategories.displayName =\n \"ComposerPrimitive.MentionCategories\";\n\n// =============================================================================\n// MentionCategoryItem — A single category row (clickable to drill-down)\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionCategoryItem {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button> & {\n categoryId: string;\n };\n}\n\n/**\n * A button that selects a category and triggers drill-down navigation.\n * Automatically receives `data-highlighted` when keyboard-navigated.\n */\nexport const ComposerPrimitiveMentionCategoryItem = forwardRef<\n ComposerPrimitiveMentionCategoryItem.Element,\n ComposerPrimitiveMentionCategoryItem.Props\n>(({ categoryId, onClick, ...props }, forwardedRef) => {\n const {\n selectCategory,\n categories,\n highlightedIndex,\n activeCategoryId,\n isSearchMode,\n } = useMentionContext();\n\n const handleClick = useCallback(() => {\n selectCategory(categoryId);\n }, [selectCategory, categoryId]);\n\n // Derive highlighted state from context — no manual wiring needed\n const isHighlighted =\n !activeCategoryId &&\n !isSearchMode &&\n categories.findIndex((c) => c.id === categoryId) === highlightedIndex;\n\n return (\n <Primitive.button\n type=\"button\"\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted ? \"\" : undefined}\n {...props}\n ref={forwardedRef}\n onClick={composeEventHandlers(onClick, handleClick)}\n />\n );\n});\n\nComposerPrimitiveMentionCategoryItem.displayName =\n \"ComposerPrimitive.MentionCategoryItem\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\n\nexport namespace ThreadPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n /**\n * Props for the ThreadPrimitive.Root component.\n * Accepts all standard div element props.\n */\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * The root container component for a thread.\n *\n * This component serves as the foundational wrapper for all thread-related components.\n * It provides the basic structure and context needed for thread functionality.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Root>\n * <ThreadPrimitive.Viewport>\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * </ThreadPrimitive.Viewport>\n * </ThreadPrimitive.Root>\n * ```\n */\nexport const ThreadPrimitiveRoot = forwardRef<\n ThreadPrimitiveRoot.Element,\n ThreadPrimitiveRoot.Props\n>((props, ref) => {\n return <Primitive.div {...props} ref={ref} />;\n});\n\nThreadPrimitiveRoot.displayName = \"ThreadPrimitive.Root\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace ComposerPrimitiveDictationTranscript {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\n/**\n * Renders the current interim (partial) transcript while dictation is active.\n *\n * This component displays real-time feedback of what the user is saying before\n * the transcription is finalized and committed to the composer input.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.If dictation>\n * <div className=\"dictation-preview\">\n * <ComposerPrimitive.DictationTranscript />\n * </div>\n * </ComposerPrimitive.If>\n * ```\n */\nexport const ComposerPrimitiveDictationTranscript = forwardRef<\n ComposerPrimitiveDictationTranscript.Element,\n ComposerPrimitiveDictationTranscript.Props\n>(({ children, ...props }, forwardRef) => {\n const transcript = useAuiState((s) => s.composer.dictation?.transcript);\n\n if (!transcript) return null;\n\n return (\n <Primitive.span {...props} ref={forwardRef}>\n {children ?? transcript}\n </Primitive.span>\n );\n});\n\nComposerPrimitiveDictationTranscript.displayName =\n \"ComposerPrimitive.DictationTranscript\";\n","\"use client\";\n\nimport { Primitive } from \"../../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { useMentionContext } from \"./ComposerMentionContext\";\n\n// =============================================================================\n// MentionPopover — Container that only renders when mention is active\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionPopover {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * Renders a container for the mention picker popover.\n * Only renders when a `@` trigger is detected in the composer text.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.MentionRoot adapter={mentionAdapter}>\n * <ComposerPrimitive.Input />\n * <ComposerPrimitive.MentionPopover>\n * <ComposerPrimitive.MentionCategories />\n * </ComposerPrimitive.MentionPopover>\n * </ComposerPrimitive.MentionRoot>\n * ```\n */\nexport const ComposerPrimitiveMentionPopover = forwardRef<\n ComposerPrimitiveMentionPopover.Element,\n ComposerPrimitiveMentionPopover.Props\n>((props, forwardedRef) => {\n const { open } = useMentionContext();\n if (!open) return null;\n\n return (\n <Primitive.div\n role=\"listbox\"\n data-state=\"open\"\n {...props}\n ref={forwardedRef}\n />\n );\n});\n\nComposerPrimitiveMentionPopover.displayName =\n \"ComposerPrimitive.MentionPopover\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n useCallback,\n} from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\nimport { ThreadPrimitiveViewportSlack } from \"../thread/ThreadViewportSlack\";\n\nconst useIsHoveringRef = () => {\n const aui = useAui();\n const message = useAuiState(() => aui.message());\n\n const callbackRef = useCallback(\n (el: HTMLElement) => {\n const handleMouseEnter = () => {\n message.setIsHovering(true);\n };\n const handleMouseLeave = () => {\n message.setIsHovering(false);\n };\n\n el.addEventListener(\"mouseenter\", handleMouseEnter);\n el.addEventListener(\"mouseleave\", handleMouseLeave);\n\n if (el.matches(\":hover\")) {\n // TODO this is needed for SSR to work, figure out why\n queueMicrotask(() => message.setIsHovering(true));\n }\n\n return () => {\n el.removeEventListener(\"mouseenter\", handleMouseEnter);\n el.removeEventListener(\"mouseleave\", handleMouseLeave);\n message.setIsHovering(false);\n };\n },\n [message],\n );\n\n return useManagedRef(callbackRef);\n};\n\n/**\n * Hook that registers the anchor user message as a content inset.\n * Only registers if: user message, at index messages.length-2, and last message is assistant.\n */\nconst useMessageViewportRef = () => {\n const turnAnchor = useThreadViewport((s) => s.turnAnchor);\n const registerUserHeight = useThreadViewport(\n (s) => s.registerUserMessageHeight,\n );\n\n // inset rules:\n // - the previous user message before the last assistant message registers its full height\n const shouldRegisterAsInset = useAuiState(\n (s) =>\n turnAnchor === \"top\" &&\n s.message.role === \"user\" &&\n s.message.index === s.thread.messages.length - 2 &&\n s.thread.messages.at(-1)?.role === \"assistant\",\n );\n\n const getHeight = useCallback((el: HTMLElement) => el.offsetHeight, []);\n\n return useSizeHandle(\n shouldRegisterAsInset ? registerUserHeight : null,\n getHeight,\n );\n};\n\nexport namespace MessagePrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n /**\n * Props for the MessagePrimitive.Root component.\n * Accepts all standard div element props.\n */\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * The root container component for a message.\n *\n * This component provides the foundational wrapper for message content and handles\n * hover state management for the message. It automatically tracks when the user\n * is hovering over the message, which can be used by child components like action bars.\n *\n * When `turnAnchor=\"top\"` is set on the viewport, this component\n * registers itself as the scroll anchor if it's the last user message.\n *\n * @example\n * ```tsx\n * <MessagePrimitive.Root>\n * <MessagePrimitive.Content />\n * <ActionBarPrimitive.Root>\n * <ActionBarPrimitive.Copy />\n * <ActionBarPrimitive.Edit />\n * </ActionBarPrimitive.Root>\n * </MessagePrimitive.Root>\n * ```\n */\nexport const MessagePrimitiveRoot = forwardRef<\n MessagePrimitiveRoot.Element,\n MessagePrimitiveRoot.Props\n>((props, forwardRef) => {\n const isHoveringRef = useIsHoveringRef();\n const anchorUserMessageRef = useMessageViewportRef();\n const ref = useComposedRefs<HTMLDivElement>(\n forwardRef,\n isHoveringRef,\n anchorUserMessageRef,\n );\n const messageId = useAuiState((s) => s.message.id);\n\n return (\n <ThreadPrimitiveViewportSlack>\n <Primitive.div {...props} ref={ref} data-message-id={messageId} />\n </ThreadPrimitiveViewportSlack>\n );\n});\n\nMessagePrimitiveRoot.displayName = \"MessagePrimitive.Root\";\n","\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { RequireAtLeastOne } from \"../../utils/RequireAtLeastOne\";\n\ntype MessageIfFilters = {\n user: boolean | undefined;\n assistant: boolean | undefined;\n system: boolean | undefined;\n hasBranches: boolean | undefined;\n copied: boolean | undefined;\n lastOrHover: boolean | undefined;\n last: boolean | undefined;\n speaking: boolean | undefined;\n hasAttachments: boolean | undefined;\n hasContent: boolean | undefined;\n submittedFeedback: \"positive\" | \"negative\" | null | undefined;\n};\ntype UseMessageIfProps = RequireAtLeastOne<MessageIfFilters>;\n\nconst useMessageIf = (props: UseMessageIfProps) => {\n return useAuiState((s) => {\n const {\n role,\n attachments,\n parts,\n branchCount,\n isLast,\n speech,\n isCopied,\n isHovering,\n } = s.message;\n\n if (props.hasBranches === true && branchCount < 2) return false;\n\n if (props.user && role !== \"user\") return false;\n if (props.assistant && role !== \"assistant\") return false;\n if (props.system && role !== \"system\") return false;\n\n if (props.lastOrHover === true && !isHovering && !isLast) return false;\n if (props.last !== undefined && props.last !== isLast) return false;\n\n if (props.copied === true && !isCopied) return false;\n if (props.copied === false && isCopied) return false;\n\n if (props.speaking === true && speech == null) return false;\n if (props.speaking === false && speech != null) return false;\n\n if (\n props.hasAttachments === true &&\n (role !== \"user\" || !attachments?.length)\n )\n return false;\n if (\n props.hasAttachments === false &&\n role === \"user\" &&\n !!attachments?.length\n )\n return false;\n\n if (props.hasContent === true && parts.length === 0) return false;\n if (props.hasContent === false && parts.length > 0) return false;\n\n if (\n props.submittedFeedback !== undefined &&\n (s.message.metadata.submittedFeedback?.type ?? null) !==\n props.submittedFeedback\n )\n return false;\n\n return true;\n });\n};\n\nexport namespace MessagePrimitiveIf {\n export type Props = PropsWithChildren<UseMessageIfProps>;\n}\n\n/**\n * @deprecated Use `<AuiIf condition={(s) => s.message...} />` instead.\n */\nexport const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({\n children,\n ...query\n}) => {\n const result = useMessageIf(query);\n return result ? children : null;\n};\n\nMessagePrimitiveIf.displayName = \"MessagePrimitive.If\";\n","\"use client\";\n\nimport { Primitive } from \"../../../utils/Primitive\";\nimport {\n type ComponentRef,\n type ComponentPropsWithoutRef,\n forwardRef,\n useCallback,\n} from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useMentionContext } from \"./ComposerMentionContext\";\n\n// =============================================================================\n// MentionBack — Button to navigate back from items to categories\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionBack {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\n/**\n * A button that navigates back from category items to the category list.\n * Only renders when a category is active (drill-down view).\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.MentionBack>\n * &larr; Back\n * </ComposerPrimitive.MentionBack>\n * ```\n */\nexport const ComposerPrimitiveMentionBack = forwardRef<\n ComposerPrimitiveMentionBack.Element,\n ComposerPrimitiveMentionBack.Props\n>(({ onClick, ...props }, forwardedRef) => {\n const { activeCategoryId, isSearchMode, goBack } = useMentionContext();\n\n const handleClick = useCallback(() => {\n goBack();\n }, [goBack]);\n\n if (!activeCategoryId || isSearchMode) return null;\n\n return (\n <Primitive.button\n type=\"button\"\n {...props}\n ref={forwardedRef}\n onClick={composeEventHandlers(onClick, handleClick)}\n />\n );\n});\n\nComposerPrimitiveMentionBack.displayName = \"ComposerPrimitive.MentionBack\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from \"react\";\nimport { useMessagePartImage } from \"./useMessagePartImage\";\n\nexport namespace MessagePartPrimitiveImage {\n export type Element = ComponentRef<typeof Primitive.img>;\n /**\n * Props for the MessagePartPrimitive.Image component.\n * Accepts all standard img element props.\n */\n export type Props = ComponentPropsWithoutRef<typeof Primitive.img>;\n}\n\n/**\n * Renders an image from the current message part context.\n *\n * This component displays image content from the current message part,\n * automatically setting the src attribute from the message part's image data.\n *\n * @example\n * ```tsx\n * <MessagePartPrimitive.Image\n * alt=\"Generated image\"\n * className=\"message-image\"\n * style={{ maxWidth: '100%' }}\n * />\n * ```\n */\nexport const MessagePartPrimitiveImage = forwardRef<\n MessagePartPrimitiveImage.Element,\n MessagePartPrimitiveImage.Props\n>((props, forwardedRef) => {\n const { image } = useMessagePartImage();\n return <Primitive.img src={image} {...props} ref={forwardedRef} />;\n});\n\nMessagePartPrimitiveImage.displayName = \"MessagePartPrimitive.Image\";\n","import {\n ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n MouseEventHandler,\n} from \"react\";\nimport { Primitive } from \"./Primitive\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\n\ntype ActionButtonCallback<TProps> = (\n props: TProps,\n) => MouseEventHandler<HTMLButtonElement> | null;\n\ntype PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;\n\nexport type ActionButtonProps<THook> = PrimitiveButtonProps &\n (THook extends (props: infer TProps) => unknown ? TProps : never);\n\nexport type ActionButtonElement = ComponentRef<typeof Primitive.button>;\n\nexport const createActionButton = <TProps,>(\n displayName: string,\n useActionButton: ActionButtonCallback<TProps>,\n forwardProps: (keyof NonNullable<TProps>)[] = [],\n) => {\n const ActionButton = forwardRef<\n ActionButtonElement,\n PrimitiveButtonProps & TProps\n >((props, forwardedRef) => {\n const forwardedProps = {} as TProps;\n const primitiveProps = {} as PrimitiveButtonProps;\n\n (Object.keys(props) as Array<keyof typeof props>).forEach((key) => {\n if (forwardProps.includes(key as keyof TProps)) {\n (forwardedProps as any)[key] = props[key];\n } else {\n (primitiveProps as any)[key] = props[key];\n }\n });\n\n const callback = useActionButton(forwardedProps as TProps) ?? undefined;\n return (\n <Primitive.button\n {...primitiveProps}\n type=\"button\"\n ref={forwardedRef}\n disabled={primitiveProps.disabled || !callback}\n onClick={composeEventHandlers(primitiveProps.onClick, callback)}\n />\n );\n });\n\n ActionButton.displayName = displayName;\n\n return ActionButton;\n};\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useActionBarCopy } from \"@assistant-ui/core/react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that provides copy functionality for action bar buttons.\n *\n * This hook returns a callback function that copies message content to the clipboard,\n * or null if copying is not available. It handles both regular message content and\n * composer text when in editing mode.\n *\n * @param options Configuration options\n * @param options.copiedDuration Duration in milliseconds to show the copied state\n * @returns A copy callback function, or null if copying is disabled\n *\n * @example\n * ```tsx\n * function CustomCopyButton() {\n * const copy = useActionBarPrimitiveCopy({ copiedDuration: 2000 });\n *\n * return (\n * <button onClick={copy} disabled={!copy}>\n * {copy ? \"Copy\" : \"Cannot Copy\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useActionBarPrimitiveCopy = ({\n copiedDuration = 3000,\n}: {\n copiedDuration?: number | undefined;\n} = {}) => {\n const { copy, disabled } = useActionBarCopy({\n copiedDuration,\n copyToClipboard: (text) => navigator.clipboard.writeText(text),\n });\n if (disabled) return null;\n return copy;\n};\n\nexport namespace ActionBarPrimitiveCopy {\n export type Element = HTMLButtonElement;\n /**\n * Props for the ActionBarPrimitive.Copy component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useActionBarPrimitiveCopy>;\n}\n\n/**\n * A button component that copies message content to the clipboard.\n *\n * This component automatically handles copying message text to the clipboard\n * and provides visual feedback through the data-copied attribute. It's disabled\n * when there's no copyable content available.\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Copy copiedDuration={2000}>\n * Copy Message\n * </ActionBarPrimitive.Copy>\n * ```\n */\nexport const ActionBarPrimitiveCopy = forwardRef<\n ActionBarPrimitiveCopy.Element,\n ActionBarPrimitiveCopy.Props\n>(({ copiedDuration, onClick, disabled, ...props }, forwardedRef) => {\n const isCopied = useAuiState((s) => s.message.isCopied);\n const callback = useActionBarPrimitiveCopy({ copiedDuration });\n return (\n <Primitive.button\n type=\"button\"\n {...(isCopied ? { \"data-copied\": \"true\" } : {})}\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveCopy.displayName = \"ActionBarPrimitive.Copy\";\n","\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n ElementType,\n} from \"react\";\nimport { useMessagePartText } from \"./useMessagePartText\";\nimport { useSmooth } from \"../../utils/smooth/useSmooth\";\n\nexport namespace MessagePartPrimitiveText {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.span>,\n \"children\" | \"asChild\"\n > & {\n /**\n * Whether to enable smooth text streaming animation.\n * When enabled, text appears with a typing effect as it streams in.\n * @default true\n */\n smooth?: boolean;\n /**\n * The HTML element or React component to render as.\n * @default \"span\"\n */\n component?: ElementType;\n };\n}\n\n/**\n * Renders the text content of a message part with optional smooth streaming.\n *\n * This component displays text content from the current message part context,\n * with support for smooth streaming animation that shows text appearing\n * character by character as it's generated.\n *\n * @example\n * ```tsx\n * <MessagePartPrimitive.Text\n * smooth={true}\n * component=\"p\"\n * className=\"message-text\"\n * />\n * ```\n */\nexport const MessagePartPrimitiveText = forwardRef<\n MessagePartPrimitiveText.Element,\n MessagePartPrimitiveText.Props\n>(({ smooth = true, component: Component = \"span\", ...rest }, forwardedRef) => {\n const { text, status } = useSmooth(useMessagePartText(), smooth);\n\n return (\n <Component data-status={status.type} {...rest} ref={forwardedRef}>\n {text}\n </Component>\n );\n});\n\nMessagePartPrimitiveText.displayName = \"MessagePartPrimitive.Text\";\n","\"use client\";\n\nimport { forwardRef, useCallback } from \"react\";\nimport { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\n\nconst useActionBarExportMarkdown = ({\n filename,\n onExport,\n}: {\n filename?: string | undefined;\n onExport?: ((content: string) => void | Promise<void>) | undefined;\n} = {}) => {\n const aui = useAui();\n const hasExportableContent = useAuiState((s) => {\n return (\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n\n const callback = useCallback(async () => {\n const content = aui.message().getCopyText();\n if (!content) return;\n\n if (onExport) {\n await onExport(content);\n return;\n }\n\n const blob = new Blob([content], { type: \"text/markdown\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = filename ?? `message-${Date.now()}.md`;\n a.click();\n URL.revokeObjectURL(url);\n }, [aui, filename, onExport]);\n\n if (!hasExportableContent) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveExportMarkdown {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarExportMarkdown>;\n}\n\nexport const ActionBarPrimitiveExportMarkdown = forwardRef<\n ActionBarPrimitiveExportMarkdown.Element,\n ActionBarPrimitiveExportMarkdown.Props\n>(({ filename, onExport, onClick, disabled, ...props }, forwardedRef) => {\n const callback = useActionBarExportMarkdown({ filename, onExport });\n return (\n <Primitive.button\n type=\"button\"\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveExportMarkdown.displayName =\n \"ActionBarPrimitive.ExportMarkdown\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useActionBarStopSpeaking as useActionBarStopSpeakingBehavior } from \"@assistant-ui/core/react\";\n\nconst useActionBarStopSpeaking = () => {\n const { disabled, stopSpeaking } = useActionBarStopSpeakingBehavior();\n if (disabled) return null;\n return stopSpeaking;\n};\n\nexport namespace ActionBarPrimitiveStopSpeaking {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarStopSpeaking>;\n}\n\nexport const ActionBarPrimitiveStopSpeaking = forwardRef<\n ActionBarPrimitiveStopSpeaking.Element,\n ActionBarPrimitiveStopSpeaking.Props\n>((props, ref) => {\n const callback = useActionBarStopSpeaking();\n\n // TODO this stops working if the user is not hovering over an older message\n useEscapeKeydown((e) => {\n if (callback) {\n e.preventDefault();\n callback();\n }\n });\n\n return (\n <Primitive.button\n type=\"button\"\n disabled={!callback}\n {...props}\n ref={ref}\n onClick={composeEventHandlers(props.onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveStopSpeaking.displayName = \"ActionBarPrimitive.StopSpeaking\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useActionBarFeedbackNegative as useActionBarFeedbackNegativeBehavior } from \"@assistant-ui/core/react\";\n\nconst useActionBarFeedbackNegative = () => {\n const { submit } = useActionBarFeedbackNegativeBehavior();\n return submit;\n};\n\nexport namespace ActionBarPrimitiveFeedbackNegative {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarFeedbackNegative>;\n}\n\nexport const ActionBarPrimitiveFeedbackNegative = forwardRef<\n ActionBarPrimitiveFeedbackNegative.Element,\n ActionBarPrimitiveFeedbackNegative.Props\n>(({ onClick, disabled, ...props }, forwardedRef) => {\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"negative\",\n );\n const callback = useActionBarFeedbackNegative();\n return (\n <Primitive.button\n type=\"button\"\n {...(isSubmitted ? { \"data-submitted\": \"true\" } : {})}\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveFeedbackNegative.displayName =\n \"ActionBarPrimitive.FeedbackNegative\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useActionBarFeedbackPositive as useActionBarFeedbackPositiveBehavior } from \"@assistant-ui/core/react\";\n\nconst useActionBarFeedbackPositive = () => {\n const { submit } = useActionBarFeedbackPositiveBehavior();\n return submit;\n};\n\nexport namespace ActionBarPrimitiveFeedbackPositive {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarFeedbackPositive>;\n}\n\nexport const ActionBarPrimitiveFeedbackPositive = forwardRef<\n ActionBarPrimitiveFeedbackPositive.Element,\n ActionBarPrimitiveFeedbackPositive.Props\n>(({ onClick, disabled, ...props }, forwardedRef) => {\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"positive\",\n );\n const callback = useActionBarFeedbackPositive();\n return (\n <Primitive.button\n type=\"button\"\n {...(isSubmitted ? { \"data-submitted\": \"true\" } : {})}\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveFeedbackPositive.displayName =\n \"ActionBarPrimitive.FeedbackPositive\";\n","\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useState,\n type ReactElement,\n cloneElement,\n isValidElement,\n} from \"react\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Slot } from \"radix-ui\";\nimport React from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nexport namespace ComposerPrimitiveAttachmentDropzone {\n export type Element = HTMLDivElement;\n export type Props = React.HTMLAttributes<HTMLDivElement> & {\n asChild?: boolean | undefined;\n render?: ReactElement | undefined;\n disabled?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveAttachmentDropzone = forwardRef<\n HTMLDivElement,\n ComposerPrimitiveAttachmentDropzone.Props\n>(({ disabled, asChild = false, render, children, ...rest }, ref) => {\n const [isDragging, setIsDragging] = useState(false);\n const aui = useAui();\n\n const handleDragEnterCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(true);\n },\n [disabled],\n );\n\n const handleDragOverCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n if (!isDragging) setIsDragging(true);\n },\n [disabled, isDragging],\n );\n\n const handleDragLeaveCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n const next = e.relatedTarget as Node | null;\n if (next && e.currentTarget.contains(next)) {\n return;\n }\n setIsDragging(false);\n },\n [disabled],\n );\n\n const handleDrop = useCallback(\n async (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(false);\n for (const file of e.dataTransfer.files) {\n try {\n await aui.composer().addAttachment(file);\n } catch (error) {\n console.error(\"Failed to add attachment:\", error);\n }\n }\n },\n [disabled, aui],\n );\n\n const mergedProps = {\n ...(isDragging ? { \"data-dragging\": \"true\" } : null),\n ...rest,\n onDragEnterCapture: composeEventHandlers(\n rest.onDragEnterCapture,\n handleDragEnterCapture,\n ),\n onDragOverCapture: composeEventHandlers(\n rest.onDragOverCapture,\n handleDragOverCapture,\n ),\n onDragLeaveCapture: composeEventHandlers(\n rest.onDragLeaveCapture,\n handleDragLeaveCapture,\n ),\n onDropCapture: composeEventHandlers(rest.onDropCapture, handleDrop),\n ref,\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n children !== undefined\n ? children\n : (render.props as Record<string, unknown>).children;\n return (\n <Slot.Root {...mergedProps}>\n {cloneElement(render, undefined, renderChildren as React.ReactNode)}\n </Slot.Root>\n );\n }\n\n const Comp = asChild ? Slot.Root : \"div\";\n return <Comp {...mergedProps}>{children}</Comp>;\n});\n\nComposerPrimitiveAttachmentDropzone.displayName =\n \"ComposerPrimitive.AttachmentDropzone\";\n","import { useCallback, useRef } from \"react\";\n\nexport const useManagedRef = <TNode>(\n callback: (node: TNode) => (() => void) | void,\n) => {\n const cleanupRef = useRef<(() => void) | void>(undefined);\n\n const ref = useCallback(\n (el: TNode | null) => {\n // Call the previous cleanup function\n if (cleanupRef.current) {\n cleanupRef.current();\n }\n\n // Call the new callback and store its cleanup function\n if (el) {\n cleanupRef.current = callback(el);\n }\n },\n [callback],\n );\n\n return ref;\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarEdit = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.composer.isEditing);\n\n const edit = useCallback(() => {\n aui.composer().beginEdit();\n }, [aui]);\n\n return { edit, disabled };\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport type UseSuggestionTriggerOptions = {\n prompt: string;\n send?: boolean | undefined;\n clearComposer?: boolean | undefined;\n};\n\nexport const useSuggestionTrigger = ({\n prompt,\n send,\n clearComposer = true,\n}: UseSuggestionTriggerOptions) => {\n const aui = useAui();\n const disabled = useAuiState((s) => s.thread.isDisabled);\n const resolvedSend = send ?? false;\n\n const trigger = useCallback(() => {\n const isRunning = aui.thread().getState().isRunning;\n\n if (resolvedSend && !isRunning) {\n aui.thread().append({\n content: [{ type: \"text\", text: prompt }],\n runConfig: aui.composer().getState().runConfig,\n });\n if (clearComposer) {\n aui.composer().setText(\"\");\n }\n } else {\n if (clearComposer) {\n aui.composer().setText(prompt);\n } else {\n const currentText = aui.composer().getState().text;\n aui\n .composer()\n .setText(currentText.trim() ? `${currentText} ${prompt}` : prompt);\n }\n }\n }, [aui, resolvedSend, clearComposer, prompt]);\n\n return { trigger, disabled };\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport type UseActionBarCopyOptions = {\n copiedDuration?: number | undefined;\n copyToClipboard?: ((text: string) => void | Promise<void>) | undefined;\n};\n\nexport const useActionBarCopy = ({\n copiedDuration = 3000,\n copyToClipboard,\n}: UseActionBarCopyOptions = {}) => {\n const aui = useAui();\n const disabled = useAuiState((s) => {\n return !(\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n const isCopied = useAuiState((s) => s.message.isCopied);\n const isEditing = useAuiState((s) => s.composer.isEditing);\n const composerValue = useAuiState((s) => s.composer.text);\n\n const copy = useCallback(() => {\n const valueToCopy = isEditing ? composerValue : aui.message().getCopyText();\n if (!valueToCopy) return;\n\n const write = copyToClipboard ?? (() => {});\n const result = write(valueToCopy);\n Promise.resolve(result).then(() => {\n aui.message().setIsCopied(true);\n setTimeout(() => aui.message().setIsCopied(false), copiedDuration);\n });\n }, [aui, isEditing, composerValue, copiedDuration, copyToClipboard]);\n\n return { copy, disabled, isCopied };\n};\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useComposerCancel as useComposerCancelBehavior } from \"@assistant-ui/core/react\";\n\nconst useComposerCancel = () => {\n const { disabled, cancel } = useComposerCancelBehavior();\n if (disabled) return null;\n return cancel;\n};\n\nexport namespace ComposerPrimitiveCancel {\n export type Element = ActionButtonElement;\n /**\n * Props for the ComposerPrimitive.Cancel component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useComposerCancel>;\n}\n\n/**\n * A button component that cancels the current message composition.\n *\n * This component automatically handles the cancel functionality and is disabled\n * when canceling is not available.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Cancel>\n * Cancel\n * </ComposerPrimitive.Cancel>\n * ```\n */\nexport const ComposerPrimitiveCancel = createActionButton(\n \"ComposerPrimitive.Cancel\",\n useComposerCancel,\n);\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useActionBarSpeak as useActionBarSpeakBehavior } from \"@assistant-ui/core/react\";\n\nconst useActionBarSpeak = () => {\n const { disabled, speak } = useActionBarSpeakBehavior();\n if (disabled) return null;\n return speak;\n};\n\nexport namespace ActionBarPrimitiveSpeak {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarSpeak>;\n}\n\nexport const ActionBarPrimitiveSpeak = createActionButton(\n \"ActionBarPrimitive.Speak\",\n useActionBarSpeak,\n);\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\n\nexport type ActionBarInteractionContextValue = {\n acquireInteractionLock: () => () => void;\n};\n\nexport const ActionBarInteractionContext =\n createContext<ActionBarInteractionContextValue | null>(null);\n\nexport const useActionBarInteractionContext = () =>\n useContext(ActionBarInteractionContext);\n","\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n useCallback,\n} from \"react\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\nimport { ThreadPrimitiveViewportProvider } from \"../../context/providers/ThreadViewportProvider\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\n /**\n * Whether to automatically scroll to the bottom when new messages are added.\n * When enabled, the viewport will automatically scroll to show the latest content.\n *\n * Default false if `turnAnchor` is \"top\", otherwise defaults to true.\n */\n autoScroll?: boolean | undefined;\n\n /**\n * Controls scroll anchoring behavior for new messages.\n * - \"bottom\" (default): Messages anchor at the bottom, classic chat behavior.\n * - \"top\": New user messages anchor at the top of the viewport for a focused reading experience.\n */\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n\n /**\n * Whether to scroll to bottom when a new run starts.\n *\n * Defaults to true.\n */\n scrollToBottomOnRunStart?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when thread history is first loaded.\n *\n * Defaults to true.\n */\n scrollToBottomOnInitialize?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when switching to a different thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n}\n\nconst useViewportSizeRef = () => {\n const register = useThreadViewport((s) => s.registerViewport);\n const getHeight = useCallback((el: HTMLElement) => el.clientHeight, []);\n return useSizeHandle(register, getHeight);\n};\n\nconst ThreadPrimitiveViewportScrollable = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(\n (\n {\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n children,\n ...rest\n },\n forwardedRef,\n ) => {\n const autoScrollRef = useThreadViewportAutoScroll<HTMLDivElement>({\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n });\n const viewportSizeRef = useViewportSizeRef();\n const ref = useComposedRefs(forwardedRef, autoScrollRef, viewportSizeRef);\n\n return (\n <Primitive.div {...rest} ref={ref}>\n {children}\n </Primitive.div>\n );\n },\n);\n\nThreadPrimitiveViewportScrollable.displayName =\n \"ThreadPrimitive.ViewportScrollable\";\n\n/**\n * A scrollable viewport container for thread messages.\n *\n * This component provides a scrollable area for displaying thread messages with\n * automatic scrolling capabilities. It manages the viewport state and provides\n * context for child components to access viewport-related functionality.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport turnAnchor=\"top\">\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewport = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(({ turnAnchor, ...props }, ref) => {\n return (\n <ThreadPrimitiveViewportProvider options={{ turnAnchor }}>\n <ThreadPrimitiveViewportScrollable {...props} ref={ref} />\n </ThreadPrimitiveViewportProvider>\n );\n});\n\nThreadPrimitiveViewport.displayName = \"ThreadPrimitive.Viewport\";\n","\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n ComponentPropsWithoutRef,\n useCallback,\n} from \"react\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace ThreadPrimitiveViewportFooter {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A footer container that measures its height for scroll calculations.\n *\n * This component measures its height and provides it to the viewport context\n * for use in scroll calculations (e.g., ViewportSlack min-height).\n *\n * Multiple ViewportFooter components can be used - their heights are summed.\n *\n * Typically used with `className=\"sticky bottom-0\"` to keep the footer\n * visible at the bottom of the viewport while scrolling.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport>\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * <ThreadPrimitive.ViewportFooter className=\"sticky bottom-0\">\n * <Composer />\n * </ThreadPrimitive.ViewportFooter>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewportFooter = forwardRef<\n ThreadPrimitiveViewportFooter.Element,\n ThreadPrimitiveViewportFooter.Props\n>((props, forwardedRef) => {\n const register = useThreadViewport((s) => s.registerContentInset);\n const getHeight = useCallback((el: HTMLElement) => {\n const marginTop = parseFloat(getComputedStyle(el).marginTop) || 0;\n return el.offsetHeight + marginTop;\n }, []);\n\n const resizeRef = useSizeHandle(register, getHeight);\n\n const ref = useComposedRefs(forwardedRef, resizeRef);\n\n return <Primitive.div {...props} ref={ref} />;\n});\n\nThreadPrimitiveViewportFooter.displayName = \"ThreadPrimitive.ViewportFooter\";\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useSuggestionTrigger as useSuggestionTriggerBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadSuggestion = ({\n prompt,\n send,\n clearComposer,\n autoSend,\n method: _method,\n}: {\n /** The suggestion prompt. */\n prompt: string;\n\n /**\n * When true, automatically sends the message.\n * When false, replaces or appends the composer text with the suggestion - depending on the value of `clearComposer`.\n */\n send?: boolean | undefined;\n\n /**\n * Whether to clear the composer after sending.\n * When send is set to false, determines if composer text is replaced with suggestion (true, default),\n * or if it's appended to the composer text (false).\n *\n * @default true\n */\n clearComposer?: boolean | undefined;\n\n /** @deprecated Use `send` instead. */\n autoSend?: boolean | undefined;\n\n /** @deprecated Use `clearComposer` instead. */\n method?: \"replace\";\n}) => {\n // ========== Deprecation Mapping ==========\n const resolvedSend = send ?? autoSend ?? false;\n // ==========================================\n\n const { disabled, trigger } = useSuggestionTriggerBehavior({\n prompt,\n send: resolvedSend,\n clearComposer,\n });\n if (disabled) return null;\n return trigger;\n};\n\nexport namespace ThreadPrimitiveSuggestion {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadSuggestion>;\n}\n\nexport const ThreadPrimitiveSuggestion = createActionButton(\n \"ThreadPrimitive.Suggestion\",\n useThreadSuggestion,\n [\"prompt\", \"send\", \"clearComposer\", \"autoSend\", \"method\"],\n);\n","\"use client\";\n\nimport type {\n ActionButtonElement,\n ActionButtonProps,\n} from \"../../utils/createActionButton\";\nimport { createActionButton } from \"../../utils/createActionButton\";\nimport { useComposerDictate as useComposerDictateBehavior } from \"@assistant-ui/core/react\";\n\nconst useComposerDictate = () => {\n const { disabled, startDictation } = useComposerDictateBehavior();\n if (disabled) return null;\n return startDictation;\n};\n\nexport namespace ComposerPrimitiveDictate {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerDictate>;\n}\n\n/**\n * A button that starts dictation to convert voice to text.\n *\n * Requires a DictationAdapter to be configured in the runtime.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Dictate>\n * <MicIcon />\n * </ComposerPrimitive.Dictate>\n * ```\n */\nexport const ComposerPrimitiveDictate = createActionButton(\n \"ComposerPrimitive.Dictate\",\n useComposerDictate,\n);\n","\"use client\";\n\nimport {\n ComponentType,\n createContext,\n FC,\n forwardRef,\n PropsWithChildren,\n useContext,\n useState,\n} from \"react\";\nimport { ReadonlyStore } from \"../../context/ReadonlyStore\";\nimport { create, UseBoundStore } from \"zustand\";\nimport type {\n MessagePartStatus,\n ToolCallMessagePartStatus,\n} from \"@assistant-ui/core\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { createContextStoreHook } from \"../../context/react/utils/createContextStoreHook\";\n\ntype SmoothContextValue = {\n useSmoothStatus: UseBoundStore<\n ReadonlyStore<MessagePartStatus | ToolCallMessagePartStatus>\n >;\n};\n\nconst SmoothContext = createContext<SmoothContextValue | null>(null);\n\nconst makeSmoothContext = (\n initialState: MessagePartStatus | ToolCallMessagePartStatus,\n) => {\n const useSmoothStatus = create(() => initialState);\n return { useSmoothStatus };\n};\n\nexport const SmoothContextProvider: FC<PropsWithChildren> = ({ children }) => {\n const outer = useSmoothContext({ optional: true });\n const aui = useAui();\n\n const [context] = useState(() =>\n makeSmoothContext(aui.part().getState().status),\n );\n\n // do not wrap if there is an outer SmoothContextProvider\n if (outer) return children;\n\n return (\n <SmoothContext.Provider value={context}>{children}</SmoothContext.Provider>\n );\n};\n\nexport const withSmoothContextProvider = <C extends ComponentType<any>>(\n Component: C,\n): C => {\n const Wrapped = forwardRef((props, ref) => {\n return (\n <SmoothContextProvider>\n <Component {...(props as any)} ref={ref} />\n </SmoothContextProvider>\n );\n });\n Wrapped.displayName = Component.displayName;\n return Wrapped as any;\n};\n\nfunction useSmoothContext(options?: {\n optional?: false | undefined;\n}): SmoothContextValue;\nfunction useSmoothContext(options?: {\n optional?: boolean | undefined;\n}): SmoothContextValue | null;\nfunction useSmoothContext(options?: { optional?: boolean | undefined }) {\n const context = useContext(SmoothContext);\n if (!options?.optional && !context)\n throw new Error(\n \"This component must be used within a SmoothContextProvider.\",\n );\n return context;\n}\n\nexport const { useSmoothStatus, useSmoothStatusStore } = createContextStoreHook(\n useSmoothContext,\n \"useSmoothStatus\",\n);\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useActionBarReload as useActionBarReloadBehavior } from \"@assistant-ui/core/react\";\n\n/**\n * Hook that provides reload functionality for action bar buttons.\n *\n * This hook returns a callback function that reloads/regenerates the current assistant message,\n * or null if reloading is not available (e.g., thread is running, disabled, or message is not from assistant).\n *\n * @returns A reload callback function, or null if reloading is disabled\n *\n * @example\n * ```tsx\n * function CustomReloadButton() {\n * const reload = useActionBarReload();\n *\n * return (\n * <button onClick={reload} disabled={!reload}>\n * {reload ? \"Reload Message\" : \"Cannot Reload\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useActionBarReload = () => {\n const { disabled, reload } = useActionBarReloadBehavior();\n if (disabled) return null;\n return reload;\n};\n\nexport namespace ActionBarPrimitiveReload {\n export type Element = ActionButtonElement;\n /**\n * Props for the ActionBarPrimitive.Reload component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useActionBarReload>;\n}\n\n/**\n * A button component that reloads/regenerates the current assistant message.\n *\n * This component automatically handles reloading the current assistant message\n * and is disabled when reloading is not available (e.g., thread is running,\n * disabled, or message is not from assistant).\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Reload>\n * Reload Message\n * </ActionBarPrimitive.Reload>\n * ```\n */\nexport const ActionBarPrimitiveReload = createActionButton(\n \"ActionBarPrimitive.Reload\",\n useActionBarReload,\n);\n","import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n PropsWithChildren,\n useMemo,\n} from \"react\";\nimport {\n RenderChildrenWithAccessor,\n useAuiState,\n useAui,\n} from \"@assistant-ui/store\";\nimport type { PartState } from \"../../../store/scopes/part\";\nimport { PartByIndexProvider } from \"../../providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../providers/TextMessagePartProvider\";\nimport { ChainOfThoughtByIndicesProvider } from \"../../providers/ChainOfThoughtByIndicesProvider\";\nimport { getMessageQuote } from \"../../utils/getMessageQuote\";\nimport type {\n Unstable_AudioMessagePartComponent,\n DataMessagePartComponent,\n DataMessagePartProps,\n EmptyMessagePartComponent,\n TextMessagePartComponent,\n ImageMessagePartComponent,\n SourceMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n FileMessagePartComponent,\n ReasoningMessagePartComponent,\n ReasoningGroupComponent,\n QuoteMessagePartComponent,\n} from \"../../types/MessagePartComponentTypes\";\nimport type { MessagePartStatus } from \"../../../types/message\";\nimport { useShallow } from \"zustand/shallow\";\n\ntype MessagePartRange =\n | { type: \"single\"; index: number }\n | { type: \"toolGroup\"; startIndex: number; endIndex: number }\n | { type: \"reasoningGroup\"; startIndex: number; endIndex: number }\n | { type: \"chainOfThoughtGroup\"; startIndex: number; endIndex: number };\n\n/**\n * Creates a group state manager for a specific part type.\n * Returns functions to start, end, and finalize groups.\n */\nconst createGroupState = <\n T extends \"toolGroup\" | \"reasoningGroup\" | \"chainOfThoughtGroup\",\n>(\n groupType: T,\n) => {\n let start = -1;\n\n return {\n startGroup: (index: number) => {\n if (start === -1) {\n start = index;\n }\n },\n endGroup: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n start = -1;\n }\n },\n finalize: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n }\n },\n };\n};\n\n/**\n * Groups consecutive tool-call and reasoning message parts into ranges.\n * Always groups tool calls and reasoning parts, even if there's only one.\n * When useChainOfThought is true, groups tool-call and reasoning parts together.\n */\nconst groupMessageParts = (\n messageTypes: readonly string[],\n useChainOfThought: boolean,\n): MessagePartRange[] => {\n const ranges: MessagePartRange[] = [];\n\n if (useChainOfThought) {\n const chainOfThoughtGroup = createGroupState(\"chainOfThoughtGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\" || type === \"reasoning\") {\n chainOfThoughtGroup.startGroup(i);\n } else {\n chainOfThoughtGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n chainOfThoughtGroup.finalize(messageTypes.length - 1, ranges);\n } else {\n const toolGroup = createGroupState(\"toolGroup\");\n const reasoningGroup = createGroupState(\"reasoningGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\") {\n reasoningGroup.endGroup(i - 1, ranges);\n toolGroup.startGroup(i);\n } else if (type === \"reasoning\") {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.startGroup(i);\n } else {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n toolGroup.finalize(messageTypes.length - 1, ranges);\n reasoningGroup.finalize(messageTypes.length - 1, ranges);\n }\n\n return ranges;\n};\n\nconst useMessagePartsGroups = (\n useChainOfThought: boolean,\n): MessagePartRange[] => {\n const messageTypes = useAuiState(\n useShallow((s) => s.message.parts.map((c: any) => c.type)),\n );\n\n return useMemo(() => {\n if (messageTypes.length === 0) {\n return [];\n }\n return groupMessageParts(messageTypes, useChainOfThought);\n }, [messageTypes, useChainOfThought]);\n};\n\nexport namespace MessagePrimitiveParts {\n type DataConfig = {\n /** Map data event names to specific components */\n by_name?: Record<string, DataMessagePartComponent | undefined> | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n };\n\n type BaseComponents = {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /** Component for rendering audio content (experimental) */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?: DataConfig | undefined;\n /** Component for rendering a quoted message reference (from metadata, not parts) */\n Quote?: QuoteMessagePartComponent | undefined;\n };\n\n type ToolsConfig =\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n };\n\n /**\n * Standard component configuration for rendering reasoning and tool-call parts\n * individually (with optional grouping).\n *\n * Cannot be combined with `ChainOfThought`.\n */\n type StandardComponents = BaseComponents & {\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Configuration for tool call rendering */\n tools?: ToolsConfig | undefined;\n\n /**\n * Component for rendering grouped consecutive tool calls.\n *\n * @param startIndex - Index of the first tool call in the group\n * @param endIndex - Index of the last tool call in the group\n * @param children - Rendered tool call components to display within the group\n *\n * @deprecated This feature is still experimental and subject to change.\n */\n ToolGroup?: ComponentType<\n PropsWithChildren<{ startIndex: number; endIndex: number }>\n >;\n\n /**\n * Component for rendering grouped reasoning parts.\n *\n * @param startIndex - Index of the first reasoning part in the group\n * @param endIndex - Index of the last reasoning part in the group\n * @param children - Rendered reasoning part components\n */\n ReasoningGroup?: ReasoningGroupComponent;\n\n ChainOfThought?: never;\n };\n\n /**\n * Chain of thought component configuration.\n *\n * When `ChainOfThought` is set, it takes control of rendering ALL reasoning and\n * tool-call parts in the message. The `Reasoning`, `tools`, `ReasoningGroup`, and\n * `ToolGroup` components cannot be used alongside it.\n */\n type ChainOfThoughtComponents = BaseComponents & {\n ChainOfThought: ComponentType;\n\n Reasoning?: never;\n tools?: never;\n ToolGroup?: never;\n ReasoningGroup?: never;\n };\n\n export type Props =\n | {\n /**\n * Component configuration for rendering different types of message content.\n *\n * Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,\n * or `ChainOfThought` to group all reasoning and tool-call parts into a single\n * collapsible component. These two modes are mutually exclusive.\n */\n components?: StandardComponents | ChainOfThoughtComponents | undefined;\n /**\n * When enabled, shows the Empty component if the last part in the message\n * is anything other than Text or Reasoning.\n *\n * @experimental This API is experimental and may change in future versions.\n * @default true\n */\n unstable_showEmptyOnNonTextEnd?: boolean | undefined;\n children?: never;\n }\n | {\n /** Render function called for each part. Receives the enriched part state. */\n children: (value: { part: EnrichedPartState }) => ReactNode;\n components?: never;\n unstable_showEmptyOnNonTextEnd?: never;\n };\n}\n\nconst ToolUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: ToolCallMessagePartComponent | undefined;\n} & ToolCallMessagePartProps) => {\n const Render = useAuiState((s) => {\n const Render = s.tools.tools[props.toolName] ?? Fallback;\n if (Array.isArray(Render)) return Render[0] ?? Fallback;\n return Render;\n });\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: DataMessagePartComponent | undefined;\n} & DataMessagePartProps) => {\n const Render = useAuiState((s) => {\n const Render = s.dataRenderers.renderers[props.name] ?? Fallback;\n if (Array.isArray(Render)) return Render[0] ?? Fallback;\n return Render;\n });\n if (!Render) return null;\n return <Render {...props} />;\n};\n\n/**\n * Platform-agnostic no-op default components.\n * Each platform (web, RN) wraps MessagePrimitiveParts with its own defaults.\n */\nexport const defaultComponents = {\n Text: () => null,\n Reasoning: () => null,\n Source: () => null,\n Image: () => null,\n File: () => null,\n Unstable_Audio: () => null,\n ToolGroup: ({ children }: PropsWithChildren) => children,\n ReasoningGroup: ({ children }: PropsWithChildren) => children,\n} satisfies MessagePrimitiveParts.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveParts.Props[\"components\"];\n};\n\nexport const MessagePartComponent: FC<MessagePartComponentProps> = ({\n components: {\n Text = defaultComponents.Text,\n Reasoning = defaultComponents.Reasoning,\n Image = defaultComponents.Image,\n Source = defaultComponents.Source,\n File = defaultComponents.File,\n Unstable_Audio: Audio = defaultComponents.Unstable_Audio,\n tools = {},\n data,\n } = {},\n}) => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n\n const type = part.type;\n if (type === \"tool-call\") {\n const addResult = aui.part().addToolResult;\n const resume = aui.part().resumeToolCall;\n if (\"Override\" in tools)\n return <tools.Override {...part} addResult={addResult} resume={resume} />;\n const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;\n return (\n <ToolUIDisplay\n {...part}\n Fallback={Tool}\n addResult={addResult}\n resume={resume}\n />\n );\n }\n\n if (part.status?.type === \"requires-action\")\n throw new Error(\"Encountered unexpected requires-action status\");\n\n switch (type) {\n case \"text\":\n return <Text {...part} />;\n\n case \"reasoning\":\n return <Reasoning {...part} />;\n\n case \"source\":\n return <Source {...part} />;\n\n case \"image\":\n return <Image {...part} />;\n\n case \"file\":\n return <File {...part} />;\n\n case \"audio\":\n return <Audio {...part} />;\n\n case \"data\": {\n const Data = data?.by_name?.[part.name] ?? data?.Fallback;\n return <DataUIDisplay {...part} Fallback={Data} />;\n }\n\n default:\n console.warn(`Unknown message part type: ${type}`);\n return null;\n }\n};\n\nexport namespace MessagePrimitivePartByIndex {\n export type Props = {\n index: number;\n components: MessagePrimitiveParts.Props[\"components\"];\n };\n}\n\n/**\n * Renders a single message part at the specified index.\n */\nexport const MessagePrimitivePartByIndex: FC<MessagePrimitivePartByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <PartByIndexProvider index={index}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data &&\n prev.components?.ToolGroup === next.components?.ToolGroup &&\n prev.components?.ReasoningGroup === next.components?.ReasoningGroup,\n );\n\nMessagePrimitivePartByIndex.displayName = \"MessagePrimitive.PartByIndex\";\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n if (status.type !== \"running\") return null;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst ConditionalEmptyImpl: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n enabled: boolean;\n}> = ({ components, enabled }) => {\n const shouldShowEmpty = useAuiState((s) => {\n if (!enabled) return false;\n if (s.message.parts.length === 0) return false;\n\n const lastPart = s.message.parts[s.message.parts.length - 1];\n return lastPart?.type !== \"text\" && lastPart?.type !== \"reasoning\";\n });\n\n if (!shouldShowEmpty) return null;\n return <EmptyParts components={components} />;\n};\n\nconst ConditionalEmpty = memo(\n ConditionalEmptyImpl,\n (prev, next) =>\n prev.enabled === next.enabled &&\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst QuoteRendererImpl: FC<{ Quote: QuoteMessagePartComponent }> = ({\n Quote,\n}) => {\n const quoteInfo = useAuiState(getMessageQuote);\n if (!quoteInfo) return null;\n return <Quote text={quoteInfo.text} messageId={quoteInfo.messageId} />;\n};\n\nconst QuoteRenderer = memo(QuoteRendererImpl);\n\n/**\n * Stable propless component that renders the registered tool UI for the\n * current part context. Reads tool registry and part state from context.\n */\nconst RegisteredToolUI: FC = () => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) => {\n if (s.part.type !== \"tool-call\") return null;\n const entry = s.tools.tools[s.part.toolName];\n if (Array.isArray(entry)) return entry[0] ?? null;\n return entry ?? null;\n });\n\n if (!Render || part.type !== \"tool-call\") return null;\n\n return (\n <Render\n {...part}\n addResult={aui.part().addToolResult}\n resume={aui.part().resumeToolCall}\n />\n );\n};\n\n/**\n * Stable propless component that renders the registered data renderer UI\n * for the current part context.\n */\nconst RegisteredDataRendererUI: FC = () => {\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) => {\n if (s.part.type !== \"data\") return null;\n const entry = s.dataRenderers.renderers[s.part.name];\n if (Array.isArray(entry)) return entry[0] ?? null;\n return entry ?? null;\n });\n\n if (!Render || part.type !== \"data\") return null;\n\n return <Render {...(part as DataMessagePartProps)} />;\n};\n\n/**\n * Fallback component rendered when the children render function returns null.\n * Renders registered tool/data UIs via context.\n * For all other part types, renders nothing.\n *\n * This allows users to write:\n * {({ part }) => {\n * if (part.type === \"text\") return <MyText />;\n * return null; // tool UIs and data UIs still render via registry\n * }}\n *\n * To explicitly render nothing (suppressing registered UIs), return <></>.\n */\nconst DefaultPartFallback: FC = () => {\n const partType = useAuiState((s) => s.part.type);\n\n if (partType === \"tool-call\") return <RegisteredToolUI />;\n if (partType === \"data\") return <RegisteredDataRendererUI />;\n\n return null;\n};\n\nexport type { PartState };\n\n/**\n * Enriched part state passed to children render functions.\n *\n * For tool-call parts, adds `toolUI`, `addResult`, and `resume`.\n * For data parts, adds `dataRendererUI`.\n */\nexport type EnrichedPartState =\n | (Extract<PartState, { type: \"tool-call\" }> & {\n /** The registered tool UI element, or null if none registered. */\n readonly toolUI: ReactNode;\n /** Add a tool result to this tool call. */\n addResult: ToolCallMessagePartProps[\"addResult\"];\n /** Resume a tool call waiting for human input. */\n resume: ToolCallMessagePartProps[\"resume\"];\n })\n | (Extract<PartState, { type: \"data\" }> & {\n /** The registered data renderer UI element, or null if none registered. */\n readonly dataRendererUI: ReactNode;\n })\n | Exclude<PartState, { type: \"tool-call\" } | { type: \"data\" }>;\n\nconst MessagePrimitivePartsInner: FC<{\n children: (value: { part: EnrichedPartState }) => ReactNode;\n}> = ({ children }) => {\n const aui = useAui();\n const contentLength = useAuiState((s) => s.message.parts.length);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: aui accessors are stable refs\n return useMemo(\n () =>\n Array.from({ length: contentLength }, (_, index) => (\n <PartByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.message().part({ index }).getState()}\n >\n {(getItem) => {\n const result = children({\n get part() {\n const state = getItem();\n if (state.type === \"tool-call\") {\n const entry = aui.tools().getState().tools[state.toolName];\n const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;\n const partMethods = aui.message().part({ index });\n return {\n ...state,\n toolUI: hasUI ? <RegisteredToolUI /> : null,\n addResult: partMethods.addToolResult,\n resume: partMethods.resumeToolCall,\n };\n }\n if (state.type === \"data\") {\n const entry = aui.dataRenderers().getState().renderers[\n state.name\n ];\n const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;\n return {\n ...state,\n dataRendererUI: hasUI ? (\n <RegisteredDataRendererUI />\n ) : null,\n };\n }\n return state;\n },\n });\n if (result !== null) return result;\n return <DefaultPartFallback />;\n }}\n </RenderChildrenWithAccessor>\n </PartByIndexProvider>\n )),\n [contentLength, children],\n );\n};\n\n/**\n * Renders the parts of a message with support for multiple content types.\n *\n * This is the platform-agnostic base. Each platform wraps this with its own\n * default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).\n */\nexport const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({\n components,\n unstable_showEmptyOnNonTextEnd = true,\n children,\n}) => {\n if (children) {\n return <MessagePrimitivePartsInner>{children}</MessagePrimitivePartsInner>;\n }\n return (\n <MessagePrimitivePartsCompat\n components={components}\n unstable_showEmptyOnNonTextEnd={unstable_showEmptyOnNonTextEnd}\n />\n );\n};\n\nMessagePrimitiveParts.displayName = \"MessagePrimitive.Parts\";\n\nconst MessagePrimitivePartsCompat: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n unstable_showEmptyOnNonTextEnd: boolean;\n}> = ({ components, unstable_showEmptyOnNonTextEnd }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const useChainOfThought = !!components?.ChainOfThought;\n const messageRanges = useMessagePartsGroups(useChainOfThought);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n return messageRanges.map((range) => {\n if (range.type === \"single\") {\n return (\n <MessagePrimitivePartByIndex\n key={range.index}\n index={range.index}\n components={components}\n />\n );\n } else if (range.type === \"chainOfThoughtGroup\") {\n const ChainOfThoughtComponent = components?.ChainOfThought;\n if (!ChainOfThoughtComponent) return null;\n return (\n <ChainOfThoughtByIndicesProvider\n key={`chainOfThought-${range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n <ChainOfThoughtComponent />\n </ChainOfThoughtByIndicesProvider>\n );\n } else if (range.type === \"toolGroup\") {\n const ToolGroupComponent =\n components?.ToolGroup ?? defaultComponents.ToolGroup;\n return (\n <ToolGroupComponent\n key={`tool-${range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => (\n <MessagePrimitivePartByIndex\n key={i}\n index={range.startIndex + i}\n components={components}\n />\n ),\n )}\n </ToolGroupComponent>\n );\n } else {\n // reasoningGroup\n const ReasoningGroupComponent =\n components?.ReasoningGroup ?? defaultComponents.ReasoningGroup;\n return (\n <ReasoningGroupComponent\n key={`reasoning-${range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => (\n <MessagePrimitivePartByIndex\n key={i}\n index={range.startIndex + i}\n components={components}\n />\n ),\n )}\n </ReasoningGroupComponent>\n );\n }\n });\n }, [messageRanges, components, contentLength]);\n\n return (\n <>\n {components?.Quote && <QuoteRenderer Quote={components.Quote} />}\n {partsElements}\n <ConditionalEmpty\n components={components}\n enabled={unstable_showEmptyOnNonTextEnd}\n />\n </>\n );\n};\n","\"use client\";\n\nimport {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n type ReactNode,\n type FC,\n} from \"react\";\nimport { useResource } from \"@assistant-ui/tap/react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type {\n Unstable_MentionAdapter,\n Unstable_DirectiveFormatter,\n} from \"@assistant-ui/core\";\nimport { unstable_defaultDirectiveFormatter } from \"@assistant-ui/core\";\nimport {\n MentionResource,\n type MentionResourceOutput,\n type SelectItemOverride,\n} from \"./MentionResource\";\n\n// =============================================================================\n// Context — public (popover components read state + actions from here)\n// =============================================================================\n\nconst MentionContext = createContext<MentionResourceOutput | null>(null);\n\nexport const useMentionContext = () => {\n const ctx = useContext(MentionContext);\n if (!ctx)\n throw new Error(\n \"useMentionContext must be used within ComposerPrimitive.MentionRoot\",\n );\n return ctx;\n};\n\nexport const useMentionContextOptional = () => {\n return useContext(MentionContext);\n};\n\n// =============================================================================\n// Internal context — ComposerInput → MentionRoot communication\n// =============================================================================\n\ntype MentionInternalContextValue = {\n setCursorPosition(pos: number): void;\n registerSelectItemOverride(fn: SelectItemOverride): () => void;\n};\n\nconst MentionInternalContext =\n createContext<MentionInternalContextValue | null>(null);\n\nexport const useMentionInternalContext = () => {\n return useContext(MentionInternalContext);\n};\n\n// =============================================================================\n// Provider Component\n// =============================================================================\n\nexport namespace ComposerPrimitiveMentionRoot {\n export type Props = {\n children: ReactNode;\n adapter?: Unstable_MentionAdapter | undefined;\n /** Character(s) that trigger the mention popover. @default \"@\" */\n trigger?: string | undefined;\n /** Custom formatter for serializing/parsing mention directives. */\n formatter?: Unstable_DirectiveFormatter | undefined;\n };\n}\n\nexport const ComposerPrimitiveMentionRoot: FC<\n ComposerPrimitiveMentionRoot.Props\n> = ({\n children,\n adapter: adapterProp,\n trigger: triggerChar = \"@\",\n formatter: formatterProp,\n}) => {\n const aui = useAui();\n const text = useAuiState((s) => s.composer.text);\n const formatter = formatterProp ?? unstable_defaultDirectiveFormatter;\n\n // ---------------------------------------------------------------------------\n // Runtime adapter (subscribe to state changes instead of useAuiState to avoid\n // infinite loop — getModelContext() returns a new object on every call)\n // ---------------------------------------------------------------------------\n\n const getRuntimeAdapter = useCallback(() => {\n try {\n const runtime = aui.composer().__internal_getRuntime?.();\n return (runtime as any)?._core?.getState()?.getMentionAdapter?.();\n } catch {\n return undefined;\n }\n }, [aui]);\n const [runtimeAdapter, setRuntimeAdapter] = useState(getRuntimeAdapter);\n useEffect(() => {\n return aui.subscribe(() => {\n setRuntimeAdapter((prev: unknown) => {\n const next = getRuntimeAdapter();\n return prev === next ? prev : next;\n });\n });\n }, [aui, getRuntimeAdapter]);\n const adapter = adapterProp ?? runtimeAdapter;\n\n // ---------------------------------------------------------------------------\n // Mention resource (all state + logic managed via tap primitives)\n // ---------------------------------------------------------------------------\n\n const mention = useResource(\n MentionResource({ adapter, text, triggerChar, formatter, aui }),\n );\n\n // ---------------------------------------------------------------------------\n // Internal context (stable — methods come from tapEffectEvent)\n // ---------------------------------------------------------------------------\n\n const internalContextValue = useMemo<MentionInternalContextValue>(\n () => ({\n setCursorPosition: mention.setCursorPosition,\n registerSelectItemOverride: mention.registerSelectItemOverride,\n }),\n [mention.setCursorPosition, mention.registerSelectItemOverride],\n );\n\n return (\n <MentionContext.Provider value={mention}>\n <MentionInternalContext.Provider value={internalContextValue}>\n {children}\n </MentionInternalContext.Provider>\n </MentionContext.Provider>\n );\n};\n\nComposerPrimitiveMentionRoot.displayName = \"ComposerPrimitive.MentionRoot\";\n","import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport type { QueueItemState } from \"../../../store/scopes/queue-item\";\nimport { QueueItemByIndexProvider } from \"../../providers/QueueItemByIndexProvider\";\n\nexport namespace ComposerPrimitiveQueue {\n export type Props = {\n /** Render function called for each queue item. Receives the queue item state. */\n children: (value: { queueItem: QueueItemState }) => ReactNode;\n };\n}\n\nconst ComposerPrimitiveQueueInner: FC<{\n children: (value: { queueItem: QueueItemState }) => ReactNode;\n}> = ({ children }) => {\n const queue = useAuiState((s) => s.composer.queue.length);\n\n return useMemo(\n () =>\n Array.from({ length: queue }, (_, index) => (\n <QueueItemByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.composer().queueItem({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get queueItem() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </QueueItemByIndexProvider>\n )),\n [queue, children],\n );\n};\n\n/**\n * Renders all queue items in the composer.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Queue>\n * {({ queueItem }) => (\n * <div>\n * <QueueItemPrimitive.Text />\n * <QueueItemPrimitive.Steer>Run Now</QueueItemPrimitive.Steer>\n * </div>\n * )}\n * </ComposerPrimitive.Queue>\n * ```\n */\nexport const ComposerPrimitiveQueue = memo(ComposerPrimitiveQueueInner);\n\nComposerPrimitiveQueue.displayName = \"ComposerPrimitive.Queue\";\n","import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"../../providers/MessageByIndexProvider\";\nimport { MessageState } from \"../../../store\";\n\ntype MessagesComponentConfig =\n | {\n /** Component used to render all message types */\n Message: ComponentType;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages specifically */\n UserMessage?: ComponentType | undefined;\n /** Component used to render assistant messages specifically */\n AssistantMessage?: ComponentType | undefined;\n /** Component used to render system messages specifically */\n SystemMessage?: ComponentType | undefined;\n }\n | {\n /** Component used to render all message types (fallback) */\n Message?: ComponentType | undefined;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages */\n UserMessage: ComponentType;\n /** Component used to render assistant messages */\n AssistantMessage: ComponentType;\n /** Component used to render system messages */\n SystemMessage?: ComponentType | undefined;\n };\n\nexport namespace ThreadPrimitiveMessages {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessagesComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each message. Receives the message. */\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n}\n\nconst isComponentsSame = (\n prev: MessagesComponentConfig,\n next: MessagesComponentConfig,\n) => {\n return (\n prev.Message === next.Message &&\n prev.EditComposer === next.EditComposer &&\n prev.UserEditComposer === next.UserEditComposer &&\n prev.AssistantEditComposer === next.AssistantEditComposer &&\n prev.SystemEditComposer === next.SystemEditComposer &&\n prev.UserMessage === next.UserMessage &&\n prev.AssistantMessage === next.AssistantMessage &&\n prev.SystemMessage === next.SystemMessage\n );\n};\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\n\nconst getComponent = (\n components: MessagesComponentConfig,\n role: MessageState[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default:\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n};\n\ntype ThreadMessageComponentProps = {\n components: MessagesComponentConfig;\n};\n\nconst ThreadMessageComponent: FC<ThreadMessageComponentProps> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\nexport namespace ThreadPrimitiveMessageByIndex {\n export type Props = {\n index: number;\n components: MessagesComponentConfig;\n };\n}\n\n/**\n * Renders a single message at the specified index in the current thread.\n */\nexport const ThreadPrimitiveMessageByIndex: FC<ThreadPrimitiveMessageByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n isComponentsSame(prev.components, next.components),\n );\n\nThreadPrimitiveMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nconst ThreadPrimitiveMessagesInner: FC<{\n children: (value: { message: MessageState }) => ReactNode;\n}> = ({ children }) => {\n const messagesLength = useAuiState((s) => s.thread.messages.length);\n\n return useMemo(() => {\n if (messagesLength === 0) return null;\n return Array.from({ length: messagesLength }, (_, index) => (\n <MessageByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread().message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n ));\n }, [messagesLength, children]);\n};\n\n/**\n * Renders all messages in the current thread.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Messages>\n * {({ message }) => {\n * if (message.role === \"user\") return <MyUserMessage />;\n * return <MyAssistantMessage />;\n * }}\n * </ThreadPrimitive.Messages>\n * ```\n */\nexport const ThreadPrimitiveMessagesImpl: FC<ThreadPrimitiveMessages.Props> = ({\n components,\n children,\n}) => {\n if (components) {\n return (\n <ThreadPrimitiveMessagesInner>\n {() => <ThreadMessageComponent components={components} />}\n </ThreadPrimitiveMessagesInner>\n );\n }\n return (\n <ThreadPrimitiveMessagesInner>{children}</ThreadPrimitiveMessagesInner>\n );\n};\n\nThreadPrimitiveMessagesImpl.displayName = \"ThreadPrimitive.Messages\";\n\nexport const ThreadPrimitiveMessages = memo(\n ThreadPrimitiveMessagesImpl,\n (prev, next) => {\n if (prev.children || next.children) {\n return prev.children === next.children;\n }\n return isComponentsSame(prev.components!, next.components!);\n },\n);\n","import type { CompleteAttachment } from \"../../../types/attachment\";\nimport { ComponentType, type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageAttachmentByIndexProvider } from \"../../providers/AttachmentByIndexProvider\";\n\ntype MessageAttachmentsComponentConfig = {\n Image?: ComponentType | undefined;\n Document?: ComponentType | undefined;\n File?: ComponentType | undefined;\n Attachment?: ComponentType | undefined;\n};\n\nexport namespace MessagePrimitiveAttachments {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageAttachmentsComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each attachment. Receives the attachment. */\n children: (value: { attachment: CompleteAttachment }) => ReactNode;\n components?: never;\n };\n}\n\nconst getComponent = (\n components: MessageAttachmentsComponentConfig | undefined,\n attachment: CompleteAttachment,\n) => {\n const type = attachment.type;\n switch (type) {\n case \"image\":\n return components?.Image ?? components?.Attachment;\n case \"document\":\n return components?.Document ?? components?.Attachment;\n case \"file\":\n return components?.File ?? components?.Attachment;\n default:\n return components?.Attachment;\n }\n};\n\nconst AttachmentComponent: FC<{\n components: MessageAttachmentsComponentConfig | undefined;\n}> = ({ components }) => {\n const attachment = useAuiState((s) => s.attachment);\n if (!attachment) return null;\n\n const Component = getComponent(components, attachment as CompleteAttachment);\n if (!Component) return null;\n return <Component />;\n};\n\nexport namespace MessagePrimitiveAttachmentByIndex {\n export type Props = {\n index: number;\n components?: MessageAttachmentsComponentConfig;\n };\n}\n\n/**\n * Renders a single attachment at the specified index within the current message.\n */\nexport const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <MessageAttachmentByIndexProvider index={index}>\n <AttachmentComponent components={components} />\n </MessageAttachmentByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.Document === next.components?.Document &&\n prev.components?.File === next.components?.File &&\n prev.components?.Attachment === next.components?.Attachment,\n );\n\nMessagePrimitiveAttachmentByIndex.displayName =\n \"MessagePrimitive.AttachmentByIndex\";\n\nconst MessagePrimitiveAttachmentsInner: FC<{\n children: (value: { attachment: CompleteAttachment }) => ReactNode;\n}> = ({ children }) => {\n const attachmentsCount = useAuiState((s) => {\n if (s.message.role !== \"user\") return 0;\n return s.message.attachments.length;\n });\n\n return useMemo(\n () =>\n Array.from({ length: attachmentsCount }, (_, index) => (\n <MessageAttachmentByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.message().attachment({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get attachment() {\n return getItem() as CompleteAttachment;\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageAttachmentByIndexProvider>\n )),\n [attachmentsCount, children],\n );\n};\n\nexport const MessagePrimitiveAttachments: FC<\n MessagePrimitiveAttachments.Props\n> = ({ components, children }) => {\n if (components) {\n return (\n <MessagePrimitiveAttachmentsInner>\n {({ attachment }) => {\n const Component = getComponent(components, attachment);\n if (!Component) return null;\n return <Component />;\n }}\n </MessagePrimitiveAttachmentsInner>\n );\n }\n return (\n <MessagePrimitiveAttachmentsInner>\n {children}\n </MessagePrimitiveAttachmentsInner>\n );\n};\n\nMessagePrimitiveAttachments.displayName = \"MessagePrimitive.Attachments\";\n","import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport type { SuggestionState } from \"../../../store/scopes/suggestion\";\nimport { SuggestionByIndexProvider } from \"../../providers/SuggestionByIndexProvider\";\n\ntype SuggestionsComponentConfig = {\n /** Component used to render each suggestion */\n Suggestion: ComponentType;\n};\n\nexport namespace ThreadPrimitiveSuggestions {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: SuggestionsComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each suggestion. Receives the suggestion. */\n children: (value: { suggestion: SuggestionState }) => ReactNode;\n components?: never;\n };\n}\n\ntype SuggestionComponentProps = {\n components: SuggestionsComponentConfig;\n};\n\nconst SuggestionComponent: FC<SuggestionComponentProps> = ({ components }) => {\n const Component = components.Suggestion;\n return <Component />;\n};\n\nexport namespace ThreadPrimitiveSuggestionByIndex {\n export type Props = {\n index: number;\n components: SuggestionsComponentConfig;\n };\n}\n\n/**\n * Renders a single suggestion at the specified index.\n */\nexport const ThreadPrimitiveSuggestionByIndex: FC<ThreadPrimitiveSuggestionByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <SuggestionByIndexProvider index={index}>\n <SuggestionComponent components={components} />\n </SuggestionByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components.Suggestion === next.components.Suggestion,\n );\n\nThreadPrimitiveSuggestionByIndex.displayName =\n \"ThreadPrimitive.SuggestionByIndex\";\n\nconst ThreadPrimitiveSuggestionsInner: FC<{\n children: (value: { suggestion: SuggestionState }) => ReactNode;\n}> = ({ children }) => {\n const suggestionsLength = useAuiState(\n (s) => s.suggestions.suggestions.length,\n );\n\n return useMemo(() => {\n if (suggestionsLength === 0) return null;\n return Array.from({ length: suggestionsLength }, (_, index) => (\n <SuggestionByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.suggestions().suggestion({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get suggestion() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </SuggestionByIndexProvider>\n ));\n }, [suggestionsLength, children]);\n};\n\n/**\n * Renders all suggestions.\n */\nexport const ThreadPrimitiveSuggestionsImpl: FC<\n ThreadPrimitiveSuggestions.Props\n> = ({ components, children }) => {\n if (components) {\n return (\n <ThreadPrimitiveSuggestionsInner>\n {() => <SuggestionComponent components={components} />}\n </ThreadPrimitiveSuggestionsInner>\n );\n }\n return (\n <ThreadPrimitiveSuggestionsInner>\n {children}\n </ThreadPrimitiveSuggestionsInner>\n );\n};\n\nThreadPrimitiveSuggestionsImpl.displayName = \"ThreadPrimitive.Suggestions\";\n\nexport const ThreadPrimitiveSuggestions = memo(\n ThreadPrimitiveSuggestionsImpl,\n (prev, next) => {\n if (prev.children || next.children) {\n return prev.children === next.children;\n }\n return prev.components!.Suggestion === next.components!.Suggestion;\n },\n);\n","import type { Attachment } from \"../../../types/attachment\";\nimport { ComponentType, type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { ComposerAttachmentByIndexProvider } from \"../../providers/AttachmentByIndexProvider\";\n\ntype ComposerAttachmentsComponentConfig = {\n Image?: ComponentType | undefined;\n Document?: ComponentType | undefined;\n File?: ComponentType | undefined;\n Attachment?: ComponentType | undefined;\n};\n\nexport namespace ComposerPrimitiveAttachments {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: ComposerAttachmentsComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each attachment. Receives the attachment. */\n children: (value: { attachment: Attachment }) => ReactNode;\n components?: never;\n };\n}\n\nconst getComponent = (\n components: ComposerAttachmentsComponentConfig | undefined,\n attachment: Attachment,\n) => {\n const type = attachment.type;\n switch (type) {\n case \"image\":\n return components?.Image ?? components?.Attachment;\n case \"document\":\n return components?.Document ?? components?.Attachment;\n case \"file\":\n return components?.File ?? components?.Attachment;\n default:\n return components?.Attachment;\n }\n};\n\nconst AttachmentComponent: FC<{\n components: ComposerAttachmentsComponentConfig | undefined;\n}> = ({ components }) => {\n const attachment = useAuiState((s) => s.attachment);\n if (!attachment) return null;\n\n const Component = getComponent(components, attachment);\n if (!Component) return null;\n return <Component />;\n};\n\nexport namespace ComposerPrimitiveAttachmentByIndex {\n export type Props = {\n index: number;\n components?: ComposerAttachmentsComponentConfig;\n };\n}\n\n/**\n * Renders a single attachment at the specified index within the composer.\n */\nexport const ComposerPrimitiveAttachmentByIndex: FC<ComposerPrimitiveAttachmentByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <ComposerAttachmentByIndexProvider index={index}>\n <AttachmentComponent components={components} />\n </ComposerAttachmentByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.Document === next.components?.Document &&\n prev.components?.File === next.components?.File &&\n prev.components?.Attachment === next.components?.Attachment,\n );\n\nComposerPrimitiveAttachmentByIndex.displayName =\n \"ComposerPrimitive.AttachmentByIndex\";\n\nconst ComposerPrimitiveAttachmentsInner: FC<{\n children: (value: { attachment: Attachment }) => ReactNode;\n}> = ({ children }) => {\n const attachmentsCount = useAuiState((s) => s.composer.attachments.length);\n\n return useMemo(\n () =>\n Array.from({ length: attachmentsCount }, (_, index) => (\n <ComposerAttachmentByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) =>\n aui.composer().attachment({ index }).getState()\n }\n >\n {(getItem) =>\n children({\n get attachment() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </ComposerAttachmentByIndexProvider>\n )),\n [attachmentsCount, children],\n );\n};\n\nexport const ComposerPrimitiveAttachments: FC<\n ComposerPrimitiveAttachments.Props\n> = ({ components, children }) => {\n if (components) {\n return (\n <ComposerPrimitiveAttachmentsInner>\n {({ attachment }) => {\n const Component = getComponent(components, attachment);\n if (!Component) return null;\n return <Component />;\n }}\n </ComposerPrimitiveAttachmentsInner>\n );\n }\n return (\n <ComposerPrimitiveAttachmentsInner>\n {children}\n </ComposerPrimitiveAttachmentsInner>\n );\n};\n\nComposerPrimitiveAttachments.displayName = \"ComposerPrimitive.Attachments\";\n","import { useSyncExternalStore, useDebugValue } from \"react\";\nimport type { AssistantState } from \"./types/client\";\nimport { useAui } from \"./useAui\";\nimport { getProxiedAssistantState } from \"./utils/proxied-assistant-state\";\n\n/**\n * Hook to access a slice of the assistant state with automatic subscription\n *\n * @param selector - Function to select a slice of the state\n * @returns The selected state slice\n *\n * @example\n * ```typescript\n * const aui = useAui({\n * foo: RootScope({ ... }),\n * });\n *\n * const bar = useAuiState((s) => s.foo.bar);\n * ```\n */\nexport const useAuiState = <T>(selector: (state: AssistantState) => T): T => {\n const aui = useAui();\n const proxiedState = getProxiedAssistantState(aui);\n\n const slice = useSyncExternalStore(\n aui.subscribe,\n () => selector(proxiedState),\n () => selector(proxiedState),\n );\n\n if (slice === proxiedState) {\n throw new Error(\n \"You tried to return the entire AssistantState. This is not supported due to technical limitations.\",\n );\n }\n\n useDebugValue(slice);\n\n return slice;\n};\n","import React from 'react';\nimport { shallow } from 'zustand/vanilla/shallow';\n\nfunction useShallow(selector) {\n const prev = React.useRef(void 0);\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","import React from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\n\nvar useLatest = function useLatest(value) {\n var ref = React.useRef(value);\n useIsomorphicLayoutEffect(function () {\n ref.current = value;\n });\n return ref;\n};\n\nexport { useLatest as default };\n","\"use client\";\n\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport enum HideAndFloatStatus {\n Hidden = \"hidden\",\n Floating = \"floating\",\n Normal = \"normal\",\n}\n\nexport type UseActionBarFloatStatusProps = {\n hideWhenRunning?: boolean | undefined;\n autohide?: \"always\" | \"not-last\" | \"never\" | undefined;\n autohideFloat?: \"always\" | \"single-branch\" | \"never\" | undefined;\n forceVisible?: boolean | undefined;\n};\n\nexport const useActionBarFloatStatus = ({\n hideWhenRunning,\n autohide,\n autohideFloat,\n forceVisible,\n}: UseActionBarFloatStatusProps) => {\n return useAuiState((s) => {\n if (hideWhenRunning && s.thread.isRunning) return HideAndFloatStatus.Hidden;\n\n const autohideEnabled =\n autohide === \"always\" || (autohide === \"not-last\" && !s.message.isLast);\n const isVisibleByInteraction = forceVisible || s.message.isHovering;\n\n // normal status\n if (!autohideEnabled) return HideAndFloatStatus.Normal;\n\n // hidden status\n if (!isVisibleByInteraction) return HideAndFloatStatus.Hidden;\n\n // floating status\n if (\n autohideFloat === \"always\" ||\n (autohideFloat === \"single-branch\" && s.message.branchCount <= 1)\n )\n return HideAndFloatStatus.Floating;\n\n return HideAndFloatStatus.Normal;\n });\n};\n","import type {\n Unstable_MentionCategory,\n Unstable_MentionItem,\n Unstable_DirectiveSegment,\n Unstable_DirectiveFormatter,\n} from \"../types/mention\";\n\n// =============================================================================\n// Mention Adapter\n// =============================================================================\n\n/**\n * Adapter for providing mention categories and items to the mention picker.\n *\n * All methods are synchronous by design — the adapter drives UI display and\n * must return data immediately. Use external state management (e.g. React\n * Query, SWR, or local state) to handle async data fetching, then expose\n * the loaded results synchronously through this adapter.\n */\nexport type Unstable_MentionAdapter = {\n /** Return the top-level categories for the mention picker. */\n categories(): readonly Unstable_MentionCategory[];\n\n /** Return items within a category. */\n categoryItems(categoryId: string): readonly Unstable_MentionItem[];\n\n /** Global search across all categories (optional). */\n search?(query: string): readonly Unstable_MentionItem[];\n};\n\n// =============================================================================\n// Default Directive Formatter\n// =============================================================================\n\nconst DIRECTIVE_RE = /:([\\w-]+)\\[([^\\]]+)\\](?:\\{name=([^}]+)\\})?/g;\n\n/**\n * Default directive formatter using the `:type[label]{name=id}` syntax.\n *\n * When `id` equals `label`, the `{name=…}` attribute is omitted for brevity.\n */\nexport const unstable_defaultDirectiveFormatter: Unstable_DirectiveFormatter = {\n serialize(item: Unstable_MentionItem): string {\n const attrs = item.id !== item.label ? `{name=${item.id}}` : \"\";\n return `:${item.type}[${item.label}]${attrs}`;\n },\n\n parse(text: string): Unstable_DirectiveSegment[] {\n const segments: Unstable_DirectiveSegment[] = [];\n let lastIndex = 0;\n\n DIRECTIVE_RE.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = DIRECTIVE_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n segments.push({\n kind: \"text\",\n text: text.slice(lastIndex, match.index),\n });\n }\n const label = match[2]!;\n segments.push({\n kind: \"mention\",\n type: match[1]!,\n label,\n id: match[3] ?? label,\n });\n lastIndex = DIRECTIVE_RE.lastIndex;\n }\n\n if (lastIndex < text.length) {\n segments.push({ kind: \"text\", text: text.slice(lastIndex) });\n }\n\n return segments;\n },\n};\n","\"use client\";\n\nimport { MessageRuntime } from \"../runtime/MessageRuntime\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { createStateHookForRuntime } from \"../../context/react/utils/createStateHookForRuntime\";\nimport type { EditComposerRuntime } from \"@assistant-ui/core\";\n\n/**\n * @deprecated Use `useAui()` with `aui.message()` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12\n *\n * Hook to access the MessageRuntime from the current context.\n *\n * The MessageRuntime provides access to message-level state and actions,\n * including message content, status, editing capabilities, and branching.\n *\n * @param options Configuration options\n * @param options.optional Whether the hook should return null if no context is found\n * @returns The MessageRuntime instance, or null if optional is true and no context exists\n *\n * @example\n * ```tsx\n * // Before:\n * function MessageActions() {\n * const runtime = useMessageRuntime();\n * const handleReload = () => {\n * runtime.reload();\n * };\n * const handleEdit = () => {\n * runtime.startEdit();\n * };\n * return (\n * <div>\n * <button onClick={handleReload}>Reload</button>\n * <button onClick={handleEdit}>Edit</button>\n * </div>\n * );\n * }\n *\n * // After:\n * function MessageActions() {\n * const aui = useAui();\n * const handleReload = () => {\n * aui.message().reload();\n * };\n * const handleEdit = () => {\n * aui.message().startEdit();\n * };\n * return (\n * <div>\n * <button onClick={handleReload}>Reload</button>\n * <button onClick={handleEdit}>Edit</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMessageRuntime(options?: {\n optional?: false | undefined;\n}): MessageRuntime;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}): MessageRuntime | null;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const aui = useAui();\n const runtime = useAuiState(() =>\n aui.message.source\n ? (aui.message().__internal_getRuntime?.() ?? null)\n : null,\n );\n if (!runtime && !options?.optional) {\n throw new Error(\"MessageRuntime is not available\");\n }\n return runtime;\n}\n\n/**\n * @deprecated Use `useAuiState((s) => s.message)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12\n *\n * Hook to access the current message state.\n *\n * This hook provides reactive access to the message's state, including content,\n * role, status, and other message-level properties.\n *\n * @param selector Optional selector function to pick specific state properties\n * @returns The selected message state or the entire message state if no selector provided\n *\n * @example\n * ```tsx\n * // Before:\n * function MessageContent() {\n * const role = useMessage((state) => state.role);\n * const content = useMessage((state) => state.content);\n * const isLoading = useMessage((state) => state.status.type === \"running\");\n * return (\n * <div className={`message-${role}`}>\n * {isLoading ? \"Loading...\" : content.map(part => part.text).join(\"\")}\n * </div>\n * );\n * }\n *\n * // After:\n * function MessageContent() {\n * const role = useAuiState((s) => s.message.role);\n * const content = useAuiState((s) => s.message.content);\n * const isLoading = useAuiState((s) => s.message.status.type === \"running\");\n * return (\n * <div className={`message-${role}`}>\n * {isLoading ? \"Loading...\" : content.map(part => part.text).join(\"\")}\n * </div>\n * );\n * }\n * ```\n */\nexport const useMessage = createStateHookForRuntime(useMessageRuntime);\n\nconst useEditComposerRuntime = (opt: {\n optional: boolean | undefined;\n}): EditComposerRuntime | null => useMessageRuntime(opt)?.composer ?? null;\n\n/**\n * @deprecated Use `useAuiState((s) => s.message.composer)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12\n */\nexport const useEditComposer = createStateHookForRuntime(\n useEditComposerRuntime,\n);\n","import { type FC, type PropsWithChildren } from \"react\";\nimport { useAui, useAuiState, AuiProvider } from \"@assistant-ui/store\";\nimport { ChainOfThoughtClient } from \"../../store/clients/chain-of-thought-client\";\nimport type { ChainOfThoughtPart } from \"../../store/scopes/chain-of-thought\";\n\nexport const ChainOfThoughtByIndicesProvider: FC<\n PropsWithChildren<{\n startIndex: number;\n endIndex: number;\n }>\n> = ({ startIndex, endIndex, children }) => {\n const parts = useAuiState((s) => s.message.parts).slice(\n startIndex,\n endIndex + 1,\n ) as ChainOfThoughtPart[];\n\n const parentAui = useAui();\n\n const aui = useAui({\n chainOfThought: ChainOfThoughtClient({\n parts,\n getMessagePart: ({ index }) => {\n if (index < 0 || index >= parts.length) {\n throw new Error(\n `ChainOfThought part index ${index} is out of bounds (0..${parts.length - 1})`,\n );\n }\n return parentAui.message().part({ index: startIndex + index });\n },\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n","\"use client\";\n\nimport type { FC } from \"react\";\nimport {\n MessagePrimitiveParts as MessagePrimitivePartsBase,\n MessagePartComponent as MessagePartComponentBase,\n MessagePrimitivePartByIndex as MessagePrimitivePartByIndexBase,\n messagePartsDefaultComponents,\n} from \"@assistant-ui/core/react\";\nimport { MessagePartPrimitiveText } from \"../messagePart/MessagePartText\";\nimport { MessagePartPrimitiveImage } from \"../messagePart/MessagePartImage\";\nimport { MessagePartPrimitiveInProgress } from \"../messagePart/MessagePartInProgress\";\n\nconst webDefaultComponents = {\n ...messagePartsDefaultComponents,\n Text: () => (\n <p style={{ whiteSpace: \"pre-line\" }}>\n <MessagePartPrimitiveText />\n <MessagePartPrimitiveInProgress>\n <span style={{ fontFamily: \"revert\" }}>{\" \\u25CF\"}</span>\n </MessagePartPrimitiveInProgress>\n </p>\n ),\n Image: () => <MessagePartPrimitiveImage />,\n} satisfies MessagePrimitiveParts.Props[\"components\"];\n\nexport namespace MessagePrimitiveParts {\n export type Props = MessagePrimitivePartsBase.Props;\n}\n\n/**\n * Renders the parts of a message with web-specific default components.\n */\nexport const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = (\n props,\n) => {\n if (\"children\" in props) {\n return (\n <MessagePrimitivePartsBase>{props.children}</MessagePrimitivePartsBase>\n );\n }\n\n const { components, ...rest } = props;\n const merged = components\n ? {\n Text: components.Text ?? webDefaultComponents.Text,\n Image: components.Image ?? webDefaultComponents.Image,\n Reasoning:\n components.Reasoning ?? messagePartsDefaultComponents.Reasoning,\n Source: components.Source ?? messagePartsDefaultComponents.Source,\n File: components.File ?? messagePartsDefaultComponents.File,\n Unstable_Audio:\n components.Unstable_Audio ??\n messagePartsDefaultComponents.Unstable_Audio,\n ...(\"ChainOfThought\" in components\n ? { ChainOfThought: components.ChainOfThought }\n : {\n tools: components.tools,\n data: components.data,\n ToolGroup:\n components.ToolGroup ?? messagePartsDefaultComponents.ToolGroup,\n ReasoningGroup:\n components.ReasoningGroup ??\n messagePartsDefaultComponents.ReasoningGroup,\n }),\n Empty: components.Empty,\n Quote: components.Quote,\n }\n : webDefaultComponents;\n\n return <MessagePrimitivePartsBase components={merged as any} {...rest} />;\n};\n\nMessagePrimitiveParts.displayName = \"MessagePrimitive.Parts\";\n\n// Re-export everything else unchanged\nexport {\n MessagePartComponentBase as MessagePartComponent,\n MessagePrimitivePartByIndexBase as MessagePrimitivePartByIndex,\n};\n","import React from 'react'\n\nconst context = React.createContext(true)\n\nfunction forbiddenInRender() {\n throw new Error(\"A function wrapped in useEffectEvent can't be called during rendering.\")\n}\n\n// We can only check if we're in a render phase, beyond initial render, in React 19, with its `React.use` hook.\nconst isInvalidExecutionContextForEventFunction =\n 'use' in React\n ? () => {\n // There's no way to check if we're in a render phase from outside of React, the API used by useEffectEvent is private: https://github.com/facebook/react/blob/a00ca6f6b51e46a0ccec54a2231bfe7a1ed9ae1d/packages/react-reconciler/src/ReactFiberWorkLoop.js#L1785-L1788\n // So to emulate the same behavior, we call the use hook and if it doesn't throw, we're in a render phase.\n try {\n return React.use(context)\n } catch {\n return false\n }\n }\n : () => false\n\n/**\n * This is a ponyfill of the upcoming `useEffectEvent` hook that'll arrive in React 19.\n * https://19.react.dev/learn/separating-events-from-effects#declaring-an-effect-event\n * To learn more about the ponyfill itself, see: https://blog.bitsrc.io/a-look-inside-the-useevent-polyfill-from-the-new-react-docs-d1c4739e8072\n * @public\n */\nexport function useEffectEvent<const T extends (...args: any[]) => void>(fn: T): T {\n /**\n * For both React 18 and 19 we set the ref to the forbiddenInRender function, to catch illegal calls to the function during render.\n * Once the insertion effect runs, we set the ref to the actual function.\n */\n const ref = React.useRef(forbiddenInRender as T)\n\n React.useInsertionEffect(() => {\n ref.current = fn\n }, [fn])\n\n return ((...args: any) => {\n // Performs a similar check to what React does for `useEffectEvent`:\n // 1. https://github.com/facebook/react/blob/b7e2de632b2a160bc09edda1fbb9b8f85a6914e8/packages/react-reconciler/src/ReactFiberHooks.js#L2729-L2733\n // 2. https://github.com/facebook/react/blob/b7e2de632b2a160bc09edda1fbb9b8f85a6914e8/packages/react-reconciler/src/ReactFiberHooks.js#L2746C9-L2750\n if (isInvalidExecutionContextForEventFunction()) {\n forbiddenInRender()\n }\n\n const latestFn = ref.current!\n return latestFn(...args)\n }) as T\n}\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\n\nexport namespace useThreadScrollToBottom {\n export type Options = {\n behavior?: ScrollBehavior | undefined;\n };\n}\n\nconst useThreadScrollToBottom = ({\n behavior,\n}: useThreadScrollToBottom.Options = {}) => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom({ behavior });\n }, [threadViewportStore, behavior]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n [\"behavior\"],\n);\n","\"use client\";\n\nimport type { ImageMessagePart, MessagePartState } from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessagePartImage = () => {\n const image = useAuiState((s) => {\n if (s.part.type !== \"image\")\n throw new Error(\n \"MessagePartImage can only be used inside image message parts.\",\n );\n\n return s.part as MessagePartState & ImageMessagePart;\n });\n\n return image;\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { CreateAttachment } from \"../../types/attachment\";\n\nexport const useComposerAddAttachment = () => {\n const aui = useAui();\n const disabled = useAuiState((s) => !s.composer.isEditing);\n\n const addAttachment = useCallback(\n (file: File | CreateAttachment) => {\n return aui.composer().addAttachment(file);\n },\n [aui],\n );\n\n return { addAttachment, disabled };\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useComposerDictate = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n s.composer.dictation != null ||\n !s.thread.capabilities.dictation ||\n !s.composer.isEditing,\n );\n\n const startDictation = useCallback(() => {\n aui.composer().startDictation();\n }, [aui]);\n\n return { startDictation, disabled };\n};\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { ComposerSendOptions } from \"../../store/scopes/composer\";\n\nexport const useComposerSend = () => {\n const aui = useAui();\n const disabled = useAuiState(\n (s) =>\n (s.thread.isRunning && !s.thread.capabilities.queue) ||\n !s.composer.isEditing ||\n s.composer.isEmpty,\n );\n\n const send = useCallback(\n (opts?: ComposerSendOptions) => {\n aui.composer().send(opts);\n },\n [aui],\n );\n\n return { send, disabled };\n};\n","import { resource, tapMemo, tapState } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type {\n ChainOfThoughtState,\n ChainOfThoughtPart,\n} from \"../scopes/chain-of-thought\";\nimport type { MessagePartStatus } from \"../../types/message\";\nimport type { PartMethods } from \"../scopes/part\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const ChainOfThoughtClient = resource(\n ({\n parts,\n getMessagePart,\n }: {\n parts: readonly ChainOfThoughtPart[];\n getMessagePart: (selector: { index: number }) => PartMethods;\n }): ClientOutput<\"chainOfThought\"> => {\n const [collapsed, setCollapsed] = tapState(true);\n\n const status = tapMemo(() => {\n const lastPart = parts[parts.length - 1];\n return lastPart?.status ?? COMPLETE_STATUS;\n }, [parts]);\n\n const state = tapMemo<ChainOfThoughtState>(\n () => ({ parts, collapsed, status }),\n [parts, collapsed, status],\n );\n\n return {\n getState: () => state,\n setCollapsed,\n part: getMessagePart,\n };\n },\n);\n","\"use client\";\n\nimport { FC, PropsWithChildren } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace MessagePartPrimitiveInProgress {\n export type Props = PropsWithChildren;\n}\n\n// TODO should this be renamed to IsRunning?\nexport const MessagePartPrimitiveInProgress: FC<\n MessagePartPrimitiveInProgress.Props\n> = ({ children }) => {\n const isInProgress = useAuiState((s) => s.part.status.type === \"running\");\n\n return isInProgress ? children : null;\n};\n\nMessagePartPrimitiveInProgress.displayName = \"MessagePartPrimitive.InProgress\";\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useComposerAddAttachment as useComposerAddAttachmentBehavior } from \"@assistant-ui/core/react\";\n\nconst useComposerAddAttachment = ({\n multiple = true,\n}: {\n /** allow selecting multiple files */\n multiple?: boolean | undefined;\n} = {}) => {\n const { disabled, addAttachment } = useComposerAddAttachmentBehavior();\n const aui = useAui();\n\n const callback = useCallback(() => {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n input.multiple = multiple;\n input.hidden = true;\n\n const attachmentAccept = aui.composer().getState().attachmentAccept;\n if (attachmentAccept !== \"*\") {\n input.accept = attachmentAccept;\n }\n\n document.body.appendChild(input);\n\n input.onchange = (e) => {\n const fileList = (e.target as HTMLInputElement).files;\n if (!fileList) return;\n for (const file of fileList) {\n addAttachment(file);\n }\n\n document.body.removeChild(input);\n };\n\n input.oncancel = () => {\n if (!input.files || input.files.length === 0) {\n document.body.removeChild(input);\n }\n };\n\n input.click();\n }, [aui, multiple, addAttachment]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveAddAttachment {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerAddAttachment>;\n}\n\nexport const ComposerPrimitiveAddAttachment = createActionButton(\n \"ComposerPrimitive.AddAttachment\",\n useComposerAddAttachment,\n [\"multiple\"],\n);\n","import { useCallback } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport const useActionBarFeedbackPositive = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"positive\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"positive\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n\nexport const useActionBarFeedbackNegative = () => {\n const aui = useAui();\n const isSubmitted = useAuiState(\n (s) => s.message.metadata.submittedFeedback?.type === \"negative\",\n );\n\n const submit = useCallback(() => {\n aui.message().submitFeedback({ type: \"negative\" });\n }, [aui]);\n\n return { submit, isSubmitted };\n};\n","import {\n resource,\n tapState,\n tapMemo,\n tapEffectEvent,\n tapEffect,\n tapRef,\n} from \"@assistant-ui/tap\";\nimport type {\n Unstable_MentionAdapter,\n Unstable_MentionCategory,\n Unstable_MentionItem,\n Unstable_DirectiveFormatter,\n} from \"@assistant-ui/core\";\nimport type { AssistantClient } from \"@assistant-ui/store\";\nimport { detectMentionTrigger } from \"./detectMentionTrigger\";\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type MentionKeyEvent = {\n readonly key: string;\n readonly shiftKey: boolean;\n preventDefault(): void;\n};\n\nexport type SelectItemOverride = (item: Unstable_MentionItem) => boolean;\n\nexport type MentionResourceOutput = {\n // State\n readonly open: boolean;\n readonly query: string;\n readonly activeCategoryId: string | null;\n readonly categories: readonly Unstable_MentionCategory[];\n readonly items: readonly Unstable_MentionItem[];\n readonly highlightedIndex: number;\n readonly isSearchMode: boolean;\n readonly formatter: Unstable_DirectiveFormatter;\n\n // Actions\n selectCategory(categoryId: string): void;\n goBack(): void;\n selectItem(item: Unstable_MentionItem): void;\n close(): void;\n handleKeyDown(e: MentionKeyEvent): boolean;\n\n // Internal (for ComposerInput integration)\n setCursorPosition(pos: number): void;\n registerSelectItemOverride(fn: SelectItemOverride): () => void;\n};\n\n// =============================================================================\n// Resource\n// =============================================================================\n\nexport const MentionResource = resource(\n ({\n adapter,\n text,\n triggerChar,\n formatter,\n aui,\n }: {\n adapter: Unstable_MentionAdapter | undefined;\n text: string;\n triggerChar: string;\n formatter: Unstable_DirectiveFormatter;\n aui: AssistantClient;\n }): MentionResourceOutput => {\n // -------------------------------------------------------------------------\n // Cursor tracking + trigger detection\n // -------------------------------------------------------------------------\n\n const [cursorPosition, setCursorPosition] = tapState(text.length);\n\n const trigger = tapMemo(() => {\n const pos = Math.min(cursorPosition, text.length);\n return detectMentionTrigger(text, triggerChar, pos);\n }, [cursorPosition, text, triggerChar]);\n\n const open = trigger !== null && adapter !== undefined;\n const query = trigger?.query ?? \"\";\n\n // -------------------------------------------------------------------------\n // Category navigation\n // -------------------------------------------------------------------------\n\n const [activeCategoryId, setActiveCategoryId] = tapState<string | null>(\n null,\n );\n\n // Reset when popover closes\n tapEffect(() => {\n if (!open) setActiveCategoryId(null);\n }, [open]);\n\n const categories = tapMemo<readonly Unstable_MentionCategory[]>(() => {\n if (!open || !adapter) return [];\n return adapter.categories();\n }, [open, adapter]);\n\n const effectiveActiveCategoryId = open ? activeCategoryId : null;\n\n // -------------------------------------------------------------------------\n // Items + search\n // -------------------------------------------------------------------------\n\n const allItems = tapMemo<readonly Unstable_MentionItem[]>(() => {\n if (!effectiveActiveCategoryId || !adapter) return [];\n return adapter.categoryItems(effectiveActiveCategoryId);\n }, [effectiveActiveCategoryId, adapter]);\n\n const searchResults = tapMemo<\n readonly Unstable_MentionItem[] | null\n >(() => {\n if (!open || !adapter || !query || effectiveActiveCategoryId) return null;\n if (adapter.search) return adapter.search(query);\n\n const cats = adapter.categories();\n const all: Unstable_MentionItem[] = [];\n const lower = query.toLowerCase();\n for (const cat of cats) {\n for (const item of adapter.categoryItems(cat.id)) {\n if (\n item.id.toLowerCase().includes(lower) ||\n item.label.toLowerCase().includes(lower) ||\n item.description?.toLowerCase().includes(lower)\n ) {\n all.push(item);\n }\n }\n }\n return all;\n }, [open, adapter, query, effectiveActiveCategoryId]);\n\n const isSearchMode = searchResults !== null;\n\n // -------------------------------------------------------------------------\n // Filtering\n // -------------------------------------------------------------------------\n\n const filteredCategories = tapMemo(() => {\n if (isSearchMode) return [];\n if (!query) return categories;\n const lower = query.toLowerCase();\n return categories.filter((cat) =>\n cat.label.toLowerCase().includes(lower),\n );\n }, [categories, query, isSearchMode]);\n\n const filteredItems = tapMemo(() => {\n if (isSearchMode) return searchResults ?? [];\n if (!query) return allItems;\n const lower = query.toLowerCase();\n return allItems.filter(\n (item) =>\n item.id.toLowerCase().includes(lower) ||\n item.label.toLowerCase().includes(lower) ||\n item.description?.toLowerCase().includes(lower),\n );\n }, [allItems, query, isSearchMode, searchResults]);\n\n // -------------------------------------------------------------------------\n // Keyboard navigation\n // -------------------------------------------------------------------------\n\n const [highlightedIndex, setHighlightedIndex] = tapState(0);\n\n const navigableList = tapMemo(() => {\n if (isSearchMode) return searchResults ?? [];\n if (effectiveActiveCategoryId) return filteredItems;\n return filteredCategories;\n }, [\n isSearchMode,\n searchResults,\n effectiveActiveCategoryId,\n filteredItems,\n filteredCategories,\n ]);\n\n // Reset highlight when list changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentional reset on list change\n tapEffect(() => {\n setHighlightedIndex(0);\n }, [navigableList]);\n\n // -------------------------------------------------------------------------\n // Lexical select-item override\n // -------------------------------------------------------------------------\n\n const selectItemOverrideRef = tapRef<SelectItemOverride | null>(null);\n\n const registerSelectItemOverride = tapEffectEvent(\n (fn: SelectItemOverride) => {\n selectItemOverrideRef.current = fn;\n return () => {\n if (selectItemOverrideRef.current === fn) {\n selectItemOverrideRef.current = null;\n }\n };\n },\n );\n\n // -------------------------------------------------------------------------\n // Actions (stable via tapEffectEvent)\n // -------------------------------------------------------------------------\n\n const selectCategory = tapEffectEvent((categoryId: string) => {\n setActiveCategoryId(categoryId);\n setHighlightedIndex(0);\n });\n\n const goBack = tapEffectEvent(() => {\n setActiveCategoryId(null);\n setHighlightedIndex(0);\n });\n\n const selectItem = tapEffectEvent((item: Unstable_MentionItem) => {\n if (!trigger) return;\n\n // Try the Lexical override first\n if (selectItemOverrideRef.current?.(item)) {\n setActiveCategoryId(null);\n setHighlightedIndex(0);\n return;\n }\n\n // Default: text-based replacement (textarea path)\n const currentText = aui.composer().getState().text;\n const before = currentText.slice(0, trigger.offset);\n const after = currentText.slice(\n trigger.offset + triggerChar.length + trigger.query.length,\n );\n const directive = formatter.serialize(item);\n const newText =\n before + directive + (after.startsWith(\" \") ? after : ` ${after}`);\n\n aui.composer().setText(newText);\n setActiveCategoryId(null);\n setHighlightedIndex(0);\n });\n\n const close = tapEffectEvent(() => {\n setActiveCategoryId(null);\n setHighlightedIndex(0);\n // Move cursor before the trigger so trigger detection deactivates\n if (trigger) {\n setCursorPosition(trigger.offset);\n }\n });\n\n const handleKeyDown = tapEffectEvent((e: MentionKeyEvent): boolean => {\n if (!open) return false;\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault();\n setHighlightedIndex((prev) => {\n const len = navigableList.length;\n if (len === 0) return 0;\n return prev < len - 1 ? prev + 1 : 0;\n });\n return true;\n }\n case \"ArrowUp\": {\n e.preventDefault();\n setHighlightedIndex((prev) => {\n const len = navigableList.length;\n if (len === 0) return 0;\n return prev > 0 ? prev - 1 : len - 1;\n });\n return true;\n }\n case \"Enter\": {\n if (e.shiftKey) return false;\n e.preventDefault();\n const item = navigableList[highlightedIndex];\n if (!item) return true;\n\n if (isSearchMode || effectiveActiveCategoryId) {\n selectItem(item as Unstable_MentionItem);\n } else {\n selectCategory((item as Unstable_MentionCategory).id);\n }\n return true;\n }\n case \"Escape\": {\n e.preventDefault();\n close();\n return true;\n }\n case \"Backspace\": {\n if (effectiveActiveCategoryId && query === \"\") {\n e.preventDefault();\n goBack();\n return true;\n }\n return false;\n }\n default:\n return false;\n }\n });\n\n // -------------------------------------------------------------------------\n // Output\n // -------------------------------------------------------------------------\n\n return {\n open,\n query,\n activeCategoryId: effectiveActiveCategoryId,\n categories: filteredCategories,\n items: filteredItems,\n highlightedIndex,\n isSearchMode,\n formatter,\n selectCategory,\n goBack,\n selectItem,\n close,\n handleKeyDown,\n setCursorPosition,\n registerSelectItemOverride,\n };\n },\n);\n","\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"radix-ui\";\nimport {\n ClipboardEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n cloneElement,\n isValidElement,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\nimport { flushResourcesSync } from \"@assistant-ui/tap\";\nimport {\n useMentionContextOptional,\n useMentionInternalContext,\n} from \"./mention/ComposerMentionContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n\n type BaseProps = {\n /**\n * Whether to render as a child component using Slot.\n * When true, the component will merge its props with its child.\n */\n asChild?: boolean | undefined;\n /**\n * A React element to use as the input container, with props merged in.\n */\n render?: ReactElement | undefined;\n /**\n * Whether to cancel message composition when Escape is pressed.\n * @default true\n */\n cancelOnEscape?: boolean | undefined;\n /**\n * Whether to automatically focus the input when a new run starts.\n * @default true\n */\n unstable_focusOnRunStart?: boolean | undefined;\n /**\n * Whether to automatically focus the input when scrolling to bottom.\n * @default true\n */\n unstable_focusOnScrollToBottom?: boolean | undefined;\n /**\n * Whether to automatically focus the input when switching threads.\n * @default true\n */\n unstable_focusOnThreadSwitched?: boolean | undefined;\n /**\n * Whether to automatically add pasted files as attachments.\n * @default true\n */\n addAttachmentOnPaste?: boolean | undefined;\n };\n\n type SubmitModeProps =\n | {\n /**\n * Controls how the Enter key submits messages.\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"ctrlEnter\": Ctrl/Cmd+Enter submits (plain Enter for newline)\n * - \"none\": Keyboard submission disabled\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"ctrlEnter\" | \"none\" | undefined;\n /**\n * @deprecated Use `submitMode` instead\n * @ignore\n */\n submitOnEnter?: never;\n }\n | {\n submitMode?: never;\n /**\n * Whether to submit the message when Enter is pressed (without Shift).\n * @default true\n * @deprecated Use `submitMode` instead. Will be removed in a future version.\n */\n submitOnEnter?: boolean | undefined;\n };\n\n export type Props = TextareaAutosizeProps & BaseProps & SubmitModeProps;\n}\n\n/**\n * A text input component for composing messages.\n *\n * This component provides a rich text input experience with automatic resizing,\n * keyboard shortcuts, file paste support, and intelligent focus management.\n * It integrates with the composer context to manage message state and submission.\n *\n * @example\n * ```tsx\n * // Ctrl/Cmd+Enter to submit (plain Enter inserts newline)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitMode=\"ctrlEnter\"\n * />\n *\n * // Old API (deprecated, still supported)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitOnEnter={true}\n * />\n * ```\n */\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n render,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n onPaste,\n onSelect,\n submitOnEnter,\n submitMode,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n addAttachmentOnPaste = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const aui = useAui();\n const mentionContext = useMentionContextOptional();\n const mentionInternalContext = useMentionInternalContext();\n\n const effectiveSubmitMode =\n submitMode ?? (submitOnEnter === false ? \"none\" : \"enter\");\n\n const value = useAuiState((s) => {\n if (!s.composer.isEditing) return \"\";\n return s.composer.text;\n });\n\n const isDisabled =\n useAuiState(\n (s) => s.thread.isDisabled || s.composer.dictation?.inputDisabled,\n ) || disabledProp;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n // Only handle ESC if it originated from within this input\n if (!textareaRef.current?.contains(e.target as Node)) return;\n\n // Let mention popover handle Escape first\n if (mentionContext?.open) {\n mentionContext.handleKeyDown(e);\n return;\n }\n\n if (!cancelOnEscape) return;\n\n const composer = aui.composer();\n if (composer.getState().canCancel) {\n composer.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n // Let the mention popover handle keyboard events first\n if (mentionContext?.handleKeyDown(e)) return;\n\n if (e.key === \"Enter\") {\n const threadState = aui.thread().getState();\n const hasQueue = threadState.capabilities.queue;\n\n // Steer hotkey: Cmd/Ctrl+Shift+Enter (respects submitMode=\"none\" and isEmpty)\n if (\n e.shiftKey &&\n (e.ctrlKey || e.metaKey) &&\n hasQueue &&\n effectiveSubmitMode !== \"none\" &&\n !aui.composer().getState().isEmpty\n ) {\n e.preventDefault();\n aui.composer().send({ steer: true });\n return;\n }\n\n // Regular newline: Shift+Enter\n if (e.shiftKey) return;\n\n // Block submission when running unless queue is supported\n if (threadState.isRunning && !hasQueue) return;\n\n let shouldSubmit = false;\n if (effectiveSubmitMode === \"ctrlEnter\") {\n shouldSubmit = e.ctrlKey || e.metaKey;\n } else if (effectiveSubmitMode === \"enter\") {\n shouldSubmit = true;\n }\n\n if (shouldSubmit) {\n e.preventDefault();\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const handlePaste = async (e: ClipboardEvent<HTMLTextAreaElement>) => {\n if (!addAttachmentOnPaste) return;\n const threadCapabilities = aui.thread().getState().capabilities;\n const files = Array.from(e.clipboardData?.files || []);\n\n if (threadCapabilities.attachments && files.length > 0) {\n try {\n e.preventDefault();\n await Promise.all(\n files.map((file) => aui.composer().addAttachment(file)),\n );\n } catch (error) {\n console.error(\"Error adding attachment:\", error);\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (\n aui.composer().getState().type === \"thread\" &&\n unstable_focusOnScrollToBottom\n ) {\n focus();\n }\n });\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnRunStart\n )\n return undefined;\n\n return aui.on(\"thread.runStart\", focus);\n }, [unstable_focusOnRunStart, focus, aui]);\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnThreadSwitched\n )\n return undefined;\n\n return aui.on(\"threadListItem.switchedTo\", focus);\n }, [unstable_focusOnThreadSwitched, focus, aui]);\n\n const inputProps = {\n name: \"input\" as const,\n value,\n ...rest,\n ref: ref as React.ForwardedRef<HTMLTextAreaElement>,\n disabled: isDisabled,\n onChange: composeEventHandlers(\n onChange,\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!aui.composer().getState().isEditing) return;\n flushResourcesSync(() => {\n aui.composer().setText(e.target.value);\n });\n mentionInternalContext?.setCursorPosition(\n e.target.selectionStart ?? e.target.value.length,\n );\n },\n ),\n onKeyDown: composeEventHandlers(onKeyDown, handleKeyPress),\n onSelect: composeEventHandlers(\n onSelect,\n (e: React.SyntheticEvent<HTMLTextAreaElement>) => {\n const target = e.target as HTMLTextAreaElement;\n mentionInternalContext?.setCursorPosition(\n target.selectionStart ?? target.value.length,\n );\n },\n ),\n onPaste: composeEventHandlers(onPaste, handlePaste),\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n (rest as any).children !== undefined\n ? ((rest as any).children as ReactNode)\n : ((render.props as Record<string, unknown>).children as ReactNode);\n return (\n <Slot.Root {...inputProps}>\n {cloneElement(render, undefined, renderChildren)}\n </Slot.Root>\n );\n }\n\n const Component = asChild ? Slot.Root : TextareaAutosize;\n return <Component {...inputProps} />;\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n","\"use client\";\n\nimport {\n type ComponentType,\n type FC,\n memo,\n PropsWithChildren,\n useMemo,\n} from \"react\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\nimport { PartByIndexProvider } from \"../../context/providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../context/providers/TextMessagePartProvider\";\nimport { MessagePartPrimitiveText } from \"../messagePart/MessagePartText\";\nimport { MessagePartPrimitiveImage } from \"../messagePart/MessagePartImage\";\nimport type {\n Unstable_AudioMessagePartComponent,\n DataMessagePartComponent,\n DataMessagePartProps,\n EmptyMessagePartComponent,\n TextMessagePartComponent,\n ImageMessagePartComponent,\n SourceMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n FileMessagePartComponent,\n ReasoningMessagePartComponent,\n} from \"@assistant-ui/core/react\";\nimport { MessagePartPrimitiveInProgress } from \"../messagePart/MessagePartInProgress\";\nimport type { MessagePartStatus } from \"@assistant-ui/core\";\n\ntype MessagePartGroup = {\n groupKey: string | undefined;\n indices: number[];\n};\n\nexport type GroupingFunction = (parts: readonly any[]) => MessagePartGroup[];\n\n/**\n * Groups message parts by their parent ID.\n * Parts without a parent ID appear in their chronological position as individual groups.\n * Parts with the same parent ID are grouped together at the position of their first occurrence.\n */\nconst groupMessagePartsByParentId: GroupingFunction = (\n parts: readonly any[],\n): MessagePartGroup[] => {\n // Map maintains insertion order, so groups appear in order of first occurrence\n const groupMap = new Map<string, number[]>();\n\n // Process each part in order\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n const parentId = part?.parentId as string | undefined;\n\n // For parts without parentId, assign a unique group ID to maintain their position\n const groupId = parentId ?? `__ungrouped_${i}`;\n\n // Get or create the indices array for this group\n const indices = groupMap.get(groupId) ?? [];\n indices.push(i);\n groupMap.set(groupId, indices);\n }\n\n // Convert map to array of groups\n const groups: MessagePartGroup[] = [];\n for (const [groupId, indices] of groupMap) {\n // Extract parentId (undefined for ungrouped parts)\n const groupKey = groupId.startsWith(\"__ungrouped_\") ? undefined : groupId;\n groups.push({ groupKey, indices });\n }\n\n return groups;\n};\n\nconst useMessagePartsGrouped = (\n groupingFunction: GroupingFunction,\n): MessagePartGroup[] => {\n const parts = useAuiState((s) => s.message.parts);\n\n return useMemo(() => {\n if (parts.length === 0) {\n return [];\n }\n return groupingFunction(parts);\n }, [parts, groupingFunction]);\n};\n\nexport namespace MessagePrimitiveUnstable_PartsGrouped {\n export type Props = {\n /**\n * Function that takes an array of message parts and returns an array of groups.\n * Each group contains a key (for identification) and an array of indices.\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * groupingFunction={(parts) => {\n * const groups = new Map<string, number[]>();\n * parts.forEach((part, i) => {\n * const key = part.parentId ?? `__ungrouped_${i}`;\n * const indices = groups.get(key) ?? [];\n * indices.push(i);\n * groups.set(key, indices);\n * });\n * return Array.from(groups.entries()).map(([key, indices]) => ({\n * key: key.startsWith(\"__ungrouped_\") ? undefined : key,\n * indices\n * }));\n * }}\n * ```\n *\n * @example\n * ```tsx\n * // Group by tool name\n * import { groupMessagePartsByToolName } from \"@assistant-ui/react\";\n *\n * <MessagePrimitive.Unstable_PartsGrouped\n * groupingFunction={groupMessagePartsByToolName}\n * components={{\n * Group: ({ key, indices, children }) => {\n * if (!key) return <>{children}</>;\n * return (\n * <div className=\"tool-group\">\n * <h4>Tool: {key}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\n groupingFunction: GroupingFunction;\n\n /**\n * Component configuration for rendering different types of message content.\n *\n * You can provide custom components for each content type (text, image, file, etc.)\n * and configure tool rendering behavior. If not provided, default components will be used.\n */\n components:\n | {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /** Component for rendering audio content (experimental) */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?:\n | {\n /** Map data event names to specific components */\n by_name?:\n | Record<string, DataMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n }\n | undefined;\n /** Configuration for tool call rendering */\n tools?:\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n }\n | undefined;\n\n /**\n * Component for rendering grouped message parts.\n *\n * When provided, this component will automatically wrap message parts that share\n * the same group key as determined by the groupingFunction.\n *\n * The component receives:\n * - `groupKey`: The group key (or undefined for ungrouped parts)\n * - `indices`: Array of indices for the parts in this group\n * - `children`: The rendered message part components\n *\n * @example\n * ```tsx\n * // Collapsible group\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <details className=\"message-group\">\n * <summary>\n * Group {groupKey} ({indices.length} parts)\n * </summary>\n * <div className=\"group-content\">\n * {children}\n * </div>\n * </details>\n * );\n * }\n * ```\n *\n * @param groupKey - The group key (undefined for ungrouped parts)\n * @param indices - Array of indices for the parts in this group\n * @param children - Rendered message part components to display within the group\n */\n Group?: ComponentType<\n PropsWithChildren<{\n groupKey: string | undefined;\n indices: number[];\n }>\n >;\n }\n | undefined;\n };\n}\n\nconst ToolUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: ToolCallMessagePartComponent | undefined;\n} & ToolCallMessagePartProps) => {\n const Render = useAuiState((s) => {\n const Render = s.tools.tools[props.toolName] ?? Fallback;\n if (Array.isArray(Render)) return Render[0] ?? Fallback;\n return Render;\n });\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: DataMessagePartComponent | undefined;\n} & DataMessagePartProps) => {\n const Render = useAuiState((s) => {\n const Render = s.dataRenderers.renderers[props.name] ?? Fallback;\n if (Array.isArray(Render)) return Render[0] ?? Fallback;\n return Render;\n });\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst defaultComponents = {\n Text: () => (\n <p style={{ whiteSpace: \"pre-line\" }}>\n <MessagePartPrimitiveText />\n <MessagePartPrimitiveInProgress>\n <span style={{ fontFamily: \"revert\" }}>{\" \\u25CF\"}</span>\n </MessagePartPrimitiveInProgress>\n </p>\n ),\n Reasoning: () => null,\n Source: () => null,\n Image: () => <MessagePartPrimitiveImage />,\n File: () => null,\n Unstable_Audio: () => null,\n Group: ({ children }) => children,\n} satisfies MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\nconst MessagePartComponent: FC<MessagePartComponentProps> = ({\n components: {\n Text = defaultComponents.Text,\n Reasoning = defaultComponents.Reasoning,\n Image = defaultComponents.Image,\n Source = defaultComponents.Source,\n File = defaultComponents.File,\n Unstable_Audio: Audio = defaultComponents.Unstable_Audio,\n tools = {},\n data,\n } = {},\n}) => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n\n const type = part.type;\n if (type === \"tool-call\") {\n const addResult = aui.part().addToolResult;\n const resume = aui.part().resumeToolCall;\n if (\"Override\" in tools)\n return <tools.Override {...part} addResult={addResult} resume={resume} />;\n const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;\n return (\n <ToolUIDisplay\n {...part}\n Fallback={Tool}\n addResult={addResult}\n resume={resume}\n />\n );\n }\n\n if (part.status?.type === \"requires-action\")\n throw new Error(\"Encountered unexpected requires-action status\");\n\n switch (type) {\n case \"text\":\n return <Text {...part} />;\n\n case \"reasoning\":\n return <Reasoning {...part} />;\n\n case \"source\":\n return <Source {...part} />;\n\n case \"image\":\n return <Image {...part} />;\n\n case \"file\":\n return <File {...part} />;\n\n case \"audio\":\n return <Audio {...part} />;\n\n case \"data\": {\n const Data = data?.by_name?.[part.name] ?? data?.Fallback;\n return <DataUIDisplay {...part} Fallback={Data} />;\n }\n\n default:\n console.warn(`Unknown message part type: ${type}`);\n return null;\n }\n};\n\ntype MessagePartProps = {\n partIndex: number;\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\nconst MessagePartImpl: FC<MessagePartProps> = ({ partIndex, components }) => {\n return (\n <PartByIndexProvider index={partIndex}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n );\n};\n\nconst MessagePart = memo(\n MessagePartImpl,\n (prev, next) =>\n prev.partIndex === next.partIndex &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data &&\n prev.components?.Group === next.components?.Group,\n);\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\n/**\n * Renders the parts of a message grouped by a custom grouping function.\n *\n * This component allows you to group message parts based on any criteria you define.\n * The grouping function receives all message parts and returns an array of groups,\n * where each group has a key and an array of part indices.\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * <MessagePrimitive.Unstable_PartsGrouped\n * components={{\n * Text: ({ text }) => <p className=\"message-text\">{text}</p>,\n * Image: ({ image }) => <img src={image} alt=\"Message image\" />,\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <div className=\"parent-group border rounded p-4\">\n * <h4>Parent ID: {groupKey}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n *\n * @example\n * ```tsx\n * // Group by tool name\n * import { groupMessagePartsByToolName } from \"@assistant-ui/react\";\n *\n * <MessagePrimitive.Unstable_PartsGrouped\n * groupingFunction={groupMessagePartsByToolName}\n * components={{\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <div className=\"tool-group\">\n * <h4>Tool: {groupKey}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\nexport const MessagePrimitiveUnstable_PartsGrouped: FC<\n MessagePrimitiveUnstable_PartsGrouped.Props\n> = ({ groupingFunction, components }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const messageGroups = useMessagePartsGrouped(groupingFunction);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n return messageGroups.map((group, groupIndex) => {\n const GroupComponent = components?.Group ?? defaultComponents.Group;\n\n return (\n <GroupComponent\n key={`group-${groupIndex}-${group.groupKey ?? \"ungrouped\"}`}\n groupKey={group.groupKey}\n indices={group.indices}\n >\n {group.indices.map((partIndex) => (\n <MessagePart\n key={partIndex}\n partIndex={partIndex}\n components={components}\n />\n ))}\n </GroupComponent>\n );\n });\n }, [messageGroups, components, contentLength]);\n\n return <>{partsElements}</>;\n};\n\nMessagePrimitiveUnstable_PartsGrouped.displayName =\n \"MessagePrimitive.Unstable_PartsGrouped\";\n\n/**\n * Renders the parts of a message grouped by their parent ID.\n * This is a convenience wrapper around Unstable_PartsGrouped with parent ID grouping.\n *\n * @deprecated Use MessagePrimitive.Unstable_PartsGrouped instead for more flexibility\n */\nexport const MessagePrimitiveUnstable_PartsGroupedByParentId: FC<\n Omit<MessagePrimitiveUnstable_PartsGrouped.Props, \"groupingFunction\">\n> = ({ components, ...props }) => {\n return (\n <MessagePrimitiveUnstable_PartsGrouped\n {...props}\n components={components}\n groupingFunction={groupMessagePartsByParentId}\n />\n );\n};\n\nMessagePrimitiveUnstable_PartsGroupedByParentId.displayName =\n \"MessagePrimitive.Unstable_PartsGroupedByParentId\";\n","\"use client\";\n\nimport type {\n TextMessagePart,\n ReasoningMessagePart,\n MessagePartState,\n} from \"@assistant-ui/core\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport const useMessagePartText = () => {\n const text = useAuiState((s) => {\n if (s.part.type !== \"text\" && s.part.type !== \"reasoning\")\n throw new Error(\n \"MessagePartText can only be used inside text or reasoning message parts.\",\n );\n\n return s.part as MessagePartState &\n (TextMessagePart | ReasoningMessagePart);\n });\n\n return text;\n};\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport * as React from 'react';\nimport useLatest from 'use-latest';\nimport useComposedRef from 'use-composed-ref';\n\nvar isBrowser = typeof document !== 'undefined';\n\nvar HIDDEN_TEXTAREA_STYLE = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0',\n display: 'block'\n};\nvar forceHiddenStyles = function forceHiddenStyles(node) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n};\nvar forceHiddenStyles$1 = forceHiddenStyles;\n\nvar hiddenTextarea = null;\nvar getHeight = function getHeight(node, sizingData) {\n var height = node.scrollHeight;\n if (sizingData.sizingStyle.boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n return height + sizingData.borderSize;\n }\n\n // remove padding, since height = content\n return height - sizingData.paddingSize;\n};\nfunction calculateNodeHeight(sizingData, value, minRows, maxRows) {\n if (minRows === void 0) {\n minRows = 1;\n }\n if (maxRows === void 0) {\n maxRows = Infinity;\n }\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement('textarea');\n hiddenTextarea.setAttribute('tabindex', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n forceHiddenStyles$1(hiddenTextarea);\n }\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n }\n var paddingSize = sizingData.paddingSize,\n borderSize = sizingData.borderSize,\n sizingStyle = sizingData.sizingStyle;\n var boxSizing = sizingStyle.boxSizing;\n Object.keys(sizingStyle).forEach(function (_key) {\n var key = _key;\n hiddenTextarea.style[key] = sizingStyle[key];\n });\n forceHiddenStyles$1(hiddenTextarea);\n hiddenTextarea.value = value;\n var height = getHeight(hiddenTextarea, sizingData);\n // Double set and calc due to Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904\n hiddenTextarea.value = value;\n height = getHeight(hiddenTextarea, sizingData);\n\n // measure height of a textarea with a single row\n hiddenTextarea.value = 'x';\n var rowHeight = hiddenTextarea.scrollHeight - paddingSize;\n var minHeight = rowHeight * minRows;\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n height = Math.max(minHeight, height);\n var maxHeight = rowHeight * maxRows;\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n height = Math.min(maxHeight, height);\n return [height, rowHeight];\n}\n\nvar noop = function noop() {};\nvar pick = function pick(props, obj) {\n return props.reduce(function (acc, prop) {\n acc[prop] = obj[prop];\n return acc;\n }, {});\n};\n\nvar SIZING_STYLE = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'letterSpacing', 'lineHeight', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop',\n// non-standard\n'tabSize', 'textIndent',\n// non-standard\n'textRendering', 'textTransform', 'width', 'wordBreak', 'wordSpacing', 'scrollbarGutter'];\nvar isIE = isBrowser ? !!document.documentElement.currentStyle : false;\nvar getSizingData = function getSizingData(node) {\n var style = window.getComputedStyle(node);\n if (style === null) {\n return null;\n }\n var sizingStyle = pick(SIZING_STYLE, style);\n var boxSizing = sizingStyle.boxSizing;\n\n // probably node is detached from DOM, can't read computed dimensions\n if (boxSizing === '') {\n return null;\n }\n\n // IE (Edge has already correct behaviour) returns content width as computed width\n // so we need to add manually padding and border widths\n if (isIE && boxSizing === 'border-box') {\n sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(sizingStyle.borderRightWidth) + parseFloat(sizingStyle.borderLeftWidth) + parseFloat(sizingStyle.paddingRight) + parseFloat(sizingStyle.paddingLeft) + 'px';\n }\n var paddingSize = parseFloat(sizingStyle.paddingBottom) + parseFloat(sizingStyle.paddingTop);\n var borderSize = parseFloat(sizingStyle.borderBottomWidth) + parseFloat(sizingStyle.borderTopWidth);\n return {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize\n };\n};\nvar getSizingData$1 = getSizingData;\n\nfunction useListener(target, type, listener) {\n var latestListener = useLatest(listener);\n React.useLayoutEffect(function () {\n var handler = function handler(ev) {\n return latestListener.current(ev);\n };\n // might happen if document.fonts is not defined, for instance\n if (!target) {\n return;\n }\n target.addEventListener(type, handler);\n return function () {\n return target.removeEventListener(type, handler);\n };\n }, []);\n}\nvar useFormResetListener = function useFormResetListener(libRef, listener) {\n useListener(document.body, 'reset', function (ev) {\n if (libRef.current.form === ev.target) {\n listener(ev);\n }\n });\n};\nvar useWindowResizeListener = function useWindowResizeListener(listener) {\n useListener(window, 'resize', listener);\n};\nvar useFontsLoadedListener = function useFontsLoadedListener(listener) {\n useListener(document.fonts, 'loadingdone', listener);\n};\n\nvar _excluded = [\"cacheMeasurements\", \"maxRows\", \"minRows\", \"onChange\", \"onHeightChange\"];\nvar TextareaAutosize = function TextareaAutosize(_ref, userRef) {\n var cacheMeasurements = _ref.cacheMeasurements,\n maxRows = _ref.maxRows,\n minRows = _ref.minRows,\n _ref$onChange = _ref.onChange,\n onChange = _ref$onChange === void 0 ? noop : _ref$onChange,\n _ref$onHeightChange = _ref.onHeightChange,\n onHeightChange = _ref$onHeightChange === void 0 ? noop : _ref$onHeightChange,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n var isControlled = props.value !== undefined;\n var libRef = React.useRef(null);\n var ref = useComposedRef(libRef, userRef);\n var heightRef = React.useRef(0);\n var measurementsCacheRef = React.useRef();\n var resizeTextarea = function resizeTextarea() {\n var node = libRef.current;\n var nodeSizingData = cacheMeasurements && measurementsCacheRef.current ? measurementsCacheRef.current : getSizingData$1(node);\n if (!nodeSizingData) {\n return;\n }\n measurementsCacheRef.current = nodeSizingData;\n var _calculateNodeHeight = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows),\n height = _calculateNodeHeight[0],\n rowHeight = _calculateNodeHeight[1];\n if (heightRef.current !== height) {\n heightRef.current = height;\n node.style.setProperty('height', height + \"px\", 'important');\n onHeightChange(height, {\n rowHeight: rowHeight\n });\n }\n };\n var handleChange = function handleChange(event) {\n if (!isControlled) {\n resizeTextarea();\n }\n onChange(event);\n };\n if (isBrowser) {\n React.useLayoutEffect(resizeTextarea);\n useFormResetListener(libRef, function () {\n if (!isControlled) {\n var currentValue = libRef.current.value;\n requestAnimationFrame(function () {\n var node = libRef.current;\n if (node && currentValue !== node.value) {\n resizeTextarea();\n }\n });\n }\n });\n useWindowResizeListener(resizeTextarea);\n useFontsLoadedListener(resizeTextarea);\n return /*#__PURE__*/React.createElement(\"textarea\", _extends({}, props, {\n onChange: handleChange,\n ref: ref\n }));\n }\n return /*#__PURE__*/React.createElement(\"textarea\", _extends({}, props, {\n onChange: onChange,\n ref: ref\n }));\n};\nvar index = /* #__PURE__ */React.forwardRef(TextareaAutosize);\n\nexport { index as default };\n","\"use client\";\n\nimport { Slot } from \"radix-ui\";\nimport {\n createContext,\n type FC,\n type ReactNode,\n useCallback,\n useContext,\n} from \"react\";\nimport { useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\n\nconst SlackNestingContext = createContext(false);\n\nconst parseCssLength = (value: string, element: HTMLElement): number => {\n const match = value.match(/^([\\d.]+)(em|px|rem)$/);\n if (!match) return 0;\n\n const num = parseFloat(match[1]!);\n const unit = match[2];\n\n if (unit === \"px\") return num;\n if (unit === \"em\") {\n const fontSize = parseFloat(getComputedStyle(element).fontSize) || 16;\n return num * fontSize;\n }\n if (unit === \"rem\") {\n const rootFontSize =\n parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n return num * rootFontSize;\n }\n return 0;\n};\n\nexport type ThreadViewportSlackProps = {\n /** Threshold at which the user message height clamps to the offset */\n fillClampThreshold?: string;\n /** Offset used when clamping large user messages */\n fillClampOffset?: string;\n children: ReactNode;\n};\n\n/**\n * A slot component that provides minimum height to enable scroll anchoring.\n *\n * When using `turnAnchor=\"top\"`, this component ensures there is\n * enough scroll room below the anchor point (last user message) for it to scroll\n * to the top of the viewport. The min-height is applied only to the last\n * assistant message.\n *\n * This component is used internally by MessagePrimitive.Root.\n */\nexport const ThreadPrimitiveViewportSlack: FC<ThreadViewportSlackProps> = ({\n children,\n fillClampThreshold = \"10em\",\n fillClampOffset = \"6em\",\n}) => {\n const shouldApplySlack = useAuiState(\n // only add slack to the last assistant message following a user message (valid turn)\n (s) =>\n s.message.isLast &&\n s.message.role === \"assistant\" &&\n s.message.index >= 1 &&\n s.thread.messages.at(s.message.index - 1)?.role === \"user\",\n );\n const threadViewportStore = useThreadViewportStore({ optional: true });\n const isNested = useContext(SlackNestingContext);\n\n const callback = useCallback(\n (el: HTMLElement) => {\n if (!threadViewportStore || isNested) return;\n\n const updateMinHeight = () => {\n const state = threadViewportStore.getState();\n if (state.turnAnchor === \"top\" && shouldApplySlack) {\n const { viewport, inset, userMessage } = state.height;\n const threshold = parseCssLength(fillClampThreshold, el);\n const offset = parseCssLength(fillClampOffset, el);\n const clampAdjustment =\n userMessage <= threshold ? userMessage : offset;\n\n const minHeight = Math.max(0, viewport - inset - clampAdjustment);\n el.style.minHeight = `${minHeight}px`;\n el.style.flexShrink = \"0\";\n el.style.transition = \"min-height 0s\";\n } else {\n el.style.minHeight = \"\";\n el.style.flexShrink = \"\";\n el.style.transition = \"\";\n }\n };\n\n updateMinHeight();\n return threadViewportStore.subscribe(updateMinHeight);\n },\n [\n threadViewportStore,\n shouldApplySlack,\n isNested,\n fillClampThreshold,\n fillClampOffset,\n ],\n );\n\n const ref = useManagedRef<HTMLElement>(callback);\n\n return (\n <SlackNestingContext.Provider value={true}>\n <Slot.Root ref={ref}>{children}</Slot.Root>\n </SlackNestingContext.Provider>\n );\n};\n\nThreadPrimitiveViewportSlack.displayName = \"ThreadPrimitive.ViewportSlack\";\n","import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver((mutations) => {\n // Filter out style-only attribute mutations to prevent feedback loops\n // with components like ThreadViewportSlack that write styles in response\n // to viewport changes\n const hasRelevantMutation = mutations.some(\n (m) => m.type !== \"attributes\" || m.attributeName !== \"style\",\n );\n if (hasRelevantMutation) {\n callbackRef();\n }\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['rect', { x: '9', y: '9', width: '6', height: '6', rx: '1', key: '1ssd4o' }],\n];\n\n/**\n * @component @name CircleStop\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cmVjdCB4PSI5IiB5PSI5IiB3aWR0aD0iNiIgaGVpZ2h0PSI2IiByeD0iMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/circle-stop\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CircleStop = createLucideIcon('circle-stop', __iconNode);\n\nexport default CircleStop;\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n [\n 'path',\n {\n d: 'M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z',\n key: '117uat',\n },\n ],\n ['path', { d: 'M6 12h16', key: 's4cdu5' }],\n];\n\n/**\n * @component @name SendHorizontal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy43MTQgMy4wNDhhLjQ5OC40OTggMCAwIDAtLjY4My42MjdsMi44NDMgNy42MjdhMiAyIDAgMCAxIDAgMS4zOTZsLTIuODQyIDcuNjI3YS40OTguNDk4IDAgMCAwIC42ODIuNjI3bDE4LTguNWEuNS41IDAgMCAwIDAtLjkwNHoiIC8+CiAgPHBhdGggZD0iTTYgMTJoMTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/send-horizontal\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst SendHorizontal = createLucideIcon('send-horizontal', __iconNode);\n\nexport default SendHorizontal;\n","const WHITESPACE_RE = /\\s/;\n\n/**\n * Detect a mention trigger in text relative to the cursor position.\n *\n * @internal Exported for testing and for the MentionResource.\n */\nexport function detectMentionTrigger(\n text: string,\n triggerChar: string,\n cursorPosition: number,\n): {\n query: string;\n offset: number;\n} | null {\n // Only consider text up to the cursor\n const textUpToCursor = text.slice(0, cursorPosition);\n\n // Search backwards from cursor for the trigger character.\n // Stop at any whitespace during scan — trigger must be contiguous with cursor.\n for (let i = textUpToCursor.length - 1; i >= 0; i--) {\n const char = textUpToCursor[i]!;\n\n if (WHITESPACE_RE.test(char)) return null;\n\n if (textUpToCursor.startsWith(triggerChar, i)) {\n // Trigger must be preceded by whitespace or be at start of text\n if (i > 0 && !WHITESPACE_RE.test(textUpToCursor[i - 1]!)) continue;\n\n const query = textUpToCursor.slice(i + triggerChar.length);\n\n return { query, offset: i };\n }\n }\n\n return null;\n}\n","\"use client\";\n\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\nimport type { SizeHandle } from \"../../context/stores/ThreadViewport\";\n\n/**\n * Hook that creates a ref for tracking element size via a SizeHandle.\n * Automatically sets up ResizeObserver and reports height changes.\n *\n * @param register - Function that returns a SizeHandle (e.g., registerContentInset)\n * @param getHeight - Optional function to compute height (defaults to el.offsetHeight)\n * @returns A ref callback to attach to the element\n */\nexport const useSizeHandle = (\n register: (() => SizeHandle) | null | undefined,\n getHeight?: (el: HTMLElement) => number,\n) => {\n const callbackRef = useCallback(\n (el: HTMLElement) => {\n if (!register) return;\n\n const sizeHandle = register();\n\n const updateHeight = () => {\n const height = getHeight ? getHeight(el) : el.offsetHeight;\n sizeHandle.setHeight(height);\n };\n\n const ro = new ResizeObserver(updateHeight);\n ro.observe(el);\n updateHeight();\n\n return () => {\n ro.disconnect();\n sizeHandle.unregister();\n };\n },\n [register, getHeight],\n );\n\n return useManagedRef(callbackRef);\n};\n","import { type FC, type ReactNode, memo } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { getMessageQuote } from \"../../utils/getMessageQuote\";\nimport type { QuoteInfo } from \"../../../types/quote\";\n\nexport namespace MessagePrimitiveQuote {\n export type Props = {\n /** Render function called when a quote is present. Receives quote info. */\n children: (value: QuoteInfo) => ReactNode;\n };\n}\n\n/**\n * Renders a quote block if the message has quote metadata.\n * Place this above `MessagePrimitive.Parts` in your message layout.\n *\n * @example\n * ```tsx\n * <MessagePrimitive.Quote>\n * {({ text, messageId }) => <QuoteBlock text={text} messageId={messageId} />}\n * </MessagePrimitive.Quote>\n * <MessagePrimitive.Parts>\n * {({ part }) => { ... }}\n * </MessagePrimitive.Parts>\n * ```\n */\nconst MessagePrimitiveQuoteImpl: FC<MessagePrimitiveQuote.Props> = ({\n children,\n}) => {\n const quoteInfo = useAuiState(getMessageQuote);\n if (!quoteInfo) return null;\n return <>{children(quoteInfo)}</>;\n};\n\nexport const MessagePrimitiveQuote = memo(MessagePrimitiveQuoteImpl);\n\nMessagePrimitiveQuote.displayName = \"MessagePrimitive.Quote\";\n","\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n type FormEvent,\n forwardRef,\n ComponentPropsWithoutRef,\n} from \"react\";\nimport { useComposerSend } from \"./ComposerSend\";\n\nexport namespace ComposerPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.form>;\n /**\n * Props for the ComposerPrimitive.Root component.\n * Accepts all standard form element props.\n */\n export type Props = ComponentPropsWithoutRef<typeof Primitive.form>;\n}\n\n/**\n * The root form container for message composition.\n *\n * This component provides a form wrapper that handles message submission when the form\n * is submitted (e.g., via Enter key or submit button). It automatically prevents the\n * default form submission and triggers the composer's send functionality.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Root>\n * <ComposerPrimitive.Input placeholder=\"Type your message...\" />\n * <ComposerPrimitive.Send>Send</ComposerPrimitive.Send>\n * </ComposerPrimitive.Root>\n * ```\n */\nexport const ComposerPrimitiveRoot = forwardRef<\n ComposerPrimitiveRoot.Element,\n ComposerPrimitiveRoot.Props\n>(({ onSubmit, ...rest }, forwardedRef) => {\n const send = useComposerSend();\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n\n if (!send) return;\n send();\n };\n\n return (\n <Primitive.form\n {...rest}\n ref={forwardedRef}\n onSubmit={composeEventHandlers(onSubmit, handleSubmit)}\n />\n );\n});\n\nComposerPrimitiveRoot.displayName = \"ComposerPrimitive.Root\";\n","\"use client\";\n\nimport { useCallback } from \"react\";\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useComposerSend as useComposerSendBehavior } from \"@assistant-ui/core/react\";\n\nexport const useComposerSend = () => {\n const { disabled, send } = useComposerSendBehavior();\n const callback = useCallback(() => send(), [send]);\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveSend {\n export type Element = ActionButtonElement;\n /**\n * Props for the ComposerPrimitive.Send component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useComposerSend>;\n}\n\n/**\n * A button component that sends the current message in the composer.\n *\n * This component automatically handles the send functionality and is disabled\n * when sending is not available (e.g., when the thread is running, the composer\n * is empty, or not in editing mode).\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Send>\n * Send Message\n * </ComposerPrimitive.Send>\n * ```\n */\nexport const ComposerPrimitiveSend = createActionButton(\n \"ComposerPrimitive.Send\",\n useComposerSend,\n);\n","\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useActionBarEdit as useActionBarEditBehavior } from \"@assistant-ui/core/react\";\n\n/**\n * Hook that provides edit functionality for action bar buttons.\n *\n * This hook returns a callback function that starts editing the current message,\n * or null if editing is not available (e.g., already in editing mode).\n *\n * @returns An edit callback function, or null if editing is disabled\n *\n * @example\n * ```tsx\n * function CustomEditButton() {\n * const edit = useActionBarEdit();\n *\n * return (\n * <button onClick={edit} disabled={!edit}>\n * {edit ? \"Edit Message\" : \"Cannot Edit\"}\n * </button>\n * );\n * }\n * ```\n */\nconst useActionBarEdit = () => {\n const { disabled, edit } = useActionBarEditBehavior();\n if (disabled) return null;\n return edit;\n};\n\nexport namespace ActionBarPrimitiveEdit {\n export type Element = ActionButtonElement;\n /**\n * Props for the ActionBarPrimitive.Edit component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<typeof useActionBarEdit>;\n}\n\n/**\n * A button component that starts editing the current message.\n *\n * This component automatically handles starting the edit mode for the current message\n * and is disabled when editing is not available (e.g., already in editing mode).\n *\n * @example\n * ```tsx\n * <ActionBarPrimitive.Edit>\n * Edit Message\n * </ActionBarPrimitive.Edit>\n * ```\n */\nexport const ActionBarPrimitiveEdit = createActionButton(\n \"ActionBarPrimitive.Edit\",\n useActionBarEdit,\n);\n","import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\ndeclare module 'react' {\n interface ReactElement {\n $$typeof?: symbol | string;\n }\n}\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\n\ninterface LazyReactElement extends React.ReactElement {\n $$typeof: typeof REACT_LAZY_TYPE;\n _payload: PromiseLike<Exclude<React.ReactNode, PromiseLike<any>>>;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type Usable<T> = PromiseLike<T> | React.Context<T>;\nconst use: typeof React.use | undefined = (React as any)[' use '.trim().toString()];\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return typeof value === 'object' && value !== null && 'then' in value;\n}\n\nfunction isLazyComponent(element: React.ReactNode): element is LazyReactElement {\n return (\n element != null &&\n typeof element === 'object' &&\n '$$typeof' in element &&\n element.$$typeof === REACT_LAZY_TYPE &&\n '_payload' in element &&\n isPromiseLike(element._payload)\n );\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === 'function') {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === 'function') {\n children = use(children._payload);\n }\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode,\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","'use strict'\n\nconst hasBuffer = typeof Buffer !== 'undefined'\nconst suspectProtoRx = /\"(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])(?:p|\\\\u0070)(?:r|\\\\u0072)(?:o|\\\\u006[Ff])(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:_|\\\\u005[Ff])(?:_|\\\\u005[Ff])\"\\s*:/\nconst suspectConstructorRx = /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/\n\n/**\n * @description Internal parse function that parses JSON text with security checks.\n * @private\n * @param {string|Buffer} text - The JSON text string or Buffer to parse.\n * @param {Function} [reviver] - The JSON.parse() optional reviver argument.\n * @param {import('./types').ParseOptions} [options] - Optional configuration object.\n * @returns {*} The parsed object.\n * @throws {SyntaxError} If a forbidden prototype property is found and `options.protoAction` or\n * `options.constructorAction` is `'error'`.\n */\nfunction _parse (text, reviver, options) {\n // Normalize arguments\n if (options == null) {\n if (reviver !== null && typeof reviver === 'object') {\n options = reviver\n reviver = undefined\n }\n }\n\n if (hasBuffer && Buffer.isBuffer(text)) {\n text = text.toString()\n }\n\n // BOM checker\n if (text && text.charCodeAt(0) === 0xFEFF) {\n text = text.slice(1)\n }\n\n // Parse normally, allowing exceptions\n const obj = JSON.parse(text, reviver)\n\n // Ignore null and non-objects\n if (obj === null || typeof obj !== 'object') {\n return obj\n }\n\n const protoAction = (options && options.protoAction) || 'error'\n const constructorAction = (options && options.constructorAction) || 'error'\n\n // options: 'error' (default) / 'remove' / 'ignore'\n if (protoAction === 'ignore' && constructorAction === 'ignore') {\n return obj\n }\n\n if (protoAction !== 'ignore' && constructorAction !== 'ignore') {\n if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {\n return obj\n }\n } else if (protoAction !== 'ignore' && constructorAction === 'ignore') {\n if (suspectProtoRx.test(text) === false) {\n return obj\n }\n } else {\n if (suspectConstructorRx.test(text) === false) {\n return obj\n }\n }\n\n // Scan result for proto keys\n return filter(obj, { protoAction, constructorAction, safe: options && options.safe })\n}\n\n/**\n * @description Scans and filters an object for forbidden prototype properties.\n * @param {Object} obj - The object being scanned.\n * @param {import('./types').ParseOptions} [options] - Optional configuration object.\n * @returns {Object|null} The filtered object, or `null` if safe mode is enabled and issues are found.\n * @throws {SyntaxError} If a forbidden prototype property is found and `options.protoAction` or\n * `options.constructorAction` is `'error'`.\n */\nfunction filter (obj, { protoAction = 'error', constructorAction = 'error', safe } = {}) {\n let next = [obj]\n\n while (next.length) {\n const nodes = next\n next = []\n\n for (const node of nodes) {\n if (protoAction !== 'ignore' && Object.prototype.hasOwnProperty.call(node, '__proto__')) { // Avoid calling node.hasOwnProperty directly\n if (safe === true) {\n return null\n } else if (protoAction === 'error') {\n throw new SyntaxError('Object contains forbidden prototype property')\n }\n\n delete node.__proto__ // eslint-disable-line no-proto\n }\n\n if (constructorAction !== 'ignore' &&\n Object.prototype.hasOwnProperty.call(node, 'constructor') &&\n node.constructor !== null &&\n typeof node.constructor === 'object' &&\n Object.prototype.hasOwnProperty.call(node.constructor, 'prototype')) { // Avoid calling node.hasOwnProperty directly\n if (safe === true) {\n return null\n } else if (constructorAction === 'error') {\n throw new SyntaxError('Object contains forbidden prototype property')\n }\n\n delete node.constructor\n }\n\n for (const key in node) {\n const value = node[key]\n if (value && typeof value === 'object') {\n next.push(value)\n }\n }\n }\n }\n return obj\n}\n\n/**\n * @description Parses a given JSON-formatted text into an object.\n * @param {string|Buffer} text - The JSON text string or Buffer to parse.\n * @param {Function} [reviver] - The `JSON.parse()` optional reviver argument, or options object.\n * @param {import('./types').ParseOptions} [options] - Optional configuration object.\n * @returns {*} The parsed object.\n * @throws {SyntaxError} If the JSON text is malformed or contains forbidden prototype properties\n * when `options.protoAction` or `options.constructorAction` is `'error'`.\n */\nfunction parse (text, reviver, options) {\n const { stackTraceLimit } = Error\n Error.stackTraceLimit = 0\n try {\n return _parse(text, reviver, options)\n } finally {\n Error.stackTraceLimit = stackTraceLimit\n }\n}\n\n/**\n * @description Safely parses a given JSON-formatted text into an object.\n * @param {string|Buffer} text - The JSON text string or Buffer to parse.\n * @param {Function} [reviver] - The `JSON.parse()` optional reviver argument.\n * @returns {*|null|undefined} The parsed object, `null` if security issues found, or `undefined` on parse error.\n */\nfunction safeParse (text, reviver) {\n const { stackTraceLimit } = Error\n Error.stackTraceLimit = 0\n try {\n return _parse(text, reviver, { safe: true })\n } catch {\n return undefined\n } finally {\n Error.stackTraceLimit = stackTraceLimit\n }\n}\n\nmodule.exports = parse\nmodule.exports.default = parse\nmodule.exports.parse = parse\nmodule.exports.safeParse = safeParse\nmodule.exports.scan = filter\n","import { notifyManager } from './notifyManager'\nimport { Removable } from './removable'\nimport { createRetryer } from './retryer'\nimport type {\n DefaultError,\n MutationFunctionContext,\n MutationMeta,\n MutationOptions,\n MutationStatus,\n} from './types'\nimport type { MutationCache } from './mutationCache'\nimport type { MutationObserver } from './mutationObserver'\nimport type { Retryer } from './retryer'\nimport type { QueryClient } from './queryClient'\n\n// TYPES\n\ninterface MutationConfig<TData, TError, TVariables, TOnMutateResult> {\n client: QueryClient\n mutationId: number\n mutationCache: MutationCache\n options: MutationOptions<TData, TError, TVariables, TOnMutateResult>\n state?: MutationState<TData, TError, TVariables, TOnMutateResult>\n}\n\nexport interface MutationState<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> {\n context: TOnMutateResult | undefined\n data: TData | undefined\n error: TError | null\n failureCount: number\n failureReason: TError | null\n isPaused: boolean\n status: MutationStatus\n variables: TVariables | undefined\n submittedAt: number\n}\n\ninterface FailedAction<TError> {\n type: 'failed'\n failureCount: number\n error: TError | null\n}\n\ninterface PendingAction<TVariables, TOnMutateResult> {\n type: 'pending'\n isPaused: boolean\n variables?: TVariables\n context?: TOnMutateResult\n}\n\ninterface SuccessAction<TData> {\n type: 'success'\n data: TData\n}\n\ninterface ErrorAction<TError> {\n type: 'error'\n error: TError\n}\n\ninterface PauseAction {\n type: 'pause'\n}\n\ninterface ContinueAction {\n type: 'continue'\n}\n\nexport type Action<TData, TError, TVariables, TOnMutateResult> =\n | ContinueAction\n | ErrorAction<TError>\n | FailedAction<TError>\n | PendingAction<TVariables, TOnMutateResult>\n | PauseAction\n | SuccessAction<TData>\n\n// CLASS\n\nexport class Mutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> extends Removable {\n state: MutationState<TData, TError, TVariables, TOnMutateResult>\n options!: MutationOptions<TData, TError, TVariables, TOnMutateResult>\n readonly mutationId: number\n\n #client: QueryClient\n #observers: Array<\n MutationObserver<TData, TError, TVariables, TOnMutateResult>\n >\n #mutationCache: MutationCache\n #retryer?: Retryer<TData>\n\n constructor(\n config: MutationConfig<TData, TError, TVariables, TOnMutateResult>,\n ) {\n super()\n\n this.#client = config.client\n this.mutationId = config.mutationId\n this.#mutationCache = config.mutationCache\n this.#observers = []\n this.state = config.state || getDefaultState()\n\n this.setOptions(config.options)\n this.scheduleGc()\n }\n\n setOptions(\n options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,\n ): void {\n this.options = options\n\n this.updateGcTime(this.options.gcTime)\n }\n\n get meta(): MutationMeta | undefined {\n return this.options.meta\n }\n\n addObserver(observer: MutationObserver<any, any, any, any>): void {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer)\n\n // Stop the mutation from being garbage collected\n this.clearGcTimeout()\n\n this.#mutationCache.notify({\n type: 'observerAdded',\n mutation: this,\n observer,\n })\n }\n }\n\n removeObserver(observer: MutationObserver<any, any, any, any>): void {\n this.#observers = this.#observers.filter((x) => x !== observer)\n\n this.scheduleGc()\n\n this.#mutationCache.notify({\n type: 'observerRemoved',\n mutation: this,\n observer,\n })\n }\n\n protected optionalRemove() {\n if (!this.#observers.length) {\n if (this.state.status === 'pending') {\n this.scheduleGc()\n } else {\n this.#mutationCache.remove(this)\n }\n }\n }\n\n continue(): Promise<unknown> {\n return (\n this.#retryer?.continue() ??\n // continuing a mutation assumes that variables are set, mutation must have been dehydrated before\n this.execute(this.state.variables!)\n )\n }\n\n async execute(variables: TVariables): Promise<TData> {\n const onContinue = () => {\n this.#dispatch({ type: 'continue' })\n }\n\n const mutationFnContext = {\n client: this.#client,\n meta: this.options.meta,\n mutationKey: this.options.mutationKey,\n } satisfies MutationFunctionContext\n\n this.#retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject(new Error('No mutationFn found'))\n }\n\n return this.options.mutationFn(variables, mutationFnContext)\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: 'failed', failureCount, error })\n },\n onPause: () => {\n this.#dispatch({ type: 'pause' })\n },\n onContinue,\n retry: this.options.retry ?? 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode,\n canRun: () => this.#mutationCache.canRun(this),\n })\n\n const restored = this.state.status === 'pending'\n const isPaused = !this.#retryer.canStart()\n\n try {\n if (restored) {\n // Dispatch continue action to unpause restored mutation\n onContinue()\n } else {\n this.#dispatch({ type: 'pending', variables, isPaused })\n // Notify cache callback\n if (this.#mutationCache.config.onMutate) {\n await this.#mutationCache.config.onMutate(\n variables,\n this as Mutation<unknown, unknown, unknown, unknown>,\n mutationFnContext,\n )\n }\n const context = await this.options.onMutate?.(\n variables,\n mutationFnContext,\n )\n if (context !== this.state.context) {\n this.#dispatch({\n type: 'pending',\n context,\n variables,\n isPaused,\n })\n }\n }\n const data = await this.#retryer.start()\n\n // Notify cache callback\n await this.#mutationCache.config.onSuccess?.(\n data,\n variables,\n this.state.context,\n this as Mutation<unknown, unknown, unknown, unknown>,\n mutationFnContext,\n )\n\n await this.options.onSuccess?.(\n data,\n variables,\n this.state.context!,\n mutationFnContext,\n )\n\n // Notify cache callback\n await this.#mutationCache.config.onSettled?.(\n data,\n null,\n this.state.variables,\n this.state.context,\n this as Mutation<unknown, unknown, unknown, unknown>,\n mutationFnContext,\n )\n\n await this.options.onSettled?.(\n data,\n null,\n variables,\n this.state.context,\n mutationFnContext,\n )\n\n this.#dispatch({ type: 'success', data })\n return data\n } catch (error) {\n try {\n // Notify cache callback\n await this.#mutationCache.config.onError?.(\n error as any,\n variables,\n this.state.context,\n this as Mutation<unknown, unknown, unknown, unknown>,\n mutationFnContext,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n\n try {\n await this.options.onError?.(\n error as TError,\n variables,\n this.state.context,\n mutationFnContext,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n\n try {\n // Notify cache callback\n await this.#mutationCache.config.onSettled?.(\n undefined,\n error as any,\n this.state.variables,\n this.state.context,\n this as Mutation<unknown, unknown, unknown, unknown>,\n mutationFnContext,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n\n try {\n await this.options.onSettled?.(\n undefined,\n error as TError,\n variables,\n this.state.context,\n mutationFnContext,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n\n this.#dispatch({ type: 'error', error: error as TError })\n throw error\n } finally {\n this.#mutationCache.runNext(this)\n }\n }\n\n #dispatch(action: Action<TData, TError, TVariables, TOnMutateResult>): void {\n const reducer = (\n state: MutationState<TData, TError, TVariables, TOnMutateResult>,\n ): MutationState<TData, TError, TVariables, TOnMutateResult> => {\n switch (action.type) {\n case 'failed':\n return {\n ...state,\n failureCount: action.failureCount,\n failureReason: action.error,\n }\n case 'pause':\n return {\n ...state,\n isPaused: true,\n }\n case 'continue':\n return {\n ...state,\n isPaused: false,\n }\n case 'pending':\n return {\n ...state,\n context: action.context,\n data: undefined,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: action.isPaused,\n status: 'pending',\n variables: action.variables,\n submittedAt: Date.now(),\n }\n case 'success':\n return {\n ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: 'success',\n isPaused: false,\n }\n case 'error':\n return {\n ...state,\n data: undefined,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: 'error',\n }\n }\n }\n this.state = reducer(this.state)\n\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onMutationUpdate(action)\n })\n this.#mutationCache.notify({\n mutation: this,\n type: 'updated',\n action,\n })\n })\n }\n}\n\nexport function getDefaultState<\n TData,\n TError,\n TVariables,\n TOnMutateResult,\n>(): MutationState<TData, TError, TVariables, TOnMutateResult> {\n return {\n context: undefined,\n data: undefined,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: 'idle',\n variables: undefined,\n submittedAt: 0,\n }\n}\n","/* @ts-self-types=\"./index.d.ts\" */\nlet urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\nexport let customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += alphabet[(Math.random() * alphabet.length) | 0]\n }\n return id\n }\n}\nexport let nanoid = (size = 21) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += urlAlphabet[(Math.random() * 64) | 0]\n }\n return id\n}\n","'use client';\n\nimport type { FC } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n ActionBarPrimitive,\n ComposerPrimitive,\n MessagePrimitive,\n ThreadPrimitive,\n useMessage,\n} from '@assistant-ui/react';\nimport type { Components } from 'react-markdown';\nimport Markdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { useTranslation } from 'react-i18next';\nimport { cn } from '@/lib/utils';\nimport {\n SendHorizontal,\n CircleStop,\n Copy,\n Paperclip,\n Bot,\n User,\n Maximize2,\n X,\n ChevronDown,\n ChevronUp,\n LoaderCircle,\n} from 'lucide-react';\n\n// ── Markdown components for assistant messages ──────────────────────────────\n\nconst markdownComponents: Components = {\n p: ({ children }) => <p className=\"mb-2 leading-relaxed last:mb-0\">{children}</p>,\n strong: ({ children }) => <strong className=\"font-semibold\">{children}</strong>,\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n code: ({ children, className }) =>\n className ? (\n <code className={`${className} text-[11px]`}>{children}</code>\n ) : (\n <code className=\"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-xs\">\n {children}\n </code>\n ),\n pre: ({ children }) => {\n // Extract language and raw text from the nested <code> element\n const codeEl = children as React.ReactElement<{ className?: string; children?: string }>;\n const lang = codeEl?.props?.className?.replace('language-', '') ?? '';\n const rawText = typeof codeEl?.props?.children === 'string' ? codeEl.props.children : '';\n const isPreviewable = ['html', 'svg'].includes(lang) && rawText.length > 0;\n\n if (isPreviewable) {\n return <HtmlPreviewBlock code={rawText} language={lang} />;\n }\n\n return <CollapsibleCode language={lang}>{children}</CollapsibleCode>;\n },\n ul: ({ children }) => <ul className=\"mb-2 list-disc ps-4 last:mb-0\">{children}</ul>,\n ol: ({ children }) => <ol className=\"mb-2 list-decimal ps-4 last:mb-0\">{children}</ol>,\n li: ({ children }) => <li className=\"mb-0.5\">{children}</li>,\n h1: ({ children }) => <h1 className=\"mb-1 text-base font-bold\">{children}</h1>,\n h2: ({ children }) => <h2 className=\"mb-1 text-sm font-bold\">{children}</h2>,\n h3: ({ children }) => <h3 className=\"mb-1 text-sm font-semibold\">{children}</h3>,\n a: ({ children, href }) => (\n <a href={href} className=\"text-blue-500 underline\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"border-muted-foreground/30 my-1 border-s-2 ps-3 italic opacity-80\">\n {children}\n </blockquote>\n ),\n table: ({ children }) => (\n <div className=\"my-2 overflow-x-auto\">\n <table className=\"min-w-full border-collapse text-xs\">{children}</table>\n </div>\n ),\n thead: ({ children }) => <thead className=\"bg-muted/50 border-b\">{children}</thead>,\n th: ({ children }) => <th className=\"px-2 py-1 text-start font-semibold\">{children}</th>,\n td: ({ children }) => <td className=\"border-muted border-t px-2 py-1\">{children}</td>,\n tr: ({ children }) => <tr>{children}</tr>,\n hr: () => <hr className=\"border-border/40 my-3 border-t\" />,\n};\n\n// ── Thread ──────────────────────────────────────────────────────────────────\n\nexport function Thread({\n className,\n statusBar,\n composer,\n}: {\n className?: string;\n statusBar?: React.ReactNode;\n composer?: React.ReactNode;\n}) {\n return (\n <ThreadPrimitive.Root className={cn('flex h-full flex-col', className)}>\n <ThreadPrimitive.Viewport className=\"flex flex-1 flex-col overflow-y-auto pt-4\">\n <ThreadPrimitive.Empty>\n <ThreadEmpty />\n </ThreadPrimitive.Empty>\n\n <ThreadPrimitive.Messages\n components={{\n UserMessage,\n AssistantMessage,\n }}\n />\n </ThreadPrimitive.Viewport>\n\n {statusBar}\n {composer ?? <Composer />}\n </ThreadPrimitive.Root>\n );\n}\n\n// ── Empty state ─────────────────────────────────────────────────────────────\n\nfunction ThreadEmpty() {\n return (\n <div className=\"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center\">\n <Bot className=\"text-muted-foreground/40 h-10 w-10\" />\n <p className=\"text-muted-foreground text-sm\">\n Send a message to start chatting with the agent.\n </p>\n </div>\n );\n}\n\n// ── User message ────────────────────────────────────────────────────────────\n\nconst UserMessage: FC = () => {\n return (\n <MessagePrimitive.Root className=\"group flex w-full items-start gap-2.5 px-4 py-0.5\">\n {/* User avatar */}\n <div className=\"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15\">\n <User className=\"h-3.5 w-3.5 text-violet-500\" />\n </div>\n\n <div className=\"flex max-w-[85%] min-w-0 flex-col gap-0.5\">\n <div className=\"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md\">\n <MessagePrimitive.Content components={{ Text: UserMessageText }} />\n </div>\n\n <div className=\"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100\">\n <MessageMeta />\n <ActionBarPrimitive.Root className=\"flex items-center gap-1\">\n <ActionBarPrimitive.Copy asChild>\n <IconButton tooltip=\"Copy\">\n <Copy />\n </IconButton>\n </ActionBarPrimitive.Copy>\n </ActionBarPrimitive.Root>\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nfunction UserMessageText({ text }: { text: string }) {\n return <span className=\"whitespace-pre-wrap\">{text}</span>;\n}\n\n// ── Assistant message ───────────────────────────────────────────────────────\n\nconst AssistantMessage: FC = () => {\n return (\n <MessagePrimitive.Root className=\"group flex w-full items-start gap-2.5 px-4 py-0.5\">\n {/* Avatar */}\n <div className=\"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full\">\n <Bot className=\"text-muted-foreground h-3.5 w-3.5\" />\n </div>\n\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <div className=\"bg-muted/50 text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-white/5 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md\">\n <MessagePrimitive.Content components={{ Text: AssistantMessageText }} />\n </div>\n\n <div className=\"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100\">\n <MessageMeta />\n <ActionBarPrimitive.Root className=\"flex items-center gap-1\">\n <ActionBarPrimitive.Copy asChild>\n <IconButton tooltip=\"Copy\">\n <Copy />\n </IconButton>\n </ActionBarPrimitive.Copy>\n </ActionBarPrimitive.Root>\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\n// ── Collapsible code block ───────────────────────────────────────────────\n\nconst CODE_COLLAPSED_HEIGHT = 200; // px\n\nfunction CollapsibleCode({ children, language }: { children: React.ReactNode; language?: string }) {\n const { t } = useTranslation('web');\n const [expanded, setExpanded] = useState(false);\n const [needsCollapse, setNeedsCollapse] = useState(false);\n const ref = useRef<HTMLPreElement>(null);\n\n useEffect(() => {\n if (ref.current && ref.current.scrollHeight > CODE_COLLAPSED_HEIGHT + 40) {\n setNeedsCollapse(true);\n }\n }, [children]);\n\n return (\n <div className=\"bg-background/50 relative my-2 overflow-hidden rounded-md\">\n {language ? (\n <div className=\"text-muted-foreground/50 border-b border-white/5 px-3 py-1 font-mono text-[10px] uppercase\">\n {language}\n </div>\n ) : null}\n <pre\n ref={ref}\n className=\"overflow-x-auto p-3 font-mono text-xs leading-relaxed transition-[max-height] duration-300 ease-in-out\"\n style={{\n maxHeight: expanded\n ? 'min(60vh, 500px)'\n : !needsCollapse\n ? 'min(60vh, 500px)'\n : `${CODE_COLLAPSED_HEIGHT}px`,\n overflow: expanded ? 'auto' : undefined,\n }}\n >\n {children}\n </pre>\n {needsCollapse && !expanded ? (\n <div className=\"absolute inset-x-0 bottom-0 flex items-end justify-center bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-3\">\n <button\n type=\"button\"\n onClick={() => setExpanded(true)}\n className=\"inline-flex items-center gap-1 rounded-full border border-white/10 bg-white/10 px-3 py-1 text-[11px] font-medium text-white/80 shadow-lg backdrop-blur-md transition-all hover:bg-white/20 hover:text-white\"\n >\n <ChevronDown className=\"h-3 w-3\" />\n {t('chat.showMore')}\n </button>\n </div>\n ) : null}\n {needsCollapse && expanded ? (\n <div className=\"flex justify-center border-t border-white/5 py-1.5\">\n <button\n type=\"button\"\n onClick={() => setExpanded(false)}\n className=\"inline-flex items-center gap-1 rounded-full px-3 py-0.5 text-[11px] text-white/50 transition-colors hover:text-white/80\"\n >\n <ChevronUp className=\"h-3 w-3\" />\n {t('chat.showLess')}\n </button>\n </div>\n ) : null}\n </div>\n );\n}\n\n// ── HTML preview block with code/preview toggle ─────────────────────────\n\nfunction HtmlPreviewBlock({ code, language }: { code: string; language: string }) {\n const { t } = useTranslation('web');\n const [showPreview, setShowPreview] = useState(false);\n const [maximized, setMaximized] = useState(false);\n const [fullscreenCode, setFullscreenCode] = useState(false);\n const lines = code.split('\\n').length;\n const chars = code.length;\n\n return (\n <>\n <div className=\"bg-background/50 my-2 overflow-hidden rounded-md border\">\n <div className=\"flex items-center justify-between border-b px-3 py-1\">\n <span className=\"text-muted-foreground font-mono text-xs uppercase\">{language}</span>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={() => setShowPreview(false)}\n className={cn(\n 'rounded px-2.5 py-0.5 text-xs font-medium transition-colors',\n !showPreview\n ? 'bg-muted text-foreground'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {t('chat.code')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowPreview(true)}\n className={cn(\n 'rounded px-2.5 py-0.5 text-xs font-medium transition-colors',\n showPreview\n ? 'bg-muted text-foreground'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {t('chat.preview')}\n </button>\n <button\n type=\"button\"\n onClick={() => {\n setFullscreenCode(!showPreview);\n setMaximized(true);\n }}\n className=\"text-muted-foreground hover:text-foreground ms-1 rounded p-0.5 transition-colors\"\n title={t('chat.openFullscreen')}\n >\n <Maximize2 className=\"h-3 w-3\" />\n </button>\n </div>\n </div>\n <div style={{ height: 'min(55vh, 450px)' }}>\n {showPreview ? (\n <iframe\n srcDoc={code}\n sandbox=\"allow-scripts\"\n className=\"h-full w-full border-0 bg-white\"\n title={t('chat.htmlPreview')}\n />\n ) : (\n <pre className=\"h-full overflow-auto p-3 font-mono text-xs leading-relaxed\">\n <code>{code}</code>\n </pre>\n )}\n </div>\n </div>\n\n {/* Fullscreen modal — fake browser chrome, portaled to body */}\n {maximized && typeof document !== 'undefined'\n ? createPortal(\n <div\n className=\"fixed inset-0 z-[9999] flex items-center justify-center bg-black/70 backdrop-blur-sm\"\n onClick={() => setMaximized(false)}\n >\n <div\n className=\"bg-background relative flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-xl border shadow-2xl\"\n onClick={(e) => e.stopPropagation()}\n >\n {/* Toolbar */}\n <div className=\"bg-muted/80 flex h-12 shrink-0 items-center justify-between border-b px-5\">\n {/* Left — tabs */}\n <div className=\"bg-muted flex items-center gap-0.5 rounded-lg p-1\">\n <button\n type=\"button\"\n onClick={() => setFullscreenCode(false)}\n className={cn(\n 'rounded-md px-4 py-1.5 text-sm font-medium transition-all',\n !fullscreenCode\n ? 'bg-background text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {t('chat.preview')}\n </button>\n <button\n type=\"button\"\n onClick={() => setFullscreenCode(true)}\n className={cn(\n 'rounded-md px-4 py-1.5 text-sm font-medium transition-all',\n fullscreenCode\n ? 'bg-background text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {t('chat.code')}\n </button>\n </div>\n\n {/* Center — stats */}\n <div className=\"text-muted-foreground/60 flex items-center gap-4 text-xs\">\n <span>{lines} lines</span>\n <span>{chars.toLocaleString()} chars</span>\n <span className=\"font-mono uppercase\">{language}</span>\n </div>\n\n {/* Right — close */}\n <button\n type=\"button\"\n onClick={() => setMaximized(false)}\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground rounded-lg p-2 transition-colors\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n {/* Content */}\n {fullscreenCode ? (\n <pre className=\"flex-1 overflow-auto p-4 font-mono text-xs leading-relaxed\">\n <code>{code}</code>\n </pre>\n ) : (\n <iframe\n srcDoc={code}\n sandbox=\"allow-scripts\"\n className=\"flex-1 border-0 bg-white dark:bg-neutral-900\"\n title={t('chat.htmlPreviewFullscreen')}\n />\n )}\n </div>\n </div>,\n document.body\n )\n : null}\n </>\n );\n}\n\nconst ACTIVITY_MARKER_RE = /^\\*⏳ (.+)\\*$/;\n\nfunction AssistantMessageText({ text }: { text: string }) {\n if (text === '*Thinking...*' || text === '*Agent is waking up...*') {\n return <ThinkingIndicator booting={text.includes('waking')} />;\n }\n\n // Live activity indicator (e.g. \"Using tool: Bash\", \"Running: Read\")\n const activityMatch = ACTIVITY_MARKER_RE.exec(text);\n if (activityMatch) {\n return <ActivityIndicator label={activityMatch[1]} />;\n }\n\n return (\n <Markdown remarkPlugins={[remarkGfm]} components={markdownComponents}>\n {text}\n </Markdown>\n );\n}\n\nfunction ActivityIndicator({ label }: { label: string }) {\n return (\n <span className=\"text-muted-foreground inline-flex items-center gap-2 text-sm italic\">\n <LoaderCircle className=\"h-3.5 w-3.5 animate-spin\" />\n <span>{label}</span>\n </span>\n );\n}\n\n// ── Thinking indicator with cycling words ────────────────────────────────\n\nconst THINKING_WORDS = [\n 'Thinking',\n 'Reasoning',\n 'Analyzing',\n 'Processing',\n 'Evaluating',\n 'Considering',\n 'Reflecting',\n 'Pondering',\n];\n\nconst BOOTING_WORDS = ['Waking up', 'Initializing', 'Loading tools', 'Preparing', 'Connecting'];\n\nimport { useEffect, useRef, useState } from 'react';\n\nfunction ThinkingIndicator({ booting }: { booting: boolean }) {\n const words = booting ? BOOTING_WORDS : THINKING_WORDS;\n const [index, setIndex] = useState(0);\n const [fade, setFade] = useState(true);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setFade(false);\n setTimeout(() => {\n setIndex((i) => (i + 1) % words.length);\n setFade(true);\n }, 200);\n }, 2000);\n return () => clearInterval(interval);\n }, [words]);\n\n return (\n <span className=\"text-muted-foreground inline-flex w-32 items-center gap-1.5 text-sm italic\">\n <span\n className=\"inline-block transition-all duration-300 ease-in-out\"\n style={{ opacity: fade ? 1 : 0, transform: fade ? 'translateY(0)' : 'translateY(-4px)' }}\n >\n {words[index]}\n </span>\n <span className=\"inline-flex gap-0.5\">\n <span\n className=\"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full\"\n style={{ animationDelay: '0ms' }}\n />\n <span\n className=\"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full\"\n style={{ animationDelay: '150ms' }}\n />\n <span\n className=\"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full\"\n style={{ animationDelay: '300ms' }}\n />\n </span>\n </span>\n );\n}\n\n// ── Message metadata (timestamp + relative time) ────────────────────────────\n\nfunction MessageMeta() {\n const message = useMessage();\n // Tick every 30s so relative timestamps stay fresh\n const [tick, setTick] = useState(0);\n useEffect(() => {\n const id = setInterval(() => setTick((t) => t + 1), 30_000);\n return () => clearInterval(id);\n }, []);\n\n const meta = useMemo(() => {\n if (!message?.createdAt) return null;\n const date = new Date(message.createdAt as unknown as string);\n if (isNaN(date.getTime())) return null;\n return {\n time: date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }),\n relative: formatRelativeTime(date),\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [message?.createdAt, tick]);\n\n if (!meta) return null;\n\n return (\n <span className=\"text-muted-foreground/60 text-[10px]\" title={meta.time}>\n {meta.relative}\n </span>\n );\n}\n\nfunction formatRelativeTime(date: Date): string {\n const diff = Date.now() - date.getTime();\n if (diff < 0 || diff < 5000) return 'just now';\n const seconds = Math.floor(diff / 1000);\n if (seconds < 60) return `${seconds}s ago`;\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n return date.toLocaleDateString();\n}\n\n// ── Icon button helper ──────────────────────────────────────────────────────\n\nimport { forwardRef, useMemo } from 'react';\nimport type { ButtonHTMLAttributes } from 'react';\n\nconst IconButton = forwardRef<\n HTMLButtonElement,\n ButtonHTMLAttributes<HTMLButtonElement> & { tooltip: string }\n>(({ tooltip, children, className, ...props }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n title={tooltip}\n className={cn(\n 'text-muted-foreground hover:text-foreground hover:bg-muted inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors',\n '[&>svg]:h-3.5 [&>svg]:w-3.5',\n className\n )}\n {...props}\n >\n {children}\n </button>\n));\nIconButton.displayName = 'IconButton';\n\n// ── Composer ────────────────────────────────────────────────────────────────\n\nfunction Composer() {\n return (\n <ComposerPrimitive.Root className=\"flex items-end gap-2 border-t p-3\">\n <ComposerPrimitive.AddAttachment asChild>\n <IconButton tooltip=\"Attach file\" className=\"mb-0.5\">\n <Paperclip />\n </IconButton>\n </ComposerPrimitive.AddAttachment>\n\n <ComposerPrimitive.Input\n rows={1}\n autoFocus\n placeholder=\"Write a message...\"\n className={cn(\n 'bg-muted min-h-[40px] flex-1 resize-none rounded-xl border-0 px-4 py-2.5 text-sm',\n 'focus:ring-ring/30 focus:ring-2 focus:outline-none',\n 'placeholder:text-muted-foreground/60',\n 'max-h-40 overflow-y-auto'\n )}\n />\n <ComposerAction />\n </ComposerPrimitive.Root>\n );\n}\n\nfunction ComposerAction() {\n return (\n <>\n <ThreadPrimitive.If running={false}>\n <ComposerPrimitive.Send\n className={cn(\n 'bg-primary text-primary-foreground inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl',\n 'hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30',\n 'transition-colors'\n )}\n >\n <SendHorizontal className=\"size-4\" />\n </ComposerPrimitive.Send>\n </ThreadPrimitive.If>\n <ThreadPrimitive.If running>\n <ComposerPrimitive.Cancel\n className={cn(\n 'bg-destructive/10 text-destructive inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl',\n 'hover:bg-destructive/20',\n 'transition-colors'\n )}\n >\n <CircleStop className=\"size-4\" />\n </ComposerPrimitive.Cancel>\n </ThreadPrimitive.If>\n </>\n );\n}\n","'use client';\n\nimport { useCallback, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { AssistantRuntimeProvider } from '@assistant-ui/react';\nimport { Trash2, Cpu } from 'lucide-react';\nimport { cn } from '@/lib/utils';\nimport { Thread } from '@/components/assistant-ui/thread';\nimport { useAttachments } from '@/hooks/use-attachments';\nimport { composeUserInput } from '@/app/actions/compose-user-input';\nimport { AgentModelPicker } from '@/components/features/settings/AgentModelPicker';\nimport { useChatRuntime } from './useChatRuntime';\nimport { ChatComposer } from './ChatComposer';\n\nexport interface ChatTabProps {\n featureId: string;\n worktreePath?: string;\n}\n\nconst IS_DEV = process.env.NODE_ENV === 'development';\n\nexport function ChatTab({ featureId, worktreePath }: ChatTabProps) {\n const [overrideAgent, setOverrideAgent] = useState<string | undefined>(undefined);\n const [overrideModel, setOverrideModel] = useState<string | undefined>(undefined);\n const [debugMode, setDebugMode] = useState(false);\n const att = useAttachments();\n\n const contentTransform = useCallback(\n (content: string) =>\n composeUserInput(\n content,\n att.completedAttachments.map((a) => ({ path: a.path, name: a.name, notes: a.notes }))\n ),\n [att.completedAttachments]\n );\n\n const { runtime, status, clearChat, sessionInfo, isChatLoading } = useChatRuntime(\n featureId,\n worktreePath,\n {\n contentTransform,\n onMessageSent: att.clearAttachments,\n model: overrideModel,\n agentType: overrideAgent,\n debugMode,\n }\n );\n\n const handlePickFiles = useCallback(async () => {\n try {\n const res = await fetch('/api/dialog/pick-files');\n if (!res.ok) return;\n const data = (await res.json()) as { paths?: string[] };\n if (!data.paths?.length) return;\n for (const filePath of data.paths) {\n const uploadRes = await fetch('/api/attachments/upload-from-path', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ path: filePath, sessionId: `chat-${featureId}` }),\n });\n if (!uploadRes.ok) continue;\n const uploaded = (await uploadRes.json()) as {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n path: string;\n };\n att.addAttachment(uploaded);\n }\n } catch {\n // Native picker not available — ignore\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- att.addAttachment is a stable callback from useAttachments\n }, [featureId, att.addAttachment]);\n\n const composer = (\n <ChatComposer\n attachments={att.attachments}\n isDragOver={att.isDragOver}\n uploadError={att.uploadError}\n onDragEnter={att.handleDragEnter}\n onDragLeave={att.handleDragLeave}\n onDragOver={att.handleDragOver}\n onDrop={att.handleDrop}\n onPaste={att.handlePaste}\n onRemoveAttachment={att.removeAttachment}\n onNotesChange={att.updateNotes}\n onPickFiles={handlePickFiles}\n agentPicker={\n <AgentModelPicker\n initialAgentType={overrideAgent ?? 'claude-code'}\n initialModel={overrideModel ?? 'claude-sonnet-4-6'}\n mode=\"override\"\n onAgentModelChange={(agent, model) => {\n setOverrideAgent(agent);\n setOverrideModel(model);\n }}\n className=\"w-55\"\n />\n }\n />\n );\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {/* Header bar — session info + stop/clear */}\n <ChatHeader\n sessionInfo={sessionInfo}\n isAgentActive={status.isRunning}\n onClear={clearChat}\n debugMode={debugMode}\n onDebugToggle={IS_DEV ? setDebugMode : undefined}\n />\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {isChatLoading ? (\n <ChatSkeleton />\n ) : (\n <AssistantRuntimeProvider runtime={runtime}>\n <Thread composer={composer} />\n </AssistantRuntimeProvider>\n )}\n </div>\n </div>\n );\n}\n\n// ── Loading skeleton ────────────────────────────────────────────────────────\n\nfunction ChatSkeleton() {\n return (\n <div className=\"flex flex-1 flex-col gap-3 p-4 pt-6\">\n {/* Assistant message skeleton */}\n <div className=\"flex items-start gap-2.5\">\n <div className=\"bg-muted h-6 w-6 animate-pulse rounded-full\" />\n <div className=\"flex flex-col gap-1.5\">\n <div className=\"bg-muted h-4 w-48 animate-pulse rounded-lg\" />\n <div className=\"bg-muted h-4 w-72 animate-pulse rounded-lg\" />\n <div className=\"bg-muted h-4 w-36 animate-pulse rounded-lg\" />\n </div>\n </div>\n {/* User message skeleton */}\n <div className=\"flex items-start gap-2.5\">\n <div className=\"bg-muted h-6 w-6 animate-pulse rounded-full\" />\n <div className=\"bg-muted h-4 w-32 animate-pulse rounded-lg\" />\n </div>\n {/* Assistant message skeleton */}\n <div className=\"flex items-start gap-2.5\">\n <div className=\"bg-muted h-6 w-6 animate-pulse rounded-full\" />\n <div className=\"flex flex-col gap-1.5\">\n <div className=\"bg-muted h-4 w-56 animate-pulse rounded-lg\" />\n <div className=\"bg-muted h-4 w-64 animate-pulse rounded-lg\" />\n </div>\n </div>\n </div>\n );\n}\n\n// ── Session info types ──────────────────────────────────────────────────────\n\ninterface SessionInfo {\n pid: number | null;\n sessionId: string | null;\n model: string | null;\n startedAt: string;\n idleTimeoutMinutes: number;\n lastActivityAt: string;\n}\n\n// ── Chat header — compact session info + actions ─────────────────────────────\n\nfunction ChatHeader({\n sessionInfo,\n isAgentActive,\n onClear,\n debugMode,\n onDebugToggle,\n}: {\n sessionInfo: SessionInfo | null;\n isAgentActive: boolean;\n onClear: () => Promise<void>;\n debugMode: boolean;\n onDebugToggle?: (enabled: boolean) => void;\n}) {\n const { t } = useTranslation('web');\n return (\n <div className=\"flex h-8 shrink-0 items-center border-b px-3\">\n {/* Left — session info + activity */}\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n {sessionInfo ? (\n <>\n {isAgentActive ? (\n <span className=\"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500\" />\n ) : (\n <Cpu className=\"text-muted-foreground/40 h-3 w-3 shrink-0\" />\n )}\n <span className=\"text-muted-foreground font-mono text-[10px]\">\n {sessionInfo.model ?? 'agent'}\n {sessionInfo.sessionId ? ` · ${sessionInfo.sessionId.slice(0, 8)}` : ''}\n </span>\n </>\n ) : (\n <span className=\"text-muted-foreground/40 text-[11px]\">{t('chat.noSession')}</span>\n )}\n </div>\n\n {/* Right — actions */}\n <div className=\"flex items-center gap-1 ps-2\">\n {onDebugToggle ? (\n <label className=\"text-muted-foreground/60 flex cursor-pointer items-center gap-1 text-[10px]\">\n <input\n type=\"checkbox\"\n checked={debugMode}\n onChange={(e) => onDebugToggle(e.target.checked)}\n className=\"h-3 w-3 cursor-pointer rounded\"\n />\n Debug\n </label>\n ) : null}\n <ToolbarButton\n onClick={() => {\n void onClear();\n }}\n title={t('chat.clearChatHistory')}\n >\n <Trash2 className=\"h-2.5 w-2.5\" />\n <span>{t('chat.clear')}</span>\n </ToolbarButton>\n </div>\n </div>\n );\n}\n\n// ── Toolbar button ──────────────────────────────────────────────────────────\n\nfunction ToolbarButton({\n children,\n onClick,\n title,\n variant,\n}: {\n children: React.ReactNode;\n onClick: () => void;\n title: string;\n variant?: 'danger';\n}) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n title={title}\n className={cn(\n 'inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors',\n variant === 'danger'\n ? 'text-destructive hover:bg-destructive/10'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted'\n )}\n >\n {children}\n </button>\n );\n}\n","// src/mutationObserver.ts\nimport { getDefaultState } from \"./mutation.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { hashKey, shallowEqualObjects } from \"./utils.js\";\nvar MutationObserver = class extends Subscribable {\n #client;\n #currentResult = void 0;\n #currentMutation;\n #mutateOptions;\n constructor(client, options) {\n super();\n this.#client = client;\n this.setOptions(options);\n this.bindMethods();\n this.#updateResult();\n }\n bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n this.options = this.#client.defaultMutationOptions(options);\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: \"observerOptionsUpdated\",\n mutation: this.#currentMutation,\n observer: this\n });\n }\n if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {\n this.reset();\n } else if (this.#currentMutation?.state.status === \"pending\") {\n this.#currentMutation.setOptions(this.options);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this);\n }\n }\n onMutationUpdate(action) {\n this.#updateResult();\n this.#notify(action);\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n reset() {\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = void 0;\n this.#updateResult();\n this.#notify();\n }\n mutate(variables, options) {\n this.#mutateOptions = options;\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n this.#currentMutation.addObserver(this);\n return this.#currentMutation.execute(variables);\n }\n #updateResult() {\n const state = this.#currentMutation?.state ?? getDefaultState();\n this.#currentResult = {\n ...state,\n isPending: state.status === \"pending\",\n isSuccess: state.status === \"success\",\n isError: state.status === \"error\",\n isIdle: state.status === \"idle\",\n mutate: this.mutate,\n reset: this.reset\n };\n }\n #notify(action) {\n notifyManager.batch(() => {\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables;\n const onMutateResult = this.#currentResult.context;\n const context = {\n client: this.#client,\n meta: this.options.meta,\n mutationKey: this.options.mutationKey\n };\n if (action?.type === \"success\") {\n try {\n this.#mutateOptions.onSuccess?.(\n action.data,\n variables,\n onMutateResult,\n context\n );\n } catch (e) {\n void Promise.reject(e);\n }\n try {\n this.#mutateOptions.onSettled?.(\n action.data,\n null,\n variables,\n onMutateResult,\n context\n );\n } catch (e) {\n void Promise.reject(e);\n }\n } else if (action?.type === \"error\") {\n try {\n this.#mutateOptions.onError?.(\n action.error,\n variables,\n onMutateResult,\n context\n );\n } catch (e) {\n void Promise.reject(e);\n }\n try {\n this.#mutateOptions.onSettled?.(\n void 0,\n action.error,\n variables,\n onMutateResult,\n context\n );\n } catch (e) {\n void Promise.reject(e);\n }\n }\n }\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n });\n }\n};\nexport {\n MutationObserver\n};\n//# sourceMappingURL=mutationObserver.js.map","\"use client\";\n\n// src/useMutation.ts\nimport * as React from \"react\";\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError\n} from \"@tanstack/query-core\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nfunction useMutation(options, queryClient) {\n const client = useQueryClient(queryClient);\n const [observer] = React.useState(\n () => new MutationObserver(\n client,\n options\n )\n );\n React.useEffect(() => {\n observer.setOptions(options);\n }, [observer, options]);\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer]\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult()\n );\n const mutate = React.useCallback(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop);\n },\n [observer]\n );\n if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {\n throw result.error;\n }\n return { ...result, mutate, mutateAsync: result.mutate };\n}\nexport {\n useMutation\n};\n//# sourceMappingURL=useMutation.js.map","'use client';\n\nimport { useState, useEffect, useRef, useCallback, useMemo } from 'react';\nimport type { ThreadMessageLike, AppendMessage } from '@assistant-ui/react';\nimport { useExternalStoreRuntime } from '@assistant-ui/react';\nimport { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport type { InteractiveMessage } from '@shipit-ai/core/domain/generated/output';\nimport { InteractiveMessageRole } from '@shipit-ai/core/domain/generated/output';\n\n/** Chat state returned by the backend — matches ChatState from service interface */\ninterface ChatState {\n messages: InteractiveMessage[];\n sessionStatus: string | null;\n streamingText: string | null;\n sessionInfo: SessionInfo | null;\n turnStatus?: string;\n}\n\ninterface SessionInfo {\n pid: number | null;\n sessionId: string | null;\n model: string | null;\n startedAt: string;\n idleTimeoutMinutes: number;\n lastActivityAt: string;\n totalCostUsd: number | null;\n totalInputTokens: number | null;\n totalOutputTokens: number | null;\n}\n\n// ── API helpers ─────────────────────────────────────────────────────────────\n\nasync function fetchChatState(featureId: string): Promise<ChatState> {\n const res = await fetch(`/api/interactive/chat/${featureId}/messages`);\n if (!res.ok) {\n // eslint-disable-next-line no-console\n console.error(`[ChatState] fetch failed: ${res.status}`, await res.text().catch(() => ''));\n throw new Error(`Failed to fetch chat state: ${res.status}`);\n }\n return res.json() as Promise<ChatState>;\n}\n\nasync function postMessage(\n featureId: string,\n content: string,\n worktreePath: string,\n model?: string,\n agentType?: string\n): Promise<InteractiveMessage> {\n const res = await fetch(`/api/interactive/chat/${featureId}/messages`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ content, worktreePath, model, agentType }),\n });\n if (!res.ok) throw new Error(`Failed to send message: ${res.status}`);\n const data = (await res.json()) as { message: InteractiveMessage };\n return data.message;\n}\n\n// ── Convert domain message to assistant-ui format ───────────────────────────\n\nfunction toThreadMessage(msg: InteractiveMessage): ThreadMessageLike {\n return {\n id: msg.id,\n role: msg.role === InteractiveMessageRole.user ? 'user' : 'assistant',\n content: [{ type: 'text', text: msg.content }],\n createdAt: msg.createdAt ? new Date(msg.createdAt as unknown as string) : undefined,\n };\n}\n\n// ── Query key ───────────────────────────────────────────────────────────────\n\nfunction chatQueryKey(featureId: string) {\n return ['chat-messages', featureId] as const;\n}\n\n// ── Status info for the typing indicator ────────────────────────────────────\n\nexport interface ChatStatus {\n /** Whether the agent is actively working (booting, thinking, streaming). */\n isRunning: boolean;\n /** Human-readable status text (e.g. \"Agent is waking up...\", \"Using tool: Read\"). */\n statusText: string | null;\n}\n\n// ── Hook ────────────────────────────────────────────────────────────────────\n\nexport interface ChatRuntimeOptions {\n /** Transform message content before sending (e.g. append attachment refs). */\n contentTransform?: (content: string) => string;\n /** Called after a message is successfully sent (e.g. clear attachments). */\n onMessageSent?: () => void;\n /** Override model for new sessions (e.g. 'claude-sonnet-4-6'). */\n model?: string;\n /** Override agent type for new sessions (e.g. 'claude-code'). */\n agentType?: string;\n /** When true, inject debug bubbles showing SSE events, session info, etc. */\n debugMode?: boolean;\n}\n\n/** A debug event captured from SSE for display in debug mode. */\nexport interface DebugEvent {\n id: string;\n timestamp: Date;\n label: string;\n detail?: string;\n}\n\n/**\n * `featureId` is a polymorphic scope key: a feature UUID, \"repo-<id>\", or \"global\".\n * All API calls and SSE subscriptions are scoped to this key.\n */\nexport function useChatRuntime(\n featureId: string,\n worktreePath?: string,\n options?: ChatRuntimeOptions\n) {\n const queryClient = useQueryClient();\n\n // Keep a ref to the latest model/agent so the mutation closure always\n // reads the current value without depending on stale captures.\n const modelRef = useRef(options?.model);\n const agentTypeRef = useRef(options?.agentType);\n modelRef.current = options?.model;\n agentTypeRef.current = options?.agentType;\n\n // ── Debug events (dev mode only) ────────────────────────────────────────\n const debugModeRef = useRef(options?.debugMode ?? false);\n debugModeRef.current = options?.debugMode ?? false;\n const [debugEvents, setDebugEvents] = useState<DebugEvent[]>([]);\n\n const pushDebug = useCallback((label: string, detail?: string) => {\n if (!debugModeRef.current) return;\n setDebugEvents((prev) => [\n ...prev,\n { id: `dbg-${Date.now()}-${Math.random()}`, timestamp: new Date(), label, detail },\n ]);\n }, []);\n\n // ── TanStack Query: fetch messages from backend ─────────────────────────\n const { data: chatState, isLoading: isChatLoading } = useQuery({\n queryKey: chatQueryKey(featureId),\n queryFn: () => fetchChatState(featureId),\n refetchInterval: 3000, // Fallback polling every 3s\n });\n\n // Auto-mark as read when chat tab is open and turn status is 'unread'\n useEffect(() => {\n if (chatState?.turnStatus === 'unread') {\n void fetch(`/api/interactive/chat/${featureId}/mark-read`, { method: 'POST' });\n }\n }, [chatState?.turnStatus, featureId]);\n\n const messages = useMemo(() => chatState?.messages ?? [], [chatState?.messages]);\n const sessionStatus = chatState?.sessionStatus ?? null;\n\n // Track session status changes for debug\n const prevSessionStatusRef = useRef<string | null>(null);\n useEffect(() => {\n if (sessionStatus && sessionStatus !== prevSessionStatusRef.current) {\n const info = chatState?.sessionInfo;\n const detail = info\n ? `model=${info.model ?? '?'}, sid=${info.sessionId?.slice(0, 8) ?? '?'}`\n : undefined;\n pushDebug(`session_${sessionStatus}`, detail);\n }\n prevSessionStatusRef.current = sessionStatus;\n }, [sessionStatus, chatState?.sessionInfo, pushDebug]);\n const backendStreamingText = chatState?.streamingText ?? null;\n\n // Cache last known sessionInfo so PID stays visible after process exits\n const lastSessionInfoRef = useRef<ChatState['sessionInfo']>(null);\n if (chatState?.sessionInfo) {\n lastSessionInfoRef.current = chatState.sessionInfo;\n }\n const sessionInfo = chatState?.sessionInfo ?? lastSessionInfoRef.current;\n\n // ── SSE: real-time streaming deltas ─────────────────────────────────────\n\n const [streamingText, setStreamingText] = useState('');\n const [statusLog, setStatusLog] = useState<string | null>(null);\n const [awaitingResponse, setAwaitingResponse] = useState(false);\n const awaitingTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const eventSourceRef = useRef<EventSource | null>(null);\n\n // Delayed awaiting — only show Thinking bubble after 600ms to avoid flash\n const startAwaiting = useCallback(() => {\n if (awaitingTimerRef.current) clearTimeout(awaitingTimerRef.current);\n awaitingTimerRef.current = setTimeout(() => setAwaitingResponse(true), 600);\n }, []);\n const cancelAwaiting = useCallback(() => {\n if (awaitingTimerRef.current) {\n clearTimeout(awaitingTimerRef.current);\n awaitingTimerRef.current = null;\n }\n setAwaitingResponse(false);\n }, []);\n\n // Clear awaitingResponse when backend delivers a new assistant message\n const lastMsgRole = messages.length > 0 ? messages[messages.length - 1].role : null;\n useEffect(() => {\n if (lastMsgRole === InteractiveMessageRole.assistant) {\n cancelAwaiting();\n }\n }, [lastMsgRole, messages.length, cancelAwaiting]);\n\n useEffect(() => {\n const es = new EventSource(`/api/interactive/chat/${featureId}/stream`);\n eventSourceRef.current = es;\n\n es.addEventListener('delta', (event: MessageEvent) => {\n try {\n const data = JSON.parse(event.data as string) as { delta: string };\n if (data.delta) {\n cancelAwaiting();\n setStreamingText((prev) => prev + data.delta);\n setStatusLog(null);\n }\n } catch {\n // Ignore\n }\n });\n\n es.addEventListener('activity', (event: MessageEvent) => {\n cancelAwaiting();\n try {\n const data = JSON.parse(event.data as string) as {\n activity?: { kind: string; label: string; detail?: string };\n };\n if (data.activity) {\n pushDebug(`[${data.activity.kind}] ${data.activity.label}`, data.activity.detail);\n }\n } catch {\n // Ignore\n }\n // Tool events are already persisted to DB — just refetch to show them\n void queryClient.invalidateQueries({ queryKey: chatQueryKey(featureId) });\n });\n\n es.addEventListener('log', (event: MessageEvent) => {\n try {\n const data = JSON.parse(event.data as string) as { log: string };\n if (data.log) {\n cancelAwaiting();\n setStatusLog(data.log);\n pushDebug('log', data.log);\n }\n } catch {\n // Ignore\n }\n });\n\n es.addEventListener('done', () => {\n setStatusLog(null);\n cancelAwaiting();\n pushDebug('turn_done');\n // Refetch first, THEN clear local streaming state so there's no gap\n void queryClient.invalidateQueries({ queryKey: chatQueryKey(featureId) }).then(() => {\n setStreamingText('');\n });\n });\n\n es.onerror = () => {\n // SSE dropped — the 3s polling handles reliability\n };\n\n return () => {\n es.close();\n eventSourceRef.current = null;\n };\n }, [featureId, queryClient, cancelAwaiting, pushDebug]);\n\n // ── Mutation: send user message ─────────────────────────────────────────\n const sendMutation = useMutation({\n mutationFn: (content: string) =>\n postMessage(featureId, content, worktreePath ?? '', modelRef.current, agentTypeRef.current),\n onMutate: async (content: string) => {\n pushDebug(\n 'send_message',\n `model=${modelRef.current ?? 'default'}, agent=${agentTypeRef.current ?? 'default'}, len=${content.length}`\n );\n startAwaiting();\n // Cancel in-flight refetches so our optimistic update isn't overwritten\n await queryClient.cancelQueries({ queryKey: chatQueryKey(featureId) });\n\n const previous = queryClient.getQueryData<ChatState>(chatQueryKey(featureId));\n\n // Optimistically add user message\n queryClient.setQueryData<ChatState>(chatQueryKey(featureId), (old) => ({\n messages: [\n ...(old?.messages ?? []),\n {\n id: `optimistic-${Date.now()}`,\n featureId,\n role: InteractiveMessageRole.user,\n content,\n createdAt: new Date(),\n updatedAt: new Date(),\n },\n ],\n sessionStatus: old?.sessionStatus ?? 'booting',\n streamingText: null,\n sessionInfo: old?.sessionInfo ?? null,\n }));\n\n return { previous };\n },\n onError: (_err, _content, context) => {\n // Rollback on error\n if (context?.previous) {\n queryClient.setQueryData(chatQueryKey(featureId), context.previous);\n }\n },\n onSettled: () => {\n // Refetch to reconcile optimistic data with server\n void queryClient.invalidateQueries({ queryKey: chatQueryKey(featureId) });\n },\n });\n\n // ── Derive running state ────────────────────────────────────────────────\n // Note: sendMutation.isPending is excluded — the 600ms awaitingResponse\n // timer provides a smooth transition without flicker.\n const isRunning =\n awaitingResponse || !!streamingText || !!statusLog || sessionStatus === 'booting';\n\n // ── Build thread messages for assistant-ui ─────────────────────────────\n const activeStreamText = streamingText ?? backendStreamingText ?? '';\n\n const threadMessages: ThreadMessageLike[] = useMemo(() => {\n const chatMessages: ThreadMessageLike[] = messages.map(toThreadMessage);\n\n // Merge debug bubbles into the timeline by timestamp\n let result: ThreadMessageLike[];\n if (options?.debugMode && debugEvents.length > 0) {\n const debugMessages: ThreadMessageLike[] = debugEvents.map((evt) => ({\n id: evt.id,\n role: 'assistant' as const,\n content: [\n {\n type: 'text' as const,\n text: evt.detail ? `🔧 **${evt.label}** — ${evt.detail}` : `🔧 **${evt.label}**`,\n },\n ],\n createdAt: evt.timestamp,\n }));\n // Merge both arrays (both already sorted by time) into one sorted list\n result = [];\n let ci = 0;\n let di = 0;\n while (ci < chatMessages.length && di < debugMessages.length) {\n const chatTime = chatMessages[ci].createdAt\n ? new Date(chatMessages[ci].createdAt as unknown as string).getTime()\n : 0;\n const dbgTime = debugMessages[di].createdAt\n ? new Date(debugMessages[di].createdAt as unknown as string).getTime()\n : 0;\n if (chatTime <= dbgTime) {\n result.push(chatMessages[ci++]);\n } else {\n result.push(debugMessages[di++]);\n }\n }\n while (ci < chatMessages.length) result.push(chatMessages[ci++]);\n while (di < debugMessages.length) result.push(debugMessages[di++]);\n } else {\n result = chatMessages;\n }\n\n // Streaming text as the last message — may include a live activity suffix\n if (activeStreamText.trim()) {\n const parts: { type: 'text'; text: string }[] = [{ type: 'text', text: activeStreamText }];\n // Append live activity indicator when agent is doing tool work\n if (statusLog) {\n parts.push({ type: 'text', text: `*⏳ ${statusLog}*` });\n }\n result.push({ id: 'streaming', role: 'assistant', content: parts });\n } else if (statusLog) {\n // No streaming text yet but agent is actively working (tool calls, etc.)\n result.push({\n id: 'streaming',\n role: 'assistant',\n content: [{ type: 'text', text: `*⏳ ${statusLog}*` }],\n });\n } else if (awaitingResponse || sessionStatus === 'booting') {\n // Note: sendMutation.isPending is NOT included here — the 600ms\n // delay via startAwaiting() prevents flash on fast responses.\n result.push({\n id: 'streaming',\n role: 'assistant',\n content: [\n {\n type: 'text',\n text: sessionStatus === 'booting' ? '*Agent is waking up...*' : '*Thinking...*',\n },\n ],\n });\n }\n\n return result;\n }, [\n messages,\n activeStreamText,\n awaitingResponse,\n sessionStatus,\n statusLog,\n options?.debugMode,\n debugEvents,\n ]);\n\n // ── Status info for typing indicator ──────────────────────────────────\n const status: ChatStatus = useMemo(() => {\n if (!isRunning) return { isRunning: false, statusText: null };\n return { isRunning: true, statusText: statusLog };\n }, [isRunning, statusLog]);\n\n // ── onNew: called by assistant-ui when user submits ─────────────────────\n const onNew = useCallback(\n async (message: AppendMessage) => {\n const textPart = message.content.find((c) => c.type === 'text');\n if (textPart?.type !== 'text' || !textPart.text.trim()) return;\n const content = options?.contentTransform\n ? options.contentTransform(textPart.text)\n : textPart.text;\n sendMutation.mutate(content, {\n onSuccess: () => options?.onMessageSent?.(),\n });\n },\n [sendMutation, options]\n );\n\n // ── Clear chat ─────────────────────────────────────────────────────────\n const clearChat = useCallback(async () => {\n const res = await fetch(`/api/interactive/chat/${featureId}/messages`, { method: 'DELETE' });\n if (!res.ok) throw new Error(`Failed to clear chat: ${res.status}`);\n setStreamingText('');\n setDebugEvents([]);\n setStatusLog(null);\n cancelAwaiting();\n void queryClient.invalidateQueries({ queryKey: chatQueryKey(featureId) });\n }, [featureId, queryClient, cancelAwaiting]);\n\n // ── Stop agent ────────────────────────────────────────────────────────\n const stopAgent = useCallback(async () => {\n const res = await fetch(`/api/interactive/chat/${featureId}/stop`, { method: 'POST' });\n if (!res.ok) throw new Error(`Failed to stop agent: ${res.status}`);\n setStreamingText('');\n\n setStatusLog(null);\n cancelAwaiting();\n void queryClient.invalidateQueries({ queryKey: chatQueryKey(featureId) });\n }, [featureId, queryClient, cancelAwaiting]);\n\n // ── Build assistant-ui runtime ──────────────────────────────────────────\n const runtime = useExternalStoreRuntime({\n messages: threadMessages,\n convertMessage: useCallback((msg: ThreadMessageLike): ThreadMessageLike => msg, []),\n isRunning,\n onNew,\n onCancel: useCallback(async () => {\n setStreamingText('');\n\n setStatusLog(null);\n cancelAwaiting();\n }, [cancelAwaiting]),\n });\n\n return { runtime, status, clearChat, stopAgent, sessionInfo, isChatLoading };\n}\n","'use client';\n\nimport { useState, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { ComposerPrimitive, ThreadPrimitive } from '@assistant-ui/react';\nimport { SendHorizontal, CircleStop, Paperclip } from 'lucide-react';\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\nimport { AttachmentChip } from '@/components/common/attachment-chip';\nimport type { FormAttachment } from '@/hooks/use-attachments';\n\nexport interface ChatComposerProps {\n attachments: FormAttachment[];\n isDragOver: boolean;\n uploadError: string | null;\n onDragEnter: (e: React.DragEvent) => void;\n onDragLeave: (e: React.DragEvent) => void;\n onDragOver: (e: React.DragEvent) => void;\n onDrop: (e: React.DragEvent) => void;\n onPaste: (e: React.ClipboardEvent) => void;\n onRemoveAttachment: (id: string) => void;\n onNotesChange: (id: string, notes: string) => void;\n onPickFiles: () => void;\n /** Agent/model picker rendered in the controls row. */\n agentPicker?: React.ReactNode;\n}\n\nexport function ChatComposer({\n attachments,\n isDragOver,\n uploadError,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n onPaste,\n onRemoveAttachment,\n onNotesChange,\n onPickFiles,\n agentPicker,\n}: ChatComposerProps) {\n const { t } = useTranslation('web');\n const [isFocused, setIsFocused] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n return (\n <ComposerPrimitive.Root className=\"shrink-0 border-t p-3\">\n <div\n onDragEnter={onDragEnter}\n onDragLeave={onDragLeave}\n onDragOver={onDragOver}\n onDrop={onDrop}\n className={cn(\n 'flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors',\n isDragOver && 'border-primary/50 bg-primary/5'\n )}\n >\n <div\n ref={containerRef}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n className={cn(\n 'border-input flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]',\n isFocused && 'ring-ring/50 border-ring ring-[3px]'\n )}\n >\n {/* Textarea — 1 row default, expands to 3, then scrolls */}\n <ComposerPrimitive.Input\n rows={1}\n autoFocus\n placeholder={t('chat.writeMessage')}\n onPaste={onPaste}\n aria-invalid={!!uploadError}\n aria-describedby={uploadError ? 'chat-upload-error' : undefined}\n className=\"max-h-[4.5rem] min-h-0 resize-none rounded-none border-0 px-3 py-2.5 text-sm shadow-none focus:outline-none focus-visible:ring-0\"\n />\n\n {/* Attachment chips — between textarea and controls bar */}\n {attachments.length > 0 ? (\n <div className=\"flex flex-wrap items-center gap-1.5 px-3 py-2\">\n {attachments.map((file) => (\n <AttachmentChip\n key={file.id}\n name={file.name}\n size={file.size}\n mimeType={file.mimeType}\n path={file.path}\n onRemove={() => onRemoveAttachment(file.id)}\n loading={file.loading}\n notes={file.notes}\n onNotesChange={(notes) => onNotesChange(file.id, notes)}\n />\n ))}\n </div>\n ) : null}\n\n {/* Upload error */}\n {uploadError ? (\n <p id=\"chat-upload-error\" className=\"text-destructive px-3 pb-2 text-xs\" role=\"alert\">\n {uploadError}\n </p>\n ) : null}\n\n {/* Controls bar — agent picker + status left, actions right */}\n <div className=\"border-input flex items-center gap-3 border-t px-3 py-1.5\">\n {/* Agent/model picker */}\n {agentPicker}\n <div className=\"flex-1\" />\n\n {/* Attach files */}\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={onPickFiles}\n aria-label={t('chat.attachFiles')}\n className=\"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors\"\n >\n <Paperclip className=\"h-4 w-4\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{t('chat.attachFiles')}</TooltipContent>\n </Tooltip>\n\n {/* Send / Cancel */}\n <ChatComposerAction />\n </div>\n </div>\n </div>\n </ComposerPrimitive.Root>\n );\n}\n\nfunction ChatComposerAction() {\n return (\n <>\n <ThreadPrimitive.If running={false}>\n <ComposerPrimitive.Send\n className={cn(\n 'bg-primary text-primary-foreground inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md',\n 'hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30',\n 'transition-colors'\n )}\n >\n <SendHorizontal className=\"size-3.5\" />\n </ComposerPrimitive.Send>\n </ThreadPrimitive.If>\n <ThreadPrimitive.If running>\n <ComposerPrimitive.Cancel\n className={cn(\n 'bg-destructive/10 text-destructive inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md',\n 'hover:bg-destructive/20',\n 'transition-colors'\n )}\n >\n <CircleStop className=\"size-3.5\" />\n </ComposerPrimitive.Cancel>\n </ThreadPrimitive.If>\n </>\n );\n}\n","'use client';\n\nimport { useState, useCallback, useRef } from 'react';\n\nconst MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB\n\n/** Minimal set of known-safe extensions (same as feature-create-drawer). */\nconst ALLOWED_EXTENSIONS = new Set([\n 'txt',\n 'md',\n 'csv',\n 'json',\n 'yaml',\n 'yml',\n 'xml',\n 'html',\n 'css',\n 'js',\n 'ts',\n 'jsx',\n 'tsx',\n 'py',\n 'rb',\n 'go',\n 'rs',\n 'java',\n 'kt',\n 'c',\n 'cpp',\n 'h',\n 'hpp',\n 'cs',\n 'swift',\n 'sh',\n 'bash',\n 'zsh',\n 'fish',\n 'ps1',\n 'bat',\n 'cmd',\n 'sql',\n 'graphql',\n 'proto',\n 'toml',\n 'ini',\n 'cfg',\n 'conf',\n 'env',\n 'dockerfile',\n 'makefile',\n 'cmake',\n 'gradle',\n 'sbt',\n 'lock',\n 'sum',\n 'mod',\n 'png',\n 'jpg',\n 'jpeg',\n 'gif',\n 'svg',\n 'webp',\n 'bmp',\n 'ico',\n 'avif',\n 'pdf',\n 'doc',\n 'docx',\n 'xls',\n 'xlsx',\n 'ppt',\n 'pptx',\n 'odt',\n 'ods',\n 'odp',\n 'zip',\n 'tar',\n 'gz',\n 'bz2',\n 'xz',\n '7z',\n 'rar',\n 'log',\n 'diff',\n 'patch',\n]);\n\nfunction getExtension(filename: string): string | null {\n const idx = filename.lastIndexOf('.');\n return idx > 0 ? filename.slice(idx + 1).toLowerCase() : null;\n}\n\nexport interface FormAttachment {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n path: string;\n loading?: boolean;\n notes?: string;\n}\n\nexport function useAttachments() {\n const [attachments, setAttachments] = useState<FormAttachment[]>([]);\n const [uploadError, setUploadError] = useState<string | null>(null);\n const [isDragOver, setIsDragOver] = useState(false);\n const dragCounterRef = useRef(0);\n const sessionIdRef = useRef(crypto.randomUUID());\n\n const handleFiles = useCallback(async (fileList: File[]) => {\n setUploadError(null);\n\n for (const file of fileList) {\n if (file.size > MAX_FILE_SIZE) {\n setUploadError(`\"${file.name}\" exceeds 10 MB limit`);\n return;\n }\n const ext = getExtension(file.name);\n if (ext && !ALLOWED_EXTENSIONS.has(ext)) {\n setUploadError(`File type \"${ext}\" is not allowed`);\n return;\n }\n }\n\n for (const file of fileList) {\n const tempId = crypto.randomUUID();\n\n setAttachments((prev) => [\n ...prev,\n {\n id: tempId,\n name: file.name,\n size: file.size,\n mimeType: file.type || 'application/octet-stream',\n path: '',\n loading: true,\n },\n ]);\n\n try {\n const formData = new FormData();\n formData.append('file', file);\n formData.append('sessionId', sessionIdRef.current);\n\n const res = await fetch('/api/attachments/upload', {\n method: 'POST',\n body: formData,\n });\n\n if (!res.ok) {\n const body = await res.json().catch(() => ({ error: 'Upload failed' }));\n setAttachments((prev) => prev.filter((a) => a.id !== tempId));\n setUploadError(body.error ?? 'Upload failed');\n return;\n }\n\n const uploaded = await res.json();\n setAttachments((prev) => {\n const isDupe = prev.some((a) => a.id !== tempId && a.path === uploaded.path);\n if (isDupe) return prev.filter((a) => a.id !== tempId);\n return prev.map((a) =>\n a.id === tempId ? { ...uploaded, id: tempId, loading: false } : a\n );\n });\n } catch {\n setAttachments((prev) => prev.filter((a) => a.id !== tempId));\n setUploadError('Upload failed');\n }\n }\n }, []);\n\n const handleDragEnter = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n dragCounterRef.current += 1;\n if (dragCounterRef.current === 1) setIsDragOver(true);\n }, []);\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n dragCounterRef.current -= 1;\n if (dragCounterRef.current === 0) setIsDragOver(false);\n }, []);\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n dragCounterRef.current = 0;\n setIsDragOver(false);\n const files = Array.from(e.dataTransfer.files);\n if (files.length > 0) void handleFiles(files);\n },\n [handleFiles]\n );\n\n const handlePaste = useCallback(\n (e: React.ClipboardEvent) => {\n const items = e.clipboardData?.items;\n if (!items) return;\n const files: File[] = [];\n for (const item of Array.from(items)) {\n if (item.kind === 'file') {\n const file = item.getAsFile();\n if (file) files.push(file);\n }\n }\n if (files.length > 0) {\n e.preventDefault();\n void handleFiles(files);\n }\n },\n [handleFiles]\n );\n\n const removeAttachment = useCallback((id: string) => {\n setAttachments((prev) => prev.filter((a) => a.id !== id));\n }, []);\n\n const updateNotes = useCallback((id: string, notes: string) => {\n setAttachments((prev) => prev.map((a) => (a.id === id ? { ...a, notes } : a)));\n }, []);\n\n const addAttachment = useCallback((file: Omit<FormAttachment, 'loading'>) => {\n setAttachments((prev) => {\n const isDupe = prev.some((a) => a.path === file.path);\n if (isDupe) return prev;\n return [...prev, { ...file, loading: false }];\n });\n }, []);\n\n const clearAttachments = useCallback(() => {\n setAttachments([]);\n setUploadError(null);\n }, []);\n\n const completedAttachments = attachments.filter((a) => !a.loading);\n\n return {\n attachments,\n completedAttachments,\n uploadError,\n isDragOver,\n handleFiles,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n handlePaste,\n addAttachment,\n removeAttachment,\n updateNotes,\n clearAttachments,\n };\n}\n","import { ReadonlyJSONValue } from \"../../utils/json/json-value\";\n\nconst TOOL_RESPONSE_SYMBOL = Symbol.for(\"aui.tool-response\");\n\nexport type ToolResponseLike<TResult> = {\n result: TResult;\n artifact?: ReadonlyJSONValue | undefined;\n isError?: boolean | undefined;\n messages?: ReadonlyJSONValue | undefined;\n};\n\nexport class ToolResponse<TResult> {\n get [TOOL_RESPONSE_SYMBOL]() {\n return true;\n }\n\n readonly artifact?: ReadonlyJSONValue;\n readonly result: TResult;\n readonly isError: boolean;\n readonly messages?: ReadonlyJSONValue;\n\n constructor(options: ToolResponseLike<TResult>) {\n if (options.artifact !== undefined) {\n this.artifact = options.artifact;\n }\n this.result = options.result;\n this.isError = options.isError ?? false;\n if (options.messages !== undefined) {\n this.messages = options.messages;\n }\n }\n\n static [Symbol.hasInstance](\n obj: unknown,\n ): obj is ToolResponse<ReadonlyJSONValue> {\n return (\n typeof obj === \"object\" && obj !== null && TOOL_RESPONSE_SYMBOL in obj\n );\n }\n\n static toResponse(result: any | ToolResponse<any>): ToolResponse<any> {\n if (result instanceof ToolResponse) {\n return result;\n }\n return new ToolResponse({\n result: result === undefined ? \"<no result>\" : result,\n });\n }\n}\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { ExternalStoreThreadRuntimeCore } from \"./external-store-thread-runtime-core\";\nimport type {\n ThreadListItemCoreState,\n ThreadListRuntimeCore,\n} from \"../../runtime/interfaces/thread-list-runtime-core\";\nimport type { ExternalStoreThreadListAdapter } from \"./external-store-adapter\";\n\nexport type ExternalStoreThreadFactory = () => ExternalStoreThreadRuntimeCore;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst DEFAULT_THREAD_ID = \"DEFAULT_THREAD_ID\";\nconst DEFAULT_THREADS = Object.freeze([DEFAULT_THREAD_ID]);\nconst DEFAULT_THREAD = Object.freeze({\n id: DEFAULT_THREAD_ID,\n remoteId: undefined,\n externalId: undefined,\n status: \"regular\",\n});\nconst RESOLVED_PROMISE = Promise.resolve();\nconst DEFAULT_THREAD_DATA = Object.freeze({\n [DEFAULT_THREAD_ID]: DEFAULT_THREAD,\n});\n\nexport class ExternalStoreThreadListRuntimeCore\n implements ThreadListRuntimeCore\n{\n private _mainThreadId: string = DEFAULT_THREAD_ID;\n private _threads: readonly string[] = DEFAULT_THREADS;\n private _archivedThreads: readonly string[] = EMPTY_ARRAY;\n private _threadData: Readonly<Record<string, ThreadListItemCoreState>> =\n DEFAULT_THREAD_DATA;\n\n public get isLoading() {\n return this.adapter.isLoading ?? false;\n }\n\n public get newThreadId() {\n return undefined;\n }\n\n public get threadIds() {\n return this._threads;\n }\n\n public get archivedThreadIds() {\n return this._archivedThreads;\n }\n\n public get threadItems() {\n return this._threadData;\n }\n\n public getLoadThreadsPromise() {\n return RESOLVED_PROMISE;\n }\n\n private _mainThread: ExternalStoreThreadRuntimeCore;\n\n public get mainThreadId() {\n return this._mainThreadId;\n }\n\n constructor(\n private adapter: ExternalStoreThreadListAdapter = {},\n private threadFactory: ExternalStoreThreadFactory,\n ) {\n this._mainThread = this.threadFactory();\n this.__internal_setAdapter(adapter, true);\n }\n\n public getMainThreadRuntimeCore() {\n return this._mainThread;\n }\n\n public getThreadRuntimeCore(): never {\n throw new Error(\"Method not implemented.\");\n }\n\n public getItemById(threadId: string) {\n for (const thread of this.adapter.threads ?? []) {\n if (thread.id === threadId) return thread as any;\n }\n for (const thread of this.adapter.archivedThreads ?? []) {\n if (thread.id === threadId) return thread as any;\n }\n if (threadId === DEFAULT_THREAD_ID) return DEFAULT_THREAD;\n return undefined;\n }\n\n public __internal_setAdapter(\n adapter: ExternalStoreThreadListAdapter,\n initialLoad = false,\n ) {\n const previousAdapter = this.adapter;\n this.adapter = adapter;\n\n const newThreadId = adapter.threadId ?? DEFAULT_THREAD_ID;\n const newThreads = adapter.threads ?? EMPTY_ARRAY;\n const newArchivedThreads = adapter.archivedThreads ?? EMPTY_ARRAY;\n\n const previousThreadId = previousAdapter.threadId ?? DEFAULT_THREAD_ID;\n const previousThreads = previousAdapter.threads ?? EMPTY_ARRAY;\n const previousArchivedThreads =\n previousAdapter.archivedThreads ?? EMPTY_ARRAY;\n\n if (\n !initialLoad &&\n previousThreadId === newThreadId &&\n previousThreads === newThreads &&\n previousArchivedThreads === newArchivedThreads\n ) {\n return;\n }\n\n this._threadData = {\n ...DEFAULT_THREAD_DATA,\n ...Object.fromEntries(\n adapter.threads?.map((t) => [\n t.id,\n {\n ...t,\n remoteId: t.remoteId,\n externalId: t.externalId,\n status: \"regular\",\n },\n ]) ?? [],\n ),\n ...Object.fromEntries(\n adapter.archivedThreads?.map((t) => [\n t.id,\n {\n ...t,\n remoteId: t.remoteId,\n externalId: t.externalId,\n status: \"archived\",\n },\n ]) ?? [],\n ),\n };\n\n if (previousThreads !== newThreads) {\n this._threads = this.adapter.threads?.map((t) => t.id) ?? EMPTY_ARRAY;\n }\n\n if (previousArchivedThreads !== newArchivedThreads) {\n this._archivedThreads =\n this.adapter.archivedThreads?.map((t) => t.id) ?? EMPTY_ARRAY;\n }\n\n if (previousThreadId !== newThreadId) {\n this._mainThreadId = newThreadId;\n this._mainThread = this.threadFactory();\n }\n\n this._notifySubscribers();\n }\n\n public async switchToThread(threadId: string): Promise<void> {\n if (this._mainThreadId === threadId) return;\n const onSwitchToThread = this.adapter.onSwitchToThread;\n if (!onSwitchToThread)\n throw new Error(\n \"External store adapter does not support switching to thread\",\n );\n await onSwitchToThread(threadId);\n }\n\n public async switchToNewThread(): Promise<void> {\n const onSwitchToNewThread = this.adapter.onSwitchToNewThread;\n if (!onSwitchToNewThread)\n throw new Error(\n \"External store adapter does not support switching to new thread\",\n );\n\n await onSwitchToNewThread();\n }\n\n public async rename(threadId: string, newTitle: string): Promise<void> {\n const onRename = this.adapter.onRename;\n if (!onRename)\n throw new Error(\"External store adapter does not support renaming\");\n\n await onRename(threadId, newTitle);\n }\n\n public async detach(): Promise<void> {\n // no-op\n }\n\n public async archive(threadId: string): Promise<void> {\n const onArchive = this.adapter.onArchive;\n if (!onArchive)\n throw new Error(\"External store adapter does not support archiving\");\n\n await onArchive(threadId);\n }\n\n public async unarchive(threadId: string): Promise<void> {\n const onUnarchive = this.adapter.onUnarchive;\n if (!onUnarchive)\n throw new Error(\"External store adapter does not support unarchiving\");\n\n await onUnarchive(threadId);\n }\n\n public async delete(threadId: string): Promise<void> {\n const onDelete = this.adapter.onDelete;\n if (!onDelete)\n throw new Error(\"External store adapter does not support deleting\");\n\n await onDelete(threadId);\n }\n\n public initialize(\n threadId: string,\n ): Promise<{ remoteId: string; externalId: string | undefined }> {\n return Promise.resolve({ remoteId: threadId, externalId: undefined });\n }\n\n public generateTitle(): never {\n throw new Error(\"Method not implemented.\");\n }\n\n private _subscriptions = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n private _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n}\n","import type {\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ToolCallMessagePartStatus,\n} from \"../../types/message\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { MessagePartStatus } from \"../../types/message\";\nimport type { SubscribableWithState } from \"../../subscribable/subscribable\";\nimport type { ThreadRuntimeCoreBinding } from \"./thread-runtime\";\nimport type { MessageStateBinding } from \"./bindings\";\nimport type { MessagePartRuntimePath } from \"./paths\";\nimport { ToolResponse } from \"assistant-stream\";\n\nexport type MessagePartState = (\n | ThreadUserMessagePart\n | ThreadAssistantMessagePart\n) & {\n readonly status: MessagePartStatus | ToolCallMessagePartStatus;\n};\n\ntype MessagePartSnapshotBinding = SubscribableWithState<\n MessagePartState,\n MessagePartRuntimePath\n>;\n\nexport type MessagePartRuntime = {\n addToolResult(result: any | ToolResponse<any>): void;\n resumeToolCall(payload: unknown): void;\n\n readonly path: MessagePartRuntimePath;\n getState(): MessagePartState;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class MessagePartRuntimeImpl implements MessagePartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: MessagePartSnapshotBinding,\n private messageApi?: MessageStateBinding,\n private threadApi?: ThreadRuntimeCoreBinding,\n ) {\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.addToolResult = this.addToolResult.bind(this);\n this.resumeToolCall = this.resumeToolCall.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any | ToolResponse<any>) {\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Message part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool message part\");\n\n if (!this.messageApi)\n throw new Error(\n \"Message API is not available. This is likely a bug in assistant-ui.\",\n );\n if (!this.threadApi) throw new Error(\"Thread API is not available\");\n\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n const response = ToolResponse.toResponse(result);\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result: response.result,\n artifact: response.artifact,\n isError: response.isError,\n });\n }\n\n public resumeToolCall(payload: unknown) {\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Message part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to resume tool call on non-tool message part\");\n\n if (!this.threadApi) throw new Error(\"Thread API is not available\");\n\n const toolCallId = state.toolCallId;\n this.threadApi.getState().resumeToolCall({\n toolCallId,\n payload,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n","import type { ThreadMessage } from \"../../types/message\";\nimport type { RunConfig } from \"../../types/message\";\nimport { generateId, generateOptimisticId } from \"../../utils/id\";\nimport type { ThreadMessageLike } from \"./thread-message-like\";\nimport { getAutoStatus } from \"./auto-status\";\nimport { fromThreadMessageLike } from \"./thread-message-like\";\n\nexport type ExportedMessageRepositoryItem = {\n message: ThreadMessage;\n parentId: string | null;\n runConfig?: RunConfig;\n};\n\nexport type ExportedMessageRepository = {\n headId?: string | null;\n messages: Array<{\n message: ThreadMessage;\n parentId: string | null;\n runConfig?: RunConfig;\n }>;\n};\n\nexport const ExportedMessageRepository = {\n fromArray: (\n messages: readonly ThreadMessageLike[],\n ): ExportedMessageRepository => {\n const conv = messages.map((m) =>\n fromThreadMessageLike(\n m,\n generateId(),\n getAutoStatus(false, false, false, false, undefined),\n ),\n );\n\n return {\n messages: conv.map((m, idx) => ({\n parentId: idx > 0 ? conv[idx - 1]!.id : null,\n message: m,\n })),\n };\n },\n};\n\ntype RepositoryParent = {\n children: string[];\n next: RepositoryMessage | null;\n};\n\ntype RepositoryMessage = RepositoryParent & {\n prev: RepositoryMessage | null;\n current: ThreadMessage;\n level: number;\n};\n\nconst findHead = (\n message: RepositoryMessage | RepositoryParent,\n): RepositoryMessage | null => {\n if (message.next) return findHead(message.next);\n if (\"current\" in message) return message;\n return null;\n};\n\nclass CachedValue<T> {\n private _value: T | null = null;\n\n constructor(private func: () => T) {}\n\n get value() {\n if (this._value === null) {\n this._value = this.func();\n }\n return this._value;\n }\n\n dirty() {\n this._value = null;\n }\n}\n\nexport class MessageRepository {\n private messages = new Map<string, RepositoryMessage>();\n private head: RepositoryMessage | null = null;\n private root: RepositoryParent = {\n children: [],\n next: null,\n };\n\n private updateLevels(message: RepositoryMessage, newLevel: number) {\n message.level = newLevel;\n for (const childId of message.children) {\n const childMessage = this.messages.get(childId);\n if (childMessage) {\n this.updateLevels(childMessage, newLevel + 1);\n }\n }\n }\n\n private performOp(\n newParent: RepositoryMessage | null,\n child: RepositoryMessage,\n operation: \"cut\" | \"link\" | \"relink\",\n ) {\n const parentOrRoot = child.prev ?? this.root;\n const newParentOrRoot = newParent ?? this.root;\n\n if (operation === \"relink\" && parentOrRoot === newParentOrRoot) return;\n\n if (operation !== \"link\") {\n parentOrRoot.children = parentOrRoot.children.filter(\n (m) => m !== child.current.id,\n );\n\n if (parentOrRoot.next === child) {\n const fallbackId = parentOrRoot.children.at(-1);\n const fallback = fallbackId ? this.messages.get(fallbackId) : null;\n if (fallback === undefined) {\n throw new Error(\n \"MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.\",\n );\n }\n parentOrRoot.next = fallback;\n }\n }\n\n if (operation !== \"cut\") {\n for (\n let current: RepositoryMessage | null = newParent;\n current;\n current = current.prev\n ) {\n if (current.current.id === child.current.id) {\n throw new Error(\n \"MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.\",\n );\n }\n }\n\n newParentOrRoot.children = [\n ...newParentOrRoot.children,\n child.current.id,\n ];\n\n if (findHead(child) === this.head || newParentOrRoot.next === null) {\n newParentOrRoot.next = child;\n }\n\n child.prev = newParent;\n\n const newLevel = newParent ? newParent.level + 1 : 0;\n this.updateLevels(child, newLevel);\n }\n }\n\n private _messages = new CachedValue<readonly ThreadMessage[]>(() => {\n const messages = new Array<ThreadMessage>((this.head?.level ?? -1) + 1);\n for (let current = this.head; current; current = current.prev) {\n messages[current.level] = current.current;\n }\n return messages;\n });\n\n get headId() {\n return this.head?.current.id ?? null;\n }\n\n getMessages(headId?: string) {\n if (headId === undefined || headId === this.head?.current.id) {\n return this._messages.value;\n }\n\n const headMessage = this.messages.get(headId);\n if (!headMessage) {\n throw new Error(\n \"MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.\",\n );\n }\n\n const messages = new Array<ThreadMessage>(headMessage.level + 1);\n for (\n let current: RepositoryMessage | null = headMessage;\n current;\n current = current.prev\n ) {\n messages[current.level] = current.current;\n }\n return messages;\n }\n\n addOrUpdateMessage(parentId: string | null, message: ThreadMessage) {\n const existingItem = this.messages.get(message.id);\n const prev = parentId ? this.messages.get(parentId) : null;\n if (prev === undefined)\n throw new Error(\n \"MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n if (existingItem) {\n existingItem.current = message;\n this.performOp(prev, existingItem, \"relink\");\n this._messages.dirty();\n return;\n }\n\n const newItem: RepositoryMessage = {\n prev,\n current: message,\n next: null,\n children: [],\n level: prev ? prev.level + 1 : 0,\n };\n\n this.messages.set(message.id, newItem);\n this.performOp(prev, newItem, \"link\");\n\n if (this.head === prev) {\n this.head = newItem;\n }\n\n this._messages.dirty();\n }\n\n getMessage(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n return {\n parentId: message.prev?.current.id ?? null,\n message: message.current,\n index: message.level,\n };\n }\n\n appendOptimisticMessage(parentId: string | null, message: ThreadMessageLike) {\n let optimisticId: string;\n do {\n optimisticId = generateOptimisticId();\n } while (this.messages.has(optimisticId));\n\n this.addOrUpdateMessage(\n parentId,\n fromThreadMessageLike(message, optimisticId, { type: \"running\" }),\n );\n\n return optimisticId;\n }\n\n deleteMessage(messageId: string, replacementId?: string | null | undefined) {\n const message = this.messages.get(messageId);\n\n if (!message)\n throw new Error(\n \"MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n const replacement =\n replacementId === undefined\n ? message.prev\n : replacementId === null\n ? null\n : this.messages.get(replacementId);\n if (replacement === undefined)\n throw new Error(\n \"MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.\",\n );\n\n for (const child of message.children) {\n const childMessage = this.messages.get(child);\n if (!childMessage)\n throw new Error(\n \"MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.\",\n );\n this.performOp(replacement, childMessage, \"relink\");\n }\n\n this.performOp(null, message, \"cut\");\n this.messages.delete(messageId);\n\n if (this.head === message) {\n this.head = findHead(replacement ?? this.root);\n }\n\n this._messages.dirty();\n }\n\n getBranches(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.\",\n );\n\n const { children } = message.prev ?? this.root;\n return children;\n }\n\n switchToBranch(messageId: string) {\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.\",\n );\n\n const prevOrRoot = message.prev ?? this.root;\n prevOrRoot.next = message;\n\n this.head = findHead(message);\n\n this._messages.dirty();\n }\n\n resetHead(messageId: string | null) {\n if (messageId === null) {\n this.clear();\n return;\n }\n\n const message = this.messages.get(messageId);\n if (!message)\n throw new Error(\n \"MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.\",\n );\n\n if (message.children.length > 0) {\n const deleteDescendants = (msg: RepositoryMessage) => {\n for (const childId of msg.children) {\n const childMessage = this.messages.get(childId);\n if (childMessage) {\n deleteDescendants(childMessage);\n this.messages.delete(childId);\n }\n }\n };\n deleteDescendants(message);\n\n message.children = [];\n message.next = null;\n }\n\n this.head = message;\n for (\n let current: RepositoryMessage | null = message;\n current;\n current = current.prev\n ) {\n if (current.prev) {\n current.prev.next = current;\n } else {\n this.root.next = current;\n }\n }\n\n this._messages.dirty();\n }\n\n clear(): void {\n this.messages.clear();\n this.head = null;\n this.root = {\n children: [],\n next: null,\n };\n this._messages.dirty();\n }\n\n export(): ExportedMessageRepository {\n const exportItems: ExportedMessageRepository[\"messages\"] = [];\n\n for (const [, message] of this.messages) {\n exportItems.push({\n message: message.current,\n parentId: message.prev?.current.id ?? null,\n });\n }\n\n return {\n headId: this.head?.current.id ?? null,\n messages: exportItems,\n };\n }\n\n import({ headId, messages }: ExportedMessageRepository) {\n for (const { message, parentId } of messages) {\n this.addOrUpdateMessage(parentId, message);\n }\n\n this.resetHead(headId ?? messages.at(-1)?.message.id ?? null);\n }\n}\n","import type { MessageStatus } from \"../../types/message\";\nimport { ReadonlyJSONValue } from \"assistant-stream/utils\";\n\nconst symbolAutoStatus = Symbol(\"autoStatus\");\n\nconst AUTO_STATUS_RUNNING = Object.freeze(\n Object.assign({ type: \"running\" as const }, { [symbolAutoStatus]: true }),\n);\nconst AUTO_STATUS_COMPLETE = Object.freeze(\n Object.assign(\n {\n type: \"complete\" as const,\n reason: \"unknown\" as const,\n },\n { [symbolAutoStatus]: true },\n ),\n);\n\nconst AUTO_STATUS_PENDING = Object.freeze(\n Object.assign(\n {\n type: \"requires-action\" as const,\n reason: \"tool-calls\" as const,\n },\n { [symbolAutoStatus]: true },\n ),\n);\n\nconst AUTO_STATUS_INTERRUPT = Object.freeze(\n Object.assign(\n {\n type: \"requires-action\" as const,\n reason: \"interrupt\" as const,\n },\n { [symbolAutoStatus]: true },\n ),\n);\n\nexport const isAutoStatus = (status: MessageStatus) =>\n (status as any)[symbolAutoStatus] === true;\n\nexport const getAutoStatus = (\n isLast: boolean,\n isRunning: boolean,\n hasInterruptedToolCalls: boolean,\n hasPendingToolCalls: boolean,\n error?: ReadonlyJSONValue,\n): MessageStatus => {\n if (isLast && error) {\n return Object.assign(\n {\n type: \"incomplete\" as const,\n reason: \"error\" as const,\n error: error,\n },\n { [symbolAutoStatus]: true },\n );\n }\n\n return isLast && isRunning\n ? AUTO_STATUS_RUNNING\n : hasInterruptedToolCalls\n ? AUTO_STATUS_INTERRUPT\n : hasPendingToolCalls\n ? AUTO_STATUS_PENDING\n : AUTO_STATUS_COMPLETE;\n};\n","import { customAlphabet } from \"nanoid/non-secure\";\n\nexport const generateId = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7,\n);\n\nconst optimisticPrefix = \"__optimistic__\";\nexport const generateOptimisticId = () => `${optimisticPrefix}${generateId()}`;\nexport const isOptimisticId = (id: string) => id.startsWith(optimisticPrefix);\n\nconst errorPrefix = \"__error__\";\nexport const generateErrorMessageId = () => `${errorPrefix}${generateId()}`;\nexport const isErrorMessageId = (id: string) => id.startsWith(errorPrefix);\n","import { BaseAssistantRuntimeCore } from \"../../runtime/base/base-assistant-runtime-core\";\nimport { ExternalStoreThreadListRuntimeCore } from \"./external-store-thread-list-runtime-core\";\nimport type { ExternalStoreAdapter } from \"./external-store-adapter\";\nimport { ExternalStoreThreadRuntimeCore } from \"./external-store-thread-runtime-core\";\n\nconst getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {\n return store.adapters?.threadList ?? {};\n};\n\nexport class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {\n public readonly threads;\n\n constructor(adapter: ExternalStoreAdapter<any>) {\n super();\n this.threads = new ExternalStoreThreadListRuntimeCore(\n getThreadListAdapter(adapter),\n () => new ExternalStoreThreadRuntimeCore(this._contextProvider, adapter),\n );\n }\n\n public setAdapter(adapter: ExternalStoreAdapter<any>) {\n // Update the thread list adapter and propagate store changes to the main thread\n this.threads.__internal_setAdapter(getThreadListAdapter(adapter));\n this.threads.getMainThreadRuntimeCore().__internal_setAdapter(adapter);\n }\n}\n","import type { AppendMessage, ThreadMessage } from \"../../types/message\";\nimport type {\n AddToolResultOptions,\n ResumeRunConfig,\n ResumeToolCallOptions,\n StartRunConfig,\n ThreadSuggestion,\n} from \"../../runtime/interfaces/thread-runtime-core\";\n\nimport type { ExternalStoreAdapter } from \"./external-store-adapter\";\nimport {\n getExternalStoreMessages,\n bindExternalStoreMessage,\n} from \"../../runtime/utils/external-store-message\";\nimport { ThreadMessageConverter } from \"./thread-message-converter\";\nimport { getAutoStatus, isAutoStatus } from \"../../runtime/utils/auto-status\";\nimport {\n fromThreadMessageLike,\n type ThreadMessageLike,\n} from \"../../runtime/utils/thread-message-like\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport type {\n RuntimeCapabilities,\n ThreadRuntimeCore,\n} from \"../../runtime/interfaces/thread-runtime-core\";\nimport { BaseThreadRuntimeCore } from \"../../runtime/base/base-thread-runtime-core\";\nimport type { ModelContextProvider } from \"../../model-context/types\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../../runtime/utils/message-repository\";\n\nconst EMPTY_ARRAY: readonly ThreadSuggestion[] = Object.freeze([]);\n\nconst shallowEqual = (a: object, b: object): boolean => {\n const aKeys = Object.keys(a);\n if (aKeys.length !== Object.keys(b).length) return false;\n for (const key of aKeys) {\n if ((a as any)[key] !== (b as any)[key]) return false;\n }\n return true;\n};\n\nexport const hasUpcomingMessage = (\n isRunning: boolean,\n messages: readonly ThreadMessage[],\n) => {\n return isRunning && messages[messages.length - 1]?.role !== \"assistant\";\n};\n\nexport class ExternalStoreThreadRuntimeCore\n extends BaseThreadRuntimeCore\n implements ThreadRuntimeCore\n{\n private _assistantOptimisticId: string | null = null;\n\n private _capabilities: RuntimeCapabilities = {\n switchToBranch: false,\n switchBranchDuringRun: false,\n edit: false,\n reload: false,\n cancel: false,\n unstable_copy: false,\n speech: false,\n dictation: false,\n voice: false,\n attachments: false,\n feedback: false,\n queue: false,\n };\n\n public get capabilities() {\n return this._capabilities;\n }\n\n private _messages!: readonly ThreadMessage[];\n public isDisabled!: boolean;\n public get isLoading() {\n return this._store.isLoading ?? false;\n }\n\n protected override _getBaseMessages(): readonly ThreadMessage[] {\n return this._messages;\n }\n\n public override get state() {\n return this._store.state ?? super.state;\n }\n\n public get adapters() {\n return this._store.adapters;\n }\n\n public suggestions: readonly ThreadSuggestion[] = [];\n public extras: unknown = undefined;\n\n private _converter = new ThreadMessageConverter();\n\n private _store!: ExternalStoreAdapter<any>;\n\n public override beginEdit(messageId: string) {\n if (!this._store.onEdit)\n throw new Error(\"Runtime does not support editing.\");\n\n super.beginEdit(messageId);\n }\n\n constructor(\n contextProvider: ModelContextProvider,\n store: ExternalStoreAdapter<any>,\n ) {\n super(contextProvider);\n this.__internal_setAdapter(store);\n }\n\n public __internal_setAdapter(store: ExternalStoreAdapter<any>) {\n if (this._store === store) return;\n\n const isRunning = store.isRunning ?? false;\n this.isDisabled = store.isDisabled ?? false;\n\n const oldStore = this._store as ExternalStoreAdapter<any> | undefined;\n this._store = store;\n if (this.extras !== store.extras) {\n this.extras = store.extras;\n }\n\n const newSuggestions = store.suggestions ?? EMPTY_ARRAY;\n if (!shallowEqual(this.suggestions, newSuggestions)) {\n this.suggestions = newSuggestions;\n }\n\n const newCapabilities: RuntimeCapabilities = {\n switchToBranch: this._store.setMessages !== undefined,\n switchBranchDuringRun: false,\n edit: this._store.onEdit !== undefined,\n reload: this._store.onReload !== undefined,\n cancel: this._store.onCancel !== undefined,\n speech: this._store.adapters?.speech !== undefined,\n dictation: this._store.adapters?.dictation !== undefined,\n voice: this._store.adapters?.voice !== undefined,\n unstable_copy: this._store.unstable_capabilities?.copy !== false,\n attachments: !!this._store.adapters?.attachments,\n feedback: !!this._store.adapters?.feedback,\n queue: false,\n };\n if (!shallowEqual(this._capabilities, newCapabilities)) {\n this._capabilities = newCapabilities;\n }\n\n let messages: readonly ThreadMessage[];\n\n if (store.messageRepository) {\n // Handle messageRepository\n if (\n oldStore &&\n oldStore.isRunning === store.isRunning &&\n oldStore.messageRepository === store.messageRepository\n ) {\n this._notifySubscribers();\n return;\n }\n\n // Clear and import the message repository\n this.repository.clear();\n this._assistantOptimisticId = null;\n this.repository.import(store.messageRepository);\n\n messages = this.repository.getMessages();\n } else if (store.messages) {\n // Handle messages array\n\n if (oldStore) {\n // flush the converter cache when the convertMessage prop changes\n if (oldStore.convertMessage !== store.convertMessage) {\n this._converter = new ThreadMessageConverter();\n } else if (\n oldStore.isRunning === store.isRunning &&\n oldStore.messages === store.messages\n ) {\n this._notifySubscribers();\n // no conversion update\n return;\n }\n }\n\n messages = !store.convertMessage\n ? store.messages\n : this._converter.convertMessages(store.messages, (cache, m, idx) => {\n if (!store.convertMessage) return m;\n\n const isLast = idx === (store.messages?.length ?? 0) - 1;\n const autoStatus = getAutoStatus(\n isLast,\n isRunning,\n false,\n false,\n undefined,\n );\n\n if (\n cache &&\n (cache.role !== \"assistant\" ||\n !isAutoStatus(cache.status) ||\n cache.status === autoStatus)\n )\n return cache;\n\n const messageLike = store.convertMessage(m, idx);\n const newMessage = fromThreadMessageLike(\n messageLike,\n idx.toString(),\n autoStatus,\n );\n bindExternalStoreMessage(newMessage, m);\n return newMessage;\n });\n\n for (let i = 0; i < messages.length; i++) {\n const message = messages[i]!;\n const parent = messages[i - 1];\n this.repository.addOrUpdateMessage(parent?.id ?? null, message);\n }\n } else {\n throw new Error(\n \"ExternalStoreAdapter must provide either 'messages' or 'messageRepository'\",\n );\n }\n\n // Common logic for both paths\n if (messages.length > 0) this.ensureInitialized();\n\n if ((oldStore?.isRunning ?? false) !== (store.isRunning ?? false)) {\n if (store.isRunning) {\n this._notifyEventSubscribers(\"runStart\");\n } else {\n this._notifyEventSubscribers(\"runEnd\");\n }\n }\n\n if (this._assistantOptimisticId) {\n this.repository.deleteMessage(this._assistantOptimisticId);\n this._assistantOptimisticId = null;\n }\n\n if (hasUpcomingMessage(isRunning, messages)) {\n this._assistantOptimisticId = this.repository.appendOptimisticMessage(\n messages.at(-1)?.id ?? null,\n {\n role: \"assistant\",\n content: [],\n },\n );\n }\n\n this.repository.resetHead(\n this._assistantOptimisticId ?? messages.at(-1)?.id ?? null,\n );\n\n this._messages = this.repository.getMessages();\n this._notifySubscribers();\n }\n\n public override switchToBranch(branchId: string): void {\n if (!this._store.setMessages)\n throw new Error(\"Runtime does not support switching branches.\");\n\n // Silently ignore branch switches while running\n if (this._store.isRunning) {\n return;\n }\n\n this.repository.switchToBranch(branchId);\n this.updateMessages(this.repository.getMessages());\n }\n\n public async append(message: AppendMessage): Promise<void> {\n if (message.parentId !== (this.messages.at(-1)?.id ?? null)) {\n if (!this._store.onEdit)\n throw new Error(\"Runtime does not support editing messages.\");\n await this._store.onEdit(message);\n } else {\n await this._store.onNew(message);\n }\n }\n\n public async startRun(config: StartRunConfig): Promise<void> {\n if (!this._store.onReload)\n throw new Error(\"Runtime does not support reloading messages.\");\n\n await this._store.onReload(config.parentId, config);\n }\n\n public async resumeRun(config: ResumeRunConfig): Promise<void> {\n if (!this._store.onResume)\n throw new Error(\"Runtime does not support resuming runs.\");\n\n await this._store.onResume(config);\n }\n\n public exportExternalState(): any {\n if (!this._store.onExportExternalState)\n throw new Error(\"Runtime does not support exporting external states.\");\n\n return this._store.onExportExternalState();\n }\n\n public importExternalState(state: any): void {\n if (!this._store.onLoadExternalState)\n throw new Error(\"Runtime does not support importing external states.\");\n\n this._store.onLoadExternalState(state);\n }\n\n public unstable_loadExternalState(state: any): void {\n this.importExternalState(state);\n }\n\n public cancelRun(): void {\n if (!this._store.onCancel)\n throw new Error(\"Runtime does not support cancelling runs.\");\n\n this._store.onCancel();\n\n if (this._assistantOptimisticId) {\n this.repository.deleteMessage(this._assistantOptimisticId);\n this._assistantOptimisticId = null;\n }\n\n let messages = this.repository.getMessages();\n const previousMessage = messages[messages.length - 1];\n if (\n previousMessage?.role === \"user\" &&\n previousMessage.id === messages.at(-1)?.id // ensure the previous message is a leaf node\n ) {\n this.repository.deleteMessage(previousMessage.id);\n if (!this.composer.text.trim()) {\n this.composer.setText(getThreadMessageText(previousMessage));\n }\n\n messages = this.repository.getMessages();\n } else {\n this._notifySubscribers();\n }\n\n // resync messages (for reloading, to restore the previous branch)\n setTimeout(() => {\n this.updateMessages(messages);\n }, 0);\n }\n\n public addToolResult(options: AddToolResultOptions) {\n if (!this._store.onAddToolResult && !this._store.onAddToolResult)\n throw new Error(\"Runtime does not support tool results.\");\n this._store.onAddToolResult?.(options);\n }\n\n public resumeToolCall(options: ResumeToolCallOptions) {\n if (!this._store.onResumeToolCall)\n throw new Error(\"Runtime does not support resuming tool calls.\");\n this._store.onResumeToolCall(options);\n }\n\n public override reset(initialMessages?: readonly ThreadMessageLike[]) {\n const repo = new MessageRepository();\n repo.import(ExportedMessageRepository.fromArray(initialMessages ?? []));\n this.updateMessages(repo.getMessages());\n }\n\n public override import(data: ExportedMessageRepository) {\n this._assistantOptimisticId = null;\n\n super.import(data);\n\n if (this._store.onImport) {\n this._store.onImport(this.repository.getMessages());\n }\n }\n\n private updateMessages = (messages: readonly ThreadMessage[]) => {\n const hasConverter = this._store.convertMessage !== undefined;\n if (hasConverter) {\n this._store.setMessages?.(messages.flatMap(getExternalStoreMessages));\n } else {\n // TODO mark this as readonly in v0.12.0\n this._store.setMessages?.(messages as ThreadMessage[]);\n }\n };\n}\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { ModelContextProvider } from \"../../model-context/types\";\nimport { CompositeContextProvider } from \"../../utils/composite-context-provider\";\nimport type { AssistantRuntimeCore } from \"../interfaces/assistant-runtime-core\";\nimport type { ThreadListRuntimeCore } from \"../interfaces/thread-list-runtime-core\";\n\nexport abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {\n protected readonly _contextProvider = new CompositeContextProvider();\n public abstract get threads(): ThreadListRuntimeCore;\n\n public registerModelContextProvider(\n provider: ModelContextProvider,\n ): Unsubscribe {\n return this._contextProvider.registerModelContextProvider(provider);\n }\n\n public getModelContextProvider(): ModelContextProvider {\n return this._contextProvider;\n }\n}\n","import type { ThreadMessage } from \"../../types/message\";\n\nexport type ConverterCallback<TIn> = (\n cache: ThreadMessage | undefined,\n message: TIn,\n idx: number,\n) => ThreadMessage;\n\nexport class ThreadMessageConverter {\n private readonly cache = new WeakMap<WeakKey, ThreadMessage>();\n\n convertMessages<TIn extends WeakKey>(\n messages: readonly TIn[],\n converter: ConverterCallback<TIn>,\n ): ThreadMessage[] {\n return messages.map((m, idx) => {\n const cached = this.cache.get(m);\n const newMessage = converter(cached, m, idx);\n this.cache.set(m, newMessage);\n return newMessage;\n });\n }\n}\n","import type { AppendMessage, ThreadMessage } from \"../types/message\";\nimport type { TextMessagePart } from \"../types/message\";\n\nexport const getThreadMessageText = (\n message: ThreadMessage | AppendMessage,\n) => {\n const textParts = message.content.filter(\n (part) => part.type === \"text\",\n ) as TextMessagePart[];\n\n return textParts.map((part) => part.text).join(\"\\n\\n\");\n};\n","import sjson from \"secure-json-parse\";\nimport { fixJson } from \"./fix-json\";\nimport { ReadonlyJSONObject } from \"./json-value\";\n\nconst PARTIAL_JSON_OBJECT_META_SYMBOL = Symbol(\n \"aui.parse-partial-json-object.meta\",\n);\n\ntype FieldState = \"complete\" | \"partial\";\n\ntype PartialJsonObjectMeta = {\n state: \"complete\" | \"partial\";\n partialPath: string[];\n};\n\nexport const getPartialJsonObjectMeta = (\n obj: Record<symbol, unknown>,\n): PartialJsonObjectMeta | undefined => {\n return obj?.[PARTIAL_JSON_OBJECT_META_SYMBOL] as PartialJsonObjectMeta;\n};\n\nexport const parsePartialJsonObject = (\n json: string,\n):\n | (ReadonlyJSONObject & {\n [PARTIAL_JSON_OBJECT_META_SYMBOL]: PartialJsonObjectMeta;\n })\n | undefined => {\n if (json.length === 0)\n return {\n [PARTIAL_JSON_OBJECT_META_SYMBOL]: { state: \"partial\", partialPath: [] },\n };\n\n try {\n const res = sjson.parse(json);\n if (typeof res !== \"object\" || res === null)\n throw new Error(\"argsText is expected to be an object\");\n\n res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {\n state: \"complete\",\n partialPath: [],\n };\n return res;\n } catch {\n try {\n const [fixedJson, partialPath] = fixJson(json);\n const res = sjson.parse(fixedJson);\n if (typeof res !== \"object\" || res === null)\n throw new Error(\"argsText is expected to be an object\");\n\n res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {\n state: \"partial\",\n partialPath,\n };\n return res;\n } catch {\n return undefined;\n }\n }\n};\n\nconst getFieldState = (\n parent: unknown,\n parentMeta: PartialJsonObjectMeta,\n fieldPath: string[],\n): FieldState => {\n if (typeof parent !== \"object\" || parent === null) return parentMeta.state;\n\n // 1) parent is complete: return \"complete\"\n if (parentMeta.state === \"complete\") return \"complete\";\n\n // 2) we finished traversing: return parent state\n if (fieldPath.length === 0) return parentMeta.state;\n\n const [field, ...restPath] = fieldPath as [string, ...string[]];\n\n // 3) field doesn't yet exist in parent: return \"partial\"\n if (!Object.prototype.hasOwnProperty.call(parent, field)) return \"partial\";\n\n const [partialField, ...restPartialPath] = parentMeta.partialPath;\n\n // 4) field exists but is not partial: return \"complete\"\n if (field !== partialField) return \"complete\";\n\n // 5) field exists and is partial: return child state\n const child = (parent as Record<string, unknown>)[field];\n const childMeta: PartialJsonObjectMeta = {\n state: \"partial\",\n partialPath: restPartialPath,\n };\n\n return getFieldState(child, childMeta, restPath);\n};\n\nexport const getPartialJsonObjectFieldState = (\n obj: Record<string, unknown>,\n fieldPath: (string | number)[],\n): FieldState => {\n const meta = getPartialJsonObjectMeta(obj);\n if (!meta) throw new Error(\"unable to determine object state\");\n\n return getFieldState(obj, meta, fieldPath.map(String));\n};\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { SubscribableWithState } from \"../../subscribable/subscribable\";\nimport type { ThreadListItemRuntimePath } from \"./paths\";\nimport type { ThreadListRuntimeCoreBinding } from \"./thread-list-runtime\";\n\nexport type ThreadListItemEventType = \"switchedTo\" | \"switchedAway\";\n\nimport type { ThreadListItemState } from \"./bindings\";\nimport type { ThreadListItemStatus } from \"../interfaces/thread-list-runtime-core\";\n\nexport type { ThreadListItemState, ThreadListItemStatus };\n\nexport type ThreadListItemRuntime = {\n readonly path: ThreadListItemRuntimePath;\n getState(): ThreadListItemState;\n\n initialize(): Promise<{ remoteId: string; externalId: string | undefined }>;\n generateTitle(): Promise<void>;\n\n switchTo(): Promise<void>;\n rename(newTitle: string): Promise<void>;\n archive(): Promise<void>;\n unarchive(): Promise<void>;\n delete(): Promise<void>;\n\n detach(): void;\n\n subscribe(callback: () => void): Unsubscribe;\n\n unstable_on(\n event: ThreadListItemEventType,\n callback: () => void,\n ): Unsubscribe;\n\n __internal_getRuntime(): ThreadListItemRuntime;\n};\n\nexport type ThreadListItemStateBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: ThreadListItemStateBinding,\n private _threadListBinding: ThreadListRuntimeCoreBinding,\n ) {\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.switchTo = this.switchTo.bind(this);\n this.rename = this.rename.bind(this);\n this.archive = this.archive.bind(this);\n this.unarchive = this.unarchive.bind(this);\n this.delete = this.delete.bind(this);\n this.initialize = this.initialize.bind(this);\n this.generateTitle = this.generateTitle.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.unstable_on = this.unstable_on.bind(this);\n this.getState = this.getState.bind(this);\n this.detach = this.detach.bind(this);\n }\n\n public getState(): ThreadListItemState {\n return this._core.getState();\n }\n\n public switchTo(): Promise<void> {\n const state = this._core.getState();\n return this._threadListBinding.switchToThread(state.id);\n }\n\n public rename(newTitle: string): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.rename(state.id, newTitle);\n }\n\n public archive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.archive(state.id);\n }\n\n public unarchive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.unarchive(state.id);\n }\n\n public delete(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.delete(state.id);\n }\n\n public initialize(): Promise<{\n remoteId: string;\n externalId: string | undefined;\n }> {\n const state = this._core.getState();\n return this._threadListBinding.initialize(state.id);\n }\n\n public generateTitle(): Promise<void> {\n const state = this._core.getState();\n return this._threadListBinding.generateTitle(state.id);\n }\n\n public unstable_on(event: ThreadListItemEventType, callback: () => void) {\n let prevIsMain = this._core.getState().isMain;\n let prevThreadId = this._core.getState().id;\n return this.subscribe(() => {\n const currentState = this._core.getState();\n const newIsMain = currentState.isMain;\n const newThreadId = currentState.id;\n if (prevIsMain === newIsMain && prevThreadId === newThreadId) return;\n prevIsMain = newIsMain;\n prevThreadId = newThreadId;\n\n if (event === \"switchedTo\" && !newIsMain) return;\n if (event === \"switchedAway\" && newIsMain) return;\n callback();\n });\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n\n public detach(): void {\n const state = this._core.getState();\n\n this._threadListBinding.detach(state.id);\n }\n\n public __internal_getRuntime(): ThreadListItemRuntime {\n return this;\n }\n}\n","\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { ExternalStoreRuntimeCore } from \"../../runtimes/internal\";\nimport type { ExternalStoreAdapter } from \"../../runtimes/external-store/external-store-adapter\";\nimport type { AssistantRuntime } from \"../../runtime/api/assistant-runtime\";\nimport { AssistantRuntimeImpl } from \"../../runtime/internal\";\nimport { useRuntimeAdapters } from \"./RuntimeAdapterProvider\";\n\nexport const useExternalStoreRuntime = <T>(\n store: ExternalStoreAdapter<T>,\n): AssistantRuntime => {\n const [runtime] = useState(() => new ExternalStoreRuntimeCore(store));\n\n useEffect(() => {\n runtime.setAdapter(store);\n });\n\n const { modelContext } = useRuntimeAdapters() ?? {};\n\n useEffect(() => {\n if (!modelContext) return undefined;\n return runtime.registerModelContextProvider(modelContext);\n }, [modelContext, runtime]);\n\n return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);\n};\n","import type {\n AppendMessage,\n ThreadAssistantMessage,\n ThreadMessage,\n} from \"../../types/message\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { ModelContextProvider } from \"../../model-context/types\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport { generateId } from \"../../utils/id\";\nimport {\n ExportedMessageRepository,\n MessageRepository,\n} from \"../utils/message-repository\";\nimport { DefaultThreadComposerRuntimeCore } from \"./default-thread-composer-runtime-core\";\nimport type {\n AddToolResultOptions,\n ResumeToolCallOptions,\n ThreadSuggestion,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n VoiceSessionState,\n RuntimeCapabilities,\n ThreadRuntimeEventType,\n StartRunConfig,\n ResumeRunConfig,\n} from \"../interfaces/thread-runtime-core\";\nimport { DefaultEditComposerRuntimeCore } from \"./default-edit-composer-runtime-core\";\nimport type { SpeechSynthesisAdapter } from \"../../adapters/speech\";\nimport type { FeedbackAdapter } from \"../../adapters/feedback\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { RealtimeVoiceAdapter } from \"../../adapters/voice\";\nimport type { ThreadMessageLike } from \"../utils/thread-message-like\";\n\ntype BaseThreadAdapters = {\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n voice?: RealtimeVoiceAdapter | undefined;\n};\n\nexport abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {\n private _subscriptions = new Set<() => void>();\n private _isInitialized = false;\n\n protected readonly repository = new MessageRepository();\n public abstract get adapters(): BaseThreadAdapters | undefined;\n public abstract get isDisabled(): boolean;\n public abstract get isLoading(): boolean;\n public abstract get suggestions(): readonly ThreadSuggestion[];\n public abstract get extras(): unknown;\n\n public abstract get capabilities(): RuntimeCapabilities;\n public abstract append(message: AppendMessage): void;\n public abstract startRun(config: StartRunConfig): void;\n public abstract resumeRun(config: ResumeRunConfig): void;\n public abstract addToolResult(options: AddToolResultOptions): void;\n public abstract resumeToolCall(options: ResumeToolCallOptions): void;\n public abstract cancelRun(): void;\n public abstract exportExternalState(): any;\n public abstract importExternalState(state: any): void;\n public abstract unstable_loadExternalState(state: any): void;\n\n protected _voiceMessages: ThreadMessage[] = [];\n protected _voiceGeneration = 0;\n private _cachedMergedMessages: readonly ThreadMessage[] | null = null;\n private _cachedVoiceGeneration = -1;\n private _cachedMergedBase: readonly ThreadMessage[] | null = null;\n\n protected _markVoiceMessagesDirty() {\n this._voiceGeneration++;\n this._cachedMergedMessages = null;\n }\n\n protected _getBaseMessages(): readonly ThreadMessage[] {\n return this.repository.getMessages();\n }\n\n public get messages(): readonly ThreadMessage[] {\n if (this._voiceMessages.length === 0) {\n return this._getBaseMessages();\n }\n const base = this._getBaseMessages();\n if (\n this._cachedVoiceGeneration !== this._voiceGeneration ||\n this._cachedMergedBase !== base\n ) {\n this._cachedMergedMessages = [...base, ...this._voiceMessages];\n this._cachedVoiceGeneration = this._voiceGeneration;\n this._cachedMergedBase = base;\n }\n return this._cachedMergedMessages!;\n }\n\n public get state() {\n let mostRecentAssistantMessage;\n for (const message of this.messages) {\n if (message.role === \"assistant\") {\n mostRecentAssistantMessage = message;\n }\n }\n\n return mostRecentAssistantMessage?.metadata.unstable_state ?? null;\n }\n\n public readonly composer = new DefaultThreadComposerRuntimeCore(this);\n\n constructor(private readonly _contextProvider: ModelContextProvider) {}\n\n public getModelContext() {\n return this._contextProvider.getModelContext();\n }\n\n private _editComposers = new Map<string, DefaultEditComposerRuntimeCore>();\n public getEditComposer(messageId: string) {\n return this._editComposers.get(messageId);\n }\n public beginEdit(messageId: string) {\n if (this._editComposers.has(messageId))\n throw new Error(\"Edit already in progress\");\n\n this._editComposers.set(\n messageId,\n new DefaultEditComposerRuntimeCore(\n this,\n () => this._editComposers.delete(messageId),\n this.repository.getMessage(messageId),\n ),\n );\n this._notifySubscribers();\n }\n\n public getMessageById(messageId: string) {\n try {\n return this.repository.getMessage(messageId);\n } catch {\n // Check voice messages\n const baseMessages = this.repository.getMessages();\n const voiceIdx = this._voiceMessages.findIndex((m) => m.id === messageId);\n if (voiceIdx !== -1) {\n const parentId =\n voiceIdx > 0\n ? this._voiceMessages[voiceIdx - 1]!.id\n : (baseMessages.at(-1)?.id ?? null);\n return {\n parentId,\n message: this._voiceMessages[voiceIdx]!,\n index: baseMessages.length + voiceIdx,\n };\n }\n return undefined;\n }\n }\n\n public getBranches(messageId: string): string[] {\n if (this._voiceMessages.some((m) => m.id === messageId)) {\n return [];\n }\n return this.repository.getBranches(messageId);\n }\n\n public switchToBranch(branchId: string): void {\n this.repository.switchToBranch(branchId);\n this._notifySubscribers();\n }\n\n protected _notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public _notifyEventSubscribers(event: ThreadRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n\n public submitFeedback({ messageId, type }: SubmitFeedbackOptions) {\n const adapter = this.adapters?.feedback;\n if (!adapter) throw new Error(\"Feedback adapter not configured\");\n\n const { message, parentId } = this.repository.getMessage(messageId);\n adapter.submit({ message, type });\n\n if (message.role === \"assistant\") {\n const updatedMessage: ThreadMessage = {\n ...message,\n metadata: {\n ...message.metadata,\n submittedFeedback: { type },\n },\n };\n this.repository.addOrUpdateMessage(parentId, updatedMessage);\n }\n\n this._notifySubscribers();\n }\n\n private _stopSpeaking: Unsubscribe | undefined;\n public speech: SpeechState | undefined;\n\n public speak(messageId: string) {\n const adapter = this.adapters?.speech;\n if (!adapter) throw new Error(\"Speech adapter not configured\");\n\n const { message } = this.repository.getMessage(messageId);\n\n this._stopSpeaking?.();\n\n const utterance = adapter.speak(getThreadMessageText(message));\n const unsub = utterance.subscribe(() => {\n if (utterance.status.type === \"ended\") {\n this._stopSpeaking = undefined;\n this.speech = undefined;\n } else {\n this.speech = { messageId, status: utterance.status };\n }\n this._notifySubscribers();\n });\n\n this.speech = { messageId, status: utterance.status };\n this._notifySubscribers();\n\n this._stopSpeaking = () => {\n utterance.cancel();\n unsub();\n this.speech = undefined;\n this._stopSpeaking = undefined;\n };\n }\n\n public stopSpeaking() {\n if (!this._stopSpeaking) throw new Error(\"No message is being spoken\");\n this._stopSpeaking();\n this._notifySubscribers();\n }\n\n private _voiceSession: RealtimeVoiceAdapter.Session | undefined;\n private _voiceUnsubs: Array<() => void> = [];\n public voice: VoiceSessionState | undefined;\n\n private _voiceVolume = 0;\n private _voiceVolumeSubscribers = new Set<() => void>();\n\n public getVoiceVolume = () => this._voiceVolume;\n\n public subscribeVoiceVolume = (callback: () => void): Unsubscribe => {\n this._voiceVolumeSubscribers.add(callback);\n return () => this._voiceVolumeSubscribers.delete(callback);\n };\n\n public connectVoice() {\n const adapter = this.adapters?.voice;\n if (!adapter) throw new Error(\"Voice adapter not configured\");\n\n this.disconnectVoice();\n\n const session = adapter.connect({});\n this._voiceSession = session;\n const unsubs: Array<() => void> = [];\n\n let currentMode: RealtimeVoiceAdapter.Mode = \"listening\";\n\n this.voice = {\n status: session.status,\n isMuted: session.isMuted,\n mode: currentMode,\n };\n this._voiceVolume = 0;\n this._notifySubscribers();\n\n unsubs.push(\n session.onStatusChange((status) => {\n if (status.type === \"ended\") {\n this._finishVoiceAssistantMessage();\n this._voiceSession = undefined;\n this.voice = undefined;\n } else {\n this.voice = {\n status,\n isMuted: session.isMuted,\n mode: currentMode,\n };\n }\n this._notifySubscribers();\n }),\n );\n\n unsubs.push(\n session.onModeChange((mode) => {\n currentMode = mode;\n if (this.voice) {\n this.voice = { ...this.voice, mode };\n this._notifySubscribers();\n }\n }),\n );\n\n unsubs.push(\n session.onVolumeChange((volume) => {\n this._voiceVolume = volume;\n for (const cb of this._voiceVolumeSubscribers) cb();\n }),\n );\n\n unsubs.push(\n session.onTranscript((transcript) => {\n this._handleVoiceTranscript(transcript);\n }),\n );\n\n this._voiceUnsubs = unsubs;\n }\n\n private _currentAssistantMsg: ThreadAssistantMessage | null = null;\n\n private _handleVoiceTranscript(\n transcript: RealtimeVoiceAdapter.TranscriptItem,\n ) {\n this.ensureInitialized();\n\n if (transcript.role === \"user\") {\n this._finishVoiceAssistantMessage();\n this._currentAssistantMsg = null;\n\n if (transcript.isFinal) {\n this._voiceMessages.push({\n id: generateId(),\n role: \"user\",\n content: [{ type: \"text\", text: transcript.text }],\n metadata: { custom: {} },\n createdAt: new Date(),\n status: { type: \"complete\", reason: \"unknown\" },\n attachments: [],\n });\n this._markVoiceMessagesDirty();\n this._notifySubscribers();\n }\n } else {\n if (!this._currentAssistantMsg) {\n this._currentAssistantMsg = {\n id: generateId(),\n role: \"assistant\",\n content: [{ type: \"text\", text: transcript.text }],\n metadata: {\n unstable_state: this.state,\n unstable_annotations: [],\n unstable_data: [],\n steps: [],\n custom: {},\n },\n status: { type: \"running\" },\n createdAt: new Date(),\n };\n this._voiceMessages.push(this._currentAssistantMsg);\n } else {\n const idx = this._voiceMessages.indexOf(this._currentAssistantMsg);\n if (idx === -1) return;\n const updated: ThreadAssistantMessage = {\n ...this._currentAssistantMsg,\n content: [{ type: \"text\", text: transcript.text }],\n ...(transcript.isFinal\n ? { status: { type: \"complete\", reason: \"stop\" } }\n : {}),\n };\n this._voiceMessages[idx] = updated;\n this._currentAssistantMsg = updated;\n }\n\n if (transcript.isFinal) {\n this._currentAssistantMsg = null;\n }\n\n this._markVoiceMessagesDirty();\n this._notifySubscribers();\n }\n }\n\n private _finishVoiceAssistantMessage() {\n const last = this._voiceMessages.at(-1);\n if (last?.role === \"assistant\" && last.status.type === \"running\") {\n const idx = this._voiceMessages.length - 1;\n this._voiceMessages[idx] = {\n ...(last as ThreadAssistantMessage),\n status: { type: \"complete\", reason: \"stop\" },\n };\n this._markVoiceMessagesDirty();\n this._notifySubscribers();\n }\n }\n\n public disconnectVoice() {\n this._finishVoiceAssistantMessage();\n this._currentAssistantMsg = null;\n for (const unsub of this._voiceUnsubs) unsub();\n this._voiceUnsubs = [];\n this._voiceSession?.disconnect();\n this._voiceSession = undefined;\n this.voice = undefined;\n this._voiceVolume = 0;\n for (const cb of this._voiceVolumeSubscribers) cb();\n this._voiceMessages = [];\n this._markVoiceMessagesDirty();\n this._notifySubscribers();\n }\n\n public muteVoice() {\n if (!this._voiceSession) throw new Error(\"No active voice session\");\n this._voiceSession.mute();\n this.voice = {\n ...this.voice!,\n isMuted: true,\n };\n this._notifySubscribers();\n }\n\n public unmuteVoice() {\n if (!this._voiceSession) throw new Error(\"No active voice session\");\n this._voiceSession.unmute();\n this.voice = {\n ...this.voice!,\n isMuted: false,\n };\n this._notifySubscribers();\n }\n\n protected ensureInitialized() {\n if (!this._isInitialized) {\n this._isInitialized = true;\n this._notifyEventSubscribers(\"initialize\");\n }\n }\n\n public export() {\n return this.repository.export();\n }\n\n public import(data: ExportedMessageRepository) {\n this.ensureInitialized();\n this.repository.clear();\n this.repository.import(data);\n this._notifySubscribers();\n }\n\n public reset(initialMessages?: readonly ThreadMessageLike[]) {\n this.import(ExportedMessageRepository.fromArray(initialMessages ?? []));\n }\n\n private _eventSubscribers = new Map<\n ThreadRuntimeEventType,\n Set<() => void>\n >();\n\n public unstable_on(event: ThreadRuntimeEventType, callback: () => void) {\n if (event === \"modelContextUpdate\") {\n return this._contextProvider.subscribe?.(callback) ?? (() => {});\n }\n\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event)!;\n subscribers.delete(callback);\n };\n }\n}\n","import { parsePartialJsonObject } from \"assistant-stream/utils\";\nimport { generateId } from \"../../utils/id\";\nimport type {\n ReasoningMessagePart,\n SourceMessagePart,\n ThreadStep,\n MessageStatus,\n ImageMessagePart,\n ThreadMessage,\n ThreadAssistantMessagePart,\n ThreadAssistantMessage,\n ThreadUserMessagePart,\n ThreadUserMessage,\n ThreadSystemMessage,\n FileMessagePart,\n DataMessagePart,\n Unstable_AudioMessagePart,\n} from \"../../types/message\";\nimport type { CompleteAttachment } from \"../../types/attachment\";\nimport type { MessageTiming, TextMessagePart } from \"../../types/message\";\nimport { ReadonlyJSONObject, ReadonlyJSONValue } from \"assistant-stream/utils\";\n\ntype DataPrefixedPart = {\n readonly type: `data-${string}`;\n readonly data: any;\n};\n\nexport type ThreadMessageLike = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly content:\n | string\n | readonly (\n | TextMessagePart\n | ReasoningMessagePart\n | SourceMessagePart\n | ImageMessagePart\n | FileMessagePart\n | DataMessagePart\n | Unstable_AudioMessagePart\n | DataPrefixedPart\n | {\n readonly type: \"tool-call\";\n readonly toolCallId?: string;\n readonly toolName: string;\n readonly args?: ReadonlyJSONObject;\n readonly argsText?: string;\n readonly artifact?: any;\n readonly result?: any | undefined;\n readonly isError?: boolean | undefined;\n readonly parentId?: string | undefined;\n readonly messages?: readonly ThreadMessage[] | undefined;\n }\n )[];\n readonly id?: string | undefined;\n readonly createdAt?: Date | undefined;\n readonly status?: MessageStatus | undefined;\n readonly attachments?:\n | readonly (Omit<CompleteAttachment, \"content\"> & {\n readonly content: readonly (ThreadUserMessagePart | DataPrefixedPart)[];\n })[]\n | undefined;\n readonly metadata?:\n | {\n readonly unstable_state?: ReadonlyJSONValue;\n readonly unstable_annotations?:\n | readonly ReadonlyJSONValue[]\n | undefined;\n readonly unstable_data?: readonly ReadonlyJSONValue[] | undefined;\n readonly steps?: readonly ThreadStep[] | undefined;\n readonly timing?: MessageTiming | undefined;\n readonly submittedFeedback?: { readonly type: \"positive\" | \"negative\" };\n readonly custom?: Record<string, unknown> | undefined;\n }\n | undefined;\n};\n\nconst convertDataPrefixedPart = (\n type: string,\n data: unknown,\n): DataMessagePart | undefined => {\n if (!type.startsWith(\"data-\")) return undefined;\n return { type: \"data\", name: type.substring(5), data };\n};\n\nexport const fromThreadMessageLike = (\n like: ThreadMessageLike,\n fallbackId: string,\n fallbackStatus: MessageStatus,\n): ThreadMessage => {\n const { role, id, createdAt, attachments, status, metadata } = like;\n const common = {\n id: id ?? fallbackId,\n createdAt: createdAt ?? new Date(),\n };\n\n const content =\n typeof like.content === \"string\"\n ? [{ type: \"text\" as const, text: like.content }]\n : like.content;\n\n const sanitizeImageContent = ({\n image,\n ...rest\n }: ImageMessagePart): ImageMessagePart | null => {\n const match = image.match(\n /^data:image\\/(png|jpeg|jpg|gif|webp);base64,(.*)$/,\n );\n if (match) {\n return { ...rest, image };\n }\n console.warn(`Invalid image data format detected`);\n return null;\n };\n\n if (role !== \"user\" && attachments?.length)\n throw new Error(\"attachments are only supported for user messages\");\n\n if (role !== \"assistant\" && status)\n throw new Error(\"status is only supported for assistant messages\");\n\n if (role !== \"assistant\" && metadata?.steps)\n throw new Error(\"metadata.steps is only supported for assistant messages\");\n\n switch (role) {\n case \"assistant\":\n return {\n ...common,\n role,\n content: content\n .map((part): ThreadAssistantMessagePart | null => {\n const type = part.type;\n switch (type) {\n case \"text\":\n case \"reasoning\":\n if (part.text.trim().length === 0) return null;\n return part;\n\n case \"file\":\n case \"source\":\n return part;\n\n case \"image\":\n return sanitizeImageContent(part);\n\n case \"data\":\n return part;\n\n case \"tool-call\": {\n const { parentId, messages, ...basePart } = part;\n const commonProps = {\n ...basePart,\n toolCallId: part.toolCallId ?? `tool-${generateId()}`,\n ...(parentId !== undefined && { parentId }),\n ...(messages !== undefined && { messages }),\n };\n\n if (part.args) {\n return {\n ...commonProps,\n args: part.args,\n argsText: part.argsText ?? JSON.stringify(part.args),\n };\n }\n return {\n ...commonProps,\n args: parsePartialJsonObject(part.argsText ?? \"\") ?? {},\n argsText: part.argsText ?? \"\",\n };\n }\n\n default: {\n const converted = convertDataPrefixedPart(\n type,\n (part as DataPrefixedPart).data,\n );\n if (converted) return converted;\n throw new Error(\n `Unsupported assistant message part type: ${type}`,\n );\n }\n }\n })\n .filter((c) => !!c),\n status: status ?? fallbackStatus,\n metadata: {\n unstable_state: metadata?.unstable_state ?? null,\n unstable_annotations: metadata?.unstable_annotations ?? [],\n unstable_data: metadata?.unstable_data ?? [],\n custom: metadata?.custom ?? {},\n steps: metadata?.steps ?? [],\n ...(metadata?.timing && { timing: metadata.timing }),\n ...(metadata?.submittedFeedback && {\n submittedFeedback: metadata.submittedFeedback,\n }),\n },\n } satisfies ThreadAssistantMessage;\n\n case \"user\":\n return {\n ...common,\n role,\n content: content.map((part): ThreadUserMessagePart => {\n const type = part.type;\n switch (type) {\n case \"text\":\n case \"image\":\n case \"audio\":\n case \"file\":\n case \"data\":\n return part;\n\n default: {\n const converted = convertDataPrefixedPart(\n type,\n (part as DataPrefixedPart).data,\n );\n if (converted) return converted;\n throw new Error(`Unsupported user message part type: ${type}`);\n }\n }\n }),\n attachments: (attachments ?? []).map((att) => ({\n ...att,\n content: att.content.map((part): ThreadUserMessagePart => {\n const converted = convertDataPrefixedPart(\n part.type,\n (part as DataPrefixedPart).data,\n );\n return converted ?? (part as ThreadUserMessagePart);\n }),\n })),\n metadata: {\n custom: metadata?.custom ?? {},\n },\n } satisfies ThreadUserMessage;\n\n case \"system\":\n if (content.length !== 1 || content[0]!.type !== \"text\")\n throw new Error(\n \"System messages must have exactly one text message part.\",\n );\n\n return {\n ...common,\n role,\n content: content as [TextMessagePart],\n metadata: {\n custom: metadata?.custom ?? {},\n },\n } satisfies ThreadSystemMessage;\n\n default: {\n const unsupportedRole: never = role;\n throw new Error(`Unknown message role: ${unsupportedRole}`);\n }\n }\n};\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport {\n LazyMemoizeSubject,\n NestedSubscriptionSubject,\n} from \"../../subscribable/subscribable\";\nimport {\n SKIP_UPDATE,\n ShallowMemoizeSubject,\n} from \"../../subscribable/subscribable\";\nimport type { ThreadListRuntimeCore } from \"../interfaces/thread-list-runtime-core\";\nimport {\n ThreadListItemRuntime,\n ThreadListItemRuntimeImpl,\n ThreadListItemState,\n} from \"./thread-list-item-runtime\";\nimport {\n ThreadListItemRuntimeBinding,\n ThreadRuntime,\n ThreadRuntimeCoreBinding,\n ThreadRuntimeImpl,\n} from \"./thread-runtime\";\n\nexport type ThreadListState = {\n readonly mainThreadId: string;\n readonly newThreadId: string | undefined;\n readonly threadIds: readonly string[];\n readonly archivedThreadIds: readonly string[];\n readonly isLoading: boolean;\n readonly threadItems: Readonly<\n Record<string, Omit<ThreadListItemState, \"isMain\" | \"threadId\">>\n >;\n};\n\nexport type ThreadListRuntime = {\n getState(): ThreadListState;\n\n subscribe(callback: () => void): Unsubscribe;\n\n readonly main: ThreadRuntime;\n getById(threadId: string): ThreadRuntime;\n\n readonly mainItem: ThreadListItemRuntime;\n getItemById(threadId: string): ThreadListItemRuntime;\n getItemByIndex(idx: number): ThreadListItemRuntime;\n getArchivedItemByIndex(idx: number): ThreadListItemRuntime;\n\n switchToThread(threadId: string): Promise<void>;\n switchToNewThread(): Promise<void>;\n};\n\nconst getThreadListState = (\n threadList: ThreadListRuntimeCore,\n): ThreadListState => {\n return {\n mainThreadId: threadList.mainThreadId,\n newThreadId: threadList.newThreadId,\n threadIds: threadList.threadIds,\n archivedThreadIds: threadList.archivedThreadIds,\n isLoading: threadList.isLoading,\n threadItems: threadList.threadItems,\n };\n};\n\nconst getThreadListItemState = (\n threadList: ThreadListRuntimeCore,\n threadId: string | undefined,\n): ThreadListItemState | SKIP_UPDATE => {\n if (threadId === undefined) return SKIP_UPDATE;\n\n const threadData = threadList.getItemById(threadId);\n if (!threadData) return SKIP_UPDATE;\n return {\n id: threadData.id,\n remoteId: threadData.remoteId,\n externalId: threadData.externalId,\n title: threadData.title,\n status: threadData.status,\n isMain: threadData.id === threadList.mainThreadId,\n };\n};\n\nexport type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;\n\nexport class ThreadListRuntimeImpl implements ThreadListRuntime {\n private _getState;\n constructor(\n private _core: ThreadListRuntimeCoreBinding,\n private _runtimeFactory: new (\n binding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) => ThreadRuntime = ThreadRuntimeImpl,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: {},\n getState: () => getThreadListState(_core),\n subscribe: (callback) => _core.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n\n this._mainThreadListItemRuntime = new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: `threadItems[main]`,\n threadSelector: { type: \"main\" },\n },\n getState: () => {\n return getThreadListItemState(this._core, this._core.mainThreadId);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n\n this.main = new _runtimeFactory(\n new NestedSubscriptionSubject({\n path: {\n ref: \"threads.main\",\n threadSelector: { type: \"main\" },\n },\n getState: () => _core.getMainThreadRuntimeCore(),\n subscribe: (callback) => _core.subscribe(callback),\n }),\n this._mainThreadListItemRuntime,\n );\n\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.switchToThread = this.switchToThread.bind(this);\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.getById = this.getById.bind(this);\n this.getItemById = this.getItemById.bind(this);\n this.getItemByIndex = this.getItemByIndex.bind(this);\n this.getArchivedItemByIndex = this.getArchivedItemByIndex.bind(this);\n }\n\n public switchToThread(threadId: string): Promise<void> {\n return this._core.switchToThread(threadId);\n }\n\n public switchToNewThread(): Promise<void> {\n return this._core.switchToNewThread();\n }\n\n public getState(): ThreadListState {\n return this._getState();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n\n private _mainThreadListItemRuntime;\n\n public readonly main: ThreadRuntime;\n\n public get mainItem() {\n return this._mainThreadListItemRuntime;\n }\n\n public getById(threadId: string) {\n return new this._runtimeFactory(\n new NestedSubscriptionSubject({\n path: {\n ref: `threads[threadId=${JSON.stringify(threadId)}]`,\n threadSelector: { type: \"threadId\", threadId },\n },\n getState: () => this._core.getThreadRuntimeCore(threadId),\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this.mainItem,\n );\n }\n\n public getItemByIndex(idx: number) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: `threadItems[${idx}]`,\n threadSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getThreadListItemState(this._core, this._core.threadIds[idx]);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n\n public getArchivedItemByIndex(idx: number) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: `archivedThreadItems[${idx}]`,\n threadSelector: { type: \"archiveIndex\", index: idx },\n },\n getState: () => {\n return getThreadListItemState(\n this._core,\n this._core.archivedThreadIds[idx],\n );\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n\n public getItemById(threadId: string) {\n return new ThreadListItemRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ref: `threadItems[threadId=${threadId}]`,\n threadSelector: { type: \"threadId\", threadId },\n },\n getState: () => {\n return getThreadListItemState(this._core, threadId);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n","import {\n SpeechState,\n SubmittedFeedback,\n} from \"../interfaces/thread-runtime-core\";\nimport { symbolInnerMessage } from \"../utils/external-store-message\";\nimport type {\n ToolCallMessagePartStatus,\n ThreadMessage,\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n} from \"../../types/message\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { MessagePartStatus, RunConfig } from \"../../types/message\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport { NestedSubscriptionSubject } from \"../../subscribable/subscribable\";\nimport {\n SKIP_UPDATE,\n ShallowMemoizeSubject,\n} from \"../../subscribable/subscribable\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n MessageAttachmentRuntimeImpl,\n} from \"./attachment-runtime\";\nimport {\n EditComposerRuntime,\n EditComposerRuntimeImpl,\n} from \"./composer-runtime\";\nimport {\n MessagePartRuntime,\n MessagePartRuntimeImpl,\n MessagePartState,\n} from \"./message-part-runtime\";\nimport { MessageRuntimePath } from \"./paths\";\nimport { ThreadRuntimeCoreBinding } from \"./thread-runtime\";\nimport type { MessageStateBinding } from \"./bindings\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const toMessagePartStatus = (\n message: ThreadMessage,\n partIndex: number,\n part: ThreadUserMessagePart | ThreadAssistantMessagePart,\n): ToolCallMessagePartStatus => {\n if (message.role !== \"assistant\") return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) {\n return message.status as ToolCallMessagePartStatus;\n } else {\n return COMPLETE_STATUS;\n }\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as MessagePartStatus) : COMPLETE_STATUS;\n};\n\nconst getMessagePartState = (\n message: MessageState,\n partIndex: number,\n): MessagePartState | SKIP_UPDATE => {\n const part = message.content[partIndex];\n if (!part) {\n return SKIP_UPDATE;\n }\n\n // if the message part is the same, don't update\n const status = toMessagePartStatus(message, partIndex, part);\n return Object.freeze({\n ...part,\n ...{ [symbolInnerMessage]: (part as any)[symbolInnerMessage] },\n status,\n });\n};\n\nexport type MessageState = ThreadMessage & {\n readonly parentId: string | null;\n /** The position of this message in the thread (0 for first message) */\n readonly index: number;\n readonly isLast: boolean;\n\n readonly branchNumber: number;\n readonly branchCount: number;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n readonly speech: SpeechState | undefined;\n /**\n * @deprecated Use `message.metadata.submittedFeedback` instead. This will be removed in 0.12.0.\n */\n readonly submittedFeedback: SubmittedFeedback | undefined;\n};\n\nexport type { MessageStateBinding } from \"./bindings\";\n\ntype ReloadConfig = {\n runConfig?: RunConfig;\n};\n\nexport type MessageRuntime = {\n readonly path: MessageRuntimePath;\n\n readonly composer: EditComposerRuntime;\n\n getState(): MessageState;\n reload(config?: ReloadConfig): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speak(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n submitFeedback({ type }: { type: \"positive\" | \"negative\" }): void;\n switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }): void;\n unstable_getCopyText(): string;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getMessagePartByIndex(idx: number): MessagePartRuntime;\n getMessagePartByToolCallId(toolCallId: string): MessagePartRuntime;\n\n getAttachmentByIndex(idx: number): AttachmentRuntime & { source: \"message\" };\n};\n\nexport class MessageRuntimeImpl implements MessageRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: MessageStateBinding,\n private _threadBinding: ThreadRuntimeCoreBinding,\n ) {\n this.composer = new EditComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: `${this.path.ref}${this.path.ref}.composer`,\n composerSource: \"edit\",\n },\n getState: this._getEditComposerRuntimeCore,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n () => this._threadBinding.getState().beginEdit(this._core.getState().id),\n );\n\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.reload = this.reload.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.getMessagePartByIndex = this.getMessagePartByIndex.bind(this);\n this.getMessagePartByToolCallId =\n this.getMessagePartByToolCallId.bind(this);\n this.getAttachmentByIndex = this.getAttachmentByIndex.bind(this);\n this.unstable_getCopyText = this.unstable_getCopyText.bind(this);\n this.speak = this.speak.bind(this);\n this.stopSpeaking = this.stopSpeaking.bind(this);\n this.submitFeedback = this.submitFeedback.bind(this);\n this.switchToBranch = this.switchToBranch.bind(this);\n }\n\n public readonly composer;\n\n private _getEditComposerRuntimeCore = () => {\n return this._threadBinding\n .getState()\n .getEditComposer(this._core.getState().id);\n };\n\n public getState() {\n return this._core.getState();\n }\n\n public reload(reloadConfig: ReloadConfig = {}) {\n const editComposerRuntimeCore = this._getEditComposerRuntimeCore();\n const composerRuntimeCore =\n editComposerRuntimeCore ?? this._threadBinding.getState().composer;\n const composer = editComposerRuntimeCore ?? composerRuntimeCore;\n\n const { runConfig = composer.runConfig } = reloadConfig;\n const state = this._core.getState();\n if (state.role !== \"assistant\")\n throw new Error(\"Can only reload assistant messages\");\n\n this._threadBinding.getState().startRun({\n parentId: state.parentId,\n sourceId: state.id,\n runConfig,\n });\n }\n\n public speak() {\n const state = this._core.getState();\n return this._threadBinding.getState().speak(state.id);\n }\n\n public stopSpeaking() {\n const state = this._core.getState();\n const thread = this._threadBinding.getState();\n if (thread.speech?.messageId === state.id) {\n this._threadBinding.getState().stopSpeaking();\n } else {\n throw new Error(\"Message is not being spoken\");\n }\n }\n\n public submitFeedback({ type }: { type: \"positive\" | \"negative\" }) {\n const state = this._core.getState();\n this._threadBinding.getState().submitFeedback({\n messageId: state.id,\n type,\n });\n }\n\n public switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }) {\n const state = this._core.getState();\n if (branchId && position) {\n throw new Error(\"May not specify both branchId and position\");\n } else if (!branchId && !position) {\n throw new Error(\"Must specify either branchId or position\");\n }\n\n const thread = this._threadBinding.getState();\n const branches = thread.getBranches(state.id);\n let targetBranch = branchId;\n if (position === \"previous\") {\n targetBranch = branches[state.branchNumber - 2];\n } else if (position === \"next\") {\n targetBranch = branches[state.branchNumber];\n }\n if (!targetBranch) throw new Error(\"Branch not found\");\n\n this._threadBinding.getState().switchToBranch(targetBranch);\n }\n\n public unstable_getCopyText() {\n return getThreadMessageText(this.getState());\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getMessagePartByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message part index must be >= 0\");\n return new MessagePartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: `${this.path.ref}${this.path.ref}.content[${idx}]`,\n messagePartSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getMessagePartState(this.getState(), idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getMessagePartByToolCallId(toolCallId: string) {\n return new MessagePartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,\n messagePartSelector: { type: \"toolCallId\", toolCallId },\n },\n getState: () => {\n const state = this._core.getState();\n const idx = state.content.findIndex(\n (part) =>\n part.type === \"tool-call\" && part.toolCallId === toolCallId,\n );\n if (idx === -1) return SKIP_UPDATE;\n return getMessagePartState(state, idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getAttachmentByIndex(idx: number) {\n return new MessageAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: `${this.path.ref}${this.path.ref}.attachments[${idx}]`,\n attachmentSource: \"message\",\n attachmentSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments?.[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"message\",\n } satisfies AttachmentState & { source: \"message\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n );\n }\n}\n","import type { Attachment, CreateAttachment } from \"../../types/attachment\";\nimport type { MessageRole } from \"../../types/message\";\nimport type { QuoteInfo } from \"../../types/quote\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { RunConfig } from \"../../types/message\";\nimport {\n LazyMemoizeSubject,\n EventSubscriptionSubject,\n} from \"../../subscribable/subscribable\";\nimport {\n ShallowMemoizeSubject,\n SKIP_UPDATE,\n} from \"../../subscribable/subscribable\";\nimport type {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n DictationState,\n ThreadComposerRuntimeCore,\n} from \"../interfaces/composer-runtime-core\";\nimport type {\n ThreadComposerRuntimeCoreBinding,\n EditComposerRuntimeCoreBinding,\n ComposerRuntimeCoreBinding,\n} from \"./bindings\";\nimport type { ComposerRuntimePath } from \"./paths\";\n\nimport {\n type AttachmentRuntime,\n type AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./attachment-runtime\";\n\nexport type {\n ThreadComposerRuntimeCoreBinding,\n EditComposerRuntimeCoreBinding,\n ComposerRuntimeCoreBinding,\n};\n\ntype BaseComposerState = {\n readonly canCancel: boolean;\n readonly isEditing: boolean;\n readonly isEmpty: boolean;\n\n readonly text: string;\n readonly role: MessageRole;\n readonly attachments: readonly Attachment[];\n readonly runConfig: RunConfig;\n\n readonly attachmentAccept: string;\n\n /**\n * The current state of dictation.\n * Undefined when dictation is not active.\n */\n readonly dictation: DictationState | undefined;\n\n /**\n * The currently quoted text, if any.\n * Undefined when no quote is set.\n */\n readonly quote: QuoteInfo | undefined;\n};\n\nexport type ThreadComposerState = BaseComposerState & {\n readonly type: \"thread\";\n};\n\nexport type EditComposerState = BaseComposerState & {\n readonly type: \"edit\";\n};\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst EMPTY_OBJECT = Object.freeze({});\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n attachmentAccept: runtime?.attachmentAccept ?? \"\",\n dictation: runtime?.dictation,\n quote: runtime?.quote,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n\n text: runtime?.text ?? \"\",\n role: runtime?.role ?? \"user\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n runConfig: runtime?.runConfig ?? EMPTY_OBJECT,\n attachmentAccept: runtime?.attachmentAccept ?? \"\",\n dictation: runtime?.dictation,\n quote: runtime?.quote,\n\n value: runtime?.text ?? \"\",\n });\n};\n\nexport type ComposerRuntime = {\n readonly path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n\n /**\n * Get the current state of the composer. Includes any data that has been added to the composer.\n */\n getState(): ComposerState;\n\n /**\n * Add an attachment to the composer. Accepts either a standard File object\n * (processed through the AttachmentAdapter) or a CreateAttachment descriptor\n * for external-source attachments (URLs, API data, CMS references) that\n * bypasses the adapter entirely.\n * @param fileOrAttachment The file or attachment descriptor to add.\n */\n addAttachment(fileOrAttachment: File | CreateAttachment): Promise<void>;\n\n /**\n * Set the text of the composer.\n * @param text The text to set in the composer.\n */\n setText(text: string): void;\n\n /**\n * Set the role of the composer. For instance, if you'd like a specific message to have the 'assistant' role, you can do so here.\n * @param role The role to set in the composer.\n */\n setRole(role: MessageRole): void;\n\n /**\n * Set the run config of the composer. This is used to send custom configuration data to the model.\n * Within your backend, you can use the `runConfig` object.\n * Example:\n * ```ts\n * composerRuntime.setRunConfig({\n * custom: { customField: \"customValue\" }\n * });\n * ```\n * @param runConfig The run config to set in the composer.\n */\n setRunConfig(runConfig: RunConfig): void;\n\n /**\n * Reset the composer. This will clear the entire state of the composer, including all text and attachments.\n */\n reset(): Promise<void>;\n\n /**\n * Clear all attachments from the composer.\n */\n clearAttachments(): Promise<void>;\n\n /**\n * Send a message. This will send whatever text or attachments are in the composer.\n */\n send(): void;\n\n /**\n * Cancel the current run. In edit mode, this will exit edit mode.\n */\n cancel(): void;\n\n /**\n * Listens for changes to the composer state.\n * @param callback The callback to call when the composer state changes.\n */\n subscribe(callback: () => void): Unsubscribe;\n\n /**\n * Get an attachment by index.\n * @param idx The index of the attachment to get.\n */\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n\n /**\n * Start dictation to convert voice to text input.\n * Requires a DictationAdapter to be configured.\n */\n startDictation(): void;\n\n /**\n * Stop the current dictation session.\n */\n stopDictation(): void;\n\n /**\n * Set a quote for the next message. Pass undefined to clear.\n * @param quote The quote info to set, or undefined to clear.\n */\n setQuote(quote: QuoteInfo | undefined): void;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n unstable_on(\n event: ComposerRuntimeEventType,\n callback: () => void,\n ): Unsubscribe;\n};\n\nexport abstract class ComposerRuntimeImpl implements ComposerRuntime {\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n protected __internal_bindMethods() {\n this.setText = this.setText.bind(this);\n this.setRunConfig = this.setRunConfig.bind(this);\n this.getState = this.getState.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.addAttachment = this.addAttachment.bind(this);\n this.reset = this.reset.bind(this);\n this.clearAttachments = this.clearAttachments.bind(this);\n this.send = this.send.bind(this);\n this.cancel = this.cancel.bind(this);\n this.setRole = this.setRole.bind(this);\n this.getAttachmentByIndex = this.getAttachmentByIndex.bind(this);\n this.startDictation = this.startDictation.bind(this);\n this.stopDictation = this.stopDictation.bind(this);\n this.setQuote = this.setQuote.bind(this);\n this.unstable_on = this.unstable_on.bind(this);\n }\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setRunConfig(runConfig: RunConfig) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRunConfig(runConfig);\n }\n\n public addAttachment(fileOrAttachment: File | CreateAttachment) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(fileOrAttachment);\n }\n\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.reset();\n }\n\n public clearAttachments() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.clearAttachments();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public startDictation() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.startDictation();\n }\n\n public stopDictation() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.stopDictation();\n }\n\n public setQuote(quote: QuoteInfo | undefined) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setQuote(quote);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n private _eventSubscriptionSubjects = new Map<\n string,\n EventSubscriptionSubject<ComposerRuntimeEventType>\n >();\n\n public unstable_on(\n event: ComposerRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventSubscriptionSubjects.get(event);\n if (!subject) {\n subject = new EventSubscriptionSubject({\n event: event,\n binding: this._core,\n });\n this._eventSubscriptionSubjects.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n\n this.__internal_bindMethods();\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n\n this.__internal_bindMethods();\n }\n\n public override __internal_bindMethods() {\n super.__internal_bindMethods();\n this.beginEdit = this.beginEdit.bind(this);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n","import type { AppendMessage, ThreadMessage } from \"../../types/message\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n private _nonTextParts;\n private _previousText;\n private _parentId;\n private _sourceId;\n constructor(\n private runtime: ThreadRuntimeCore & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n private endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this._parentId = parentId;\n this._sourceId = message.id;\n this._previousText = getThreadMessageText(message);\n this.setText(this._previousText);\n\n this.setRole(message.role);\n this.setAttachments(message.attachments ?? []);\n\n this._nonTextParts = message.content.filter((part) => part.type !== \"text\");\n\n this.setRunConfig({ ...runtime.composer.runConfig });\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n ) {\n const text = getThreadMessageText(message as AppendMessage);\n if (text !== this._previousText) {\n this.runtime.append({\n ...message,\n content: [...message.content, ...this._nonTextParts] as any,\n parentId: this._parentId,\n sourceId: this._sourceId,\n });\n }\n\n this.handleCancel();\n }\n\n public handleCancel() {\n this.endEditCallback();\n this._notifySubscribers();\n }\n}\n","import { getDefaultState } from './mutation'\nimport { notifyManager } from './notifyManager'\nimport { Subscribable } from './subscribable'\nimport { hashKey, shallowEqualObjects } from './utils'\nimport type { QueryClient } from './queryClient'\nimport type {\n DefaultError,\n MutateOptions,\n MutationFunctionContext,\n MutationObserverOptions,\n MutationObserverResult,\n} from './types'\nimport type { Action, Mutation } from './mutation'\n\n// TYPES\n\ntype MutationObserverListener<TData, TError, TVariables, TOnMutateResult> = (\n result: MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n) => void\n\n// CLASS\n\nexport class MutationObserver<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends Subscribable<\n MutationObserverListener<TData, TError, TVariables, TOnMutateResult>\n> {\n options!: MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n\n #client: QueryClient\n #currentResult: MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > = undefined!\n #currentMutation?: Mutation<TData, TError, TVariables, TOnMutateResult>\n #mutateOptions?: MutateOptions<TData, TError, TVariables, TOnMutateResult>\n\n constructor(\n client: QueryClient,\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n super()\n\n this.#client = client\n this.setOptions(options)\n this.bindMethods()\n this.#updateResult()\n }\n\n protected bindMethods(): void {\n this.mutate = this.mutate.bind(this)\n this.reset = this.reset.bind(this)\n }\n\n setOptions(\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n const prevOptions = this.options as\n | MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n | undefined\n this.options = this.#client.defaultMutationOptions(options)\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: 'observerOptionsUpdated',\n mutation: this.#currentMutation,\n observer: this,\n })\n }\n\n if (\n prevOptions?.mutationKey &&\n this.options.mutationKey &&\n hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)\n ) {\n this.reset()\n } else if (this.#currentMutation?.state.status === 'pending') {\n this.#currentMutation.setOptions(this.options)\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this)\n }\n }\n\n onMutationUpdate(\n action: Action<TData, TError, TVariables, TOnMutateResult>,\n ): void {\n this.#updateResult()\n\n this.#notify(action)\n }\n\n getCurrentResult(): MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > {\n return this.#currentResult\n }\n\n reset(): void {\n // reset needs to remove the observer from the mutation because there is no way to \"get it back\"\n // another mutate call will yield a new mutation!\n this.#currentMutation?.removeObserver(this)\n this.#currentMutation = undefined\n this.#updateResult()\n this.#notify()\n }\n\n mutate(\n variables: TVariables,\n options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,\n ): Promise<TData> {\n this.#mutateOptions = options\n\n this.#currentMutation?.removeObserver(this)\n\n this.#currentMutation = this.#client\n .getMutationCache()\n .build(this.#client, this.options)\n\n this.#currentMutation.addObserver(this)\n\n return this.#currentMutation.execute(variables)\n }\n\n #updateResult(): void {\n const state =\n this.#currentMutation?.state ??\n getDefaultState<TData, TError, TVariables, TOnMutateResult>()\n\n this.#currentResult = {\n ...state,\n isPending: state.status === 'pending',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset,\n } as MutationObserverResult<TData, TError, TVariables, TOnMutateResult>\n }\n\n #notify(action?: Action<TData, TError, TVariables, TOnMutateResult>): void {\n notifyManager.batch(() => {\n // First trigger the mutate callbacks\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables!\n const onMutateResult = this.#currentResult.context\n\n const context = {\n client: this.#client,\n meta: this.options.meta,\n mutationKey: this.options.mutationKey,\n } satisfies MutationFunctionContext\n\n if (action?.type === 'success') {\n try {\n this.#mutateOptions.onSuccess?.(\n action.data,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n action.data,\n null,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n } else if (action?.type === 'error') {\n try {\n this.#mutateOptions.onError?.(\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n undefined,\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n }\n }\n\n // Then trigger the listeners\n this.listeners.forEach((listener) => {\n listener(this.#currentResult)\n })\n })\n }\n}\n","import { createContext, FC, ReactNode, useContext } from \"react\";\nimport type { ThreadHistoryAdapter } from \"../../adapters/thread-history\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { ModelContextProvider } from \"../../model-context/types\";\n\nexport type RuntimeAdapters = {\n modelContext?: ModelContextProvider | undefined;\n history?: ThreadHistoryAdapter | undefined;\n attachments?: AttachmentAdapter | undefined;\n};\n\nconst RuntimeAdaptersContext = createContext<RuntimeAdapters | null>(null);\n\nexport namespace RuntimeAdapterProvider {\n export type Props = {\n adapters: RuntimeAdapters;\n children: ReactNode;\n };\n}\n\nexport const RuntimeAdapterProvider: FC<RuntimeAdapterProvider.Props> = ({\n adapters,\n children,\n}) => {\n const context = useContext(RuntimeAdaptersContext);\n return (\n <RuntimeAdaptersContext.Provider\n value={{\n ...context,\n ...adapters,\n }}\n >\n {children}\n </RuntimeAdaptersContext.Provider>\n );\n};\n\nexport const useRuntimeAdapters = () => {\n return useContext(RuntimeAdaptersContext);\n};\n","import {\n ThreadSuggestion,\n RuntimeCapabilities,\n ThreadRuntimeCore,\n SpeechState,\n VoiceSessionState,\n ThreadRuntimeEventType,\n StartRunConfig,\n ResumeRunConfig,\n} from \"../interfaces/thread-runtime-core\";\nimport { ExportedMessageRepository } from \"../utils/message-repository\";\nimport { ThreadMessageLike } from \"../utils/thread-message-like\";\nimport {\n MessageRuntime,\n MessageRuntimeImpl,\n MessageState,\n} from \"./message-runtime\";\nimport { NestedSubscriptionSubject } from \"../../subscribable/subscribable\";\nimport {\n ShallowMemoizeSubject,\n SKIP_UPDATE,\n} from \"../../subscribable/subscribable\";\nimport type { SubscribableWithState } from \"../../subscribable/subscribable\";\nimport {\n ThreadComposerRuntime,\n ThreadComposerRuntimeImpl,\n} from \"./composer-runtime\";\nimport {\n MessageRuntimePath,\n ThreadListItemRuntimePath,\n ThreadRuntimePath,\n} from \"./paths\";\nimport type { ThreadListItemState } from \"./bindings\";\nimport type { AppendMessage, ThreadMessage } from \"../../types/message\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { RunConfig } from \"../../types/message\";\nimport { EventSubscriptionSubject } from \"../../subscribable/subscribable\";\nimport { symbolInnerMessage } from \"../utils/external-store-message\";\nimport { ModelContext } from \"../../model-context/types\";\nimport {\n ChatModelRunOptions,\n ChatModelRunResult,\n} from \"../utils/chat-model-adapter\";\nimport { ReadonlyJSONValue } from \"assistant-stream/utils\";\n\nexport type CreateStartRunConfig = {\n parentId: string | null;\n sourceId?: string | null | undefined;\n runConfig?: RunConfig | undefined;\n};\n\nexport type CreateResumeRunConfig = CreateStartRunConfig & {\n stream?: (\n options: ChatModelRunOptions,\n ) => AsyncGenerator<ChatModelRunResult, void, unknown>;\n};\n\nconst toResumeRunConfig = (message: CreateResumeRunConfig): ResumeRunConfig => {\n return {\n parentId: message.parentId ?? null,\n sourceId: message.sourceId ?? null,\n runConfig: message.runConfig ?? {},\n ...(message.stream ? { stream: message.stream } : {}),\n };\n};\n\nconst toStartRunConfig = (message: CreateStartRunConfig): StartRunConfig => {\n return {\n parentId: message.parentId ?? null,\n sourceId: message.sourceId ?? null,\n runConfig: message.runConfig ?? {},\n };\n};\n\nexport type CreateAppendMessage =\n | string\n | {\n parentId?: string | null | undefined;\n sourceId?: string | null | undefined;\n role?: AppendMessage[\"role\"] | undefined;\n content: AppendMessage[\"content\"];\n attachments?: AppendMessage[\"attachments\"] | undefined;\n metadata?: AppendMessage[\"metadata\"] | undefined;\n createdAt?: Date | undefined;\n runConfig?: AppendMessage[\"runConfig\"] | undefined;\n startRun?: boolean | undefined;\n };\n\nconst toAppendMessage = (\n messages: readonly ThreadMessage[],\n message: CreateAppendMessage,\n): AppendMessage => {\n if (typeof message === \"string\") {\n return {\n createdAt: new Date(),\n parentId: messages.at(-1)?.id ?? null,\n sourceId: null,\n runConfig: {},\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n metadata: { custom: {} },\n };\n }\n\n return {\n createdAt: message.createdAt ?? new Date(),\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n sourceId: message.sourceId ?? null,\n role: message.role ?? \"user\",\n content: message.content,\n attachments: message.attachments ?? [],\n metadata: message.metadata ?? { custom: {} },\n runConfig: message.runConfig ?? {},\n startRun: message.startRun,\n } as AppendMessage;\n};\n\nexport type ThreadRuntimeCoreBinding = SubscribableWithState<\n ThreadRuntimeCore,\n ThreadRuntimePath\n> & {\n outerSubscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadListItemRuntimeBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport type ThreadState = {\n /**\n * The thread ID.\n * @deprecated This field is deprecated and will be removed in 0.12.0. Use `useThreadListItem().id` instead.\n */\n readonly threadId: string;\n\n /**\n * The thread metadata.\n *\n * @deprecated Use `useThreadListItem()` instead. This field is deprecated and will be removed in 0.12.0.\n */\n readonly metadata: ThreadListItemState;\n\n /**\n * Whether the thread is disabled. Disabled threads cannot receive new messages.\n */\n readonly isDisabled: boolean;\n\n /**\n * Whether the thread is loading its history.\n */\n readonly isLoading: boolean;\n\n /**\n * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.\n */\n readonly isRunning: boolean;\n\n /**\n * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.\n */\n readonly capabilities: RuntimeCapabilities;\n\n /**\n * The messages in the currently selected branch of the thread.\n */\n readonly messages: readonly ThreadMessage[];\n\n /**\n * The thread state.\n *\n * @deprecated This feature is experimental\n */\n readonly state: ReadonlyJSONValue;\n\n /**\n * Follow up message suggestions to show the user.\n */\n readonly suggestions: readonly ThreadSuggestion[];\n\n /**\n * Custom extra information provided by the runtime.\n */\n readonly extras: unknown;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n readonly speech: SpeechState | undefined;\n\n readonly voice: VoiceSessionState | undefined;\n};\n\nexport const getThreadState = (\n runtime: ThreadRuntimeCore,\n threadListItemState: ThreadListItemState,\n): ThreadState => {\n const lastMessage = runtime.messages.at(-1);\n return Object.freeze({\n threadId: threadListItemState.id,\n metadata: threadListItemState,\n capabilities: runtime.capabilities,\n isDisabled: runtime.isDisabled,\n isLoading: runtime.isLoading,\n isRunning:\n lastMessage?.role !== \"assistant\"\n ? false\n : lastMessage.status.type === \"running\",\n messages: runtime.messages,\n state: runtime.state,\n suggestions: runtime.suggestions,\n extras: runtime.extras,\n speech: runtime.speech,\n voice: runtime.voice,\n });\n};\n\nexport type ThreadRuntime = {\n /**\n * The selector for the thread runtime.\n */\n readonly path: ThreadRuntimePath;\n\n /**\n * The thread composer runtime.\n */\n readonly composer: ThreadComposerRuntime;\n\n /**\n * Gets a snapshot of the thread state.\n */\n getState(): ThreadState;\n\n /**\n * Append a new message to the thread.\n *\n * @example ```ts\n * // append a new user message with the text \"Hello, world!\"\n * threadRuntime.append(\"Hello, world!\");\n * ```\n *\n * @example ```ts\n * // append a new assistant message with the text \"Hello, world!\"\n * threadRuntime.append({\n * role: \"assistant\",\n * content: [{ type: \"text\", text: \"Hello, world!\" }],\n * });\n * ```\n */\n append(message: CreateAppendMessage): void;\n\n /**\n * @deprecated pass an object with `parentId` instead. This will be removed in 0.12.0.\n */\n startRun(parentId: string | null): void;\n /**\n * Start a new run with the given configuration.\n * @param config The configuration for starting the run\n */\n startRun(config: CreateStartRunConfig): void;\n\n /**\n * Resume a run with the given configuration.\n * @param config The configuration for resuming the run\n **/\n resumeRun(config: CreateResumeRunConfig): void;\n\n /**\n * @deprecated Use `resumeRun` instead.\n */\n unstable_resumeRun(config: CreateResumeRunConfig): void;\n\n /**\n * Export the thread state in the external store format.\n * For AI SDK runtimes, this returns the AI SDK message format.\n * For other runtimes, this may return different formats or throw an error.\n * @returns The thread state in the external format (typed as any)\n */\n exportExternalState(): any;\n\n /**\n * Import thread state from the external store format.\n * For AI SDK runtimes, this accepts AI SDK messages.\n * For other runtimes, this may accept different formats or throw an error.\n * @param state The thread state in the external format (typed as any)\n */\n importExternalState(state: any): void;\n\n /**\n * Load external state into the thread.\n * @deprecated Use importExternalState instead. This method will be removed in 0.12.0.\n * @param state The state to load into the thread\n */\n unstable_loadExternalState(state: any): void;\n\n subscribe(callback: () => void): Unsubscribe;\n cancelRun(): void;\n getModelContext(): ModelContext;\n\n /**\n * @deprecated This method was renamed to `getModelContext`.\n */\n getModelConfig(): ModelContext;\n\n export(): ExportedMessageRepository;\n import(repository: ExportedMessageRepository): void;\n\n /**\n * Reset the thread with optional initial messages.\n *\n * @param initialMessages - Optional array of initial messages to populate the thread\n */\n reset(initialMessages?: readonly ThreadMessageLike[]): void;\n\n getMessageByIndex(idx: number): MessageRuntime;\n getMessageById(messageId: string): MessageRuntime;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n\n connectVoice(): void;\n disconnectVoice(): void;\n getVoiceVolume(): number;\n subscribeVoiceVolume(callback: () => void): Unsubscribe;\n muteVoice(): void;\n unmuteVoice(): void;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n};\n\nexport class ThreadRuntimeImpl implements ThreadRuntime {\n public get path() {\n return this._threadBinding.path;\n }\n\n public get __internal_threadBinding() {\n return this._threadBinding;\n }\n\n private readonly _threadBinding: ThreadRuntimeCoreBinding & {\n getStateState(): ThreadState;\n };\n\n constructor(\n threadBinding: ThreadRuntimeCoreBinding,\n threadListItemBinding: ThreadListItemRuntimeBinding,\n ) {\n const stateBinding = new ShallowMemoizeSubject({\n path: threadBinding.path,\n getState: () =>\n getThreadState(\n threadBinding.getState(),\n threadListItemBinding.getState(),\n ),\n subscribe: (callback) => {\n const sub1 = threadBinding.subscribe(callback);\n const sub2 = threadListItemBinding.subscribe(callback);\n return () => {\n sub1();\n sub2();\n };\n },\n });\n\n this._threadBinding = {\n path: threadBinding.path,\n getState: () => threadBinding.getState(),\n getStateState: () => stateBinding.getState(),\n outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),\n subscribe: (callback) => threadBinding.subscribe(callback),\n };\n\n this.composer = new ThreadComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: `${this.path.ref}.composer`,\n composerSource: \"thread\",\n },\n getState: () => this._threadBinding.getState().composer,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n );\n\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.append = this.append.bind(this);\n this.resumeRun = this.resumeRun.bind(this);\n this.unstable_resumeRun = this.unstable_resumeRun.bind(this);\n this.unstable_loadExternalState =\n this.unstable_loadExternalState.bind(this);\n this.importExternalState = this.importExternalState.bind(this);\n this.exportExternalState = this.exportExternalState.bind(this);\n this.startRun = this.startRun.bind(this);\n this.cancelRun = this.cancelRun.bind(this);\n this.stopSpeaking = this.stopSpeaking.bind(this);\n this.connectVoice = this.connectVoice.bind(this);\n this.disconnectVoice = this.disconnectVoice.bind(this);\n this.muteVoice = this.muteVoice.bind(this);\n this.unmuteVoice = this.unmuteVoice.bind(this);\n this.getVoiceVolume = this.getVoiceVolume.bind(this);\n this.subscribeVoiceVolume = this.subscribeVoiceVolume.bind(this);\n this.export = this.export.bind(this);\n this.import = this.import.bind(this);\n this.reset = this.reset.bind(this);\n this.getMessageByIndex = this.getMessageByIndex.bind(this);\n this.getMessageById = this.getMessageById.bind(this);\n this.subscribe = this.subscribe.bind(this);\n this.unstable_on = this.unstable_on.bind(this);\n this.getModelContext = this.getModelContext.bind(this);\n this.getModelConfig = this.getModelConfig.bind(this);\n this.getState = this.getState.bind(this);\n }\n\n public readonly composer;\n\n public getState() {\n return this._threadBinding.getStateState();\n }\n\n public append(message: CreateAppendMessage) {\n this._threadBinding\n .getState()\n .append(\n toAppendMessage(this._threadBinding.getState().messages, message),\n );\n }\n\n public subscribe(callback: () => void) {\n return this._threadBinding.subscribe(callback);\n }\n\n public getModelContext() {\n return this._threadBinding.getState().getModelContext();\n }\n\n public getModelConfig() {\n return this.getModelContext();\n }\n\n public startRun(configOrParentId: string | null | CreateStartRunConfig) {\n const config =\n configOrParentId === null || typeof configOrParentId === \"string\"\n ? { parentId: configOrParentId }\n : configOrParentId;\n return this._threadBinding.getState().startRun(toStartRunConfig(config));\n }\n\n public resumeRun(config: CreateResumeRunConfig) {\n return this._threadBinding.getState().resumeRun(toResumeRunConfig(config));\n }\n\n /** @deprecated Use `resumeRun` instead. */\n public unstable_resumeRun(config: CreateResumeRunConfig) {\n return this.resumeRun(config);\n }\n\n public exportExternalState() {\n return this._threadBinding.getState().exportExternalState();\n }\n\n public importExternalState(state: any) {\n this._threadBinding.getState().importExternalState(state);\n }\n\n public unstable_loadExternalState(state: any) {\n this._threadBinding.getState().unstable_loadExternalState(state);\n }\n\n public cancelRun() {\n this._threadBinding.getState().cancelRun();\n }\n\n public stopSpeaking() {\n return this._threadBinding.getState().stopSpeaking();\n }\n\n public connectVoice() {\n this._threadBinding.getState().connectVoice();\n }\n\n public disconnectVoice() {\n this._threadBinding.getState().disconnectVoice();\n }\n\n public getVoiceVolume() {\n return this._threadBinding.getState().getVoiceVolume();\n }\n\n public subscribeVoiceVolume(callback: () => void) {\n return this._threadBinding.getState().subscribeVoiceVolume(callback);\n }\n\n public muteVoice() {\n this._threadBinding.getState().muteVoice();\n }\n\n public unmuteVoice() {\n this._threadBinding.getState().unmuteVoice();\n }\n\n public export() {\n return this._threadBinding.getState().export();\n }\n\n public import(data: ExportedMessageRepository) {\n this._threadBinding.getState().import(data);\n }\n\n public reset(initialMessages?: readonly ThreadMessageLike[]) {\n this._threadBinding.getState().reset(initialMessages);\n }\n\n public getMessageByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message index must be >= 0\");\n\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: `${this.path.ref}.messages[${idx}]`,\n messageSelector: { type: \"index\", index: idx },\n },\n () => {\n const messages = this._threadBinding.getState().messages;\n const message = messages[idx];\n if (!message) return undefined;\n return {\n message,\n parentId: messages[idx - 1]?.id ?? null,\n index: idx,\n };\n },\n );\n }\n\n public getMessageById(messageId: string) {\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,\n messageSelector: { type: \"messageId\", messageId: messageId },\n },\n () => this._threadBinding.getState().getMessageById(messageId),\n );\n }\n\n private _getMessageRuntime(\n path: MessageRuntimePath,\n callback: () =>\n | { parentId: string | null; message: ThreadMessage; index: number }\n | undefined,\n ) {\n return new MessageRuntimeImpl(\n new ShallowMemoizeSubject({\n path,\n getState: () => {\n const { message, parentId, index } = callback() ?? {};\n\n const { messages, speech: speechState } =\n this._threadBinding.getState();\n\n if (!message || parentId === undefined || index === undefined)\n return SKIP_UPDATE;\n\n const thread = this._threadBinding.getState();\n\n const branches = thread.getBranches(message.id);\n const submittedFeedback = message.metadata.submittedFeedback;\n\n return {\n ...message,\n ...{ [symbolInnerMessage]: (message as any)[symbolInnerMessage] },\n\n index,\n isLast: messages.at(-1)?.id === message.id,\n parentId,\n\n branchNumber: branches.indexOf(message.id) + 1,\n branchCount: branches.length,\n\n speech:\n speechState?.messageId === message.id ? speechState : undefined,\n\n submittedFeedback,\n } satisfies MessageState;\n },\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n this._threadBinding,\n );\n }\n\n private _eventSubscriptionSubjects = new Map<\n string,\n EventSubscriptionSubject<ThreadRuntimeEventType>\n >();\n\n public unstable_on(\n event: ThreadRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventSubscriptionSubjects.get(event);\n if (!subject) {\n subject = new EventSubscriptionSubject({\n event: event,\n binding: this._threadBinding,\n });\n this._eventSubscriptionSubjects.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n}\n","import type { ThreadMessage } from \"../../types/message\";\n\nexport const symbolInnerMessage = Symbol(\"innerMessage\");\nconst symbolInnerMessages = Symbol(\"innerMessages\");\n\ntype WithInnerMessages<T> = {\n [symbolInnerMessage]?: T | T[];\n [symbolInnerMessages]?: T[];\n};\n\n/**\n * @deprecated Use `getExternalStoreMessages` (plural) instead. This function will be removed in 0.12.0.\n */\nexport const getExternalStoreMessage = <T>(input: ThreadMessage) => {\n const withInnerMessages = input as WithInnerMessages<T>;\n return withInnerMessages[symbolInnerMessage];\n};\n\nconst EMPTY_ARRAY: never[] = [];\n\n/**\n * Attach the original external store message(s) to a ThreadMessage or message part.\n * This is a no-op if the target already has a bound message.\n * Use `getExternalStoreMessages` to retrieve the bound messages later.\n *\n * @deprecated This API is experimental and may change without notice.\n */\nexport const bindExternalStoreMessage = <T>(\n target: object,\n message: T | T[],\n): void => {\n if (symbolInnerMessage in target) return;\n (target as WithInnerMessages<T>)[symbolInnerMessage] = message;\n};\n\nexport const getExternalStoreMessages = <T>(\n input:\n | { messages: readonly ThreadMessage[] }\n | ThreadMessage\n | ThreadMessage[\"content\"][number],\n) => {\n const container = (\n \"messages\" in input ? input.messages : input\n ) as WithInnerMessages<T>;\n const value = container[symbolInnerMessages] || container[symbolInnerMessage];\n if (!value) return EMPTY_ARRAY;\n if (Array.isArray(value)) {\n return value;\n }\n container[symbolInnerMessages] = [value];\n return container[symbolInnerMessages];\n};\n","import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { ModelContextProvider } from \"../../model-context/types\";\nimport type { AssistantRuntimeCore } from \"../interfaces/assistant-runtime-core\";\nimport type { ThreadRuntime } from \"./thread-runtime\";\nimport {\n ThreadListRuntime,\n ThreadListRuntimeImpl,\n} from \"./thread-list-runtime\";\nimport { ExportedMessageRepository } from \"../utils/message-repository\";\nimport type { ThreadMessageLike } from \"../utils/thread-message-like\";\n\nexport type AssistantRuntime = {\n /**\n * The threads in this assistant.\n */\n readonly threads: ThreadListRuntime;\n\n /**\n * The currently selected main thread. Equivalent to `threads.main`.\n */\n readonly thread: ThreadRuntime;\n\n /**\n * @deprecated This field was renamed to `threads`.\n */\n readonly threadList: ThreadListRuntime;\n\n /**\n * Switch to a new thread.\n *\n * @deprecated This method was moved to `threads.switchToNewThread`.\n */\n switchToNewThread(): void;\n\n /**\n * Switch to a thread.\n *\n * @param threadId The thread ID to switch to.\n * @deprecated This method was moved to `threads.switchToThread`.\n */\n switchToThread(threadId: string): void;\n\n /**\n * Register a model context provider. Model context providers are configuration such as system message, temperature, etc. that are set in the frontend.\n *\n * @param provider The model context provider to register.\n */\n registerModelContextProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated This method was renamed to `registerModelContextProvider`.\n */\n registerModelConfigProvider(provider: ModelContextProvider): Unsubscribe;\n\n /**\n * @deprecated Use `runtime.thread.reset(initialMessages)`.\n */\n reset: unknown; // make it a type error\n};\n\nexport class AssistantRuntimeImpl implements AssistantRuntime {\n public readonly threads;\n public get threadList() {\n return this.threads;\n }\n\n public readonly _thread: ThreadRuntime;\n\n public constructor(private readonly _core: AssistantRuntimeCore) {\n this.threads = new ThreadListRuntimeImpl(_core.threads);\n this._thread = this.threads.main;\n\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.switchToNewThread = this.switchToNewThread.bind(this);\n this.switchToThread = this.switchToThread.bind(this);\n this.registerModelContextProvider =\n this.registerModelContextProvider.bind(this);\n this.registerModelConfigProvider =\n this.registerModelConfigProvider.bind(this);\n this.reset = this.reset.bind(this);\n }\n\n public get thread() {\n return this._thread;\n }\n\n public switchToNewThread() {\n return this._core.threads.switchToNewThread();\n }\n\n public switchToThread(threadId: string) {\n return this._core.threads.switchToThread(threadId);\n }\n\n public registerModelContextProvider(provider: ModelContextProvider) {\n return this._core.registerModelContextProvider(provider);\n }\n\n public registerModelConfigProvider(provider: ModelContextProvider) {\n return this.registerModelContextProvider(provider);\n }\n\n public reset({\n initialMessages,\n }: {\n initialMessages?: ThreadMessageLike[];\n } = {}) {\n return this._core.threads\n .getMainThreadRuntimeCore()\n .import(ExportedMessageRepository.fromArray(initialMessages ?? []));\n }\n}\n","import type {\n Attachment,\n PendingAttachment,\n CompleteAttachment,\n} from \"../types/attachment\";\n\n// =============================================================================\n// Adapter Type\n// =============================================================================\n\nexport type AttachmentAdapter = {\n accept: string;\n add(state: {\n file: File;\n }): Promise<PendingAttachment> | AsyncGenerator<PendingAttachment, void>;\n remove(attachment: Attachment): Promise<void>;\n send(attachment: PendingAttachment): Promise<CompleteAttachment>;\n};\n\n// =============================================================================\n// Simple Image Attachment Adapter\n// =============================================================================\n\nexport class SimpleImageAttachmentAdapter implements AttachmentAdapter {\n public accept = \"image/*\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"image\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"image\",\n image: await getFileDataURL(attachment.file),\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileDataURL = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsDataURL(file);\n });\n\n// =============================================================================\n// Simple Text Attachment Adapter\n// =============================================================================\n\nexport class SimpleTextAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type,\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [\n {\n type: \"text\",\n text: `<attachment name=${attachment.name}>\\n${await getFileText(attachment.file)}\\n</attachment>`,\n },\n ],\n };\n }\n\n public async remove() {\n // noop\n }\n}\n\nconst getFileText = (file: File) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n reader.readAsText(file);\n });\n\n// =============================================================================\n// Composite Attachment Adapter\n// =============================================================================\n\nexport function fileMatchesAccept(\n file: { name: string; type: string },\n acceptString: string,\n) {\n if (acceptString === \"*\") {\n return true;\n }\n\n const allowedTypes = acceptString\n .split(\",\")\n .map((type) => type.trim().toLowerCase());\n\n const fileExtension = `.${file.name.split(\".\").pop()!.toLowerCase()}`;\n const fileMimeType = file.type.toLowerCase();\n\n for (const type of allowedTypes) {\n if (type.startsWith(\".\") && type === fileExtension) {\n return true;\n }\n\n if (type.includes(\"/\") && type === fileMimeType) {\n return true;\n }\n\n if (type.endsWith(\"/*\")) {\n const generalType = type.split(\"/\")[0]!;\n if (fileMimeType.startsWith(`${generalType}/`)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\nexport class CompositeAttachmentAdapter implements AttachmentAdapter {\n private _adapters: AttachmentAdapter[];\n\n public accept: string;\n\n constructor(adapters: AttachmentAdapter[]) {\n this._adapters = adapters;\n\n const wildcardIdx = adapters.findIndex((a) => a.accept === \"*\");\n if (wildcardIdx !== -1) {\n if (wildcardIdx !== adapters.length - 1)\n throw new Error(\n \"A wildcard adapter (handling all files) can only be specified as the last adapter.\",\n );\n\n this.accept = \"*\";\n } else {\n this.accept = adapters.map((a) => a.accept).join(\",\");\n }\n }\n\n public add(state: { file: File }) {\n for (const adapter of this._adapters) {\n if (fileMatchesAccept(state.file, adapter.accept)) {\n return adapter.add(state);\n }\n }\n throw new Error(\"No matching adapter found for file\");\n }\n\n public async send(attachment: PendingAttachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (fileMatchesAccept(attachment.file, adapter.accept)) {\n return adapter.send(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n\n public async remove(attachment: Attachment) {\n const adapters = this._adapters.slice();\n for (const adapter of adapters) {\n if (\n fileMatchesAccept(\n {\n name: attachment.name,\n type: attachment.contentType ?? \"\",\n },\n adapter.accept,\n )\n ) {\n return adapter.remove(attachment);\n }\n }\n throw new Error(\"No matching adapter found for attachment\");\n }\n}\n","// LICENSE for this file only\n\n// MIT License\n\n// Copyright (c) 2025 AgentbaseAI Inc.\n// Copyright (c) 2023 Lars Grammel\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\ntype State =\n | \"ROOT\"\n | \"FINISH\"\n | \"INSIDE_STRING\"\n | \"INSIDE_STRING_ESCAPE\"\n | \"INSIDE_LITERAL\"\n | \"INSIDE_NUMBER\"\n | \"INSIDE_OBJECT_START\"\n | \"INSIDE_OBJECT_KEY\"\n | \"INSIDE_OBJECT_AFTER_KEY\"\n | \"INSIDE_OBJECT_BEFORE_VALUE\"\n | \"INSIDE_OBJECT_AFTER_VALUE\"\n | \"INSIDE_OBJECT_AFTER_COMMA\"\n | \"INSIDE_ARRAY_START\"\n | \"INSIDE_ARRAY_AFTER_VALUE\"\n | \"INSIDE_ARRAY_AFTER_COMMA\";\n\n// Implemented as a scanner with additional fixing\n// that performs a single linear time scan pass over the partial JSON.\n//\n// The states should ideally match relevant states from the JSON spec:\n// https://www.json.org/json-en.html\n//\n// Please note that invalid JSON is not considered/covered, because it\n// is assumed that the resulting JSON will be processed by a standard\n// JSON parser that will detect any invalid JSON.\n\n// Returns a tuple of [fixedJson, partialPath]\n// partialPath is an array of object/array keys that represent\n// the currently partial values. An object is considered partial\n// if through appending extra characters to the JSON string, its\n// value could change.\n\n// Example input: '{\"foo\":[{\"a\":f'\n// Example output: ['{\"foo\":[{\"a\":false}]}', ['foo', '0']]\n// Example input: '{\"foo\":'\n// Example output: ['{}', []]\n\nexport function fixJson(input: string): [string, string[]] {\n const stack: State[] = [\"ROOT\"];\n let lastValidIndex = -1;\n let literalStart: number | null = null;\n const path: string[] = [];\n let currentKey: string | undefined;\n\n function pushCurrentKeyToPath(): void {\n if (currentKey !== undefined) {\n path.push(JSON.parse(`\"${currentKey}\"`));\n currentKey = undefined;\n }\n }\n\n function processValueStart(char: string, i: number, swapState: State) {\n switch (char) {\n case '\"': {\n lastValidIndex = i;\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_STRING\");\n\n pushCurrentKeyToPath();\n break;\n }\n\n case \"f\":\n case \"t\":\n case \"n\": {\n lastValidIndex = i;\n literalStart = i;\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_LITERAL\");\n break;\n }\n\n case \"-\": {\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_NUMBER\");\n\n pushCurrentKeyToPath();\n break;\n }\n case \"0\":\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\": {\n lastValidIndex = i;\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_NUMBER\");\n\n pushCurrentKeyToPath();\n break;\n }\n\n case \"{\": {\n lastValidIndex = i;\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_OBJECT_START\");\n\n pushCurrentKeyToPath();\n break;\n }\n\n case \"[\": {\n lastValidIndex = i;\n stack.pop();\n stack.push(swapState);\n stack.push(\"INSIDE_ARRAY_START\");\n\n pushCurrentKeyToPath();\n break;\n }\n }\n }\n\n function processAfterObjectValue(char: string, i: number) {\n switch (char) {\n case \",\": {\n stack.pop();\n stack.push(\"INSIDE_OBJECT_AFTER_COMMA\");\n break;\n }\n case \"}\": {\n lastValidIndex = i;\n stack.pop();\n currentKey = path.pop();\n break;\n }\n }\n }\n\n function processAfterArrayValue(char: string, i: number) {\n switch (char) {\n case \",\": {\n stack.pop();\n stack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n currentKey = (Number(currentKey) + 1).toString();\n break;\n }\n case \"]\": {\n lastValidIndex = i;\n stack.pop();\n currentKey = path.pop();\n break;\n }\n }\n }\n\n for (let i = 0; i < input.length; i++) {\n const char = input[i]!;\n const currentState = stack[stack.length - 1];\n\n switch (currentState) {\n case \"ROOT\":\n processValueStart(char, i, \"FINISH\");\n break;\n\n case \"INSIDE_OBJECT_START\": {\n switch (char) {\n case '\"': {\n stack.pop();\n stack.push(\"INSIDE_OBJECT_KEY\");\n currentKey = \"\";\n break;\n }\n case \"}\": {\n lastValidIndex = i;\n stack.pop();\n currentKey = path.pop();\n break;\n }\n }\n break;\n }\n\n case \"INSIDE_OBJECT_AFTER_COMMA\": {\n switch (char) {\n case '\"': {\n stack.pop();\n stack.push(\"INSIDE_OBJECT_KEY\");\n currentKey = \"\";\n break;\n }\n }\n break;\n }\n\n case \"INSIDE_OBJECT_KEY\": {\n switch (char) {\n case '\"': {\n stack.pop();\n stack.push(\"INSIDE_OBJECT_AFTER_KEY\");\n break;\n }\n case \"\\\\\": {\n stack.push(\"INSIDE_STRING_ESCAPE\");\n currentKey += char;\n break;\n }\n default: {\n currentKey += char;\n break;\n }\n }\n break;\n }\n\n case \"INSIDE_OBJECT_AFTER_KEY\": {\n switch (char) {\n case \":\": {\n stack.pop();\n stack.push(\"INSIDE_OBJECT_BEFORE_VALUE\");\n\n break;\n }\n }\n break;\n }\n\n case \"INSIDE_OBJECT_BEFORE_VALUE\": {\n processValueStart(char, i, \"INSIDE_OBJECT_AFTER_VALUE\");\n break;\n }\n\n case \"INSIDE_OBJECT_AFTER_VALUE\": {\n processAfterObjectValue(char, i);\n break;\n }\n\n case \"INSIDE_STRING\": {\n switch (char) {\n case '\"': {\n stack.pop();\n lastValidIndex = i;\n\n currentKey = path.pop();\n break;\n }\n\n case \"\\\\\": {\n stack.push(\"INSIDE_STRING_ESCAPE\");\n break;\n }\n\n default: {\n lastValidIndex = i;\n }\n }\n\n break;\n }\n\n case \"INSIDE_ARRAY_START\": {\n switch (char) {\n case \"]\": {\n lastValidIndex = i;\n stack.pop();\n currentKey = path.pop();\n break;\n }\n\n default: {\n lastValidIndex = i;\n currentKey = \"0\";\n processValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n break;\n }\n }\n break;\n }\n\n case \"INSIDE_ARRAY_AFTER_VALUE\": {\n switch (char) {\n case \",\": {\n stack.pop();\n stack.push(\"INSIDE_ARRAY_AFTER_COMMA\");\n\n currentKey = (Number(currentKey) + 1).toString();\n break;\n }\n\n case \"]\": {\n lastValidIndex = i;\n stack.pop();\n currentKey = path.pop();\n break;\n }\n\n default: {\n lastValidIndex = i;\n break;\n }\n }\n\n break;\n }\n\n case \"INSIDE_ARRAY_AFTER_COMMA\": {\n processValueStart(char, i, \"INSIDE_ARRAY_AFTER_VALUE\");\n break;\n }\n\n case \"INSIDE_STRING_ESCAPE\": {\n stack.pop();\n\n if (stack[stack.length - 1] === \"INSIDE_STRING\") {\n lastValidIndex = i;\n } else if (stack[stack.length - 1] === \"INSIDE_OBJECT_KEY\") {\n currentKey += char;\n }\n\n break;\n }\n\n case \"INSIDE_NUMBER\": {\n switch (char) {\n case \"0\":\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\": {\n lastValidIndex = i;\n break;\n }\n\n case \"e\":\n case \"E\":\n case \"-\":\n case \".\": {\n break;\n }\n\n case \",\": {\n stack.pop();\n currentKey = path.pop();\n\n if (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") {\n processAfterArrayValue(char, i);\n }\n\n if (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") {\n processAfterObjectValue(char, i);\n }\n\n break;\n }\n\n case \"}\": {\n stack.pop();\n currentKey = path.pop();\n\n if (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") {\n processAfterObjectValue(char, i);\n }\n\n break;\n }\n\n case \"]\": {\n stack.pop();\n currentKey = path.pop();\n\n if (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") {\n processAfterArrayValue(char, i);\n }\n\n break;\n }\n\n default: {\n stack.pop();\n currentKey = path.pop();\n break;\n }\n }\n\n break;\n }\n\n case \"INSIDE_LITERAL\": {\n const partialLiteral = input.substring(literalStart!, i + 1);\n\n if (\n !\"false\".startsWith(partialLiteral) &&\n !\"true\".startsWith(partialLiteral) &&\n !\"null\".startsWith(partialLiteral)\n ) {\n stack.pop();\n\n if (stack[stack.length - 1] === \"INSIDE_OBJECT_AFTER_VALUE\") {\n processAfterObjectValue(char, i);\n } else if (stack[stack.length - 1] === \"INSIDE_ARRAY_AFTER_VALUE\") {\n processAfterArrayValue(char, i);\n }\n } else {\n lastValidIndex = i;\n }\n\n break;\n }\n }\n }\n\n let result = input.slice(0, lastValidIndex + 1);\n\n for (let i = stack.length - 1; i >= 0; i--) {\n const state = stack[i];\n\n switch (state) {\n case \"INSIDE_STRING\": {\n result += '\"';\n break;\n }\n\n case \"INSIDE_OBJECT_KEY\":\n case \"INSIDE_OBJECT_AFTER_KEY\":\n case \"INSIDE_OBJECT_AFTER_COMMA\":\n case \"INSIDE_OBJECT_START\":\n case \"INSIDE_OBJECT_BEFORE_VALUE\":\n case \"INSIDE_OBJECT_AFTER_VALUE\": {\n result += \"}\";\n break;\n }\n\n case \"INSIDE_ARRAY_START\":\n case \"INSIDE_ARRAY_AFTER_COMMA\":\n case \"INSIDE_ARRAY_AFTER_VALUE\": {\n result += \"]\";\n break;\n }\n\n case \"INSIDE_LITERAL\": {\n const partialLiteral = input.substring(literalStart!, input.length);\n\n if (\"true\".startsWith(partialLiteral)) {\n result += \"true\".slice(partialLiteral.length);\n } else if (\"false\".startsWith(partialLiteral)) {\n result += \"false\".slice(partialLiteral.length);\n } else if (\"null\".startsWith(partialLiteral)) {\n result += \"null\".slice(partialLiteral.length);\n }\n }\n }\n }\n\n return [result, path];\n}\n","import type { AppendMessage } from \"../../types/message\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type { ThreadComposerRuntimeCore } from \"../interfaces/composer-runtime-core\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n private _canCancel = false;\n public get canCancel() {\n return this._canCancel;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n ) {\n super();\n this.connect();\n }\n\n public connect() {\n return this.runtime.subscribe(() => {\n if (this.canCancel !== this.runtime.capabilities.cancel) {\n this._canCancel = this.runtime.capabilities.cancel;\n this._notifySubscribers();\n }\n });\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n ) {\n this.runtime.append({\n ...(message as AppendMessage),\n parentId: this.runtime.messages.at(-1)?.id ?? null,\n sourceId: null,\n });\n }\n\n public async handleCancel() {\n this.runtime.cancelRun();\n }\n}\n","import type { Attachment, CompleteAttachment } from \"../../types/attachment\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { SubscribableWithState } from \"../../subscribable/subscribable\";\n\nimport type { ComposerRuntimeCoreBinding } from \"./bindings\";\nimport type { AttachmentRuntimePath } from \"./paths\";\n\ntype MessageAttachmentState = CompleteAttachment & {\n readonly source: \"message\";\n};\n\ntype ThreadComposerAttachmentState = Attachment & {\n readonly source: \"thread-composer\";\n};\n\ntype EditComposerAttachmentState = Attachment & {\n readonly source: \"edit-composer\";\n};\n\nexport type AttachmentState =\n | ThreadComposerAttachmentState\n | EditComposerAttachmentState\n | MessageAttachmentState;\n\ntype AttachmentSnapshotBinding<Source extends AttachmentRuntimeSource> =\n SubscribableWithState<\n AttachmentState & { source: Source },\n AttachmentRuntimePath & { attachmentSource: Source }\n >;\n\ntype AttachmentRuntimeSource = AttachmentState[\"source\"];\n\nexport type AttachmentRuntime<\n TSource extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> = {\n readonly path: AttachmentRuntimePath & { attachmentSource: TSource };\n readonly source: TSource;\n getState(): AttachmentState & { source: TSource };\n remove(): Promise<void>;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport abstract class AttachmentRuntimeImpl<\n Source extends AttachmentRuntimeSource = AttachmentRuntimeSource,\n> implements AttachmentRuntime\n{\n public get path() {\n return this._core.path;\n }\n\n public abstract get source(): Source;\n\n constructor(private _core: AttachmentSnapshotBinding<Source>) {\n this.__internal_bindMethods();\n }\n\n protected __internal_bindMethods() {\n this.getState = this.getState.bind(this);\n this.remove = this.remove.bind(this);\n this.subscribe = this.subscribe.bind(this);\n }\n\n public getState(): AttachmentState & { source: Source } {\n return this._core.getState();\n }\n\n public abstract remove(): Promise<void>;\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n}\n\nabstract class ComposerAttachmentRuntime<\n Source extends \"thread-composer\" | \"edit-composer\",\n> extends AttachmentRuntimeImpl<Source> {\n constructor(\n core: AttachmentSnapshotBinding<Source>,\n private _composerApi: ComposerRuntimeCoreBinding,\n ) {\n super(core);\n }\n\n public remove() {\n const core = this._composerApi.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.removeAttachment(this.getState().id);\n }\n}\n\nexport class ThreadComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"thread-composer\"> {\n public get source(): \"thread-composer\" {\n return \"thread-composer\";\n }\n}\n\nexport class EditComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime<\"edit-composer\"> {\n public get source(): \"edit-composer\" {\n return \"edit-composer\";\n }\n}\n\nexport class MessageAttachmentRuntimeImpl extends AttachmentRuntimeImpl<\"message\"> {\n public get source(): \"message\" {\n return \"message\";\n }\n\n constructor(core: AttachmentSnapshotBinding<\"message\">) {\n super(core);\n }\n\n public remove(): never {\n throw new Error(\"Message attachments cannot be removed\");\n }\n}\n","import type {\n Attachment,\n CompleteAttachment,\n CreateAttachment,\n PendingAttachment,\n} from \"../../types/attachment\";\nimport type { MessageRole, AppendMessage } from \"../../types/message\";\nimport type { QuoteInfo } from \"../../types/quote\";\nimport type { Unsubscribe } from \"../../types/unsubscribe\";\nimport type { RunConfig } from \"../../types/message\";\nimport { BaseSubscribable } from \"../../subscribable/subscribable\";\nimport {\n type AttachmentAdapter,\n fileMatchesAccept,\n} from \"../../adapters/attachment\";\nimport type {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n DictationState,\n} from \"../interfaces/composer-runtime-core\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport { generateId } from \"../../utils/id\";\n\nconst isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>\n a.status.type === \"complete\";\n\nexport abstract class BaseComposerRuntimeCore\n extends BaseSubscribable\n implements ComposerRuntimeCore\n{\n public readonly isEditing = true;\n\n protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;\n protected abstract getDictationAdapter(): DictationAdapter | undefined;\n\n public get attachmentAccept(): string {\n return this.getAttachmentAdapter()?.accept ?? \"*\";\n }\n\n private _attachments: readonly Attachment[] = [];\n public get attachments() {\n return this._attachments;\n }\n\n protected setAttachments(value: readonly Attachment[]) {\n this._attachments = value;\n this._notifySubscribers();\n }\n\n public abstract get canCancel(): boolean;\n\n public get isEmpty() {\n return !this.text.trim() && !this.attachments.length;\n }\n\n private _text = \"\";\n\n get text() {\n return this._text;\n }\n\n private _role: MessageRole = \"user\";\n\n get role() {\n return this._role;\n }\n\n private _runConfig: RunConfig = {};\n\n get runConfig() {\n return this._runConfig;\n }\n\n private _quote: QuoteInfo | undefined = undefined;\n\n get quote() {\n return this._quote;\n }\n\n public setQuote(quote: QuoteInfo | undefined) {\n if (this._quote === quote) return;\n\n this._quote = quote;\n this._notifySubscribers();\n }\n\n public setText(value: string) {\n if (this._text === value) return;\n\n this._text = value;\n if (this._dictation) {\n this._dictationBaseText = value;\n this._currentInterimText = \"\";\n const { status, inputDisabled } = this._dictation;\n this._dictation = inputDisabled ? { status, inputDisabled } : { status };\n }\n this._notifySubscribers();\n }\n\n public setRole(role: MessageRole) {\n if (this._role === role) return;\n\n this._role = role;\n this._notifySubscribers();\n }\n\n public setRunConfig(runConfig: RunConfig) {\n if (this._runConfig === runConfig) return;\n\n this._runConfig = runConfig;\n this._notifySubscribers();\n }\n\n private _emptyTextAndAttachments() {\n this._attachments = [];\n this._text = \"\";\n this._notifySubscribers();\n }\n\n private async _onClearAttachments() {\n const adapter = this.getAttachmentAdapter();\n if (adapter) {\n const pending = this._attachments.filter((a) => !isAttachmentComplete(a));\n await Promise.all(pending.map((a) => adapter.remove(a)));\n }\n }\n\n public async reset() {\n if (\n this._attachments.length === 0 &&\n this._text === \"\" &&\n this._role === \"user\" &&\n Object.keys(this._runConfig).length === 0 &&\n this._quote === undefined\n ) {\n return;\n }\n\n this._role = \"user\";\n this._runConfig = {};\n this._quote = undefined;\n\n const task = this._onClearAttachments();\n this._emptyTextAndAttachments();\n await task;\n }\n\n public async clearAttachments() {\n const task = this._onClearAttachments();\n this.setAttachments([]);\n\n await task;\n }\n\n public async send() {\n if (this.isEmpty) return;\n\n if (this._dictationSession) {\n this._dictationSession.cancel();\n this._cleanupDictation();\n }\n\n const adapter = this.getAttachmentAdapter();\n const attachments =\n this.attachments.length > 0\n ? Promise.all(\n this.attachments.map(async (a) => {\n if (isAttachmentComplete(a)) return a;\n if (!adapter) throw new Error(\"Attachments are not supported\");\n const result = await adapter.send(a);\n return result as CompleteAttachment;\n }),\n )\n : [];\n\n const text = this.text;\n const quote = this._quote;\n this._quote = undefined;\n this._emptyTextAndAttachments();\n\n const message: Omit<AppendMessage, \"parentId\" | \"sourceId\"> = {\n createdAt: new Date(),\n role: this.role,\n content: text ? [{ type: \"text\", text }] : [],\n attachments: await attachments,\n runConfig: this.runConfig,\n metadata: { custom: { ...(quote ? { quote } : {}) } },\n };\n\n this.handleSend(message);\n this._notifyEventSubscribers(\"send\");\n }\n\n public cancel() {\n this.handleCancel();\n }\n\n protected abstract handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n ): void;\n protected abstract handleCancel(): void;\n\n async addAttachment(fileOrAttachment: File | CreateAttachment) {\n if (!(fileOrAttachment instanceof File)) {\n const a: CompleteAttachment = {\n id: fileOrAttachment.id ?? generateId(),\n type: fileOrAttachment.type ?? \"document\",\n name: fileOrAttachment.name,\n contentType: fileOrAttachment.contentType,\n content: fileOrAttachment.content,\n status: { type: \"complete\" },\n };\n this._attachments = [...this._attachments, a];\n this._notifyEventSubscribers(\"attachmentAdd\");\n this._notifySubscribers();\n return;\n }\n\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n if (\n !fileMatchesAccept(\n { name: fileOrAttachment.name, type: fileOrAttachment.type },\n adapter.accept,\n )\n ) {\n throw new Error(\n `File type ${fileOrAttachment.type || \"unknown\"} is not accepted. Accepted types: ${adapter.accept}`,\n );\n }\n\n const upsertAttachment = (a: PendingAttachment) => {\n const idx = this._attachments.findIndex(\n (attachment) => attachment.id === a.id,\n );\n if (idx !== -1)\n this._attachments = [\n ...this._attachments.slice(0, idx),\n a,\n ...this._attachments.slice(idx + 1),\n ];\n else {\n this._attachments = [...this._attachments, a];\n }\n\n this._notifySubscribers();\n };\n\n let lastAttachment: PendingAttachment | undefined;\n try {\n const promiseOrGenerator = adapter.add({ file: fileOrAttachment });\n if (Symbol.asyncIterator in promiseOrGenerator) {\n for await (const r of promiseOrGenerator) {\n lastAttachment = r;\n upsertAttachment(r);\n }\n } else {\n lastAttachment = await promiseOrGenerator;\n upsertAttachment(lastAttachment);\n }\n } catch (e) {\n if (lastAttachment) {\n upsertAttachment({\n ...lastAttachment,\n status: { type: \"incomplete\", reason: \"error\" },\n });\n }\n try {\n this._notifyEventSubscribers(\"attachmentAddError\");\n } catch {\n // prevent subscriber errors from masking the adapter error\n }\n throw e;\n }\n\n const hasError =\n lastAttachment?.status.type === \"incomplete\" &&\n lastAttachment.status.reason === \"error\";\n this._notifyEventSubscribers(\n hasError ? \"attachmentAddError\" : \"attachmentAdd\",\n );\n }\n\n async removeAttachment(attachmentId: string) {\n const index = this._attachments.findIndex((a) => a.id === attachmentId);\n if (index === -1) throw new Error(\"Attachment not found\");\n const attachment = this._attachments[index]!;\n\n if (!isAttachmentComplete(attachment)) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n await adapter.remove(attachment);\n }\n\n this._attachments = this._attachments.filter((a) => a.id !== attachmentId);\n this._notifySubscribers();\n }\n\n private _dictation: DictationState | undefined;\n private _dictationSession: DictationAdapter.Session | undefined;\n private _dictationUnsubscribes: Unsubscribe[] = [];\n private _dictationBaseText = \"\";\n private _currentInterimText = \"\";\n private _dictationSessionIdCounter = 0;\n private _activeDictationSessionId: number | undefined;\n private _isCleaningDictation = false;\n\n public get dictation(): DictationState | undefined {\n return this._dictation;\n }\n\n private _isActiveSession(\n sessionId: number,\n session: DictationAdapter.Session,\n ): boolean {\n return (\n this._activeDictationSessionId === sessionId &&\n this._dictationSession === session\n );\n }\n\n public startDictation(): void {\n const adapter = this.getDictationAdapter();\n if (!adapter) {\n throw new Error(\"Dictation adapter not configured\");\n }\n\n if (this._dictationSession) {\n for (const unsub of this._dictationUnsubscribes) {\n unsub();\n }\n this._dictationUnsubscribes = [];\n const oldSession = this._dictationSession;\n oldSession.stop().catch(() => {});\n this._dictationSession = undefined;\n }\n\n const inputDisabled = adapter.disableInputDuringDictation ?? false;\n\n this._dictationBaseText = this._text;\n this._currentInterimText = \"\";\n\n const session = adapter.listen();\n this._dictationSession = session;\n const sessionId = ++this._dictationSessionIdCounter;\n this._activeDictationSessionId = sessionId;\n this._dictation = { status: session.status, inputDisabled };\n this._notifySubscribers();\n\n const unsubSpeech = session.onSpeech((result) => {\n if (!this._isActiveSession(sessionId, session)) return;\n const isFinal = result.isFinal !== false;\n\n const needsSeparator =\n this._dictationBaseText &&\n !this._dictationBaseText.endsWith(\" \") &&\n result.transcript;\n const separator = needsSeparator ? \" \" : \"\";\n\n if (isFinal) {\n this._dictationBaseText =\n this._dictationBaseText + separator + result.transcript;\n this._currentInterimText = \"\";\n this._text = this._dictationBaseText;\n\n if (this._dictation) {\n const { transcript: _, ...rest } = this._dictation;\n this._dictation = rest;\n }\n this._notifySubscribers();\n } else {\n this._currentInterimText = separator + result.transcript;\n this._text = this._dictationBaseText + this._currentInterimText;\n\n if (this._dictation) {\n this._dictation = {\n ...this._dictation,\n transcript: result.transcript,\n };\n }\n this._notifySubscribers();\n }\n });\n this._dictationUnsubscribes.push(unsubSpeech);\n\n const unsubStart = session.onSpeechStart(() => {\n if (!this._isActiveSession(sessionId, session)) return;\n\n this._dictation = {\n status: { type: \"running\" },\n inputDisabled,\n ...(this._dictation?.transcript && {\n transcript: this._dictation.transcript,\n }),\n };\n this._notifySubscribers();\n });\n this._dictationUnsubscribes.push(unsubStart);\n\n const unsubEnd = session.onSpeechEnd(() => {\n this._cleanupDictation({ sessionId });\n });\n this._dictationUnsubscribes.push(unsubEnd);\n\n const statusInterval = setInterval(() => {\n if (!this._isActiveSession(sessionId, session)) return;\n\n if (session.status.type === \"ended\") {\n this._cleanupDictation({ sessionId });\n }\n }, 100);\n this._dictationUnsubscribes.push(() => clearInterval(statusInterval));\n }\n\n public stopDictation(): void {\n if (!this._dictationSession) return;\n\n const session = this._dictationSession;\n const sessionId = this._activeDictationSessionId;\n session.stop().finally(() => {\n this._cleanupDictation({ sessionId });\n });\n }\n\n private _cleanupDictation(options?: { sessionId: number | undefined }): void {\n const isStaleSession =\n options?.sessionId !== undefined &&\n options.sessionId !== this._activeDictationSessionId;\n if (isStaleSession || this._isCleaningDictation) return;\n\n this._isCleaningDictation = true;\n try {\n for (const unsub of this._dictationUnsubscribes) {\n unsub();\n }\n this._dictationUnsubscribes = [];\n this._dictationSession = undefined;\n this._activeDictationSessionId = undefined;\n this._dictation = undefined;\n this._dictationBaseText = \"\";\n this._currentInterimText = \"\";\n this._notifySubscribers();\n } finally {\n this._isCleaningDictation = false;\n }\n }\n\n private _eventSubscribers = new Map<\n ComposerRuntimeEventType,\n Set<() => void>\n >();\n\n protected _notifyEventSubscribers(event: ComposerRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public unstable_on(event: ComposerRuntimeEventType, callback: () => void) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n subscribers.delete(callback);\n };\n }\n}\n","import type { Unsubscribe } from \"../types/unsubscribe\";\n\n// =============================================================================\n// Sentinel\n// =============================================================================\n\nexport const SKIP_UPDATE = Symbol(\"skip-update\");\nexport type SKIP_UPDATE = typeof SKIP_UPDATE;\n\n// =============================================================================\n// Types\n// =============================================================================\n\nexport type Subscribable = {\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport type SubscribableWithState<TState, TPath> = Subscribable & {\n path: TPath;\n getState: () => TState;\n};\n\nexport type NestedSubscribable<\n TState extends Subscribable | undefined,\n TPath,\n> = SubscribableWithState<TState, TPath>;\n\nexport type EventSubscribable<TEvent extends string> = {\n event: TEvent;\n binding: SubscribableWithState<\n | {\n unstable_on: (event: TEvent, callback: () => void) => Unsubscribe;\n }\n | undefined,\n unknown\n >;\n};\n\n// =============================================================================\n// Utilities\n// =============================================================================\n\nfunction shallowEqual<T extends object>(\n objA: T | undefined,\n objB: T | undefined,\n) {\n if (objA === undefined && objB === undefined) return true;\n if (objA === undefined) return false;\n if (objB === undefined) return false;\n\n for (const key of Object.keys(objA)) {\n const valueA = objA[key as keyof T];\n const valueB = objB[key as keyof T];\n if (!Object.is(valueA, valueB)) return false;\n }\n\n return true;\n}\n\n// =============================================================================\n// Base Subscribable (simple pub-sub)\n// =============================================================================\n\nexport class BaseSubscribable {\n private _subscribers = new Set<() => void>();\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscribers.add(callback);\n return () => this._subscribers.delete(callback);\n }\n\n public waitForUpdate() {\n return new Promise<void>((resolve) => {\n const unsubscribe = this.subscribe(() => {\n unsubscribe();\n resolve();\n });\n });\n }\n\n protected _notifySubscribers() {\n const errors = [];\n for (const callback of this._subscribers) {\n try {\n callback();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n for (const error of errors) {\n console.error(error);\n }\n throw new AggregateError(errors);\n }\n }\n }\n}\n\n// =============================================================================\n// Base Subject (lazy connect/disconnect)\n// =============================================================================\n\nexport abstract class BaseSubject {\n private _subscriptions = new Set<() => void>();\n private _connection: Unsubscribe | undefined;\n\n protected get isConnected() {\n return !!this._connection;\n }\n\n protected abstract _connect(): Unsubscribe;\n\n protected notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n private _updateConnection() {\n if (this._subscriptions.size > 0) {\n if (this._connection) return;\n this._connection = this._connect();\n } else {\n this._connection?.();\n this._connection = undefined;\n }\n }\n\n public subscribe(callback: () => void) {\n this._subscriptions.add(callback);\n this._updateConnection();\n\n return () => {\n this._subscriptions.delete(callback);\n this._updateConnection();\n };\n }\n}\n\n// =============================================================================\n// Subject Implementations\n// =============================================================================\n\nexport class ShallowMemoizeSubject<TState extends object, TPath>\n extends BaseSubject\n implements SubscribableWithState<TState, TPath>\n{\n public get path() {\n return this.binding.path;\n }\n\n constructor(\n private binding: SubscribableWithState<TState | SKIP_UPDATE, TPath>,\n ) {\n super();\n const state = binding.getState();\n if (state === SKIP_UPDATE)\n throw new Error(\"Entry not available in the store\");\n this._previousState = state;\n }\n\n private _previousState: TState;\n public getState = () => {\n if (!this.isConnected) this._syncState();\n return this._previousState;\n };\n\n private _syncState() {\n const state = this.binding.getState();\n if (state === SKIP_UPDATE) return false;\n if (shallowEqual(state, this._previousState)) return false;\n this._previousState = state;\n return true;\n }\n\n protected _connect() {\n const callback = () => {\n if (this._syncState()) {\n this.notifySubscribers();\n }\n };\n\n return this.binding.subscribe(callback);\n }\n}\n\nexport class LazyMemoizeSubject<TState extends object, TPath>\n extends BaseSubject\n implements SubscribableWithState<TState, TPath>\n{\n public get path() {\n return this.binding.path;\n }\n\n constructor(\n private binding: SubscribableWithState<TState | SKIP_UPDATE, TPath>,\n ) {\n super();\n }\n\n private _previousStateDirty = true;\n private _previousState: TState | undefined;\n public getState = () => {\n if (!this.isConnected || this._previousStateDirty) {\n const newState = this.binding.getState();\n if (newState !== SKIP_UPDATE) {\n this._previousState = newState;\n }\n this._previousStateDirty = false;\n }\n if (this._previousState === undefined)\n throw new Error(\"Entry not available in the store\");\n return this._previousState;\n };\n\n protected _connect() {\n const callback = () => {\n this._previousStateDirty = true;\n this.notifySubscribers();\n };\n\n return this.binding.subscribe(callback);\n }\n}\n\nexport class NestedSubscriptionSubject<\n TState extends Subscribable | undefined,\n TPath,\n >\n extends BaseSubject\n implements\n SubscribableWithState<TState, TPath>,\n NestedSubscribable<TState, TPath>\n{\n public get path() {\n return this.binding.path;\n }\n\n constructor(private binding: NestedSubscribable<TState, TPath>) {\n super();\n }\n\n public getState() {\n return this.binding.getState();\n }\n\n public outerSubscribe(callback: () => void) {\n return this.binding.subscribe(callback);\n }\n\n protected _connect(): Unsubscribe {\n const callback = () => {\n this.notifySubscribers();\n };\n\n let lastState = this.binding.getState();\n let innerUnsubscribe = lastState?.subscribe(callback);\n const onRuntimeUpdate = () => {\n const newState = this.binding.getState();\n if (newState === lastState) return;\n lastState = newState;\n\n innerUnsubscribe?.();\n innerUnsubscribe = newState?.subscribe(callback);\n\n callback();\n };\n\n const outerUnsubscribe = this.outerSubscribe(onRuntimeUpdate);\n return () => {\n outerUnsubscribe?.();\n innerUnsubscribe?.();\n };\n }\n}\n\nexport class EventSubscriptionSubject<\n TEvent extends string,\n> extends BaseSubject {\n constructor(private config: EventSubscribable<TEvent>) {\n super();\n }\n\n public getState() {\n return this.config.binding.getState();\n }\n\n public outerSubscribe(callback: () => void) {\n return this.config.binding.subscribe(callback);\n }\n\n protected _connect(): Unsubscribe {\n const callback = () => {\n this.notifySubscribers();\n };\n\n let lastState = this.config.binding.getState();\n let innerUnsubscribe = lastState?.unstable_on(this.config.event, callback);\n const onRuntimeUpdate = () => {\n const newState = this.config.binding.getState();\n if (newState === lastState) return;\n lastState = newState;\n\n innerUnsubscribe?.();\n innerUnsubscribe = newState?.unstable_on(this.config.event, callback);\n };\n\n const outerUnsubscribe = this.outerSubscribe(onRuntimeUpdate);\n return () => {\n outerUnsubscribe?.();\n innerUnsubscribe?.();\n };\n }\n}\n","interface Attachment {\n path: string;\n name: string;\n notes?: string;\n}\n\nexport function composeUserInput(\n description: string,\n attachments: Attachment[] | undefined\n): string {\n if (!attachments || attachments.length === 0) {\n return description;\n }\n\n const refs = attachments\n .map((a) => (a.notes?.trim() ? `@${a.path} [Note: ${a.notes.trim()}]` : `@${a.path}`))\n .join(' ');\n return `${description}\\n\\n${refs}`;\n}\n","'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TOnMutateResult> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TOnMutateResult>(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction<TData, TError, TVariables, TOnMutateResult>\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n"],"names":["error","AggregateError","cleanupAllEffects","cell","executionContext","cells","hasBuffer","Buffer","suspectProtoRx","suspectConstructorRx","_parse","text","reviver","options","undefined","isBuffer","toString","charCodeAt","slice","obj","JSON","parse","protoAction","constructorAction","test","filter","safe","next","length","nodes","node","Object","prototype","hasOwnProperty","call","SyntaxError","__proto__","key","value","push","stackTraceLimit","Error","safeParse","module","exports","default","scan","className","children","strong","code","markdownComponents","p","codeEl","em","props","pre","lang","replace","rawText","isPreviewable","language","includes","ul","HtmlPreviewBlock","li","CollapsibleCode","h1","ol","h2","h3","a","href","target","rel","blockquote","table","thead","th","td","tr","hr","Thread","statusBar","composer","Root","Viewport","Empty","ThreadEmpty","Messages","components","UserMessage","AssistantMessage","Composer","Text","Content","UserMessageText","MessageMeta","Copy","asChild","IconButton","tooltip","AssistantMessageText","t","setExpanded","current","CODE_COLLAPSED_HEIGHT","expanded","needsCollapse","setNeedsCollapse","ref","scrollHeight","style","maxHeight","overflow","type","onClick","showPreview","setShowPreview","maximized","setMaximized","fullscreenCode","setFullscreenCode","lines","split","chars","title","height","srcDoc","sandbox","document","e","stopPropagation","toLocaleString","body","ACTIVITY_MARKER_RE","ThinkingIndicator","booting","activityMatch","exec","ActivityIndicator","label","remarkPlugins","THINKING_WORDS","interval","BOOTING_WORDS","words","index","setIndex","fade","setFade","setInterval","setTimeout","i","clearInterval","opacity","transform","animationDelay","message","tick","setTick","id","meta","createdAt","date","Date","isNaN","getTime","time","toLocaleTimeString","hour","minute","relative","formatRelativeTime","diff","now","seconds","Math","floor","minutes","hours","toLocaleDateString","displayName","AddAttachment","Input","rows","autoFocus","placeholder","ComposerAction","If","running","Send","Cancel"],"mappings":"uCAqBA,CAAA,CAAA,CAAA,CAAA,AAAM,CAAN,CAAM,CAAA,EAAY,CAAA,CAAA,CAAA,CAAZ,AAAY,CAAZ,AAAY,CAAZ,AAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAlBC,CAkBa,AAjB/C,CAiB+C,AAjB9C,CAiB8C,AAjB9C,CAiB8C,AAjB9C,CAiB8C,AAjB9C,CAiB8C,AAjB9C,CAAA,AAiB8C,CAAA,AAjB9C,CAAQ,AAiBsC,AAjB9C,CAiB8C,AAjBtC,AAAE,CAiB8C,CAAA,AAjB3C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,AAAa,CAAA,CAAA,CAAA,CAAA,AAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,AAAQ,CAAE,AAAF,EAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,AAAa,CAAA,CAAA,CAAA,CAA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AW,CAC5B,WAAY,EAAI,UAAU,CAC1B,YAAa,EAAIA,WAAW,CAC5B,YAAa,EAAI,eAAe,CAChC,YAAa,EAAI,eAAe,CAChC,WAAY,EAAI,cAAc,CAC9B,OAAQ,EAAI,UAAU,CACtB,QAAS,EAAI,WAAW,CACxB,mBAAoB,EAAI,gBAAgB,CACxC,cAAe,EAAI,WAAW,CAC9B,YAAa,EACb,YACE,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,gBAAgB,CAAA,CACf,iBAAkB,GAAiB,cACnC,aAAc,GAAiB,oBAC/B,KAAK,WACL,mBAAoB,CAAC,EAAO,KAC1B,EAAiB,GACjB,EAAiB,EACnB,EACA,UAAU,WAMlB,MACE,CAAA,EAAA,EAAA,IAAA,EAAC,MAAA,CAAI,UAAU,yCAEb,CAAA,EAAA,EAAA,GAAA,EAAC,GAAA,CACC,YAAa,EACb,cAAe,EAAO,SAAS,CAC/B,QAAS,EACT,UAAW,EACX,eAAe,IAAwB,IAEzC,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,CAAI,UAAU,GAFW,qCAGvB,EACC,CAAA,EAAA,EAAA,GAAA,EAAC,GAAA,CAAA,GAED,CAAA,EAAA,EAAA,GAAA,EAAC4C,EAAAA,wBAAwB,CAAA,CAACC,QAAS,WACjC,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,CAAO,SAAU,UAM9B","ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,171,174,175,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,211]}