@assistant-ui/core 0.2.9 → 0.2.11

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 (437) hide show
  1. package/dist/adapters/attachment.d.ts.map +1 -1
  2. package/dist/adapters/attachment.js +22 -12
  3. package/dist/adapters/attachment.js.map +1 -1
  4. package/dist/adapters/directive-formatter.js.map +1 -1
  5. package/dist/adapters/speech.js.map +1 -1
  6. package/dist/index.d.ts +3 -1
  7. package/dist/index.js +2 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal.js +1 -1
  10. package/dist/model-context/frame/host.js.map +1 -1
  11. package/dist/model-context/frame/provider.js.map +1 -1
  12. package/dist/model-context/registry.js.map +1 -1
  13. package/dist/model-context/tool.d.ts +1 -1
  14. package/dist/model-context/tool.js +1 -1
  15. package/dist/model-context/tool.js.map +1 -1
  16. package/dist/model-context/types.js +17 -2
  17. package/dist/model-context/types.js.map +1 -1
  18. package/dist/react/AssistantProvider.js +1 -1
  19. package/dist/react/AssistantRuntimeProvider.d.ts +1 -1
  20. package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
  21. package/dist/react/AssistantRuntimeProvider.js +1 -1
  22. package/dist/react/RuntimeAdapter.js +4 -2
  23. package/dist/react/RuntimeAdapter.js.map +1 -1
  24. package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
  25. package/dist/react/adapters/LocalStorageThreadListAdapter.js +13 -3
  26. package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
  27. package/dist/react/client/DataRenderers.d.ts.map +1 -1
  28. package/dist/react/client/DataRenderers.js +6 -5
  29. package/dist/react/client/DataRenderers.js.map +1 -1
  30. package/dist/react/client/Interactables.d.ts.map +1 -1
  31. package/dist/react/client/Interactables.js +30 -29
  32. package/dist/react/client/Interactables.js.map +1 -1
  33. package/dist/react/client/Tools.d.ts.map +1 -1
  34. package/dist/react/client/Tools.js +19 -12
  35. package/dist/react/client/Tools.js.map +1 -1
  36. package/dist/react/index.d.ts +10 -5
  37. package/dist/react/index.js +7 -2
  38. package/dist/react/model-context/define-mcp-toolkit.d.ts +12 -0
  39. package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -0
  40. package/dist/react/model-context/define-mcp-toolkit.js +14 -0
  41. package/dist/react/model-context/define-mcp-toolkit.js.map +1 -0
  42. package/dist/react/model-context/define-toolkit.d.ts +10 -12
  43. package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
  44. package/dist/react/model-context/define-toolkit.js +2 -15
  45. package/dist/react/model-context/define-toolkit.js.map +1 -1
  46. package/dist/react/model-context/external-tool.d.ts +14 -0
  47. package/dist/react/model-context/external-tool.d.ts.map +1 -0
  48. package/dist/react/model-context/external-tool.js +17 -0
  49. package/dist/react/model-context/external-tool.js.map +1 -0
  50. package/dist/react/model-context/human-tool.d.ts +27 -0
  51. package/dist/react/model-context/human-tool.d.ts.map +1 -0
  52. package/dist/react/model-context/human-tool.js +30 -0
  53. package/dist/react/model-context/human-tool.js.map +1 -0
  54. package/dist/react/model-context/makeAssistantTool.d.ts +8 -0
  55. package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
  56. package/dist/react/model-context/makeAssistantTool.js +4 -0
  57. package/dist/react/model-context/makeAssistantTool.js.map +1 -1
  58. package/dist/react/model-context/makeAssistantToolUI.d.ts +8 -0
  59. package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
  60. package/dist/react/model-context/makeAssistantToolUI.js +4 -0
  61. package/dist/react/model-context/makeAssistantToolUI.js.map +1 -1
  62. package/dist/react/model-context/provider-tool.d.ts +15 -0
  63. package/dist/react/model-context/provider-tool.d.ts.map +1 -0
  64. package/dist/react/model-context/provider-tool.js +12 -0
  65. package/dist/react/model-context/provider-tool.js.map +1 -0
  66. package/dist/react/model-context/stub-tool.d.ts +12 -0
  67. package/dist/react/model-context/stub-tool.d.ts.map +1 -0
  68. package/dist/react/model-context/stub-tool.js +15 -0
  69. package/dist/react/model-context/stub-tool.js.map +1 -0
  70. package/dist/react/model-context/toolbox.d.ts +64 -17
  71. package/dist/react/model-context/toolbox.d.ts.map +1 -1
  72. package/dist/react/model-context/toolbox.js +19 -1
  73. package/dist/react/model-context/toolbox.js.map +1 -1
  74. package/dist/react/model-context/useAssistantContext.js +1 -1
  75. package/dist/react/model-context/useAssistantContext.js.map +1 -1
  76. package/dist/react/model-context/useAssistantDataUI.js +1 -1
  77. package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
  78. package/dist/react/model-context/useAssistantInstructions.js +1 -1
  79. package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
  80. package/dist/react/model-context/useAssistantInteractable.js +1 -1
  81. package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
  82. package/dist/react/model-context/useAssistantTool.d.ts +11 -1
  83. package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
  84. package/dist/react/model-context/useAssistantTool.js +12 -6
  85. package/dist/react/model-context/useAssistantTool.js.map +1 -1
  86. package/dist/react/model-context/useAssistantToolUI.d.ts +13 -4
  87. package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
  88. package/dist/react/model-context/useAssistantToolUI.js +7 -4
  89. package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
  90. package/dist/react/model-context/useAuiToolOverrides.d.ts +22 -0
  91. package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -0
  92. package/dist/react/model-context/useAuiToolOverrides.js +31 -0
  93. package/dist/react/model-context/useAuiToolOverrides.js.map +1 -0
  94. package/dist/react/model-context/useInlineRender.js +1 -1
  95. package/dist/react/model-context/useInlineRender.js.map +1 -1
  96. package/dist/react/model-context/useInteractableState.js +1 -1
  97. package/dist/react/model-context/useInteractableState.js.map +1 -1
  98. package/dist/react/model-context/useToolArgsStatus.js +1 -1
  99. package/dist/react/primitive-hooks/useActionBarCopy.js +1 -1
  100. package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
  101. package/dist/react/primitive-hooks/useActionBarEdit.js +1 -1
  102. package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
  103. package/dist/react/primitive-hooks/useActionBarFeedback.js +1 -1
  104. package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
  105. package/dist/react/primitive-hooks/useActionBarReload.js +1 -1
  106. package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
  107. package/dist/react/primitive-hooks/useActionBarSpeak.js +1 -1
  108. package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
  109. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +1 -1
  110. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
  111. package/dist/react/primitive-hooks/useBranchPickerNext.js +1 -1
  112. package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
  113. package/dist/react/primitive-hooks/useBranchPickerPrevious.js +1 -1
  114. package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
  115. package/dist/react/primitive-hooks/useComposerAddAttachment.js +1 -1
  116. package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
  117. package/dist/react/primitive-hooks/useComposerCancel.js +1 -1
  118. package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
  119. package/dist/react/primitive-hooks/useComposerDictate.js +1 -1
  120. package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
  121. package/dist/react/primitive-hooks/useComposerSend.js +1 -1
  122. package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
  123. package/dist/react/primitive-hooks/useEditComposerCancel.js +1 -1
  124. package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
  125. package/dist/react/primitive-hooks/useEditComposerSend.js +1 -1
  126. package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
  127. package/dist/react/primitive-hooks/useMessageBranching.js +1 -1
  128. package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
  129. package/dist/react/primitive-hooks/useMessageReload.js +1 -1
  130. package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
  131. package/dist/react/primitive-hooks/useSuggestionTrigger.js +1 -1
  132. package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
  133. package/dist/react/primitive-hooks/useThreadListItemArchive.js +1 -1
  134. package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
  135. package/dist/react/primitive-hooks/useThreadListItemDelete.js +1 -1
  136. package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
  137. package/dist/react/primitive-hooks/useThreadListItemTrigger.js +1 -1
  138. package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
  139. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +1 -1
  140. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
  141. package/dist/react/primitive-hooks/useThreadListLoadMore.js +1 -1
  142. package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
  143. package/dist/react/primitive-hooks/useThreadListNew.js +1 -1
  144. package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
  145. package/dist/react/primitive-hooks/useVoice.js +1 -1
  146. package/dist/react/primitive-hooks/useVoice.js.map +1 -1
  147. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -1
  148. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
  149. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
  150. package/dist/react/primitives/composer/ComposerAttachments.js +1 -1
  151. package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
  152. package/dist/react/primitives/composer/ComposerQueue.js +1 -1
  153. package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
  154. package/dist/react/primitives/generativeUI/GenerativeUI.js +1 -1
  155. package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
  156. package/dist/react/primitives/message/MessageAttachments.js +1 -1
  157. package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
  158. package/dist/react/primitives/message/MessageGroupedParts.js +1 -1
  159. package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
  160. package/dist/react/primitives/message/MessageParts.d.ts +1 -1
  161. package/dist/react/primitives/message/MessageParts.js +1 -1
  162. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  163. package/dist/react/primitives/message/MessageQuote.js +1 -1
  164. package/dist/react/primitives/part/PartMessages.d.ts +12 -10
  165. package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
  166. package/dist/react/primitives/part/PartMessages.js +13 -11
  167. package/dist/react/primitives/part/PartMessages.js.map +1 -1
  168. package/dist/react/primitives/thread/ThreadMessages.js +1 -1
  169. package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
  170. package/dist/react/primitives/thread/ThreadSuggestions.js +1 -1
  171. package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
  172. package/dist/react/primitives/threadList/ThreadListItems.js +1 -1
  173. package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
  174. package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
  175. package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
  176. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
  177. package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
  178. package/dist/react/providers/PartByIndexProvider.js.map +1 -1
  179. package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
  180. package/dist/react/providers/ReadonlyThreadProvider.js +1 -1
  181. package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
  182. package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
  183. package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
  184. package/dist/react/providers/TextMessagePartProvider.js +4 -3
  185. package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
  186. package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
  187. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +7 -0
  188. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  189. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +1 -1
  190. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  191. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +8 -0
  192. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  193. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +29 -1
  194. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  195. package/dist/react/runtimes/RuntimeAdapterProvider.js +1 -1
  196. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +1 -1
  197. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  198. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
  199. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +10 -3
  200. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
  201. package/dist/react/runtimes/createMessageConverter.d.ts +2 -2
  202. package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
  203. package/dist/react/runtimes/createMessageConverter.js.map +1 -1
  204. package/dist/react/runtimes/external-message-converter.d.ts +4 -3
  205. package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
  206. package/dist/react/runtimes/external-message-converter.js +1 -1
  207. package/dist/react/runtimes/external-message-converter.js.map +1 -1
  208. package/dist/react/runtimes/useExternalStoreRuntime.js +1 -1
  209. package/dist/react/runtimes/useExternalStoreSharedOptions.js +1 -1
  210. package/dist/react/runtimes/useLocalRuntime.d.ts +2 -1
  211. package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
  212. package/dist/react/runtimes/useLocalRuntime.js +4 -3
  213. package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
  214. package/dist/react/runtimes/useRemoteThreadListRuntime.js +1 -1
  215. package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  216. package/dist/react/utils/groupParts.d.ts +1 -1
  217. package/dist/react/utils/groupParts.js.map +1 -1
  218. package/dist/runtime/api/attachment-runtime.js.map +1 -1
  219. package/dist/runtime/api/composer-runtime.d.ts +8 -2
  220. package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
  221. package/dist/runtime/api/composer-runtime.js +14 -0
  222. package/dist/runtime/api/composer-runtime.js.map +1 -1
  223. package/dist/runtime/api/message-part-runtime.js.map +1 -1
  224. package/dist/runtime/api/message-runtime.js +1 -1
  225. package/dist/runtime/api/message-runtime.js.map +1 -1
  226. package/dist/runtime/api/thread-list-item-runtime.d.ts +2 -0
  227. package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
  228. package/dist/runtime/api/thread-list-item-runtime.js +6 -0
  229. package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
  230. package/dist/runtime/api/thread-runtime.d.ts +7 -0
  231. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  232. package/dist/runtime/api/thread-runtime.js.map +1 -1
  233. package/dist/runtime/base/base-composer-runtime-core.d.ts +4 -0
  234. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  235. package/dist/runtime/base/base-composer-runtime-core.js +7 -1
  236. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  237. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  238. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +4 -0
  239. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  240. package/dist/runtime/base/default-thread-composer-runtime-core.js +17 -1
  241. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  242. package/dist/runtime/interfaces/composer-runtime-core.d.ts +6 -1
  243. package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
  244. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +1 -0
  245. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
  246. package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -0
  247. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  248. package/dist/runtime/queue/external-thread-queue-adapter.d.ts +20 -0
  249. package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -0
  250. package/dist/runtime/queue/external-thread-queue-adapter.js +0 -0
  251. package/dist/runtime/queue/message-queue.d.ts +20 -0
  252. package/dist/runtime/queue/message-queue.d.ts.map +1 -0
  253. package/dist/runtime/queue/message-queue.js +97 -0
  254. package/dist/runtime/queue/message-queue.js.map +1 -0
  255. package/dist/runtime/utils/message-repository.js.map +1 -1
  256. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  257. package/dist/runtimes/external-store/external-store-adapter.d.ts +5 -1
  258. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  259. package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
  260. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +1 -0
  261. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
  262. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +5 -0
  263. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
  264. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +4 -0
  265. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  266. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +20 -2
  267. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  268. package/dist/runtimes/local/local-runtime-core.js.map +1 -1
  269. package/dist/runtimes/local/local-runtime-options.d.ts +5 -0
  270. package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
  271. package/dist/runtimes/local/local-thread-runtime-core.d.ts +7 -0
  272. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  273. package/dist/runtimes/local/local-thread-runtime-core.js +45 -0
  274. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  275. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +3 -0
  276. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
  277. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +3 -0
  278. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
  279. package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +1 -0
  280. package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
  281. package/dist/runtimes/remote-thread-list/adapter/in-memory.js +3 -0
  282. package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
  283. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
  284. package/dist/runtimes/remote-thread-list/empty-thread-core.js +3 -0
  285. package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
  286. package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
  287. package/dist/runtimes/remote-thread-list/types.d.ts +1 -0
  288. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  289. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
  290. package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
  291. package/dist/store/clients/chain-of-thought-client.js +6 -5
  292. package/dist/store/clients/chain-of-thought-client.js.map +1 -1
  293. package/dist/store/clients/model-context-client.d.ts.map +1 -1
  294. package/dist/store/clients/model-context-client.js +6 -5
  295. package/dist/store/clients/model-context-client.js.map +1 -1
  296. package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
  297. package/dist/store/clients/no-op-composer-client.js +4 -3
  298. package/dist/store/clients/no-op-composer-client.js.map +1 -1
  299. package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
  300. package/dist/store/clients/runtime-adapter.js +7 -6
  301. package/dist/store/clients/runtime-adapter.js.map +1 -1
  302. package/dist/store/clients/suggestions.d.ts.map +1 -1
  303. package/dist/store/clients/suggestions.js +7 -6
  304. package/dist/store/clients/suggestions.js.map +1 -1
  305. package/dist/store/clients/thread-message-client.d.ts.map +1 -1
  306. package/dist/store/clients/thread-message-client.js +13 -12
  307. package/dist/store/clients/thread-message-client.js.map +1 -1
  308. package/dist/store/index.d.ts +1 -1
  309. package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
  310. package/dist/store/runtime-clients/attachment-runtime-client.js +3 -3
  311. package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
  312. package/dist/store/runtime-clients/composer-runtime-client.d.ts +12 -5
  313. package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
  314. package/dist/store/runtime-clients/composer-runtime-client.js +32 -16
  315. package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
  316. package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
  317. package/dist/store/runtime-clients/message-part-runtime-client.js +3 -3
  318. package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
  319. package/dist/store/runtime-clients/message-runtime-client.d.ts +6 -3
  320. package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
  321. package/dist/store/runtime-clients/message-runtime-client.js +17 -16
  322. package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
  323. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
  324. package/dist/store/runtime-clients/thread-list-item-runtime-client.js +9 -7
  325. package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
  326. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
  327. package/dist/store/runtime-clients/thread-list-runtime-client.js +11 -10
  328. package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
  329. package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
  330. package/dist/store/runtime-clients/thread-runtime-client.js +15 -14
  331. package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
  332. package/dist/store/runtime-clients/useSubscribable.d.ts +7 -0
  333. package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -0
  334. package/dist/store/runtime-clients/useSubscribable.js +16 -0
  335. package/dist/store/runtime-clients/useSubscribable.js.map +1 -0
  336. package/dist/store/scope-registration.d.ts +1 -1
  337. package/dist/store/scopes/composer.d.ts +1 -1
  338. package/dist/store/scopes/queue-item.d.ts +2 -1
  339. package/dist/store/scopes/queue-item.d.ts.map +1 -1
  340. package/dist/store/scopes/queue-item.js +6 -0
  341. package/dist/store/scopes/queue-item.js.map +1 -0
  342. package/dist/store/scopes/thread-list-item.d.ts +1 -0
  343. package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
  344. package/dist/store/scopes/thread.d.ts +1 -1
  345. package/dist/store/scopes/threads.d.ts +1 -1
  346. package/dist/types/message.d.ts +2 -1
  347. package/dist/types/message.d.ts.map +1 -1
  348. package/dist/types/message.js.map +1 -1
  349. package/dist/utils/composite-context-provider.d.ts +1 -1
  350. package/dist/utils/composite-context-provider.js +3 -1
  351. package/dist/utils/composite-context-provider.js.map +1 -1
  352. package/dist/utils/json/is-json.js.map +1 -1
  353. package/dist/utils/text.js.map +1 -1
  354. package/package.json +15 -11
  355. package/src/adapters/attachment.ts +24 -4
  356. package/src/index.ts +8 -0
  357. package/src/model-context/tool.ts +1 -1
  358. package/src/model-context/types.ts +21 -3
  359. package/src/react/RuntimeAdapter.ts +6 -4
  360. package/src/react/adapters/LocalStorageThreadListAdapter.tsx +15 -2
  361. package/src/react/client/DataRenderers.ts +48 -42
  362. package/src/react/client/Interactables.ts +263 -267
  363. package/src/react/client/Tools.ts +123 -115
  364. package/src/react/index.ts +16 -3
  365. package/src/react/model-context/define-mcp-toolkit.ts +16 -0
  366. package/src/react/model-context/define-toolkit.test.ts +101 -6
  367. package/src/react/model-context/define-toolkit.ts +35 -18
  368. package/src/react/model-context/external-tool.ts +16 -0
  369. package/src/react/model-context/human-tool.ts +32 -0
  370. package/src/react/model-context/makeAssistantTool.ts +8 -0
  371. package/src/react/model-context/makeAssistantToolUI.ts +8 -0
  372. package/src/react/model-context/provider-tool.ts +30 -0
  373. package/src/react/model-context/stub-tool.ts +14 -0
  374. package/src/react/model-context/toolbox.test.ts +182 -0
  375. package/src/react/model-context/toolbox.ts +191 -23
  376. package/src/react/model-context/useAssistantTool.ts +28 -8
  377. package/src/react/model-context/useAssistantToolUI.ts +13 -4
  378. package/src/react/model-context/useAuiToolOverrides.ts +38 -0
  379. package/src/react/primitives/message/MessageGroupedParts.tsx +1 -1
  380. package/src/react/primitives/part/PartMessages.tsx +12 -10
  381. package/src/react/providers/TextMessagePartProvider.tsx +31 -32
  382. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +43 -0
  383. package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +9 -0
  384. package/src/react/runtimes/createMessageConverter.ts +2 -1
  385. package/src/react/runtimes/external-message-converter.ts +5 -3
  386. package/src/react/runtimes/useLocalRuntime.ts +2 -0
  387. package/src/runtime/api/composer-runtime.ts +26 -0
  388. package/src/runtime/api/thread-list-item-runtime.ts +15 -0
  389. package/src/runtime/base/base-composer-runtime-core.ts +11 -0
  390. package/src/runtime/base/default-thread-composer-runtime-core.ts +22 -0
  391. package/src/runtime/interfaces/composer-runtime-core.ts +7 -0
  392. package/src/runtime/interfaces/thread-list-runtime-core.ts +4 -0
  393. package/src/runtime/interfaces/thread-runtime-core.ts +5 -0
  394. package/src/runtime/queue/external-thread-queue-adapter.ts +14 -0
  395. package/src/runtime/queue/message-queue.ts +128 -0
  396. package/src/runtimes/external-store/external-store-adapter.ts +10 -0
  397. package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +13 -0
  398. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +31 -2
  399. package/src/runtimes/local/local-runtime-options.ts +6 -0
  400. package/src/runtimes/local/local-thread-runtime-core.ts +70 -0
  401. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +4 -0
  402. package/src/runtimes/remote-thread-list/adapter/in-memory.ts +4 -0
  403. package/src/runtimes/remote-thread-list/empty-thread-core.ts +4 -0
  404. package/src/runtimes/remote-thread-list/types.ts +4 -0
  405. package/src/store/clients/chain-of-thought-client.ts +24 -25
  406. package/src/store/clients/model-context-client.test.ts +87 -2
  407. package/src/store/clients/model-context-client.ts +22 -19
  408. package/src/store/clients/no-op-composer-client.ts +69 -66
  409. package/src/store/clients/runtime-adapter.ts +9 -6
  410. package/src/store/clients/suggestions.ts +41 -40
  411. package/src/store/clients/thread-message-client.ts +127 -132
  412. package/src/store/runtime-clients/attachment-runtime-client.ts +7 -3
  413. package/src/store/runtime-clients/composer-runtime-client.ts +142 -113
  414. package/src/store/runtime-clients/message-part-runtime-client.ts +16 -14
  415. package/src/store/runtime-clients/message-runtime-client.ts +124 -122
  416. package/src/store/runtime-clients/thread-list-item-runtime-client.ts +44 -44
  417. package/src/store/runtime-clients/thread-list-runtime-client.ts +83 -80
  418. package/src/store/runtime-clients/thread-runtime-client.ts +113 -119
  419. package/src/store/runtime-clients/{tap-subscribable.ts → useSubscribable.ts} +4 -4
  420. package/src/store/scopes/queue-item.ts +2 -0
  421. package/src/store/scopes/thread-list-item.ts +1 -0
  422. package/src/tests/RemoteThreadListThreadListRuntimeCore-custom-metadata.test.ts +69 -1
  423. package/src/tests/attachment-adapters.test.ts +86 -0
  424. package/src/tests/external-store-thread-runtime-core.test.ts +125 -0
  425. package/src/tests/message-queue.test.ts +168 -0
  426. package/src/tests/thread-list-runtime-getLoadThreadsPromise.test.ts +1 -0
  427. package/src/types/message.ts +2 -0
  428. package/src/utils/composite-context-provider.ts +3 -1
  429. package/dist/react/model-context/hitl.d.ts +0 -19
  430. package/dist/react/model-context/hitl.d.ts.map +0 -1
  431. package/dist/react/model-context/hitl.js +0 -22
  432. package/dist/react/model-context/hitl.js.map +0 -1
  433. package/dist/store/runtime-clients/tap-subscribable.d.ts +0 -7
  434. package/dist/store/runtime-clients/tap-subscribable.d.ts.map +0 -1
  435. package/dist/store/runtime-clients/tap-subscribable.js +0 -16
  436. package/dist/store/runtime-clients/tap-subscribable.js.map +0 -1
  437. package/src/react/model-context/hitl.ts +0 -22
