@athenaintel/react 0.41.2 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/README.md +108 -9
  2. package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
  3. package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
  4. package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
  5. package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
  6. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
  7. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
  8. package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
  9. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
  10. package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
  11. package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
  12. package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
  13. package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
  14. package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
  15. package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
  16. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
  19. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
  21. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
  23. package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
  24. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
  26. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
  28. package/dist/agent-runtime/src/chat-outbox.js +696 -0
  29. package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
  31. package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
  32. package/dist/agent-runtime/src/client-tools.d.ts +133 -0
  33. package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
  34. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  35. package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
  36. package/dist/agent-runtime/src/composer-markdown.js +10 -0
  37. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  38. package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
  39. package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
  40. package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
  41. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
  42. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  43. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
  44. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
  45. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  46. package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
  47. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs +158 -0
  48. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
  49. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  50. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
  51. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -0
  52. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  53. package/dist/agent-runtime/src/errors.d.ts +174 -0
  54. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  55. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  56. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  57. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  58. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  59. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  60. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  61. package/dist/agent-runtime/src/index.d.ts +74 -0
  62. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  63. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  64. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  65. package/dist/agent-runtime/src/interrupts.js +17 -0
  66. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  67. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  68. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  69. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  70. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  71. package/dist/agent-runtime/src/lane-history.js +209 -0
  72. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  73. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  74. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  75. package/dist/agent-runtime/src/message-text.cjs +15 -0
  76. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  77. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  78. package/dist/agent-runtime/src/message-text.js +15 -0
  79. package/dist/agent-runtime/src/message-text.js.map +1 -0
  80. package/dist/agent-runtime/src/message-window.cjs +15 -1
  81. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  82. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  83. package/dist/agent-runtime/src/message-window.js +16 -2
  84. package/dist/agent-runtime/src/message-window.js.map +1 -1
  85. package/dist/agent-runtime/src/messages.cjs +88 -4
  86. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  87. package/dist/agent-runtime/src/messages.d.ts +603 -0
  88. package/dist/agent-runtime/src/messages.js +88 -4
  89. package/dist/agent-runtime/src/messages.js.map +1 -1
  90. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  91. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  92. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  93. package/dist/agent-runtime/src/protocol.cjs +12 -4
  94. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  95. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  96. package/dist/agent-runtime/src/protocol.js +13 -5
  97. package/dist/agent-runtime/src/protocol.js.map +1 -1
  98. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  99. package/dist/agent-runtime/src/queue.d.ts +138 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
  101. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  102. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  103. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  104. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  105. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  106. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  107. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  108. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  109. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  110. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  111. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  112. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  113. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  114. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  115. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  116. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  117. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  118. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  119. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  120. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  121. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  122. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  123. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  124. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  125. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  126. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  127. package/dist/agent-runtime/src/subagents.cjs +253 -0
  128. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  130. package/dist/agent-runtime/src/subagents.js +253 -0
  131. package/dist/agent-runtime/src/subagents.js.map +1 -0
  132. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  133. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  134. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  135. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  136. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  137. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  138. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +329 -0
  139. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
  140. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  141. package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
  142. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
  143. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  144. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  145. package/dist/agent-runtime/src/tool-names.cjs +67 -0
  146. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  147. package/dist/agent-runtime/src/tool-names.d.ts +60 -0
  148. package/dist/agent-runtime/src/tool-names.js +68 -1
  149. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  150. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  151. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  152. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  153. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  154. package/dist/agent-runtime/src/tool-result.js +1 -0
  155. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  156. package/dist/agent-runtime/src/types.d.ts +159 -0
  157. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  158. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  159. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  160. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  161. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  162. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  163. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  164. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  165. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  166. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  167. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  168. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  169. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
  170. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
  172. package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
  173. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
  175. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
  177. package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
  178. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
  180. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  181. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  182. package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
  183. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  184. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  185. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  186. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  187. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  188. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  189. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  190. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  191. package/dist/chat/AthenaChat.cjs +77 -6
  192. package/dist/chat/AthenaChat.cjs.map +1 -1
  193. package/dist/chat/AthenaChat.js +78 -7
  194. package/dist/chat/AthenaChat.js.map +1 -1
  195. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  196. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  197. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  198. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  199. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  200. package/dist/chat/StatewireQueuedMessages.js +11 -4
  201. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  202. package/dist/chat/chat-outbox-rows.cjs +223 -0
  203. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  204. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  205. package/dist/chat/chat-outbox-rows.js +223 -0
  206. package/dist/chat/chat-outbox-rows.js.map +1 -0
  207. package/dist/chat/statewire-approval.d.ts +1 -1
  208. package/dist/chat/statewire-client-tools.d.ts +1 -1
  209. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  210. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  211. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  212. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  213. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  214. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  215. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  216. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  217. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  218. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  219. package/dist/chat/super-grouping/activity-timeline.cjs +19 -11
  220. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  221. package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
  222. package/dist/chat/super-grouping/activity-timeline.js +19 -11
  223. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  224. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  225. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  226. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  227. package/dist/chat/use-statewire-approval-request.js +39 -3
  228. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  229. package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
  230. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  231. package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
  232. package/dist/chat-ui/composer/tiptap-composer.js +103 -4
  233. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  234. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  235. package/dist/chat-ui/index.d.ts +1 -1
  236. package/dist/chat-ui/messages/message-components.cjs +15 -0
  237. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  238. package/dist/chat-ui/messages/message-components.js +15 -0
  239. package/dist/chat-ui/messages/message-components.js.map +1 -1
  240. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  241. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  242. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  243. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  244. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  245. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  246. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  247. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  248. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  249. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  250. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  251. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  252. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  253. package/dist/chat-ui/statewire.cjs +1 -0
  254. package/dist/chat-ui/statewire.cjs.map +1 -1
  255. package/dist/chat-ui/statewire.d.ts +2 -2
  256. package/dist/chat-ui/statewire.js +2 -1
  257. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  258. package/dist/composer/AttachmentContext.cjs +8 -4
  259. package/dist/composer/AttachmentContext.cjs.map +1 -1
  260. package/dist/composer/AttachmentContext.d.ts +7 -0
  261. package/dist/composer/AttachmentContext.js +8 -4
  262. package/dist/composer/AttachmentContext.js.map +1 -1
  263. package/dist/composer/build-composed-message.cjs +34 -0
  264. package/dist/composer/build-composed-message.cjs.map +1 -1
  265. package/dist/composer/build-composed-message.d.ts +20 -0
  266. package/dist/composer/build-composed-message.js +35 -1
  267. package/dist/composer/build-composed-message.js.map +1 -1
  268. package/dist/composer/composer-handoff.cjs +39 -2
  269. package/dist/composer/composer-handoff.cjs.map +1 -1
  270. package/dist/composer/composer-handoff.d.ts +28 -3
  271. package/dist/composer/composer-handoff.js +39 -2
  272. package/dist/composer/composer-handoff.js.map +1 -1
  273. package/dist/composer/useAttachFiles.cjs +15 -2
  274. package/dist/composer/useAttachFiles.cjs.map +1 -1
  275. package/dist/composer/useAttachFiles.d.ts +11 -0
  276. package/dist/composer/useAttachFiles.js +15 -2
  277. package/dist/composer/useAttachFiles.js.map +1 -1
  278. package/dist/composer/useSendMessage.cjs.map +1 -1
  279. package/dist/composer/useSendMessage.d.ts +4 -3
  280. package/dist/composer/useSendMessage.js.map +1 -1
  281. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  282. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  283. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  284. package/dist/index.cjs +18 -0
  285. package/dist/index.cjs.map +1 -1
  286. package/dist/index.d.ts +15 -6
  287. package/dist/index.js +19 -1
  288. package/dist/index.js.map +1 -1
  289. package/dist/offline/chat-outbox.cjs +57 -0
  290. package/dist/offline/chat-outbox.cjs.map +1 -0
  291. package/dist/offline/chat-outbox.d.ts +80 -0
  292. package/dist/offline/chat-outbox.js +57 -0
  293. package/dist/offline/chat-outbox.js.map +1 -0
  294. package/dist/offline/offline-history.cjs +77 -0
  295. package/dist/offline/offline-history.cjs.map +1 -0
  296. package/dist/offline/offline-history.d.ts +60 -0
  297. package/dist/offline/offline-history.js +77 -0
  298. package/dist/offline/offline-history.js.map +1 -0
  299. package/dist/provider/AthenaProvider.cjs +206 -9
  300. package/dist/provider/AthenaProvider.cjs.map +1 -1
  301. package/dist/provider/AthenaProvider.d.ts +22 -1
  302. package/dist/provider/AthenaProvider.js +207 -10
  303. package/dist/provider/AthenaProvider.js.map +1 -1
  304. package/dist/provider/statewire-window-context.d.ts +1 -1
  305. package/dist/react/package.json.cjs +1 -1
  306. package/dist/react/package.json.js +1 -1
  307. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  308. package/dist/references/src/anchors/format.d.ts +21 -0
  309. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  310. package/dist/references/src/anchors/parse.d.ts +8 -0
  311. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  312. package/dist/references/src/anchors/registry.d.ts +19 -0
  313. package/dist/references/src/anchors/schemas.d.ts +194 -0
  314. package/dist/references/src/anchors/serialize.d.ts +8 -0
  315. package/dist/references/src/anchors/time.d.ts +78 -0
  316. package/dist/references/src/anchors/types.d.ts +474 -0
  317. package/dist/references/src/asset-bounds.d.ts +27 -0
  318. package/dist/references/src/asset-links.d.ts +23 -0
  319. package/dist/references/src/asset-reference.d.ts +16 -0
  320. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  321. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  322. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  323. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  324. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  325. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  326. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  327. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  328. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  329. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  330. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  331. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  332. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  333. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  334. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  335. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  336. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  337. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  338. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  339. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  340. package/dist/references/src/index.d.ts +47 -0
  341. package/dist/references/src/legacy/index.d.ts +14 -0
  342. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  343. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  344. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  345. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  346. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  347. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  348. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  349. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  350. package/dist/references/src/legacy.d.ts +2 -0
  351. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  352. package/dist/references/src/mention-node/index.d.ts +5 -0
  353. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  354. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  355. package/dist/references/src/parse-reference.d.ts +23 -0
  356. package/dist/references/src/schemas.d.ts +463 -0
  357. package/dist/references/src/serialize-reference.d.ts +50 -0
  358. package/dist/references/src/sheet-name.d.ts +10 -0
  359. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  360. package/dist/references/src/types.d.ts +125 -0
  361. package/dist/references/src/version-ref.d.ts +30 -0
  362. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  363. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  364. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  365. package/dist/runtime/statewire-session-key.cjs +7 -0
  366. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  367. package/dist/runtime/statewire-session-key.d.ts +16 -0
  368. package/dist/runtime/statewire-session-key.js +8 -1
  369. package/dist/runtime/statewire-session-key.js.map +1 -1
  370. package/dist/runtime/statewire-session-lane.cjs +48 -0
  371. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  372. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  373. package/dist/runtime/statewire-session-lane.js +48 -0
  374. package/dist/runtime/statewire-session-lane.js.map +1 -0
  375. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  376. package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
  377. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  378. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  379. package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
  380. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  381. package/dist/styles.css +1 -1
  382. package/dist/threads/api.d.ts +1 -1
  383. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  384. package/dist/threads/index-triggered-refresh.cjs +164 -0
  385. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  386. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  387. package/dist/threads/index-triggered-refresh.js +164 -0
  388. package/dist/threads/index-triggered-refresh.js.map +1 -0
  389. package/dist/threads/offline-session-list.cjs +75 -0
  390. package/dist/threads/offline-session-list.cjs.map +1 -0
  391. package/dist/threads/offline-session-list.d.ts +27 -0
  392. package/dist/threads/offline-session-list.js +75 -0
  393. package/dist/threads/offline-session-list.js.map +1 -0
  394. package/dist/threads/pull-request-display.d.ts +1 -1
  395. package/dist/threads/session-list-model.d.ts +1 -1
  396. package/dist/threads/session-list-tab-share.cjs +150 -0
  397. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  398. package/dist/threads/session-list-tab-share.d.ts +73 -0
  399. package/dist/threads/session-list-tab-share.js +150 -0
  400. package/dist/threads/session-list-tab-share.js.map +1 -0
  401. package/dist/threads/session-row-parts.d.ts +1 -1
  402. package/dist/threads/sessions-query.d.ts +1 -1
  403. package/dist/threads/statewire-thread-list.cjs +105 -20
  404. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  405. package/dist/threads/statewire-thread-list.d.ts +31 -3
  406. package/dist/threads/statewire-thread-list.js +107 -22
  407. package/dist/threads/statewire-thread-list.js.map +1 -1
  408. package/dist/threads/thread-prefetcher.d.ts +1 -1
  409. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  410. package/dist/threads/use-athena-sessions.cjs +32 -22
  411. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  412. package/dist/threads/use-athena-sessions.js +33 -23
  413. package/dist/threads/use-athena-sessions.js.map +1 -1
  414. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  415. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  416. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  417. package/dist/tools/NestedPtcMessages.cjs +14 -9
  418. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  419. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  420. package/dist/tools/NestedPtcMessages.js +6 -1
  421. package/dist/tools/NestedPtcMessages.js.map +1 -1
  422. package/dist/tools/index.d.ts +1 -1
  423. package/dist/tools/primitives.d.ts +1 -1
  424. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  425. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  426. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  427. package/dist/tools/subagent-task-tool-ui.js +494 -0
  428. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  429. package/dist/tools/tool-fallback.d.ts +1 -1
  430. package/dist/tools/tool-icons.d.ts +1 -1
  431. package/dist/tools/tool-summary.d.ts +1 -1
  432. package/dist/tools/tool-uis.cjs +4 -0
  433. package/dist/tools/tool-uis.cjs.map +1 -1
  434. package/dist/tools/tool-uis.js +4 -0
  435. package/dist/tools/tool-uis.js.map +1 -1
  436. package/dist/voice/chat.cjs +6 -0
  437. package/dist/voice/chat.cjs.map +1 -0
  438. package/dist/voice/chat.d.ts +2 -0
  439. package/dist/voice/chat.js +6 -0
  440. package/dist/voice/chat.js.map +1 -0
  441. package/dist/voice/livekit-join.cjs +119 -0
  442. package/dist/voice/livekit-join.cjs.map +1 -0
  443. package/dist/voice/livekit-join.d.ts +8 -0
  444. package/dist/voice/livekit-join.js +119 -0
  445. package/dist/voice/livekit-join.js.map +1 -0
  446. package/dist/voice/livekit.cjs +32 -0
  447. package/dist/voice/livekit.cjs.map +1 -0
  448. package/dist/voice/livekit.d.ts +80 -0
  449. package/dist/voice/livekit.js +32 -0
  450. package/dist/voice/livekit.js.map +1 -0
  451. package/package.json +20 -10
