@assistant-ui/react 0.15.17 → 0.15.19

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 (169) hide show
  1. package/README.md +8 -2
  2. package/dist/context/providers/ThreadViewportProvider.js +2 -2
  3. package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
  4. package/dist/hooks/useToolCallElapsed.js.map +1 -1
  5. package/dist/index.d.ts +7 -4
  6. package/dist/index.js +5 -3
  7. package/dist/mcp-apps/McpAppRenderer.d.ts +30 -8
  8. package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
  9. package/dist/mcp-apps/McpAppRenderer.js +91 -47
  10. package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
  11. package/dist/mcp-apps/app-frame.d.ts.map +1 -1
  12. package/dist/mcp-apps/app-frame.js +57 -33
  13. package/dist/mcp-apps/app-frame.js.map +1 -1
  14. package/dist/mcp-apps/bridge.js +9 -4
  15. package/dist/mcp-apps/bridge.js.map +1 -1
  16. package/dist/mcp-apps/index.d.ts +2 -2
  17. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  18. package/dist/primitives/assistantModal/AssistantModalRoot.js +47 -79
  19. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  20. package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
  21. package/dist/primitives/composer/ComposerAttachmentDropzone.js +61 -138
  22. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  23. package/dist/primitives/composer/ComposerInput.js +3 -8
  24. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  25. package/dist/primitives/composer/ComposerInputPluginContext.d.ts +1 -2
  26. package/dist/primitives/composer/ComposerInputPluginContext.d.ts.map +1 -1
  27. package/dist/primitives/composer/ComposerInputPluginContext.js +1 -6
  28. package/dist/primitives/composer/ComposerInputPluginContext.js.map +1 -1
  29. package/dist/primitives/composer/trigger/TriggerPopoverAction.js +46 -15
  30. package/dist/primitives/composer/trigger/TriggerPopoverAction.js.map +1 -1
  31. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js +40 -10
  32. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js.map +1 -1
  33. package/dist/primitives/composer/trigger/matchesTriggerItemQuery.d.ts +6 -0
  34. package/dist/primitives/composer/trigger/matchesTriggerItemQuery.d.ts.map +1 -0
  35. package/dist/primitives/composer/trigger/matchesTriggerItemQuery.js +9 -0
  36. package/dist/primitives/composer/trigger/matchesTriggerItemQuery.js.map +1 -0
  37. package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
  38. package/dist/primitives/composer/trigger/triggerKeyboardResource.js +53 -61
  39. package/dist/primitives/composer/trigger/triggerKeyboardResource.js.map +1 -1
  40. package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
  41. package/dist/primitives/composer/trigger/triggerNavigationResource.js +129 -141
  42. package/dist/primitives/composer/trigger/triggerNavigationResource.js.map +1 -1
  43. package/dist/primitives/message/MessageParts.js +2 -14
  44. package/dist/primitives/message/MessageParts.js.map +1 -1
  45. package/dist/primitives/message/MessagePartsGrouped.d.ts +3 -3
  46. package/dist/primitives/message/MessagePartsGrouped.js +2 -2
  47. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  48. package/dist/primitives/messagePart/MessagePartText.d.ts +2 -0
  49. package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -1
  50. package/dist/primitives/messagePart/MessagePartText.js +13 -36
  51. package/dist/primitives/messagePart/MessagePartText.js.map +1 -1
  52. package/dist/primitives/reasoning/useScrollLock.js +3 -1
  53. package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
  54. package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
  55. package/dist/primitives/thread/useThreadViewportAutoScroll.js +3 -3
  56. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  57. package/dist/sandbox-host/SandboxHost.d.ts.map +1 -1
  58. package/dist/sandbox-host/SandboxHost.js +36 -9
  59. package/dist/sandbox-host/SandboxHost.js.map +1 -1
  60. package/dist/unstable/useLiveCompletionAdapter.js +24 -2
  61. package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
  62. package/dist/unstable/useMentionAdapter.d.ts +9 -3
  63. package/dist/unstable/useMentionAdapter.d.ts.map +1 -1
  64. package/dist/unstable/useMentionAdapter.js +50 -43
  65. package/dist/unstable/useMentionAdapter.js.map +1 -1
  66. package/dist/unstable/useMessageStallDetection.d.ts +4 -5
  67. package/dist/unstable/useMessageStallDetection.d.ts.map +1 -1
  68. package/dist/unstable/useMessageStallDetection.js +16 -15
  69. package/dist/unstable/useMessageStallDetection.js.map +1 -1
  70. package/dist/unstable/useModelContextSnapshot.d.ts +34 -0
  71. package/dist/unstable/useModelContextSnapshot.d.ts.map +1 -0
  72. package/dist/unstable/useModelContextSnapshot.js +61 -0
  73. package/dist/unstable/useModelContextSnapshot.js.map +1 -0
  74. package/dist/unstable/useSlashCommandAdapter.d.ts.map +1 -1
  75. package/dist/unstable/useSlashCommandAdapter.js +2 -8
  76. package/dist/unstable/useSlashCommandAdapter.js.map +1 -1
  77. package/dist/unstable/webmcp/WebMcpRegistrationResource.d.ts +14 -0
  78. package/dist/unstable/webmcp/WebMcpRegistrationResource.d.ts.map +1 -0
  79. package/dist/unstable/webmcp/WebMcpRegistrationResource.js +85 -0
  80. package/dist/unstable/webmcp/WebMcpRegistrationResource.js.map +1 -0
  81. package/dist/unstable/webmcp/convertTools.d.ts +21 -0
  82. package/dist/unstable/webmcp/convertTools.d.ts.map +1 -0
  83. package/dist/unstable/webmcp/convertTools.js +161 -0
  84. package/dist/unstable/webmcp/convertTools.js.map +1 -0
  85. package/dist/unstable/webmcp/useWebMcpProvider.d.ts +21 -0
  86. package/dist/unstable/webmcp/useWebMcpProvider.d.ts.map +1 -0
  87. package/dist/unstable/webmcp/useWebMcpProvider.js +106 -0
  88. package/dist/unstable/webmcp/useWebMcpProvider.js.map +1 -0
  89. package/dist/unstable/webmcp/webmcp-host.d.ts +39 -0
  90. package/dist/unstable/webmcp/webmcp-host.d.ts.map +1 -0
  91. package/dist/unstable/webmcp/webmcp-host.js +29 -0
  92. package/dist/unstable/webmcp/webmcp-host.js.map +1 -0
  93. package/dist/utils/Primitive.d.ts +10 -2
  94. package/dist/utils/Primitive.d.ts.map +1 -1
  95. package/dist/utils/Primitive.js +25 -6
  96. package/dist/utils/Primitive.js.map +1 -1
  97. package/dist/utils/getSelectionMessageId.d.ts.map +1 -1
  98. package/dist/utils/getSelectionMessageId.js +17 -3
  99. package/dist/utils/getSelectionMessageId.js.map +1 -1
  100. package/package.json +13 -13
  101. package/src/context/providers/ThreadViewportProvider.tsx +2 -2
  102. package/src/hooks/useToolCallElapsed.ts +3 -0
  103. package/src/index.ts +14 -1
  104. package/src/mcp-apps/McpAppRenderer.test.tsx +253 -5
  105. package/src/mcp-apps/McpAppRenderer.tsx +147 -52
  106. package/src/mcp-apps/app-frame.test.tsx +437 -1
  107. package/src/mcp-apps/app-frame.tsx +76 -21
  108. package/src/mcp-apps/bridge.test.ts +98 -0
  109. package/src/mcp-apps/bridge.ts +14 -3
  110. package/src/mcp-apps/index.ts +5 -1
  111. package/src/primitives/assistantModal/AssistantModalRoot.test.tsx +123 -0
  112. package/src/primitives/assistantModal/AssistantModalRoot.tsx +11 -31
  113. package/src/primitives/assistantModal/AssistantModalTrigger.test.tsx +1 -16
  114. package/src/primitives/composer/ComposerAttachmentDropzone.test.tsx +43 -0
  115. package/src/primitives/composer/ComposerAttachmentDropzone.tsx +2 -10
  116. package/src/primitives/composer/ComposerInput.test.tsx +22 -0
  117. package/src/primitives/composer/ComposerInput.tsx +5 -9
  118. package/src/primitives/composer/ComposerInputPluginContext.tsx +0 -10
  119. package/src/primitives/composer/trigger/TriggerPopoverAction.tsx +4 -2
  120. package/src/primitives/composer/trigger/TriggerPopoverBehavior.test.tsx +109 -0
  121. package/src/primitives/composer/trigger/TriggerPopoverDirective.tsx +4 -2
  122. package/src/primitives/composer/trigger/matchesTriggerItemQuery.test.ts +52 -0
  123. package/src/primitives/composer/trigger/matchesTriggerItemQuery.ts +13 -0
  124. package/src/primitives/composer/trigger/triggerKeyboardResource.ts +13 -7
  125. package/src/primitives/composer/trigger/triggerNavigationResource.ts +8 -13
  126. package/src/primitives/message/MessageParts.tsx +1 -21
  127. package/src/primitives/message/MessagePartsGrouped.test.tsx +93 -0
  128. package/src/primitives/message/MessagePartsGrouped.tsx +6 -6
  129. package/src/primitives/messagePart/MessagePartText.test.tsx +69 -0
  130. package/src/primitives/messagePart/MessagePartText.tsx +22 -9
  131. package/src/primitives/reasoning/useScrollLock.test.tsx +129 -0
  132. package/src/primitives/reasoning/useScrollLock.ts +15 -1
  133. package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +38 -1
  134. package/src/primitives/thread/useThreadViewportAutoScroll.ts +7 -6
  135. package/src/sandbox-host/SandboxHost.test.tsx +160 -2
  136. package/src/sandbox-host/SandboxHost.tsx +50 -10
  137. package/src/tests/MessageParts.rendererOptions.test.tsx +117 -0
  138. package/src/tests/toolCallTiming.test.tsx +55 -1
  139. package/src/unstable/useComposerInputHistory.test.tsx +2 -1
  140. package/src/unstable/useLiveCompletionAdapter.test.tsx +202 -1
  141. package/src/unstable/useLiveCompletionAdapter.ts +38 -8
  142. package/src/unstable/useMentionAdapter.test.tsx +383 -0
  143. package/src/unstable/useMentionAdapter.ts +94 -57
  144. package/src/unstable/useMessageStallDetection.ts +26 -19
  145. package/src/unstable/useModelContextSnapshot.test.tsx +132 -0
  146. package/src/unstable/useModelContextSnapshot.ts +67 -0
  147. package/src/unstable/useSlashCommandAdapter.ts +2 -9
  148. package/src/unstable/webmcp/WebMcpRegistrationResource.ts +92 -0
  149. package/src/unstable/webmcp/__tests__/webmcp.fake.tsx +168 -0
  150. package/src/unstable/webmcp/convertTools.test.ts +553 -0
  151. package/src/unstable/webmcp/convertTools.ts +260 -0
  152. package/src/unstable/webmcp/useWebMcpProvider.test.tsx +466 -0
  153. package/src/unstable/webmcp/useWebMcpProvider.ts +148 -0
  154. package/src/unstable/webmcp/webmcp-host.test.ts +142 -0
  155. package/src/unstable/webmcp/webmcp-host.ts +83 -0
  156. package/src/utils/Primitive.test.tsx +46 -1
  157. package/src/utils/Primitive.tsx +37 -7
  158. package/src/utils/getSelectionMessageId.test.ts +176 -1
  159. package/src/utils/getSelectionMessageId.ts +21 -3
  160. package/dist/utils/invokeCallbackSafely.d.ts +0 -5
  161. package/dist/utils/invokeCallbackSafely.d.ts.map +0 -1
  162. package/dist/utils/invokeCallbackSafely.js +0 -15
  163. package/dist/utils/invokeCallbackSafely.js.map +0 -1
  164. package/dist/utils/useToolArgsFieldStatus.d.ts +0 -19
  165. package/dist/utils/useToolArgsFieldStatus.d.ts.map +0 -1
  166. package/dist/utils/useToolArgsFieldStatus.js +0 -23
  167. package/dist/utils/useToolArgsFieldStatus.js.map +0 -1
  168. package/src/utils/invokeCallbackSafely.ts +0 -11
  169. package/src/utils/useToolArgsFieldStatus.ts +0 -18