@@ -1,12 +1,13 @@
1
- import { resource, tapMemo, tapState } from "@assistant-ui/tap";
1
+ import { useMemo, useState } from "@assistant-ui/tap/react-shim";
2
+ import { resource } from "@assistant-ui/tap";
2
3
  //#region src/store/clients/chain-of-thought-client.ts
3
4
  const COMPLETE_STATUS = Object.freeze({ type: "complete" });
4
- const ChainOfThoughtClient = resource(({ parts, getMessagePart }) => {
5
- const [collapsed, setCollapsed] = tapState(true);
6
- const status = tapMemo(() => {
5
+ const ChainOfThoughtClient = resource(function ChainOfThoughtClient({ parts, getMessagePart }) {
6
+ const [collapsed, setCollapsed] = useState(true);
7
+ const status = useMemo(() => {
7
8
  return parts[parts.length - 1]?.status ?? COMPLETE_STATUS;
8
9
  }, [parts]);
9
- const state = tapMemo(() => ({
10
+ const state = useMemo(() => ({
10
11
  parts,
11
12
  collapsed,
12
13
  status
@@ -1 +1 @@
1
- {"version":3,"file":"chain-of-thought-client.js","names":[],"sources":["../../../src/store/clients/chain-of-thought-client.ts"],"sourcesContent":["import { resource, tapMemo, tapState } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type {\n ChainOfThoughtState,\n ChainOfThoughtPart,\n} from \"../scopes/chain-of-thought\";\nimport type { MessagePartStatus } from \"../../types/message\";\nimport type { PartMethods } from \"../scopes/part\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const ChainOfThoughtClient = resource(\n ({\n parts,\n getMessagePart,\n }: {\n parts: readonly ChainOfThoughtPart[];\n getMessagePart: (selector: { index: number }) => PartMethods;\n }): ClientOutput<\"chainOfThought\"> => {\n const [collapsed, setCollapsed] = tapState(true);\n\n const status = tapMemo(() => {\n const lastPart = parts[parts.length - 1];\n return lastPart?.status ?? COMPLETE_STATUS;\n }, [parts]);\n\n const state = tapMemo<ChainOfThoughtState>(\n () => ({ parts, collapsed, status }),\n [parts, collapsed, status],\n );\n\n return {\n getState: () => state,\n setCollapsed,\n part: getMessagePart,\n };\n },\n);\n"],"mappings":";;AASA,MAAM,kBAAqC,OAAO,OAAO,EACvD,MAAM,WACR,CAAC;AAED,MAAa,uBAAuB,UACjC,EACC,OACA,qBAIoC;CACpC,MAAM,CAAC,WAAW,gBAAgB,SAAS,IAAI;CAE/C,MAAM,SAAS,cAAc;EAE3B,OADiB,MAAM,MAAM,SAAS,IACrB,UAAU;CAC7B,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,QAAQ,eACL;EAAE;EAAO;EAAW;CAAO,IAClC;EAAC;EAAO;EAAW;CAAM,CAC3B;CAEA,OAAO;EACL,gBAAgB;EAChB;EACA,MAAM;CACR;AACF,CACF"}
1
+ {"version":3,"file":"chain-of-thought-client.js","names":[],"sources":["../../../src/store/clients/chain-of-thought-client.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type {\n ChainOfThoughtState,\n ChainOfThoughtPart,\n} from \"../scopes/chain-of-thought\";\nimport type { MessagePartStatus } from \"../../types/message\";\nimport type { PartMethods } from \"../scopes/part\";\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const ChainOfThoughtClient = resource(function ChainOfThoughtClient({\n parts,\n getMessagePart,\n}: {\n parts: readonly ChainOfThoughtPart[];\n getMessagePart: (selector: { index: number }) => PartMethods;\n}): ClientOutput<\"chainOfThought\"> {\n const [collapsed, setCollapsed] = useState(true);\n\n const status = useMemo(() => {\n const lastPart = parts[parts.length - 1];\n return lastPart?.status ?? COMPLETE_STATUS;\n }, [parts]);\n\n const state = useMemo<ChainOfThoughtState>(\n () => ({ parts, collapsed, status }),\n [parts, collapsed, status],\n );\n\n return {\n getState: () => state,\n setCollapsed,\n part: getMessagePart,\n };\n});\n"],"mappings":";;;AAUA,MAAM,kBAAqC,OAAO,OAAO,EACvD,MAAM,WACR,CAAC;AAED,MAAa,uBAAuB,SAAS,SAAS,qBAAqB,EACzE,OACA,kBAIiC;CACjC,MAAM,CAAC,WAAW,gBAAgB,SAAS,IAAI;CAE/C,MAAM,SAAS,cAAc;EAE3B,OADiB,MAAM,MAAM,SAAS,EACvB,EAAE,UAAU;CAC7B,GAAG,CAAC,KAAK,CAAC;CAEV,MAAM,QAAQ,eACL;EAAE;EAAO;EAAW;CAAO,IAClC;EAAC;EAAO;EAAW;CAAM,CAC3B;CAEA,OAAO;EACL,gBAAgB;EAChB;EACA,MAAM;CACR;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"model-context-client.d.ts","names":[],"sources":["../../../src/store/clients/model-context-client.ts"],"mappings":";;;cA8Ba,YAAA,oCAAY,eAAA,CAAA,YAAA"}
1
+ {"version":3,"file":"model-context-client.d.ts","names":[],"sources":["../../../src/store/clients/model-context-client.ts"],"mappings":";;;cA+Ba,YAAA,oCAAY,eAAA,CAAA,YAAA"}
@@ -1,5 +1,6 @@
1
1
  import { CompositeContextProvider } from "../../utils/composite-context-provider.js";
2
- import { resource, tapEffect, tapMemo, tapState } from "@assistant-ui/tap";
2
+ import { useEffect, useMemo, useState } from "@assistant-ui/tap/react-shim";
3
+ import { resource } from "@assistant-ui/tap";
3
4
  //#region src/store/clients/model-context-client.ts
4
5
  const EMPTY_TOOL_NAMES = [];
5
6
  const INITIAL_STATE = {
@@ -18,10 +19,10 @@ const deriveState = (composite, prev) => {
18
19
  toolNames
19
20
  };
20
21
  };
21
- const ModelContext = resource(() => {
22
- const composite = tapMemo(() => new CompositeContextProvider(), []);
23
- const [state, setState] = tapState(() => deriveState(composite, INITIAL_STATE));
24
- tapEffect(() => {
22
+ const ModelContext = resource(function ModelContext() {
23
+ const composite = useMemo(() => new CompositeContextProvider(), []);
24
+ const [state, setState] = useState(() => deriveState(composite, INITIAL_STATE));
25
+ useEffect(() => {
25
26
  setState((prev) => deriveState(composite, prev));
26
27
  return composite.subscribe(() => {
27
28
  setState((prev) => deriveState(composite, prev));
@@ -1 +1 @@
1
- {"version":3,"file":"model-context-client.js","names":[],"sources":["../../../src/store/clients/model-context-client.ts"],"sourcesContent":["import { resource, tapEffect, tapMemo, tapState } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { CompositeContextProvider } from \"../../utils/composite-context-provider\";\nimport type { ModelContextState } from \"../scopes/model-context\";\n\nconst EMPTY_TOOL_NAMES: readonly string[] = [];\n\nconst INITIAL_STATE: ModelContextState = {\n modelName: undefined,\n toolNames: EMPTY_TOOL_NAMES,\n};\n\nconst toolNamesEqual = (a: readonly string[], b: readonly string[]): boolean =>\n a === b || (a.length === b.length && a.every((v, i) => v === b[i]));\n\nconst deriveState = (\n composite: CompositeContextProvider,\n prev: ModelContextState,\n): ModelContextState => {\n const ctx = composite.getModelContext();\n const modelName = ctx.config?.modelName;\n const keys = ctx.tools ? Object.keys(ctx.tools).sort() : EMPTY_TOOL_NAMES;\n const toolNames = keys.length ? keys : EMPTY_TOOL_NAMES;\n\n if (modelName === prev.modelName && toolNamesEqual(toolNames, prev.toolNames))\n return prev;\n\n return { modelName, toolNames };\n};\n\nexport const ModelContext = resource((): ClientOutput<\"modelContext\"> => {\n const composite = tapMemo(() => new CompositeContextProvider(), []);\n const [state, setState] = tapState<ModelContextState>(() =>\n deriveState(composite, INITIAL_STATE),\n );\n\n tapEffect(() => {\n setState((prev) => deriveState(composite, prev));\n return composite.subscribe(() => {\n setState((prev) => deriveState(composite, prev));\n });\n }, [composite]);\n\n return {\n getState: () => deriveState(composite, state),\n getModelContext: () => composite.getModelContext(),\n subscribe: (callback) => composite.subscribe(callback),\n register: (provider) => composite.registerModelContextProvider(provider),\n };\n});\n"],"mappings":";;;AAKA,MAAM,mBAAsC,CAAC;AAE7C,MAAM,gBAAmC;CACvC,WAAW,KAAA;CACX,WAAW;AACb;AAEA,MAAM,kBAAkB,GAAsB,MAC5C,MAAM,KAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,MAAM,EAAE,EAAE;AAEnE,MAAM,eACJ,WACA,SACsB;CACtB,MAAM,MAAM,UAAU,gBAAgB;CACtC,MAAM,YAAY,IAAI,QAAQ;CAC9B,MAAM,OAAO,IAAI,QAAQ,OAAO,KAAK,IAAI,KAAK,EAAE,KAAK,IAAI;CACzD,MAAM,YAAY,KAAK,SAAS,OAAO;CAEvC,IAAI,cAAc,KAAK,aAAa,eAAe,WAAW,KAAK,SAAS,GAC1E,OAAO;CAET,OAAO;EAAE;EAAW;CAAU;AAChC;AAEA,MAAa,eAAe,eAA6C;CACvE,MAAM,YAAY,cAAc,IAAI,yBAAyB,GAAG,CAAC,CAAC;CAClE,MAAM,CAAC,OAAO,YAAY,eACxB,YAAY,WAAW,aAAa,CACtC;CAEA,gBAAgB;EACd,UAAU,SAAS,YAAY,WAAW,IAAI,CAAC;EAC/C,OAAO,UAAU,gBAAgB;GAC/B,UAAU,SAAS,YAAY,WAAW,IAAI,CAAC;EACjD,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;EACL,gBAAgB,YAAY,WAAW,KAAK;EAC5C,uBAAuB,UAAU,gBAAgB;EACjD,YAAY,aAAa,UAAU,UAAU,QAAQ;EACrD,WAAW,aAAa,UAAU,6BAA6B,QAAQ;CACzE;AACF,CAAC"}
1
+ {"version":3,"file":"model-context-client.js","names":[],"sources":["../../../src/store/clients/model-context-client.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { CompositeContextProvider } from \"../../utils/composite-context-provider\";\nimport type { ModelContextState } from \"../scopes/model-context\";\n\nconst EMPTY_TOOL_NAMES: readonly string[] = [];\n\nconst INITIAL_STATE: ModelContextState = {\n modelName: undefined,\n toolNames: EMPTY_TOOL_NAMES,\n};\n\nconst toolNamesEqual = (a: readonly string[], b: readonly string[]): boolean =>\n a === b || (a.length === b.length && a.every((v, i) => v === b[i]));\n\nconst deriveState = (\n composite: CompositeContextProvider,\n prev: ModelContextState,\n): ModelContextState => {\n const ctx = composite.getModelContext();\n const modelName = ctx.config?.modelName;\n const keys = ctx.tools ? Object.keys(ctx.tools).sort() : EMPTY_TOOL_NAMES;\n const toolNames = keys.length ? keys : EMPTY_TOOL_NAMES;\n\n if (modelName === prev.modelName && toolNamesEqual(toolNames, prev.toolNames))\n return prev;\n\n return { modelName, toolNames };\n};\n\nexport const ModelContext = resource(\n function ModelContext(): ClientOutput<\"modelContext\"> {\n const composite = useMemo(() => new CompositeContextProvider(), []);\n const [state, setState] = useState<ModelContextState>(() =>\n deriveState(composite, INITIAL_STATE),\n );\n\n useEffect(() => {\n setState((prev) => deriveState(composite, prev));\n return composite.subscribe(() => {\n setState((prev) => deriveState(composite, prev));\n });\n }, [composite]);\n\n return {\n getState: () => deriveState(composite, state),\n getModelContext: () => composite.getModelContext(),\n subscribe: (callback) => composite.subscribe(callback),\n register: (provider) => composite.registerModelContextProvider(provider),\n };\n },\n);\n"],"mappings":";;;;AAMA,MAAM,mBAAsC,CAAC;AAE7C,MAAM,gBAAmC;CACvC,WAAW,KAAA;CACX,WAAW;AACb;AAEA,MAAM,kBAAkB,GAAsB,MAC5C,MAAM,KAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,MAAM,EAAE,EAAE;AAEnE,MAAM,eACJ,WACA,SACsB;CACtB,MAAM,MAAM,UAAU,gBAAgB;CACtC,MAAM,YAAY,IAAI,QAAQ;CAC9B,MAAM,OAAO,IAAI,QAAQ,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI;CACzD,MAAM,YAAY,KAAK,SAAS,OAAO;CAEvC,IAAI,cAAc,KAAK,aAAa,eAAe,WAAW,KAAK,SAAS,GAC1E,OAAO;CAET,OAAO;EAAE;EAAW;CAAU;AAChC;AAEA,MAAa,eAAe,SAC1B,SAAS,eAA6C;CACpD,MAAM,YAAY,cAAc,IAAI,yBAAyB,GAAG,CAAC,CAAC;CAClE,MAAM,CAAC,OAAO,YAAY,eACxB,YAAY,WAAW,aAAa,CACtC;CAEA,gBAAgB;EACd,UAAU,SAAS,YAAY,WAAW,IAAI,CAAC;EAC/C,OAAO,UAAU,gBAAgB;GAC/B,UAAU,SAAS,YAAY,WAAW,IAAI,CAAC;EACjD,CAAC;CACH,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;EACL,gBAAgB,YAAY,WAAW,KAAK;EAC5C,uBAAuB,UAAU,gBAAgB;EACjD,YAAY,aAAa,UAAU,UAAU,QAAQ;EACrD,WAAW,aAAa,UAAU,6BAA6B,QAAQ;CACzE;AACF,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"no-op-composer-client.d.ts","names":[],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"mappings":";;;cAIa,kBAAA,GAAkB,KAAA;;kDAkE9B,YAAA"}
1
+ {"version":3,"file":"no-op-composer-client.d.ts","names":[],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"mappings":";;;cAKa,kBAAA,GAAkB,KAAA;;kDAoE7B,YAAA"}
@@ -1,7 +1,8 @@
1
- import { resource, tapMemo } from "@assistant-ui/tap";
1
+ import { useMemo } from "@assistant-ui/tap/react-shim";
2
+ import { resource } from "@assistant-ui/tap";
2
3
  //#region src/store/clients/no-op-composer-client.ts
3
- const NoOpComposerClient = resource(({ type }) => {
4
- const state = tapMemo(() => {
4
+ const NoOpComposerClient = resource(function NoOpComposerClient({ type }) {
5
+ const state = useMemo(() => {
5
6
  return {
6
7
  isEditing: false,
7
8
  isEmpty: true,
@@ -1 +1 @@
1
- {"version":3,"file":"no-op-composer-client.js","names":[],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"sourcesContent":["import { resource, tapMemo } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { ComposerState } from \"../scopes/composer\";\n\nexport const NoOpComposerClient = resource(\n ({ type }: { type: \"edit\" | \"thread\" }): ClientOutput<\"composer\"> => {\n const state = tapMemo<ComposerState>(() => {\n return {\n isEditing: false,\n isEmpty: true,\n text: \"\",\n attachmentAccept: \"*\",\n attachments: [],\n role: \"user\",\n runConfig: {},\n canCancel: false,\n canSend: false,\n type: type,\n dictation: undefined,\n quote: undefined,\n queue: [],\n };\n }, [type]);\n\n return {\n getState: () => state,\n setText: () => {\n throw new Error(\"Not supported\");\n },\n setRole: () => {\n throw new Error(\"Not supported\");\n },\n setRunConfig: () => {\n throw new Error(\"Not supported\");\n },\n addAttachment: () => {\n throw new Error(\"Not supported\");\n },\n clearAttachments: () => {\n throw new Error(\"Not supported\");\n },\n attachment: () => {\n throw new Error(\"Not supported\");\n },\n reset: () => {\n throw new Error(\"Not supported\");\n },\n send: () => {\n throw new Error(\"Not supported\");\n },\n cancel: () => {\n throw new Error(\"Not supported\");\n },\n startDictation: () => {\n throw new Error(\"Not supported\");\n },\n stopDictation: () => {\n throw new Error(\"Not supported\");\n },\n beginEdit: () => {\n throw new Error(\"Not supported\");\n },\n setQuote: () => {\n throw new Error(\"Not supported\");\n },\n queueItem: () => {\n throw new Error(\"Not supported\");\n },\n };\n },\n);\n"],"mappings":";;AAIA,MAAa,qBAAqB,UAC/B,EAAE,WAAkE;CACnE,MAAM,QAAQ,cAA6B;EACzC,OAAO;GACL,WAAW;GACX,SAAS;GACT,MAAM;GACN,kBAAkB;GAClB,aAAa,CAAC;GACd,MAAM;GACN,WAAW,CAAC;GACZ,WAAW;GACX,SAAS;GACH;GACN,WAAW,KAAA;GACX,OAAO,KAAA;GACP,OAAO,CAAC;EACV;CACF,GAAG,CAAC,IAAI,CAAC;CAET,OAAO;EACL,gBAAgB;EAChB,eAAe;GACb,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,eAAe;GACb,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,oBAAoB;GAClB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,wBAAwB;GACtB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,kBAAkB;GAChB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,aAAa;GACX,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,YAAY;GACV,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,gBAAgB;GACd,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CACF"}
1
+ {"version":3,"file":"no-op-composer-client.js","names":[],"sources":["../../../src/store/clients/no-op-composer-client.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { ComposerState } from \"../scopes/composer\";\n\nexport const NoOpComposerClient = resource(function NoOpComposerClient({\n type,\n}: {\n type: \"edit\" | \"thread\";\n}): ClientOutput<\"composer\"> {\n const state = useMemo<ComposerState>(() => {\n return {\n isEditing: false,\n isEmpty: true,\n text: \"\",\n attachmentAccept: \"*\",\n attachments: [],\n role: \"user\",\n runConfig: {},\n canCancel: false,\n canSend: false,\n type: type,\n dictation: undefined,\n quote: undefined,\n queue: [],\n };\n }, [type]);\n\n return {\n getState: () => state,\n setText: () => {\n throw new Error(\"Not supported\");\n },\n setRole: () => {\n throw new Error(\"Not supported\");\n },\n setRunConfig: () => {\n throw new Error(\"Not supported\");\n },\n addAttachment: () => {\n throw new Error(\"Not supported\");\n },\n clearAttachments: () => {\n throw new Error(\"Not supported\");\n },\n attachment: () => {\n throw new Error(\"Not supported\");\n },\n reset: () => {\n throw new Error(\"Not supported\");\n },\n send: () => {\n throw new Error(\"Not supported\");\n },\n cancel: () => {\n throw new Error(\"Not supported\");\n },\n startDictation: () => {\n throw new Error(\"Not supported\");\n },\n stopDictation: () => {\n throw new Error(\"Not supported\");\n },\n beginEdit: () => {\n throw new Error(\"Not supported\");\n },\n setQuote: () => {\n throw new Error(\"Not supported\");\n },\n queueItem: () => {\n throw new Error(\"Not supported\");\n },\n };\n});\n"],"mappings":";;;AAKA,MAAa,qBAAqB,SAAS,SAAS,mBAAmB,EACrE,QAG2B;CAC3B,MAAM,QAAQ,cAA6B;EACzC,OAAO;GACL,WAAW;GACX,SAAS;GACT,MAAM;GACN,kBAAkB;GAClB,aAAa,CAAC;GACd,MAAM;GACN,WAAW,CAAC;GACZ,WAAW;GACX,SAAS;GACH;GACN,WAAW,KAAA;GACX,OAAO,KAAA;GACP,OAAO,CAAC;EACV;CACF,GAAG,CAAC,IAAI,CAAC;CAET,OAAO;EACL,gBAAgB;EAChB,eAAe;GACb,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,eAAe;GACb,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,oBAAoB;GAClB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,wBAAwB;GACtB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,kBAAkB;GAChB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,aAAa;GACX,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,YAAY;GACV,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,gBAAgB;GACd,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-adapter.d.ts","names":[],"sources":["../../../src/store/clients/runtime-adapter.ts"],"mappings":";;;;cAYa,sBAAA,GAAsB,KAAA,EAAA,gBAAA,iCAAA,eAAA,+BAAA,YAAA,aAAA,gBAAA;AAAA,cAiBtB,iCAAA,GACX,MAAA,EAAQ,YAAA,EACR,MAAA,EAAQ,eAAe"}
1
+ {"version":3,"file":"runtime-adapter.d.ts","names":[],"sources":["../../../src/store/clients/runtime-adapter.ts"],"mappings":";;;;cAaa,sBAAA,GAAsB,KAAA,EAAA,gBAAA,iCAAA,eAAA,+BAAA,YAAA,aAAA,gBAAA;AAAA,cAmBtB,iCAAA,GACX,MAAA,EAAQ,YAAA,EACR,MAAA,EAAQ,eAAe"}
@@ -1,15 +1,16 @@
1
1
  import { ThreadListClient } from "../runtime-clients/thread-list-runtime-client.js";
2
2
  import { ModelContext } from "./model-context-client.js";
3
3
  import { Suggestions } from "./suggestions.js";
4
- import { Derived, tapAssistantClientRef } from "@assistant-ui/store";
5
- import { resource, tapEffect, tapResource } from "@assistant-ui/tap";
4
+ import { useEffect } from "@assistant-ui/tap/react-shim";
5
+ import { Derived, useAssistantClientRef } from "@assistant-ui/store";
6
+ import { resource, useResource } from "@assistant-ui/tap";
6
7
  //#region src/store/clients/runtime-adapter.ts
7
- const RuntimeAdapterResource = resource((runtime) => {
8
- const clientRef = tapAssistantClientRef();
9
- tapEffect(() => {
8
+ const RuntimeAdapterResource = resource(function RuntimeAdapterResource(runtime) {
9
+ const clientRef = useAssistantClientRef();
10
+ useEffect(() => {
10
11
  return runtime.registerModelContextProvider(clientRef.current.modelContext());
11
12
  }, [runtime, clientRef]);
12
- return tapResource(ThreadListClient({
13
+ return useResource(ThreadListClient({
13
14
  runtime: runtime.threads,
14
15
  __internal_assistantRuntime: runtime
15
16
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-adapter.js","names":[],"sources":["../../../src/store/clients/runtime-adapter.ts"],"sourcesContent":["import { resource, tapEffect, tapResource } from \"@assistant-ui/tap\";\nimport type { AssistantRuntime } from \"../../runtime/api/assistant-runtime\";\nimport { ThreadListClient } from \"../runtime-clients/thread-list-runtime-client\";\nimport {\n tapAssistantClientRef,\n Derived,\n type ScopesConfig,\n type AssistantClient,\n} from \"@assistant-ui/store\";\nimport { ModelContext } from \"./model-context-client\";\nimport { Suggestions } from \"./suggestions\";\n\nexport const RuntimeAdapterResource = resource((runtime: AssistantRuntime) => {\n const clientRef = tapAssistantClientRef();\n\n tapEffect(() => {\n return runtime.registerModelContextProvider(\n clientRef.current!.modelContext(),\n );\n }, [runtime, clientRef]);\n\n return tapResource(\n ThreadListClient({\n runtime: runtime.threads,\n __internal_assistantRuntime: runtime,\n }),\n );\n});\n\nexport const baseRuntimeAdapterTransformScopes = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n): void => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n};\n"],"mappings":";;;;;;AAYA,MAAa,yBAAyB,UAAU,YAA8B;CAC5E,MAAM,YAAY,sBAAsB;CAExC,gBAAgB;EACd,OAAO,QAAQ,6BACb,UAAU,QAAS,aAAa,CAClC;CACF,GAAG,CAAC,SAAS,SAAS,CAAC;CAEvB,OAAO,YACL,iBAAiB;EACf,SAAS,QAAQ;EACjB,6BAA6B;CAC/B,CAAC,CACH;AACF,CAAC;AAED,MAAa,qCACX,QACA,WACS;CACT,OAAO,WAAW,QAAQ;EACxB,QAAQ;EACR,OAAO,EAAE,MAAM,OAAO;EACtB,MAAM,QAAQ,IAAI,QAAQ,EAAE,OAAO,MAAM;CAC3C,CAAC;CACD,OAAO,mBAAmB,QAAQ;EAChC,QAAQ;EACR,OAAO,EAAE,MAAM,OAAO;EACtB,MAAM,QAAQ,IAAI,QAAQ,EAAE,KAAK,MAAM;CACzC,CAAC;CACD,OAAO,aAAa,QAAQ;EAC1B,QAAQ;EACR,OAAO,CAAC;EACR,MAAM,QAAQ,IAAI,QAAQ,EAAE,OAAO,MAAM,EAAE,SAAS;CACtD,CAAC;CAED,IAAI,CAAC,OAAO,gBAAgB,OAAO,aAAa,WAAW,MACzD,OAAO,eAAe,aAAa;CAErC,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,WAAW,MACvD,OAAO,cAAc,YAAY;AAErC"}
1
+ {"version":3,"file":"runtime-adapter.js","names":[],"sources":["../../../src/store/clients/runtime-adapter.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useResource, resource } from \"@assistant-ui/tap\";\nimport type { AssistantRuntime } from \"../../runtime/api/assistant-runtime\";\nimport { ThreadListClient } from \"../runtime-clients/thread-list-runtime-client\";\nimport {\n useAssistantClientRef,\n Derived,\n type ScopesConfig,\n type AssistantClient,\n} from \"@assistant-ui/store\";\nimport { ModelContext } from \"./model-context-client\";\nimport { Suggestions } from \"./suggestions\";\n\nexport const RuntimeAdapterResource = resource(function RuntimeAdapterResource(\n runtime: AssistantRuntime,\n) {\n const clientRef = useAssistantClientRef();\n\n useEffect(() => {\n return runtime.registerModelContextProvider(\n clientRef.current!.modelContext(),\n );\n }, [runtime, clientRef]);\n\n return useResource(\n ThreadListClient({\n runtime: runtime.threads,\n __internal_assistantRuntime: runtime,\n }),\n );\n});\n\nexport const baseRuntimeAdapterTransformScopes = (\n scopes: ScopesConfig,\n parent: AssistantClient,\n): void => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n};\n"],"mappings":";;;;;;;AAaA,MAAa,yBAAyB,SAAS,SAAS,uBACtD,SACA;CACA,MAAM,YAAY,sBAAsB;CAExC,gBAAgB;EACd,OAAO,QAAQ,6BACb,UAAU,QAAS,aAAa,CAClC;CACF,GAAG,CAAC,SAAS,SAAS,CAAC;CAEvB,OAAO,YACL,iBAAiB;EACf,SAAS,QAAQ;EACjB,6BAA6B;CAC/B,CAAC,CACH;AACF,CAAC;AAED,MAAa,qCACX,QACA,WACS;CACT,OAAO,WAAW,QAAQ;EACxB,QAAQ;EACR,OAAO,EAAE,MAAM,OAAO;EACtB,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,OAAO,MAAM;CAC3C,CAAC;CACD,OAAO,mBAAmB,QAAQ;EAChC,QAAQ;EACR,OAAO,EAAE,MAAM,OAAO;EACtB,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,KAAK,MAAM;CACzC,CAAC;CACD,OAAO,aAAa,QAAQ;EAC1B,QAAQ;EACR,OAAO,CAAC;EACR,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS;CACtD,CAAC;CAED,IAAI,CAAC,OAAO,gBAAgB,OAAO,aAAa,WAAW,MACzD,OAAO,eAAe,aAAa;CAErC,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,WAAW,MACvD,OAAO,cAAc,YAAY;AAErC"}
@@ -1 +1 @@
1
- {"version":3,"file":"suggestions.d.ts","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"mappings":";;;KAMY,gBAAA;EAEN,KAAA;EAAe,KAAA;EAAe,MAAA;AAAA;AAAA,cAkDvB,WAAA;EAAA,gCACqB,eAAA,CAC9B,YAAA;EAAA,CAIA,WAAA,EAAa,gBAAA,iCACgB,eAAA,CAC7B,YAAA,iBACA,gBAAA;AAAA"}
1
+ {"version":3,"file":"suggestions.d.ts","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"mappings":";;;KAOY,gBAAA;EAEN,KAAA;EAAe,KAAA;EAAe,MAAA;AAAA;AAAA,cAkDvB,WAAA;EAAA,gCACqB,eAAA,CAC9B,YAAA;EAAA,CAIA,WAAA,EAAa,gBAAA,iCACgB,eAAA,CAC7B,YAAA,iBACA,gBAAA;AAAA"}
@@ -1,11 +1,12 @@
1
- import { tapClientLookup } from "@assistant-ui/store";
2
- import { resource, tapState, withKey } from "@assistant-ui/tap";
1
+ import { useState } from "@assistant-ui/tap/react-shim";
2
+ import { useClientLookup } from "@assistant-ui/store";
3
+ import { resource, withKey } from "@assistant-ui/tap";
3
4
  //#region src/store/clients/suggestions.ts
4
- const SuggestionClient = resource((state) => {
5
+ const SuggestionClient = resource(function SuggestionClient(state) {
5
6
  return { getState: () => state };
6
7
  });
7
- const Suggestions = resource((suggestions) => {
8
- const [state] = tapState(() => {
8
+ const Suggestions = resource(function SuggestionsResource(suggestions) {
9
+ const [state] = useState(() => {
9
10
  return { suggestions: (suggestions ?? []).map((s) => {
10
11
  if (typeof s === "string") return {
11
12
  title: s,
@@ -19,7 +20,7 @@ const Suggestions = resource((suggestions) => {
19
20
  };
20
21
  }) };
21
22
  });
22
- const suggestionClients = tapClientLookup(() => state.suggestions.map((suggestion, index) => withKey(index, SuggestionClient(suggestion))), [state.suggestions]);
23
+ const suggestionClients = useClientLookup(() => state.suggestions.map((suggestion, index) => withKey(index, SuggestionClient(suggestion))), [state.suggestions]);
23
24
  return {
24
25
  getState: () => state,
25
26
  suggestion: ({ index }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"suggestions.js","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"sourcesContent":["import { resource, tapState, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { tapClientLookup } from \"@assistant-ui/store\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst SuggestionClient = resource(\n (state: SuggestionState): ClientOutput<\"suggestion\"> => {\n return {\n getState: () => state,\n };\n },\n);\n\nconst SuggestionsResource = resource(\n (suggestions?: SuggestionConfig[]): ClientOutput<\"suggestions\"> => {\n const [state] = tapState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n const suggestionClients = tapClientLookup(\n () =>\n state.suggestions.map((suggestion, index) =>\n withKey(index, SuggestionClient(suggestion)),\n ),\n [state.suggestions],\n );\n\n return {\n getState: () => state,\n suggestion: ({ index }: { index: number }) => {\n return suggestionClients.get({ index });\n },\n };\n },\n);\n\nexport const Suggestions: {\n (): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n undefined\n >;\n (\n suggestions: SuggestionConfig[],\n ): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n SuggestionConfig[]\n >;\n} = SuggestionsResource as any;\n"],"mappings":";;;AAUA,MAAM,mBAAmB,UACtB,UAAuD;CACtD,OAAO,EACL,gBAAgB,MAClB;AACF,CACF;AA0CA,MAAa,cAxCe,UACzB,gBAAkE;CACjE,MAAM,CAAC,SAAS,eAAiC;EAgB/C,OAAO,EACL,cAhB6B,eAAe,CAAC,GAAG,KAAK,MAAM;GAC3D,IAAI,OAAO,MAAM,UACf,OAAO;IACL,OAAO;IACP,OAAO;IACP,QAAQ;GACV;GAEF,OAAO;IACL,OAAO,EAAE;IACT,OAAO,EAAE;IACT,QAAQ,EAAE;GACZ;EACF,CAGmC,EACnC;CACF,CAAC;CAED,MAAM,oBAAoB,sBAEtB,MAAM,YAAY,KAAK,YAAY,UACjC,QAAQ,OAAO,iBAAiB,UAAU,CAAC,CAC7C,GACF,CAAC,MAAM,WAAW,CACpB;CAEA,OAAO;EACL,gBAAgB;EAChB,aAAa,EAAE,YAA+B;GAC5C,OAAO,kBAAkB,IAAI,EAAE,MAAM,CAAC;EACxC;CACF;AACF,CAcE"}
1
+ {"version":3,"file":"suggestions.js","names":[],"sources":["../../../src/store/clients/suggestions.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { SuggestionsState } from \"../scopes/suggestions\";\nimport type { SuggestionState } from \"../scopes/suggestion\";\n\nexport type SuggestionConfig =\n | string\n | { title: string; label: string; prompt: string };\n\nconst SuggestionClient = resource(function SuggestionClient(\n state: SuggestionState,\n): ClientOutput<\"suggestion\"> {\n return {\n getState: () => state,\n };\n});\n\nconst SuggestionsResource = resource(function SuggestionsResource(\n suggestions?: SuggestionConfig[],\n): ClientOutput<\"suggestions\"> {\n const [state] = useState<SuggestionsState>(() => {\n const normalizedSuggestions = (suggestions ?? []).map((s) => {\n if (typeof s === \"string\") {\n return {\n title: s,\n label: \"\",\n prompt: s,\n };\n }\n return {\n title: s.title,\n label: s.label,\n prompt: s.prompt,\n };\n });\n\n return {\n suggestions: normalizedSuggestions,\n };\n });\n\n const suggestionClients = useClientLookup(\n () =>\n state.suggestions.map((suggestion, index) =>\n withKey(index, SuggestionClient(suggestion)),\n ),\n [state.suggestions],\n );\n\n return {\n getState: () => state,\n suggestion: ({ index }: { index: number }) => {\n return suggestionClients.get({ index });\n },\n };\n});\n\nexport const Suggestions: {\n (): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n undefined\n >;\n (\n suggestions: SuggestionConfig[],\n ): import(\"@assistant-ui/tap\").ResourceElement<\n ClientOutput<\"suggestions\">,\n SuggestionConfig[]\n >;\n} = SuggestionsResource as any;\n"],"mappings":";;;;AAWA,MAAM,mBAAmB,SAAS,SAAS,iBACzC,OAC4B;CAC5B,OAAO,EACL,gBAAgB,MAClB;AACF,CAAC;AA0CD,MAAa,cAxCe,SAAS,SAAS,oBAC5C,aAC6B;CAC7B,MAAM,CAAC,SAAS,eAAiC;EAgB/C,OAAO,EACL,cAhB6B,eAAe,CAAC,EAAA,CAAG,KAAK,MAAM;GAC3D,IAAI,OAAO,MAAM,UACf,OAAO;IACL,OAAO;IACP,OAAO;IACP,QAAQ;GACV;GAEF,OAAO;IACL,OAAO,EAAE;IACT,OAAO,EAAE;IACT,QAAQ,EAAE;GACZ;EACF,CAGmC,EACnC;CACF,CAAC;CAED,MAAM,oBAAoB,sBAEtB,MAAM,YAAY,KAAK,YAAY,UACjC,QAAQ,OAAO,iBAAiB,UAAU,CAAC,CAC7C,GACF,CAAC,MAAM,WAAW,CACpB;CAEA,OAAO;EACL,gBAAgB;EAChB,aAAa,EAAE,YAA+B;GAC5C,OAAO,kBAAkB,IAAI,EAAE,MAAM,CAAC;EACxC;CACF;AACF,CAaI"}
@@ -1 +1 @@
1
- {"version":3,"file":"thread-message-client.d.ts","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"mappings":";;;;KAyDY,wBAAA;EACV,OAAA,EAAS,aAAa;EACtB,KAAA;EACA,MAAA;EACA,YAAA;EACA,WAAA;AAAA;AAAA,cAGW,mBAAA,GAAmB,KAAA,EAAA,wBAAA,iCAAA,eAAA,CAAA,YAAA,aAAA,wBAAA"}
1
+ {"version":3,"file":"thread-message-client.d.ts","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"mappings":";;;;KAsDY,wBAAA;EACV,OAAA,EAAS,aAAa;EACtB,KAAA;EACA,MAAA;EACA,YAAA;EACA,WAAA;AAAA;AAAA,cAGW,mBAAA,GAAmB,KAAA,EAAA,wBAAA,iCAAA,eAAA,CAAA,YAAA,aAAA,wBAAA"}
@@ -1,9 +1,10 @@
1
1
  import { NoOpComposerClient } from "./no-op-composer-client.js";
2
- import { tapClientLookup } from "@assistant-ui/store";
3
- import { resource, tapMemo, tapResource, tapState, withKey } from "@assistant-ui/tap";
2
+ import { useMemo, useState } from "@assistant-ui/tap/react-shim";
3
+ import { useClientLookup } from "@assistant-ui/store";
4
+ import { resource, useResource, withKey } from "@assistant-ui/tap";
4
5
  //#region src/store/clients/thread-message-client.ts
5
- const ThreadMessagePartClient = resource(({ part }) => {
6
- const state = tapMemo(() => {
6
+ const ThreadMessagePartClient = resource(function ThreadMessagePartClient({ part }) {
7
+ const state = useMemo(() => {
7
8
  return {
8
9
  ...part,
9
10
  status: { type: "complete" }
@@ -22,7 +23,7 @@ const ThreadMessagePartClient = resource(({ part }) => {
22
23
  }
23
24
  };
24
25
  });
25
- const ThreadMessageAttachmentClient = resource(({ attachment }) => {
26
+ const ThreadMessageAttachmentClient = resource(function ThreadMessageAttachmentClient({ attachment }) {
26
27
  return {
27
28
  getState: () => attachment,
28
29
  remove: () => {
@@ -30,14 +31,14 @@ const ThreadMessageAttachmentClient = resource(({ attachment }) => {
30
31
  }
31
32
  };
32
33
  });
33
- const ThreadMessageClient = resource(({ message, index, isLast = true, branchNumber = 1, branchCount = 1 }) => {
34
- const [isCopiedState, setIsCopied] = tapState(false);
35
- const [isHoveringState, setIsHovering] = tapState(false);
36
- const parts = tapClientLookup(() => message.content.map((part, idx) => withKey("toolCallId" in part && part.toolCallId != null ? `toolCallId-${part.toolCallId}` : `index-${idx}`, ThreadMessagePartClient({ part }))), [message.content]);
37
- const attachments = tapClientLookup(() => (message.attachments ?? []).map((attachment) => withKey(attachment.id, ThreadMessageAttachmentClient({ attachment }))), [message.attachments]);
38
- const composer = tapResource(NoOpComposerClient({ type: "edit" }));
34
+ const ThreadMessageClient = resource(function ThreadMessageClient({ message, index, isLast = true, branchNumber = 1, branchCount = 1 }) {
35
+ const [isCopiedState, setIsCopied] = useState(false);
36
+ const [isHoveringState, setIsHovering] = useState(false);
37
+ const parts = useClientLookup(() => message.content.map((part, idx) => withKey("toolCallId" in part && part.toolCallId != null ? `toolCallId-${part.toolCallId}` : `index-${idx}`, ThreadMessagePartClient({ part }))), [message.content]);
38
+ const attachments = useClientLookup(() => (message.attachments ?? []).map((attachment) => withKey(attachment.id, ThreadMessageAttachmentClient({ attachment }))), [message.attachments]);
39
+ const composer = useResource(NoOpComposerClient({ type: "edit" }));
39
40
  const composerState = composer.getState();
40
- const state = tapMemo(() => {
41
+ const state = useMemo(() => {
41
42
  return {
42
43
  ...message,
43
44
  parts: parts.state,
@@ -1 +1 @@
1
- {"version":3,"file":"thread-message-client.js","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"sourcesContent":["import type {\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n} from \"../../types/message\";\nimport type { Attachment } from \"../../types/attachment\";\nimport {\n resource,\n tapMemo,\n tapState,\n tapResource,\n withKey,\n} from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { tapClientLookup } from \"@assistant-ui/store\";\nimport type { MessageState } from \"../scopes/message\";\nimport type { PartState } from \"../scopes/part\";\nimport { NoOpComposerClient } from \"./no-op-composer-client\";\n\nconst ThreadMessagePartClient = resource(\n ({\n part,\n }: {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n }): ClientOutput<\"part\"> => {\n const state = tapMemo<PartState>(() => {\n return {\n ...part,\n status: { type: \"complete\" },\n };\n }, [part]);\n\n return {\n getState: () => state,\n addToolResult: () => {\n throw new Error(\"Not supported\");\n },\n resumeToolCall: () => {\n throw new Error(\"Not supported\");\n },\n respondToToolApproval: () => {\n throw new Error(\"Not supported\");\n },\n };\n },\n);\n\nconst ThreadMessageAttachmentClient = resource(\n ({ attachment }: { attachment: Attachment }): ClientOutput<\"attachment\"> => {\n return {\n getState: () => attachment,\n remove: () => {\n throw new Error(\"Not supported\");\n },\n };\n },\n);\nexport type ThreadMessageClientProps = {\n message: ThreadMessage;\n index: number;\n isLast?: boolean;\n branchNumber?: number;\n branchCount?: number;\n};\n\nexport const ThreadMessageClient = resource(\n ({\n message,\n index,\n isLast = true,\n branchNumber = 1,\n branchCount = 1,\n }: ThreadMessageClientProps): ClientOutput<\"message\"> => {\n const [isCopiedState, setIsCopied] = tapState(false);\n const [isHoveringState, setIsHovering] = tapState(false);\n\n const parts = tapClientLookup(\n () =>\n message.content.map((part, idx) =>\n withKey(\n \"toolCallId\" in part && part.toolCallId != null\n ? `toolCallId-${part.toolCallId}`\n : `index-${idx}`,\n ThreadMessagePartClient({ part }),\n ),\n ),\n [message.content],\n );\n\n const attachments = tapClientLookup(\n () =>\n (message.attachments ?? []).map((attachment) =>\n withKey(attachment.id, ThreadMessageAttachmentClient({ attachment })),\n ),\n [message.attachments],\n );\n\n const composer = tapResource(NoOpComposerClient({ type: \"edit\" }));\n const composerState = composer.getState();\n\n const state = tapMemo<MessageState>(() => {\n return {\n ...message,\n parts: parts.state,\n composer: composerState,\n parentId: null,\n index,\n isLast,\n branchNumber,\n branchCount,\n speech: undefined,\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n message,\n index,\n isCopiedState,\n isHoveringState,\n isLast,\n parts.state,\n composerState,\n branchNumber,\n branchCount,\n ]);\n\n return {\n getState: () => state,\n composer: () => composer,\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.get({ index: selector.index });\n } else {\n return parts.get({ key: `toolCallId-${selector.toolCallId}` });\n }\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n reload: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n speak: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n stopSpeaking: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n submitFeedback: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n switchToBranch: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n getCopyText: () => {\n return message.content\n .map((part) => {\n if (\"text\" in part && typeof part.text === \"string\") {\n return part.text;\n }\n return \"\";\n })\n .join(\"\\n\");\n },\n setIsCopied,\n setIsHovering,\n };\n },\n);\n"],"mappings":";;;;AAmBA,MAAM,0BAA0B,UAC7B,EACC,WAG0B;CAC1B,MAAM,QAAQ,cAAyB;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,EAAE,MAAM,WAAW;EAC7B;CACF,GAAG,CAAC,IAAI,CAAC;CAET,OAAO;EACL,gBAAgB;EAChB,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,6BAA6B;GAC3B,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CACF;AAEA,MAAM,gCAAgC,UACnC,EAAE,iBAAyE;CAC1E,OAAO;EACL,gBAAgB;EAChB,cAAc;GACZ,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CACF;AASA,MAAa,sBAAsB,UAChC,EACC,SACA,OACA,SAAS,MACT,eAAe,GACf,cAAc,QACyC;CACvD,MAAM,CAAC,eAAe,eAAe,SAAS,KAAK;CACnD,MAAM,CAAC,iBAAiB,iBAAiB,SAAS,KAAK;CAEvD,MAAM,QAAQ,sBAEV,QAAQ,QAAQ,KAAK,MAAM,QACzB,QACE,gBAAgB,QAAQ,KAAK,cAAc,OACvC,cAAc,KAAK,eACnB,SAAS,OACb,wBAAwB,EAAE,KAAK,CAAC,CAClC,CACF,GACF,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,cAAc,uBAEf,QAAQ,eAAe,CAAC,GAAG,KAAK,eAC/B,QAAQ,WAAW,IAAI,8BAA8B,EAAE,WAAW,CAAC,CAAC,CACtE,GACF,CAAC,QAAQ,WAAW,CACtB;CAEA,MAAM,WAAW,YAAY,mBAAmB,EAAE,MAAM,OAAO,CAAC,CAAC;CACjE,MAAM,gBAAgB,SAAS,SAAS;CAExC,MAAM,QAAQ,cAA4B;EACxC,OAAO;GACL,GAAG;GACH,OAAO,MAAM;GACb,UAAU;GACV,UAAU;GACV;GACA;GACA;GACA;GACA,QAAQ,KAAA;GACR,UAAU;GACV,YAAY;EACd;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,gBAAgB;EAChB,gBAAgB;EAChB,OAAO,aAAa;GAClB,IAAI,WAAW,UACb,OAAO,MAAM,IAAI,EAAE,OAAO,SAAS,MAAM,CAAC;QAE1C,OAAO,MAAM,IAAI,EAAE,KAAK,cAAc,SAAS,aAAa,CAAC;EAEjE;EACA,aAAa,aAAa;GACxB,IAAI,QAAQ,UACV,OAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;QAE3C,OAAO,YAAY,IAAI,QAAQ;EAEnC;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,aAAa;GACX,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,oBAAoB;GAClB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,mBAAmB;GACjB,OAAO,QAAQ,QACZ,KAAK,SAAS;IACb,IAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,UACzC,OAAO,KAAK;IAEd,OAAO;GACT,CAAC,EACA,KAAK,IAAI;EACd;EACA;EACA;CACF;AACF,CACF"}
1
+ {"version":3,"file":"thread-message-client.js","names":[],"sources":["../../../src/store/clients/thread-message-client.ts"],"sourcesContent":["import type {\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n} from \"../../types/message\";\nimport type { Attachment } from \"../../types/attachment\";\nimport { useMemo, useState } from \"react\";\nimport { useResource, resource, withKey } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { useClientLookup } from \"@assistant-ui/store\";\nimport type { MessageState } from \"../scopes/message\";\nimport type { PartState } from \"../scopes/part\";\nimport { NoOpComposerClient } from \"./no-op-composer-client\";\n\nconst ThreadMessagePartClient = resource(function ThreadMessagePartClient({\n part,\n}: {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n}): ClientOutput<\"part\"> {\n const state = useMemo<PartState>(() => {\n return {\n ...part,\n status: { type: \"complete\" },\n };\n }, [part]);\n\n return {\n getState: () => state,\n addToolResult: () => {\n throw new Error(\"Not supported\");\n },\n resumeToolCall: () => {\n throw new Error(\"Not supported\");\n },\n respondToToolApproval: () => {\n throw new Error(\"Not supported\");\n },\n };\n});\n\nconst ThreadMessageAttachmentClient = resource(\n function ThreadMessageAttachmentClient({\n attachment,\n }: {\n attachment: Attachment;\n }): ClientOutput<\"attachment\"> {\n return {\n getState: () => attachment,\n remove: () => {\n throw new Error(\"Not supported\");\n },\n };\n },\n);\nexport type ThreadMessageClientProps = {\n message: ThreadMessage;\n index: number;\n isLast?: boolean;\n branchNumber?: number;\n branchCount?: number;\n};\n\nexport const ThreadMessageClient = resource(function ThreadMessageClient({\n message,\n index,\n isLast = true,\n branchNumber = 1,\n branchCount = 1,\n}: ThreadMessageClientProps): ClientOutput<\"message\"> {\n const [isCopiedState, setIsCopied] = useState(false);\n const [isHoveringState, setIsHovering] = useState(false);\n\n const parts = useClientLookup(\n () =>\n message.content.map((part, idx) =>\n withKey(\n \"toolCallId\" in part && part.toolCallId != null\n ? `toolCallId-${part.toolCallId}`\n : `index-${idx}`,\n ThreadMessagePartClient({ part }),\n ),\n ),\n [message.content],\n );\n\n const attachments = useClientLookup(\n () =>\n (message.attachments ?? []).map((attachment) =>\n withKey(attachment.id, ThreadMessageAttachmentClient({ attachment })),\n ),\n [message.attachments],\n );\n\n const composer = useResource(NoOpComposerClient({ type: \"edit\" }));\n const composerState = composer.getState();\n\n const state = useMemo<MessageState>(() => {\n return {\n ...message,\n parts: parts.state,\n composer: composerState,\n parentId: null,\n index,\n isLast,\n branchNumber,\n branchCount,\n speech: undefined,\n isCopied: isCopiedState,\n isHovering: isHoveringState,\n };\n }, [\n message,\n index,\n isCopiedState,\n isHoveringState,\n isLast,\n parts.state,\n composerState,\n branchNumber,\n branchCount,\n ]);\n\n return {\n getState: () => state,\n composer: () => composer,\n part: (selector) => {\n if (\"index\" in selector) {\n return parts.get({ index: selector.index });\n } else {\n return parts.get({ key: `toolCallId-${selector.toolCallId}` });\n }\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n reload: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n speak: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n stopSpeaking: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n submitFeedback: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n switchToBranch: () => {\n throw new Error(\"Not supported in ThreadMessageProvider\");\n },\n getCopyText: () => {\n return message.content\n .map((part) => {\n if (\"text\" in part && typeof part.text === \"string\") {\n return part.text;\n }\n return \"\";\n })\n .join(\"\\n\");\n },\n setIsCopied,\n setIsHovering,\n };\n});\n"],"mappings":";;;;;AAcA,MAAM,0BAA0B,SAAS,SAAS,wBAAwB,EACxE,QAGuB;CACvB,MAAM,QAAQ,cAAyB;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,EAAE,MAAM,WAAW;EAC7B;CACF,GAAG,CAAC,IAAI,CAAC;CAET,OAAO;EACL,gBAAgB;EAChB,qBAAqB;GACnB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,eAAe;EACjC;EACA,6BAA6B;GAC3B,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CAAC;AAED,MAAM,gCAAgC,SACpC,SAAS,8BAA8B,EACrC,cAG6B;CAC7B,OAAO;EACL,gBAAgB;EAChB,cAAc;GACZ,MAAM,IAAI,MAAM,eAAe;EACjC;CACF;AACF,CACF;AASA,MAAa,sBAAsB,SAAS,SAAS,oBAAoB,EACvE,SACA,OACA,SAAS,MACT,eAAe,GACf,cAAc,KACsC;CACpD,MAAM,CAAC,eAAe,eAAe,SAAS,KAAK;CACnD,MAAM,CAAC,iBAAiB,iBAAiB,SAAS,KAAK;CAEvD,MAAM,QAAQ,sBAEV,QAAQ,QAAQ,KAAK,MAAM,QACzB,QACE,gBAAgB,QAAQ,KAAK,cAAc,OACvC,cAAc,KAAK,eACnB,SAAS,OACb,wBAAwB,EAAE,KAAK,CAAC,CAClC,CACF,GACF,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,cAAc,uBAEf,QAAQ,eAAe,CAAC,EAAA,CAAG,KAAK,eAC/B,QAAQ,WAAW,IAAI,8BAA8B,EAAE,WAAW,CAAC,CAAC,CACtE,GACF,CAAC,QAAQ,WAAW,CACtB;CAEA,MAAM,WAAW,YAAY,mBAAmB,EAAE,MAAM,OAAO,CAAC,CAAC;CACjE,MAAM,gBAAgB,SAAS,SAAS;CAExC,MAAM,QAAQ,cAA4B;EACxC,OAAO;GACL,GAAG;GACH,OAAO,MAAM;GACb,UAAU;GACV,UAAU;GACV;GACA;GACA;GACA;GACA,QAAQ,KAAA;GACR,UAAU;GACV,YAAY;EACd;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,gBAAgB;EAChB,gBAAgB;EAChB,OAAO,aAAa;GAClB,IAAI,WAAW,UACb,OAAO,MAAM,IAAI,EAAE,OAAO,SAAS,MAAM,CAAC;QAE1C,OAAO,MAAM,IAAI,EAAE,KAAK,cAAc,SAAS,aAAa,CAAC;EAEjE;EACA,aAAa,aAAa;GACxB,IAAI,QAAQ,UACV,OAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;QAE3C,OAAO,YAAY,IAAI,QAAQ;EAEnC;EACA,cAAc;GACZ,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,aAAa;GACX,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,oBAAoB;GAClB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,sBAAsB;GACpB,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,mBAAmB;GACjB,OAAO,QAAQ,QACZ,KAAK,SAAS;IACb,IAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,UACzC,OAAO,KAAK;IAEd,OAAO;GACT,CAAC,CAAC,CACD,KAAK,IAAI;EACd;EACA;EACA;CACF;AACF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /// <reference path="./scope-registration.d.ts" />
2
+ import { QueueItemClientSchema, QueueItemMeta, QueueItemMethods, QueueItemState } from "./scopes/queue-item.js";
2
3
  import { ThreadListItemClientSchema, ThreadListItemEvents, ThreadListItemMeta, ThreadListItemMethods, ThreadListItemState } from "./scopes/thread-list-item.js";
3
4
  import { AttachmentClientSchema, AttachmentMeta, AttachmentMethods, AttachmentState } from "./scopes/attachment.js";
4
- import { QueueItemClientSchema, QueueItemMeta, QueueItemMethods, QueueItemState } from "./scopes/queue-item.js";
5
5
  import { ComposerClientSchema, ComposerEvents, ComposerMeta, ComposerMethods, ComposerSendOptions, ComposerState } from "./scopes/composer.js";
6
6
  import { PartClientSchema, PartMeta, PartMethods, PartState } from "./scopes/part.js";
7
7
  import { MessageClientSchema, MessageMeta, MessageMethods, MessageState } from "./scopes/message.js";
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"mappings":";;;;cAKa,uBAAA,GAAuB,KAAA;WACT,iBAAA;AAAA;WAAA,iBAAA;AAAA"}
1
+ {"version":3,"file":"attachment-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"mappings":";;;;cAKa,uBAAA,GAAuB,KAAA;WAIvB,iBAAA;AAAA;WAAA,iBAAA;AAAA"}
@@ -1,8 +1,8 @@
1
- import { tapSubscribable } from "./tap-subscribable.js";
1
+ import { useSubscribable } from "./useSubscribable.js";
2
2
  import { resource } from "@assistant-ui/tap";
3
3
  //#region src/store/runtime-clients/attachment-runtime-client.ts
4
- const AttachmentRuntimeClient = resource(({ runtime }) => {
5
- const state = tapSubscribable(runtime);
4
+ const AttachmentRuntimeClient = resource(function AttachmentRuntimeClient({ runtime }) {
5
+ const state = useSubscribable(runtime);
6
6
  return {
7
7
  getState: () => state,
8
8
  remove: runtime.remove,
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { AttachmentRuntime } from \"../../runtime/api/attachment-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nexport const AttachmentRuntimeClient = resource(\n ({ runtime }: { runtime: AttachmentRuntime }): ClientOutput<\"attachment\"> => {\n const state = tapSubscribable(runtime);\n\n return {\n getState: () => state,\n remove: runtime.remove,\n __internal_getRuntime: () => runtime,\n };\n },\n);\n"],"mappings":";;;AAKA,MAAa,0BAA0B,UACpC,EAAE,cAA0E;CAC3E,MAAM,QAAQ,gBAAgB,OAAO;CAErC,OAAO;EACL,gBAAgB;EAChB,QAAQ,QAAQ;EAChB,6BAA6B;CAC/B;AACF,CACF"}
1
+ {"version":3,"file":"attachment-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/attachment-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { AttachmentRuntime } from \"../../runtime/api/attachment-runtime\";\nimport { useSubscribable } from \"./useSubscribable\";\n\nexport const AttachmentRuntimeClient = resource(\n function AttachmentRuntimeClient({\n runtime,\n }: {\n runtime: AttachmentRuntime;\n }): ClientOutput<\"attachment\"> {\n const state = useSubscribable(runtime);\n\n return {\n getState: () => state,\n remove: runtime.remove,\n __internal_getRuntime: () => runtime,\n };\n },\n);\n"],"mappings":";;;AAKA,MAAa,0BAA0B,SACrC,SAAS,wBAAwB,EAC/B,WAG6B;CAC7B,MAAM,QAAQ,gBAAgB,OAAO;CAErC,OAAO;EACL,gBAAgB;EAChB,QAAQ,QAAQ;EAChB,6BAA6B;CAC/B;AACF,CACF"}
@@ -1,15 +1,22 @@
1
1
  import { ComposerRuntime } from "../../runtime/api/composer-runtime.js";
2
2
  import { ClientOutput } from "@assistant-ui/store";
3
- import { tapRef } from "@assistant-ui/tap";
4
3
 
5
4
  //#region src/store/runtime-clients/composer-runtime-client.d.ts
6
5
  declare const ComposerClient: (props: {
7
- threadIdRef: tapRef.RefObject<string>;
8
- messageIdRef?: tapRef.RefObject<string>;
6
+ threadIdRef: {
7
+ current: string;
8
+ };
9
+ messageIdRef?: {
10
+ current: string;
11
+ };
9
12
  runtime: ComposerRuntime;
10
13
  }) => import("@assistant-ui/tap").ResourceElement<ClientOutput<"composer">, {
11
- threadIdRef: tapRef.RefObject<string>;
12
- messageIdRef?: tapRef.RefObject<string>;
14
+ threadIdRef: {
15
+ current: string;
16
+ };
17
+ messageIdRef?: {
18
+ current: string;
19
+ };
13
20
  runtime: ComposerRuntime;
14
21
  }>;
15
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"composer-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/composer-runtime-client.ts"],"mappings":";;;;;cAqCa,cAAA,GAAc,KAAA;eAMV,MAAA,CAAO,SAAA;iBACL,MAAA,CAAO,SAAA;WACb,eAAA;AAAA;eAFI,MAAA,CAAO,SAAA;iBACL,MAAA,CAAO,SAAA;WACb,eAAA;AAAA"}
1
+ {"version":3,"file":"composer-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/composer-runtime-client.ts"],"mappings":";;;;cAsDa,cAAA,GAAc,KAAA;;IAKV,OAAA;EAAA;;IACE,OAAA;EAAA;WACR,eAAA;AAAA;;IAFM,OAAA;EAAA;;IACE,OAAA;EAAA;WACR,eAAA;AAAA"}
@@ -1,15 +1,23 @@
1
- import { tapSubscribable } from "./tap-subscribable.js";
1
+ import { useSubscribable } from "./useSubscribable.js";
2
2
  import { AttachmentRuntimeClient } from "./attachment-runtime-client.js";
3
- import { tapAssistantEmit, tapClientLookup } from "@assistant-ui/store";
4
- import { resource, tapEffect, tapMemo, tapResource, withKey } from "@assistant-ui/tap";
3
+ import { useEffect, useMemo } from "@assistant-ui/tap/react-shim";
4
+ import { useAssistantEmit, useClientLookup } from "@assistant-ui/store";
5
+ import { resource, useResource, withKey } from "@assistant-ui/tap";
5
6
  //#region src/store/runtime-clients/composer-runtime-client.ts
6
- const ComposerAttachmentClientByIndex = resource(({ runtime, index }) => {
7
- return tapResource(AttachmentRuntimeClient({ runtime: tapMemo(() => runtime.getAttachmentByIndex(index), [runtime, index]) }));
7
+ const ComposerAttachmentClientByIndex = resource(function ComposerAttachmentClientByIndex({ runtime, index }) {
8
+ return useResource(AttachmentRuntimeClient({ runtime: useMemo(() => runtime.getAttachmentByIndex(index), [runtime, index]) }));
8
9
  });
9
- const ComposerClient = resource(({ threadIdRef, messageIdRef, runtime }) => {
10
- const runtimeState = tapSubscribable(runtime);
11
- const emit = tapAssistantEmit();
12
- tapEffect(() => {
10
+ const QueueItemClient = resource(function QueueItemClient({ item, onSteer, onRemove }) {
11
+ return {
12
+ getState: () => item,
13
+ steer: onSteer,
14
+ remove: onRemove
15
+ };
16
+ });
17
+ const ComposerClient = resource(function ComposerClient({ threadIdRef, messageIdRef, runtime }) {
18
+ const runtimeState = useSubscribable(runtime);
19
+ const emit = useAssistantEmit();
20
+ useEffect(() => {
13
21
  const unsubscribers = [];
14
22
  for (const event of ["send", "attachmentAdd"]) {
15
23
  const unsubscribe = runtime.unstable_on(event, () => {
@@ -38,11 +46,17 @@ const ComposerClient = resource(({ threadIdRef, messageIdRef, runtime }) => {
38
46
  threadIdRef,
39
47
  messageIdRef
40
48
  ]);
41
- const attachments = tapClientLookup(() => runtimeState.attachments.map((attachment, idx) => withKey(attachment.id, ComposerAttachmentClientByIndex({
49
+ const attachments = useClientLookup(() => runtimeState.attachments.map((attachment, idx) => withKey(attachment.id, ComposerAttachmentClientByIndex({
42
50
  runtime,
43
51
  index: idx
44
52
  }))), [runtimeState.attachments, runtime]);
45
- const state = tapMemo(() => {
53
+ const queue = runtimeState.queue;
54
+ const queueItems = useClientLookup(() => queue.map((item) => withKey(item.id, QueueItemClient({
55
+ item,
56
+ onSteer: () => runtime.steerQueueItem(item.id),
57
+ onRemove: () => runtime.removeQueueItem(item.id)
58
+ }))), [queue, runtime]);
59
+ const state = useMemo(() => {
46
60
  return {
47
61
  text: runtimeState.text,
48
62
  role: runtimeState.role,
@@ -56,9 +70,13 @@ const ComposerClient = resource(({ threadIdRef, messageIdRef, runtime }) => {
56
70
  type: runtimeState.type ?? "thread",
57
71
  dictation: runtimeState.dictation,
58
72
  quote: runtimeState.quote,
59
- queue: []
73
+ queue
60
74
  };
61
- }, [runtimeState, attachments.state]);
75
+ }, [
76
+ runtimeState,
77
+ attachments.state,
78
+ queue
79
+ ]);
62
80
  return {
63
81
  getState: () => state,
64
82
  setText: runtime.setText,
@@ -79,9 +97,7 @@ const ComposerClient = resource(({ threadIdRef, messageIdRef, runtime }) => {
79
97
  if ("id" in selector) return attachments.get({ key: selector.id });
80
98
  else return attachments.get(selector);
81
99
  },
82
- queueItem: () => {
83
- throw new Error("Queue is not supported in this runtime");
84
- },
100
+ queueItem: (selector) => queueItems.get(selector),
85
101
  __internal_getRuntime: () => runtime
86
102
  };
87
103
  });
@@ -1 +1 @@
1
- {"version":3,"file":"composer-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/composer-runtime-client.ts"],"sourcesContent":["import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport {\n resource,\n tapMemo,\n tapEffect,\n tapResource,\n type tapRef,\n withKey,\n} from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n tapAssistantEmit,\n tapClientLookup,\n} from \"@assistant-ui/store\";\nimport type {\n ComposerRuntime,\n EditComposerRuntime,\n} from \"../../runtime/api/composer-runtime\";\nimport type { ComposerState } from \"../scopes/composer\";\nimport { AttachmentRuntimeClient } from \"./attachment-runtime-client\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nconst ComposerAttachmentClientByIndex = resource(\n ({ runtime, index }: { runtime: ComposerRuntime; index: number }) => {\n const attachmentRuntime = tapMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n\n return tapResource(\n AttachmentRuntimeClient({\n runtime: attachmentRuntime,\n }),\n );\n },\n);\n\nexport const ComposerClient = resource(\n ({\n threadIdRef,\n messageIdRef,\n runtime,\n }: {\n threadIdRef: tapRef.RefObject<string>;\n messageIdRef?: tapRef.RefObject<string>;\n runtime: ComposerRuntime;\n }): ClientOutput<\"composer\"> => {\n const runtimeState = tapSubscribable(runtime);\n const emit = tapAssistantEmit();\n\n // Bind composer events to event manager\n tapEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to composer events\n for (const event of [\"send\", \"attachmentAdd\"] as const) {\n const unsubscribe = runtime.unstable_on(event, () => {\n emit(`composer.${event}`, {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n unsubscribers.push(\n runtime.unstable_on(\"attachmentAddError\", (payload) => {\n // payload.error omitted: raw Error is not store-serializable; use runtime.unstable_on for it.\n emit(\"composer.attachmentAddError\", {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n ...(payload.attachmentId && { attachmentId: payload.attachmentId }),\n reason: payload.reason,\n message: payload.message,\n });\n }),\n );\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, emit, threadIdRef, messageIdRef]);\n\n const attachments = tapClientLookup(\n () =>\n runtimeState.attachments.map((attachment, idx) =>\n withKey(\n attachment.id,\n ComposerAttachmentClientByIndex({\n runtime,\n index: idx,\n }),\n ),\n ),\n [runtimeState.attachments, runtime],\n );\n\n const state = tapMemo<ComposerState>(() => {\n return {\n text: runtimeState.text,\n role: runtimeState.role,\n attachments: attachments.state,\n runConfig: runtimeState.runConfig,\n isEditing: runtimeState.isEditing,\n canCancel: runtimeState.canCancel,\n canSend: runtimeState.canSend,\n attachmentAccept: runtimeState.attachmentAccept,\n isEmpty: runtimeState.isEmpty,\n type: runtimeState.type ?? \"thread\",\n dictation: runtimeState.dictation,\n quote: runtimeState.quote,\n queue: [],\n };\n }, [runtimeState, attachments.state]);\n\n return {\n getState: () => state,\n setText: runtime.setText,\n setRole: runtime.setRole,\n setRunConfig: runtime.setRunConfig,\n addAttachment: runtime.addAttachment,\n reset: runtime.reset,\n clearAttachments: runtime.clearAttachments,\n send: runtime.send,\n cancel: runtime.cancel,\n beginEdit:\n (runtime as EditComposerRuntime).beginEdit ??\n (() => {\n throw new Error(\"beginEdit is not supported in this runtime\");\n }),\n startDictation: runtime.startDictation,\n stopDictation: runtime.stopDictation,\n setQuote: runtime.setQuote,\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n queueItem: () => {\n throw new Error(\"Queue is not supported in this runtime\");\n },\n __internal_getRuntime: () => runtime,\n };\n },\n);\n"],"mappings":";;;;;AAsBA,MAAM,kCAAkC,UACrC,EAAE,SAAS,YAAyD;CAMnE,OAAO,YACL,wBAAwB,EACtB,SAPsB,cAClB,QAAQ,qBAAqB,KAAK,GACxC,CAAC,SAAS,KAAK,CAKY,EAC3B,CAAC,CACH;AACF,CACF;AAEA,MAAa,iBAAiB,UAC3B,EACC,aACA,cACA,cAK8B;CAC9B,MAAM,eAAe,gBAAgB,OAAO;CAC5C,MAAM,OAAO,iBAAiB;CAG9B,gBAAgB;EACd,MAAM,gBAA+B,CAAC;EAGtC,KAAK,MAAM,SAAS,CAAC,QAAQ,eAAe,GAAY;GACtD,MAAM,cAAc,QAAQ,YAAY,aAAa;IACnD,KAAK,YAAY,SAAS;KACxB,UAAU,YAAY;KACtB,GAAI,gBAAgB,EAAE,WAAW,aAAa,QAAQ;IACxD,CAAC;GACH,CAAC;GACD,cAAc,KAAK,WAAW;EAChC;EAEA,cAAc,KACZ,QAAQ,YAAY,uBAAuB,YAAY;GAErD,KAAK,+BAA+B;IAClC,UAAU,YAAY;IACtB,GAAI,gBAAgB,EAAE,WAAW,aAAa,QAAQ;IACtD,GAAI,QAAQ,gBAAgB,EAAE,cAAc,QAAQ,aAAa;IACjE,QAAQ,QAAQ;IAChB,SAAS,QAAQ;GACnB,CAAC;EACH,CAAC,CACH;EAEA,aAAa;GACX,KAAK,MAAM,SAAS,eAAe,MAAM;EAC3C;CACF,GAAG;EAAC;EAAS;EAAM;EAAa;CAAY,CAAC;CAE7C,MAAM,cAAc,sBAEhB,aAAa,YAAY,KAAK,YAAY,QACxC,QACE,WAAW,IACX,gCAAgC;EAC9B;EACA,OAAO;CACT,CAAC,CACH,CACF,GACF,CAAC,aAAa,aAAa,OAAO,CACpC;CAEA,MAAM,QAAQ,cAA6B;EACzC,OAAO;GACL,MAAM,aAAa;GACnB,MAAM,aAAa;GACnB,aAAa,YAAY;GACzB,WAAW,aAAa;GACxB,WAAW,aAAa;GACxB,WAAW,aAAa;GACxB,SAAS,aAAa;GACtB,kBAAkB,aAAa;GAC/B,SAAS,aAAa;GACtB,MAAM,aAAa,QAAQ;GAC3B,WAAW,aAAa;GACxB,OAAO,aAAa;GACpB,OAAO,CAAC;EACV;CACF,GAAG,CAAC,cAAc,YAAY,KAAK,CAAC;CAEpC,OAAO;EACL,gBAAgB;EAChB,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,cAAc,QAAQ;EACtB,eAAe,QAAQ;EACvB,OAAO,QAAQ;EACf,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,QAAQ,QAAQ;EAChB,WACG,QAAgC,oBAC1B;GACL,MAAM,IAAI,MAAM,4CAA4C;EAC9D;EACF,gBAAgB,QAAQ;EACxB,eAAe,QAAQ;EACvB,UAAU,QAAQ;EAClB,aAAa,aAAa;GACxB,IAAI,QAAQ,UACV,OAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;QAE3C,OAAO,YAAY,IAAI,QAAQ;EAEnC;EACA,iBAAiB;GACf,MAAM,IAAI,MAAM,wCAAwC;EAC1D;EACA,6BAA6B;CAC/B;AACF,CACF"}
1
+ {"version":3,"file":"composer-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/composer-runtime-client.ts"],"sourcesContent":["import type { Unsubscribe } from \"../../types/unsubscribe\";\nimport { useMemo, useEffect } from \"react\";\nimport { useResource, resource, withKey } from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n useAssistantEmit,\n useClientLookup,\n} from \"@assistant-ui/store\";\nimport type {\n ComposerRuntime,\n EditComposerRuntime,\n} from \"../../runtime/api/composer-runtime\";\nimport type { ComposerState } from \"../scopes/composer\";\nimport type { QueueItemState } from \"../scopes/queue-item\";\nimport { AttachmentRuntimeClient } from \"./attachment-runtime-client\";\nimport { useSubscribable } from \"./useSubscribable\";\n\nconst ComposerAttachmentClientByIndex = resource(\n function ComposerAttachmentClientByIndex({\n runtime,\n index,\n }: {\n runtime: ComposerRuntime;\n index: number;\n }) {\n const attachmentRuntime = useMemo(\n () => runtime.getAttachmentByIndex(index),\n [runtime, index],\n );\n\n return useResource(\n AttachmentRuntimeClient({\n runtime: attachmentRuntime,\n }),\n );\n },\n);\n\nconst QueueItemClient = resource(function QueueItemClient({\n item,\n onSteer,\n onRemove,\n}: {\n item: QueueItemState;\n onSteer: () => void;\n onRemove: () => void;\n}): ClientOutput<\"queueItem\"> {\n return {\n getState: () => item,\n steer: onSteer,\n remove: onRemove,\n };\n});\n\nexport const ComposerClient = resource(function ComposerClient({\n threadIdRef,\n messageIdRef,\n runtime,\n}: {\n threadIdRef: { current: string };\n messageIdRef?: { current: string };\n runtime: ComposerRuntime;\n}): ClientOutput<\"composer\"> {\n const runtimeState = useSubscribable(runtime);\n const emit = useAssistantEmit();\n\n // Bind composer events to event manager\n useEffect(() => {\n const unsubscribers: Unsubscribe[] = [];\n\n // Subscribe to composer events\n for (const event of [\"send\", \"attachmentAdd\"] as const) {\n const unsubscribe = runtime.unstable_on(event, () => {\n emit(`composer.${event}`, {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n });\n });\n unsubscribers.push(unsubscribe);\n }\n\n unsubscribers.push(\n runtime.unstable_on(\"attachmentAddError\", (payload) => {\n // payload.error omitted: raw Error is not store-serializable; use runtime.unstable_on for it.\n emit(\"composer.attachmentAddError\", {\n threadId: threadIdRef.current,\n ...(messageIdRef && { messageId: messageIdRef.current }),\n ...(payload.attachmentId && { attachmentId: payload.attachmentId }),\n reason: payload.reason,\n message: payload.message,\n });\n }),\n );\n\n return () => {\n for (const unsub of unsubscribers) unsub();\n };\n }, [runtime, emit, threadIdRef, messageIdRef]);\n\n const attachments = useClientLookup(\n () =>\n runtimeState.attachments.map((attachment, idx) =>\n withKey(\n attachment.id,\n ComposerAttachmentClientByIndex({\n runtime,\n index: idx,\n }),\n ),\n ),\n [runtimeState.attachments, runtime],\n );\n\n const queue = runtimeState.queue;\n const queueItems = useClientLookup(\n () =>\n queue.map((item) =>\n withKey(\n item.id,\n QueueItemClient({\n item,\n onSteer: () => runtime.steerQueueItem(item.id),\n onRemove: () => runtime.removeQueueItem(item.id),\n }),\n ),\n ),\n [queue, runtime],\n );\n\n const state = useMemo<ComposerState>(() => {\n return {\n text: runtimeState.text,\n role: runtimeState.role,\n attachments: attachments.state,\n runConfig: runtimeState.runConfig,\n isEditing: runtimeState.isEditing,\n canCancel: runtimeState.canCancel,\n canSend: runtimeState.canSend,\n attachmentAccept: runtimeState.attachmentAccept,\n isEmpty: runtimeState.isEmpty,\n type: runtimeState.type ?? \"thread\",\n dictation: runtimeState.dictation,\n quote: runtimeState.quote,\n queue,\n };\n }, [runtimeState, attachments.state, queue]);\n\n return {\n getState: () => state,\n setText: runtime.setText,\n setRole: runtime.setRole,\n setRunConfig: runtime.setRunConfig,\n addAttachment: runtime.addAttachment,\n reset: runtime.reset,\n clearAttachments: runtime.clearAttachments,\n send: runtime.send,\n cancel: runtime.cancel,\n beginEdit:\n (runtime as EditComposerRuntime).beginEdit ??\n (() => {\n throw new Error(\"beginEdit is not supported in this runtime\");\n }),\n startDictation: runtime.startDictation,\n stopDictation: runtime.stopDictation,\n setQuote: runtime.setQuote,\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachments.get({ key: selector.id });\n } else {\n return attachments.get(selector);\n }\n },\n queueItem: (selector) => queueItems.get(selector),\n __internal_getRuntime: () => runtime,\n };\n});\n"],"mappings":";;;;;;AAiBA,MAAM,kCAAkC,SACtC,SAAS,gCAAgC,EACvC,SACA,SAIC;CAMD,OAAO,YACL,wBAAwB,EACtB,SAPsB,cAClB,QAAQ,qBAAqB,KAAK,GACxC,CAAC,SAAS,KAAK,CAKY,EAC3B,CAAC,CACH;AACF,CACF;AAEA,MAAM,kBAAkB,SAAS,SAAS,gBAAgB,EACxD,MACA,SACA,YAK4B;CAC5B,OAAO;EACL,gBAAgB;EAChB,OAAO;EACP,QAAQ;CACV;AACF,CAAC;AAED,MAAa,iBAAiB,SAAS,SAAS,eAAe,EAC7D,aACA,cACA,WAK2B;CAC3B,MAAM,eAAe,gBAAgB,OAAO;CAC5C,MAAM,OAAO,iBAAiB;CAG9B,gBAAgB;EACd,MAAM,gBAA+B,CAAC;EAGtC,KAAK,MAAM,SAAS,CAAC,QAAQ,eAAe,GAAY;GACtD,MAAM,cAAc,QAAQ,YAAY,aAAa;IACnD,KAAK,YAAY,SAAS;KACxB,UAAU,YAAY;KACtB,GAAI,gBAAgB,EAAE,WAAW,aAAa,QAAQ;IACxD,CAAC;GACH,CAAC;GACD,cAAc,KAAK,WAAW;EAChC;EAEA,cAAc,KACZ,QAAQ,YAAY,uBAAuB,YAAY;GAErD,KAAK,+BAA+B;IAClC,UAAU,YAAY;IACtB,GAAI,gBAAgB,EAAE,WAAW,aAAa,QAAQ;IACtD,GAAI,QAAQ,gBAAgB,EAAE,cAAc,QAAQ,aAAa;IACjE,QAAQ,QAAQ;IAChB,SAAS,QAAQ;GACnB,CAAC;EACH,CAAC,CACH;EAEA,aAAa;GACX,KAAK,MAAM,SAAS,eAAe,MAAM;EAC3C;CACF,GAAG;EAAC;EAAS;EAAM;EAAa;CAAY,CAAC;CAE7C,MAAM,cAAc,sBAEhB,aAAa,YAAY,KAAK,YAAY,QACxC,QACE,WAAW,IACX,gCAAgC;EAC9B;EACA,OAAO;CACT,CAAC,CACH,CACF,GACF,CAAC,aAAa,aAAa,OAAO,CACpC;CAEA,MAAM,QAAQ,aAAa;CAC3B,MAAM,aAAa,sBAEf,MAAM,KAAK,SACT,QACE,KAAK,IACL,gBAAgB;EACd;EACA,eAAe,QAAQ,eAAe,KAAK,EAAE;EAC7C,gBAAgB,QAAQ,gBAAgB,KAAK,EAAE;CACjD,CAAC,CACH,CACF,GACF,CAAC,OAAO,OAAO,CACjB;CAEA,MAAM,QAAQ,cAA6B;EACzC,OAAO;GACL,MAAM,aAAa;GACnB,MAAM,aAAa;GACnB,aAAa,YAAY;GACzB,WAAW,aAAa;GACxB,WAAW,aAAa;GACxB,WAAW,aAAa;GACxB,SAAS,aAAa;GACtB,kBAAkB,aAAa;GAC/B,SAAS,aAAa;GACtB,MAAM,aAAa,QAAQ;GAC3B,WAAW,aAAa;GACxB,OAAO,aAAa;GACpB;EACF;CACF,GAAG;EAAC;EAAc,YAAY;EAAO;CAAK,CAAC;CAE3C,OAAO;EACL,gBAAgB;EAChB,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,cAAc,QAAQ;EACtB,eAAe,QAAQ;EACvB,OAAO,QAAQ;EACf,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,QAAQ,QAAQ;EAChB,WACG,QAAgC,oBAC1B;GACL,MAAM,IAAI,MAAM,4CAA4C;EAC9D;EACF,gBAAgB,QAAQ;EACxB,eAAe,QAAQ;EACvB,UAAU,QAAQ;EAClB,aAAa,aAAa;GACxB,IAAI,QAAQ,UACV,OAAO,YAAY,IAAI,EAAE,KAAK,SAAS,GAAG,CAAC;QAE3C,OAAO,YAAY,IAAI,QAAQ;EAEnC;EACA,YAAY,aAAa,WAAW,IAAI,QAAQ;EAChD,6BAA6B;CAC/B;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"message-part-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/message-part-runtime-client.ts"],"mappings":";;;;cAKa,iBAAA,GAAiB,KAAA;WACH,kBAAA;AAAA;WAAA,kBAAA;AAAA"}
1
+ {"version":3,"file":"message-part-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/message-part-runtime-client.ts"],"mappings":";;;;cAKa,iBAAA,GAAiB,KAAA;WAGnB,kBAAA;AAAA;WAAA,kBAAA;AAAA"}
@@ -1,8 +1,8 @@
1
- import { tapSubscribable } from "./tap-subscribable.js";
1
+ import { useSubscribable } from "./useSubscribable.js";
2
2
  import { resource } from "@assistant-ui/tap";
3
3
  //#region src/store/runtime-clients/message-part-runtime-client.ts
4
- const MessagePartClient = resource(({ runtime }) => {
5
- const state = tapSubscribable(runtime);
4
+ const MessagePartClient = resource(function MessagePartClient({ runtime }) {
5
+ const state = useSubscribable(runtime);
6
6
  return {
7
7
  getState: () => state,
8
8
  addToolResult: (result) => runtime.addToolResult(result),
@@ -1 +1 @@
1
- {"version":3,"file":"message-part-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/message-part-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { MessagePartRuntime } from \"../../runtime/api/message-part-runtime\";\nimport { tapSubscribable } from \"./tap-subscribable\";\n\nexport const MessagePartClient = resource(\n ({ runtime }: { runtime: MessagePartRuntime }): ClientOutput<\"part\"> => {\n const state = tapSubscribable(runtime);\n\n return {\n getState: () => state,\n addToolResult: (result) => runtime.addToolResult(result),\n resumeToolCall: (payload) => runtime.resumeToolCall(payload),\n respondToToolApproval: (response) =>\n runtime.respondToToolApproval(response),\n __internal_getRuntime: () => runtime,\n };\n },\n);\n"],"mappings":";;;AAKA,MAAa,oBAAoB,UAC9B,EAAE,cAAqE;CACtE,MAAM,QAAQ,gBAAgB,OAAO;CAErC,OAAO;EACL,gBAAgB;EAChB,gBAAgB,WAAW,QAAQ,cAAc,MAAM;EACvD,iBAAiB,YAAY,QAAQ,eAAe,OAAO;EAC3D,wBAAwB,aACtB,QAAQ,sBAAsB,QAAQ;EACxC,6BAA6B;CAC/B;AACF,CACF"}
1
+ {"version":3,"file":"message-part-runtime-client.js","names":[],"sources":["../../../src/store/runtime-clients/message-part-runtime-client.ts"],"sourcesContent":["import { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport type { MessagePartRuntime } from \"../../runtime/api/message-part-runtime\";\nimport { useSubscribable } from \"./useSubscribable\";\n\nexport const MessagePartClient = resource(function MessagePartClient({\n runtime,\n}: {\n runtime: MessagePartRuntime;\n}): ClientOutput<\"part\"> {\n const state = useSubscribable(runtime);\n\n return {\n getState: () => state,\n addToolResult: (result) => runtime.addToolResult(result),\n resumeToolCall: (payload) => runtime.resumeToolCall(payload),\n respondToToolApproval: (response) =>\n runtime.respondToToolApproval(response),\n __internal_getRuntime: () => runtime,\n };\n});\n"],"mappings":";;;AAKA,MAAa,oBAAoB,SAAS,SAAS,kBAAkB,EACnE,WAGuB;CACvB,MAAM,QAAQ,gBAAgB,OAAO;CAErC,OAAO;EACL,gBAAgB;EAChB,gBAAgB,WAAW,QAAQ,cAAc,MAAM;EACvD,iBAAiB,YAAY,QAAQ,eAAe,OAAO;EAC3D,wBAAwB,aACtB,QAAQ,sBAAsB,QAAQ;EACxC,6BAA6B;CAC/B;AACF,CAAC"}
@@ -1,14 +1,17 @@
1
1
  import { MessageRuntime } from "../../runtime/api/message-runtime.js";
2
2
  import { ClientOutput } from "@assistant-ui/store";
3
- import { tapRef } from "@assistant-ui/tap";
4
3
 
5
4
  //#region src/store/runtime-clients/message-runtime-client.d.ts
6
5
  declare const MessageClient: (props: {
7
6
  runtime: MessageRuntime;
8
- threadIdRef: tapRef.RefObject<string>;
7
+ threadIdRef: {
8
+ current: string;
9
+ };
9
10
  }) => import("@assistant-ui/tap").ResourceElement<ClientOutput<"message">, {
10
11
  runtime: MessageRuntime;
11
- threadIdRef: tapRef.RefObject<string>;
12
+ threadIdRef: {
13
+ current: string;
14
+ };
12
15
  }>;
13
16
  //#endregion
14
17
  export { MessageClient };
@@ -1 +1 @@
1
- {"version":3,"file":"message-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/message-runtime-client.ts"],"mappings":";;;;;cAwCa,aAAA,GAAa,KAAA;WAKb,cAAA;eACI,MAAA,CAAO,SAAA;AAAA;WADX,cAAA;eACI,MAAA,CAAO,SAAA;AAAA"}
1
+ {"version":3,"file":"message-runtime-client.d.ts","names":[],"sources":["../../../src/store/runtime-clients/message-runtime-client.ts"],"mappings":";;;;cA4Ca,aAAA,GAAa,KAAA;WAIf,cAAA;;IACM,OAAA;EAAA;AAAA;WADN,cAAA;;IACM,OAAA;EAAA;AAAA"}