@@ -1 +1 @@
1
- {"version":3,"file":"use-athena-sessions.cjs","sources":["../../src/threads/use-athena-sessions.ts"],"sourcesContent":["/**\n * `useAthenaSessions(query)` — one filtered, sorted, live session list under\n * `<AthenaProvider enableThreadList>`: the data layer of `SessionsPage` and\n * `Inbox`, for hosts drawing their own.\n *\n * - **Server-side.** The query travels to `POST /api/conversations/threads/list`\n * as filters of the server's one page statement (`planSessionsQuery`), over\n * the shared two-tier pager (`useConversationList`: a live first page and\n * frozen history pages) in the thread-list provider's query client.\n * - **Live.** Rows fold the same conversation-index pushes the sidebar folds\n * (titles, lifecycle, attention flip in place), carry the provider's\n * in-flight writes (pin, rename, read state, archive), and a thread the\n * index learns about that the list does not show yet refreshes the list\n * once.\n * - **Degraded, not wrong.** A server that cannot apply part of the query is\n * detected from its `supported_filters` echo (one `limit: 1` probe per\n * identity). Fields the loaded rows can be tested on are applied to them\n * (`degradedFields`: exact per page, a page can come back short); fields\n * they cannot are reported in `unavailableFields` and not applied, so a\n * control for them can be disabled rather than lie.\n */\nimport {\n type ConversationListFilter,\n type ConversationSummary,\n useConversationList,\n} from '@athenaintel/agent-runtime';\nimport { useQuery } from '@tanstack/react-query';\nimport { useContext, useEffect, useMemo, useRef } from 'react';\nimport { useAthenaQueryClient } from '../lib/use-athena-rest-query';\nimport { withCredentialRenewal } from '../runtime/credential-renewal';\nimport { listThreads } from './api';\nimport { createRestConversationListFetcher } from './conversation-list-fetcher';\nimport {\n type AthenaSessionsQuery,\n type AthenaSessionsQueryField,\n matchesSessionsQuery,\n planSessionsQuery,\n sessionsQueryFromKey,\n sessionsQueryKey,\n sortSessions,\n supportedFiltersFromResponse,\n unavailableSessionsQueryFields,\n} from './sessions-query';\nimport {\n AthenaSessionsLiveContext,\n type AthenaStatewireThreadSummary,\n foldConversationIndex,\n indexedThreadsToRefreshFor,\n threadSummaryFromConversation,\n} from './statewire-thread-list';\n\nexport interface UseAthenaSessionsOptions {\n /** What to list. A new object with the same content does not refetch. */\n query: AthenaSessionsQuery;\n /** Rows per page (default 50). */\n pageSize?: number;\n /** `false` holds the list idle. Default `true`. */\n enabled?: boolean;\n}\n\nexport interface AthenaSessionsList {\n /** The rows, in the query's order, with live pushes and in-flight writes applied. */\n rows: AthenaStatewireThreadSummary[];\n /** `false` outside `enableThreadList` mode: nothing is fetched and `rows` stays empty. */\n isAvailable: boolean;\n /** True until the first page has answered (or while no credential has resolved). */\n isLoading: boolean;\n isFetching: boolean;\n hasResolvedFirstPage: boolean;\n /**\n * True while the rows are the previous query's (checked against this\n * query's local part) because this query's first page is still in flight.\n */\n isPlaceholderData: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n fetchNextPage: () => void;\n /** Refetch the first page; resolves once it has answered. */\n refresh: () => Promise<void>;\n /** True while the last \"load more\" request failed. */\n isFetchNextPageError: boolean;\n /**\n * The server fields this backend applies (`supported_filters`), `null`\n * while unknown or on a backend that predates the list.\n */\n supportedFilters: ReadonlySet<string> | null;\n /** Fields applied to the loaded rows because the backend cannot. */\n degradedFields: AthenaSessionsQueryField[];\n /** Fields of this query that cannot be applied on this backend at all (and are not). */\n unavailableFields: AthenaSessionsQueryField[];\n /**\n * Every field this backend cannot apply anywhere, selected or not — what a\n * filter UI disables. Empty until the capabilities probe has answered.\n */\n unsupportedFields: AthenaSessionsQueryField[];\n}\n\nconst DEFAULT_PAGE_SIZE = 50;\n\n/** The capabilities probe's key prefix. */\nexport const THREAD_LIST_CAPABILITIES_QUERY_KEY = [\n 'athena-sdk',\n 'thread-list-capabilities',\n] as const;\n\nconst EMPTY_ROWS: AthenaStatewireThreadSummary[] = [];\nconst NOOP = () => undefined;\nconst NOOP_ASYNC = async () => undefined;\n\nexport function useAthenaSessions({\n query,\n pageSize = DEFAULT_PAGE_SIZE,\n enabled = true,\n}: UseAthenaSessionsOptions): AthenaSessionsList {\n const live = useContext(AthenaSessionsLiveContext);\n const isAvailable = live !== null;\n const backendUrl = live?.backendUrl ?? '';\n const principal = live?.principal ?? '';\n const hasAuth = live?.hasAuth ?? false;\n const includePullRequests = live?.includePullRequests ?? false;\n const getAuth = live?.getAuth;\n const active = isAvailable && enabled && hasAuth;\n // Every cache below is keyed by WHO reads (principal) and WITH WHAT (the\n // credential generation): a scoped credential for another workspace under\n // the same principal must never read this one's cached rows.\n const identityScope = `${live?.scopeKey ?? 'unavailable'}::credential-${\n live?.credentialGeneration ?? 0\n }`;\n\n // Outside thread-list mode there may be no `QueryClientProvider`; every\n // query below is disabled there, on a client of this hook's own.\n const queryClient = useAthenaQueryClient();\n\n // Which filters this backend applies: one tiny page per identity. The\n // answer is a property of the deployed agora, so it never goes stale.\n const capabilities = useQuery(\n {\n queryKey: [\n ...THREAD_LIST_CAPABILITIES_QUERY_KEY,\n backendUrl,\n principal,\n live?.credentialGeneration ?? 0,\n ],\n queryFn: async ({ signal }) => {\n if (!getAuth) return null;\n const response = await withCredentialRenewal(getAuth, (auth) =>\n listThreads(backendUrl, auth, { limit: 1, signal }),\n );\n return supportedFiltersFromResponse(response.supported_filters);\n },\n enabled: active,\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n },\n queryClient,\n );\n // A failed probe is treated as an older backend: the query degrades\n // instead of the list staying empty.\n const capabilitiesSettled = capabilities.isSuccess || capabilities.isError;\n const supportedFilters = capabilities.data ?? null;\n\n // `query` may be a fresh object every render; its normalized key is what\n // identifies it, so the plan is built from the key and recomputed only\n // when the content changes.\n const queryKey = sessionsQueryKey(query);\n const plan = useMemo(\n () =>\n planSessionsQuery(sessionsQueryFromKey(queryKey), {\n supportedFilters,\n includePullRequests,\n }),\n [queryKey, supportedFilters, includePullRequests],\n );\n const planRef = useRef(plan);\n planRef.current = plan;\n const unsupportedFields = useMemo(\n () =>\n capabilitiesSettled\n ? unavailableSessionsQueryFields({ supportedFilters, includePullRequests })\n : [],\n [capabilitiesSettled, supportedFilters, includePullRequests],\n );\n\n const fetchPage = useMemo(\n () =>\n getAuth\n ? createRestConversationListFetcher({\n backendUrl,\n getAuth,\n includePullRequests,\n extraFilters: plan.body,\n keepRow: (row) => matchesSessionsQuery(row, planRef.current.local),\n })\n : async () => ({ items: [], hasMore: false, totalCount: null }),\n [backendUrl, getAuth, includePullRequests, plan.body],\n );\n const baseFilter: ConversationListFilter = live?.baseFilter ?? {};\n const capabilityKey = supportedFilters ? [...supportedFilters].sort().join(',') : 'legacy';\n const list = useConversationList({\n fetchPage,\n filter: baseFilter,\n pageSize,\n // The query's server filters are not part of the shared filter contract,\n // so they — and what this backend applies of them — key the cache here.\n scopeKey: `${identityScope}::sessions::${queryKey}::${capabilityKey}`,\n enabled: active && capabilitiesSettled,\n queryClient,\n });\n\n // While a changed query's first page is in flight, the previous query's\n // rows stand in, checked against the new query's local part — the list\n // narrows at once instead of blanking to skeletons. Only rows read as the\n // same identity and credential ever stand in.\n const lastResolvedRef = useRef<{ scope: string; conversations: ConversationSummary[] }>({\n scope: '',\n conversations: [],\n });\n if (list.hasResolvedFirstPage) {\n lastResolvedRef.current = { scope: identityScope, conversations: list.conversations };\n }\n const standIn =\n !list.hasResolvedFirstPage && lastResolvedRef.current.scope === identityScope\n ? lastResolvedRef.current.conversations\n : null;\n const source = standIn ?? list.conversations;\n const isPlaceholderData = standIn !== null && standIn.length > 0;\n\n const indexByThread = live?.indexByThread;\n const applyOverrides = live?.applyOverrides;\n const rows = useMemo(() => {\n if (!indexByThread || !applyOverrides) return EMPTY_ROWS;\n const folded: ConversationSummary[] = applyOverrides(\n foldConversationIndex(source, indexByThread),\n ).filter((row) => matchesSessionsQuery(row, plan.local));\n return sortSessions(folded, plan.local).map(threadSummaryFromConversation);\n }, [source, indexByThread, applyOverrides, plan.local]);\n\n // A thread the index knows that this list does not show yet refreshes the\n // list — it may be new, or may have just come to match. Once per VERSION of\n // the entry (its id and `updated_at`): an unchanged entry the server keeps\n // leaving out never refreshes twice, and a later change to it (a PR opened,\n // a run now needing input) gets its own refresh.\n const refreshedForRef = useRef<Set<string>>(new Set());\n const indexEntries = live?.indexEntries ?? null;\n const listRefresh = list.refresh;\n const baseAppId = baseFilter.appId;\n const baseAppIds = baseFilter.appIds;\n useEffect(() => {\n if (!active || indexEntries === null || !list.hasResolvedFirstPage) return;\n const unlisted = indexEntryVersionsToRefresh({\n entries: indexEntries,\n listedThreadIds: new Set(list.conversations.map((conversation) => conversation.threadId)),\n refreshedVersions: refreshedForRef.current,\n appId: baseAppId,\n additionalAppIds: baseAppIds ?? [],\n query: plan.local,\n });\n for (const version of unlisted) refreshedForRef.current.add(version);\n if (unlisted.length > 0) void listRefresh();\n }, [\n active,\n indexEntries,\n list.hasResolvedFirstPage,\n list.conversations,\n baseAppId,\n baseAppIds,\n listRefresh,\n plan.local,\n ]);\n\n const listFetchNextPage = list.fetchNextPage;\n return {\n rows: isAvailable ? rows : EMPTY_ROWS,\n isAvailable,\n isLoading: active && (!capabilitiesSettled || list.isLoading),\n isFetching: list.isFetching || capabilities.isFetching,\n hasResolvedFirstPage: list.hasResolvedFirstPage,\n isPlaceholderData,\n hasNextPage: list.hasNextPage,\n isFetchingNextPage: list.isFetchingNextPage,\n fetchNextPage: isAvailable ? () => void listFetchNextPage() : NOOP,\n refresh: isAvailable ? async () => void (await listRefresh()) : NOOP_ASYNC,\n isFetchNextPageError: list.isFetchNextPageError,\n supportedFilters,\n degradedFields: plan.degraded,\n unavailableFields: plan.unavailable,\n unsupportedFields,\n };\n}\n\ntype IndexEntryLike = Parameters<typeof entryCouldMatch>[0] & {\n thread_id: string;\n updated_at: string;\n app_id: string | null;\n};\n\n/**\n * The index entries that warrant one refresh of a filtered list, as\n * `<thread_id>@<updated_at>` versions: entries the list does not show, of\n * the apps it lists, that the query could match on what the entry carries,\n * and whose version has not prompted a refresh before. An unchanged entry the\n * server keeps leaving out refreshes once; any later change to it refreshes\n * again. Exported for tests.\n */\nexport function indexEntryVersionsToRefresh({\n entries,\n listedThreadIds,\n refreshedVersions,\n appId,\n additionalAppIds,\n query,\n}: {\n entries: readonly IndexEntryLike[];\n listedThreadIds: ReadonlySet<string>;\n refreshedVersions: ReadonlySet<string>;\n appId: string | undefined;\n additionalAppIds: readonly string[];\n query: AthenaSessionsQuery;\n}): string[] {\n const versionOf = (entry: IndexEntryLike) => `${entry.thread_id}@${entry.updated_at}`;\n const byVersion = new Map(entries.map((entry) => [versionOf(entry), entry]));\n return indexedThreadsToRefreshFor({\n entries: entries.map((entry) => ({ thread_id: versionOf(entry), app_id: entry.app_id })),\n listedThreadIds: new Set(\n entries.filter((entry) => listedThreadIds.has(entry.thread_id)).map(versionOf),\n ),\n refreshedThreadIds: refreshedVersions,\n appId,\n additionalAppIds,\n }).filter((version) => {\n const entry = byVersion.get(version);\n return entry === undefined || entryCouldMatch(entry, query);\n });\n}\n\n/**\n * Whether a pushed index entry could belong to a list with this local query:\n * the fields the entry carries are checked, the rest pass.\n */\nexport function entryCouldMatch(\n entry: {\n is_unread?: boolean | null;\n is_favorited?: boolean | null;\n run_status?: string | null;\n session_status?: string | null;\n },\n query: AthenaSessionsQuery,\n): boolean {\n if (query.unreadOnly && entry.is_unread === false) return false;\n if (query.favoritesOnly && entry.is_favorited === false) return false;\n if (\n query.runStatuses &&\n typeof entry.run_status === 'string' &&\n !(query.runStatuses as readonly string[]).includes(entry.run_status)\n ) {\n return false;\n }\n if (\n query.sessionStatuses &&\n typeof entry.session_status === 'string' &&\n !(query.sessionStatuses as readonly string[]).includes(entry.session_status)\n ) {\n return false;\n }\n return true;\n}\n"],"names":["useContext","AthenaSessionsLiveContext","useAthenaQueryClient","useQuery","withCredentialRenewal","listThreads","supportedFiltersFromResponse","sessionsQueryKey","useMemo","planSessionsQuery","sessionsQueryFromKey","useRef","unavailableSessionsQueryFields","createRestConversationListFetcher","matchesSessionsQuery","useConversationList","foldConversationIndex","sortSessions","threadSummaryFromConversation","useEffect","indexedThreadsToRefreshFor"],"mappings":";;;;;;;;;;;AAiGA,MAAM,oBAAoB;AAGnB,MAAM,qCAAqC;AAAA,EAChD;AAAA,EACA;AACF;AAEA,MAAM,aAA6C,CAAA;AACnD,MAAM,OAAO,MAAM;AACnB,MAAM,aAAa,YAAY;AAExB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,WAAW;AAAA,EACX,UAAU;AACZ,GAAiD;AAC/C,QAAM,OAAOA,MAAAA,WAAWC,6CAAyB;AACjD,QAAM,cAAc,SAAS;AAC7B,QAAM,cAAa,6BAAM,eAAc;AACvC,QAAM,aAAY,6BAAM,cAAa;AACrC,QAAM,WAAU,6BAAM,YAAW;AACjC,QAAM,uBAAsB,6BAAM,wBAAuB;AACzD,QAAM,UAAU,6BAAM;AACtB,QAAM,SAAS,eAAe,WAAW;AAIzC,QAAM,gBAAgB,IAAG,6BAAM,aAAY,aAAa,iBACtD,6BAAM,yBAAwB,CAChC;AAIA,QAAM,cAAcC,mBAAAA,qBAAA;AAIpB,QAAM,eAAeC,WAAAA;AAAAA,IACnB;AAAA,MACE,UAAU;AAAA,QACR,GAAG;AAAA,QACH;AAAA,QACA;AAAA,SACA,6BAAM,yBAAwB;AAAA,MAAA;AAAA,MAEhC,SAAS,OAAO,EAAE,aAAa;AAC7B,YAAI,CAAC,QAAS,QAAO;AACrB,cAAM,WAAW,MAAMC,kBAAAA;AAAAA,UAAsB;AAAA,UAAS,CAAC,SACrDC,IAAAA,YAAY,YAAY,MAAM,EAAE,OAAO,GAAG,OAAA,CAAQ;AAAA,QAAA;AAEpD,eAAOC,cAAAA,6BAA6B,SAAS,iBAAiB;AAAA,MAChE;AAAA,MACA,SAAS;AAAA,MACT,WAAW,OAAO;AAAA,MAClB,OAAO;AAAA,IAAA;AAAA,IAET;AAAA,EAAA;AAIF,QAAM,sBAAsB,aAAa,aAAa,aAAa;AACn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AAQ,UAAU,IAAI,OAAO;AACnC,WAAO,UAAU,UAAa,gBAAgB,OAAO,KAAK;AAAA,EAC5D,CAAC;AACH;AAMO,SAAS,gBACd,OAMA,OACS;AACT,MAAI,MAAM,cAAc,MAAM,cAAc,MAAO,QAAO;AAC1D,MAAI,MAAM,iBAAiB,MAAM,iBAAiB,MAAO,QAAO;AAChE,MACE,MAAM,eACN,OAAO,MAAM,eAAe,YAC5B,CAAE,MAAM,YAAkC,SAAS,MAAM,UAAU,GACnE;AACA,WAAO;AAAA,EACT;AACA,MACE,MAAM,mBACN,OAAO,MAAM,mBAAmB,YAChC,CAAE,MAAM,gBAAsC,SAAS,MAAM,cAAc,GAC3E;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;;;;;"}
1
+ {"version":3,"file":"use-athena-sessions.cjs","sources":["../../src/threads/use-athena-sessions.ts"],"sourcesContent":["/**\n * `useAthenaSessions(query)` — one filtered, sorted, live session list under\n * `<AthenaProvider enableThreadList>`: the data layer of `SessionsPage` and\n * `Inbox`, for hosts drawing their own.\n *\n * - **Server-side.** The query travels to `POST /api/conversations/threads/list`\n * as filters of the server's one page statement (`planSessionsQuery`), over\n * the shared two-tier pager (`useConversationList`: a live first page and\n * frozen history pages) in the thread-list provider's query client.\n * - **Live.** Rows fold the same conversation-index pushes the sidebar folds\n * (titles, lifecycle, attention flip in place), carry the provider's\n * in-flight writes (pin, rename, read state, archive), and a thread the\n * index learns about that the list does not show yet refreshes the list\n * once.\n * - **Degraded, not wrong.** A server that cannot apply part of the query is\n * detected from its `supported_filters` echo (one `limit: 1` probe per\n * identity). Fields the loaded rows can be tested on are applied to them\n * (`degradedFields`: exact per page, a page can come back short); fields\n * they cannot are reported in `unavailableFields` and not applied, so a\n * control for them can be disabled rather than lie.\n */\nimport {\n type ConversationListFilter,\n type ConversationSummary,\n conversationListFilterKey,\n conversationListQueryKeys,\n useConversationList,\n} from '@athenaintel/agent-runtime';\nimport { useQuery } from '@tanstack/react-query';\nimport { useContext, useMemo, useRef } from 'react';\nimport { useAthenaQueryClient } from '../lib/use-athena-rest-query';\nimport { withCredentialRenewal } from '../runtime/credential-renewal';\nimport { listThreads } from './api';\nimport { createRestConversationListFetcher } from './conversation-list-fetcher';\nimport { useIndexTriggeredRefresh } from './index-triggered-refresh';\nimport { sessionListShareKey } from './session-list-tab-share';\nimport {\n type AthenaSessionsQuery,\n type AthenaSessionsQueryField,\n matchesSessionsQuery,\n planSessionsQuery,\n sessionsQueryFromKey,\n sessionsQueryKey,\n sortSessions,\n supportedFiltersFromResponse,\n unavailableSessionsQueryFields,\n} from './sessions-query';\nimport {\n AthenaSessionsLiveContext,\n type AthenaStatewireThreadSummary,\n foldConversationIndex,\n indexedThreadsToRefreshFor,\n threadSummaryFromConversation,\n} from './statewire-thread-list';\n\nexport interface UseAthenaSessionsOptions {\n /** What to list. A new object with the same content does not refetch. */\n query: AthenaSessionsQuery;\n /** Rows per page (default 50). */\n pageSize?: number;\n /** `false` holds the list idle. Default `true`. */\n enabled?: boolean;\n}\n\nexport interface AthenaSessionsList {\n /** The rows, in the query's order, with live pushes and in-flight writes applied. */\n rows: AthenaStatewireThreadSummary[];\n /** `false` outside `enableThreadList` mode: nothing is fetched and `rows` stays empty. */\n isAvailable: boolean;\n /** True until the first page has answered (or while no credential has resolved). */\n isLoading: boolean;\n isFetching: boolean;\n hasResolvedFirstPage: boolean;\n /**\n * True while the rows are the previous query's (checked against this\n * query's local part) because this query's first page is still in flight.\n */\n isPlaceholderData: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n fetchNextPage: () => void;\n /** Refetch the first page; resolves once it has answered. */\n refresh: () => Promise<void>;\n /** True while the last \"load more\" request failed. */\n isFetchNextPageError: boolean;\n /**\n * The server fields this backend applies (`supported_filters`), `null`\n * while unknown or on a backend that predates the list.\n */\n supportedFilters: ReadonlySet<string> | null;\n /** Fields applied to the loaded rows because the backend cannot. */\n degradedFields: AthenaSessionsQueryField[];\n /** Fields of this query that cannot be applied on this backend at all (and are not). */\n unavailableFields: AthenaSessionsQueryField[];\n /**\n * Every field this backend cannot apply anywhere, selected or not — what a\n * filter UI disables. Empty until the capabilities probe has answered.\n */\n unsupportedFields: AthenaSessionsQueryField[];\n}\n\nconst DEFAULT_PAGE_SIZE = 50;\n\n/** The capabilities probe's key prefix. */\nexport const THREAD_LIST_CAPABILITIES_QUERY_KEY = [\n 'athena-sdk',\n 'thread-list-capabilities',\n] as const;\n\nconst EMPTY_ROWS: AthenaStatewireThreadSummary[] = [];\nconst EMPTY_VERSIONS: ReadonlySet<string> = new Set();\nconst NOOP = () => undefined;\nconst NOOP_ASYNC = async () => undefined;\n\nexport function useAthenaSessions({\n query,\n pageSize = DEFAULT_PAGE_SIZE,\n enabled = true,\n}: UseAthenaSessionsOptions): AthenaSessionsList {\n const live = useContext(AthenaSessionsLiveContext);\n const isAvailable = live !== null;\n const backendUrl = live?.backendUrl ?? '';\n const principal = live?.principal ?? '';\n const hasAuth = live?.hasAuth ?? false;\n const includePullRequests = live?.includePullRequests ?? false;\n const getAuth = live?.getAuth;\n const active = isAvailable && enabled && hasAuth;\n // Every cache below is keyed by WHO reads (principal) and WITH WHAT (the\n // credential generation): a scoped credential for another workspace under\n // the same principal must never read this one's cached rows.\n const identityScope = `${live?.scopeKey ?? 'unavailable'}::credential-${\n live?.credentialGeneration ?? 0\n }`;\n\n // Outside thread-list mode there may be no `QueryClientProvider`; every\n // query below is disabled there, on a client of this hook's own.\n const queryClient = useAthenaQueryClient();\n\n // Which filters this backend applies: one tiny page per identity. The\n // answer is a property of the deployed agora, so it never goes stale.\n const capabilities = useQuery(\n {\n queryKey: [\n ...THREAD_LIST_CAPABILITIES_QUERY_KEY,\n backendUrl,\n principal,\n live?.credentialGeneration ?? 0,\n ],\n queryFn: async ({ signal }) => {\n if (!getAuth) return null;\n const response = await withCredentialRenewal(getAuth, (auth) =>\n listThreads(backendUrl, auth, { limit: 1, signal }),\n );\n return supportedFiltersFromResponse(response.supported_filters);\n },\n enabled: active,\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n },\n queryClient,\n );\n // A failed probe is treated as an older backend: the query degrades\n // instead of the list staying empty.\n const capabilitiesSettled = capabilities.isSuccess || capabilities.isError;\n const supportedFilters = capabilities.data ?? null;\n\n // `query` may be a fresh object every render; its normalized key is what\n // identifies it, so the plan is built from the key and recomputed only\n // when the content changes.\n const queryKey = sessionsQueryKey(query);\n const plan = useMemo(\n () =>\n planSessionsQuery(sessionsQueryFromKey(queryKey), {\n supportedFilters,\n includePullRequests,\n }),\n [queryKey, supportedFilters, includePullRequests],\n );\n const planRef = useRef(plan);\n planRef.current = plan;\n const unsupportedFields = useMemo(\n () =>\n capabilitiesSettled\n ? unavailableSessionsQueryFields({ supportedFilters, includePullRequests })\n : [],\n [capabilitiesSettled, supportedFilters, includePullRequests],\n );\n\n const fetchPage = useMemo(\n () =>\n getAuth\n ? createRestConversationListFetcher({\n backendUrl,\n getAuth,\n includePullRequests,\n extraFilters: plan.body,\n keepRow: (row) => matchesSessionsQuery(row, planRef.current.local),\n })\n : async () => ({ items: [], hasMore: false, totalCount: null }),\n [backendUrl, getAuth, includePullRequests, plan.body],\n );\n const baseFilter: ConversationListFilter = live?.baseFilter ?? {};\n const capabilityKey = supportedFilters ? [...supportedFilters].sort().join(',') : 'legacy';\n // The query's server filters are not part of the shared filter contract,\n // so they — and what this backend applies of them — key the cache here.\n const listScopeKey = `${identityScope}::sessions::${queryKey}::${capabilityKey}`;\n const list = useConversationList({\n fetchPage,\n filter: baseFilter,\n pageSize,\n scopeKey: listScopeKey,\n enabled: active && capabilitiesSettled,\n queryClient,\n });\n\n // While a changed query's first page is in flight, the previous query's\n // rows stand in, checked against the new query's local part — the list\n // narrows at once instead of blanking to skeletons. Only rows read as the\n // same identity and credential ever stand in.\n const lastResolvedRef = useRef<{ scope: string; conversations: ConversationSummary[] }>({\n scope: '',\n conversations: [],\n });\n if (list.hasResolvedFirstPage) {\n lastResolvedRef.current = { scope: identityScope, conversations: list.conversations };\n }\n const standIn =\n !list.hasResolvedFirstPage && lastResolvedRef.current.scope === identityScope\n ? lastResolvedRef.current.conversations\n : null;\n const source = standIn ?? list.conversations;\n const isPlaceholderData = standIn !== null && standIn.length > 0;\n\n const indexByThread = live?.indexByThread;\n const applyOverrides = live?.applyOverrides;\n const rows = useMemo(() => {\n if (!indexByThread || !applyOverrides) return EMPTY_ROWS;\n const folded: ConversationSummary[] = applyOverrides(\n foldConversationIndex(source, indexByThread),\n ).filter((row) => matchesSessionsQuery(row, plan.local));\n return sortSessions(folded, plan.local).map(threadSummaryFromConversation);\n }, [source, indexByThread, applyOverrides, plan.local]);\n\n // A thread the index knows that this list does not show yet refreshes the\n // list — it may be new, or may have just come to match. Once per VERSION of\n // the entry (its id and `updated_at`): an unchanged entry the server keeps\n // leaving out never refreshes twice, and a later change to it (a PR opened,\n // a run now needing input) gets its own refresh. Coalesced, held while the\n // list is already being read, and a refused refresh is tried again\n // (`useIndexTriggeredRefresh`).\n const indexEntries = live?.indexEntries ?? null;\n const listRefresh = list.refresh;\n const baseAppId = baseFilter.appId;\n const baseAppIds = baseFilter.appIds;\n const listedThreadIds = useMemo(\n () => new Set(list.conversations.map((conversation) => conversation.threadId)),\n [list.conversations],\n );\n const unlistedVersions = useMemo(\n () =>\n indexEntries === null\n ? []\n : indexEntryVersionsToRefresh({\n entries: indexEntries,\n listedThreadIds,\n refreshedVersions: EMPTY_VERSIONS,\n appId: baseAppId,\n additionalAppIds: baseAppIds ?? [],\n query: plan.local,\n }),\n [indexEntries, listedThreadIds, baseAppId, baseAppIds, plan.local],\n );\n useIndexTriggeredRefresh({\n pending: unlistedVersions,\n refresh: listRefresh,\n // Held while the list is being read; a refused first page does not hold\n // it (the refresh is how the list recovers).\n enabled: active && capabilitiesSettled && indexEntries !== null && !list.isFetching,\n tabShare: live?.tabShare,\n shareKey: sessionListShareKey(\n conversationListQueryKeys.firstPage(\n listScopeKey,\n conversationListFilterKey(baseFilter),\n pageSize,\n ),\n ),\n });\n\n const listFetchNextPage = list.fetchNextPage;\n return {\n rows: isAvailable ? rows : EMPTY_ROWS,\n isAvailable,\n isLoading: active && (!capabilitiesSettled || list.isLoading),\n isFetching: list.isFetching || capabilities.isFetching,\n hasResolvedFirstPage: list.hasResolvedFirstPage,\n isPlaceholderData,\n hasNextPage: list.hasNextPage,\n isFetchingNextPage: list.isFetchingNextPage,\n fetchNextPage: isAvailable ? () => void listFetchNextPage() : NOOP,\n refresh: isAvailable ? async () => void (await listRefresh()) : NOOP_ASYNC,\n isFetchNextPageError: list.isFetchNextPageError,\n supportedFilters,\n degradedFields: plan.degraded,\n unavailableFields: plan.unavailable,\n unsupportedFields,\n };\n}\n\ntype IndexEntryLike = Parameters<typeof entryCouldMatch>[0] & {\n thread_id: string;\n updated_at: string;\n app_id: string | null;\n};\n\n/**\n * The index entries that warrant one refresh of a filtered list, as\n * `<thread_id>@<updated_at>` versions: entries the list does not show, of\n * the apps it lists, that the query could match on what the entry carries,\n * and whose version has not prompted a refresh before. An unchanged entry the\n * server keeps leaving out refreshes once; any later change to it refreshes\n * again. Exported for tests.\n */\nexport function indexEntryVersionsToRefresh({\n entries,\n listedThreadIds,\n refreshedVersions,\n appId,\n additionalAppIds,\n query,\n}: {\n entries: readonly IndexEntryLike[];\n listedThreadIds: ReadonlySet<string>;\n refreshedVersions: ReadonlySet<string>;\n appId: string | undefined;\n additionalAppIds: readonly string[];\n query: AthenaSessionsQuery;\n}): string[] {\n const versionOf = (entry: IndexEntryLike) => `${entry.thread_id}@${entry.updated_at}`;\n const byVersion = new Map(entries.map((entry) => [versionOf(entry), entry]));\n return indexedThreadsToRefreshFor({\n entries: entries.map((entry) => ({ thread_id: versionOf(entry), app_id: entry.app_id })),\n listedThreadIds: new Set(\n entries.filter((entry) => listedThreadIds.has(entry.thread_id)).map(versionOf),\n ),\n refreshedThreadIds: refreshedVersions,\n appId,\n additionalAppIds,\n }).filter((version) => {\n const entry = byVersion.get(version);\n return entry === undefined || entryCouldMatch(entry, query);\n });\n}\n\n/**\n * Whether a pushed index entry could belong to a list with this local query:\n * the fields the entry carries are checked, the rest pass.\n */\nexport function entryCouldMatch(\n entry: {\n is_unread?: boolean | null;\n is_favorited?: boolean | null;\n run_status?: string | null;\n session_status?: string | null;\n },\n query: AthenaSessionsQuery,\n): boolean {\n if (query.unreadOnly && entry.is_unread === false) return false;\n if (query.favoritesOnly && entry.is_favorited === false) return false;\n if (\n query.runStatuses &&\n typeof entry.run_status === 'string' &&\n !(query.runStatuses as readonly string[]).includes(entry.run_status)\n ) {\n return false;\n }\n if (\n query.sessionStatuses &&\n typeof entry.session_status === 'string' &&\n !(query.sessionStatuses as readonly string[]).includes(entry.session_status)\n ) {\n return false;\n }\n return true;\n}\n"],"names":["useContext","AthenaSessionsLiveContext","useAthenaQueryClient","useQuery","withCredentialRenewal","listThreads","supportedFiltersFromResponse","sessionsQueryKey","useMemo","planSessionsQuery","sessionsQueryFromKey","useRef","unavailableSessionsQueryFields","createRestConversationListFetcher","matchesSessionsQuery","useConversationList","foldConversationIndex","sortSessions","threadSummaryFromConversation","useIndexTriggeredRefresh","sessionListShareKey","conversationListQueryKeys","conversationListFilterKey","indexedThreadsToRefreshFor"],"mappings":";;;;;;;;;;;;;;AAqGA,MAAM,oBAAoB;AAGnB,MAAM,qCAAqC;AAAA,EAChD;AAAA,EACA;AACF;AAEA,MAAM,aAA6C,CAAA;AACnD,MAAM,qCAA0C,IAAA;AAChD,MAAM,OAAO,MAAM;AACnB,MAAM,aAAa,YAAY;AAExB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,WAAW;AAAA,EACX,UAAU;AACZ,GAAiD;AAC/C,QAAM,OAAOA,MAAAA,WAAWC,6CAAyB;AACjD,QAAM,cAAc,SAAS;AAC7B,QAAM,cAAa,6BAAM,eAAc;AACvC,QAAM,aAAY,6BAAM,cAAa;AACrC,QAAM,WAAU,6BAAM,YAAW;AACjC,QAAM,uBAAsB,6BAAM,wBAAuB;AACzD,QAAM,UAAU,6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,cAAc,GAC3E;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;;;;;"}
@@ -1,18 +1,22 @@
1
1
  import { useQuery } from "@tanstack/react-query";
