@assistant-ui/core 0.3.19 → 0.3.21

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 (934) hide show
  1. package/dist/adapters/attachment.d.ts +50 -43
  2. package/dist/adapters/attachment.d.ts.map +1 -1
  3. package/dist/adapters/attachment.js +52 -21
  4. package/dist/adapters/attachment.js.map +1 -1
  5. package/dist/adapters/directive-formatter.d.ts +2 -5
  6. package/dist/adapters/directive-formatter.d.ts.map +1 -1
  7. package/dist/adapters/feedback.d.ts +7 -8
  8. package/dist/adapters/feedback.d.ts.map +1 -1
  9. package/dist/adapters/index.d.ts +14 -9
  10. package/dist/adapters/index.d.ts.map +1 -0
  11. package/dist/adapters/index.js +1 -1
  12. package/dist/adapters/speech.d.ts +63 -65
  13. package/dist/adapters/speech.d.ts.map +1 -1
  14. package/dist/adapters/speech.js +16 -2
  15. package/dist/adapters/speech.js.map +1 -1
  16. package/dist/adapters/suggestion.d.ts +19 -22
  17. package/dist/adapters/suggestion.d.ts.map +1 -1
  18. package/dist/adapters/thread-history.d.ts +60 -58
  19. package/dist/adapters/thread-history.d.ts.map +1 -1
  20. package/dist/adapters/trigger.d.ts +8 -11
  21. package/dist/adapters/trigger.d.ts.map +1 -1
  22. package/dist/adapters/voice.d.ts +50 -45
  23. package/dist/adapters/voice.d.ts.map +1 -1
  24. package/dist/adapters/voice.js +17 -3
  25. package/dist/adapters/voice.js.map +1 -1
  26. package/dist/index.d.ts +70 -56
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +6 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal/duplicate-detection.d.ts +1 -4
  31. package/dist/internal/duplicate-detection.d.ts.map +1 -1
  32. package/dist/internal.d.ts +27 -58
  33. package/dist/internal.d.ts.map +1 -0
  34. package/dist/internal.js +8 -6
  35. package/dist/model-context/frame/host.d.ts +20 -23
  36. package/dist/model-context/frame/host.d.ts.map +1 -1
  37. package/dist/model-context/frame/host.js +3 -1
  38. package/dist/model-context/frame/host.js.map +1 -1
  39. package/dist/model-context/frame/provider.d.ts +28 -30
  40. package/dist/model-context/frame/provider.d.ts.map +1 -1
  41. package/dist/model-context/frame/provider.js +6 -0
  42. package/dist/model-context/frame/provider.js.map +1 -1
  43. package/dist/model-context/frame/types.d.ts +24 -27
  44. package/dist/model-context/frame/types.d.ts.map +1 -1
  45. package/dist/model-context/frame/validate.d.ts +3 -0
  46. package/dist/model-context/frame/validate.d.ts.map +1 -0
  47. package/dist/model-context/frame/validate.js +26 -0
  48. package/dist/model-context/frame/validate.js.map +1 -0
  49. package/dist/model-context/interactable-composer-metadata.d.ts +51 -39
  50. package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -1
  51. package/dist/model-context/interactable-composer-metadata.js +30 -6
  52. package/dist/model-context/interactable-composer-metadata.js.map +1 -1
  53. package/dist/model-context/registry-handles.d.ts +9 -12
  54. package/dist/model-context/registry-handles.d.ts.map +1 -1
  55. package/dist/model-context/registry.d.ts +15 -18
  56. package/dist/model-context/registry.d.ts.map +1 -1
  57. package/dist/model-context/tool-call-text.d.ts +15 -17
  58. package/dist/model-context/tool-call-text.d.ts.map +1 -1
  59. package/dist/model-context/tool.d.ts +12 -14
  60. package/dist/model-context/tool.d.ts.map +1 -1
  61. package/dist/model-context/types.d.ts +40 -43
  62. package/dist/model-context/types.d.ts.map +1 -1
  63. package/dist/react/AssistantProvider.d.ts +9 -12
  64. package/dist/react/AssistantProvider.d.ts.map +1 -1
  65. package/dist/react/AssistantRuntimeProvider.d.ts +23 -26
  66. package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
  67. package/dist/react/RuntimeAdapter.d.ts +4 -8
  68. package/dist/react/RuntimeAdapter.d.ts.map +1 -1
  69. package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts +28 -23
  70. package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
  71. package/dist/react/adapters/LocalStorageThreadListAdapter.js +77 -58
  72. package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
  73. package/dist/react/adapters/TitleGenerationAdapter.d.ts +4 -7
  74. package/dist/react/adapters/TitleGenerationAdapter.d.ts.map +1 -1
  75. package/dist/react/client/AdaptedRemoteThread.d.ts +6 -9
  76. package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -1
  77. package/dist/react/client/DataRenderers.d.ts +2 -5
  78. package/dist/react/client/DataRenderers.d.ts.map +1 -1
  79. package/dist/react/client/InMemoryThreadList.d.ts +9 -12
  80. package/dist/react/client/InMemoryThreadList.d.ts.map +1 -1
  81. package/dist/react/client/Interactables.d.ts +3 -6
  82. package/dist/react/client/Interactables.d.ts.map +1 -1
  83. package/dist/react/client/Interactables.js +306 -101
  84. package/dist/react/client/Interactables.js.map +1 -1
  85. package/dist/react/client/RemoteThreadList.d.ts +34 -37
  86. package/dist/react/client/RemoteThreadList.d.ts.map +1 -1
  87. package/dist/react/client/RemoteThreadList.js +2 -1
  88. package/dist/react/client/RemoteThreadList.js.map +1 -1
  89. package/dist/react/client/Tools.d.ts +10 -12
  90. package/dist/react/client/Tools.d.ts.map +1 -1
  91. package/dist/react/client/Tools.js +4 -8
  92. package/dist/react/client/Tools.js.map +1 -1
  93. package/dist/react/client/interactable-model-context.d.ts +9 -11
  94. package/dist/react/client/interactable-model-context.d.ts.map +1 -1
  95. package/dist/react/client/interactable-model-context.js +32 -22
  96. package/dist/react/client/interactable-model-context.js.map +1 -1
  97. package/dist/react/index.d.ts +160 -122
  98. package/dist/react/index.d.ts.map +1 -0
  99. package/dist/react/index.js +5 -5
  100. package/dist/react/interactables-legacy/Interactables.d.ts +2 -5
  101. package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
  102. package/dist/react/interactables-legacy/Interactables.js +15 -8
  103. package/dist/react/interactables-legacy/Interactables.js.map +1 -1
  104. package/dist/react/interactables-legacy/interactable-model-context.d.ts +6 -9
  105. package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -1
  106. package/dist/react/interactables-legacy/interactable-model-context.js +13 -14
  107. package/dist/react/interactables-legacy/interactable-model-context.js.map +1 -1
  108. package/dist/react/interactables-legacy/scopes.d.ts +42 -46
  109. package/dist/react/interactables-legacy/scopes.d.ts.map +1 -1
  110. package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +8 -11
  111. package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -1
  112. package/dist/react/interactables-legacy/useInteractableState.d.ts +7 -9
  113. package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -1
  114. package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts +23 -14
  115. package/dist/react/interactables-shared/useInteractablePersistenceQueue.d.ts.map +1 -1
  116. package/dist/react/interactables-shared/useInteractablePersistenceQueue.js +54 -25
  117. package/dist/react/interactables-shared/useInteractablePersistenceQueue.js.map +1 -1
  118. package/dist/react/model-context/define-mcp-toolkit.d.ts +15 -18
  119. package/dist/react/model-context/define-mcp-toolkit.d.ts.map +1 -1
  120. package/dist/react/model-context/define-toolkit.d.ts +13 -6
  121. package/dist/react/model-context/define-toolkit.d.ts.map +1 -1
  122. package/dist/react/model-context/external-tool.d.ts +1 -4
  123. package/dist/react/model-context/external-tool.d.ts.map +1 -1
  124. package/dist/react/model-context/human-tool.d.ts +3 -6
  125. package/dist/react/model-context/human-tool.d.ts.map +1 -1
  126. package/dist/react/model-context/interactableTool.d.ts +26 -29
  127. package/dist/react/model-context/interactableTool.d.ts.map +1 -1
  128. package/dist/react/model-context/makeAssistantDataUI.d.ts +6 -9
  129. package/dist/react/model-context/makeAssistantDataUI.d.ts.map +1 -1
  130. package/dist/react/model-context/makeAssistantTool.d.ts +6 -9
  131. package/dist/react/model-context/makeAssistantTool.d.ts.map +1 -1
  132. package/dist/react/model-context/makeAssistantToolUI.d.ts +6 -9
  133. package/dist/react/model-context/makeAssistantToolUI.d.ts.map +1 -1
  134. package/dist/react/model-context/provider-tool.d.ts +5 -7
  135. package/dist/react/model-context/provider-tool.d.ts.map +1 -1
  136. package/dist/react/model-context/stub-tool.d.ts +1 -4
  137. package/dist/react/model-context/stub-tool.d.ts.map +1 -1
  138. package/dist/react/model-context/toolbox.d.ts +44 -32
  139. package/dist/react/model-context/toolbox.d.ts.map +1 -1
  140. package/dist/react/model-context/useAssistantContext.d.ts +3 -6
  141. package/dist/react/model-context/useAssistantContext.d.ts.map +1 -1
  142. package/dist/react/model-context/useAssistantDataUI.d.ts +7 -10
  143. package/dist/react/model-context/useAssistantDataUI.d.ts.map +1 -1
  144. package/dist/react/model-context/useAssistantInstructions.d.ts +3 -6
  145. package/dist/react/model-context/useAssistantInstructions.d.ts.map +1 -1
  146. package/dist/react/model-context/useAssistantTool.d.ts +9 -13
  147. package/dist/react/model-context/useAssistantTool.d.ts.map +1 -1
  148. package/dist/react/model-context/useAssistantToolUI.d.ts +13 -16
  149. package/dist/react/model-context/useAssistantToolUI.d.ts.map +1 -1
  150. package/dist/react/model-context/useAuiToolOverrides.d.ts +3 -5
  151. package/dist/react/model-context/useAuiToolOverrides.d.ts.map +1 -1
  152. package/dist/react/model-context/useInlineRender.d.ts +3 -6
  153. package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
  154. package/dist/react/model-context/useInteractable.d.ts +40 -40
  155. package/dist/react/model-context/useInteractable.d.ts.map +1 -1
  156. package/dist/react/model-context/useInteractableState.d.ts +10 -9
  157. package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
  158. package/dist/react/model-context/useInteractableVersions.d.ts +4 -7
  159. package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -1
  160. package/dist/react/model-context/useToolArgsStatus.d.ts +7 -9
  161. package/dist/react/model-context/useToolArgsStatus.d.ts.map +1 -1
  162. package/dist/react/primitive-hooks/useActionBarCopy.d.ts +7 -10
  163. package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
  164. package/dist/react/primitive-hooks/useActionBarEdit.d.ts +3 -6
  165. package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
  166. package/dist/react/primitive-hooks/useActionBarFeedback.d.ts +6 -9
  167. package/dist/react/primitive-hooks/useActionBarFeedback.d.ts.map +1 -1
  168. package/dist/react/primitive-hooks/useActionBarReload.d.ts +3 -6
  169. package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
  170. package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +3 -6
  171. package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -1
  172. package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +3 -6
  173. package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -1
  174. package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +3 -6
  175. package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
  176. package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +3 -6
  177. package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
  178. package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts +4 -7
  179. package/dist/react/primitive-hooks/useComposerAddAttachment.d.ts.map +1 -1
  180. package/dist/react/primitive-hooks/useComposerCancel.d.ts +3 -6
  181. package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
  182. package/dist/react/primitive-hooks/useComposerDictate.d.ts +3 -6
  183. package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -1
  184. package/dist/react/primitive-hooks/useComposerSend.d.ts +4 -7
  185. package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
  186. package/dist/react/primitive-hooks/useEditComposerCancel.d.ts +2 -5
  187. package/dist/react/primitive-hooks/useEditComposerCancel.d.ts.map +1 -1
  188. package/dist/react/primitive-hooks/useEditComposerSend.d.ts +3 -6
  189. package/dist/react/primitive-hooks/useEditComposerSend.d.ts.map +1 -1
  190. package/dist/react/primitive-hooks/useMessageBranching.d.ts +5 -8
  191. package/dist/react/primitive-hooks/useMessageBranching.d.ts.map +1 -1
  192. package/dist/react/primitive-hooks/useMessageError.d.ts +1 -4
  193. package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -1
  194. package/dist/react/primitive-hooks/useMessageReload.d.ts +3 -6
  195. package/dist/react/primitive-hooks/useMessageReload.d.ts.map +1 -1
  196. package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +7 -10
  197. package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
  198. package/dist/react/primitive-hooks/useSuggestionTrigger.js +4 -4
  199. package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
  200. package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +1 -4
  201. package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
  202. package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +1 -4
  203. package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
  204. package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +2 -5
  205. package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -1
  206. package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +2 -5
  207. package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -1
  208. package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +2 -5
  209. package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -1
  210. package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +2 -5
  211. package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -1
  212. package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts +3 -6
  213. package/dist/react/primitive-hooks/useThreadListLoadMore.d.ts.map +1 -1
  214. package/dist/react/primitive-hooks/useThreadListNew.d.ts +2 -5
  215. package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -1
  216. package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +1 -4
  217. package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -1
  218. package/dist/react/primitive-hooks/useThreadMessages.d.ts +2 -5
  219. package/dist/react/primitive-hooks/useThreadMessages.d.ts.map +1 -1
  220. package/dist/react/primitive-hooks/useVoice.d.ts +8 -11
  221. package/dist/react/primitive-hooks/useVoice.d.ts.map +1 -1
  222. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +27 -29
  223. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
  224. package/dist/react/primitives/composer/ComposerAttachments.d.ts +26 -28
  225. package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  226. package/dist/react/primitives/composer/ComposerIf.d.ts +13 -13
  227. package/dist/react/primitives/composer/ComposerIf.d.ts.map +1 -1
  228. package/dist/react/primitives/composer/ComposerQueue.d.ts +13 -17
  229. package/dist/react/primitives/composer/ComposerQueue.d.ts.map +1 -1
  230. package/dist/react/primitives/generativeUI/GenerativeUI.d.ts +30 -33
  231. package/dist/react/primitives/generativeUI/GenerativeUI.d.ts.map +1 -1
  232. package/dist/react/primitives/generativeUI/GenerativeUI.js +42 -33
  233. package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
  234. package/dist/react/primitives/message/MessageAttachments.d.ts +30 -28
  235. package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
  236. package/dist/react/primitives/message/MessageAttachments.js +14 -15
  237. package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
  238. package/dist/react/primitives/message/MessageGroupedParts.d.ts +122 -120
  239. package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
  240. package/dist/react/primitives/message/MessageGroupedParts.js +3 -3
  241. package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
  242. package/dist/react/primitives/message/MessageParts.d.ts +208 -194
  243. package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
  244. package/dist/react/primitives/message/MessageParts.js +124 -82
  245. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  246. package/dist/react/primitives/message/MessageQuote.d.ts +8 -11
  247. package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -1
  248. package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts +4 -7
  249. package/dist/react/primitives/messagePart/MessagePartInProgress.d.ts.map +1 -1
  250. package/dist/react/primitives/part/PartMessages.d.ts +16 -19
  251. package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
  252. package/dist/react/primitives/thread/ThreadMessages.d.ts +61 -64
  253. package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
  254. package/dist/react/primitives/thread/ThreadSuggestions.d.ts +25 -27
  255. package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
  256. package/dist/react/primitives/thread/ThreadSuggestions.js +24 -5
  257. package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
  258. package/dist/react/primitives/threadList/ThreadListItems.d.ts +26 -28
  259. package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  260. package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts +6 -9
  261. package/dist/react/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
  262. package/dist/react/providers/AttachmentByIndexProvider.d.ts +5 -8
  263. package/dist/react/providers/AttachmentByIndexProvider.d.ts.map +1 -1
  264. package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts +4 -7
  265. package/dist/react/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
  266. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts +3 -6
  267. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
  268. package/dist/react/providers/MessageByIdProvider.d.ts +3 -6
  269. package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -1
  270. package/dist/react/providers/MessageByIndexProvider.d.ts +3 -6
  271. package/dist/react/providers/MessageByIndexProvider.d.ts.map +1 -1
  272. package/dist/react/providers/PartByIndexProvider.d.ts +3 -6
  273. package/dist/react/providers/PartByIndexProvider.d.ts.map +1 -1
  274. package/dist/react/providers/QueueItemByIndexProvider.d.ts +4 -7
  275. package/dist/react/providers/QueueItemByIndexProvider.d.ts.map +1 -1
  276. package/dist/react/providers/ReadonlyThreadProvider.d.ts +7 -10
  277. package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -1
  278. package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
  279. package/dist/react/providers/SuggestionByIndexProvider.d.ts +4 -7
  280. package/dist/react/providers/SuggestionByIndexProvider.d.ts.map +1 -1
  281. package/dist/react/providers/TextMessagePartProvider.d.ts +4 -7
  282. package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
  283. package/dist/react/providers/TextMessagePartProvider.js +5 -1
  284. package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
  285. package/dist/react/providers/ThreadListItemByIndexProvider.d.ts +4 -7
  286. package/dist/react/providers/ThreadListItemByIndexProvider.d.ts.map +1 -1
  287. package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts +4 -8
  288. package/dist/react/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
  289. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +210 -219
  290. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  291. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +70 -46
  292. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  293. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +186 -198
  294. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  295. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +13 -4
  296. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  297. package/dist/react/runtimes/RemoteThreadResource.d.ts +17 -23
  298. package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -1
  299. package/dist/react/runtimes/RemoteThreadResource.js +3 -1
  300. package/dist/react/runtimes/RemoteThreadResource.js.map +1 -1
  301. package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +10 -11
  302. package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
  303. package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +11 -14
  304. package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -1
  305. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +6 -8
  306. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -1
  307. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +9 -2
  308. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -1
  309. package/dist/react/runtimes/assistant-transport/runManager.d.ts +9 -12
  310. package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -1
  311. package/dist/react/runtimes/assistant-transport/runManager.js +4 -1
  312. package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -1
  313. package/dist/react/runtimes/assistant-transport/types.d.ts +123 -118
  314. package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -1
  315. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +7 -10
  316. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
  317. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +17 -6
  318. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  319. package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +3 -6
  320. package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -1
  321. package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +2 -5
  322. package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -1
  323. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +7 -10
  324. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  325. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +426 -216
  326. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  327. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +15 -18
  328. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
  329. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +8 -4
  330. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
  331. package/dist/react/runtimes/cloud/auiV0.d.ts +146 -125
  332. package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
  333. package/dist/react/runtimes/cloud/auiV0.js +120 -8
  334. package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
  335. package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts +13 -15
  336. package/dist/react/runtimes/cloud/createCloudThreadListAdapter.d.ts.map +1 -1
  337. package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts +5 -7
  338. package/dist/react/runtimes/cloud/createCloudThreadListAdapterCreateFallback.d.ts.map +1 -1
  339. package/dist/react/runtimes/cloud/sdkIdentity.d.ts +2 -5
  340. package/dist/react/runtimes/cloud/sdkIdentity.d.ts.map +1 -1
  341. package/dist/react/runtimes/cloud/sdkIdentity.js +1 -1
  342. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts +3 -6
  343. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
  344. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +9 -11
  345. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
  346. package/dist/react/runtimes/createMessageConverter.d.ts +15 -19
  347. package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
  348. package/dist/react/runtimes/createMessageConverter.js.map +1 -1
  349. package/dist/react/runtimes/createRuntimeExtras.d.ts +14 -17
  350. package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -1
  351. package/dist/react/runtimes/external-message-converter.d.ts +17 -21
  352. package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
  353. package/dist/react/runtimes/external-store-history-copy.d.ts +25 -0
  354. package/dist/react/runtimes/external-store-history-copy.d.ts.map +1 -0
  355. package/dist/react/runtimes/external-store-history-copy.js +148 -0
  356. package/dist/react/runtimes/external-store-history-copy.js.map +1 -0
  357. package/dist/react/runtimes/useExternalStoreRuntime.d.ts +3 -6
  358. package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
  359. package/dist/react/runtimes/useExternalStoreRuntime.js +72 -35
  360. package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
  361. package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts +2 -5
  362. package/dist/react/runtimes/useExternalStoreSharedOptions.d.ts.map +1 -1
  363. package/dist/react/runtimes/useLocalRuntime.d.ts +29 -41
  364. package/dist/react/runtimes/useLocalRuntime.d.ts.map +1 -1
  365. package/dist/react/runtimes/useLocalRuntime.js +142 -34
  366. package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
  367. package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts +3 -6
  368. package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
  369. package/dist/react/runtimes/useRemoteThreadListRuntime.js +2 -2
  370. package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  371. package/dist/react/runtimes/useRuntimeAdapters.d.ts +5 -7
  372. package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -1
  373. package/dist/react/runtimes/useStreamingTiming.d.ts +4 -6
  374. package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -1
  375. package/dist/react/types/MessagePartComponentTypes.d.ts +72 -70
  376. package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
  377. package/dist/react/types/scopes/dataRenderers.d.ts +11 -15
  378. package/dist/react/types/scopes/dataRenderers.d.ts.map +1 -1
  379. package/dist/react/types/scopes/interactables.d.ts +60 -60
  380. package/dist/react/types/scopes/interactables.d.ts.map +1 -1
  381. package/dist/react/types/scopes/tools.d.ts +21 -24
  382. package/dist/react/types/scopes/tools.d.ts.map +1 -1
  383. package/dist/react/types/store-augmentation.d.ts +10 -11
  384. package/dist/react/types/store-augmentation.d.ts.map +1 -1
  385. package/dist/react/utils/getMessageQuote.d.ts +6 -8
  386. package/dist/react/utils/getMessageQuote.d.ts.map +1 -1
  387. package/dist/react/utils/groupParts.d.ts +35 -37
  388. package/dist/react/utils/groupParts.d.ts.map +1 -1
  389. package/dist/react/utils/useJSONEqual.d.ts +3 -6
  390. package/dist/react/utils/useJSONEqual.d.ts.map +1 -1
  391. package/dist/react/utils/useJSONSchemaDependency.d.ts +3 -6
  392. package/dist/react/utils/useJSONSchemaDependency.d.ts.map +1 -1
  393. package/dist/runtime/api/assistant-runtime.d.ts +28 -31
  394. package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
  395. package/dist/runtime/api/attachment-runtime.d.ts +51 -49
  396. package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
  397. package/dist/runtime/api/attachment-runtime.js.map +1 -1
  398. package/dist/runtime/api/bindings.d.ts +35 -35
  399. package/dist/runtime/api/bindings.d.ts.map +1 -1
  400. package/dist/runtime/api/composer-runtime.d.ts +215 -201
  401. package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
  402. package/dist/runtime/api/composer-runtime.js +4 -0
  403. package/dist/runtime/api/composer-runtime.js.map +1 -1
  404. package/dist/runtime/api/message-part-runtime.d.ts +31 -30
  405. package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
  406. package/dist/runtime/api/message-part-runtime.js +25 -2
  407. package/dist/runtime/api/message-part-runtime.js.map +1 -1
  408. package/dist/runtime/api/message-runtime.d.ts +87 -82
  409. package/dist/runtime/api/message-runtime.d.ts.map +1 -1
  410. package/dist/runtime/api/message-runtime.js +4 -3
  411. package/dist/runtime/api/message-runtime.js.map +1 -1
  412. package/dist/runtime/api/paths.d.ts +54 -57
  413. package/dist/runtime/api/paths.d.ts.map +1 -1
  414. package/dist/runtime/api/thread-list-item-runtime.d.ts +70 -72
  415. package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
  416. package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
  417. package/dist/runtime/api/thread-list-runtime.d.ts +77 -81
  418. package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
  419. package/dist/runtime/api/thread-list-runtime.js.map +1 -1
  420. package/dist/runtime/api/thread-runtime.d.ts +306 -308
  421. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  422. package/dist/runtime/api/thread-runtime.js +2 -1
  423. package/dist/runtime/api/thread-runtime.js.map +1 -1
  424. package/dist/runtime/base/base-assistant-runtime-core.d.ts +9 -12
  425. package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
  426. package/dist/runtime/base/base-composer-runtime-core.d.ts +150 -101
  427. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  428. package/dist/runtime/base/base-composer-runtime-core.js +400 -122
  429. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  430. package/dist/runtime/base/base-thread-runtime-core.d.ts +121 -104
  431. package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
  432. package/dist/runtime/base/base-thread-runtime-core.js +174 -62
  433. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  434. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +30 -31
  435. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
  436. package/dist/runtime/base/default-edit-composer-runtime-core.js +21 -2
  437. package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
  438. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +28 -31
  439. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  440. package/dist/runtime/base/default-thread-composer-runtime-core.js +23 -2
  441. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  442. package/dist/runtime/branch/external-thread-branch-adapter.d.ts +15 -18
  443. package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -1
  444. package/dist/runtime/interfaces/assistant-runtime-core.d.ts +8 -11
  445. package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
  446. package/dist/runtime/interfaces/composer-runtime-core.d.ts +98 -83
  447. package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
  448. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +67 -70
  449. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
  450. package/dist/runtime/interfaces/thread-runtime-core.d.ts +225 -211
  451. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  452. package/dist/runtime/internal.d.ts +25 -20
  453. package/dist/runtime/internal.d.ts.map +1 -0
  454. package/dist/runtime/queue/external-thread-queue-adapter.d.ts +37 -40
  455. package/dist/runtime/queue/external-thread-queue-adapter.d.ts.map +1 -1
  456. package/dist/runtime/queue/message-queue.d.ts +32 -33
  457. package/dist/runtime/queue/message-queue.d.ts.map +1 -1
  458. package/dist/runtime/queue/message-queue.js +10 -2
  459. package/dist/runtime/queue/message-queue.js.map +1 -1
  460. package/dist/runtime/queue/queue-item.d.ts +7 -10
  461. package/dist/runtime/queue/queue-item.d.ts.map +1 -1
  462. package/dist/runtime/utils/abortable-thread-load.d.ts +9 -11
  463. package/dist/runtime/utils/abortable-thread-load.d.ts.map +1 -1
  464. package/dist/runtime/utils/attachment-add-operations.d.ts +16 -15
  465. package/dist/runtime/utils/attachment-add-operations.d.ts.map +1 -1
  466. package/dist/runtime/utils/attachment-add-operations.js +24 -2
  467. package/dist/runtime/utils/attachment-add-operations.js.map +1 -1
  468. package/dist/runtime/utils/attachment-send-operations.d.ts +12 -0
  469. package/dist/runtime/utils/attachment-send-operations.d.ts.map +1 -0
  470. package/dist/runtime/utils/attachment-send-operations.js +34 -0
  471. package/dist/runtime/utils/attachment-send-operations.js.map +1 -0
  472. package/dist/runtime/utils/auto-status.d.ts +11 -13
  473. package/dist/runtime/utils/auto-status.d.ts.map +1 -1
  474. package/dist/runtime/utils/auto-status.js +3 -5
  475. package/dist/runtime/utils/auto-status.js.map +1 -1
  476. package/dist/runtime/utils/chat-model-adapter.d.ts +31 -33
  477. package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
  478. package/dist/runtime/utils/external-message-conversion.d.ts +47 -48
  479. package/dist/runtime/utils/external-message-conversion.d.ts.map +1 -1
  480. package/dist/runtime/utils/external-message-conversion.js +6 -5
  481. package/dist/runtime/utils/external-message-conversion.js.map +1 -1
  482. package/dist/runtime/utils/external-store-message.d.ts +6 -9
  483. package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
  484. package/dist/runtime/utils/message-repository-session.d.ts +24 -27
  485. package/dist/runtime/utils/message-repository-session.d.ts.map +1 -1
  486. package/dist/runtime/utils/message-repository.d.ts +52 -54
  487. package/dist/runtime/utils/message-repository.d.ts.map +1 -1
  488. package/dist/runtime/utils/message-repository.js +8 -7
  489. package/dist/runtime/utils/message-repository.js.map +1 -1
  490. package/dist/runtime/utils/pending-tool-calls.d.ts +12 -14
  491. package/dist/runtime/utils/pending-tool-calls.d.ts.map +1 -1
  492. package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +7 -10
  493. package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -1
  494. package/dist/runtime/utils/runtime-extras-brand.d.ts +6 -9
  495. package/dist/runtime/utils/runtime-extras-brand.d.ts.map +1 -1
  496. package/dist/runtime/utils/stored-message-parts.d.ts +21 -0
  497. package/dist/runtime/utils/stored-message-parts.d.ts.map +1 -0
  498. package/dist/runtime/utils/stored-message-parts.js +103 -0
  499. package/dist/runtime/utils/stored-message-parts.js.map +1 -0
  500. package/dist/runtime/utils/streaming-timing.d.ts +23 -26
  501. package/dist/runtime/utils/streaming-timing.d.ts.map +1 -1
  502. package/dist/runtime/utils/thread-message-like.d.ts +38 -34
  503. package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
  504. package/dist/runtime/utils/thread-message-like.js +16 -6
  505. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  506. package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +5 -7
  507. package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -1
  508. package/dist/runtime/utils/thread-runtime-lifecycle.js +31 -4
  509. package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -1
  510. package/dist/runtime/utils/tool-call-tree.d.ts +10 -13
  511. package/dist/runtime/utils/tool-call-tree.d.ts.map +1 -1
  512. package/dist/runtime/utils/tool-interactions.d.ts +10 -0
  513. package/dist/runtime/utils/tool-interactions.d.ts.map +1 -0
  514. package/dist/runtime/utils/tool-interactions.js +92 -0
  515. package/dist/runtime/utils/tool-interactions.js.map +1 -0
  516. package/dist/runtimes/assistant-transport/utils.d.ts +1 -4
  517. package/dist/runtimes/assistant-transport/utils.d.ts.map +1 -1
  518. package/dist/runtimes/external-store/external-store-adapter.d.ts +220 -200
  519. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  520. package/dist/runtimes/external-store/external-store-runtime-core.d.ts +6 -8
  521. package/dist/runtimes/external-store/external-store-runtime-core.d.ts.map +1 -1
  522. package/dist/runtimes/external-store/external-store-runtime-core.js +4 -1
  523. package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
  524. package/dist/runtimes/external-store/external-store-shared-options.d.ts +3 -6
  525. package/dist/runtimes/external-store/external-store-shared-options.d.ts.map +1 -1
  526. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +40 -43
  527. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
  528. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +2 -2
  529. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
  530. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +119 -125
  531. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  532. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +71 -18
  533. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  534. package/dist/runtimes/external-store/thread-message-converter.d.ts +5 -8
  535. package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
  536. package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +96 -98
  537. package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -1
  538. package/dist/runtimes/inert/InertThreadRuntimeCore.js +3 -0
  539. package/dist/runtimes/inert/InertThreadRuntimeCore.js.map +1 -1
  540. package/dist/runtimes/internal.d.ts +20 -16
  541. package/dist/runtimes/internal.d.ts.map +1 -0
  542. package/dist/runtimes/local/local-runtime-core.d.ts +7 -10
  543. package/dist/runtimes/local/local-runtime-core.d.ts.map +1 -1
  544. package/dist/runtimes/local/local-runtime-options.d.ts +41 -44
  545. package/dist/runtimes/local/local-runtime-options.d.ts.map +1 -1
  546. package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +42 -45
  547. package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
  548. package/dist/runtimes/local/local-thread-runtime-core.d.ts +94 -93
  549. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  550. package/dist/runtimes/local/local-thread-runtime-core.js +220 -29
  551. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  552. package/dist/runtimes/local/should-continue.d.ts +2 -5
  553. package/dist/runtimes/local/should-continue.d.ts.map +1 -1
  554. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +77 -55
  555. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
  556. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +28 -1
  557. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
  558. package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts +12 -15
  559. package/dist/runtimes/remote-thread-list/adapter/in-memory.d.ts.map +1 -1
  560. package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +3 -6
  561. package/dist/runtimes/remote-thread-list/adapter-changed.d.ts.map +1 -1
  562. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts +2 -5
  563. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
  564. package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +34 -31
  565. package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
  566. package/dist/runtimes/remote-thread-list/optimistic-state.js +8 -3
  567. package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
  568. package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +60 -63
  569. package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
  570. package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -1
  571. package/dist/runtimes/remote-thread-list/title-generation.d.ts +31 -33
  572. package/dist/runtimes/remote-thread-list/title-generation.d.ts.map +1 -1
  573. package/dist/runtimes/remote-thread-list/title.d.ts +5 -8
  574. package/dist/runtimes/remote-thread-list/title.d.ts.map +1 -1
  575. package/dist/runtimes/remote-thread-list/types.d.ts +119 -121
  576. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  577. package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +147 -149
  578. package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
  579. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +22 -7
  580. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
  581. package/dist/store/clients/chain-of-thought-client.d.ts +8 -11
  582. package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
  583. package/dist/store/clients/external-thread.d.ts +56 -58
  584. package/dist/store/clients/external-thread.d.ts.map +1 -1
  585. package/dist/store/clients/external-thread.js +1270 -741
  586. package/dist/store/clients/external-thread.js.map +1 -1
  587. package/dist/store/clients/model-context-client.d.ts +2 -5
  588. package/dist/store/clients/model-context-client.d.ts.map +1 -1
  589. package/dist/store/clients/no-op-composer-client.d.ts +3 -6
  590. package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
  591. package/dist/store/clients/no-op-composer-client.js +3 -1
  592. package/dist/store/clients/no-op-composer-client.js.map +1 -1
  593. package/dist/store/clients/runtime-adapter.d.ts +2 -5
  594. package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
  595. package/dist/store/clients/single-thread-list.d.ts +4 -6
  596. package/dist/store/clients/single-thread-list.d.ts.map +1 -1
  597. package/dist/store/clients/submission-message.d.ts +8 -0
  598. package/dist/store/clients/submission-message.d.ts.map +1 -0
  599. package/dist/store/clients/submission-message.js +22 -0
  600. package/dist/store/clients/submission-message.js.map +1 -0
  601. package/dist/store/clients/suggestions.d.ts +8 -11
  602. package/dist/store/clients/suggestions.d.ts.map +1 -1
  603. package/dist/store/clients/thread-message-client.d.ts +12 -12
  604. package/dist/store/clients/thread-message-client.d.ts.map +1 -1
  605. package/dist/store/clients/thread-message-client.js +81 -82
  606. package/dist/store/clients/thread-message-client.js.map +1 -1
  607. package/dist/store/clients/thread-selection-events.d.ts +1 -4
  608. package/dist/store/clients/thread-selection-events.d.ts.map +1 -1
  609. package/dist/store/clients/thread-tasks.d.ts +7 -10
  610. package/dist/store/clients/thread-tasks.d.ts.map +1 -1
  611. package/dist/store/env.d.ts +1 -4
  612. package/dist/store/env.d.ts.map +1 -1
  613. package/dist/store/index.d.ts +33 -36
  614. package/dist/store/index.d.ts.map +1 -0
  615. package/dist/store/index.js +5 -5
  616. package/dist/store/internal.d.ts +12 -12
  617. package/dist/store/internal.d.ts.map +1 -0
  618. package/dist/store/internal.js +2 -2
  619. package/dist/store/primitive-predicates.d.ts +14 -16
  620. package/dist/store/primitive-predicates.d.ts.map +1 -1
  621. package/dist/store/primitive-predicates.js +10 -5
  622. package/dist/store/primitive-predicates.js.map +1 -1
  623. package/dist/store/runtime-clients/attachment-runtime-client.d.ts +4 -7
  624. package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
  625. package/dist/store/runtime-clients/composer-runtime-client.d.ts +11 -14
  626. package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
  627. package/dist/store/runtime-clients/composer-runtime-client.js +65 -62
  628. package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
  629. package/dist/store/runtime-clients/handle-runtime-action.d.ts +1 -4
  630. package/dist/store/runtime-clients/handle-runtime-action.d.ts.map +1 -1
  631. package/dist/store/runtime-clients/handle-thread-list-action.d.ts +1 -4
  632. package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -1
  633. package/dist/store/runtime-clients/liveRef.d.ts +2 -5
  634. package/dist/store/runtime-clients/liveRef.d.ts.map +1 -1
  635. package/dist/store/runtime-clients/message-part-runtime-client.d.ts +4 -7
  636. package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
  637. package/dist/store/runtime-clients/message-part-runtime-client.js +26 -16
  638. package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
  639. package/dist/store/runtime-clients/message-runtime-client.d.ts +10 -11
  640. package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
  641. package/dist/store/runtime-clients/message-runtime-client.js +121 -113
  642. package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
  643. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +5 -8
  644. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
  645. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +6 -9
  646. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
  647. package/dist/store/runtime-clients/thread-runtime-client.d.ts +4 -7
  648. package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
  649. package/dist/store/runtime-clients/thread-runtime-client.js +221 -158
  650. package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
  651. package/dist/store/runtime-clients/useSubscribable.d.ts +3 -6
  652. package/dist/store/runtime-clients/useSubscribable.d.ts.map +1 -1
  653. package/dist/store/scope-registration.d.ts +28 -29
  654. package/dist/store/scope-registration.d.ts.map +1 -1
  655. package/dist/store/scopes/attachment.d.ts +19 -22
  656. package/dist/store/scopes/attachment.d.ts.map +1 -1
  657. package/dist/store/scopes/chain-of-thought.d.ts +33 -35
  658. package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
  659. package/dist/store/scopes/composer.d.ts +147 -135
  660. package/dist/store/scopes/composer.d.ts.map +1 -1
  661. package/dist/store/scopes/message.d.ts +119 -112
  662. package/dist/store/scopes/message.d.ts.map +1 -1
  663. package/dist/store/scopes/model-context.d.ts +10 -13
  664. package/dist/store/scopes/model-context.d.ts.map +1 -1
  665. package/dist/store/scopes/part.d.ts +53 -50
  666. package/dist/store/scopes/part.d.ts.map +1 -1
  667. package/dist/store/scopes/queue-item.d.ts +21 -23
  668. package/dist/store/scopes/queue-item.d.ts.map +1 -1
  669. package/dist/store/scopes/suggestion.d.ts +14 -17
  670. package/dist/store/scopes/suggestion.d.ts.map +1 -1
  671. package/dist/store/scopes/suggestions.d.ts +18 -21
  672. package/dist/store/scopes/suggestions.d.ts.map +1 -1
  673. package/dist/store/scopes/task.d.ts +27 -30
  674. package/dist/store/scopes/task.d.ts.map +1 -1
  675. package/dist/store/scopes/thread-list-item.d.ts +68 -71
  676. package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
  677. package/dist/store/scopes/thread.d.ts +197 -200
  678. package/dist/store/scopes/thread.d.ts.map +1 -1
  679. package/dist/store/scopes/threads.d.ts +49 -52
  680. package/dist/store/scopes/threads.d.ts.map +1 -1
  681. package/dist/subscribable/subscribable.d.ts +73 -69
  682. package/dist/subscribable/subscribable.d.ts.map +1 -1
  683. package/dist/subscribable/subscribable.js +35 -7
  684. package/dist/subscribable/subscribable.js.map +1 -1
  685. package/dist/types/attachment.d.ts +35 -37
  686. package/dist/types/attachment.d.ts.map +1 -1
  687. package/dist/types/augmentations.d.ts +7 -8
  688. package/dist/types/augmentations.d.ts.map +1 -1
  689. package/dist/types/directive.d.ts +13 -16
  690. package/dist/types/directive.d.ts.map +1 -1
  691. package/dist/types/error.d.ts +15 -17
  692. package/dist/types/error.d.ts.map +1 -1
  693. package/dist/types/index.d.ts +7 -7
  694. package/dist/types/index.d.ts.map +1 -0
  695. package/dist/types/message.d.ts +358 -318
  696. package/dist/types/message.d.ts.map +1 -1
  697. package/dist/types/message.js.map +1 -1
  698. package/dist/types/quote.d.ts +3 -6
  699. package/dist/types/quote.d.ts.map +1 -1
  700. package/dist/types/trigger.d.ts +10 -13
  701. package/dist/types/trigger.d.ts.map +1 -1
  702. package/dist/types/unsubscribe.d.ts +1 -4
  703. package/dist/types/unsubscribe.d.ts.map +1 -1
  704. package/dist/utils/abortable-iterable.d.ts +2 -5
  705. package/dist/utils/abortable-iterable.d.ts.map +1 -1
  706. package/dist/utils/composite-context-provider.d.ts +9 -13
  707. package/dist/utils/composite-context-provider.d.ts.map +1 -1
  708. package/dist/utils/data-url.d.ts +16 -19
  709. package/dist/utils/data-url.d.ts.map +1 -1
  710. package/dist/utils/getGroupStatus.d.ts +19 -21
  711. package/dist/utils/getGroupStatus.d.ts.map +1 -1
  712. package/dist/utils/id.d.ts +3 -6
  713. package/dist/utils/id.d.ts.map +1 -1
  714. package/dist/utils/image-media-type.d.ts +1 -4
  715. package/dist/utils/image-media-type.d.ts.map +1 -1
  716. package/dist/utils/invoke-user-callback.d.ts +1 -4
  717. package/dist/utils/invoke-user-callback.d.ts.map +1 -1
  718. package/dist/utils/json/is-json-equal.d.ts +1 -4
  719. package/dist/utils/json/is-json-equal.d.ts.map +1 -1
  720. package/dist/utils/json/is-json.d.ts +5 -8
  721. package/dist/utils/json/is-json.d.ts.map +1 -1
  722. package/dist/utils/json/stable-stringify-tool-args.d.ts +3 -6
  723. package/dist/utils/json/stable-stringify-tool-args.d.ts.map +1 -1
  724. package/dist/utils/normalizePartStatus.d.ts +6 -8
  725. package/dist/utils/normalizePartStatus.d.ts.map +1 -1
  726. package/dist/utils/normalizePartStatus.js +3 -2
  727. package/dist/utils/normalizePartStatus.js.map +1 -1
  728. package/dist/utils/notify-event-listeners.d.ts +2 -4
  729. package/dist/utils/notify-event-listeners.d.ts.map +1 -1
  730. package/dist/utils/record.d.ts +1 -4
  731. package/dist/utils/record.d.ts.map +1 -1
  732. package/dist/utils/silent-runtime-action.d.ts +2 -5
  733. package/dist/utils/silent-runtime-action.d.ts.map +1 -1
  734. package/dist/utils/text.d.ts +2 -5
  735. package/dist/utils/text.d.ts.map +1 -1
  736. package/dist/utils/wire-media.d.ts +3 -6
  737. package/dist/utils/wire-media.d.ts.map +1 -1
  738. package/package.json +15 -13
  739. package/src/adapters/attachment.test.ts +98 -1
  740. package/src/adapters/attachment.ts +77 -20
  741. package/src/adapters/feedback.ts +1 -0
  742. package/src/adapters/speech.test.ts +94 -0
  743. package/src/adapters/speech.ts +16 -2
  744. package/src/adapters/thread-history.ts +16 -5
  745. package/src/adapters/voice.test.ts +169 -0
  746. package/src/adapters/voice.ts +25 -4
  747. package/src/index.ts +14 -2
  748. package/src/internal.ts +7 -0
  749. package/src/model-context/frame/host.test.ts +51 -1
  750. package/src/model-context/frame/host.ts +3 -1
  751. package/src/model-context/frame/provider.test.ts +106 -20
  752. package/src/model-context/frame/provider.ts +8 -1
  753. package/src/model-context/frame/validate.ts +57 -0
  754. package/src/model-context/interactable-composer-metadata.test.ts +82 -0
  755. package/src/model-context/interactable-composer-metadata.ts +45 -2
  756. package/src/react/RuntimeAdapter.test.ts +4 -1
  757. package/src/react/adapters/LocalStorageThreadListAdapter.test.ts +711 -0
  758. package/src/react/adapters/LocalStorageThreadListAdapter.tsx +125 -109
  759. package/src/react/client/Interactables.test.ts +865 -8
  760. package/src/react/client/Interactables.ts +325 -45
  761. package/src/react/client/RemoteThreadList.concurrent.test.tsx +9 -3
  762. package/src/react/client/RemoteThreadList.initialize-failure.test.ts +124 -0
  763. package/src/react/client/RemoteThreadList.test.ts +5 -6
  764. package/src/react/client/RemoteThreadList.ts +6 -0
  765. package/src/react/client/Tools.ts +2 -3
  766. package/src/react/client/interactable-model-context.test.ts +56 -13
  767. package/src/react/client/interactable-model-context.ts +48 -23
  768. package/src/react/index.ts +2 -2
  769. package/src/react/interactables-legacy/Interactables.test.ts +221 -4
  770. package/src/react/interactables-legacy/Interactables.ts +25 -14
  771. package/src/react/interactables-legacy/interactable-model-context.ts +26 -24
  772. package/src/react/interactables-legacy/useAssistantInteractable.test.tsx +40 -22
  773. package/src/react/interactables-shared/useInteractablePersistenceQueue.test.tsx +22 -2
  774. package/src/react/interactables-shared/useInteractablePersistenceQueue.ts +63 -11
  775. package/src/react/model-context/useInteractable.test.tsx +56 -29
  776. package/src/react/primitive-hooks/useActionBarCopy.test.ts +5 -5
  777. package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +33 -0
  778. package/src/react/primitive-hooks/useSuggestionTrigger.ts +7 -4
  779. package/src/react/primitives/generativeUI/GenerativeUI.test.tsx +170 -0
  780. package/src/react/primitives/generativeUI/GenerativeUI.tsx +43 -28
  781. package/src/react/primitives/message/MessageAttachments.test.tsx +2 -6
  782. package/src/react/primitives/message/MessageAttachments.tsx +14 -8
  783. package/src/react/primitives/message/MessageGroupedParts.test.tsx +155 -8
  784. package/src/react/primitives/message/MessageGroupedParts.tsx +19 -6
  785. package/src/react/primitives/message/MessageParts.test.tsx +84 -0
  786. package/src/react/primitives/message/MessageParts.tool-interaction.test.tsx +69 -0
  787. package/src/react/primitives/message/MessageParts.tsx +29 -8
  788. package/src/react/primitives/thread/ThreadMessages.test.tsx +25 -7
  789. package/src/react/primitives/thread/ThreadSuggestions.test.tsx +97 -0
  790. package/src/react/primitives/thread/ThreadSuggestions.tsx +29 -6
  791. package/src/react/providers/ReadonlyThreadProvider.tsx +2 -2
  792. package/src/react/providers/TextMessagePartProvider.tsx +3 -0
  793. package/src/react/runtimes/RemoteThreadListHookInstanceManager.layout.test.tsx +62 -0
  794. package/src/react/runtimes/RemoteThreadListHookInstanceManager.retry.test.tsx +2 -2
  795. package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +93 -0
  796. package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +181 -21
  797. package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +62 -17
  798. package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +112 -77
  799. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +19 -3
  800. package/src/react/runtimes/RemoteThreadResource.ts +5 -2
  801. package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +3 -1
  802. package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +10 -2
  803. package/src/react/runtimes/assistant-transport/runManager.ts +3 -0
  804. package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +57 -0
  805. package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +73 -46
  806. package/src/react/runtimes/assistant-transport/transport-thread-id.test.tsx +571 -0
  807. package/src/react/runtimes/assistant-transport/types.ts +9 -1
  808. package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +10 -0
  809. package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +108 -1
  810. package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +33 -9
  811. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.integration.test.tsx +289 -0
  812. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.copy.test.tsx +471 -0
  813. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.engagement.test.tsx +330 -0
  814. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.ts +78 -2
  815. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +463 -2
  816. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +595 -227
  817. package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.test.ts +33 -4
  818. package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +7 -3
  819. package/src/react/runtimes/cloud/auiV0.ts +275 -6
  820. package/src/react/runtimes/cloud/auiV0DecodeSafely.test.ts +873 -0
  821. package/src/react/runtimes/createMessageConverter.ts +9 -3
  822. package/src/react/runtimes/external-message-converter.test.ts +7 -3
  823. package/src/react/runtimes/external-store-history-copy.ts +223 -0
  824. package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +2 -1
  825. package/src/react/runtimes/useExternalStoreRuntime.history-copy.test.tsx +483 -0
  826. package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +84 -3
  827. package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +6 -2
  828. package/src/react/runtimes/useExternalStoreRuntime.ts +25 -5
  829. package/src/react/runtimes/useLocalRuntime.test.tsx +145 -1
  830. package/src/react/runtimes/useLocalRuntime.ts +8 -5
  831. package/src/react/runtimes/useRemoteThreadListRuntime.concurrent.test.tsx +84 -4
  832. package/src/react/runtimes/useRemoteThreadListRuntime.ts +5 -1
  833. package/src/react/types/MessagePartComponentTypes.ts +10 -0
  834. package/src/react/types/scopes/interactables.ts +3 -0
  835. package/src/runtime/api/attachment-runtime.ts +10 -5
  836. package/src/runtime/api/bindings.ts +6 -1
  837. package/src/runtime/api/composer-runtime.ts +29 -6
  838. package/src/runtime/api/message-part-runtime.test.ts +215 -0
  839. package/src/runtime/api/message-part-runtime.ts +44 -1
  840. package/src/runtime/api/message-runtime.test.ts +112 -2
  841. package/src/runtime/api/message-runtime.ts +25 -7
  842. package/src/runtime/api/thread-list-item-runtime.ts +5 -5
  843. package/src/runtime/api/thread-list-runtime.ts +3 -3
  844. package/src/runtime/api/thread-runtime.test.ts +59 -0
  845. package/src/runtime/api/thread-runtime.ts +21 -11
  846. package/src/runtime/base/base-composer-runtime-core.ts +548 -153
  847. package/src/runtime/base/base-thread-runtime-core.test.ts +1614 -136
  848. package/src/runtime/base/base-thread-runtime-core.ts +236 -46
  849. package/src/runtime/base/default-edit-composer-runtime-core.ts +24 -2
  850. package/src/runtime/base/default-thread-composer-runtime-core.ts +33 -3
  851. package/src/runtime/interfaces/composer-runtime-core.ts +19 -0
  852. package/src/runtime/interfaces/thread-runtime-core.ts +24 -1
  853. package/src/runtime/queue/message-queue.ts +11 -1
  854. package/src/runtime/utils/attachment-add-operations.ts +45 -2
  855. package/src/runtime/utils/attachment-send-operations.ts +54 -0
  856. package/src/runtime/utils/auto-status.test.ts +54 -0
  857. package/src/runtime/utils/auto-status.ts +3 -10
  858. package/src/runtime/utils/external-message-conversion.test.ts +91 -0
  859. package/src/runtime/utils/external-message-conversion.ts +9 -6
  860. package/src/runtime/utils/message-repository.test.ts +69 -1
  861. package/src/runtime/utils/message-repository.ts +14 -7
  862. package/src/runtime/utils/stored-message-parts.ts +216 -0
  863. package/src/runtime/utils/thread-message-like.test.ts +58 -0
  864. package/src/runtime/utils/thread-message-like.ts +79 -48
  865. package/src/runtime/utils/thread-runtime-lifecycle.test.ts +67 -0
  866. package/src/runtime/utils/thread-runtime-lifecycle.ts +42 -8
  867. package/src/runtime/utils/tool-interactions.test.ts +193 -0
  868. package/src/runtime/utils/tool-interactions.ts +147 -0
  869. package/src/runtimes/external-store/external-store-adapter.ts +25 -0
  870. package/src/runtimes/external-store/external-store-runtime-core.ts +10 -2
  871. package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +2 -2
  872. package/src/runtimes/external-store/external-store-thread-runtime-core.test.ts +49 -0
  873. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +114 -32
  874. package/src/runtimes/inert/InertThreadRuntimeCore.test.ts +127 -56
  875. package/src/runtimes/inert/InertThreadRuntimeCore.ts +10 -1
  876. package/src/runtimes/local/local-thread-runtime-core.edit-cancellation.test.ts +70 -0
  877. package/src/runtimes/local/local-thread-runtime-core.test.ts +1866 -169
  878. package/src/runtimes/local/local-thread-runtime-core.ts +365 -40
  879. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +53 -1
  880. package/src/runtimes/remote-thread-list/optimistic-state.ts +8 -3
  881. package/src/runtimes/tool-invocations/EDGE_CASES.md +19 -4
  882. package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +392 -39
  883. package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +31 -8
  884. package/src/store/clients/external-thread.test.ts +145 -0
  885. package/src/store/clients/external-thread.ts +669 -144
  886. package/src/store/clients/model-context-client.test.ts +8 -8
  887. package/src/store/clients/no-op-composer-client.ts +2 -0
  888. package/src/store/clients/submission-message.ts +27 -0
  889. package/src/store/clients/thread-message-client.test.ts +39 -0
  890. package/src/store/clients/thread-message-client.ts +13 -6
  891. package/src/store/index.ts +2 -2
  892. package/src/store/internal.ts +1 -0
  893. package/src/store/primitive-predicates.test.ts +119 -0
  894. package/src/store/primitive-predicates.ts +19 -4
  895. package/src/store/runtime-clients/composer-runtime-client.ts +4 -3
  896. package/src/store/runtime-clients/message-part-runtime-client.test.ts +42 -0
  897. package/src/store/runtime-clients/message-part-runtime-client.ts +4 -0
  898. package/src/store/runtime-clients/message-runtime-client.ts +5 -0
  899. package/src/store/runtime-clients/thread-runtime-client.test.tsx +243 -0
  900. package/src/store/runtime-clients/thread-runtime-client.ts +46 -9
  901. package/src/store/scopes/composer.ts +22 -4
  902. package/src/store/scopes/message.ts +12 -1
  903. package/src/store/scopes/part.ts +8 -0
  904. package/src/subscribable/subscribable.test.ts +205 -3
  905. package/src/subscribable/subscribable.ts +49 -7
  906. package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +95 -1
  907. package/src/tests/attachment-adapters.test.ts +16 -1
  908. package/src/tests/auiV0Encode.test.ts +412 -1
  909. package/src/tests/base-composer-runtime-core-addAttachment.test.ts +6 -6
  910. package/src/tests/base-composer-runtime-core-send.test.ts +722 -29
  911. package/src/tests/base-composer-runtime-core.test.ts +212 -5
  912. package/src/tests/composer-can-cancel.test.ts +35 -6
  913. package/src/tests/composer-can-send.test.ts +120 -1
  914. package/src/tests/composer-submission.test.tsx +796 -0
  915. package/src/tests/default-edit-composer-runtime-core.test.ts +149 -2
  916. package/src/tests/external-store-thread-list-runtime-core.test.ts +111 -0
  917. package/src/tests/external-store-thread-runtime-core-adapter.test.ts +810 -28
  918. package/src/tests/external-store-thread-runtime-core.test.ts +217 -0
  919. package/src/tests/external-thread-attachments.test.tsx +763 -26
  920. package/src/tests/external-thread-feedback.test.tsx +20 -7
  921. package/src/tests/external-thread-isLast.test.tsx +69 -0
  922. package/src/tests/external-thread-parity.test.tsx +1 -1
  923. package/src/tests/get-thread-state-isRunning.test.ts +2 -2
  924. package/src/tests/message-queue.test.ts +45 -10
  925. package/src/tests/remote-thread-list-adapter-switch.test.ts +45 -1
  926. package/src/tests/thread-switch-events.test.tsx +11 -7
  927. package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +2 -1
  928. package/src/types/message.test.ts +19 -0
  929. package/src/types/message.ts +65 -10
  930. package/src/utils/normalizePartStatus.ts +14 -1
  931. package/dist/tests/remote-thread-list-test-helpers.d.ts +0 -16
  932. package/dist/tests/remote-thread-list-test-helpers.d.ts.map +0 -1
  933. package/dist/tests/remote-thread-list-test-helpers.js +0 -59
  934. package/dist/tests/remote-thread-list-test-helpers.js.map +0 -1
