@athenaintel/react 0.20.0 → 0.21.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 (347) hide show
  1. package/README.md +74 -0
  2. package/dist/assets/use-asset-embed.cjs +8 -0
  3. package/dist/assets/use-asset-embed.cjs.map +1 -1
  4. package/dist/assets/use-asset-embed.js +8 -0
  5. package/dist/assets/use-asset-embed.js.map +1 -1
  6. package/dist/chat/StatewireApprovalCard.cjs +22 -4
  7. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  8. package/dist/chat/StatewireApprovalCard.d.ts +14 -0
  9. package/dist/chat/StatewireApprovalCard.js +23 -5
  10. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  11. package/dist/chat/StatewireClientToolBridge.cjs +2 -1
  12. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  13. package/dist/chat/StatewireClientToolBridge.js +2 -1
  14. package/dist/chat/StatewireClientToolBridge.js.map +1 -1
  15. package/dist/chat/StatewireQueuedMessages.cjs +2 -1
  16. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  17. package/dist/chat/StatewireQueuedMessages.js +2 -1
  18. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  19. package/dist/chat/athena-citation-links.cjs +17 -1
  20. package/dist/chat/athena-citation-links.cjs.map +1 -1
  21. package/dist/chat/athena-citation-links.js +17 -1
  22. package/dist/chat/athena-citation-links.js.map +1 -1
  23. package/dist/chat/statewire-client-tools.cjs +2 -1
  24. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  25. package/dist/chat/statewire-client-tools.js +2 -1
  26. package/dist/chat/statewire-client-tools.js.map +1 -1
  27. package/dist/chat/super-grouping/SuperGroupingCard.cjs +69 -187
  28. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  29. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +10 -6
  30. package/dist/chat/super-grouping/SuperGroupingCard.js +73 -191
  31. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  32. package/dist/chat/super-grouping/ToolTimeline.cjs +131 -0
  33. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -0
  34. package/dist/chat/super-grouping/ToolTimeline.d.ts +16 -0
  35. package/dist/chat/super-grouping/ToolTimeline.js +131 -0
  36. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -0
  37. package/dist/chat/super-grouping/activity-timeline.cjs +14 -8
  38. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  39. package/dist/chat/super-grouping/activity-timeline.d.ts +3 -0
  40. package/dist/chat/super-grouping/activity-timeline.js +14 -8
  41. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  42. package/dist/chat/super-grouping/timeline-step.cjs +65 -0
  43. package/dist/chat/super-grouping/timeline-step.cjs.map +1 -0
  44. package/dist/chat/super-grouping/timeline-step.d.ts +17 -0
  45. package/dist/chat/super-grouping/timeline-step.js +65 -0
  46. package/dist/chat/super-grouping/timeline-step.js.map +1 -0
  47. package/dist/chat/tiptap-text.cjs +8 -8
  48. package/dist/chat/tiptap-text.cjs.map +1 -1
  49. package/dist/chat/use-athena-run-live.cjs +2 -1
  50. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  51. package/dist/chat/use-athena-run-live.js +2 -1
  52. package/dist/chat/use-athena-run-live.js.map +1 -1
  53. package/dist/chat/use-statewire-approval-request.cjs +7 -2
  54. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  55. package/dist/chat/use-statewire-approval-request.d.ts +12 -2
  56. package/dist/chat/use-statewire-approval-request.js +8 -3
  57. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  58. package/dist/chat-ui/composer/tiptap-composer.cjs +24 -65
  59. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  60. package/dist/chat-ui/composer/tiptap-composer.js +24 -65
  61. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  62. package/dist/chat-ui/index.cjs +2 -1
  63. package/dist/chat-ui/index.cjs.map +1 -1
  64. package/dist/chat-ui/index.js +2 -1
  65. package/dist/chat-ui/index.js.map +1 -1
  66. package/dist/chat-ui/mentions/mention-chip.cjs +49 -4
  67. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  68. package/dist/chat-ui/mentions/mention-chip.d.ts +11 -0
  69. package/dist/chat-ui/mentions/mention-chip.js +50 -5
  70. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  71. package/dist/chat-ui/mentions/mention-extension.cjs +18 -6
  72. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  73. package/dist/chat-ui/mentions/mention-extension.d.ts +2 -0
  74. package/dist/chat-ui/mentions/mention-extension.js +18 -6
  75. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  76. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +1 -1
  77. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
  78. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +1 -1
  79. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
  80. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +9 -6
  81. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  82. package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +2 -2
  83. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +10 -7
  84. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  85. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +2 -2
  86. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
  87. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +2 -2
  88. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +2 -2
  89. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
  90. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
  91. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  92. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -2
  93. package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
  94. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  95. package/dist/chat-ui/messages/message-components.cjs +6 -29
  96. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  97. package/dist/chat-ui/messages/message-components.d.ts +1 -13
  98. package/dist/chat-ui/messages/message-components.js +8 -31
  99. package/dist/chat-ui/messages/message-components.js.map +1 -1
  100. package/dist/chat-ui/messages/runtime-message.cjs +3 -2
  101. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  102. package/dist/chat-ui/messages/runtime-message.js +3 -2
  103. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  104. package/dist/chat-ui/messages/statewire-continue-run.cjs +23 -8
  105. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  106. package/dist/chat-ui/messages/statewire-continue-run.d.ts +14 -4
  107. package/dist/chat-ui/messages/statewire-continue-run.js +23 -8
  108. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  109. package/dist/chat-ui/messages/user-edit-composer.cjs +2 -1
  110. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  111. package/dist/chat-ui/messages/user-edit-composer.js +2 -1
  112. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  113. package/dist/chat-ui/rich-text/chat-message-body.cjs +76 -0
  114. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -0
  115. package/dist/chat-ui/rich-text/chat-message-body.d.ts +5 -0
  116. package/dist/chat-ui/rich-text/chat-message-body.js +76 -0
  117. package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -0
  118. package/dist/chat-ui/rich-text/chat-node-views.cjs +51 -0
  119. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -0
  120. package/dist/chat-ui/rich-text/chat-node-views.d.ts +13 -0
  121. package/dist/chat-ui/rich-text/chat-node-views.js +51 -0
  122. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -0
  123. package/dist/chat-ui/rich-text/chat-text-schema.cjs +70 -0
  124. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -0
  125. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +7 -0
  126. package/dist/chat-ui/rich-text/chat-text-schema.js +70 -0
  127. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -0
  128. package/dist/chat-ui/rich-text/dom-output-spec.cjs +83 -0
  129. package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -0
  130. package/dist/chat-ui/rich-text/dom-output-spec.d.ts +11 -0
  131. package/dist/chat-ui/rich-text/dom-output-spec.js +83 -0
  132. package/dist/chat-ui/rich-text/dom-output-spec.js.map +1 -0
  133. package/dist/chat-ui/statewire.cjs +2 -1
  134. package/dist/chat-ui/statewire.cjs.map +1 -1
  135. package/dist/chat-ui/statewire.js +2 -1
  136. package/dist/chat-ui/statewire.js.map +1 -1
  137. package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -1
  138. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  139. package/dist/chat-ui/thread/statewire-history-edge.js +2 -1
  140. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  141. package/dist/index.cjs +2 -1
  142. package/dist/index.cjs.map +1 -1
  143. package/dist/index.js +2 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +32 -0
  146. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +1 -0
  147. package/dist/node_modules/qrcode-generator/dist/qrcode.js +31 -0
  148. package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +1 -0
  149. package/dist/node_modules/zod/v4/classic/errors.cjs +44 -0
  150. package/dist/node_modules/zod/v4/classic/errors.cjs.map +1 -0
  151. package/dist/node_modules/zod/v4/classic/errors.js +44 -0
  152. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  153. package/dist/node_modules/zod/v4/classic/iso.cjs +43 -0
  154. package/dist/node_modules/zod/v4/classic/iso.cjs.map +1 -0
  155. package/dist/node_modules/zod/v4/classic/iso.js +43 -0
  156. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  157. package/dist/node_modules/zod/v4/classic/parse.cjs +29 -0
  158. package/dist/node_modules/zod/v4/classic/parse.cjs.map +1 -0
  159. package/dist/node_modules/zod/v4/classic/parse.js +29 -0
  160. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  161. package/dist/node_modules/zod/v4/classic/schemas.cjs +871 -0
  162. package/dist/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
  163. package/dist/node_modules/zod/v4/classic/schemas.js +871 -0
  164. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  165. package/dist/node_modules/zod/v4/core/api.cjs +570 -0
  166. package/dist/node_modules/zod/v4/core/api.cjs.map +1 -0
  167. package/dist/node_modules/zod/v4/core/api.js +570 -0
  168. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  169. package/dist/node_modules/zod/v4/core/checks.cjs +411 -0
  170. package/dist/node_modules/zod/v4/core/checks.cjs.map +1 -0
  171. package/dist/node_modules/zod/v4/core/checks.js +411 -0
  172. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  173. package/dist/node_modules/zod/v4/core/core.cjs +77 -0
  174. package/dist/node_modules/zod/v4/core/core.cjs.map +1 -0
  175. package/dist/node_modules/zod/v4/core/core.js +77 -0
  176. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  177. package/dist/node_modules/zod/v4/core/doc.cjs +38 -0
  178. package/dist/node_modules/zod/v4/core/doc.cjs.map +1 -0
  179. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  180. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  181. package/dist/node_modules/zod/v4/core/errors.cjs +76 -0
  182. package/dist/node_modules/zod/v4/core/errors.cjs.map +1 -0
  183. package/dist/node_modules/zod/v4/core/errors.js +76 -0
  184. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  185. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +312 -0
  186. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +1 -0
  187. package/dist/node_modules/zod/v4/core/json-schema-processors.js +312 -0
  188. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
  189. package/dist/node_modules/zod/v4/core/parse.cjs +96 -0
  190. package/dist/node_modules/zod/v4/core/parse.cjs.map +1 -0
  191. package/dist/node_modules/zod/v4/core/parse.js +96 -0
  192. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  193. package/dist/node_modules/zod/v4/core/regexes.cjs +86 -0
  194. package/dist/node_modules/zod/v4/core/regexes.cjs.map +1 -0
  195. package/dist/node_modules/zod/v4/core/regexes.js +86 -0
  196. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  197. package/dist/node_modules/zod/v4/core/registries.cjs +52 -0
  198. package/dist/node_modules/zod/v4/core/registries.cjs.map +1 -0
  199. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  200. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  201. package/dist/node_modules/zod/v4/core/schemas.cjs +1412 -0
  202. package/dist/node_modules/zod/v4/core/schemas.cjs.map +1 -0
  203. package/dist/node_modules/zod/v4/core/schemas.js +1413 -0
  204. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  205. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +370 -0
  206. package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +1 -0
  207. package/dist/node_modules/zod/v4/core/to-json-schema.js +370 -0
  208. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  209. package/dist/node_modules/zod/v4/core/util.cjs +444 -0
  210. package/dist/node_modules/zod/v4/core/util.cjs.map +1 -0
  211. package/dist/node_modules/zod/v4/core/util.js +444 -0
  212. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  213. package/dist/node_modules/zod/v4/core/versions.cjs +9 -0
  214. package/dist/node_modules/zod/v4/core/versions.cjs.map +1 -0
  215. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  216. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  217. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs +7 -1
  218. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
  219. package/dist/packages/agent-runtime/src/client-tool-bridge.js +7 -1
  220. package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +1 -1
  221. package/dist/packages/agent-runtime/src/conversation-list.cjs +4 -0
  222. package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
  223. package/dist/packages/agent-runtime/src/conversation-list.js +4 -0
  224. package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
  225. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  226. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  227. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +2 -0
  228. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  229. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +2 -0
  230. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  231. package/dist/packages/agent-runtime/src/interrupts.cjs +31 -7
  232. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
  233. package/dist/packages/agent-runtime/src/interrupts.js +31 -7
  234. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
  235. package/dist/packages/agent-runtime/src/messages.cjs +35 -5
  236. package/dist/packages/agent-runtime/src/messages.cjs.map +1 -1
  237. package/dist/packages/agent-runtime/src/messages.js +35 -5
  238. package/dist/packages/agent-runtime/src/messages.js.map +1 -1
  239. package/dist/packages/agent-runtime/src/protocol.cjs +4 -6
  240. package/dist/packages/agent-runtime/src/protocol.cjs.map +1 -1
  241. package/dist/packages/agent-runtime/src/protocol.js +4 -6
  242. package/dist/packages/agent-runtime/src/protocol.js.map +1 -1
  243. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +296 -14
  244. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  245. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +293 -11
  246. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  247. package/dist/packages/agent-runtime/src/screen-point.cjs +68 -0
  248. package/dist/packages/agent-runtime/src/screen-point.cjs.map +1 -0
  249. package/dist/packages/agent-runtime/src/screen-point.js +68 -0
  250. package/dist/packages/agent-runtime/src/screen-point.js.map +1 -0
  251. package/dist/packages/agent-runtime/src/statewire-transport.cjs +6 -1
  252. package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +1 -1
  253. package/dist/packages/agent-runtime/src/statewire-transport.js +6 -1
  254. package/dist/packages/agent-runtime/src/statewire-transport.js.map +1 -1
  255. package/dist/packages/agent-runtime/src/thread-handoff.cjs +85 -0
  256. package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +1 -0
  257. package/dist/packages/agent-runtime/src/thread-handoff.js +85 -0
  258. package/dist/packages/agent-runtime/src/thread-handoff.js.map +1 -0
  259. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs +1 -1
  260. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -1
  261. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js +1 -1
  262. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +1 -1
  263. package/dist/packages/agent-runtime/src/tool-metadata.cjs +0 -8
  264. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  265. package/dist/packages/agent-runtime/src/tool-metadata.js +0 -8
  266. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  267. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +14 -0
  268. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -0
  269. package/dist/packages/agent-runtime/src/use-deep-agent-config.js +14 -0
  270. package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -0
  271. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs +21 -5
  272. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  273. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js +21 -5
  274. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  275. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs +13 -3
  276. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  277. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js +14 -4
  278. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  279. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +35 -15
  280. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  281. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +35 -15
  282. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  283. package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -1
  284. package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -1
  285. package/dist/packages/react/package.json.cjs +1 -1
  286. package/dist/packages/react/package.json.js +1 -1
  287. package/dist/provider/AthenaProvider.cjs +2 -1
  288. package/dist/provider/AthenaProvider.cjs.map +1 -1
  289. package/dist/provider/AthenaProvider.js +2 -1
  290. package/dist/provider/AthenaProvider.js.map +1 -1
  291. package/dist/runtime/statewire-lifecycle.cjs +2 -1
  292. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  293. package/dist/runtime/statewire-lifecycle.js +2 -1
  294. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  295. package/dist/runtime/useAthenaStatewireRuntime.cjs +2 -1
  296. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  297. package/dist/runtime/useAthenaStatewireRuntime.js +2 -1
  298. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  299. package/dist/styles.css +1 -1
  300. package/dist/threads/conversation-list-fetcher.cjs +4 -0
  301. package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
  302. package/dist/threads/conversation-list-fetcher.js +4 -0
  303. package/dist/threads/conversation-list-fetcher.js.map +1 -1
  304. package/dist/threads/statewire-thread-list.cjs +2 -1
  305. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  306. package/dist/threads/statewire-thread-list.js +2 -1
  307. package/dist/threads/statewire-thread-list.js.map +1 -1
  308. package/dist/threads/use-rest-conversation-history.cjs +2 -1
  309. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  310. package/dist/threads/use-rest-conversation-history.js +2 -1
  311. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  312. package/dist/threads/use-statewire-conversation-history.cjs +2 -1
  313. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  314. package/dist/threads/use-statewire-conversation-history.d.ts +1 -0
  315. package/dist/threads/use-statewire-conversation-history.js +2 -1
  316. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  317. package/dist/tools/index.cjs +2 -1
  318. package/dist/tools/index.cjs.map +1 -1
  319. package/dist/tools/index.js +2 -1
  320. package/dist/tools/index.js.map +1 -1
  321. package/dist/tools/misc-tool-uis.cjs +2 -1
  322. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  323. package/dist/tools/misc-tool-uis.js +2 -1
  324. package/dist/tools/misc-tool-uis.js.map +1 -1
  325. package/dist/tools/primitives.cjs +2 -1
  326. package/dist/tools/primitives.cjs.map +1 -1
  327. package/dist/tools/primitives.js +2 -1
  328. package/dist/tools/primitives.js.map +1 -1
  329. package/dist/tools/tool-fallback.cjs +2 -1
  330. package/dist/tools/tool-fallback.cjs.map +1 -1
  331. package/dist/tools/tool-fallback.js +2 -1
  332. package/dist/tools/tool-fallback.js.map +1 -1
  333. package/dist/tools/voice-update-tool-ui.cjs +2 -1
  334. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  335. package/dist/tools/voice-update-tool-ui.js +2 -1
  336. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  337. package/dist/voice/index.cjs +6 -0
  338. package/dist/voice/index.cjs.map +1 -0
  339. package/dist/voice/index.d.ts +2 -0
  340. package/dist/voice/index.js +6 -0
  341. package/dist/voice/index.js.map +1 -0
  342. package/dist/voice/use-athena-voice-session.cjs +315 -0
  343. package/dist/voice/use-athena-voice-session.cjs.map +1 -0
  344. package/dist/voice/use-athena-voice-session.d.ts +145 -0
  345. package/dist/voice/use-athena-voice-session.js +315 -0
  346. package/dist/voice/use-athena-voice-session.js.map +1 -0
  347. package/package.json +17 -3