2
- import { useContext, useMemo, useRef, useEffect } from "react";
2
+ import { useContext, useMemo, useRef } from "react";
3
3
  import { useAthenaQueryClient } from "../lib/use-athena-rest-query.js";
4
4
  import { withCredentialRenewal } from "../runtime/credential-renewal.js";
5
5
  import { listThreads } from "./api.js";
6
6
  import { createRestConversationListFetcher } from "./conversation-list-fetcher.js";
7
+ import { useIndexTriggeredRefresh } from "./index-triggered-refresh.js";
8
+ import { sessionListShareKey } from "./session-list-tab-share.js";
7
9
  import { supportedFiltersFromResponse, sessionsQueryKey, planSessionsQuery, sessionsQueryFromKey, unavailableSessionsQueryFields, matchesSessionsQuery, sortSessions } from "./sessions-query.js";
8
10
  import { AthenaSessionsLiveContext, foldConversationIndex, threadSummaryFromConversation, indexedThreadsToRefreshFor } from "./statewire-thread-list.js";
9
11
  import { useConversationList } from "../agent-runtime/src/use-conversation-list.js";
12
+ import { conversationListQueryKeys, conversationListFilterKey } from "../agent-runtime/src/conversation-list.js";
10
13
  const DEFAULT_PAGE_SIZE = 50;