@@ -6,8 +6,11 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
6
6
  get canCancel() {
7
7
  return true;
8
8
  }
9
+ get detachesDraftOnSend() {
10
+ return false;
11
+ }
9
12
  get canSend() {
10
- return !this.isEmpty && !this._isSending;
13
+ return !this.isEmpty && !this.runtime.voice && !this.isSubmitting;
11
14
  }
12
15
  getAttachmentAdapter() {
13
16
  return this.runtime.adapters?.attachments;
@@ -20,10 +23,21 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
20
23
  _sourceId;
21
24
  runtime;
22
25
  endEditCallback;
26
+ _ended = false;
23
27
  constructor(runtime, endEditCallback, { parentId, message }) {
24
28
  super();
25
29
  this.runtime = runtime;
26
- this.endEditCallback = endEditCallback;
30
+ let lastHasVoice = runtime.voice !== void 0;
31
+ const unsubscribe = runtime.subscribe(() => {
32
+ const hasVoice = runtime.voice !== void 0;
33
+ if (hasVoice === lastHasVoice) return;
34
+ lastHasVoice = hasVoice;
35
+ this._notifySubscribers();
36
+ });
37
+ this.endEditCallback = () => {
38
+ unsubscribe();
39
+ endEditCallback();
40
+ };
27
41
  this._parentId = parentId;
28
42
  this._sourceId = message.id;
29
43
  this.setText(getThreadMessageText(message));
@@ -58,6 +72,11 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
58
72
  return appendTask;
59
73
  }
60
74
  handleCancel() {
75
+ if (this._ended) return;
76
+ this._ended = true;
77
+ this.reset().catch((error) => {
78
+ console.error("[assistant-ui] Failed to clear cancelled edit", error);
79
+ });
61
80
  this.endEditCallback();
62
81
  this._notifySubscribers();
63
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"default-edit-composer-runtime-core.js","names":["AppendMessage","ThreadMessage","CompleteAttachment","getThreadMessageText","liftNonTextParts","AttachmentAdapter","DictationAdapter","SendOptions","ThreadRuntimeCore","BaseComposerRuntimeCore","DefaultEditComposerRuntimeCore","canCancel","canSend","isEmpty","_isSending","getAttachmentAdapter","runtime","adapters","attachments","getDictationAdapter","dictation","_nonTextPassthrough","_parentId","_sourceId","endEditCallback","constructor","parentId","message","id","setText","setRole","role","content","filter","p","type","setAttachments","setRunConfig","composer","runConfig","sourceId","handleSend","Omit","options","length","appendTask","append","startRun","handleCancel","_notifySubscribers"],"sources":["../../../src/runtime/base/default-edit-composer-runtime-core.ts"],"sourcesContent":["import type { AppendMessage, ThreadMessage } from \"../../types/message\";\nimport type { CompleteAttachment } from \"../../types/attachment\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport { liftNonTextParts } from \"../../adapters/attachment\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type { SendOptions } from \"../interfaces/composer-runtime-core\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n public get canSend() {\n return !this.isEmpty && !this._isSending;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n private _nonTextPassthrough: readonly ThreadMessage[\"content\"][number][];\n private _parentId: string | null;\n private _sourceId: string | null;\n private runtime: ThreadRuntimeCore & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n };\n private endEditCallback: () => void;\n\n constructor(\n runtime: ThreadRuntimeCore & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this.runtime = runtime;\n this.endEditCallback = endEditCallback;\n this._parentId = parentId;\n this._sourceId = message.id;\n this.setText(getThreadMessageText(message));\n\n this.setRole(message.role);\n\n let attachments: readonly CompleteAttachment[];\n if (message.role === \"user\") {\n attachments = [\n ...(message.attachments ?? []),\n ...liftNonTextParts(message.content),\n ];\n this._nonTextPassthrough = [];\n } else {\n attachments = message.attachments ?? [];\n this._nonTextPassthrough = message.content.filter(\n (p) => p.type !== \"text\",\n );\n }\n this.setAttachments(attachments);\n\n this.setRunConfig({ ...runtime.composer.runConfig });\n }\n\n public get parentId() {\n return this._parentId;\n }\n\n public get sourceId() {\n return this._sourceId;\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n options?: SendOptions,\n ) {\n const content =\n this._nonTextPassthrough.length > 0\n ? ([\n ...message.content,\n ...this._nonTextPassthrough,\n ] as AppendMessage[\"content\"])\n : message.content;\n const appendTask = this.runtime.append({\n ...message,\n content,\n parentId: this._parentId,\n sourceId: this._sourceId,\n startRun: options?.startRun,\n });\n\n this.handleCancel();\n return appendTask;\n }\n\n public handleCancel() {\n this.endEditCallback();\n this._notifySubscribers();\n }\n}\n"],"mappings":";;;;AAUA,IAAaU,iCAAb,cAAoDD,wBAAwB;CAC1E,IAAWE,YAAY;EACrB,OAAO;CACT;CAEA,IAAWC,UAAU;EACnB,OAAO,CAAC,KAAKC,WAAW,CAAC,KAAKC;CAChC;CAEA,uBAAiC;EAC/B,OAAO,KAAKE,QAAQC,UAAUC;CAChC;CAEA,sBAAgC;EAC9B,OAAO,KAAKF,QAAQC,UAAUG;CAChC;CAEA;CACA;CACA;CACA;CAQA;CAEAK,YACET,SAQAQ,iBACA,EAAEE,UAAUC,WACZ;EACA,MAAM;EACN,KAAKX,UAAUA;EACf,KAAKQ,kBAAkBA;EACvB,KAAKF,YAAYI;EACjB,KAAKH,YAAYI,QAAQC;EACzB,KAAKC,QAAQ1B,qBAAqBwB,OAAO,CAAC;EAE1C,KAAKG,QAAQH,QAAQI,IAAI;EAEzB,IAAIb;EACJ,IAAIS,QAAQI,SAAS,QAAQ;GAC3Bb,cAAc,CACZ,GAAIS,QAAQT,eAAe,CAAA,GAC3B,GAAGd,iBAAiBuB,QAAQK,OAAO,CAAC;GAEtC,KAAKX,sBAAsB,CAAA;EAC7B,OAAO;GACLH,cAAcS,QAAQT,eAAe,CAAA;GACrC,KAAKG,sBAAsBM,QAAQK,QAAQC,QACxCC,MAAMA,EAAEC,SAAS,MACpB;EACF;EACA,KAAKC,eAAelB,WAAW;EAE/B,KAAKmB,aAAa,EAAE,GAAGrB,QAAQsB,SAASC,UAAU,CAAC;CACrD;CAEA,IAAWb,WAAW;EACpB,OAAO,KAAKJ;CACd;CAEA,IAAWkB,WAAW;EACpB,OAAO,KAAKjB;CACd;CAEA,MAAakB,WACXd,SACAgB,SACA;EACA,MAAMX,UACJ,KAAKX,oBAAoBuB,SAAS,IAC7B,CACC,GAAGjB,QAAQK,SACX,GAAG,KAAKX,mBAAmB,IAE7BM,QAAQK;EACd,MAAMa,aAAa,KAAK7B,QAAQ8B,OAAO;GACrC,GAAGnB;GACHK;GACAN,UAAU,KAAKJ;GACfkB,UAAU,KAAKjB;GACfwB,UAAUJ,SAASI;EACrB,CAAC;EAED,KAAKC,aAAa;EAClB,OAAOH;CACT;CAEA,eAAsB;EACpB,KAAKrB,gBAAgB;EACrB,KAAKyB,mBAAmB;CAC1B;AACF"}
1
+ {"version":3,"file":"default-edit-composer-runtime-core.js","names":["AppendMessage","ThreadMessage","CompleteAttachment","getThreadMessageText","liftNonTextParts","AttachmentAdapter","DictationAdapter","SendOptions","ThreadRuntimeCore","BaseComposerRuntimeCore","DefaultEditComposerRuntimeCore","canCancel","detachesDraftOnSend","canSend","isEmpty","runtime","voice","isSubmitting","getAttachmentAdapter","adapters","attachments","getDictationAdapter","dictation","_nonTextPassthrough","_parentId","_sourceId","endEditCallback","_ended","constructor","parentId","message","lastHasVoice","undefined","unsubscribe","subscribe","hasVoice","_notifySubscribers","id","setText","setRole","role","content","filter","p","type","setAttachments","setRunConfig","composer","runConfig","sourceId","handleSend","Omit","options","length","appendTask","append","startRun","handleCancel","reset","catch","error","console"],"sources":["../../../src/runtime/base/default-edit-composer-runtime-core.ts"],"sourcesContent":["import type { AppendMessage, ThreadMessage } from \"../../types/message\";\nimport type { CompleteAttachment } from \"../../types/attachment\";\nimport { getThreadMessageText } from \"../../utils/text\";\nimport { liftNonTextParts } from \"../../adapters/attachment\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type { SendOptions } from \"../interfaces/composer-runtime-core\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n // An edit composer is the message it is editing, so its draft stays in place\n // until the edit lands rather than moving into a submission row.\n protected override get detachesDraftOnSend() {\n return false;\n }\n\n public get canSend() {\n return !this.isEmpty && !this.runtime.voice && !this.isSubmitting;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n private _nonTextPassthrough: readonly ThreadMessage[\"content\"][number][];\n private _parentId: string | null;\n private _sourceId: string | null;\n private runtime: ThreadRuntimeCore & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n };\n private endEditCallback: () => void;\n private _ended = false;\n\n constructor(\n runtime: ThreadRuntimeCore & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this.runtime = runtime;\n let lastHasVoice = runtime.voice !== undefined;\n const unsubscribe = runtime.subscribe(() => {\n const hasVoice = runtime.voice !== undefined;\n if (hasVoice === lastHasVoice) return;\n lastHasVoice = hasVoice;\n this._notifySubscribers();\n });\n this.endEditCallback = () => {\n unsubscribe();\n endEditCallback();\n };\n this._parentId = parentId;\n this._sourceId = message.id;\n this.setText(getThreadMessageText(message));\n\n this.setRole(message.role);\n\n let attachments: readonly CompleteAttachment[];\n if (message.role === \"user\") {\n attachments = [\n ...(message.attachments ?? []),\n ...liftNonTextParts(message.content),\n ];\n this._nonTextPassthrough = [];\n } else {\n attachments = message.attachments ?? [];\n this._nonTextPassthrough = message.content.filter(\n (p) => p.type !== \"text\",\n );\n }\n this.setAttachments(attachments);\n\n this.setRunConfig({ ...runtime.composer.runConfig });\n }\n\n public get parentId() {\n return this._parentId;\n }\n\n public get sourceId() {\n return this._sourceId;\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n options?: SendOptions,\n ) {\n const content =\n this._nonTextPassthrough.length > 0\n ? ([\n ...message.content,\n ...this._nonTextPassthrough,\n ] as AppendMessage[\"content\"])\n : message.content;\n const appendTask = this.runtime.append({\n ...message,\n content,\n parentId: this._parentId,\n sourceId: this._sourceId,\n startRun: options?.startRun,\n });\n\n this.handleCancel();\n return appendTask;\n }\n\n public handleCancel() {\n if (this._ended) return;\n this._ended = true;\n void this.reset().catch((error: unknown) => {\n console.error(\"[assistant-ui] Failed to clear cancelled edit\", error);\n });\n this.endEditCallback();\n this._notifySubscribers();\n }\n}\n"],"mappings":";;;;AAUA,IAAaU,iCAAb,cAAoDD,wBAAwB;CAC1E,IAAWE,YAAY;EACrB,OAAO;CACT;CAIA,IAAuBC,sBAAsB;EAC3C,OAAO;CACT;CAEA,IAAWC,UAAU;EACnB,OAAO,CAAC,KAAKC,WAAW,CAAC,KAAKC,QAAQC,SAAS,CAAC,KAAKC;CACvD;CAEA,uBAAiC;EAC/B,OAAO,KAAKF,QAAQI,UAAUC;CAChC;CAEA,sBAAgC;EAC9B,OAAO,KAAKL,QAAQI,UAAUG;CAChC;CAEA;CACA;CACA;CACA;CAQA;CACA,SAAiB;CAEjBM,YACEb,SAQAW,iBACA,EAAEG,UAAUC,WACZ;EACA,MAAM;EACN,KAAKf,UAAUA;EACf,IAAIgB,eAAehB,QAAQC,UAAUgB,KAAAA;EACrC,MAAMC,cAAclB,QAAQmB,gBAAgB;GAC1C,MAAMC,WAAWpB,QAAQC,UAAUgB,KAAAA;GACnC,IAAIG,aAAaJ,cAAc;GAC/BA,eAAeI;GACf,KAAKC,mBAAmB;EAC1B,CAAC;EACD,KAAKV,wBAAwB;GAC3BO,YAAY;GACZP,gBAAgB;EAClB;EACA,KAAKF,YAAYK;EACjB,KAAKJ,YAAYK,QAAQO;EACzB,KAAKC,QAAQnC,qBAAqB2B,OAAO,CAAC;EAE1C,KAAKS,QAAQT,QAAQU,IAAI;EAEzB,IAAIpB;EACJ,IAAIU,QAAQU,SAAS,QAAQ;GAC3BpB,cAAc,CACZ,GAAIU,QAAQV,eAAe,CAAA,GAC3B,GAAGhB,iBAAiB0B,QAAQW,OAAO,CAAC;GAEtC,KAAKlB,sBAAsB,CAAA;EAC7B,OAAO;GACLH,cAAcU,QAAQV,eAAe,CAAA;GACrC,KAAKG,sBAAsBO,QAAQW,QAAQC,QACxCC,MAAMA,EAAEC,SAAS,MACpB;EACF;EACA,KAAKC,eAAezB,WAAW;EAE/B,KAAK0B,aAAa,EAAE,GAAG/B,QAAQgC,SAASC,UAAU,CAAC;CACrD;CAEA,IAAWnB,WAAW;EACpB,OAAO,KAAKL;CACd;CAEA,IAAWyB,WAAW;EACpB,OAAO,KAAKxB;CACd;CAEA,MAAayB,WACXpB,SACAsB,SACA;EACA,MAAMX,UACJ,KAAKlB,oBAAoB8B,SAAS,IAC7B,CACC,GAAGvB,QAAQW,SACX,GAAG,KAAKlB,mBAAmB,IAE7BO,QAAQW;EACd,MAAMa,aAAa,KAAKvC,QAAQwC,OAAO;GACrC,GAAGzB;GACHW;GACAZ,UAAU,KAAKL;GACfyB,UAAU,KAAKxB;GACf+B,UAAUJ,SAASI;EACrB,CAAC;EAED,KAAKC,aAAa;EAClB,OAAOH;CACT;CAEA,eAAsB;EACpB,IAAI,KAAK3B,QAAQ;EACjB,KAAKA,SAAS;EACd,KAAU+B,MAAM,CAAC,CAACC,OAAOC,UAAmB;GAC1CC,QAAQD,MAAM,iDAAiDA,KAAK;EACtE,CAAC;EACD,KAAKlC,gBAAgB;EACrB,KAAKU,mBAAmB;CAC1B;AACF"}
@@ -1,34 +1,31 @@
1
- import { AppendMessage } from "../../types/message.js";
2
- import { AttachmentAdapter } from "../../adapters/attachment.js";
3
- import { Unsubscribe } from "../../types/unsubscribe.js";
4
- import { DictationAdapter } from "../../adapters/speech.js";
5
- import { QueueItemState } from "../queue/queue-item.js";
6
- import { QueuePlacement } from "../queue/external-thread-queue-adapter.js";
7
- import { SendOptions, ThreadComposerRuntimeCore } from "../interfaces/composer-runtime-core.js";
8
- import { ThreadRuntimeCore } from "../interfaces/thread-runtime-core.js";
1
+ import type { AppendMessage, MessageRole } from "../../types/message.js";
2
+ import type { AttachmentAdapter } from "../../adapters/attachment.js";
3
+ import type { DictationAdapter } from "../../adapters/speech.js";
4
+ import type { SendOptions, ThreadComposerRuntimeCore } from "../interfaces/composer-runtime-core.js";
5
+ import type { ThreadRuntimeCore } from "../interfaces/thread-runtime-core.js";
6
+ import type { QueuePlacement } from "../queue/external-thread-queue-adapter.js";
7
+ import { type QueueItemState } from "../queue/queue-item.js";
9
8
  import { BaseComposerRuntimeCore } from "./base-composer-runtime-core.js";
10
- import "../../index.js";
11
- //#region src/runtime/base/default-thread-composer-runtime-core.d.ts
12
- declare class DefaultThreadComposerRuntimeCore extends BaseComposerRuntimeCore implements ThreadComposerRuntimeCore {
13
- get canCancel(): boolean;
14
- get canSend(): boolean;
15
- private _queueCache;
16
- get queue(): readonly QueueItemState[];
17
- moveQueueItem(queueItemId: string, placement: QueuePlacement): void;
18
- removeQueueItem(queueItemId: string): void;
19
- protected getAttachmentAdapter(): AttachmentAdapter | undefined;
20
- protected getDictationAdapter(): DictationAdapter | undefined;
21
- private runtime;
22
- constructor(runtime: Omit<ThreadRuntimeCore, "composer"> & {
23
- adapters?: {
24
- attachments?: AttachmentAdapter | undefined;
25
- dictation?: DictationAdapter | undefined;
26
- } | undefined;
27
- });
28
- connect(): Unsubscribe;
29
- handleSend(message: Omit<AppendMessage, "parentId" | "sourceId">, options?: SendOptions): Promise<void>;
30
- handleCancel(): Promise<void>;
9
+ export declare class DefaultThreadComposerRuntimeCore extends BaseComposerRuntimeCore implements ThreadComposerRuntimeCore {
10
+ get canCancel(): boolean;
11
+ get canSend(): boolean;
12
+ cancel(): void;
13
+ protected threadMessageIds(role: MessageRole): string[];
14
+ private _queueCache;
15
+ get queue(): readonly QueueItemState[];
16
+ moveQueueItem(queueItemId: string, placement: QueuePlacement): void;
17
+ removeQueueItem(queueItemId: string): void;
18
+ protected getAttachmentAdapter(): AttachmentAdapter | undefined;
19
+ protected getDictationAdapter(): DictationAdapter | undefined;
20
+ private runtime;
21
+ constructor(runtime: Omit<ThreadRuntimeCore, "composer"> & {
22
+ adapters?: {
23
+ attachments?: AttachmentAdapter | undefined;
24
+ dictation?: DictationAdapter | undefined;
25
+ } | undefined;
26
+ });
27
+ connect(): import("../../index.js").Unsubscribe;
28
+ handleSend(message: Omit<AppendMessage, "parentId" | "sourceId">, options?: SendOptions): Promise<void>;
29
+ handleCancel(): Promise<void>;
31
30
  }
32
- //#endregion
33
- export { DefaultThreadComposerRuntimeCore };
34
31
  //# sourceMappingURL=default-thread-composer-runtime-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-thread-composer-runtime-core.d.ts","names":[],"sources":["../../../src/runtime/base/default-thread-composer-runtime-core.ts"],"mappings":";;;;;;;;;;;cAmBa,yCACH,mCACG;MAEA;MAIA;UAIH;MAQY,kBAAkB;EAgBtB,cACd,qBACA,WAAW;EAKG,gBAAgB;YAItB,wBAAoB;YAIpB,uBAAmB;UAIrB;EAUN,YAAA,SAAS,KAAK;IACZ;MAEM,cAAc;MACd,YAAY;;;EAUf,WAVe;EAiCT,WACX,SAAS,KAAK,yCACd,UAAU,cAAW;EAWV,gBAAY"}
1
+ {"version":3,"file":"default-thread-composer-runtime-core.d.ts","sourceRoot":"","sources":["../../../src/runtime/base/default-thread-composer-runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,+BAA4B;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qCAAkC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAA8B;AAC9D,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EAC1B,+CAA4C;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,6CAA0C;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,kDAA+C;AAC7E,OAAO,EAAqB,KAAK,cAAc,EAAE,+BAA4B;AAC7E,OAAO,EAAE,uBAAuB,EAAE,wCAAqC;AAQvE,qBAAa,gCACX,SAAQ,uBACR,YAAW,yBAAyB;IAEpC,IAAW,SAAS,YAEnB;IAED,IAAW,OAAO,YAQjB;IAEe,MAAM;cAWH,gBAAgB,CAAC,IAAI,EAAE,WAAW;IAMrD,OAAO,CAAC,WAAW,CAML;IAEd,IAAoB,KAAK,IAAI,SAAS,cAAc,EAAE,CAcrD;IAEe,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,cAAc,GACxB,IAAI;IAIS,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI1D,SAAS,CAAC,oBAAoB;IAI9B,SAAS,CAAC,mBAAmB;IAI7B,OAAO,CAAC,OAAO,CAOb;gBAGA,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;QAC7C,QAAQ,CAAC,EACL;YACE,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;YAC5C,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;SAC1C,GACD,SAAS,CAAC;KACf;IAOI,OAAO;IA8BD,UAAU,CACrB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAAC,EACrD,OAAO,CAAC,EAAE,WAAW;IAWV,YAAY;CAG1B"}
@@ -8,10 +8,24 @@ const isCancelable = (runtime) => {
8
8
  };
9
9
  var DefaultThreadComposerRuntimeCore = class extends BaseComposerRuntimeCore {
10
10
  get canCancel() {
11
- return isCancelable(this.runtime);
11
+ return this.isSubmitting || isCancelable(this.runtime);
12
12
  }
13
13
  get canSend() {
14
- return !this.isEmpty && !this.runtime.isSendDisabled && !this._isSending;
14
+ if (this.isEmpty || this.runtime.isSendDisabled || this.isSubmitting) return false;
15
+ const voice = this.runtime.voice;
16
+ if (!voice) return true;
17
+ return voice.canSendText && this.role === "user" && this.attachments.length === 0;
18
+ }
19
+ cancel() {
20
+ if (!this.isSubmitting) {
21
+ super.cancel();
22
+ return;
23
+ }
24
+ this.cancelSubmission();
25
+ if (isCancelable(this.runtime)) super.cancel();
26
+ }
27
+ threadMessageIds(role) {
28
+ return this.runtime.messages.filter((message) => message.role === role).map((message) => message.id);
15
29
  }
16
30
  _queueCache;
17
31
  get queue() {
@@ -48,8 +62,10 @@ var DefaultThreadComposerRuntimeCore = class extends BaseComposerRuntimeCore {
48
62
  connect() {
49
63
  let lastCanCancel = false;
50
64
  let lastIsSendDisabled = this.runtime.isSendDisabled;
65
+ let lastVoiceInput = this.runtime.voice?.canSendText;
51
66
  let lastQueue = this.queue;
52
67
  return this.runtime.subscribe(() => {
68
+ this.settleInTransit();
53
69
  let changed = false;
54
70
  const nextCanCancel = this.canCancel;
55
71
  if (lastCanCancel !== nextCanCancel) {
@@ -60,6 +76,11 @@ var DefaultThreadComposerRuntimeCore = class extends BaseComposerRuntimeCore {
60
76
  lastIsSendDisabled = this.runtime.isSendDisabled;
61
77
  changed = true;
62
78
  }
79
+ const nextVoiceInput = this.runtime.voice?.canSendText;
80
+ if (lastVoiceInput !== nextVoiceInput) {
81
+ lastVoiceInput = nextVoiceInput;
82
+ changed = true;
83
+ }
63
84
  if (lastQueue !== this.queue) {
64
85
  lastQueue = this.queue;
65
86
  changed = true;
@@ -1 +1 @@
1
- {"version":3,"file":"default-thread-composer-runtime-core.js","names":["AppendMessage","AttachmentAdapter","DictationAdapter","SendOptions","ThreadComposerRuntimeCore","ThreadRuntimeCore","getThreadRuntimeCoreIsRunning","QueuePlacement","EMPTY_QUEUE_ITEMS","QueueItemState","BaseComposerRuntimeCore","isCancelable","runtime","Omit","capabilities","cancel","DefaultThreadComposerRuntimeCore","canCancel","canSend","isEmpty","isSendDisabled","_isSending","_queueCache","steer","queue","flat","getSteerQueueItems","getQueueItems","cache","length","moveQueueItem","queueItemId","placement","removeQueueItem","getAttachmentAdapter","adapters","attachments","getDictationAdapter","dictation","constructor","connect","lastCanCancel","lastIsSendDisabled","lastQueue","subscribe","changed","nextCanCancel","_notifySubscribers","handleSend","message","options","append","parentId","messages","at","id","sourceId","startRun","handleCancel","cancelRun"],"sources":["../../../src/runtime/base/default-thread-composer-runtime-core.ts"],"sourcesContent":["import type { AppendMessage } from \"../../types/message\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type {\n SendOptions,\n ThreadComposerRuntimeCore,\n} from \"../interfaces/composer-runtime-core\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { getThreadRuntimeCoreIsRunning } from \"../api/thread-runtime\";\nimport type { QueuePlacement } from \"../queue/external-thread-queue-adapter\";\nimport { EMPTY_QUEUE_ITEMS, type QueueItemState } from \"../queue/queue-item\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nconst isCancelable = (runtime: Omit<ThreadRuntimeCore, \"composer\">) => {\n // capabilities is a subclass field assigned after this composer is constructed\n if (!runtime.capabilities?.cancel) return false;\n return getThreadRuntimeCoreIsRunning(runtime);\n};\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n public get canCancel() {\n return isCancelable(this.runtime);\n }\n\n public get canSend() {\n return !this.isEmpty && !this.runtime.isSendDisabled && !this._isSending;\n }\n\n private _queueCache:\n | {\n steer: readonly QueueItemState[];\n queue: readonly QueueItemState[];\n flat: readonly QueueItemState[];\n }\n | undefined;\n\n public override get queue(): readonly QueueItemState[] {\n const steer = this.runtime.getSteerQueueItems?.() ?? EMPTY_QUEUE_ITEMS;\n const queue = this.runtime.getQueueItems?.() ?? EMPTY_QUEUE_ITEMS;\n const cache = this._queueCache;\n if (cache && cache.steer === steer && cache.queue === queue)\n return cache.flat;\n const flat =\n steer.length === 0\n ? queue\n : queue.length === 0\n ? steer\n : [...steer, ...queue];\n this._queueCache = { steer, queue, flat };\n return flat;\n }\n\n public override moveQueueItem(\n queueItemId: string,\n placement: QueuePlacement,\n ): void {\n this.runtime.moveQueueItem?.(queueItemId, placement);\n }\n\n public override removeQueueItem(queueItemId: string): void {\n this.runtime.removeQueueItem?.(queueItemId);\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n };\n\n constructor(\n runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n ) {\n super();\n this.runtime = runtime;\n this.connect();\n }\n\n public connect() {\n let lastCanCancel = false;\n let lastIsSendDisabled = this.runtime.isSendDisabled;\n let lastQueue = this.queue;\n return this.runtime.subscribe(() => {\n let changed = false;\n const nextCanCancel = this.canCancel;\n if (lastCanCancel !== nextCanCancel) {\n lastCanCancel = nextCanCancel;\n changed = true;\n }\n if (lastIsSendDisabled !== this.runtime.isSendDisabled) {\n lastIsSendDisabled = this.runtime.isSendDisabled;\n changed = true;\n }\n if (lastQueue !== this.queue) {\n lastQueue = this.queue;\n changed = true;\n }\n if (changed) this._notifySubscribers();\n });\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n options?: SendOptions,\n ) {\n return this.runtime.append({\n ...(message as AppendMessage),\n parentId: this.runtime.messages.at(-1)?.id ?? null,\n sourceId: null,\n startRun: options?.startRun,\n steer: options?.steer,\n });\n }\n\n public async handleCancel() {\n this.runtime.cancelRun();\n }\n}\n"],"mappings":";;;;AAaA,MAAMW,gBAAgBC,YAAiD;CAErE,IAAI,CAACA,QAAQE,cAAcC,QAAQ,OAAO;CAC1C,OAAOT,8BAA8BM,OAAO;AAC9C;AAEA,IAAaI,mCAAb,cACUN,wBAEV;CACE,IAAWO,YAAY;EACrB,OAAON,aAAa,KAAKC,OAAO;CAClC;CAEA,IAAWM,UAAU;EACnB,OAAO,CAAC,KAAKC,WAAW,CAAC,KAAKP,QAAQQ,kBAAkB,CAAC,KAAKC;CAChE;CAEA;CAQA,IAAoBG,QAAmC;EACrD,MAAMD,QAAQ,KAAKX,QAAQc,qBAAqB,KAAKlB;EACrD,MAAMgB,QAAQ,KAAKZ,QAAQe,gBAAgB,KAAKnB;EAChD,MAAMoB,QAAQ,KAAKN;EACnB,IAAIM,SAASA,MAAML,UAAUA,SAASK,MAAMJ,UAAUA,OACpD,OAAOI,MAAMH;EACf,MAAMA,OACJF,MAAMM,WAAW,IACbL,QACAA,MAAMK,WAAW,IACfN,QACA,CAAC,GAAGA,OAAO,GAAGC,KAAK;EAC3B,KAAKF,cAAc;GAAEC;GAAOC;GAAOC;EAAK;EACxC,OAAOA;CACT;CAEA,cACEM,aACAC,WACM;EACN,KAAKpB,QAAQkB,gBAAgBC,aAAaC,SAAS;CACrD;CAEA,gBAAgCD,aAA2B;EACzD,KAAKnB,QAAQqB,kBAAkBF,WAAW;CAC5C;CAEA,uBAAiC;EAC/B,OAAO,KAAKnB,QAAQuB,UAAUC;CAChC;CAEA,sBAAgC;EAC9B,OAAO,KAAKxB,QAAQuB,UAAUG;CAChC;CAEA;CASAC,YACE3B,SAQA;EACA,MAAM;EACN,KAAKA,UAAUA;EACf,KAAK4B,QAAQ;CACf;CAEA,UAAiB;EACf,IAAIC,gBAAgB;EACpB,IAAIC,qBAAqB,KAAK9B,QAAQQ;EACtC,IAAIuB,YAAY,KAAKnB;EACrB,OAAO,KAAKZ,QAAQgC,gBAAgB;GAClC,IAAIC,UAAU;GACd,MAAMC,gBAAgB,KAAK7B;GAC3B,IAAIwB,kBAAkBK,eAAe;IACnCL,gBAAgBK;IAChBD,UAAU;GACZ;GACA,IAAIH,uBAAuB,KAAK9B,QAAQQ,gBAAgB;IACtDsB,qBAAqB,KAAK9B,QAAQQ;IAClCyB,UAAU;GACZ;GACA,IAAIF,cAAc,KAAKnB,OAAO;IAC5BmB,YAAY,KAAKnB;IACjBqB,UAAU;GACZ;GACA,IAAIA,SAAS,KAAKE,mBAAmB;EACvC,CAAC;CACH;CAEA,MAAaC,WACXC,SACAC,SACA;EACA,OAAO,KAAKtC,QAAQuC,OAAO;GACzB,GAAIF;GACJG,UAAU,KAAKxC,QAAQyC,SAASC,GAAG,EAAE,CAAC,EAAEC,MAAM;GAC9CC,UAAU;GACVC,UAAUP,SAASO;GACnBlC,OAAO2B,SAAS3B;EAClB,CAAC;CACH;CAEA,MAAamC,eAAe;EAC1B,KAAK9C,QAAQ+C,UAAU;CACzB;AACF"}
1
+ {"version":3,"file":"default-thread-composer-runtime-core.js","names":["AppendMessage","MessageRole","AttachmentAdapter","DictationAdapter","SendOptions","ThreadComposerRuntimeCore","ThreadRuntimeCore","getThreadRuntimeCoreIsRunning","QueuePlacement","EMPTY_QUEUE_ITEMS","QueueItemState","BaseComposerRuntimeCore","isCancelable","runtime","Omit","capabilities","cancel","DefaultThreadComposerRuntimeCore","canCancel","isSubmitting","canSend","isEmpty","isSendDisabled","voice","canSendText","role","attachments","length","cancelSubmission","threadMessageIds","messages","filter","message","map","id","_queueCache","steer","queue","flat","getSteerQueueItems","getQueueItems","cache","moveQueueItem","queueItemId","placement","removeQueueItem","getAttachmentAdapter","adapters","getDictationAdapter","dictation","constructor","connect","lastCanCancel","lastIsSendDisabled","lastVoiceInput","lastQueue","subscribe","settleInTransit","changed","nextCanCancel","nextVoiceInput","_notifySubscribers","handleSend","options","append","parentId","at","sourceId","startRun","handleCancel","cancelRun"],"sources":["../../../src/runtime/base/default-thread-composer-runtime-core.ts"],"sourcesContent":["import type { AppendMessage, MessageRole } from \"../../types/message\";\nimport type { AttachmentAdapter } from \"../../adapters/attachment\";\nimport type { DictationAdapter } from \"../../adapters/speech\";\nimport type {\n SendOptions,\n ThreadComposerRuntimeCore,\n} from \"../interfaces/composer-runtime-core\";\nimport type { ThreadRuntimeCore } from \"../interfaces/thread-runtime-core\";\nimport { getThreadRuntimeCoreIsRunning } from \"../api/thread-runtime\";\nimport type { QueuePlacement } from \"../queue/external-thread-queue-adapter\";\nimport { EMPTY_QUEUE_ITEMS, type QueueItemState } from \"../queue/queue-item\";\nimport { BaseComposerRuntimeCore } from \"./base-composer-runtime-core\";\n\nconst isCancelable = (runtime: Omit<ThreadRuntimeCore, \"composer\">) => {\n // capabilities is a subclass field assigned after this composer is constructed\n if (!runtime.capabilities?.cancel) return false;\n return getThreadRuntimeCoreIsRunning(runtime);\n};\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n public get canCancel() {\n return this.isSubmitting || isCancelable(this.runtime);\n }\n\n public get canSend() {\n if (this.isEmpty || this.runtime.isSendDisabled || this.isSubmitting)\n return false;\n const voice = this.runtime.voice;\n if (!voice) return true;\n return (\n voice.canSendText && this.role === \"user\" && this.attachments.length === 0\n );\n }\n\n public override cancel() {\n if (!this.isSubmitting) {\n super.cancel();\n return;\n }\n // Stopping takes a send still being prepared back into the draft and\n // still stops a run that is going, so the one control never loses either.\n this.cancelSubmission();\n if (isCancelable(this.runtime)) super.cancel();\n }\n\n protected override threadMessageIds(role: MessageRole) {\n return this.runtime.messages\n .filter((message) => message.role === role)\n .map((message) => message.id);\n }\n\n private _queueCache:\n | {\n steer: readonly QueueItemState[];\n queue: readonly QueueItemState[];\n flat: readonly QueueItemState[];\n }\n | undefined;\n\n public override get queue(): readonly QueueItemState[] {\n const steer = this.runtime.getSteerQueueItems?.() ?? EMPTY_QUEUE_ITEMS;\n const queue = this.runtime.getQueueItems?.() ?? EMPTY_QUEUE_ITEMS;\n const cache = this._queueCache;\n if (cache && cache.steer === steer && cache.queue === queue)\n return cache.flat;\n const flat =\n steer.length === 0\n ? queue\n : queue.length === 0\n ? steer\n : [...steer, ...queue];\n this._queueCache = { steer, queue, flat };\n return flat;\n }\n\n public override moveQueueItem(\n queueItemId: string,\n placement: QueuePlacement,\n ): void {\n this.runtime.moveQueueItem?.(queueItemId, placement);\n }\n\n public override removeQueueItem(queueItemId: string): void {\n this.runtime.removeQueueItem?.(queueItemId);\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n protected getDictationAdapter() {\n return this.runtime.adapters?.dictation;\n }\n\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n };\n\n constructor(\n runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n dictation?: DictationAdapter | undefined;\n }\n | undefined;\n },\n ) {\n super();\n this.runtime = runtime;\n this.connect();\n }\n\n public connect() {\n let lastCanCancel = false;\n let lastIsSendDisabled = this.runtime.isSendDisabled;\n let lastVoiceInput = this.runtime.voice?.canSendText;\n let lastQueue = this.queue;\n return this.runtime.subscribe(() => {\n this.settleInTransit();\n let changed = false;\n const nextCanCancel = this.canCancel;\n if (lastCanCancel !== nextCanCancel) {\n lastCanCancel = nextCanCancel;\n changed = true;\n }\n if (lastIsSendDisabled !== this.runtime.isSendDisabled) {\n lastIsSendDisabled = this.runtime.isSendDisabled;\n changed = true;\n }\n const nextVoiceInput = this.runtime.voice?.canSendText;\n if (lastVoiceInput !== nextVoiceInput) {\n lastVoiceInput = nextVoiceInput;\n changed = true;\n }\n if (lastQueue !== this.queue) {\n lastQueue = this.queue;\n changed = true;\n }\n if (changed) this._notifySubscribers();\n });\n }\n\n public async handleSend(\n message: Omit<AppendMessage, \"parentId\" | \"sourceId\">,\n options?: SendOptions,\n ) {\n return this.runtime.append({\n ...(message as AppendMessage),\n parentId: this.runtime.messages.at(-1)?.id ?? null,\n sourceId: null,\n startRun: options?.startRun,\n steer: options?.steer,\n });\n }\n\n public async handleCancel() {\n this.runtime.cancelRun();\n }\n}\n"],"mappings":"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"}
@@ -1,4 +1,3 @@
1
- //#region src/runtime/branch/external-thread-branch-adapter.d.ts
2
1
  /**
3
2
  * The branch surface a runtime exposes so the branch picker can navigate
4
3
  * between sibling variants of a message. Read during render; recreate the
@@ -9,22 +8,20 @@
9
8
  * payload carries the edited message's own id as both `parentId` and
10
9
  * `sourceId`.
11
10
  */
12
- type ExternalThreadBranchAdapter = {
13
- /**
14
- * Returns the sibling branch ids for a message in display order, including
15
- * the message's own id. Return an empty array for messages without
16
- * alternative branches.
17
- */
18
- getBranches: (messageId: string) => readonly string[];
19
- /**
20
- * Makes the given branch the visible one. The runtime is expected to swap
21
- * the `messages` array to the selected branch. May be invoked
22
- * programmatically while a run is in progress; pending queue items are not
23
- * cleared, and reconciling them with the new branch is the runtime's
24
- * responsibility.
25
- */
26
- switchToBranch: (branchId: string) => void;
11
+ export type ExternalThreadBranchAdapter = {
12
+ /**
13
+ * Returns the sibling branch ids for a message in display order, including
14
+ * the message's own id. Return an empty array for messages without
15
+ * alternative branches.
16
+ */
17
+ getBranches: (messageId: string) => readonly string[];
18
+ /**
19
+ * Makes the given branch the visible one. The runtime is expected to swap
20
+ * the `messages` array to the selected branch. May be invoked
21
+ * programmatically while a run is in progress; pending queue items are not
22
+ * cleared, and reconciling them with the new branch is the runtime's
23
+ * responsibility.
24
+ */
25
+ switchToBranch: (branchId: string) => void;
27
26
  };
28
- //#endregion
29
- export { ExternalThreadBranchAdapter };
30
27
  //# sourceMappingURL=external-thread-branch-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external-thread-branch-adapter.d.ts","names":[],"sources":["../../../src/runtime/branch/external-thread-branch-adapter.ts"],"mappings":";;;;;;;;;;;KAUY;;;;;;EAMV,cAAc;;;;;;;;EAQd,iBAAiB"}
1
+ {"version":3,"file":"external-thread-branch-adapter.d.ts","sourceRoot":"","sources":["../../../src/runtime/branch/external-thread-branch-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;;OAIG;IACH,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;IACtD;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC"}
@@ -1,13 +1,10 @@
1
- import { Unsubscribe } from "../../types/unsubscribe.js";
2
- import { ModelContextProvider } from "../../model-context/types.js";
3
- import { ThreadListRuntimeCore } from "./thread-list-runtime-core.js";
4
- //#region src/runtime/interfaces/assistant-runtime-core.d.ts
5
- type AssistantRuntimeCore = {
6
- readonly threads: ThreadListRuntimeCore;
7
- registerModelContextProvider: (provider: ModelContextProvider) => Unsubscribe;
8
- getModelContextProvider: () => ModelContextProvider;
9
- readonly RenderComponent?: ((...args: any[]) => unknown) | undefined;
1
+ import type { Unsubscribe } from "../../types/unsubscribe.js";
2
+ import type { ModelContextProvider } from "../../model-context/types.js";
3
+ import type { ThreadListRuntimeCore } from "./thread-list-runtime-core.js";
4
+ export type AssistantRuntimeCore = {
5
+ readonly threads: ThreadListRuntimeCore;
6
+ registerModelContextProvider: (provider: ModelContextProvider) => Unsubscribe;
7
+ getModelContextProvider: () => ModelContextProvider;
8
+ readonly RenderComponent?: ((...args: any[]) => unknown) | undefined;
10
9
  };
11
- //#endregion
12
- export { AssistantRuntimeCore };
13
10
  //# sourceMappingURL=assistant-runtime-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-runtime-core.d.ts","names":[],"sources":["../../../src/runtime/interfaces/assistant-runtime-core.ts"],"mappings":";;;;KAIY;WACD,SAAS;EAElB,+BAA+B,UAAU,yBAAyB;EAClE,+BAA+B;WAEtB,uBAAuB"}
1
+ {"version":3,"file":"assistant-runtime-core.d.ts","sourceRoot":"","sources":["../../../src/runtime/interfaces/assistant-runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mCAAgC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,qCAAkC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,sCAAmC;AAExE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAExC,4BAA4B,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,WAAW,CAAC;IAC9E,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;IAEpD,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACtE,CAAC"}
@@ -1,90 +1,105 @@
1
- import { MessageRole, RunConfig } from "../../types/message.js";
2
- import { Attachment, CreateAttachment } from "../../types/attachment.js";
3
- import { Unsubscribe } from "../../types/unsubscribe.js";
4
- import { DictationAdapter } from "../../adapters/speech.js";
5
- import { QuoteInfo } from "../../types/quote.js";
6
- import { QueueItemState } from "../queue/queue-item.js";
7
- import { QueuePlacement } from "../queue/external-thread-queue-adapter.js";
8
- //#region src/runtime/interfaces/composer-runtime-core.d.ts
9
- type AttachmentAddErrorReason = "no-adapter" | "not-accepted" | "adapter-error";
10
- type AttachmentAddErrorEvent = {
11
- readonly reason: AttachmentAddErrorReason;
12
- readonly message: string;
13
- readonly attachmentId?: string;
14
- readonly error?: Error;
1
+ import type { MessageRole } from "../../types/message.js";
2
+ import type { QuoteInfo } from "../../types/quote.js";
3
+ import type { Attachment, CreateAttachment } from "../../types/attachment.js";
4
+ import type { Unsubscribe } from "../../types/unsubscribe.js";
5
+ import type { RunConfig } from "../../types/message.js";
6
+ import type { DictationAdapter } from "../../adapters/speech.js";
7
+ import type { QueueItemState } from "../queue/queue-item.js";
8
+ import type { QueuePlacement } from "../queue/external-thread-queue-adapter.js";
9
+ export type AttachmentAddErrorReason = "no-adapter" | "not-accepted" | "adapter-error";
10
+ export type AttachmentAddErrorEvent = {
11
+ readonly reason: AttachmentAddErrorReason;
12
+ readonly message: string;
13
+ readonly attachmentId?: string;
14
+ readonly error?: Error;
15
15
  };
16
- type ComposerRuntimeEventPayload = {
17
- /**
18
- * Fired after a send with the size of what went out. The composer state is
19
- * already cleared when it fires, so the counts are only available here.
20
- */
21
- send: {
22
- readonly chars: number;
23
- readonly attachments: number;
24
- };
25
- /**
26
- * @deprecated State-derivable. Observe `state.attachments` via `subscribe` +
27
- * `getState` instead. Kept for backward compatibility.
28
- */
29
- attachmentAdd: {
30
- readonly contentType?: string | undefined;
31
- };
32
- attachmentAddError: AttachmentAddErrorEvent & {
33
- readonly contentType?: string | undefined;
34
- };
16
+ export type ComposerRuntimeEventPayload = {
17
+ /**
18
+ * Fired after a send with the size of what went out. The composer state is
19
+ * already cleared when it fires, so the counts are only available here.
20
+ */
21
+ send: {
22
+ readonly chars: number;
23
+ readonly attachments: number;
24
+ };
25
+ /**
26
+ * @deprecated State-derivable. Observe `state.attachments` via `subscribe` +
27
+ * `getState` instead. Kept for backward compatibility.
28
+ */
29
+ attachmentAdd: {
30
+ readonly contentType?: string | undefined;
31
+ };
32
+ attachmentAddError: AttachmentAddErrorEvent & {
33
+ readonly contentType?: string | undefined;
34
+ };
35
35
  };
36
- type ComposerRuntimeEventType = keyof ComposerRuntimeEventPayload;
37
- type ComposerRuntimeEventCallback<E extends ComposerRuntimeEventType> = (payload: ComposerRuntimeEventPayload[E]) => void;
38
- type DictationState = {
39
- readonly status: DictationAdapter.Status;
40
- readonly transcript?: string;
41
- readonly inputDisabled?: boolean;
36
+ export type ComposerRuntimeEventType = keyof ComposerRuntimeEventPayload;
37
+ export type ComposerRuntimeEventCallback<E extends ComposerRuntimeEventType> = (payload: ComposerRuntimeEventPayload[E]) => void;
38
+ export type DictationState = {
39
+ readonly status: DictationAdapter.Status;
40
+ readonly transcript?: string;
41
+ readonly inputDisabled?: boolean;
42
42
  };
43
- type SendOptions = {
44
- startRun?: boolean;
45
- /** Process this message next; only meaningful with the `queue` capability. */
46
- steer?: boolean;
43
+ /**
44
+ * A message the user sent that the thread does not show as one of its own
45
+ * yet, because its attachments are still being prepared or the runtime has
46
+ * not shown it since taking it. A send that cannot be delivered takes its
47
+ * content back into the draft, so a submission is always in flight.
48
+ */
49
+ export type ComposerSubmission = {
50
+ readonly id: string;
51
+ readonly role: MessageRole;
52
+ readonly text: string;
53
+ readonly quote: QuoteInfo | undefined;
54
+ readonly attachments: readonly Attachment[];
47
55
  };
48
- type ComposerRuntimeCore = Readonly<{
49
- isEditing: boolean;
50
- canCancel: boolean;
51
- canSend: boolean;
52
- isEmpty: boolean;
53
- attachments: readonly Attachment[];
54
- attachmentAccept: string;
55
- addAttachment: (fileOrAttachment: File | CreateAttachment) => Promise<void>;
56
- removeAttachment: (attachmentId: string) => Promise<void>;
57
- text: string;
58
- setText: (value: string) => void;
59
- role: MessageRole;
60
- setRole: (role: MessageRole) => void;
61
- runConfig: RunConfig;
62
- setRunConfig: (runConfig: RunConfig) => void;
63
- quote: QuoteInfo | undefined;
64
- setQuote: (quote: QuoteInfo | undefined) => void;
65
- reset: () => Promise<void>;
66
- clearAttachments: () => Promise<void>;
67
- send: (options?: SendOptions) => void;
68
- cancel: () => void;
69
- queue: readonly QueueItemState[];
70
- moveQueueItem: (queueItemId: string, placement: QueuePlacement) => void;
71
- removeQueueItem: (queueItemId: string) => void;
72
- dictation: DictationState | undefined;
73
- startDictation: () => void;
74
- stopDictation: () => void;
75
- subscribe: (callback: () => void) => Unsubscribe;
76
- /**
77
- * @deprecated This API is still under active development and might change without notice.
78
- * For state-derivable transitions, prefer `subscribe` + `getState`. This channel is the
79
- * escape hatch for transient occurrences not represented in state.
80
- */
81
- unstable_on: <E extends ComposerRuntimeEventType>(event: E, callback: ComposerRuntimeEventCallback<E>) => Unsubscribe;
56
+ export type SendOptions = {
57
+ startRun?: boolean;
58
+ /** Process this message next; only meaningful with the `queue` capability. */
59
+ steer?: boolean;
60
+ };
61
+ export type ComposerRuntimeCore = Readonly<{
62
+ isEditing: boolean;
63
+ canCancel: boolean;
64
+ canSend: boolean;
65
+ isEmpty: boolean;
66
+ attachments: readonly Attachment[];
67
+ attachmentAccept: string;
68
+ addAttachment: (fileOrAttachment: File | CreateAttachment) => Promise<void>;
69
+ removeAttachment: (attachmentId: string) => Promise<void>;
70
+ text: string;
71
+ setText: (value: string) => void;
72
+ role: MessageRole;
73
+ setRole: (role: MessageRole) => void;
74
+ runConfig: RunConfig;
75
+ setRunConfig: (runConfig: RunConfig) => void;
76
+ quote: QuoteInfo | undefined;
77
+ setQuote: (quote: QuoteInfo | undefined) => void;
78
+ reset: () => Promise<void>;
79
+ clearAttachments: () => Promise<void>;
80
+ send: (options?: SendOptions) => void;
81
+ cancel: () => void;
82
+ /** The message this composer sent while its attachments are prepared. */
83
+ submission?: ComposerSubmission | undefined;
84
+ /** Messages this composer handed to the runtime that the thread does not show yet. */
85
+ inTransit?: readonly ComposerSubmission[] | undefined;
86
+ queue: readonly QueueItemState[];
87
+ moveQueueItem: (queueItemId: string, placement: QueuePlacement) => void;
88
+ removeQueueItem: (queueItemId: string) => void;
89
+ dictation: DictationState | undefined;
90
+ startDictation: () => void;
91
+ stopDictation: () => void;
92
+ subscribe: (callback: () => void) => Unsubscribe;
93
+ /**
94
+ * @deprecated This API is still under active development and might change without notice.
95
+ * For state-derivable transitions, prefer `subscribe` + `getState`. This channel is the
96
+ * escape hatch for transient occurrences not represented in state.
97
+ */
98
+ unstable_on: <E extends ComposerRuntimeEventType>(event: E, callback: ComposerRuntimeEventCallback<E>) => Unsubscribe;
82
99
  }>;
83
- type ThreadComposerRuntimeCore = ComposerRuntimeCore;
84
- type EditComposerRuntimeCore = ComposerRuntimeCore & Readonly<{
85
- parentId: string | null;
86
- sourceId: string | null;
100
+ export type ThreadComposerRuntimeCore = ComposerRuntimeCore;
101
+ export type EditComposerRuntimeCore = ComposerRuntimeCore & Readonly<{
102
+ parentId: string | null;
103
+ sourceId: string | null;
87
104
  }>;
88
- //#endregion
89
- export { AttachmentAddErrorEvent, AttachmentAddErrorReason, ComposerRuntimeCore, ComposerRuntimeEventCallback, ComposerRuntimeEventPayload, ComposerRuntimeEventType, DictationState, EditComposerRuntimeCore, SendOptions, ThreadComposerRuntimeCore };
90
105
  //# sourceMappingURL=composer-runtime-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composer-runtime-core.d.ts","names":[],"sources":["../../../src/runtime/interfaces/composer-runtime-core.ts"],"mappings":";;;;;;;;KASY;KAKA;WACD,QAAQ;WACR;WACA;WACA,QAAQ;;KAGP;;;;;EAKV;aACW;aACA;;;;;;EAMX;aAA0B;;EAC1B,oBAAoB;aACT;;;KAID,iCAAiC;KAEjC,6BAA6B,UAAU,6BACjD,SAAS,4BAA4B;KAG3B;WACD,QAAQ,iBAAiB;WACzB;WACA;;KAGC;EACV;;EAEA;;KAGU,sBAAsB;EAChC;EAEA;EACA;EACA;EAEA,sBAAsB;EACtB;EAEA,gBAAgB,kBAAkB,OAAO,qBAAqB;EAC9D,mBAAmB,yBAAyB;EAE5C;EACA,UAAU;EAEV,MAAM;EACN,UAAU,MAAM;EAEhB,WAAW;EACX,eAAe,WAAW;EAE1B,OAAO;EACP,WAAW,OAAO;EAElB,aAAa;EACb,wBAAwB;EAExB,OAAO,UAAU;EACjB;EAEA,gBAAgB;EAChB,gBAAgB,qBAAqB,WAAW;EAChD,kBAAkB;EAElB,WAAW;EACX;EACA;EAEA,YAAY,yBAAyB;;;;;;EAOrC,cAAc,UAAU,0BACtB,OAAO,GACP,UAAU,6BAA6B,OACpC;;KAGK,4BAA4B;KAE5B,0BAA0B,sBACpC;EACE;EACA"}
1
+ {"version":3,"file":"composer-runtime-core.d.ts","sourceRoot":"","sources":["../../../src/runtime/interfaces/composer-runtime-core.ts"],"names":[],"mappings":"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"}