@@ -0,0 +1,13 @@
1
+ import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
2
+ import { type NodeViewProps } from "@tiptap/react";
3
+ import type { ReactNode } from "react";
4
+ export declare function ChatMention({ node, interactive, }: {
5
+ node: ProseMirrorNode;
6
+ interactive?: boolean;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ChatMentionNodeView({ node, editor }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ChatCodeBlock({ node, children, }: {
10
+ node: ProseMirrorNode;
11
+ children: ReactNode;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ChatCodeBlockNodeView({ node }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
3
+ import { MentionLink } from "../mentions/mention-chip.js";
4
+ import { makeMentionUrl } from "../mentions/mention-extension.js";
5
+ function ChatMention({
6
+ node,
7
+ interactive = true
8
+ }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "span",
11
+ {
12
+ className: "mention-chip",
13
+ "data-mention": "",
14
+ "data-type": node.attrs.type,
15
+ "data-name": node.attrs.name,
16
+ "data-id": node.attrs.id,
17
+ "data-asset-type": node.attrs.assetType,
18
+ "data-display-as-preview": String(node.attrs.displayAsPreview === true),
19
+ children: /* @__PURE__ */ jsx(
20
+ MentionLink,
21
+ {
22
+ href: makeMentionUrl(node.attrs),
23
+ interactive,
24
+ children: node.attrs.name
25
+ }
26
+ )
27
+ }
28
+ );
29
+ }
30
+ function ChatMentionNodeView({ node, editor }) {
31
+ return /* @__PURE__ */ jsx(NodeViewWrapper, { as: "span", children: /* @__PURE__ */ jsx(ChatMention, { node, interactive: !editor.isEditable }) });
32
+ }
33
+ function ChatCodeBlock({
34
+ node,
35
+ children
36
+ }) {
37
+ return /* @__PURE__ */ jsxs("div", { className: "not-prose my-2 overflow-hidden rounded-lg border border-border bg-muted/30", children: [
38
+ node.attrs.language && /* @__PURE__ */ jsx("div", { className: "border-b border-border bg-muted/50 px-3 py-1 text-[10px] font-medium text-muted-foreground", children: node.attrs.language }),
39
+ /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground", children })
40
+ ] });
41
+ }
42
+ function ChatCodeBlockNodeView({ node }) {
43
+ return /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(ChatCodeBlock, { node, children: /* @__PURE__ */ jsx(NodeViewContent, { as: "code" }) }) });
44
+ }
45
+ export {
46
+ ChatCodeBlock,
47
+ ChatCodeBlockNodeView,
48
+ ChatMention,
49
+ ChatMentionNodeView
50
+ };
51
+ //# sourceMappingURL=chat-node-views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-node-views.js","sources":["../../../src/chat-ui/rich-text/chat-node-views.tsx"],"sourcesContent":["import type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\nimport {\n NodeViewContent,\n NodeViewWrapper,\n type NodeViewProps,\n} from \"@tiptap/react\";\nimport type { ReactNode } from \"react\";\nimport { MentionLink } from \"../mentions/mention-chip\";\nimport {\n makeMentionUrl,\n type MentionNodeAttrs,\n} from \"../mentions/mention-extension\";\n\nexport function ChatMention({\n node,\n interactive = true,\n}: {\n node: ProseMirrorNode;\n interactive?: boolean;\n}) {\n return (\n <span\n className=\"mention-chip\"\n data-mention=\"\"\n data-type={node.attrs.type}\n data-name={node.attrs.name}\n data-id={node.attrs.id}\n data-asset-type={node.attrs.assetType}\n data-display-as-preview={String(node.attrs.displayAsPreview === true)}\n >\n <MentionLink\n href={makeMentionUrl(node.attrs as MentionNodeAttrs)}\n interactive={interactive}\n >\n {node.attrs.name}\n </MentionLink>\n </span>\n );\n}\n\nexport function ChatMentionNodeView({ node, editor }: NodeViewProps) {\n return (\n <NodeViewWrapper as=\"span\">\n <ChatMention node={node} interactive={!editor.isEditable} />\n </NodeViewWrapper>\n );\n}\n\nexport function ChatCodeBlock({\n node,\n children,\n}: {\n node: ProseMirrorNode;\n children: ReactNode;\n}) {\n return (\n <div className=\"not-prose my-2 overflow-hidden rounded-lg border border-border bg-muted/30\">\n {node.attrs.language && (\n <div className=\"border-b border-border bg-muted/50 px-3 py-1 text-[10px] font-medium text-muted-foreground\">\n {node.attrs.language}\n </div>\n )}\n <pre className=\"overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground\">\n {children}\n </pre>\n </div>\n );\n}\n\nexport function ChatCodeBlockNodeView({ node }: NodeViewProps) {\n return (\n <NodeViewWrapper>\n <ChatCodeBlock node={node}>\n <NodeViewContent as=\"code\" />\n </ChatCodeBlock>\n </NodeViewWrapper>\n );\n}\n"],"names":[],"mappings":";;;;AAaO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA,cAAc;AAChB,GAGG;AACD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,gBAAa;AAAA,MACb,aAAW,KAAK,MAAM;AAAA,MACtB,aAAW,KAAK,MAAM;AAAA,MACtB,WAAS,KAAK,MAAM;AAAA,MACpB,mBAAiB,KAAK,MAAM;AAAA,MAC5B,2BAAyB,OAAO,KAAK,MAAM,qBAAqB,IAAI;AAAA,MAEpE,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM,eAAe,KAAK,KAAyB;AAAA,UACnD;AAAA,UAEC,eAAK,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGN;AAEO,SAAS,oBAAoB,EAAE,MAAM,UAAyB;AACnE,SACE,oBAAC,iBAAA,EAAgB,IAAG,QAClB,UAAA,oBAAC,aAAA,EAAY,MAAY,aAAa,CAAC,OAAO,WAAA,CAAY,EAAA,CAC5D;AAEJ;AAEO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AACF,GAGG;AACD,SACE,qBAAC,OAAA,EAAI,WAAU,8EACZ,UAAA;AAAA,IAAA,KAAK,MAAM,YACV,oBAAC,OAAA,EAAI,WAAU,8FACZ,UAAA,KAAK,MAAM,SAAA,CACd;AAAA,IAEF,oBAAC,OAAA,EAAI,WAAU,yEACZ,SAAA,CACH;AAAA,EAAA,GACF;AAEJ;AAEO,SAAS,sBAAsB,EAAE,QAAuB;AAC7D,SACE,oBAAC,iBAAA,EACC,UAAA,oBAAC,eAAA,EAAc,MACb,8BAAC,iBAAA,EAAgB,IAAG,OAAA,CAAO,EAAA,CAC7B,GACF;AAEJ;"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const core = require("@tiptap/core");
4
+ const model = require("@tiptap/pm/model");
5
+ const StarterKit = require("@tiptap/starter-kit");
6
+ const CodeBlock = require("@tiptap/extension-code-block");
7
+ const react = require("@tiptap/react");
8
+ const Link = require("@tiptap/extension-link");
9
+ const Image = require("@tiptap/extension-image");
10
+ const Table = require("@tiptap/extension-table");
11
+ const TableRow = require("@tiptap/extension-table-row");
12
+ const TableCell = require("@tiptap/extension-table-cell");
13
+ const TableHeader = require("@tiptap/extension-table-header");
14
+ const TaskList = require("@tiptap/extension-task-list");
15
+ const TaskItem = require("@tiptap/extension-task-item");
16
+ const tiptapMarkdown = require("tiptap-markdown");
17
+ const mentionExtension = require("../mentions/mention-extension.cjs");
18
+ const chatNodeViews = require("./chat-node-views.cjs");
19
+ const ChatMentionExtension = mentionExtension.MentionExtension.extend({
20
+ addNodeView: () => react.ReactNodeViewRenderer(chatNodeViews.ChatMentionNodeView, { as: "span" })
21
+ });
22
+ const ChatCodeBlockExtension = CodeBlock.extend({
23
+ addNodeView: () => react.ReactNodeViewRenderer(chatNodeViews.ChatCodeBlockNodeView)
24
+ });
25
+ function createChatTextExtensions() {
26
+ return [
27
+ StarterKit.configure({ codeBlock: false }),
28
+ ChatCodeBlockExtension,
29
+ Link.configure({
30
+ openOnClick: false,
31
+ autolink: true,
32
+ linkOnPaste: true,
33
+ protocols: ["athena-point"]
34
+ }),
35
+ Image.configure({ inline: true }),
36
+ Table.configure({ resizable: false }),
37
+ TableRow,
38
+ TableCell,
39
+ TableHeader,
40
+ TaskList,
41
+ TaskItem.configure({ nested: true }),
42
+ tiptapMarkdown.Markdown.configure({
43
+ html: true,
44
+ tightLists: true,
45
+ tightListClass: "tight",
46
+ bulletListMarker: "-",
47
+ linkify: true,
48
+ breaks: true,
49
+ transformPastedText: true,
50
+ transformCopiedText: false
51
+ }),
52
+ ChatMentionExtension
53
+ ];
54
+ }
55
+ let parserEditor;
56
+ function parseChatText(markdown) {
57
+ parserEditor ?? (parserEditor = new core.Editor({
58
+ extensions: createChatTextExtensions(),
59
+ content: "",
60
+ editable: false
61
+ }));
62
+ const html = parserEditor.storage.markdown.parser.parse(markdown);
63
+ const body = new window.DOMParser().parseFromString(html, "text/html").body;
64
+ return model.DOMParser.fromSchema(parserEditor.schema).parse(body);
65
+ }
66
+ const CHAT_TEXT_CLASS = "aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2";
67
+ exports.CHAT_TEXT_CLASS = CHAT_TEXT_CLASS;
68
+ exports.createChatTextExtensions = createChatTextExtensions;
69
+ exports.parseChatText = parseChatText;
70
+ //# sourceMappingURL=chat-text-schema.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-text-schema.cjs","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport Table from \"@tiptap/extension-table\";\nimport TableRow from \"@tiptap/extension-table-row\";\nimport TableCell from \"@tiptap/extension-table-cell\";\nimport TableHeader from \"@tiptap/extension-table-header\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\nconst ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({ codeBlock: false }),\n ChatCodeBlockExtension,\n Link.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n protocols: [\"athena-point\"],\n }),\n Image.configure({ inline: true }),\n Table.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\nlet parserEditor: Editor | undefined;\n\n/** A single detached parser per browser tab, never an editor per message. */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n const html: string = parserEditor.storage.markdown.parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n return ProseMirrorDOMParser.fromSchema(parserEditor.schema).parse(body);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["MentionExtension","ReactNodeViewRenderer","ChatMentionNodeView","ChatCodeBlockNodeView","Markdown","Editor","ProseMirrorDOMParser"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,uBAAuBA,iBAAAA,iBAAiB,OAAO;AAAA,EACnD,aAAa,MAAMC,MAAAA,sBAAsBC,cAAAA,qBAAqB,EAAE,IAAI,QAAQ;AAC9E,CAAC;AACD,MAAM,yBAAyB,UAAU,OAAO;AAAA,EAC9C,aAAa,MAAMD,MAAAA,sBAAsBE,cAAAA,qBAAqB;AAChE,CAAC;AAGM,SAAS,2BAAuC;AACrD,SAAO;AAAA,IACL,WAAW,UAAU,EAAE,WAAW,OAAO;AAAA,IACzC;AAAA,IACA,KAAK,UAAU;AAAA,MACb,aAAa;AAAA,MACb,UAAU;AAAA,MACV,aAAa;AAAA,MACb,WAAW,CAAC,cAAc;AAAA,IAAA,CAC3B;AAAA,IACD,MAAM,UAAU,EAAE,QAAQ,MAAM;AAAA,IAChC,MAAM,UAAU,EAAE,WAAW,OAAO;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,UAAU,EAAE,QAAQ,MAAM;AAAA,IACnCC,eAAAA,SAAS,UAAU;AAAA,MACjB,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,kBAAkB;AAAA,MAClB,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,IAAA,CACtB;AAAA,IACD;AAAA,EAAA;AAEJ;AAEA,IAAI;AAGG,SAAS,cAAc,UAAkB;AAC9C,kCAAiB,IAAIC,KAAAA,OAAO;AAAA,IAC1B,YAAY,yBAAA;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,QAAM,OAAe,aAAa,QAAQ,SAAS,OAAO,MAAM,QAAQ;AACxE,QAAM,OAAO,IAAI,OAAO,UAAA,EAAY,gBAAgB,MAAM,WAAW,EAAE;AACvE,SAAOC,MAAAA,UAAqB,WAAW,aAAa,MAAM,EAAE,MAAM,IAAI;AACxE;AAGO,MAAM,kBACX;;;;"}
@@ -0,0 +1,7 @@
1
+ import { type Extensions } from "@tiptap/core";
2
+ /** Both the editable draft and the static message body use this schema and parser. */
3
+ export declare function createChatTextExtensions(): Extensions;
4
+ /** A single detached parser per browser tab, never an editor per message. */
5
+ export declare function parseChatText(markdown: string): import("prosemirror-model").Node;
6
+ /** Typography is shared; the composer supplies only its padding and scroll boundary. */
7
+ export declare const CHAT_TEXT_CLASS = "aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2";
@@ -0,0 +1,70 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { DOMParser } from "@tiptap/pm/model";
3
+ import StarterKit from "@tiptap/starter-kit";
4
+ import CodeBlock from "@tiptap/extension-code-block";
5
+ import { ReactNodeViewRenderer } from "@tiptap/react";
6
+ import Link from "@tiptap/extension-link";
7
+ import Image from "@tiptap/extension-image";
8
+ import Table from "@tiptap/extension-table";
9
+ import TableRow from "@tiptap/extension-table-row";
10
+ import TableCell from "@tiptap/extension-table-cell";
11
+ import TableHeader from "@tiptap/extension-table-header";
12
+ import TaskList from "@tiptap/extension-task-list";
13
+ import TaskItem from "@tiptap/extension-task-item";
14
+ import { Markdown } from "tiptap-markdown";
15
+ import { MentionExtension } from "../mentions/mention-extension.js";
16
+ import { ChatCodeBlockNodeView, ChatMentionNodeView } from "./chat-node-views.js";
17
+ const ChatMentionExtension = MentionExtension.extend({
18
+ addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: "span" })
19
+ });
20
+ const ChatCodeBlockExtension = CodeBlock.extend({
21
+ addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView)
22
+ });
23
+ function createChatTextExtensions() {
24
+ return [
25
+ StarterKit.configure({ codeBlock: false }),
26
+ ChatCodeBlockExtension,
27
+ Link.configure({
28
+ openOnClick: false,
29
+ autolink: true,
30
+ linkOnPaste: true,
31
+ protocols: ["athena-point"]
32
+ }),
33
+ Image.configure({ inline: true }),
34
+ Table.configure({ resizable: false }),
35
+ TableRow,
36
+ TableCell,
37
+ TableHeader,
38
+ TaskList,
39
+ TaskItem.configure({ nested: true }),
40
+ Markdown.configure({
41
+ html: true,
42
+ tightLists: true,
43
+ tightListClass: "tight",
44
+ bulletListMarker: "-",
45
+ linkify: true,
46
+ breaks: true,
47
+ transformPastedText: true,
48
+ transformCopiedText: false
49
+ }),
50
+ ChatMentionExtension
51
+ ];
52
+ }
53
+ let parserEditor;
54
+ function parseChatText(markdown) {
55
+ parserEditor ?? (parserEditor = new Editor({
56
+ extensions: createChatTextExtensions(),
57
+ content: "",
58
+ editable: false
59
+ }));
60
+ const html = parserEditor.storage.markdown.parser.parse(markdown);
61
+ const body = new window.DOMParser().parseFromString(html, "text/html").body;
62
+ return DOMParser.fromSchema(parserEditor.schema).parse(body);
63
+ }
64
+ const CHAT_TEXT_CLASS = "aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2";
65
+ export {
66
+ CHAT_TEXT_CLASS,
67
+ createChatTextExtensions,
68
+ parseChatText
69
+ };
70
+ //# sourceMappingURL=chat-text-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-text-schema.js","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport Table from \"@tiptap/extension-table\";\nimport TableRow from \"@tiptap/extension-table-row\";\nimport TableCell from \"@tiptap/extension-table-cell\";\nimport TableHeader from \"@tiptap/extension-table-header\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\nconst ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({ codeBlock: false }),\n ChatCodeBlockExtension,\n Link.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n protocols: [\"athena-point\"],\n }),\n Image.configure({ inline: true }),\n Table.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\nlet parserEditor: Editor | undefined;\n\n/** A single detached parser per browser tab, never an editor per message. */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n const html: string = parserEditor.storage.markdown.parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n return ProseMirrorDOMParser.fromSchema(parserEditor.schema).parse(body);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["ProseMirrorDOMParser"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,uBAAuB,iBAAiB,OAAO;AAAA,EACnD,aAAa,MAAM,sBAAsB,qBAAqB,EAAE,IAAI,QAAQ;AAC9E,CAAC;AACD,MAAM,yBAAyB,UAAU,OAAO;AAAA,EAC9C,aAAa,MAAM,sBAAsB,qBAAqB;AAChE,CAAC;AAGM,SAAS,2BAAuC;AACrD,SAAO;AAAA,IACL,WAAW,UAAU,EAAE,WAAW,OAAO;AAAA,IACzC;AAAA,IACA,KAAK,UAAU;AAAA,MACb,aAAa;AAAA,MACb,UAAU;AAAA,MACV,aAAa;AAAA,MACb,WAAW,CAAC,cAAc;AAAA,IAAA,CAC3B;AAAA,IACD,MAAM,UAAU,EAAE,QAAQ,MAAM;AAAA,IAChC,MAAM,UAAU,EAAE,WAAW,OAAO;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,UAAU,EAAE,QAAQ,MAAM;AAAA,IACnC,SAAS,UAAU;AAAA,MACjB,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,kBAAkB;AAAA,MAClB,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,IAAA,CACtB;AAAA,IACD;AAAA,EAAA;AAEJ;AAEA,IAAI;AAGG,SAAS,cAAc,UAAkB;AAC9C,kCAAiB,IAAI,OAAO;AAAA,IAC1B,YAAY,yBAAA;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,QAAM,OAAe,aAAa,QAAQ,SAAS,OAAO,MAAM,QAAQ;AACxE,QAAM,OAAO,IAAI,OAAO,UAAA,EAAY,gBAAgB,MAAM,WAAW,EAAE;AACvE,SAAOA,UAAqB,WAAW,aAAa,MAAM,EAAE,MAAM,IAAI;AACxE;AAGO,MAAM,kBACX;"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const react = require("react");
4
+ const ATTRIBUTE_PROPS = {
5
+ class: "className",
6
+ for: "htmlFor",
7
+ tabindex: "tabIndex",
8
+ contenteditable: "contentEditable",
9
+ spellcheck: "spellCheck",
10
+ colspan: "colSpan",
11
+ rowspan: "rowSpan",
12
+ readonly: "readOnly",
13
+ maxlength: "maxLength",
14
+ autocomplete: "autoComplete",
15
+ crossorigin: "crossOrigin",
16
+ srcset: "srcSet",
17
+ datetime: "dateTime"
18
+ };
19
+ function styleTextToObject(style) {
20
+ const result = {};
21
+ for (const declaration of style.split(";")) {
22
+ const separator = declaration.indexOf(":");
23
+ if (separator === -1) continue;
24
+ const property = declaration.slice(0, separator).trim();
25
+ const value = declaration.slice(separator + 1).trim();
26
+ if (property === "" || value === "") continue;
27
+ const key = property.startsWith("--") ? property : property.replace(
28
+ /-([a-z])/g,
29
+ (_match, letter) => letter.toUpperCase()
30
+ );
31
+ result[key] = value;
32
+ }
33
+ return result;
34
+ }
35
+ function attributesToProps(attrs) {
36
+ const props = {};
37
+ for (const [name, value] of Object.entries(attrs)) {
38
+ if (value === null || value === void 0) continue;
39
+ if (name === "style" && typeof value === "string") {
40
+ props.style = styleTextToObject(value);
41
+ continue;
42
+ }
43
+ if (name === "checked") {
44
+ props.defaultChecked = value !== false;
45
+ continue;
46
+ }
47
+ props[ATTRIBUTE_PROPS[name] ?? name] = value;
48
+ }
49
+ return props;
50
+ }
51
+ function isAttributeObject(value) {
52
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !(typeof Node !== "undefined" && value instanceof Node);
53
+ }
54
+ function renderDOMOutputSpec(spec, content, key) {
55
+ if (typeof spec === "string") return spec;
56
+ if (!Array.isArray(spec)) {
57
+ throw new Error(
58
+ "static message body: DOMOutputSpec must use the array form"
59
+ );
60
+ }
61
+ const [tag, ...rest] = spec;
62
+ if (typeof tag !== "string") {
63
+ throw new Error("static message body: DOMOutputSpec tag must be a string");
64
+ }
65
+ const tagName = tag.includes(" ") ? tag.slice(tag.lastIndexOf(" ") + 1) : tag;
66
+ let attrs = {};
67
+ let children = rest;
68
+ if (rest.length > 0 && isAttributeObject(rest[0])) {
69
+ attrs = rest[0];
70
+ children = rest.slice(1);
71
+ }
72
+ const rendered = children.map(
73
+ (child, index) => child === 0 ? content : renderDOMOutputSpec(child, content, index)
74
+ );
75
+ const props = attributesToProps(attrs);
76
+ if (tagName === "input") props.disabled = true;
77
+ if (key !== void 0) props.key = key;
78
+ return react.createElement(tagName, props, ...rendered);
79
+ }
80
+ exports.attributesToProps = attributesToProps;
81
+ exports.renderDOMOutputSpec = renderDOMOutputSpec;
82
+ exports.styleTextToObject = styleTextToObject;
83
+ //# sourceMappingURL=dom-output-spec.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-output-spec.cjs","sources":["../../../src/chat-ui/rich-text/dom-output-spec.tsx"],"sourcesContent":["import type { DOMOutputSpec } from \"@tiptap/pm/model\";\nimport { type CSSProperties, createElement, type ReactNode } from \"react\";\n\n/**\n * ProseMirror's `DOMOutputSpec` (what every node and mark's `renderHTML`\n * returns) rendered as React elements, so the static message body draws a\n * node exactly as the editor's DOM serializer would — same tag, same\n * attributes, same nesting — with the node's content placed at the spec's hole.\n *\n * Only the array form is supported. A spec that hands back a live DOM node\n * belongs to a node view, and those nodes never reach this renderer (the parser\n * reports them as unsupported).\n */\n\n/** HTML attribute names whose React prop is spelled differently. */\nconst ATTRIBUTE_PROPS: Readonly<Record<string, string>> = {\n class: \"className\",\n for: \"htmlFor\",\n tabindex: \"tabIndex\",\n contenteditable: \"contentEditable\",\n spellcheck: \"spellCheck\",\n colspan: \"colSpan\",\n rowspan: \"rowSpan\",\n readonly: \"readOnly\",\n maxlength: \"maxLength\",\n autocomplete: \"autoComplete\",\n crossorigin: \"crossOrigin\",\n srcset: \"srcSet\",\n datetime: \"dateTime\",\n};\n\n/** `text-align: center; --x: 1` → `{ textAlign: 'center', '--x': '1' }`. */\nexport function styleTextToObject(style: string): CSSProperties {\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const separator = declaration.indexOf(\":\");\n if (separator === -1) continue;\n const property = declaration.slice(0, separator).trim();\n const value = declaration.slice(separator + 1).trim();\n if (property === \"\" || value === \"\") continue;\n const key = property.startsWith(\"--\")\n ? property\n : property.replace(/-([a-z])/g, (_match, letter: string) =>\n letter.toUpperCase(),\n );\n result[key] = value;\n }\n return result as CSSProperties;\n}\n\n/** A spec's attribute object as React props. `null`/`undefined` values are dropped, like the serializer drops them. */\nexport function attributesToProps(\n attrs: Record<string, unknown>,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(attrs)) {\n if (value === null || value === undefined) continue;\n if (name === \"style\" && typeof value === \"string\") {\n props.style = styleTextToObject(value);\n continue;\n }\n // A checkbox spec carries `checked: 'checked'` (or null): an uncontrolled input.\n if (name === \"checked\") {\n props.defaultChecked = value !== false;\n continue;\n }\n props[ATTRIBUTE_PROPS[name] ?? name] = value;\n }\n return props;\n}\n\nfunction isAttributeObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n !(typeof Node !== \"undefined\" && value instanceof Node)\n );\n}\n\n/**\n * Render a spec, placing `content` at its hole (`0`). Throws for a spec the\n * array grammar cannot express (a DOM node, a `{ dom, contentDOM }` pair).\n */\nexport function renderDOMOutputSpec(\n spec: DOMOutputSpec,\n content: ReactNode,\n key?: string | number,\n): ReactNode {\n if (typeof spec === \"string\") return spec;\n if (!Array.isArray(spec)) {\n throw new Error(\n \"static message body: DOMOutputSpec must use the array form\",\n );\n }\n const [tag, ...rest] = spec;\n if (typeof tag !== \"string\") {\n throw new Error(\"static message body: DOMOutputSpec tag must be a string\");\n }\n // A namespaced tag (`svg:...`) is never produced by the message schema.\n const tagName = tag.includes(\" \") ? tag.slice(tag.lastIndexOf(\" \") + 1) : tag;\n let attrs: Record<string, unknown> = {};\n let children: unknown[] = rest;\n if (rest.length > 0 && isAttributeObject(rest[0])) {\n attrs = rest[0];\n children = rest.slice(1);\n }\n const rendered = children.map((child, index) =>\n child === 0\n ? content\n : renderDOMOutputSpec(child as DOMOutputSpec, content, index),\n );\n const props = attributesToProps(attrs);\n if (tagName === \"input\") props.disabled = true;\n if (key !== undefined) props.key = key;\n return createElement(tagName, props, ...rendered);\n}\n"],"names":["createElement"],"mappings":";;;AAeA,MAAM,kBAAoD;AAAA,EACxD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAA8B;AAC9D,QAAM,SAAiC,CAAA;AACvC,aAAW,eAAe,MAAM,MAAM,GAAG,GAAG;AAC1C,UAAM,YAAY,YAAY,QAAQ,GAAG;AACzC,QAAI,cAAc,GAAI;AACtB,UAAM,WAAW,YAAY,MAAM,GAAG,SAAS,EAAE,KAAA;AACjD,UAAM,QAAQ,YAAY,MAAM,YAAY,CAAC,EAAE,KAAA;AAC/C,QAAI,aAAa,MAAM,UAAU,GAAI;AACrC,UAAM,MAAM,SAAS,WAAW,IAAI,IAChC,WACA,SAAS;AAAA,MAAQ;AAAA,MAAa,CAAC,QAAQ,WACrC,OAAO,YAAA;AAAA,IAAY;AAEzB,WAAO,GAAG,IAAI;AAAA,EAChB;AACA,SAAO;AACT;AAGO,SAAS,kBACd,OACyB;AACzB,QAAM,QAAiC,CAAA;AACvC,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AACjD,QAAI,UAAU,QAAQ,UAAU,OAAW;AAC3C,QAAI,SAAS,WAAW,OAAO,UAAU,UAAU;AACjD,YAAM,QAAQ,kBAAkB,KAAK;AACrC;AAAA,IACF;AAEA,QAAI,SAAS,WAAW;AACtB,YAAM,iBAAiB,UAAU;AACjC;AAAA,IACF;AACA,UAAM,gBAAgB,IAAI,KAAK,IAAI,IAAI;AAAA,EACzC;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,OAAkD;AAC3E,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,EAAE,OAAO,SAAS,eAAe,iBAAiB;AAEtD;AAMO,SAAS,oBACd,MACA,SACA,KACW;AACX,MAAI,OAAO,SAAS,SAAU,QAAO;AACrC,MAAI,CAAC,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,QAAM,CAAC,KAAK,GAAG,IAAI,IAAI;AACvB,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,UAAU,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC,IAAI;AAC1E,MAAI,QAAiC,CAAA;AACrC,MAAI,WAAsB;AAC1B,MAAI,KAAK,SAAS,KAAK,kBAAkB,KAAK,CAAC,CAAC,GAAG;AACjD,YAAQ,KAAK,CAAC;AACd,eAAW,KAAK,MAAM,CAAC;AAAA,EACzB;AACA,QAAM,WAAW,SAAS;AAAA,IAAI,CAAC,OAAO,UACpC,UAAU,IACN,UACA,oBAAoB,OAAwB,SAAS,KAAK;AAAA,EAAA;AAEhE,QAAM,QAAQ,kBAAkB,KAAK;AACrC,MAAI,YAAY,QAAS,OAAM,WAAW;AAC1C,MAAI,QAAQ,OAAW,OAAM,MAAM;AACnC,SAAOA,oBAAc,SAAS,OAAO,GAAG,QAAQ;AAClD;;;;"}
@@ -0,0 +1,11 @@
1
+ import type { DOMOutputSpec } from "@tiptap/pm/model";
2
+ import { type CSSProperties, type ReactNode } from "react";
3
+ /** `text-align: center; --x: 1` → `{ textAlign: 'center', '--x': '1' }`. */
4
+ export declare function styleTextToObject(style: string): CSSProperties;
5
+ /** A spec's attribute object as React props. `null`/`undefined` values are dropped, like the serializer drops them. */
6
+ export declare function attributesToProps(attrs: Record<string, unknown>): Record<string, unknown>;
7
+ /**
8
+ * Render a spec, placing `content` at its hole (`0`). Throws for a spec the
9
+ * array grammar cannot express (a DOM node, a `{ dom, contentDOM }` pair).
10
+ */
11
+ export declare function renderDOMOutputSpec(spec: DOMOutputSpec, content: ReactNode, key?: string | number): ReactNode;
@@ -0,0 +1,83 @@
1
+ import { createElement } from "react";
2
+ const ATTRIBUTE_PROPS = {
3
+ class: "className",
4
+ for: "htmlFor",
5
+ tabindex: "tabIndex",
6
+ contenteditable: "contentEditable",
7
+ spellcheck: "spellCheck",
8
+ colspan: "colSpan",
9
+ rowspan: "rowSpan",
10
+ readonly: "readOnly",
11
+ maxlength: "maxLength",
12
+ autocomplete: "autoComplete",
13
+ crossorigin: "crossOrigin",
14
+ srcset: "srcSet",
15
+ datetime: "dateTime"
16
+ };
17
+ function styleTextToObject(style) {
18
+ const result = {};
19
+ for (const declaration of style.split(";")) {
20
+ const separator = declaration.indexOf(":");
21
+ if (separator === -1) continue;
22
+ const property = declaration.slice(0, separator).trim();
23
+ const value = declaration.slice(separator + 1).trim();
24
+ if (property === "" || value === "") continue;
25
+ const key = property.startsWith("--") ? property : property.replace(
26
+ /-([a-z])/g,
27
+ (_match, letter) => letter.toUpperCase()
28
+ );
29
+ result[key] = value;
30
+ }
31
+ return result;
32
+ }
33
+ function attributesToProps(attrs) {
34
+ const props = {};
35
+ for (const [name, value] of Object.entries(attrs)) {
36
+ if (value === null || value === void 0) continue;
37
+ if (name === "style" && typeof value === "string") {
38
+ props.style = styleTextToObject(value);
39
+ continue;
40
+ }
41
+ if (name === "checked") {
42
+ props.defaultChecked = value !== false;
43
+ continue;
44
+ }
45
+ props[ATTRIBUTE_PROPS[name] ?? name] = value;
46
+ }
47
+ return props;
48
+ }
49
+ function isAttributeObject(value) {
50
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !(typeof Node !== "undefined" && value instanceof Node);
51
+ }
52
+ function renderDOMOutputSpec(spec, content, key) {
53
+ if (typeof spec === "string") return spec;
54
+ if (!Array.isArray(spec)) {
55
+ throw new Error(
56
+ "static message body: DOMOutputSpec must use the array form"
57
+ );
58
+ }
59
+ const [tag, ...rest] = spec;
60
+ if (typeof tag !== "string") {
61
+ throw new Error("static message body: DOMOutputSpec tag must be a string");
62
+ }
63
+ const tagName = tag.includes(" ") ? tag.slice(tag.lastIndexOf(" ") + 1) : tag;
64
+ let attrs = {};
65
+ let children = rest;
66
+ if (rest.length > 0 && isAttributeObject(rest[0])) {
67
+ attrs = rest[0];
68
+ children = rest.slice(1);
69
+ }
70
+ const rendered = children.map(
71
+ (child, index) => child === 0 ? content : renderDOMOutputSpec(child, content, index)
72
+ );
73
+ const props = attributesToProps(attrs);
74
+ if (tagName === "input") props.disabled = true;
75
+ if (key !== void 0) props.key = key;
76
+ return createElement(tagName, props, ...rendered);
77
+ }
78
+ export {
79
+ attributesToProps,
80
+ renderDOMOutputSpec,
81
+ styleTextToObject
82
+ };
83
+ //# sourceMappingURL=dom-output-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-output-spec.js","sources":["../../../src/chat-ui/rich-text/dom-output-spec.tsx"],"sourcesContent":["import type { DOMOutputSpec } from \"@tiptap/pm/model\";\nimport { type CSSProperties, createElement, type ReactNode } from \"react\";\n\n/**\n * ProseMirror's `DOMOutputSpec` (what every node and mark's `renderHTML`\n * returns) rendered as React elements, so the static message body draws a\n * node exactly as the editor's DOM serializer would — same tag, same\n * attributes, same nesting — with the node's content placed at the spec's hole.\n *\n * Only the array form is supported. A spec that hands back a live DOM node\n * belongs to a node view, and those nodes never reach this renderer (the parser\n * reports them as unsupported).\n */\n\n/** HTML attribute names whose React prop is spelled differently. */\nconst ATTRIBUTE_PROPS: Readonly<Record<string, string>> = {\n class: \"className\",\n for: \"htmlFor\",\n tabindex: \"tabIndex\",\n contenteditable: \"contentEditable\",\n spellcheck: \"spellCheck\",\n colspan: \"colSpan\",\n rowspan: \"rowSpan\",\n readonly: \"readOnly\",\n maxlength: \"maxLength\",\n autocomplete: \"autoComplete\",\n crossorigin: \"crossOrigin\",\n srcset: \"srcSet\",\n datetime: \"dateTime\",\n};\n\n/** `text-align: center; --x: 1` → `{ textAlign: 'center', '--x': '1' }`. */\nexport function styleTextToObject(style: string): CSSProperties {\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const separator = declaration.indexOf(\":\");\n if (separator === -1) continue;\n const property = declaration.slice(0, separator).trim();\n const value = declaration.slice(separator + 1).trim();\n if (property === \"\" || value === \"\") continue;\n const key = property.startsWith(\"--\")\n ? property\n : property.replace(/-([a-z])/g, (_match, letter: string) =>\n letter.toUpperCase(),\n );\n result[key] = value;\n }\n return result as CSSProperties;\n}\n\n/** A spec's attribute object as React props. `null`/`undefined` values are dropped, like the serializer drops them. */\nexport function attributesToProps(\n attrs: Record<string, unknown>,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(attrs)) {\n if (value === null || value === undefined) continue;\n if (name === \"style\" && typeof value === \"string\") {\n props.style = styleTextToObject(value);\n continue;\n }\n // A checkbox spec carries `checked: 'checked'` (or null): an uncontrolled input.\n if (name === \"checked\") {\n props.defaultChecked = value !== false;\n continue;\n }\n props[ATTRIBUTE_PROPS[name] ?? name] = value;\n }\n return props;\n}\n\nfunction isAttributeObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n !(typeof Node !== \"undefined\" && value instanceof Node)\n );\n}\n\n/**\n * Render a spec, placing `content` at its hole (`0`). Throws for a spec the\n * array grammar cannot express (a DOM node, a `{ dom, contentDOM }` pair).\n */\nexport function renderDOMOutputSpec(\n spec: DOMOutputSpec,\n content: ReactNode,\n key?: string | number,\n): ReactNode {\n if (typeof spec === \"string\") return spec;\n if (!Array.isArray(spec)) {\n throw new Error(\n \"static message body: DOMOutputSpec must use the array form\",\n );\n }\n const [tag, ...rest] = spec;\n if (typeof tag !== \"string\") {\n throw new Error(\"static message body: DOMOutputSpec tag must be a string\");\n }\n // A namespaced tag (`svg:...`) is never produced by the message schema.\n const tagName = tag.includes(\" \") ? tag.slice(tag.lastIndexOf(\" \") + 1) : tag;\n let attrs: Record<string, unknown> = {};\n let children: unknown[] = rest;\n if (rest.length > 0 && isAttributeObject(rest[0])) {\n attrs = rest[0];\n children = rest.slice(1);\n }\n const rendered = children.map((child, index) =>\n child === 0\n ? content\n : renderDOMOutputSpec(child as DOMOutputSpec, content, index),\n );\n const props = attributesToProps(attrs);\n if (tagName === \"input\") props.disabled = true;\n if (key !== undefined) props.key = key;\n return createElement(tagName, props, ...rendered);\n}\n"],"names":[],"mappings":";AAeA,MAAM,kBAAoD;AAAA,EACxD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAA8B;AAC9D,QAAM,SAAiC,CAAA;AACvC,aAAW,eAAe,MAAM,MAAM,GAAG,GAAG;AAC1C,UAAM,YAAY,YAAY,QAAQ,GAAG;AACzC,QAAI,cAAc,GAAI;AACtB,UAAM,WAAW,YAAY,MAAM,GAAG,SAAS,EAAE,KAAA;AACjD,UAAM,QAAQ,YAAY,MAAM,YAAY,CAAC,EAAE,KAAA;AAC/C,QAAI,aAAa,MAAM,UAAU,GAAI;AACrC,UAAM,MAAM,SAAS,WAAW,IAAI,IAChC,WACA,SAAS;AAAA,MAAQ;AAAA,MAAa,CAAC,QAAQ,WACrC,OAAO,YAAA;AAAA,IAAY;AAEzB,WAAO,GAAG,IAAI;AAAA,EAChB;AACA,SAAO;AACT;AAGO,SAAS,kBACd,OACyB;AACzB,QAAM,QAAiC,CAAA;AACvC,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AACjD,QAAI,UAAU,QAAQ,UAAU,OAAW;AAC3C,QAAI,SAAS,WAAW,OAAO,UAAU,UAAU;AACjD,YAAM,QAAQ,kBAAkB,KAAK;AACrC;AAAA,IACF;AAEA,QAAI,SAAS,WAAW;AACtB,YAAM,iBAAiB,UAAU;AACjC;AAAA,IACF;AACA,UAAM,gBAAgB,IAAI,KAAK,IAAI,IAAI;AAAA,EACzC;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,OAAkD;AAC3E,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,EAAE,OAAO,SAAS,eAAe,iBAAiB;AAEtD;AAMO,SAAS,oBACd,MACA,SACA,KACW;AACX,MAAI,OAAO,SAAS,SAAU,QAAO;AACrC,MAAI,CAAC,MAAM,QAAQ,IAAI,GAAG;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,QAAM,CAAC,KAAK,GAAG,IAAI,IAAI;AACvB,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,UAAU,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,IAAI,YAAY,GAAG,IAAI,CAAC,IAAI;AAC1E,MAAI,QAAiC,CAAA;AACrC,MAAI,WAAsB;AAC1B,MAAI,KAAK,SAAS,KAAK,kBAAkB,KAAK,CAAC,CAAC,GAAG;AACjD,YAAQ,KAAK,CAAC;AACd,eAAW,KAAK,MAAM,CAAC;AAAA,EACzB;AACA,QAAM,WAAW,SAAS;AAAA,IAAI,CAAC,OAAO,UACpC,UAAU,IACN,UACA,oBAAoB,OAAwB,SAAS,KAAK;AAAA,EAAA;AAEhE,QAAM,QAAQ,kBAAkB,KAAK;AACrC,MAAI,YAAY,QAAS,OAAM,WAAW;AAC1C,MAAI,QAAQ,OAAW,OAAM,MAAM;AACnC,SAAO,cAAc,SAAS,OAAO,GAAG,QAAQ;AAClD;"}
@@ -19,10 +19,11 @@ require("../packages/agent-runtime/src/messages.cjs");
19
19
  require("../packages/agent-runtime/src/statewire-state.cjs");