11
14
  const THREAD_LIST_CAPABILITIES_QUERY_KEY = [
12
15
  "athena-sdk",
13
16
  "thread-list-capabilities"
14
17
  ];
15
18
  const EMPTY_ROWS = [];
19
+ const EMPTY_VERSIONS = /* @__PURE__ */ new Set();
16
20
  const NOOP = () => void 0;
17
21
  const NOOP_ASYNC = async () => void 0;
18
22
  function useAthenaSessions({
@@ -80,13 +84,12 @@ function useAthenaSessions({
80
84
  );
81
85
  const baseFilter = (live == null ? void 0 : live.baseFilter) ?? {};
82
86
  const capabilityKey = supportedFilters ? [...supportedFilters].sort().join(",") : "legacy";
87
+ const listScopeKey = `${identityScope}::sessions::${queryKey}::${capabilityKey}`;
83
88
  const list = useConversationList({
84
89
  fetchPage,
85
90
  filter: baseFilter,
86
91
  pageSize,
87
- // The query's server filters are not part of the shared filter contract,
88
- // so they — and what this backend applies of them — key the cache here.
89
- scopeKey: `${identityScope}::sessions::${queryKey}::${capabilityKey}`,
92
+ scopeKey: listScopeKey,
90
93
  enabled: active && capabilitiesSettled,
91
94
  queryClient
92
95
  });
@@ -109,33 +112,40 @@ function useAthenaSessions({
109
112
  ).filter((row) => matchesSessionsQuery(row, plan.local));
110
113
  return sortSessions(folded, plan.local).map(threadSummaryFromConversation);
111
114
  }, [source, indexByThread, applyOverrides, plan.local]);
112
- const refreshedForRef = useRef(/* @__PURE__ */ new Set());
113
115
  const indexEntries = (live == null ? void 0 : live.indexEntries) ?? null;
114
116
  const listRefresh = list.refresh;
115
117
  const baseAppId = baseFilter.appId;
116
118
  const baseAppIds = baseFilter.appIds;
117
- useEffect(() => {
118
- if (!active || indexEntries === null || !list.hasResolvedFirstPage) return;
119
- const unlisted = indexEntryVersionsToRefresh({
119
+ const listedThreadIds = useMemo(
120
+ () => new Set(list.conversations.map((conversation) => conversation.threadId)),
121
+ [list.conversations]
122
+ );
123
+ const unlistedVersions = useMemo(
124
+ () => indexEntries === null ? [] : indexEntryVersionsToRefresh({
120
125
  entries: indexEntries,
121
- listedThreadIds: new Set(list.conversations.map((conversation) => conversation.threadId)),
122
- refreshedVersions: refreshedForRef.current,
126
+ listedThreadIds,
127
+ refreshedVersions: EMPTY_VERSIONS,
123
128
  appId: baseAppId,
124
129
  additionalAppIds: baseAppIds ?? [],
125
130
  query: plan.local
126
- });
127
- for (const version of unlisted) refreshedForRef.current.add(version);
128
- if (unlisted.length > 0) void listRefresh();
129
- }, [
130
- active,
131
- indexEntries,
132
- list.hasResolvedFirstPage,
133
- list.conversations,
134
- baseAppId,
135
- baseAppIds,
136
- listRefresh,
137
- plan.local
138
- ]);
131
+ }),
132
+ [indexEntries, listedThreadIds, baseAppId, baseAppIds, plan.local]
133
+ );
134
+ useIndexTriggeredRefresh({
135
+ pending: unlistedVersions,
136
+ refresh: listRefresh,
137
+ // Held while the list is being read; a refused first page does not hold
138
+ // it (the refresh is how the list recovers).
139
+ enabled: active && capabilitiesSettled && indexEntries !== null && !list.isFetching,
140
+ tabShare: live == null ? void 0 : live.tabShare,
141
+ shareKey: sessionListShareKey(
142
+ conversationListQueryKeys.firstPage(
143
+ listScopeKey,
144
+ conversationListFilterKey(baseFilter),
145
+ pageSize
146
+ )
147
+ )
148
+ });
139
149
  const listFetchNextPage = list.fetchNextPage;
140
150
  return {
141
151
  rows: isAvailable ? rows : EMPTY_ROWS,
@@ -1 +1 @@
1
- {"version":3,"file":"use-athena-sessions.js","sources":["../../src/threads/use-athena-sessions.ts"],"sourcesContent":["/**\n * `useAthenaSessions(query)` — one filtered, sorted, live session list under\n * `<AthenaProvider enableThreadList>`: the data layer of `SessionsPage` and\n * `Inbox`, for hosts drawing their own.\n *\n * - **Server-side.** The query travels to `POST /api/conversations/threads/list`\n * as filters of the server's one page statement (`planSessionsQuery`), over\n * the shared two-tier pager (`useConversationList`: a live first page and\n * frozen history pages) in the thread-list provider's query client.\n * - **Live.** Rows fold the same conversation-index pushes the sidebar folds\n * (titles, lifecycle, attention flip in place), carry the provider's\n * in-flight writes (pin, rename, read state, archive), and a thread the\n * index learns about that the list does not show yet refreshes the list\n * once.\n * - **Degraded, not wrong.** A server that cannot apply part of the query is\n * detected from its `supported_filters` echo (one `limit: 1` probe per\n * identity). Fields the loaded rows can be tested on are applied to them\n * (`degradedFields`: exact per page, a page can come back short); fields\n * they cannot are reported in `unavailableFields` and not applied, so a\n * control for them can be disabled rather than lie.\n */\nimport {\n type ConversationListFilter,\n type ConversationSummary,\n useConversationList,\n} from '@athenaintel/agent-runtime';\nimport { useQuery } from '@tanstack/react-query';\nimport { useContext, useEffect, useMemo, useRef } from 'react';\nimport { useAthenaQueryClient } from '../lib/use-athena-rest-query';\nimport { withCredentialRenewal } from '../runtime/credential-renewal';\nimport { listThreads } from './api';\nimport { createRestConversationListFetcher } from './conversation-list-fetcher';\nimport {\n type AthenaSessionsQuery,\n type AthenaSessionsQueryField,\n matchesSessionsQuery,\n planSessionsQuery,\n sessionsQueryFromKey,\n sessionsQueryKey,\n sortSessions,\n supportedFiltersFromResponse,\n unavailableSessionsQueryFields,\n} from './sessions-query';\nimport {\n AthenaSessionsLiveContext,\n type AthenaStatewireThreadSummary,\n foldConversationIndex,\n indexedThreadsToRefreshFor,\n threadSummaryFromConversation,\n} from './statewire-thread-list';\n\nexport interface UseAthenaSessionsOptions {\n /** What to list. A new object with the same content does not refetch. */\n query: AthenaSessionsQuery;\n /** Rows per page (default 50). */\n pageSize?: number;\n /** `false` holds the list idle. Default `true`. */\n enabled?: boolean;\n}\n\nexport interface AthenaSessionsList {\n /** The rows, in the query's order, with live pushes and in-flight writes applied. */\n rows: AthenaStatewireThreadSummary[];\n /** `false` outside `enableThreadList` mode: nothing is fetched and `rows` stays empty. */\n isAvailable: boolean;\n /** True until the first page has answered (or while no credential has resolved). */\n isLoading: boolean;\n isFetching: boolean;\n hasResolvedFirstPage: boolean;\n /**\n * True while the rows are the previous query's (checked against this\n * query's local part) because this query's first page is still in flight.\n */\n isPlaceholderData: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n fetchNextPage: () => void;\n /** Refetch the first page; resolves once it has answered. */\n refresh: () => Promise<void>;\n /** True while the last \"load more\" request failed. */\n isFetchNextPageError: boolean;\n /**\n * The server fields this backend applies (`supported_filters`), `null`\n * while unknown or on a backend that predates the list.\n */\n supportedFilters: ReadonlySet<string> | null;\n /** Fields applied to the loaded rows because the backend cannot. */\n degradedFields: AthenaSessionsQueryField[];\n /** Fields of this query that cannot be applied on this backend at all (and are not). */\n unavailableFields: AthenaSessionsQueryField[];\n /**\n * Every field this backend cannot apply anywhere, selected or not — what a\n * filter UI disables. Empty until the capabilities probe has answered.\n */\n unsupportedFields: AthenaSessionsQueryField[];\n}\n\nconst DEFAULT_PAGE_SIZE = 50;\n\n/** The capabilities probe's key prefix. */\nexport const THREAD_LIST_CAPABILITIES_QUERY_KEY = [\n 'athena-sdk',\n 'thread-list-capabilities',\n] as const;\n\nconst EMPTY_ROWS: AthenaStatewireThreadSummary[] = [];\nconst NOOP = () => undefined;\nconst NOOP_ASYNC = async () => undefined;\n\nexport function useAthenaSessions({\n query,\n pageSize = DEFAULT_PAGE_SIZE,\n enabled = true,\n}: UseAthenaSessionsOptions): AthenaSessionsList {\n const live = useContext(AthenaSessionsLiveContext);\n const isAvailable = live !== null;\n const backendUrl = live?.backendUrl ?? '';\n const principal = live?.principal ?? '';\n const hasAuth = live?.hasAuth ?? false;\n const includePullRequests = live?.includePullRequests ?? false;\n const getAuth = live?.getAuth;\n const active = isAvailable && enabled && hasAuth;\n // Every cache below is keyed by WHO reads (principal) and WITH WHAT (the\n // credential generation): a scoped credential for another workspace under\n // the same principal must never read this one's cached rows.\n const identityScope = `${live?.scopeKey ?? 'unavailable'}::credential-${\n live?.credentialGeneration ?? 0\n }`;\n\n // Outside thread-list mode there may be no `QueryClientProvider`; every\n // query below is disabled there, on a client of this hook's own.\n const queryClient = useAthenaQueryClient();\n\n // Which filters this backend applies: one tiny page per identity. The\n // answer is a property of the deployed agora, so it never goes stale.\n const capabilities = useQuery(\n {\n queryKey: [\n ...THREAD_LIST_CAPABILITIES_QUERY_KEY,\n backendUrl,\n principal,\n live?.credentialGeneration ?? 0,\n ],\n queryFn: async ({ signal }) => {\n if (!getAuth) return null;\n const response = await withCredentialRenewal(getAuth, (auth) =>\n listThreads(backendUrl, auth, { limit: 1, signal }),\n );\n return supportedFiltersFromResponse(response.supported_filters);\n },\n enabled: active,\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n },\n queryClient,\n );\n // A failed probe is treated as an older backend: the query degrades\n // instead of the list staying empty.\n const capabilitiesSettled = capabilities.isSuccess || capabilities.isError;\n const supportedFilters = capabilities.data ?? null;\n\n // `query` may be a fresh object every render; its normalized key is what\n // identifies it, so the plan is built from the key and recomputed only\n // when the content changes.\n const queryKey = sessionsQueryKey(query);\n const plan = useMemo(\n () =>\n planSessionsQuery(sessionsQueryFromKey(queryKey), {\n supportedFilters,\n includePullRequests,\n }),\n [queryKey, supportedFilters, includePullRequests],\n );\n const planRef = useRef(plan);\n planRef.current = plan;\n const unsupportedFields = useMemo(\n () =>\n capabilitiesSettled\n ? unavailableSessionsQueryFields({ supportedFilters, includePullRequests })\n : [],\n [capabilitiesSettled, supportedFilters, includePullRequests],\n );\n\n const fetchPage = useMemo(\n () =>\n getAuth\n ? createRestConversationListFetcher({\n backendUrl,\n getAuth,\n includePullRequests,\n extraFilters: plan.body,\n keepRow: (row) => matchesSessionsQuery(row, planRef.current.local),\n })\n : async () => ({ items: [], hasMore: false, totalCount: null }),\n [backendUrl, getAuth, includePullRequests, plan.body],\n );\n const baseFilter: ConversationListFilter = live?.baseFilter ?? {};\n const capabilityKey = supportedFilters ? [...supportedFilters].sort().join(',') : 'legacy';\n const list = useConversationList({\n fetchPage,\n filter: baseFilter,\n pageSize,\n // The query's server filters are not part of the shared filter contract,\n // so they — and what this backend applies of them — key the cache here.\n scopeKey: `${identityScope}::sessions::${queryKey}::${capabilityKey}`,\n enabled: active && capabilitiesSettled,\n queryClient,\n });\n\n // While a changed query's first page is in flight, the previous query's\n // rows stand in, checked against the new query's local part — the list\n // narrows at once instead of blanking to skeletons. Only rows read as the\n // same identity and credential ever stand in.\n const lastResolvedRef = useRef<{ scope: string; conversations: ConversationSummary[] }>({\n scope: '',\n conversations: [],\n });\n if (list.hasResolvedFirstPage) {\n lastResolvedRef.current = { scope: identityScope, conversations: list.conversations };\n }\n const standIn =\n !list.hasResolvedFirstPage && lastResolvedRef.current.scope === identityScope\n ? lastResolvedRef.current.conversations\n : null;\n const source = standIn ?? list.conversations;\n const isPlaceholderData = standIn !== null && standIn.length > 0;\n\n const indexByThread = live?.indexByThread;\n const applyOverrides = live?.applyOverrides;\n const rows = useMemo(() => {\n if (!indexByThread || !applyOverrides) return EMPTY_ROWS;\n const folded: ConversationSummary[] = applyOverrides(\n foldConversationIndex(source, indexByThread),\n ).filter((row) => matchesSessionsQuery(row, plan.local));\n return sortSessions(folded, plan.local).map(threadSummaryFromConversation);\n }, [source, indexByThread, applyOverrides, plan.local]);\n\n // A thread the index knows that this list does not show yet refreshes the\n // list — it may be new, or may have just come to match. Once per VERSION of\n // the entry (its id and `updated_at`): an unchanged entry the server keeps\n // leaving out never refreshes twice, and a later change to it (a PR opened,\n // a run now needing input) gets its own refresh.\n const refreshedForRef = useRef<Set<string>>(new Set());\n const indexEntries = live?.indexEntries ?? null;\n const listRefresh = list.refresh;\n const baseAppId = baseFilter.appId;\n const baseAppIds = baseFilter.appIds;\n useEffect(() => {\n if (!active || indexEntries === null || !list.hasResolvedFirstPage) return;\n const unlisted = indexEntryVersionsToRefresh({\n entries: indexEntries,\n listedThreadIds: new Set(list.conversations.map((conversation) => conversation.threadId)),\n refreshedVersions: refreshedForRef.current,\n appId: baseAppId,\n additionalAppIds: baseAppIds ?? [],\n query: plan.local,\n });\n for (const version of unlisted) refreshedForRef.current.add(version);\n if (unlisted.length > 0) void listRefresh();\n }, [\n active,\n indexEntries,\n list.hasResolvedFirstPage,\n list.conversations,\n baseAppId,\n baseAppIds,\n listRefresh,\n plan.local,\n ]);\n\n const listFetchNextPage = list.fetchNextPage;\n return {\n rows: isAvailable ? rows : EMPTY_ROWS,\n isAvailable,\n isLoading: active && (!capabilitiesSettled || list.isLoading),\n isFetching: list.isFetching || capabilities.isFetching,\n hasResolvedFirstPage: list.hasResolvedFirstPage,\n isPlaceholderData,\n hasNextPage: list.hasNextPage,\n isFetchingNextPage: list.isFetchingNextPage,\n fetchNextPage: isAvailable ? () => void listFetchNextPage() : NOOP,\n refresh: isAvailable ? async () => void (await listRefresh()) : NOOP_ASYNC,\n isFetchNextPageError: list.isFetchNextPageError,\n supportedFilters,\n degradedFields: plan.degraded,\n unavailableFields: plan.unavailable,\n unsupportedFields,\n };\n}\n\ntype IndexEntryLike = Parameters<typeof entryCouldMatch>[0] & {\n thread_id: string;\n updated_at: string;\n app_id: string | null;\n};\n\n/**\n * The index entries that warrant one refresh of a filtered list, as\n * `<thread_id>@<updated_at>` versions: entries the list does not show, of\n * the apps it lists, that the query could match on what the entry carries,\n * and whose version has not prompted a refresh before. An unchanged entry the\n * server keeps leaving out refreshes once; any later change to it refreshes\n * again. Exported for tests.\n */\nexport function indexEntryVersionsToRefresh({\n entries,\n listedThreadIds,\n refreshedVersions,\n appId,\n additionalAppIds,\n query,\n}: {\n entries: readonly IndexEntryLike[];\n listedThreadIds: ReadonlySet<string>;\n refreshedVersions: ReadonlySet<string>;\n appId: string | undefined;\n additionalAppIds: readonly string[];\n query: AthenaSessionsQuery;\n}): string[] {\n const versionOf = (entry: IndexEntryLike) => `${entry.thread_id}@${entry.updated_at}`;\n const byVersion = new Map(entries.map((entry) => [versionOf(entry), entry]));\n return indexedThreadsToRefreshFor({\n entries: entries.map((entry) => ({ thread_id: versionOf(entry), app_id: entry.app_id })),\n listedThreadIds: new Set(\n entries.filter((entry) => listedThreadIds.has(entry.thread_id)).map(versionOf),\n ),\n refreshedThreadIds: refreshedVersions,\n appId,\n additionalAppIds,\n }).filter((version) => {\n const entry = byVersion.get(version);\n return entry === undefined || entryCouldMatch(entry, query);\n });\n}\n\n/**\n * Whether a pushed index entry could belong to a list with this local query:\n * the fields the entry carries are checked, the rest pass.\n */\nexport function entryCouldMatch(\n entry: {\n is_unread?: boolean | null;\n is_favorited?: boolean | null;\n run_status?: string | null;\n session_status?: string | null;\n },\n query: AthenaSessionsQuery,\n): boolean {\n if (query.unreadOnly && entry.is_unread === false) return false;\n if (query.favoritesOnly && entry.is_favorited === false) return false;\n if (\n query.runStatuses &&\n typeof entry.run_status === 'string' &&\n !(query.runStatuses as readonly string[]).includes(entry.run_status)\n ) {\n return false;\n }\n if (\n query.sessionStatuses &&\n typeof entry.session_status === 'string' &&\n !(query.sessionStatuses as readonly string[]).includes(entry.session_status)\n ) {\n return false;\n }\n return true;\n}\n"],"names":[],"mappings":";;;;;;;;;AAiGA,MAAM,oBAAoB;AAGnB,MAAM,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N,OAAO,MAAM,mBAAmB,YAChC,CAAE,MAAM,gBAAsC,SAAS,MAAM,cAAc,GAC3E;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;"}
1
+ {"version":3,"file":"use-athena-sessions.js","sources":["../../src/threads/use-athena-sessions.ts"],"sourcesContent":["/**\n * `useAthenaSessions(query)` — one filtered, sorted, live session list under\n * `<AthenaProvider enableThreadList>`: the data layer of `SessionsPage` and\n * `Inbox`, for hosts drawing their own.\n *\n * - **Server-side.** The query travels to `POST /api/conversations/threads/list`\n * as filters of the server's one page statement (`planSessionsQuery`), over\n * the shared two-tier pager (`useConversationList`: a live first page and\n * frozen history pages) in the thread-list provider's query client.\n * - **Live.** Rows fold the same conversation-index pushes the sidebar folds\n * (titles, lifecycle, attention flip in place), carry the provider's\n * in-flight writes (pin, rename, read state, archive), and a thread the\n * index learns about that the list does not show yet refreshes the list\n * once.\n * - **Degraded, not wrong.** A server that cannot apply part of the query is\n * detected from its `supported_filters` echo (one `limit: 1` probe per\n * identity). Fields the loaded rows can be tested on are applied to them\n * (`degradedFields`: exact per page, a page can come back short); fields\n * they cannot are reported in `unavailableFields` and not applied, so a\n * control for them can be disabled rather than lie.\n */\nimport {\n type ConversationListFilter,\n type ConversationSummary,\n conversationListFilterKey,\n conversationListQueryKeys,\n useConversationList,\n} from '@athenaintel/agent-runtime';\nimport { useQuery } from '@tanstack/react-query';\nimport { useContext, useMemo, useRef } from 'react';\nimport { useAthenaQueryClient } from '../lib/use-athena-rest-query';\nimport { withCredentialRenewal } from '../runtime/credential-renewal';\nimport { listThreads } from './api';\nimport { createRestConversationListFetcher } from './conversation-list-fetcher';\nimport { useIndexTriggeredRefresh } from './index-triggered-refresh';\nimport { sessionListShareKey } from './session-list-tab-share';\nimport {\n type AthenaSessionsQuery,\n type AthenaSessionsQueryField,\n matchesSessionsQuery,\n planSessionsQuery,\n sessionsQueryFromKey,\n sessionsQueryKey,\n sortSessions,\n supportedFiltersFromResponse,\n unavailableSessionsQueryFields,\n} from './sessions-query';\nimport {\n AthenaSessionsLiveContext,\n type AthenaStatewireThreadSummary,\n foldConversationIndex,\n indexedThreadsToRefreshFor,\n threadSummaryFromConversation,\n} from './statewire-thread-list';\n\nexport interface UseAthenaSessionsOptions {\n /** What to list. A new object with the same content does not refetch. */\n query: AthenaSessionsQuery;\n /** Rows per page (default 50). */\n pageSize?: number;\n /** `false` holds the list idle. Default `true`. */\n enabled?: boolean;\n}\n\nexport interface AthenaSessionsList {\n /** The rows, in the query's order, with live pushes and in-flight writes applied. */\n rows: AthenaStatewireThreadSummary[];\n /** `false` outside `enableThreadList` mode: nothing is fetched and `rows` stays empty. */\n isAvailable: boolean;\n /** True until the first page has answered (or while no credential has resolved). */\n isLoading: boolean;\n isFetching: boolean;\n hasResolvedFirstPage: boolean;\n /**\n * True while the rows are the previous query's (checked against this\n * query's local part) because this query's first page is still in flight.\n */\n isPlaceholderData: boolean;\n hasNextPage: boolean;\n isFetchingNextPage: boolean;\n fetchNextPage: () => void;\n /** Refetch the first page; resolves once it has answered. */\n refresh: () => Promise<void>;\n /** True while the last \"load more\" request failed. */\n isFetchNextPageError: boolean;\n /**\n * The server fields this backend applies (`supported_filters`), `null`\n * while unknown or on a backend that predates the list.\n */\n supportedFilters: ReadonlySet<string> | null;\n /** Fields applied to the loaded rows because the backend cannot. */\n degradedFields: AthenaSessionsQueryField[];\n /** Fields of this query that cannot be applied on this backend at all (and are not). */\n unavailableFields: AthenaSessionsQueryField[];\n /**\n * Every field this backend cannot apply anywhere, selected or not — what a\n * filter UI disables. Empty until the capabilities probe has answered.\n */\n unsupportedFields: AthenaSessionsQueryField[];\n}\n\nconst DEFAULT_PAGE_SIZE = 50;\n\n/** The capabilities probe's key prefix. */\nexport const THREAD_LIST_CAPABILITIES_QUERY_KEY = [\n 'athena-sdk',\n 'thread-list-capabilities',\n] as const;\n\nconst EMPTY_ROWS: AthenaStatewireThreadSummary[] = [];\nconst EMPTY_VERSIONS: ReadonlySet<string> = new Set();\nconst NOOP = () => undefined;\nconst NOOP_ASYNC = async () => undefined;\n\nexport function useAthenaSessions({\n query,\n pageSize = DEFAULT_PAGE_SIZE,\n enabled = true,\n}: UseAthenaSessionsOptions): AthenaSessionsList {\n const live = useContext(AthenaSessionsLiveContext);\n const isAvailable = live !== null;\n const backendUrl = live?.backendUrl ?? '';\n const principal = live?.principal ?? '';\n const hasAuth = live?.hasAuth ?? false;\n const includePullRequests = live?.includePullRequests ?? false;\n const getAuth = live?.getAuth;\n const active = isAvailable && enabled && hasAuth;\n // Every cache below is keyed by WHO reads (principal) and WITH WHAT (the\n // credential generation): a scoped credential for another workspace under\n // the same principal must never read this one's cached rows.\n const identityScope = `${live?.scopeKey ?? 'unavailable'}::credential-${\n live?.credentialGeneration ?? 0\n }`;\n\n // Outside thread-list mode there may be no `QueryClientProvider`; every\n // query below is disabled there, on a client of this hook's own.\n const queryClient = useAthenaQueryClient();\n\n // Which filters this backend applies: one tiny page per identity. The\n // answer is a property of the deployed agora, so it never goes stale.\n const capabilities = useQuery(\n {\n queryKey: [\n ...THREAD_LIST_CAPABILITIES_QUERY_KEY,\n backendUrl,\n principal,\n live?.credentialGeneration ?? 0,\n ],\n queryFn: async ({ signal }) => {\n if (!getAuth) return null;\n const response = await withCredentialRenewal(getAuth, (auth) =>\n listThreads(backendUrl, auth, { limit: 1, signal }),\n );\n return supportedFiltersFromResponse(response.supported_filters);\n },\n enabled: active,\n staleTime: Number.POSITIVE_INFINITY,\n retry: 1,\n },\n queryClient,\n );\n // A failed probe is treated as an older backend: the query degrades\n // instead of the list staying empty.\n const capabilitiesSettled = capabilities.isSuccess || capabilities.isError;\n const supportedFilters = capabilities.data ?? null;\n\n // `query` may be a fresh object every render; its normalized key is what\n // identifies it, so the plan is built from the key and recomputed only\n // when the content changes.\n const queryKey = sessionsQueryKey(query);\n const plan = useMemo(\n () =>\n planSessionsQuery(sessionsQueryFromKey(queryKey), {\n supportedFilters,\n includePullRequests,\n }),\n [queryKey, supportedFilters, includePullRequests],\n );\n const planRef = useRef(plan);\n planRef.current = plan;\n const unsupportedFields = useMemo(\n () =>\n capabilitiesSettled\n ? unavailableSessionsQueryFields({ supportedFilters, includePullRequests })\n : [],\n [capabilitiesSettled, supportedFilters, includePullRequests],\n );\n\n const fetchPage = useMemo(\n () =>\n getAuth\n ? createRestConversationListFetcher({\n backendUrl,\n getAuth,\n includePullRequests,\n extraFilters: plan.body,\n keepRow: (row) => matchesSessionsQuery(row, planRef.current.local),\n })\n : async () => ({ items: [], hasMore: false, totalCount: null }),\n [backendUrl, getAuth, includePullRequests, plan.body],\n );\n const baseFilter: ConversationListFilter = live?.baseFilter ?? {};\n const capabilityKey = supportedFilters ? [...supportedFilters].sort().join(',') : 'legacy';\n // The query's server filters are not part of the shared filter contract,\n // so they — and what this backend applies of them — key the cache here.\n const listScopeKey = `${identityScope}::sessions::${queryKey}::${capabilityKey}`;\n const list = useConversationList({\n fetchPage,\n filter: baseFilter,\n pageSize,\n scopeKey: listScopeKey,\n enabled: active && capabilitiesSettled,\n queryClient,\n });\n\n // While a changed query's first page is in flight, the previous query's\n // rows stand in, checked against the new query's local part — the list\n // narrows at once instead of blanking to skeletons. Only rows read as the\n // same identity and credential ever stand in.\n const lastResolvedRef = useRef<{ scope: string; conversations: ConversationSummary[] }>({\n scope: '',\n conversations: [],\n });\n if (list.hasResolvedFirstPage) {\n lastResolvedRef.current = { scope: identityScope, conversations: list.conversations };\n }\n const standIn =\n !list.hasResolvedFirstPage && lastResolvedRef.current.scope === identityScope\n ? lastResolvedRef.current.conversations\n : null;\n const source = standIn ?? list.conversations;\n const isPlaceholderData = standIn !== null && standIn.length > 0;\n\n const indexByThread = live?.indexByThread;\n const applyOverrides = live?.applyOverrides;\n const rows = useMemo(() => {\n if (!indexByThread || !applyOverrides) return EMPTY_ROWS;\n const folded: ConversationSummary[] = applyOverrides(\n foldConversationIndex(source, indexByThread),\n ).filter((row) => matchesSessionsQuery(row, plan.local));\n return sortSessions(folded, plan.local).map(threadSummaryFromConversation);\n }, [source, indexByThread, applyOverrides, plan.local]);\n\n // A thread the index knows that this list does not show yet refreshes the\n // list — it may be new, or may have just come to match. Once per VERSION of\n // the entry (its id and `updated_at`): an unchanged entry the server keeps\n // leaving out never refreshes twice, and a later change to it (a PR opened,\n // a run now needing input) gets its own refresh. Coalesced, held while the\n // list is already being read, and a refused refresh is tried again\n // (`useIndexTriggeredRefresh`).\n const indexEntries = live?.indexEntries ?? null;\n const listRefresh = list.refresh;\n const baseAppId = baseFilter.appId;\n const baseAppIds = baseFilter.appIds;\n const listedThreadIds = useMemo(\n () => new Set(list.conversations.map((conversation) => conversation.threadId)),\n [list.conversations],\n );\n const unlistedVersions = useMemo(\n () =>\n indexEntries === null\n ? []\n : indexEntryVersionsToRefresh({\n entries: indexEntries,\n listedThreadIds,\n refreshedVersions: EMPTY_VERSIONS,\n appId: baseAppId,\n additionalAppIds: baseAppIds ?? [],\n query: plan.local,\n }),\n [indexEntries, listedThreadIds, baseAppId, baseAppIds, plan.local],\n );\n useIndexTriggeredRefresh({\n pending: unlistedVersions,\n refresh: listRefresh,\n // Held while the list is being read; a refused first page does not hold\n // it (the refresh is how the list recovers).\n enabled: active && capabilitiesSettled && indexEntries !== null && !list.isFetching,\n tabShare: live?.tabShare,\n shareKey: sessionListShareKey(\n conversationListQueryKeys.firstPage(\n listScopeKey,\n conversationListFilterKey(baseFilter),\n pageSize,\n ),\n ),\n });\n\n const listFetchNextPage = list.fetchNextPage;\n return {\n rows: isAvailable ? rows : EMPTY_ROWS,\n isAvailable,\n isLoading: active && (!capabilitiesSettled || list.isLoading),\n isFetching: list.isFetching || capabilities.isFetching,\n hasResolvedFirstPage: list.hasResolvedFirstPage,\n isPlaceholderData,\n hasNextPage: list.hasNextPage,\n isFetchingNextPage: list.isFetchingNextPage,\n fetchNextPage: isAvailable ? () => void listFetchNextPage() : NOOP,\n refresh: isAvailable ? async () => void (await listRefresh()) : NOOP_ASYNC,\n isFetchNextPageError: list.isFetchNextPageError,\n supportedFilters,\n degradedFields: plan.degraded,\n unavailableFields: plan.unavailable,\n unsupportedFields,\n };\n}\n\ntype IndexEntryLike = Parameters<typeof entryCouldMatch>[0] & {\n thread_id: string;\n updated_at: string;\n app_id: string | null;\n};\n\n/**\n * The index entries that warrant one refresh of a filtered list, as\n * `<thread_id>@<updated_at>` versions: entries the list does not show, of\n * the apps it lists, that the query could match on what the entry carries,\n * and whose version has not prompted a refresh before. An unchanged entry the\n * server keeps leaving out refreshes once; any later change to it refreshes\n * again. Exported for tests.\n */\nexport function indexEntryVersionsToRefresh({\n entries,\n listedThreadIds,\n refreshedVersions,\n appId,\n additionalAppIds,\n query,\n}: {\n entries: readonly IndexEntryLike[];\n listedThreadIds: ReadonlySet<string>;\n refreshedVersions: ReadonlySet<string>;\n appId: string | undefined;\n additionalAppIds: readonly string[];\n query: AthenaSessionsQuery;\n}): string[] {\n const versionOf = (entry: IndexEntryLike) => `${entry.thread_id}@${entry.updated_at}`;\n const byVersion = new Map(entries.map((entry) => [versionOf(entry), entry]));\n return indexedThreadsToRefreshFor({\n entries: entries.map((entry) => ({ thread_id: versionOf(entry), app_id: entry.app_id })),\n listedThreadIds: new Set(\n entries.filter((entry) => listedThreadIds.has(entry.thread_id)).map(versionOf),\n ),\n refreshedThreadIds: refreshedVersions,\n appId,\n additionalAppIds,\n }).filter((version) => {\n const entry = byVersion.get(version);\n return entry === undefined || entryCouldMatch(entry, query);\n });\n}\n\n/**\n * Whether a pushed index entry could belong to a list with this local query:\n * the fields the entry carries are checked, the rest pass.\n */\nexport function entryCouldMatch(\n entry: {\n is_unread?: boolean | null;\n is_favorited?: boolean | null;\n run_status?: string | null;\n session_status?: string | null;\n },\n query: AthenaSessionsQuery,\n): boolean {\n if (query.unreadOnly && entry.is_unread === false) return false;\n if (query.favoritesOnly && entry.is_favorited === false) return false;\n if (\n query.runStatuses &&\n typeof entry.run_status === 'string' &&\n !(query.runStatuses as readonly string[]).includes(entry.run_status)\n ) {\n return false;\n }\n if (\n query.sessionStatuses &&\n typeof entry.session_status === 'string' &&\n !(query.sessionStatuses as readonly string[]).includes(entry.session_status)\n ) {\n return false;\n }\n return true;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqGA,MAAM,oBAAoB;AAGnB,MAAM,qCAAqC;AAAA,EAChD;AAAA,EACA;AACF;AAEA,MAAM,aAA6C,CAAA;AACnD,MAAM,qCAA0C,IAAA;AAChD,MAAM,OAAO,MAAM;AACnB,MAAM,aAAa,YAAY;AAExB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,WAAW;AAAA,EACX,UAAU;AACZ,GAAiD;AAC/C,QAAM,OAAO,WAAW,yBAAyB;AACjD,QAAM,cAAc,SAAS;AAC7B,QAAM,cAAa,6BAAM,eAAc;AACvC,QAAM,aAAY,6BAAM,cAAa;AACrC,QAAM,WAAU,6BAAM,YAAW;AACjC,QAAM,uBAAsB,6BAAM,wBAAuB;AACzD,QAAM,UAAU,6BAAM;AACtB,QAAM,SAAS,eAAe,WAAW;AAIzC,QAAM,gBAAgB,IAAG,6BAAM,aAAY,aAAa,iBACtD,6BAAM,yBAAwB,CAChC;AAIA,QAAM,cAAc,qBAAA;AAIpB,QAAM,eAAe;AAAA,IACnB;AAAA,MACE,UAAU;AAAA,QACR,GAAG;AAAA,QACH;AAAA,QACA;AAAA,SACA,6BAAM,yBAAwB;AAAA,MAAA;AAAA,MAEhC,SAAS,OAAO,EAAE,aAAa;AAC7B,YAAI,CAAC,QAAS,QAAO;AACrB,cAAM,WAAW,MAAM;AAAA,UAAsB;AAAA,UAAS,CAAC,SACrD,YAAY,YAAY,MAAM,EAAE,OAAO,GAAG,OAAA,CAAQ;AAAA,QAAA;AAEpD,eAAO,6BAA6B,SAAS,iBAAiB;AAAA,MAChE;AAAA,MACA,SAAS;AAAA,MACT,WAAW,OAAO;AAAA,MAClB,OAAO;AAAA,IAAA;AAAA,IAET;AAAA,EAAA;AAIF,QAAM,sBAAsB,aAAa,aAAa,aAAa;AACnE,QAAM,mBAAm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;AAAA,EAC5D,CAAC;AACH;AAMO,SAAS,gBACd,OAMA,OACS;AACT,MAAI,MAAM,cAAc,MAAM,cAAc,MAAO,QAAO;AAC1D,MAAI,MAAM,iBAAiB,MAAM,iBAAiB,MAAO,QAAO;AAChE,MACE,MAAM,eACN,OAAO,MAAM,eAAe,YAC5B,CAAE,MAAM,YAAkC,SAAS,MAAM,UAAU,GACnE;AACA,WAAO;AAAA,EACT;AACA,MACE,MAAM,mBACN,OAAO,MAAM,mBAAmB,YAChC,CAAE,MAAM,gBAAsC,SAAS,MAAM,cAAc,GAC3E;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;"}
@@ -1,4 +1,4 @@
1
- import { type ConversationSummary } from '@athenaintel/agent-runtime';
1
+ import { type ConversationSummary } from '../agent-runtime/src/index';
2
2
  import { type CredentialResolver } from '../runtime/credential-renewal';
3
3
  export type RestConversationAuth = {
4
4
  apiKey?: string;
@@ -1,4 +1,4 @@
1
- import { type ConversationIndexEntry, type ConversationSummary, type UseConversationIndexOptions } from "@athenaintel/agent-runtime";
1
+ import { type ConversationIndexEntry, type ConversationSummary, type UseConversationIndexOptions } from "../agent-runtime/src/index";
2
2
  import { type CredentialResolver } from "../runtime/credential-renewal";
3
3
  import { type RestConversationAuth } from "./use-rest-conversation-history";
4
4
  export interface UseStatewireConversationHistoryOptions {
@@ -57,13 +57,13 @@ export declare function useStatewireConversationHistory({ backendUrl, conversati
57
57
  messageCount: number | null;
58
58
  sessionStatus: string | null;
59
59
  runStatus: string | null;
60
- attention?: import("@athenaintel/agent-runtime").ConversationAttention | null;
60
+ attention?: import("../agent-runtime/src/index").ConversationAttention | null;
61
61
  nextAction?: string | null;
62
- attentionSource?: import("@athenaintel/agent-runtime").ConversationAttentionSource | null;
62
+ attentionSource?: import("../agent-runtime/src/index").ConversationAttentionSource | null;
63
63
  isFavorited?: boolean;
64
64
  createdByMe?: boolean;
65
- lastWake?: import("@athenaintel/agent-runtime").ConversationWake | null;
66
- pullRequests?: import("@athenaintel/agent-runtime").ConversationPullRequest[] | null;
65
+ lastWake?: import("../agent-runtime/src/index").ConversationWake | null;
66
+ pullRequests?: import("../agent-runtime/src/index").ConversationPullRequest[] | null;
67
67
  isUnread: boolean;
68
68
  }[];
69
69
  totalCount: number | null;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The table writer every Tiptap editor that writes Markdown through
3
+ * tiptap-markdown shares: Olympus's docs `TableNode` and Skill editor, and the
4
+ * `@athenaintel/react` chat composer's `ChatTableExtension`. A table node takes
5
+ * it through {@link markdownTableStorage}.
6
+ */
7
+ import { type Editor } from "@tiptap/core";
8
+ import { Fragment, type Node as ProseMirrorNode } from "@tiptap/pm/model";
9
+ /**
10
+ * A table cell's markdown with each `|` escaped, so none of them ends the cell.
11
+ * GFM ends a cell at every unescaped pipe, inside a code span or a link target
12
+ * too; markdown-it drops the backslash of each `\|` as it splits the row, so the
13
+ * cell (and any code span in it) reads back with its literal pipe. The AOP
14
+ * converter's markdown read escapes cells the same way
15
+ * (`agora/converter-olympus/src/utils/turndown-helpers.ts`).
16
+ */
17
+ export declare function escapeTableCellPipes(markdown: string): string;
18
+ /**
19
+ * What the table serializer uses of tiptap-markdown's serializer state:
20
+ * prosemirror-markdown's `MarkdownSerializerState` plus tiptap-markdown's
21
+ * `inTable` flag, which makes a hard break inside a cell write `<br>`.
22
+ */
23
+ interface MarkdownTableSerializerState {
24
+ out: string;
25
+ inTable: boolean;
26
+ write(content?: string): void;
27
+ text(text: string, escapeMarkdown?: boolean): void;
28
+ ensureNewLine(): void;
29
+ closeBlock(node: ProseMirrorNode): void;
30
+ renderInline(parent: ProseMirrorNode, fromBlockStart?: boolean): void;
31
+ }
32
+ /** The `this` tiptap-markdown binds a node's `serialize` to. */
33
+ interface MarkdownSpecContext {
34
+ editor: Editor;
35
+ }
36
+ /**
37
+ * tiptap-markdown 0.9.0's table serializer, except that a `|` inside a cell is
38
+ * written as `\|` (see {@link escapeTableCellPipes}). The library writes it
39
+ * bare — it escapes only `<` / `>` in text, and prosemirror-markdown only
40
+ * `` `*\~[]_ `` — so a cell holding `a | b` or `` `x|y` `` read back as extra
41
+ * columns and markdown-it dropped every cell past the header's width. A table
42
+ * that is not a GFM pipe table is still written as HTML, and everything else is
43
+ * written exactly as the library writes it.
44
+ */
45
+ export declare function serializeMarkdownTable(this: MarkdownSpecContext, state: MarkdownTableSerializerState, node: ProseMirrorNode, parent: ProseMirrorNode | Fragment): void;
46
+ /**
47
+ * The storage that makes tiptap-markdown serialize a table node with
48
+ * {@link serializeMarkdownTable}: tiptap-markdown reads a node's markdown spec
49
+ * from `storage.markdown`, over its own spec for the node's name.
50
+ */
51
+ export declare function markdownTableStorage(): {
52
+ markdown: {
53
+ serialize: typeof serializeMarkdownTable;
54
+ };
55
+ };
56
+ export {};
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const react$1 = require("@assistant-ui/react");
5
- const react = require("react");
6
- const NestedPtcComponentsContext = react.createContext(null);
4
+ const react = require("@assistant-ui/react");
5
+ const react$1 = require("react");
6
+ const toolNames = require("../agent-runtime/src/tool-names.cjs");
7
+ const NestedPtcComponentsContext = react$1.createContext(null);
7
8
  const NestedPtcComponentsProvider = ({ components, children }) => /* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsContext.Provider, { value: components, children });
8
9
  const useNestedPtcComponents = (fallback) => {
9
- const components = react.useContext(NestedPtcComponentsContext);
10
- return react.useMemo(() => {
10
+ const components = react$1.useContext(NestedPtcComponentsContext);
11
+ return react$1.useMemo(() => {
11
12
  const standardComponents = components && "ChainOfThought" in components && components.ChainOfThought ? void 0 : components;
12
13
  return {
13
14
  ...standardComponents ?? {},
@@ -23,13 +24,16 @@ const NestedPtcMessages = ({
23
24
  components,
24
25
  messageClassName
25
26
  }) => {
26
- const propsRef = react.useRef({ components, messageClassName });
27
+ const isSubagentLane = react.useAuiState(
28
+ (s) => s.part.type === "tool-call" && s.part.toolName === toolNames.TASK_TOOL_NAME
29
+ );
30
+ const propsRef = react$1.useRef({ components, messageClassName });
27
31
  propsRef.current = { components, messageClassName };
28
- const messageComponents = react.useMemo(() => {
32
+ const messageComponents = react$1.useMemo(() => {
29
33
  const NestedMessage = () => {
30
34
  const { components: components2, messageClassName: messageClassName2 } = propsRef.current;
31
35
  const parts = /* @__PURE__ */ jsxRuntime.jsx(
32
- react$1.MessagePrimitive.Parts,
36
+ react.MessagePrimitive.Parts,
33
37
  {
34
38
  components: { Empty: EmptyComponent, ...components2 }
35
39
  }
@@ -38,7 +42,8 @@ const NestedPtcMessages = ({
38
42
  };
39
43
  return { Message: NestedMessage };
40
44
  }, []);
41
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePartPrimitive.Messages, { components: messageComponents });
45
+ if (isSubagentLane) return null;
46
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MessagePartPrimitive.Messages, { components: messageComponents });
42
47
  };
43
48
  exports.NestedPtcComponentsProvider = NestedPtcComponentsProvider;
44
49
  exports.NestedPtcMessages = NestedPtcMessages;
@@ -1 +1 @@
1
- {"version":3,"file":"NestedPtcMessages.cjs","sources":["../../src/tools/NestedPtcMessages.tsx"],"sourcesContent":["\"use client\";\n\nimport { MessagePartPrimitive, MessagePrimitive } from \"@assistant-ui/react\";\nimport {\n createContext,\n useContext,\n useMemo,\n useRef,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n} from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\n\ntype PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>[\"components\"];\ntype StandardPartsComponents = Extract<\n NonNullable<PartsComponents>,\n { ChainOfThought?: undefined }\n>;\n\nconst NestedPtcComponentsContext = createContext<PartsComponents | null>(null);\n\nexport const NestedPtcComponentsProvider: FC<\n PropsWithChildren<{ components: PartsComponents }>\n> = ({ components, children }) => (\n <NestedPtcComponentsContext.Provider value={components}>\n {children}\n </NestedPtcComponentsContext.Provider>\n);\n\nexport const useNestedPtcComponents = (\n fallback: ToolCallMessagePartComponent\n): PartsComponents => {\n const components = useContext(NestedPtcComponentsContext);\n\n return useMemo(() => {\n const standardComponents =\n components && \"ChainOfThought\" in components && components.ChainOfThought\n ? undefined\n : (components as StandardPartsComponents | null);\n\n return {\n ...(standardComponents ?? {}),\n tools: {\n ...(standardComponents?.tools ?? {}),\n Fallback: fallback,\n },\n } satisfies StandardPartsComponents;\n }, [components, fallback]);\n};\n\nexport interface NestedPtcMessagesProps {\n components: PartsComponents;\n messageClassName?: string;\n}\n\nconst EmptyComponent: FC = () => null;\n\nexport const NestedPtcMessages: FC<NestedPtcMessagesProps> = ({\n components,\n messageClassName,\n}) => {\n const propsRef = useRef({ components, messageClassName });\n propsRef.current = { components, messageClassName };\n\n const messageComponents = useMemo(() => {\n const NestedMessage: FC = () => {\n const { components, messageClassName } = propsRef.current;\n const parts = (\n <MessagePrimitive.Parts\n components={{ Empty: EmptyComponent, ...components }}\n />\n );\n return messageClassName ? (\n <div className={messageClassName}>{parts}</div>\n ) : (\n parts\n );\n };\n\n return { Message: NestedMessage };\n }, []);\n\n return <MessagePartPrimitive.Messages components={messageComponents} />;\n};\n"],"names":["createContext","jsx","useContext","useMemo","useRef","components","messageClassName","MessagePrimitive","MessagePartPrimitive"],"mappings":";;;;;AAoBA,MAAM,6BAA6BA,MAAAA,cAAsC,IAAI;AAEtE,MAAM,8BAET,CAAC,EAAE,YAAY,eACjBC,2BAAAA,IAAC,2BAA2B,UAA3B,EAAoC,OAAO,YACzC,SAAA,CACH;AAGK,MAAM,yBAAyB,CACpC,aACoB;AACpB,QAAM,aAAaC,MAAAA,WAAW,0BAA0B;AAExD,SAAOC,MAAAA,QAAQ,MAAM;AACnB,UAAM,qBACJ,cAAc,oBAAoB,cAAc,WAAW,iBACvD,SACC;AAEP,WAAO;AAAA,MACL,GAAI,sBAAsB,CAAA;AAAA,MAC1B,OAAO;AAAA,QACL,IAAI,yDAAoB,UAAS,CAAA;AAAA,QACjC,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,GAAG,CAAC,YAAY,QAAQ,CAAC;AAC3B;AAOA,MAAM,iBAAqB,MAAM;AAE1B,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AACF,MAAM;AACJ,QAAM,WAAWC,MAAAA,OAAO,EAAE,YAAY,kBAAkB;AACxD,WAAS,UAAU,EAAE,YAAY,iBAAA;AAEjC,QAAM,oBAAoBD,MAAAA,QAAQ,MAAM;AACtC,UAAM,gBAAoB,MAAM;AAC9B,YAAM,EAAE,YAAAE,aAAY,kBAAAC,kBAAAA,IAAqB,SAAS;AAClD,YAAM,QACJL,2BAAAA;AAAAA,QAACM,QAAAA,iBAAiB;AAAA,QAAjB;AAAA,UACC,YAAY,EAAE,OAAO,gBAAgB,GAAGF,YAAAA;AAAAA,QAAW;AAAA,MAAA;AAGvD,aAAOC,oBACLL,+BAAC,OAAA,EAAI,WAAWK,mBAAmB,iBAAM,IAEzC;AAAA,IAEJ;AAEA,WAAO,EAAE,SAAS,cAAA;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,SAAOL,2BAAAA,IAACO,QAAAA,qBAAqB,UAArB,EAA8B,YAAY,kBAAA,CAAmB;AACvE;;;;"}
1
+ {"version":3,"file":"NestedPtcMessages.cjs","sources":["../../src/tools/NestedPtcMessages.tsx"],"sourcesContent":["\"use client\";\n\nimport { MessagePartPrimitive, MessagePrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { TASK_TOOL_NAME } from \"@athenaintel/agent-runtime\";\nimport {\n createContext,\n useContext,\n useMemo,\n useRef,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n} from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\n\ntype PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>[\"components\"];\ntype StandardPartsComponents = Extract<\n NonNullable<PartsComponents>,\n { ChainOfThought?: undefined }\n>;\n\nconst NestedPtcComponentsContext = createContext<PartsComponents | null>(null);\n\nexport const NestedPtcComponentsProvider: FC<\n PropsWithChildren<{ components: PartsComponents }>\n> = ({ components, children }) => (\n <NestedPtcComponentsContext.Provider value={components}>\n {children}\n </NestedPtcComponentsContext.Provider>\n);\n\nexport const useNestedPtcComponents = (\n fallback: ToolCallMessagePartComponent\n): PartsComponents => {\n const components = useContext(NestedPtcComponentsContext);\n\n return useMemo(() => {\n const standardComponents =\n components && \"ChainOfThought\" in components && components.ChainOfThought\n ? undefined\n : (components as StandardPartsComponents | null);\n\n return {\n ...(standardComponents ?? {}),\n tools: {\n ...(standardComponents?.tools ?? {}),\n Fallback: fallback,\n },\n } satisfies StandardPartsComponents;\n }, [components, fallback]);\n};\n\nexport interface NestedPtcMessagesProps {\n components: PartsComponents;\n messageClassName?: string;\n}\n\nconst EmptyComponent: FC = () => null;\n\n/**\n * A tool call's nested messages (a programmatic-tool-calling execution's\n * sub-calls), rendered under the tool card with the parent's renderers.\n *\n * Except a `task` call's: those are its subagent's lane, which the subagent\n * card (`SubagentTaskToolUI`) shows and pages. A generic card or a host's own\n * `task` UI wrapped with these would show a second, unpaged copy (a cut lane\n * holds only its newest steps), so it renders nothing for them.\n */\nexport const NestedPtcMessages: FC<NestedPtcMessagesProps> = ({\n components,\n messageClassName,\n}) => {\n const isSubagentLane = useAuiState(\n (s) => s.part.type === \"tool-call\" && s.part.toolName === TASK_TOOL_NAME,\n );\n const propsRef = useRef({ components, messageClassName });\n propsRef.current = { components, messageClassName };\n\n const messageComponents = useMemo(() => {\n const NestedMessage: FC = () => {\n const { components, messageClassName } = propsRef.current;\n const parts = (\n <MessagePrimitive.Parts\n components={{ Empty: EmptyComponent, ...components }}\n />\n );\n return messageClassName ? (\n <div className={messageClassName}>{parts}</div>\n ) : (\n parts\n );\n };\n\n return { Message: NestedMessage };\n }, []);\n\n if (isSubagentLane) return null;\n return <MessagePartPrimitive.Messages components={messageComponents} />;\n};\n"],"names":["createContext","jsx","useContext","use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zC;AAAA,IAEJ;AAEA,WAAO,EAAE,SAAS,cAAA;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,MAAI,eAAgB,QAAO;AAC3B,SAAOP,2BAAAA,IAACS,MAAAA,qBAAqB,UAArB,EAA8B,YAAY,kBAAA,CAAmB;AACvE;;;;"}
@@ -10,5 +10,14 @@ export interface NestedPtcMessagesProps {
10
10
  components: PartsComponents;
11
11
  messageClassName?: string;
12
12
  }
13
+ /**
14
+ * A tool call's nested messages (a programmatic-tool-calling execution's
15
+ * sub-calls), rendered under the tool card with the parent's renderers.
16
+ *
17
+ * Except a `task` call's: those are its subagent's lane, which the subagent
18
+ * card (`SubagentTaskToolUI`) shows and pages. A generic card or a host's own
19
+ * `task` UI wrapped with these would show a second, unpaged copy (a cut lane
20
+ * holds only its newest steps), so it renders nothing for them.
21
+ */
13
22
  export declare const NestedPtcMessages: FC<NestedPtcMessagesProps>;
14
23
  export {};
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { MessagePartPrimitive, MessagePrimitive } from "@assistant-ui/react";
2
+ import { useAuiState, MessagePartPrimitive, MessagePrimitive } from "@assistant-ui/react";
3
3
  import { useRef, useMemo, useContext, createContext } from "react";
4
+ import { TASK_TOOL_NAME } from "../agent-runtime/src/tool-names.js";
4
5
  const NestedPtcComponentsContext = createContext(null);
5
6
  const NestedPtcComponentsProvider = ({ components, children }) => /* @__PURE__ */ jsx(NestedPtcComponentsContext.Provider, { value: components, children });
6
7
  const useNestedPtcComponents = (fallback) => {
@@ -21,6 +22,9 @@ const NestedPtcMessages = ({
21
22
  components,
22
23
  messageClassName
23
24
  }) => {
25
+ const isSubagentLane = useAuiState(
26
+ (s) => s.part.type === "tool-call" && s.part.toolName === TASK_TOOL_NAME
27
+ );
24
28
  const propsRef = useRef({ components, messageClassName });
25
29
  propsRef.current = { components, messageClassName };
26
30
  const messageComponents = useMemo(() => {
@@ -36,6 +40,7 @@ const NestedPtcMessages = ({
36
40
  };
37
41
  return { Message: NestedMessage };
38
42
  }, []);
43
+ if (isSubagentLane) return null;
39
44
  return /* @__PURE__ */ jsx(MessagePartPrimitive.Messages, { components: messageComponents });
40
45
  };
41
46
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"NestedPtcMessages.js","sources":["../../src/tools/NestedPtcMessages.tsx"],"sourcesContent":["\"use client\";\n\nimport { MessagePartPrimitive, MessagePrimitive } from \"@assistant-ui/react\";\nimport {\n createContext,\n useContext,\n useMemo,\n useRef,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n} from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\n\ntype PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>[\"components\"];\ntype StandardPartsComponents = Extract<\n NonNullable<PartsComponents>,\n { ChainOfThought?: undefined }\n>;\n\nconst NestedPtcComponentsContext = createContext<PartsComponents | null>(null);\n\nexport const NestedPtcComponentsProvider: FC<\n PropsWithChildren<{ components: PartsComponents }>\n> = ({ components, children }) => (\n <NestedPtcComponentsContext.Provider value={components}>\n {children}\n </NestedPtcComponentsContext.Provider>\n);\n\nexport const useNestedPtcComponents = (\n fallback: ToolCallMessagePartComponent\n): PartsComponents => {\n const components = useContext(NestedPtcComponentsContext);\n\n return useMemo(() => {\n const standardComponents =\n components && \"ChainOfThought\" in components && components.ChainOfThought\n ? undefined\n : (components as StandardPartsComponents | null);\n\n return {\n ...(standardComponents ?? {}),\n tools: {\n ...(standardComponents?.tools ?? {}),\n Fallback: fallback,\n },\n } satisfies StandardPartsComponents;\n }, [components, fallback]);\n};\n\nexport interface NestedPtcMessagesProps {\n components: PartsComponents;\n messageClassName?: string;\n}\n\nconst EmptyComponent: FC = () => null;\n\nexport const NestedPtcMessages: FC<NestedPtcMessagesProps> = ({\n components,\n messageClassName,\n}) => {\n const propsRef = useRef({ components, messageClassName });\n propsRef.current = { components, messageClassName };\n\n const messageComponents = useMemo(() => {\n const NestedMessage: FC = () => {\n const { components, messageClassName } = propsRef.current;\n const parts = (\n <MessagePrimitive.Parts\n components={{ Empty: EmptyComponent, ...components }}\n />\n );\n return messageClassName ? (\n <div className={messageClassName}>{parts}</div>\n ) : (\n parts\n );\n };\n\n return { Message: NestedMessage };\n }, []);\n\n return <MessagePartPrimitive.Messages components={messageComponents} />;\n};\n"],"names":["components","messageClassName"],"mappings":";;;AAoBA,MAAM,6BAA6B,cAAsC,IAAI;AAEtE,MAAM,8BAET,CAAC,EAAE,YAAY,eACjB,oBAAC,2BAA2B,UAA3B,EAAoC,OAAO,YACzC,SAAA,CACH;AAGK,MAAM,yBAAyB,CACpC,aACoB;AACpB,QAAM,aAAa,WAAW,0BAA0B;AAExD,SAAO,QAAQ,MAAM;AACnB,UAAM,qBACJ,cAAc,oBAAoB,cAAc,WAAW,iBACvD,SACC;AAEP,WAAO;AAAA,MACL,GAAI,sBAAsB,CAAA;AAAA,MAC1B,OAAO;AAAA,QACL,IAAI,yDAAoB,UAAS,CAAA;AAAA,QACjC,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,GAAG,CAAC,YAAY,QAAQ,CAAC;AAC3B;AAOA,MAAM,iBAAqB,MAAM;AAE1B,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AACF,MAAM;AACJ,QAAM,WAAW,OAAO,EAAE,YAAY,kBAAkB;AACxD,WAAS,UAAU,EAAE,YAAY,iBAAA;AAEjC,QAAM,oBAAoB,QAAQ,MAAM;AACtC,UAAM,gBAAoB,MAAM;AAC9B,YAAM,EAAE,YAAAA,aAAY,kBAAAC,kBAAAA,IAAqB,SAAS;AAClD,YAAM,QACJ;AAAA,QAAC,iBAAiB;AAAA,QAAjB;AAAA,UACC,YAAY,EAAE,OAAO,gBAAgB,GAAGD,YAAAA;AAAAA,QAAW;AAAA,MAAA;AAGvD,aAAOC,oBACL,oBAAC,OAAA,EAAI,WAAWA,mBAAmB,iBAAM,IAEzC;AAAA,IAEJ;AAEA,WAAO,EAAE,SAAS,cAAA;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,SAAO,oBAAC,qBAAqB,UAArB,EAA8B,YAAY,kBAAA,CAAmB;AACvE;"}
1
+ {"version":3,"file":"NestedPtcMessages.js","sources":["../../src/tools/NestedPtcMessages.tsx"],"sourcesContent":["\"use client\";\n\nimport { MessagePartPrimitive, MessagePrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { TASK_TOOL_NAME } from \"@athenaintel/agent-runtime\";\nimport {\n createContext,\n useContext,\n useMemo,\n useRef,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n} from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\n\ntype PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>[\"components\"];\ntype StandardPartsComponents = Extract<\n NonNullable<PartsComponents>,\n { ChainOfThought?: undefined }\n>;\n\nconst NestedPtcComponentsContext = createContext<PartsComponents | null>(null);\n\nexport const NestedPtcComponentsProvider: FC<\n PropsWithChildren<{ components: PartsComponents }>\n> = ({ components, children }) => (\n <NestedPtcComponentsContext.Provider value={components}>\n {children}\n </NestedPtcComponentsContext.Provider>\n);\n\nexport const useNestedPtcComponents = (\n fallback: ToolCallMessagePartComponent\n): PartsComponents => {\n const components = useContext(NestedPtcComponentsContext);\n\n return useMemo(() => {\n const standardComponents =\n components && \"ChainOfThought\" in components && components.ChainOfThought\n ? undefined\n : (components as StandardPartsComponents | null);\n\n return {\n ...(standardComponents ?? {}),\n tools: {\n ...(standardComponents?.tools ?? {}),\n Fallback: fallback,\n },\n } satisfies StandardPartsComponents;\n }, [components, fallback]);\n};\n\nexport interface NestedPtcMessagesProps {\n components: PartsComponents;\n messageClassName?: string;\n}\n\nconst EmptyComponent: FC = () => null;\n\n/**\n * A tool call's nested messages (a programmatic-tool-calling execution's\n * sub-calls), rendered under the tool card with the parent's renderers.\n *\n * Except a `task` call's: those are its subagent's lane, which the subagent\n * card (`SubagentTaskToolUI`) shows and pages. A generic card or a host's own\n * `task` UI wrapped with these would show a second, unpaged copy (a cut lane\n * holds only its newest steps), so it renders nothing for them.\n */\nexport const NestedPtcMessages: FC<NestedPtcMessagesProps> = ({\n components,\n messageClassName,\n}) => {\n const isSubagentLane = useAuiState(\n (s) => s.part.type === \"tool-call\" && s.part.toolName === TASK_TOOL_NAME,\n );\n const propsRef = useRef({ components, messageClassName });\n propsRef.current = { components, messageClassName };\n\n const messageComponents = useMemo(() => {\n const NestedMessage: FC = () => {\n const { components, messageClassName } = propsRef.current;\n const parts = (\n <MessagePrimitive.Parts\n components={{ Empty: EmptyComponent, ...components }}\n />\n );\n return messageClassName ? (\n <div className={messageClassName}>{parts}</div>\n ) : (\n parts\n );\n };\n\n return { Message: NestedMessage };\n }, []);\n\n if (isSubagentLane) return null;\n return <MessagePartPrimitive.Messages components={messageComponents} />;\n};\n"],"names":["components","messageClassName"],"mappings":";;;;AAqBA,MAAM,6BAA6B,cAAsC,IAAI;AAEtE,MAAM,8BAET,CAAC,EAAE,YAAY,eACjB,oBAAC,2BAA2B,UAA3B,EAAoC,OAAO,YACzC,SAAA,CACH;AAGK,MAAM,yBAAyB,CACpC,aACoB;AACpB,QAAM,aAAa,WAAW,0BAA0B;AAExD,SAAO,QAAQ,MAAM;AACnB,UAAM,qBACJ,cAAc,oBAAoB,cAAc,WAAW,iBACvD,SACC;AAEP,WAAO;AAAA,MACL,GAAI,sBAAsB,CAAA;AAAA,MAC1B,OAAO;AAAA,QACL,IAAI,yDAAoB,UAAS,CAAA;AAAA,QACjC,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,GAAG,CAAC,YAAY,QAAQ,CAAC;AAC3B;AAOA,MAAM,iBAAqB,MAAM;AAW1B,MAAM,oBAAgD,CAAC;AAAA,EAC5D;AAAA,EACA;AACF,MAAM;AACJ,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAAM,EAAE,KAAK,SAAS,eAAe,EAAE,KAAK,aAAa;AAAA,EAAA;AAE5D,QAAM,WAAW,OAAO,EAAE,YAAY,kBAAkB;AACxD,WAAS,UAAU,EAAE,YAAY,iBAAA;AAEjC,QAAM,oBAAoB,QAAQ,MAAM;AACtC,UAAM,gBAAoB,MAAM;AAC9B,YAAM,EAAE,YAAAA,aAAY,kBAAAC,kBAAAA,IAAqB,SAAS;AAClD,YAAM,QACJ;AAAA,QAAC,iBAAiB;AAAA,QAAjB;AAAA,UACC,YAAY,EAAE,OAAO,gBAAgB,GAAGD,YAAAA;AAAAA,QAAW;AAAA,MAAA;AAGvD,aAAOC,oBACL,oBAAC,OAAA,EAAI,WAAWA,mBAAmB,iBAAM,IAEzC;AAAA,IAEJ;AAEA,WAAO,EAAE,SAAS,cAAA;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,MAAI,eAAgB,QAAO;AAC3B,SAAO,oBAAC,qBAAqB,UAArB,EAA8B,YAAY,kBAAA,CAAmB;AACvE;"}
@@ -15,4 +15,4 @@ export { InstallPackageToolUI } from "./misc-tool-uis";
15
15
  export { VoiceUpdateCard, type VoiceUpdateCardProps, VoiceUpdateToolUI, } from "./voice-update-tool-ui";
16
16
  export { TestRecordingMarkToolUI, TestRecordingReportCard, type TestRecordingReportCardProps, TestRecordingStartToolUI, TestRecordingStopToolUI, } from "./test-recording-tool-uis";
17
17
  export { isSdkInlineTool } from "./inline-tools";
18
- export { classifyToolResult, describeToolArgs, getToolDisplayMeta, isToolResultSuccess, resultMessage, toolActiveLabel, toolCompletedLabel, type ToolDisplayMeta, type ToolResultClassification, } from "@athenaintel/agent-runtime";
18
+ export { classifyToolResult, describeToolArgs, getToolDisplayMeta, isToolResultSuccess, resultMessage, toolActiveLabel, toolCompletedLabel, type ToolDisplayMeta, type ToolResultClassification, } from "../agent-runtime/src/index";
@@ -5,7 +5,7 @@
5
5
  * without importing the registry that imports it back.
6
6
  */
7
7
  import { type ElementType, type ReactNode } from "react";
8
- import { formatToolName } from "@athenaintel/agent-runtime";
8
+ import { formatToolName } from "../agent-runtime/src/index";
9
9
  export { formatToolName };
10
10
  /** Parse JSON text into a record, or `null` when it is not one. */
11
11
  export declare function tryParseJson(text: string): Record<string, unknown> | null;