package/README.md CHANGED
@@ -48,7 +48,7 @@ npm install @assistant-ui/react @assistant-ui/ai-sdk
48
48
 
49
49
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
50
50
  import { useChatRuntime } from "@assistant-ui/ai-sdk";
51
- import { Thread } from "@/components/assistant-ui/thread";
51
+ import { Thread } from "@/components/assistant-ui/elements/thread.aui";
52
52
 
53
53
  export function Chat() {
54
54
  const runtime = useChatRuntime();
@@ -98,7 +98,13 @@ Sample customization to make a Perplexity lookalike:
98
98
 
99
99
  <a href="https://mastra.ai/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Mastra.svg" height="20" alt="Mastra"></a>, <a href="https://langchain.com/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/LangChain.svg" height="20" alt="LangChain"></a>, <a href="https://athenaintelligence.ai/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Athena-Intelligence.svg" height="20" alt="Athena Intelligence"></a>, <a href="https://browser-use.com/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Browser-Use.svg" height="20" alt="Browser Use"></a>, <a href="https://stack-ai.com/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Stack.svg" height="20" alt="Stack"></a>, <a href="https://inconvo.com/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Inconvo.svg" height="20" alt="Inconvo"></a>, <a href="https://iterable.com/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Iterable.svg" height="20" alt="Iterable"></a>, <a href="https://helicone.ai/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/helicone.svg" height="20" alt="Helicone"></a>, <a href="https://getgram.ai/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/gram.svg" height="20" alt="Gram"></a>, <a href="https://coreviz.io/?ref=assistant-ui" target="_blank" rel="noopener noreferrer"><img src="https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/logos/Coreviz.svg" height="20" alt="Coreviz"></a>, and many more.
100
100
 
101
- ![Chart of assistant-ui's traction](https://raw.githubusercontent.com/assistant-ui/assistant-ui/main/.github/assets/traction.png)
101
+ <a href="https://www.assistant-ui.com/traction">
102
+ <picture>
103
+ <source media="(prefers-color-scheme: dark)" srcset="https://www.assistant-ui.com/traction-dark.png" />
104
+ <source media="(prefers-color-scheme: light)" srcset="https://www.assistant-ui.com/traction.png" />
105
+ <img src="https://www.assistant-ui.com/traction.png" alt="Chart of assistant-ui's traction" width="100%" />
106
+ </picture>
107
+ </a>
102
108
 
103
109
  ## Demos
104
110
 
@@ -24,8 +24,8 @@ const useThreadViewportStoreValue = (options) => {
24
24
  let t2;
25
25
  let t3;
26
26
  if ($[3] !== outerViewport || $[4] !== store) {
27
- t2 = () => outerViewport?.getState().onScrollToBottom(() => {
28
- store.getState().scrollToBottom();
27
+ t2 = () => outerViewport?.getState().onScrollToBottom((config) => {
28
+ store.getState().scrollToBottom(config);
29
29
  });
30
30
  t3 = [outerViewport, store];
31
31
  $[3] = outerViewport;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewportProvider.js","names":["c","_c","FC","PropsWithChildren","useEffect","useState","makeThreadViewportStore","ThreadViewportStoreOptions","ThreadViewportContext","ThreadViewportContextValue","useThreadViewportStore","writableStore","ThreadViewportProviderProps","options","useThreadViewportStoreValue","$","t0","Symbol","for","optional","outerViewport","t1","store","t2","t3","getState","onScrollToBottom","scrollToBottom","t4","t5","subscribe","state","isAtBottom","setState","ThreadPrimitiveViewportProvider","children","undefined","useThreadViewport","context"],"sources":["../../../src/context/providers/ThreadViewportProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\n\nimport {\n makeThreadViewportStore,\n type ThreadViewportStoreOptions,\n} from \"../stores/ThreadViewport\";\nimport {\n ThreadViewportContext,\n type ThreadViewportContextValue,\n useThreadViewportStore,\n} from \"../react/ThreadViewportContext\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport type ThreadViewportProviderProps = PropsWithChildren<{\n options?: ThreadViewportStoreOptions;\n}>;\n\nconst useThreadViewportStoreValue = (options: ThreadViewportStoreOptions) => {\n const outerViewport = useThreadViewportStore({ optional: true });\n // Viewport options are initial configuration. Keeping them non-reactive avoids\n // fanout through every message in long threads when anchoring config changes.\n const [store] = useState(() => makeThreadViewportStore(options));\n\n // Forward scrollToBottom from outer viewport to inner viewport\n useEffect(() => {\n return outerViewport?.getState().onScrollToBottom(() => {\n store.getState().scrollToBottom();\n });\n }, [outerViewport, store]);\n\n useEffect(() => {\n if (!outerViewport) return;\n return store.subscribe((state) => {\n if (outerViewport.getState().isAtBottom !== state.isAtBottom) {\n writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });\n }\n });\n }, [store, outerViewport]);\n\n return store;\n};\n\nexport const ThreadPrimitiveViewportProvider: FC<\n ThreadViewportProviderProps\n> = ({ children, options = {} }) => {\n const useThreadViewport = useThreadViewportStoreValue(options);\n\n const [context] = useState<ThreadViewportContextValue>(() => {\n return {\n useThreadViewport,\n };\n });\n\n return (\n <ThreadViewportContext.Provider value={context}>\n {children}\n </ThreadViewportContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;AAmBA,MAAMc,+BAA8BD,YAAA;CAAA,MAAAE,IAAAd,EAAA,EAAA;CAAA,IAAAe;CAAA,IAAAD,EAAA,OAAAE,OAAAC,IAAA,2BAAA,GAAA;EACWF,KAAA,EAAAG,UAAY,KAAK;EAACJ,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAA/D,MAAAK,gBAAsBV,uBAAuBM,EAAkB;CAAE,IAAAK;CAAA,IAAAN,EAAA,OAAAF,SAAA;EAGxCQ,WAAMf,wBAAwBO,OAAO;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAA/D,MAAA,CAAAO,SAAgBjB,SAASgB,EAAsC;CAAE,IAAAE;CAAA,IAAAC;CAAA,IAAAT,EAAA,OAAAK,iBAAAL,EAAA,OAAAO,OAAA;EAGvDC,WACDH,eAAaK,SAA4B,CAAC,CAAAC,uBAAC;GAChDJ,MAAKG,SAAU,CAAC,CAAAE,eAAgB;EAAC,CAClC;EACAH,KAAA,CAACJ,eAAeE,KAAK;EAAC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B,YAAApB,EAAA,OAAAuB,SAAA;EAGDV,KAAA,oBAAA,sBAAA,UAAA;GAAuCU,OAAAA;GACpCH;EACH,CAAA;EAAiCpB,EAAA,KAAAoB;EAAApB,EAAA,KAAAuB;EAAAvB,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAFjCa;AAEiC"}
1
+ {"version":3,"file":"ThreadViewportProvider.js","names":["c","_c","FC","PropsWithChildren","useEffect","useState","makeThreadViewportStore","ThreadViewportStoreOptions","ThreadViewportContext","ThreadViewportContextValue","useThreadViewportStore","writableStore","ThreadViewportProviderProps","options","useThreadViewportStoreValue","$","t0","Symbol","for","optional","outerViewport","t1","store","t2","t3","getState","onScrollToBottom","config","scrollToBottom","t4","t5","subscribe","state","isAtBottom","setState","ThreadPrimitiveViewportProvider","children","undefined","useThreadViewport","context"],"sources":["../../../src/context/providers/ThreadViewportProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, type PropsWithChildren, useEffect, useState } from \"react\";\n\nimport {\n makeThreadViewportStore,\n type ThreadViewportStoreOptions,\n} from \"../stores/ThreadViewport\";\nimport {\n ThreadViewportContext,\n type ThreadViewportContextValue,\n useThreadViewportStore,\n} from \"../react/ThreadViewportContext\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport type ThreadViewportProviderProps = PropsWithChildren<{\n options?: ThreadViewportStoreOptions;\n}>;\n\nconst useThreadViewportStoreValue = (options: ThreadViewportStoreOptions) => {\n const outerViewport = useThreadViewportStore({ optional: true });\n // Viewport options are initial configuration. Keeping them non-reactive avoids\n // fanout through every message in long threads when anchoring config changes.\n const [store] = useState(() => makeThreadViewportStore(options));\n\n // Forward scrollToBottom from outer viewport to inner viewport\n useEffect(() => {\n return outerViewport?.getState().onScrollToBottom((config) => {\n store.getState().scrollToBottom(config);\n });\n }, [outerViewport, store]);\n\n useEffect(() => {\n if (!outerViewport) return;\n return store.subscribe((state) => {\n if (outerViewport.getState().isAtBottom !== state.isAtBottom) {\n writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });\n }\n });\n }, [store, outerViewport]);\n\n return store;\n};\n\nexport const ThreadPrimitiveViewportProvider: FC<\n ThreadViewportProviderProps\n> = ({ children, options = {} }) => {\n const useThreadViewport = useThreadViewportStoreValue(options);\n\n const [context] = useState<ThreadViewportContextValue>(() => {\n return {\n useThreadViewport,\n };\n });\n\n return (\n <ThreadViewportContext.Provider value={context}>\n {children}\n </ThreadViewportContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;AAmBA,MAAMc,+BAA8BD,YAAA;CAAA,MAAAE,IAAAd,EAAA,EAAA;CAAA,IAAAe;CAAA,IAAAD,EAAA,OAAAE,OAAAC,IAAA,2BAAA,GAAA;EACWF,KAAA,EAAAG,UAAY,KAAK;EAACJ,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAA/D,MAAAK,gBAAsBV,uBAAuBM,EAAkB;CAAE,IAAAK;CAAA,IAAAN,EAAA,OAAAF,SAAA;EAGxCQ,WAAMf,wBAAwBO,OAAO;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAA/D,MAAA,CAAAO,SAAgBjB,SAASgB,EAAsC;CAAE,IAAAE;CAAA,IAAAC;CAAA,IAAAT,EAAA,OAAAK,iBAAAL,EAAA,OAAAO,OAAA;EAGvDC,WACDH,eAAaK,SAA4B,CAAC,CAAAC,kBAACC,WAAA;GAChDL,MAAKG,SAAU,CAAC,CAAAG,eAAgBD,MAAM;EAAC,CACxC;EACAH,KAAA,CAACJ,eAAeE,KAAK;EAACP,EAAA,KAAAK;EAAAL,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAA;EAAAD,KAAAR,EAAA;EAAAS,KAAAT,EAAA;CAAA;CAJzBX,UAAUmB,IAIPC,EAAsB;CAAC,IAAAK;CAAA,IAAAC;CAAA,IAAAf,EAAA,OAAAK,iBAAAL,EAAA,OAAAO,OAAA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"useToolCallElapsed.js","names":["c","_c","useEffect","useState","useAuiState","useToolCallElapsed","$","timing","_temp","partRunning","_temp2","running","undefined","completedAt","now","setNow","_temp3","t0","t1","Date","id","setInterval","clearInterval","Math","max","startedAt","s","part","optional","type","s_0","part_0","status"],"sources":["../../src/hooks/useToolCallElapsed.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that returns the elapsed wall-clock time of the current tool call in\n * milliseconds, ticking once per second while the call runs.\n *\n * Reads `part.timing`. Returns `undefined` when the part is not a tool call,\n * carries no timing, ended without a recorded completion (the duration is\n * unknown), or when no message part scope is available (so kit components\n * stay renderable standalone, e.g. in docs previews).\n *\n * @example\n * ```tsx\n * function ToolDuration() {\n * const elapsedMs = useToolCallElapsed();\n * if (elapsedMs === undefined) return null;\n * return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;\n * }\n * ```\n */\nexport const useToolCallElapsed = (): number | undefined => {\n const timing = useAuiState((s) => {\n const part = s.optional.part;\n return part?.type === \"tool-call\" ? part.timing : undefined;\n });\n const partRunning = useAuiState((s) => {\n const part = s.optional.part;\n return part?.type === \"tool-call\" && part.status.type === \"running\";\n });\n const running =\n timing !== undefined && timing.completedAt === undefined && partRunning;\n const [now, setNow] = useState(() => Date.now());\n\n useEffect(() => {\n if (!running) return undefined;\n setNow(Date.now());\n const id = setInterval(() => setNow(Date.now()), 1000);\n return () => clearInterval(id);\n }, [running]);\n\n if (timing === undefined) return undefined;\n if (timing.completedAt !== undefined)\n return Math.max(0, timing.completedAt - timing.startedAt);\n if (!running) return undefined;\n return Math.max(0, now - timing.startedAt);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAaK,2BAAqB;CAAA,MAAAC,IAAAL,EAAA,CAAA;CAChC,MAAAM,SAAeH,YAAYI,KAG1B;CACD,MAAAC,cAAoBL,YAAYM,MAG/B;CACD,MAAAC,UACEJ,WAAWK,KAAAA,KAAaL,OAAMM,gBAAiBD,KAAAA,KAA/CH;CACF,MAAA,CAAAK,KAAAC,UAAsBZ,SAASa,MAAgB;CAAE,IAAAC;CAAA,IAAAC;CAAA,IAAAZ,EAAA,OAAAK,SAAA;EAEvCM,WAAA;GACR,IAAI,CAACN,SAAO;GACZI,OAAOI,KAAIL,IAAK,CAAC;GACjB,MAAAM,KAAWC,kBAAkBN,OAAOI,KAAIL,IAAK,CAAC,GAAG,GAAI;GAAE,aAC1CQ,cAAcF,EAAE;EAAC;EAC7BF,KAAA,CAACP,OAAO;EAACL,EAAA,KAAAK;EAAAL,EAAA,KAAAW;EAAAX,EAAA,KAAAY;CAAA,OAAA;EAAAD,KAAAX,EAAA;EAAAY,KAAAZ,EAAA;CAAA;CALZJ,UAAUe,IAKPC,EAAS;CAEZ,IAAIX,WAAWK,KAAAA,GAAS;CACxB,IAAIL,OAAMM,gBAAiBD,KAAAA,GAAS,OAC3BW,KAAIC,IAAK,GAAGjB,OAAMM,cAAeN,OAAMkB,SAAU;CAC1D,IAAI,CAACd,SAAO;CAAmB,OACxBY,KAAIC,IAAK,GAAGV,MAAMP,OAAMkB,SAAU;AAAC;AAxBV,SAAAjB,MAAAkB,GAAA;CAE9B,MAAAC,OAAaD,EAACE,SAASD;CAAM,OACtBA,MAAIE,SAAW,cAAcF,KAAIpB,SAAjCK,KAAAA;AAAoD;AAH7B,SAAAF,OAAAoB,KAAA;CAM9B,MAAAC,SAAaL,IAACE,SAASD;CAAM,OACtBA,QAAIE,SAAW,eAAeF,OAAIK,OAAOH,SAAU;AAAS;AAPrC,SAAAb,SAAA;CAAA,OAWKG,KAAIL,IAAK;AAAC"}
1
+ {"version":3,"file":"useToolCallElapsed.js","names":["c","_c","useEffect","useState","useAuiState","useToolCallElapsed","$","timing","_temp","partRunning","_temp2","running","undefined","completedAt","now","setNow","_temp3","t0","t1","Date","id","setInterval","clearInterval","Math","max","startedAt","s","part","optional","type","s_0","part_0","status"],"sources":["../../src/hooks/useToolCallElapsed.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that returns the elapsed wall-clock time of the current tool call in\n * milliseconds, ticking once per second while the call runs.\n *\n * Reads `part.timing`. Returns `undefined` when the part is not a tool call,\n * carries no timing, ended without a recorded completion (the duration is\n * unknown), or when no message part scope is available (so kit components\n * stay renderable standalone, e.g. in docs previews).\n *\n * @example\n * ```tsx\n * function ToolDuration() {\n * const elapsedMs = useToolCallElapsed();\n * if (elapsedMs === undefined) return null;\n * return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;\n * }\n * ```\n */\nexport const useToolCallElapsed = (): number | undefined => {\n const timing = useAuiState((s) => {\n const part = s.optional.part;\n return part?.type === \"tool-call\" ? part.timing : undefined;\n });\n const partRunning = useAuiState((s) => {\n const part = s.optional.part;\n return part?.type === \"tool-call\" && part.status.type === \"running\";\n });\n const running =\n timing !== undefined && timing.completedAt === undefined && partRunning;\n const [now, setNow] = useState(() => Date.now());\n\n useEffect(() => {\n if (!running) return undefined;\n // The clock is an external source; this catches the elapsed value up before\n // the interval takes over.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setNow(Date.now());\n const id = setInterval(() => setNow(Date.now()), 1000);\n return () => clearInterval(id);\n }, [running]);\n\n if (timing === undefined) return undefined;\n if (timing.completedAt !== undefined)\n return Math.max(0, timing.completedAt - timing.startedAt);\n if (!running) return undefined;\n return Math.max(0, now - timing.startedAt);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAaK,2BAAqB;CAAA,MAAAC,IAAAL,EAAA,CAAA;CAChC,MAAAM,SAAeH,YAAYI,KAG1B;CACD,MAAAC,cAAoBL,YAAYM,MAG/B;CACD,MAAAC,UACEJ,WAAWK,KAAAA,KAAaL,OAAMM,gBAAiBD,KAAAA,KAA/CH;CACF,MAAA,CAAAK,KAAAC,UAAsBZ,SAASa,MAAgB;CAAE,IAAAC;CAAA,IAAAC;CAAA,IAAAZ,EAAA,OAAAK,SAAA;EAEvCM,WAAA;GACR,IAAI,CAACN,SAAO;GAIZI,OAAOI,KAAIL,IAAK,CAAC;GACjB,MAAAM,KAAWC,kBAAkBN,OAAOI,KAAIL,IAAK,CAAC,GAAG,GAAI;GAAE,aAC1CQ,cAAcF,EAAE;EAAC;EAC7BF,KAAA,CAACP,OAAO;EAACL,EAAA,KAAAK;EAAAL,EAAA,KAAAW;EAAAX,EAAA,KAAAY;CAAA,OAAA;EAAAD,KAAAX,EAAA;EAAAY,KAAAZ,EAAA;CAAA;CARZJ,UAAUe,IAQPC,EAAS;CAEZ,IAAIX,WAAWK,KAAAA,GAAS;CACxB,IAAIL,OAAMM,gBAAiBD,KAAAA,GAAS,OAC3BW,KAAIC,IAAK,GAAGjB,OAAMM,cAAeN,OAAMkB,SAAU;CAC1D,IAAI,CAACd,SAAO;CAAmB,OACxBY,KAAIC,IAAK,GAAGV,MAAMP,OAAMkB,SAAU;AAAC;AA3BV,SAAAjB,MAAAkB,GAAA;CAE9B,MAAAC,OAAaD,EAACE,SAASD;CAAM,OACtBA,MAAIE,SAAW,cAAcF,KAAIpB,SAAjCK,KAAAA;AAAoD;AAH7B,SAAAF,OAAAoB,KAAA;CAM9B,MAAAC,SAAaL,IAACE,SAASD;CAAM,OACtBA,QAAIE,SAAW,eAAeF,OAAIK,OAAOH,SAAU;AAAS;AAPrC,SAAAb,SAAA;CAAA,OAWKG,KAAIL,IAAK;AAAC"}
package/dist/index.d.ts CHANGED
@@ -66,14 +66,17 @@ import { Unstable_UseLiveCompletionAdapterOptions, unstable_useLiveCompletionAda
66
66
  import { Unstable_ComposerInputHistory, unstable_useComposerInputHistory } from "./unstable/useComposerInputHistory.js";
67
67
  import { Unstable_ComposerInput, Unstable_TriggerPopoverAriaProps, Unstable_UseComposerInputOptions, unstable_useComposerInput, unstable_useTriggerPopoverAriaProps } from "./unstable/useComposerInput.js";
68
68
  import { McpAppBridgeHandlers, McpAppDisplayMode, McpAppHostContext, McpAppHostInfo, McpAppMetadata, McpAppResource, McpAppResourceCSP, McpAppResourceMeta, McpAppSandboxConfig, McpAppToolCallParams, McpAppsHost, McpAppsRemoteHostOptions, ToolCallMessagePartMcpMetadata } from "./mcp-apps/types.js";
69
- import { McpAppRenderer, McpAppRendererOptions } from "./mcp-apps/McpAppRenderer.js";
69
+ import { McpAppPartOptions, McpAppRenderer, McpAppRendererOptions } from "./mcp-apps/McpAppRenderer.js";
70
70
  import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
71
71
  import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
72
72
  import "./mcp-apps/index.js";
73
+ import { Unstable_WebMcpProviderOptions, Unstable_WebMcpProviderResult, unstable_useWebMcpProvider } from "./unstable/webmcp/useWebMcpProvider.js";
74
+ import { defaultWebMcpFilter } from "./unstable/webmcp/convertTools.js";
73
75
  import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, EnrichedPartState, FileMessagePartComponent, FileMessagePartProps, GenerativeUIComponentRegistry, GenerativeUIMessagePartComponent, GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, GenerativeUIRenderProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpAppResourceOutput, McpToolkitDefinition, McpToolkitEntry, McpToolkitToolConfig, PartState, ProviderToolConfig, QuoteMessagePartComponent, QuoteMessagePartProps, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, Unstable_InferInteractableState, Unstable_InteractableConfig, Unstable_InteractableDefinition, Unstable_InteractablePersistedState, Unstable_InteractablePersistenceAdapter, Unstable_InteractablePersistenceStatus, Unstable_InteractableRegistration, Unstable_InteractableStateSchema, Unstable_InteractableToolConfig, Unstable_InteractableToolRenderProps, Unstable_InteractableVersionInfo, Unstable_InteractablesClientSchema, Unstable_InteractablesConfig, Unstable_InteractablesMethods, Unstable_InteractablesState, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useCloudThreadListRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
74
76
  import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiConfig, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
75
- import { AssistantCloud } from "assistant-cloud";
76
- import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, CreateSuggestionAdapterOptions, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreBranchChange, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessageNotSentError, MessagePartRuntime, MessagePartState, MessagePartStatus, MessagePartStreamStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PartProviderMetadata, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RemoteThreadListProviderComponent, RespondToToolApprovalOptions, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, SuggestionAdapterGenerateOptions, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_InteractableSnapshotEntry, Unstable_InteractableVersion, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
77
+ import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, CreateSuggestionAdapterOptions, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreBranchChange, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessageNotSentError, MessagePartRuntime, MessagePartState, MessagePartStatus, MessagePartStreamStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PartProviderMetadata, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RemoteThreadListProviderComponent, RespondToToolApprovalOptions, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, SuggestionAdapterGenerateOptions, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalDisplay, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_InteractableSnapshotEntry, Unstable_InteractableVersion, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
78
+ import { AssistantCloud, readAnonymousRefreshToken } from "assistant-cloud";
77
79
  import { ChainOfThoughtClient, ComposerSendOptions, ExternalThread, ExternalThreadMessage, ExternalThreadProps, InMemoryThreadList, InMemoryThreadListProps, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, RemoteThreadList, RemoteThreadListProps, SingleThreadList, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
80
+ import { ShimLoadError, ShimLoadErrorCode } from "safe-content-frame";
78
81
  import { Tool } from "assistant-stream";
79
- export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiConfig, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type CreateSuggestionAdapterOptions, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppBridgeHandlers, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, MessageNotSentError, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, type MessagePartStreamStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartProviderMetadata, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, RemoteThreadList, type RemoteThreadListAdapter, type RemoteThreadListProps, type RemoteThreadListProviderComponent, type RespondToToolApprovalOptions, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, type SuggestionAdapterGenerateOptions, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInput, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersion, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_MessageStallDetection, type Unstable_MessageStallDetectionOptions, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type TriggerMatch as Unstable_TriggerMatch, type TriggerMatcher as Unstable_TriggerMatcher, type Unstable_TriggerPopoverAriaProps, type Unstable_UseComposerInputOptions, type Unstable_UseLiveCompletionAdapterOptions, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
82
+ export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiConfig, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type CreateSuggestionAdapterOptions, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppBridgeHandlers, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, type McpAppPartOptions, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, MessageNotSentError, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, type MessagePartStreamStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartProviderMetadata, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, RemoteThreadList, type RemoteThreadListAdapter, type RemoteThreadListProps, type RemoteThreadListProviderComponent, type RespondToToolApprovalOptions, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, type ShimLoadError, type ShimLoadErrorCode, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, type SuggestionAdapterGenerateOptions, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolApprovalDisplay, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInput, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersion, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_MessageStallDetection, type Unstable_MessageStallDetectionOptions, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type TriggerMatch as Unstable_TriggerMatch, type TriggerMatcher as Unstable_TriggerMatcher, type Unstable_TriggerPopoverAriaProps, type Unstable_UseComposerInputOptions, type Unstable_UseLiveCompletionAdapterOptions, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unstable_WebMcpProviderOptions, type Unstable_WebMcpProviderResult, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, readAnonymousRefreshToken, stubTool, tool, toolApprovalAcceptsText, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, defaultWebMcpFilter as unstable_defaultWebMcpFilter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, unstable_useWebMcpProvider, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
package/dist/index.js CHANGED
@@ -61,9 +61,11 @@ import { unstable_useComposerInput, unstable_useTriggerPopoverAriaProps } from "
61
61
  import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
62
62
  import { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
63
63
  import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
64
+ import { defaultWebMcpFilter } from "./unstable/webmcp/convertTools.js";
65
+ import { unstable_useWebMcpProvider } from "./unstable/webmcp/useWebMcpProvider.js";
64
66
  import { DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, RuntimeAdapterProvider, Tools, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useCloudThreadListRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
65
67
  import { AuiConfig, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
66
- import { AssistantCloud } from "assistant-cloud";
67
- import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, MessageNotSentError, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
68
+ import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, MessageNotSentError, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
69
+ import { AssistantCloud, readAnonymousRefreshToken } from "assistant-cloud";
68
70
  import { ChainOfThoughtClient, ExternalThread, InMemoryThreadList, ModelContext as ModelContextClient, RemoteThreadList, SingleThreadList, Suggestions } from "@assistant-ui/core/store";
69
- export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiConfig, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessageNotSentError, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RemoteThreadList, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
71
+ export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiConfig, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessageNotSentError, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RemoteThreadList, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, readAnonymousRefreshToken, stubTool, tool, toolApprovalAcceptsText, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, defaultWebMcpFilter as unstable_defaultWebMcpFilter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, unstable_useWebMcpProvider, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
@@ -1,15 +1,14 @@
1
1
  import { McpAppBridgeHandlers, McpAppHostContext, McpAppHostInfo, McpAppSandboxConfig, McpAppsHost } from "./types.js";
2
2
  import { ToolCallMessagePartComponent } from "@assistant-ui/core/react";
3
+ import { ToolCallMessagePart } from "@assistant-ui/core";
3
4
  import { ReactNode } from "react";
4
5
  import { ResourceElement } from "@assistant-ui/tap";
5
6
  //#region src/mcp-apps/McpAppRenderer.d.ts
6
- type McpAppRendererOptions = {
7
- /**
8
- * Provides the data-plane operations the widget can request
9
- * (`loadResource`, `callTool`, `readResource`, `listResources`). Use
10
- * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.
11
- */
12
- host: ResourceElement<McpAppsHost>;
7
+ /**
8
+ * Options that apply to a single MCP app. `McpAppRenderer` takes them as
9
+ * thread-wide defaults, and its `forPart` resolver overrides them for one part.
10
+ */
11
+ type McpAppPartOptions = {
13
12
  /** Sandbox + container styling. Passes through to SafeContentFrame. */
14
13
  sandbox?: McpAppSandboxConfig;
15
14
  /**
@@ -24,6 +23,10 @@ type McpAppRendererOptions = {
24
23
  /**
25
24
  * Optional widget interaction and lifecycle handlers. Data-plane handlers
26
25
  * (`callTool`, `readResource`, `listResources`) always use `host`.
26
+ *
27
+ * Which handlers a widget may call is captured when its frame mounts, so a
28
+ * `forPart` resolver returns the same handler keys for a part on every
29
+ * render even when the implementations change.
27
30
  */
28
31
  handlers?: Omit<McpAppBridgeHandlers, "callTool" | "readResource" | "listResources">;
29
32
  /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */
@@ -33,9 +36,28 @@ type McpAppRendererOptions = {
33
36
  /** Rendered when the resource load rejects. Defaults to `fallback`. */
34
37
  errorFallback?: ReactNode | ((error: Error) => ReactNode);
35
38
  };
39
+ type McpAppRendererOptions = McpAppPartOptions & {
40
+ /**
41
+ * Provides the data-plane operations the widget can request
42
+ * (`loadResource`, `callTool`, `readResource`, `listResources`). Use
43
+ * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.
44
+ */
45
+ host: ResourceElement<McpAppsHost>;
46
+ /**
47
+ * Resolves the options for one part. Each returned value replaces the
48
+ * thread-wide option of the same name, so a host can give every MCP app its
49
+ * own display mode and answer `requestDisplayMode` for the part that asked.
50
+ *
51
+ * `handlers` is the exception and merges per key. Its keys are capabilities
52
+ * negotiated with the widget rather than data, so replacing the whole bag to
53
+ * add one handler would withdraw the others from that part's widget with
54
+ * nothing to observe it by.
55
+ */
56
+ forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;
57
+ };
36
58
  declare const McpAppRenderer: import("@assistant-ui/tap").Resource<{
37
59
  readonly render: ToolCallMessagePartComponent;
38
60
  }, [options: McpAppRendererOptions]>;
39
61
  //#endregion
40
- export { McpAppRenderer, McpAppRendererOptions };
62
+ export { McpAppPartOptions, McpAppRenderer, McpAppRendererOptions };
41
63
  //# sourceMappingURL=McpAppRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAppRenderer.d.ts","names":[],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"mappings":";;;;;KAgCY;;;;;;EAMV,MAAM,gBAAgB;;EAEtB,UAAU;;;;;EAKV;;EAEA,WAAW;;EAEX,cAAc;;;;;EAKd,WAAW,KACT;;EAIF,WAAW;;EAEX,kBAAkB;;EAElB,gBAAgB,cAAc,OAAO,UAAU;;cAyNpC,4CAAc;WA5BL,QAAA;IA4BmC,SAAA"}
1
+ {"version":3,"file":"McpAppRenderer.d.ts","names":[],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"mappings":";;;;;;;;;;KAuCY;;EAEV,UAAU;;;;;EAKV;;EAEA,WAAW;;EAEX,cAAc;;;;;;;;;EASd,WAAW,KACT;;EAIF,WAAW;;EAEX,kBAAkB;;EAElB,gBAAgB,cAAc,OAAO,UAAU;;KAGrC,wBAAwB;;;;;;EAMlC,MAAM,gBAAgB;;;;;;;;;;;EAWtB,WAAW,MAAM,wBAAwB;;cA+R9B,4CAAc;WA3BL,QAAA;IA2BmC,SAAA"}
@@ -8,6 +8,14 @@ import { Fragment, jsx } from "react/jsx-runtime";
8
8
  import { isRecord } from "@assistant-ui/core/internal";
9
9
  import { resource, useResource } from "@assistant-ui/tap";
10
10
  //#region src/mcp-apps/McpAppRenderer.tsx
11
+ const isSameOptions = (a, b) => {
12
+ const aKeys = Object.keys(a).filter((key) => key !== "host");
13
+ const bKeys = Object.keys(b).filter((key) => key !== "host");
14
+ if (aKeys.length !== bKeys.length) return false;
15
+ const aValues = a;
16
+ const bValues = b;
17
+ return aKeys.every((key) => Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]));
18
+ };
11
19
  function getInput(part) {
12
20
  if (part.status.type === "running" && (part.argsText === "" || part.argsText === "{}")) return;
13
21
  return part.args;
@@ -15,17 +23,41 @@ function getInput(part) {
15
23
  const defaultOpenLink = ({ url }) => {
16
24
  window.open(url, "_blank", "noopener,noreferrer");
17
25
  };
18
- function extractSendMessageText(params) {
19
- if (typeof params === "string") return params;
26
+ function extractSendMessageTexts(params) {
27
+ if (typeof params === "string") return [params];
20
28
  if (!params || typeof params !== "object") return void 0;
21
29
  const obj = params;
22
- if (typeof obj["prompt"] === "string") return obj["prompt"];
23
- if (typeof obj["text"] === "string") return obj["text"];
24
- if (typeof obj["message"] === "string") return obj["message"];
30
+ if (typeof obj["prompt"] === "string") return [obj["prompt"]];
31
+ if (typeof obj["text"] === "string") return [obj["text"]];
32
+ if (typeof obj["message"] === "string") return [obj["message"]];
33
+ if (Array.isArray(obj["content"])) return obj["content"].filter((block) => isRecord(block) && block["type"] === "text" && typeof block["text"] === "string").map((block) => block.text);
34
+ }
35
+ function extractSendMessageContent(params) {
36
+ const texts = extractSendMessageTexts(params);
37
+ if (!texts) return { reason: "unrecognised params shape" };
38
+ const content = texts.filter((text) => text !== "").map((text) => ({
39
+ type: "text",
40
+ text
41
+ }));
42
+ if (content.length === 0) return { reason: "no text content to append" };
43
+ return { content };
25
44
  }
26
- function InlineRenderer({ part, useHostStore, optionsRef }) {
27
- const opts = optionsRef.current;
45
+ function resolvePartOptions(options, part) {
46
+ const overrides = options.forPart?.(part);
47
+ if (!overrides) return options;
48
+ const handlers = options.handlers && overrides.handlers ? {
49
+ ...options.handlers,
50
+ ...overrides.handlers
51
+ } : overrides.handlers ?? options.handlers;
52
+ return {
53
+ ...options,
54
+ ...overrides,
55
+ ...handlers === void 0 ? {} : { handlers }
56
+ };
57
+ }
58
+ function InlineRenderer({ part, useRendererStore }) {
28
59
  const aui = useAui();
60
+ const opts = resolvePartOptions(useRendererStore((state) => state.options), part);
29
61
  const app = getMcpAppFromToolPart(part);
30
62
  const cachedAppRef = useRef(void 0);
31
63
  useLayoutEffect(() => {
@@ -33,7 +65,7 @@ function InlineRenderer({ part, useHostStore, optionsRef }) {
33
65
  }, [app]);
34
66
  const appForRender = app ?? cachedAppRef.current;
35
67
  const [loadedResource, setLoadedResource] = useState();
36
- const host = useHostStore((state) => state.host);
68
+ const host = useRendererStore((state_0) => state_0.host);
37
69
  const resourceUri = appForRender?.resourceUri;
38
70
  const serverId = appForRender?.serverId;
39
71
  const callerHandlers = opts.handlers;
@@ -43,58 +75,63 @@ function InlineRenderer({ part, useHostStore, optionsRef }) {
43
75
  const targetHost = host;
44
76
  const targetUri = resourceUri;
45
77
  const targetServerId = serverId;
46
- targetHost.loadResource({
47
- uri: targetUri,
48
- ...targetServerId ? { serverId: targetServerId } : {}
49
- }).then((res) => {
50
- if (!cancelled) setLoadedResource({
51
- host: targetHost,
52
- resourceUri: targetUri,
53
- ...targetServerId !== void 0 ? { serverId: targetServerId } : {},
54
- resource: res
55
- });
56
- }).catch((error) => {
57
- if (!cancelled) setLoadedResource({
58
- host: targetHost,
59
- resourceUri: targetUri,
60
- ...targetServerId !== void 0 ? { serverId: targetServerId } : {},
61
- error: error instanceof Error ? error : new Error(String(error))
62
- });
63
- });
78
+ const loadResource = async () => {
79
+ await Promise.resolve();
80
+ if (cancelled || useRendererStore.getState().host !== targetHost) return;
81
+ try {
82
+ const res = await targetHost.loadResource({
83
+ uri: targetUri,
84
+ ...targetServerId ? { serverId: targetServerId } : {}
85
+ });
86
+ if (!cancelled) setLoadedResource({
87
+ host: targetHost,
88
+ resourceUri: targetUri,
89
+ ...targetServerId !== void 0 ? { serverId: targetServerId } : {},
90
+ resource: res
91
+ });
92
+ } catch (error) {
93
+ if (!cancelled) setLoadedResource({
94
+ host: targetHost,
95
+ resourceUri: targetUri,
96
+ ...targetServerId !== void 0 ? { serverId: targetServerId } : {},
97
+ error: error instanceof Error ? error : new Error(String(error))
98
+ });
99
+ }
100
+ };
101
+ loadResource();
64
102
  return () => {
65
103
  cancelled = true;
66
104
  };
67
105
  }, [
68
106
  host,
69
107
  resourceUri,
70
- serverId
108
+ serverId,
109
+ useRendererStore
71
110
  ]);
72
111
  const bridgeHandlers = useMemo(() => ({
73
112
  ...callerHandlers,
74
113
  openLink: callerHandlers?.openLink ?? defaultOpenLink,
75
114
  sendMessage: callerHandlers?.sendMessage ?? ((params) => {
76
- const text = extractSendMessageText(params);
77
- if (!text) return {
115
+ const result = extractSendMessageContent(params);
116
+ if ("reason" in result) return {
117
+ isError: true,
78
118
  ok: false,
79
- reason: "unrecognised params shape"
119
+ reason: result.reason
80
120
  };
81
- aui.thread.append({ content: [{
82
- type: "text",
83
- text
84
- }] });
121
+ aui.thread.append({ content: result.content });
85
122
  return { ok: true };
86
123
  }),
87
- callTool: (params_0) => useHostStore.getState().host.callTool({
124
+ callTool: (params_0) => useRendererStore.getState().host.callTool({
88
125
  ...params_0,
89
126
  ...serverId ? { serverId } : {}
90
127
  }),
91
- readResource: (params_1) => useHostStore.getState().host.readResource({
128
+ readResource: (params_1) => useRendererStore.getState().host.readResource({
92
129
  ...params_1,
93
130
  ...serverId ? { serverId } : {}
94
131
  }),
95
132
  listResources: (params_2) => {
96
- if (!serverId) return useHostStore.getState().host.listResources(params_2);
97
- return useHostStore.getState().host.listResources({
133
+ if (!serverId) return useRendererStore.getState().host.listResources(params_2);
134
+ return useRendererStore.getState().host.listResources({
98
135
  ...isRecord(params_2) ? params_2 : {},
99
136
  serverId
100
137
  });
@@ -103,7 +140,7 @@ function InlineRenderer({ part, useHostStore, optionsRef }) {
103
140
  aui,
104
141
  callerHandlers,
105
142
  serverId,
106
- useHostStore
143
+ useRendererStore
107
144
  ]);
108
145
  const loadedResourceForApp = loadedResource?.host === host && loadedResource?.resourceUri === appForRender?.resourceUri && loadedResource?.serverId === appForRender?.serverId ? loadedResource : void 0;
109
146
  const appResource = loadedResourceForApp?.resource;
@@ -139,21 +176,28 @@ function InlineRenderer({ part, useHostStore, optionsRef }) {
139
176
  */
140
177
  const useMcpAppRenderer = (options) => {
141
178
  const host = useResource(options.host);
142
- const optionsRef = useRef(options);
143
- optionsRef.current = options;
144
- const [useHostStore] = useState(() => create(() => ({ host })));
179
+ const [useRendererStore] = useState(() => create(() => ({
180
+ host,
181
+ options
182
+ })));
145
183
  useEffect(() => {
146
- useHostStore.setState({ host });
147
- }, [host, useHostStore]);
184
+ useRendererStore.setState((prev) => prev.host === host && isSameOptions(prev.options, options) ? prev : {
185
+ host,
186
+ options
187
+ });
188
+ }, [
189
+ host,
190
+ options,
191
+ useRendererStore
192
+ ]);
148
193
  return { render: useMemo(() => {
149
194
  const Render = (props) => /* @__PURE__ */ jsx(InlineRenderer, {
150
195
  part: props,
151
- useHostStore,
152
- optionsRef
196
+ useRendererStore
153
197
  });
154
198
  Render.displayName = "McpAppRenderer";
155
199
  return Render;
156
- }, [useHostStore]) };
200
+ }, [useRendererStore]) };
157
201
  };
158
202
  const McpAppRenderer = resource(useMcpAppRenderer);
159
203
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpAppRenderer.js","names":["useEffect","useLayoutEffect","useMemo","useRef","useState","MutableRefObject","ReactNode","McpAppMetadata","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppRendererOptions","host","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","LoadedResourceState","resourceUri","serverId","UseHostStore","getInput","part","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageText","params","obj","Record","InlineRenderer","useHostStore","optionsRef","opts","current","aui","app","cachedAppRef","appForRender","loadedResource","setLoadedResource","state","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","uri","then","res","catch","String","bridgeHandlers","openLink","sendMessage","text","ok","reason","thread","append","content","callTool","getState","readResource","listResources","loadedResourceForApp","appResource","result","useMcpAppRenderer","options","render","setState","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type MutableRefObject,\n type ReactNode,\n} from \"react\";\nimport type { McpAppMetadata } from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\nexport type McpAppRendererOptions = {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype UseHostStore = UseBoundStore<StoreApi<{ host: McpAppsHost }>>;\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageText(params: unknown): string | undefined {\n if (typeof params === \"string\") return params;\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return obj[\"prompt\"];\n if (typeof obj[\"text\"] === \"string\") return obj[\"text\"];\n if (typeof obj[\"message\"] === \"string\") return obj[\"message\"];\n return undefined;\n}\n\nfunction InlineRenderer({\n part,\n useHostStore,\n optionsRef,\n}: {\n part: ToolCallMessagePartProps;\n useHostStore: UseHostStore;\n optionsRef: MutableRefObject<McpAppRendererOptions>;\n}) {\n const opts = optionsRef.current;\n const aui = useAui();\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useHostStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n targetHost\n .loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n })\n .then((res) => {\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n })\n .catch((error: unknown) => {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const text = extractSendMessageText(params);\n if (!text) return { ok: false, reason: \"unrecognised params shape\" };\n aui.thread.append({ content: [{ type: \"text\", text }] });\n return { ok: true };\n }),\n callTool: (params) =>\n useHostStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useHostStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useHostStore.getState().host.listResources(params);\n }\n return useHostStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useHostStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n const optionsRef = useRef<McpAppRendererOptions>(options);\n optionsRef.current = options;\n\n const [useHostStore] = useState(() =>\n create<{ host: McpAppsHost }>(() => ({ host })),\n );\n useEffect(() => {\n useHostStore.setState({ host });\n }, [host, useHostStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer\n part={props}\n useHostStore={useHostStore}\n optionsRef={optionsRef}\n />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useHostStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;AA4EA,SAAS2C,SAASC,MAIN;CACV,IACEA,KAAKC,OAAOC,SAAS,cACpBF,KAAKG,aAAa,MAAMH,KAAKG,aAAa,OAE3C;CAEF,OAAOH,KAAKI;AACd;AAEA,MAAME,mBAAmB,EAAEC,UAA2B;CACpDC,OAAOC,KAAKF,KAAK,UAAU,qBAAqB;AAClD;AAEA,SAASG,uBAAuBC,QAAqC;CACnE,IAAI,OAAOA,WAAW,UAAU,OAAOA;CACvC,IAAI,CAACA,UAAU,OAAOA,WAAW,UAAU,OAAON,KAAAA;CAClD,MAAMO,MAAMD;CACZ,IAAI,OAAOC,IAAI,cAAc,UAAU,OAAOA,IAAI;CAClD,IAAI,OAAOA,IAAI,YAAY,UAAU,OAAOA,IAAI;CAChD,IAAI,OAAOA,IAAI,eAAe,UAAU,OAAOA,IAAI;AAErD;AAEA,SAASE,eAAe,EACtBd,MACAe,cACAC,cAKC;CACD,MAAMC,OAAOD,WAAWE;CACxB,MAAMC,MAAMrD,OAAO;CACnB,MAAMsD,MAAMxC,sBAAsBoB,IAAI;CACtC,MAAMqB,eAAe9D,OA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EACpD,IAAI,OAAOE,kBAAkB,YAAY,OAAO,oBAAA,UAAA,EAAA,UAAGA,cAAcC,OAAK,EAAE,CAAA;EACxE,OAAO,oBAAA,UAAA,EAAA,UAAGD,cAAc,CAAA;CAC1B;CACA,IAAI2D,eAAe,MACjB,OAAO,oBAAA,UAAA,EAAA,UAAGlC,KAAK1B,mBAAmBD,SAAS,CAAA;CAG7C,OACE,oBAAC,aAAD;EACE,KAAKgC;EACL,UAAU6B;EACV,OAAOpD,SAASC,IAAI;EACpB,QAAQA,KAAKoD;EACb,SAASnC,KAAKjC;EACd,UAAUqD;EACV,UAAUpB,KAAK/B;EACf,aAAa+B,KAAK9B;EAClB,WAAW8B,KAAKhC;CAAU,CAAA;AAGhC;;;;;;;;;AAUA,MAAMoE,qBACJC,YACsD;CACtD,MAAMvE,OAAOb,YAAYoF,QAAQvE,IAAI;CAErC,MAAMiC,aAAazD,OAA8B+F,OAAO;CACxDtC,WAAWE,UAAUoC;CAErB,MAAM,CAACvC,gBAAgBvD,eACrBO,cAAqC,EAAEgB,KAAK,EAAE,CAChD;CACA3B,gBAAgB;EACd2D,aAAayC,SAAS,EAAEzE,KAAK,CAAC;CAChC,GAAG,CAACA,MAAMgC,YAAY,CAAC;CAcvB,OAAO,EAAEwC,QAZMjG,cAA4C;EACzD,MAAMmG,UAAwCC,UAC5C,oBAAC,gBAAD;GACE,MAAMA;GACQ3C;GACFC;EAAW,CAAA;EAG3ByC,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAAC1C,YAAY,CAEPwC,EAAO;AAClB;AAEA,MAAaK,iBAAiBzF,SAASkF,iBAAiB"}
1
+ {"version":3,"file":"McpAppRenderer.js","names":["useEffect","useLayoutEffect","useMemo","useRef","useState","ReactNode","McpAppMetadata","TextMessagePart","ToolCallMessagePart","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppPartOptions","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","McpAppRendererOptions","host","forPart","part","LoadedResourceState","resourceUri","serverId","RendererState","options","UseRendererStore","isSameOptions","a","b","aKeys","Object","keys","filter","key","bKeys","length","aValues","Record","bValues","every","hasOwn","is","getInput","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageTexts","params","obj","Array","isArray","block","text","map","extractSendMessageContent","content","reason","texts","resolvePartOptions","overrides","InlineRenderer","useRendererStore","aui","rendererOptions","state","opts","app","cachedAppRef","current","appForRender","loadedResource","setLoadedResource","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","Promise","resolve","getState","res","uri","String","bridgeHandlers","openLink","sendMessage","result","isError","ok","thread","append","callTool","readResource","listResources","loadedResourceForApp","appResource","useMcpAppRenderer","render","setState","prev","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport type {\n McpAppMetadata,\n TextMessagePart,\n ToolCallMessagePart,\n} from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\n/**\n * Options that apply to a single MCP app. `McpAppRenderer` takes them as\n * thread-wide defaults, and its `forPart` resolver overrides them for one part.\n */\nexport type McpAppPartOptions = {\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n *\n * Which handlers a widget may call is captured when its frame mounts, so a\n * `forPart` resolver returns the same handler keys for a part on every\n * render even when the implementations change.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\nexport type McpAppRendererOptions = McpAppPartOptions & {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /**\n * Resolves the options for one part. Each returned value replaces the\n * thread-wide option of the same name, so a host can give every MCP app its\n * own display mode and answer `requestDisplayMode` for the part that asked.\n *\n * `handlers` is the exception and merges per key. Its keys are capabilities\n * negotiated with the widget rather than data, so replacing the whole bag to\n * add one handler would withdraw the others from that part's widget with\n * nothing to observe it by.\n */\n forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype RendererState = {\n host: McpAppsHost;\n options: McpAppRendererOptions;\n};\n\ntype UseRendererStore = UseBoundStore<StoreApi<RendererState>>;\n\n// Callers pass options as an object literal, so the resource hands this a fresh\n// identity on every run; comparing the values keeps an unchanged run from\n// re-rendering every mounted part. `host` is excluded because it is an element\n// rebuilt on every run, and the store carries the resolved host separately.\nconst isSameOptions = (\n a: McpAppRendererOptions,\n b: McpAppRendererOptions,\n): boolean => {\n const aKeys = Object.keys(a).filter((key) => key !== \"host\");\n const bKeys = Object.keys(b).filter((key) => key !== \"host\");\n if (aKeys.length !== bKeys.length) return false;\n const aValues = a as Record<string, unknown>;\n const bValues = b as Record<string, unknown>;\n return aKeys.every(\n (key) =>\n Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]),\n );\n};\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageTexts(params: unknown): string[] | undefined {\n if (typeof params === \"string\") return [params];\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return [obj[\"prompt\"]];\n if (typeof obj[\"text\"] === \"string\") return [obj[\"text\"]];\n if (typeof obj[\"message\"] === \"string\") return [obj[\"message\"]];\n if (Array.isArray(obj[\"content\"])) {\n return obj[\"content\"]\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n isRecord(block) &&\n block[\"type\"] === \"text\" &&\n typeof block[\"text\"] === \"string\",\n )\n .map((block) => block.text);\n }\n return undefined;\n}\n\nfunction extractSendMessageContent(\n params: unknown,\n): { content: TextMessagePart[] } | { reason: string } {\n const texts = extractSendMessageTexts(params);\n if (!texts) return { reason: \"unrecognised params shape\" };\n const content = texts\n .filter((text) => text !== \"\")\n .map((text): TextMessagePart => ({ type: \"text\", text }));\n if (content.length === 0) {\n return { reason: \"no text content to append\" };\n }\n return { content };\n}\n\nfunction resolvePartOptions(\n options: McpAppRendererOptions,\n part: ToolCallMessagePartProps,\n): McpAppRendererOptions {\n const overrides = options.forPart?.(part);\n if (!overrides) return options;\n const handlers =\n options.handlers && overrides.handlers\n ? { ...options.handlers, ...overrides.handlers }\n : (overrides.handlers ?? options.handlers);\n return {\n ...options,\n ...overrides,\n ...(handlers === undefined ? {} : { handlers }),\n };\n}\n\nfunction InlineRenderer({\n part,\n useRendererStore,\n}: {\n part: ToolCallMessagePartProps;\n useRendererStore: UseRendererStore;\n}) {\n const aui = useAui();\n const rendererOptions = useRendererStore((state) => state.options);\n const opts = resolvePartOptions(rendererOptions, part);\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useRendererStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n // Host changes are published later in this passive flush. Defer until that\n // publication lands, then verify this effect still owns the current host.\n const loadResource = async () => {\n await Promise.resolve();\n if (cancelled || useRendererStore.getState().host !== targetHost) return;\n try {\n const res = await targetHost.loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n });\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n } catch (error: unknown) {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n };\n void loadResource();\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId, useRendererStore]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const result = extractSendMessageContent(params);\n if (\"reason\" in result) {\n return { isError: true, ok: false, reason: result.reason };\n }\n aui.thread.append({ content: result.content });\n return { ok: true };\n }),\n callTool: (params) =>\n useRendererStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useRendererStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useRendererStore.getState().host.listResources(params);\n }\n return useRendererStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useRendererStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n // The rendered component identity has to stay stable, or every part remounts\n // its frame; options reach the parts through the store instead of props.\n const [useRendererStore] = useState(() =>\n create<RendererState>(() => ({ host, options })),\n );\n useEffect(() => {\n useRendererStore.setState((prev) =>\n prev.host === host && isSameOptions(prev.options, options)\n ? prev\n : { host, options },\n );\n }, [host, options, useRendererStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer part={props} useRendererStore={useRendererStore} />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useRendererStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;AA8GA,MAAMiD,iBACJC,GACAC,MACY;CACZ,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC,CAAC,CAACK,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,MAAMC,QAAQJ,OAAOC,KAAKH,CAAC,CAAC,CAACI,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,IAAIJ,MAAMM,WAAWD,MAAMC,QAAQ,OAAO;CAC1C,MAAMC,UAAUT;CAChB,MAAMW,UAAUV;CAChB,OAAOC,MAAMU,OACVN,QACCH,OAAOU,OAAOF,SAASL,GAAG,KAAKH,OAAOW,GAAGL,QAAQH,MAAMK,QAAQL,IAAI,CACvE;AACF;AAEA,SAASS,SAASvB,MAIN;CACV,IACEA,KAAKwB,OAAOC,SAAS,cACpBzB,KAAK0B,aAAa,MAAM1B,KAAK0B,aAAa,OAE3C;CAEF,OAAO1B,KAAK2B;AACd;AAEA,MAAME,mBAAmB,EA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pC,OAAO,EAAEqC,QARM7H,cAA4C;EACzD,MAAMgI,UAAwCC,UAC5C,oBAAC,gBAAD;GAAgB,MAAMA;GAAyBzC;EAAiB,CAAA;EAElEwC,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAACxC,gBAAgB,CAEXqC,EAAO;AAClB;AAEA,MAAaM,iBAAiBrH,SAAS8G,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-frame.d.ts","names":[],"sources":["../../src/mcp-apps/app-frame.tsx"],"mappings":";;iBAqGgB,cACd,KACA,UACA,OACA,QACA,SACA,UACA,UACA,aACA,aACC,mCAAgB,IAAA"}
1
+ {"version":3,"file":"app-frame.d.ts","names":[],"sources":["../../src/mcp-apps/app-frame.tsx"],"mappings":";;iBA8JgB,cACd,KACA,UACA,OACA,QACA,SACA,UACA,UACA,aACA,aACC,mCAAgB,IAAA"}