20
20
  require("@assistant-ui/react-statewire");
21
21
  require("@assistant-ui/store");
22
- require("@assistant-ui/react-statewire/local-storage");
22
+ require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
23
23
  require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
24
24
  require("../packages/agent-runtime/src/thread-status.cjs");
25
25
  require("@assistant-ui/core");
26
+ require("../packages/agent-runtime/src/thread-handoff.cjs");
26
27
  exports.StatewireApprovalCard = StatewireApprovalCard.StatewireApprovalCard;
27
28
  exports.useStatewireApprovalRequest = useStatewireApprovalRequest.useStatewireApprovalRequest;
28
29
  exports.StatewireQueuedMessages = StatewireQueuedMessages.StatewireQueuedMessages;
@@ -1 +1 @@
1
- {"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -17,10 +17,11 @@ import "../packages/agent-runtime/src/messages.js";
17
17
  import "../packages/agent-runtime/src/statewire-state.js";
18
18
  import "@assistant-ui/react-statewire";
19
19
  import "@assistant-ui/store";
20
- import "@assistant-ui/react-statewire/local-storage";
20
+ import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
21
21
  import "../packages/agent-runtime/src/statewire-attach-observer.js";
22
22
  import "../packages/agent-runtime/src/thread-status.js";
23
23
  import "@assistant-ui/core";
24
+ import "../packages/agent-runtime/src/thread-handoff.js";
24
25
  export {
25
26
  ContinuePill,
26
27
  HITL_PENDING_RESUME_GRACE_MS,
@@ -1 +1 @@
1
- {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,11 +13,12 @@ require("../../packages/agent-runtime/src/statewire-state.cjs");
13
13
  require("../../packages/agent-runtime/src/messages.cjs");
14
14
  const useDeepAgentWindowSync = require("../../packages/agent-runtime/src/use-deep-agent-window-sync.cjs");
15
15
  require("@assistant-ui/store");
16
- require("@assistant-ui/react-statewire/local-storage");
16
+ require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
17
17
  require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
18
18
  require("../../packages/agent-runtime/src/thread-status.cjs");
19
19
  require("@assistant-ui/react-statewire");
20
20
  require("@assistant-ui/core");
21
+ require("../../packages/agent-runtime/src/thread-handoff.cjs");
21
22
  const statewireWindowContext = require("../../provider/statewire-window-context.cjs");
22
23
  const cnfast = require("cnfast");
23
24
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history on a windowed wire: how many older\n * messages the server still holds, a manual way to load the next page, and\n * the in-flight state. Renders nothing when the whole transcript is loaded\n * (or the wire is not windowed).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n olderCount,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (olderCount <= 0) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {olderCount.toLocaleString()} earlier {olderCount === 1 ? \"message\" : \"messages\"}\n </button>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the windowed wire for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"N earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert on a wire that is not windowed: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, olderCount]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n olderCount={olderCount}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","jsxs","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":"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"}
1
+ {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history on a windowed wire: how many older\n * messages the server still holds, a manual way to load the next page, and\n * the in-flight state. Renders nothing when the whole transcript is loaded\n * (or the wire is not windowed).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n olderCount,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (olderCount <= 0) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {olderCount.toLocaleString()} earlier {olderCount === 1 ? \"message\" : \"messages\"}\n </button>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the windowed wire for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"N earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert on a wire that is not windowed: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, olderCount]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n olderCount={olderCount}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","jsxs","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":"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"}
@@ -11,11 +11,12 @@ import "../../packages/agent-runtime/src/statewire-state.js";
11
11
  import "../../packages/agent-runtime/src/messages.js";
12
12
  import { useDeepAgentWindowSync } from "../../packages/agent-runtime/src/use-deep-agent-window-sync.js";
13
13
  import "@assistant-ui/store";
14
- import "@assistant-ui/react-statewire/local-storage";
14
+ import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
15
15
  import "../../packages/agent-runtime/src/statewire-attach-observer.js";
16
16
  import "../../packages/agent-runtime/src/thread-status.js";
17
17
  import "@assistant-ui/react-statewire";
18
18
  import "@assistant-ui/core";
19
+ import "../../packages/agent-runtime/src/thread-handoff.js";
19
20
  import { useStatewireToolOutputs } from "../../provider/statewire-window-context.js";
20
21
  import { cn } from "cnfast";
21
22
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";