@assistant-ui/react 0.14.14 → 0.14.15

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 (207) hide show
  1. package/README.md +5 -1
  2. package/dist/client/ExternalThread.d.ts +2 -12
  3. package/dist/client/ExternalThread.d.ts.map +1 -1
  4. package/dist/client/ExternalThread.js +30 -29
  5. package/dist/client/ExternalThread.js.map +1 -1
  6. package/dist/client/InMemoryThreadList.d.ts.map +1 -1
  7. package/dist/client/InMemoryThreadList.js +11 -10
  8. package/dist/client/InMemoryThreadList.js.map +1 -1
  9. package/dist/client/SingleThreadList.d.ts.map +1 -1
  10. package/dist/client/SingleThreadList.js +9 -8
  11. package/dist/client/SingleThreadList.js.map +1 -1
  12. package/dist/context/providers/ThreadViewportProvider.js +1 -1
  13. package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
  14. package/dist/context/react/ThreadViewportContext.js +1 -1
  15. package/dist/context/react/utils/createContextHook.js +1 -1
  16. package/dist/context/react/utils/ensureBinding.js.map +1 -1
  17. package/dist/context/react/utils/useRuntimeState.js +1 -1
  18. package/dist/context/stores/ThreadViewport.js.map +1 -1
  19. package/dist/devtools/DevToolsHooks.js.map +1 -1
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +3 -3
  22. package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -1
  23. package/dist/legacy-runtime/cloud/auiV0.js +1 -1
  24. package/dist/legacy-runtime/hooks/AssistantContext.js.map +1 -1
  25. package/dist/legacy-runtime/hooks/AttachmentContext.js.map +1 -1
  26. package/dist/legacy-runtime/hooks/ComposerContext.js.map +1 -1
  27. package/dist/legacy-runtime/hooks/MessageContext.js.map +1 -1
  28. package/dist/legacy-runtime/hooks/MessagePartContext.js.map +1 -1
  29. package/dist/legacy-runtime/hooks/ThreadContext.js +1 -1
  30. package/dist/legacy-runtime/hooks/ThreadContext.js.map +1 -1
  31. package/dist/legacy-runtime/hooks/ThreadListItemContext.js.map +1 -1
  32. package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js +1 -1
  33. package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.js +1 -1
  34. package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js +1 -1
  35. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +1 -1
  36. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  37. package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js +1 -1
  38. package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.js +1 -1
  39. package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
  40. package/dist/mcp-apps/McpAppRenderer.js +7 -7
  41. package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
  42. package/dist/mcp-apps/McpAppsRemoteHost.d.ts.map +1 -1
  43. package/dist/mcp-apps/McpAppsRemoteHost.js +5 -4
  44. package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
  45. package/dist/mcp-apps/app-frame.d.ts +1 -1
  46. package/dist/mcp-apps/app-frame.d.ts.map +1 -1
  47. package/dist/mcp-apps/app-frame.js +82 -104
  48. package/dist/mcp-apps/app-frame.js.map +1 -1
  49. package/dist/mcp-apps/bridge.d.ts +3 -3
  50. package/dist/mcp-apps/bridge.d.ts.map +1 -1
  51. package/dist/mcp-apps/bridge.js +35 -10
  52. package/dist/mcp-apps/bridge.js.map +1 -1
  53. package/dist/mcp-apps/types.d.ts +2 -12
  54. package/dist/mcp-apps/types.d.ts.map +1 -1
  55. package/dist/mcp-apps/types.js.map +1 -1
  56. package/dist/model-context/frame/useAssistantFrameHost.js +1 -1
  57. package/dist/model-context/makeAssistantVisible.js +1 -1
  58. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  59. package/dist/primitives/actionBar/ActionBarCopy.js +1 -1
  60. package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -1
  61. package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
  62. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -1
  63. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -1
  64. package/dist/primitives/actionBar/ActionBarInteractionContext.js +1 -1
  65. package/dist/primitives/actionBar/ActionBarRoot.js +1 -1
  66. package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -1
  67. package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -1
  68. package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -1
  69. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -1
  70. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -1
  71. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -1
  72. package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
  73. package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
  74. package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
  75. package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
  76. package/dist/primitives/attachment/AttachmentRemove.js +1 -1
  77. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
  78. package/dist/primitives/attachment/AttachmentRoot.js +1 -1
  79. package/dist/primitives/attachment/AttachmentThumb.js +1 -1
  80. package/dist/primitives/branchPicker/BranchPickerRoot.js +1 -1
  81. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -1
  82. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
  83. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +1 -1
  84. package/dist/primitives/composer/ComposerAddAttachment.js +1 -1
  85. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  86. package/dist/primitives/composer/ComposerAttachmentDropzone.js +1 -1
  87. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  88. package/dist/primitives/composer/ComposerDictationTranscript.js +1 -1
  89. package/dist/primitives/composer/ComposerInput.js +1 -1
  90. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  91. package/dist/primitives/composer/ComposerInputPluginContext.js +1 -1
  92. package/dist/primitives/composer/ComposerQuote.js +1 -1
  93. package/dist/primitives/composer/ComposerQuote.js.map +1 -1
  94. package/dist/primitives/composer/ComposerRoot.js +1 -1
  95. package/dist/primitives/composer/ComposerSend.js +1 -1
  96. package/dist/primitives/composer/ComposerStopDictation.js +1 -1
  97. package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
  98. package/dist/primitives/composer/trigger/TriggerPopover.js +2 -2
  99. package/dist/primitives/composer/trigger/TriggerPopover.js.map +1 -1
  100. package/dist/primitives/composer/trigger/TriggerPopoverAction.js +1 -1
  101. package/dist/primitives/composer/trigger/TriggerPopoverBack.js +1 -1
  102. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +1 -1
  103. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js +1 -1
  104. package/dist/primitives/composer/trigger/TriggerPopoverItems.js +1 -1
  105. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -1
  106. package/dist/primitives/composer/trigger/TriggerPopoverResource.js +8 -7
  107. package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -1
  108. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js +1 -1
  109. package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts.map +1 -1
  110. package/dist/primitives/composer/trigger/triggerDetectionResource.js +5 -4
  111. package/dist/primitives/composer/trigger/triggerDetectionResource.js.map +1 -1
  112. package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
  113. package/dist/primitives/composer/trigger/triggerKeyboardResource.js +8 -7
  114. package/dist/primitives/composer/trigger/triggerKeyboardResource.js.map +1 -1
  115. package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
  116. package/dist/primitives/composer/trigger/triggerNavigationResource.js +13 -12
  117. package/dist/primitives/composer/trigger/triggerNavigationResource.js.map +1 -1
  118. package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
  119. package/dist/primitives/composer/trigger/triggerSelectionResource.js +7 -6
  120. package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
  121. package/dist/primitives/error/ErrorMessage.js +1 -1
  122. package/dist/primitives/error/ErrorRoot.js +1 -1
  123. package/dist/primitives/message/MessagePartsGrouped.js +1 -1
  124. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  125. package/dist/primitives/message/MessageRoot.js +1 -1
  126. package/dist/primitives/message/MessageRoot.js.map +1 -1
  127. package/dist/primitives/messagePart/MessagePartImage.js +1 -1
  128. package/dist/primitives/messagePart/MessagePartText.js +1 -1
  129. package/dist/primitives/queueItem/QueueItemRemove.js +1 -1
  130. package/dist/primitives/queueItem/QueueItemRemove.js.map +1 -1
  131. package/dist/primitives/queueItem/QueueItemSteer.js +1 -1
  132. package/dist/primitives/queueItem/QueueItemSteer.js.map +1 -1
  133. package/dist/primitives/queueItem/QueueItemText.js +1 -1
  134. package/dist/primitives/reasoning/useScrollLock.js +1 -1
  135. package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
  136. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +1 -1
  137. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js.map +1 -1
  138. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +1 -1
  139. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
  140. package/dist/primitives/suggestion/SuggestionDescription.js +1 -1
  141. package/dist/primitives/suggestion/SuggestionTitle.js +1 -1
  142. package/dist/primitives/suggestion/SuggestionTrigger.js +1 -1
  143. package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
  144. package/dist/primitives/thread/ThreadRoot.js +1 -1
  145. package/dist/primitives/thread/ThreadScrollToBottom.js +1 -1
  146. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  147. package/dist/primitives/thread/ThreadViewport.js +1 -1
  148. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  149. package/dist/primitives/thread/ThreadViewportFooter.js +1 -1
  150. package/dist/primitives/thread/ThreadViewportFooter.js.map +1 -1
  151. package/dist/primitives/thread/topAnchor/topAnchorTurn.js.map +1 -1
  152. package/dist/primitives/thread/topAnchor/topAnchorUtils.js.map +1 -1
  153. package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js +1 -1
  154. package/dist/primitives/thread/useThreadViewportAutoScroll.js +1 -1
  155. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  156. package/dist/primitives/threadList/ThreadListNew.js +1 -1
  157. package/dist/primitives/threadList/ThreadListRoot.js +1 -1
  158. package/dist/primitives/threadListItem/ThreadListItemRoot.js +1 -1
  159. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -1
  160. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -1
  161. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -1
  162. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -1
  163. package/dist/sandbox-host/SandboxHost.d.ts +50 -0
  164. package/dist/sandbox-host/SandboxHost.d.ts.map +1 -0
  165. package/dist/sandbox-host/SandboxHost.js +85 -0
  166. package/dist/sandbox-host/SandboxHost.js.map +1 -0
  167. package/dist/unstable/useMentionAdapter.js +1 -1
  168. package/dist/unstable/useMentionAdapter.js.map +1 -1
  169. package/dist/unstable/useSlashCommandAdapter.js +1 -1
  170. package/dist/unstable/useSlashCommandAdapter.js.map +1 -1
  171. package/dist/utils/Primitive.js +1 -1
  172. package/dist/utils/createActionButton.js +1 -1
  173. package/dist/utils/createActionButton.js.map +1 -1
  174. package/dist/utils/hooks/useManagedRef.js +1 -1
  175. package/dist/utils/hooks/useMediaQuery.js +1 -1
  176. package/dist/utils/hooks/useMediaQuery.js.map +1 -1
  177. package/dist/utils/hooks/useOnResizeContent.js +1 -1
  178. package/dist/utils/hooks/useOnScrollToBottom.js +1 -1
  179. package/dist/utils/hooks/useSizeHandle.js +1 -1
  180. package/dist/utils/json/is-json.js.map +1 -1
  181. package/dist/utils/smooth/SmoothContext.js +1 -1
  182. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  183. package/dist/utils/smooth/useSmooth.js +1 -1
  184. package/dist/utils/smooth/useSmooth.js.map +1 -1
  185. package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
  186. package/dist/utils/useToolArgsFieldStatus.d.ts.map +1 -1
  187. package/package.json +21 -20
  188. package/src/client/ExternalThread.ts +484 -515
  189. package/src/client/InMemoryThreadList.ts +153 -162
  190. package/src/client/SingleThreadList.ts +87 -84
  191. package/src/context/providers/ThreadViewportProvider.tsx +2 -2
  192. package/src/index.ts +8 -1
  193. package/src/mcp-apps/McpAppRenderer.tsx +28 -35
  194. package/src/mcp-apps/McpAppsRemoteHost.ts +25 -24
  195. package/src/mcp-apps/app-frame.tsx +100 -141
  196. package/src/mcp-apps/bridge.test.ts +100 -60
  197. package/src/mcp-apps/bridge.ts +43 -21
  198. package/src/mcp-apps/types.ts +2 -12
  199. package/src/primitives/composer/trigger/TriggerPopover.tsx +1 -1
  200. package/src/primitives/composer/trigger/TriggerPopoverResource.ts +75 -76
  201. package/src/primitives/composer/trigger/triggerDetectionResource.ts +6 -5
  202. package/src/primitives/composer/trigger/triggerKeyboardResource.ts +9 -13
  203. package/src/primitives/composer/trigger/triggerNavigationResource.ts +14 -19
  204. package/src/primitives/composer/trigger/triggerSelectionResource.ts +8 -7
  205. package/src/sandbox-host/SandboxHost.test.tsx +231 -0
  206. package/src/sandbox-host/SandboxHost.tsx +185 -0
  207. package/src/tests/local-runtime-queue.test.tsx +305 -0
@@ -1,6 +1,5 @@
1
+ import { SandboxHostConfig } from "../sandbox-host/SandboxHost.js";
1
2
  import { McpAppMetadata, ToolCallMessagePartMcpMetadata } from "@assistant-ui/core";
2
- import { CSSProperties } from "react";
3
- import { SandboxOption } from "safe-content-frame";
4
3
 
5
4
  //#region src/mcp-apps/types.d.ts
6
5
  declare const MCP_APP_MIME_TYPE: "text/html;profile=mcp-app";
@@ -94,16 +93,7 @@ type McpAppBridgeHandlers = {
94
93
  onLog?: (params: unknown) => void;
95
94
  onError?: (error: Error) => void;
96
95
  };
97
- type McpAppSandboxConfig = {
98
- sandbox?: SandboxOption[];
99
- useShadowDom?: boolean;
100
- enableBrowserCaching?: boolean;
101
- salt?: string;
102
- product?: string;
103
- className?: string;
104
- style?: CSSProperties;
105
- unsafeDocumentWrite?: boolean;
106
- };
96
+ type McpAppSandboxConfig = SandboxHostConfig;
107
97
  type McpAppFrameProps = {
108
98
  app: McpAppMetadata;
109
99
  resource: McpAppResource;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/mcp-apps/types.ts"],"mappings":";;;;;cASa,iBAAA;AAAA,cAEA,wBAAA;AAAA,KAED,iBAAA;EACV,cAAA;EACA,eAAA;EACA,YAAA;EAAA,CACC,CAAA;AAAA;AAAA,KAGS,kBAAA;EACV,aAAA;EACA,GAAA,GAAM,iBAAA;EACN,WAAA,GAAc,MAAM;EAAA,CACnB,CAAA;AAAA;AAAA,KAGS,cAAA;EACV,GAAA;EACA,QAAA,SAAiB,iBAAA;EACjB,IAAA;EACA,IAAA,GAAO,kBAAkB;AAAA;AAAA,KAGf,iBAAA;AAAA,KAEA,iBAAA;EACV,KAAA;EACA,WAAA,GAAc,iBAAA;EACd,qBAAA,GAAwB,iBAAiB;EAAA,CACxC,CAAA;AAAA;AAAA,KAGS,cAAA;EACV,IAAA;EACA,OAAO;AAAA;;AArBG;AAGZ;;;KA0BY,WAAA;EACV,YAAA,GAAe,MAAA;IAAU,GAAA;EAAA,MAAkB,OAAA,CAAQ,cAAA;EACnD,QAAA,GAAW,MAAA,EAAQ,oBAAA,KAAyB,OAAA;EAC5C,YAAA,GAAe,MAAA;IAAU,GAAA;EAAA,MAAkB,OAAA;EAC3C,aAAA,GAAgB,MAAA,eAAqB,OAAA;AAAA;;;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,KAGnB,oBAAA,GACR,oBAAA,GACA,yBAAA,GACA,qBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/mcp-apps/types.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type {\n McpAppMetadata,\n ToolCallMessagePartMcpMetadata,\n} from \"@assistant-ui/core\";\nimport type { SandboxOption } from \"safe-content-frame\";\n\nexport type { McpAppMetadata, ToolCallMessagePartMcpMetadata };\n\nexport const MCP_APP_MIME_TYPE = \"text/html;profile=mcp-app\" as const;\n\nexport const MCP_APP_PROTOCOL_VERSION = \"0.1\" as const;\n\nexport type McpAppResourceCSP = {\n connectDomains?: string[];\n resourceDomains?: string[];\n frameDomains?: string[];\n [k: string]: unknown;\n};\n\nexport type McpAppResourceMeta = {\n prefersBorder?: boolean;\n csp?: McpAppResourceCSP;\n permissions?: Record<string, unknown>;\n [k: string]: unknown;\n};\n\nexport type McpAppResource = {\n uri: string;\n mimeType: typeof MCP_APP_MIME_TYPE;\n html: string;\n meta?: McpAppResourceMeta;\n};\n\nexport type McpAppDisplayMode = \"inline\" | \"fullscreen\" | \"pip\";\n\nexport type McpAppHostContext = {\n theme?: \"light\" | \"dark\";\n displayMode?: McpAppDisplayMode;\n availableDisplayModes?: McpAppDisplayMode[];\n [k: string]: unknown;\n};\n\nexport type McpAppHostInfo = {\n name: string;\n version: string;\n};\n\n/**\n * What `McpAppRenderer` needs from its host — the data-plane operations\n * the widget can request. Provided by a host resource like\n * `McpAppsRemoteHost`.\n */\nexport type McpAppsHost = {\n loadResource: (params: { uri: string }) => Promise<McpAppResource>;\n callTool: (params: McpAppToolCallParams) => Promise<unknown>;\n readResource: (params: { uri: string }) => Promise<unknown>;\n listResources: (params?: unknown) => Promise<unknown>;\n};\n\n/**\n * Options for `McpAppsRemoteHost`. The host POSTs `{ method, params }` to\n * `url` and expects JSON responses. Method names sent:\n * - `mcp-apps/read-resource` (`{ uri }`) → `McpAppResource`\n * - `tools/call` (`{ name, arguments? }`) → tool result\n * - `resources/read` (`{ uri }`) → resource read result\n * - `resources/list` (`params?`) → list result\n */\nexport type McpAppsRemoteHostOptions = {\n url: string;\n fetch?: typeof fetch;\n headers?:\n | Record<string, string>\n | (() => Record<string, string> | Promise<Record<string, string>>);\n};\n\nexport type McpAppToolCallParams = {\n name: string;\n arguments?: Record<string, unknown>;\n};\n\nexport type McpAppBridgeHandlers = {\n allowedTools?: readonly string[];\n callTool?: (params: McpAppToolCallParams) => Promise<unknown> | unknown;\n readResource?: (params: { uri: string }) => Promise<unknown> | unknown;\n listResources?: (params?: unknown) => Promise<unknown> | unknown;\n openLink?: (params: { url: string }) => Promise<unknown> | unknown;\n sendMessage?: (params: unknown) => Promise<unknown> | unknown;\n updateModelContext?: (params: unknown) => Promise<unknown> | unknown;\n requestDisplayMode?: (params: {\n mode: McpAppDisplayMode;\n }) => Promise<{ mode: McpAppDisplayMode }> | { mode: McpAppDisplayMode };\n onSizeChange?: (params: { width?: number; height?: number }) => void;\n onInitialized?: () => void;\n onRequestTeardown?: (params: unknown) => void;\n onLog?: (params: unknown) => void;\n onError?: (error: Error) => void;\n};\n\nexport type McpAppSandboxConfig = {\n sandbox?: SandboxOption[];\n useShadowDom?: boolean;\n enableBrowserCaching?: boolean;\n salt?: string;\n product?: string;\n className?: string;\n style?: CSSProperties;\n unsafeDocumentWrite?: boolean;\n};\n\nexport type McpAppFrameProps = {\n app: McpAppMetadata;\n resource: McpAppResource;\n input?: unknown;\n output?: unknown;\n sandbox?: McpAppSandboxConfig | undefined;\n handlers?: McpAppBridgeHandlers | undefined;\n hostInfo?: McpAppHostInfo | undefined;\n hostContext?: McpAppHostContext | undefined;\n /**\n * Upper bound (in pixels) for the auto-resize height driven by the widget's\n * `notifications/size_changed`. Defaults to 800.\n */\n maxHeight?: number | undefined;\n};\n\nexport type McpAppJsonRpcRequest = {\n jsonrpc: \"2.0\";\n id: string | number;\n method: string;\n params?: unknown;\n};\n\nexport type McpAppJsonRpcNotification = {\n jsonrpc: \"2.0\";\n method: string;\n params?: unknown;\n};\n\nexport type McpAppJsonRpcError = {\n code: number;\n message: string;\n data?: unknown;\n};\n\nexport type McpAppJsonRpcResponse =\n | {\n jsonrpc: \"2.0\";\n id: string | number;\n result: unknown;\n error?: never;\n }\n | {\n jsonrpc: \"2.0\";\n id: string | number;\n result?: never;\n error: McpAppJsonRpcError;\n };\n\nexport type McpAppJsonRpcMessage =\n | McpAppJsonRpcRequest\n | McpAppJsonRpcNotification\n | McpAppJsonRpcResponse;\n"],"mappings":";AASA,MAAa,oBAAoB;AAEjC,MAAa,2BAA2B"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/mcp-apps/types.ts"],"sourcesContent":["import type {\n McpAppMetadata,\n ToolCallMessagePartMcpMetadata,\n} from \"@assistant-ui/core\";\nimport type { SandboxHostConfig } from \"../sandbox-host/SandboxHost\";\n\nexport type { McpAppMetadata, ToolCallMessagePartMcpMetadata };\n\nexport const MCP_APP_MIME_TYPE = \"text/html;profile=mcp-app\" as const;\n\nexport const MCP_APP_PROTOCOL_VERSION = \"0.1\" as const;\n\nexport type McpAppResourceCSP = {\n connectDomains?: string[];\n resourceDomains?: string[];\n frameDomains?: string[];\n [k: string]: unknown;\n};\n\nexport type McpAppResourceMeta = {\n prefersBorder?: boolean;\n csp?: McpAppResourceCSP;\n permissions?: Record<string, unknown>;\n [k: string]: unknown;\n};\n\nexport type McpAppResource = {\n uri: string;\n mimeType: typeof MCP_APP_MIME_TYPE;\n html: string;\n meta?: McpAppResourceMeta;\n};\n\nexport type McpAppDisplayMode = \"inline\" | \"fullscreen\" | \"pip\";\n\nexport type McpAppHostContext = {\n theme?: \"light\" | \"dark\";\n displayMode?: McpAppDisplayMode;\n availableDisplayModes?: McpAppDisplayMode[];\n [k: string]: unknown;\n};\n\nexport type McpAppHostInfo = {\n name: string;\n version: string;\n};\n\n/**\n * What `McpAppRenderer` needs from its host — the data-plane operations\n * the widget can request. Provided by a host resource like\n * `McpAppsRemoteHost`.\n */\nexport type McpAppsHost = {\n loadResource: (params: { uri: string }) => Promise<McpAppResource>;\n callTool: (params: McpAppToolCallParams) => Promise<unknown>;\n readResource: (params: { uri: string }) => Promise<unknown>;\n listResources: (params?: unknown) => Promise<unknown>;\n};\n\n/**\n * Options for `McpAppsRemoteHost`. The host POSTs `{ method, params }` to\n * `url` and expects JSON responses. Method names sent:\n * - `mcp-apps/read-resource` (`{ uri }`) → `McpAppResource`\n * - `tools/call` (`{ name, arguments? }`) → tool result\n * - `resources/read` (`{ uri }`) → resource read result\n * - `resources/list` (`params?`) → list result\n */\nexport type McpAppsRemoteHostOptions = {\n url: string;\n fetch?: typeof fetch;\n headers?:\n | Record<string, string>\n | (() => Record<string, string> | Promise<Record<string, string>>);\n};\n\nexport type McpAppToolCallParams = {\n name: string;\n arguments?: Record<string, unknown>;\n};\n\nexport type McpAppBridgeHandlers = {\n allowedTools?: readonly string[];\n callTool?: (params: McpAppToolCallParams) => Promise<unknown> | unknown;\n readResource?: (params: { uri: string }) => Promise<unknown> | unknown;\n listResources?: (params?: unknown) => Promise<unknown> | unknown;\n openLink?: (params: { url: string }) => Promise<unknown> | unknown;\n sendMessage?: (params: unknown) => Promise<unknown> | unknown;\n updateModelContext?: (params: unknown) => Promise<unknown> | unknown;\n requestDisplayMode?: (params: {\n mode: McpAppDisplayMode;\n }) => Promise<{ mode: McpAppDisplayMode }> | { mode: McpAppDisplayMode };\n onSizeChange?: (params: { width?: number; height?: number }) => void;\n onInitialized?: () => void;\n onRequestTeardown?: (params: unknown) => void;\n onLog?: (params: unknown) => void;\n onError?: (error: Error) => void;\n};\n\nexport type McpAppSandboxConfig = SandboxHostConfig;\n\nexport type McpAppFrameProps = {\n app: McpAppMetadata;\n resource: McpAppResource;\n input?: unknown;\n output?: unknown;\n sandbox?: McpAppSandboxConfig | undefined;\n handlers?: McpAppBridgeHandlers | undefined;\n hostInfo?: McpAppHostInfo | undefined;\n hostContext?: McpAppHostContext | undefined;\n /**\n * Upper bound (in pixels) for the auto-resize height driven by the widget's\n * `notifications/size_changed`. Defaults to 800.\n */\n maxHeight?: number | undefined;\n};\n\nexport type McpAppJsonRpcRequest = {\n jsonrpc: \"2.0\";\n id: string | number;\n method: string;\n params?: unknown;\n};\n\nexport type McpAppJsonRpcNotification = {\n jsonrpc: \"2.0\";\n method: string;\n params?: unknown;\n};\n\nexport type McpAppJsonRpcError = {\n code: number;\n message: string;\n data?: unknown;\n};\n\nexport type McpAppJsonRpcResponse =\n | {\n jsonrpc: \"2.0\";\n id: string | number;\n result: unknown;\n error?: never;\n }\n | {\n jsonrpc: \"2.0\";\n id: string | number;\n result?: never;\n error: McpAppJsonRpcError;\n };\n\nexport type McpAppJsonRpcMessage =\n | McpAppJsonRpcRequest\n | McpAppJsonRpcNotification\n | McpAppJsonRpcResponse;\n"],"mappings":";AAQA,MAAa,oBAAoB;AAEjC,MAAa,2BAA2B"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { AssistantFrameHost } from "@assistant-ui/core";
3
- import { useEffect } from "react";
3
+ import { useEffect } from "@assistant-ui/tap/react-shim";
4
4
  //#region src/model-context/frame/useAssistantFrameHost.ts
5
5
  /**
6
6
  * React hook that manages the lifecycle of an AssistantFrameHost and its binding to the current AssistantRuntime.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useAui } from "@assistant-ui/store";
3
3
  import { tool } from "@assistant-ui/core";
4
- import { createContext, forwardRef, useContext, useEffect, useId, useRef } from "react";
4
+ import { createContext, forwardRef, useContext, useEffect, useId, useRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
7
7
  //#region src/model-context/makeAssistantVisible.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"makeAssistantVisible.js","names":[],"sources":["../../src/model-context/makeAssistantVisible.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useRef,\n forwardRef,\n type ComponentType,\n type ForwardedRef,\n type PropsWithoutRef,\n useId,\n createContext,\n useContext,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { tool } from \"@assistant-ui/core\";\n\nconst click = tool({\n parameters: {\n type: \"object\",\n properties: {\n clickId: {\n type: \"string\",\n },\n },\n required: [\"clickId\"],\n },\n execute: async ({ clickId }: { clickId: string }) => {\n const escapedClickId = CSS.escape(clickId);\n const el = document.querySelector(`[data-click-id='${escapedClickId}']`);\n if (el instanceof HTMLElement) {\n el.click();\n\n // todo make adjustable\n await new Promise((resolve) => setTimeout(resolve, 2000));\n return {};\n } else {\n return \"Element not found\";\n }\n },\n});\n\nconst edit = tool({\n parameters: {\n type: \"object\",\n properties: {\n editId: {\n type: \"string\",\n },\n value: {\n type: \"string\",\n },\n },\n required: [\"editId\", \"value\"],\n },\n execute: async ({ editId, value }: { editId: string; value: string }) => {\n const escapedEditId = CSS.escape(editId);\n const el = document.querySelector(`[data-edit-id='${escapedEditId}']`);\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n el.value = value;\n el.dispatchEvent(new Event(\"input\", { bubbles: true }));\n el.dispatchEvent(new Event(\"change\", { bubbles: true }));\n\n // todo make adjustable\n await new Promise((resolve) => setTimeout(resolve, 2000));\n return {};\n } else {\n return \"Element not found\";\n }\n },\n});\n\nconst ReadableContext = createContext<boolean>(false);\n\nexport const makeAssistantVisible = <T extends ComponentType<any>>(\n Component: T,\n config?: { clickable?: boolean | undefined; editable?: boolean | undefined },\n) => {\n const ReadableComponent = forwardRef(\n (props: PropsWithoutRef<T>, outerRef: ForwardedRef<any>) => {\n const isNestedReadable = useContext(ReadableContext);\n\n const clickId = useId();\n const componentRef = useRef<HTMLElement>(null);\n\n const aui = useAui();\n\n const { clickable, editable } = config ?? {};\n useEffect(() => {\n return aui.modelContext().register({\n getModelContext: () => {\n return {\n tools: {\n ...(clickable ? { click } : {}),\n ...(editable ? { edit } : {}),\n },\n system: !isNestedReadable // only pass content if this readable isn't nested in another readable\n ? componentRef.current?.outerHTML\n : undefined,\n };\n },\n });\n }, [isNestedReadable, aui, clickable, editable]);\n\n const ref = useComposedRefs(componentRef, outerRef);\n\n return (\n <ReadableContext.Provider value={true}>\n <Component\n {...(props as any)}\n {...(config?.clickable ? { \"data-click-id\": clickId } : {})}\n {...(config?.editable ? { \"data-edit-id\": clickId } : {})}\n ref={ref}\n />\n </ReadableContext.Provider>\n );\n },\n );\n\n ReadableComponent.displayName = Component.displayName;\n\n return ReadableComponent as unknown as T;\n};\n\nexport default makeAssistantVisible;\n"],"mappings":";;;;;;;AAiBA,MAAM,QAAQ,KAAK;CACjB,YAAY;EACV,MAAM;EACN,YAAY,EACV,SAAS,EACP,MAAM,SACR,EACF;EACA,UAAU,CAAC,SAAS;CACtB;CACA,SAAS,OAAO,EAAE,cAAmC;EACnD,MAAM,iBAAiB,IAAI,OAAO,OAAO;EACzC,MAAM,KAAK,SAAS,cAAc,mBAAmB,eAAe,GAAG;EACvE,IAAI,cAAc,aAAa;GAC7B,GAAG,MAAM;GAGT,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,GAAI,CAAC;GACxD,OAAO,CAAC;EACV,OACE,OAAO;CAEX;AACF,CAAC;AAED,MAAM,OAAO,KAAK;CAChB,YAAY;EACV,MAAM;EACN,YAAY;GACV,QAAQ,EACN,MAAM,SACR;GACA,OAAO,EACL,MAAM,SACR;EACF;EACA,UAAU,CAAC,UAAU,OAAO;CAC9B;CACA,SAAS,OAAO,EAAE,QAAQ,YAA+C;EACvE,MAAM,gBAAgB,IAAI,OAAO,MAAM;EACvC,MAAM,KAAK,SAAS,cAAc,kBAAkB,cAAc,GAAG;EACrE,IAAI,cAAc,oBAAoB,cAAc,qBAAqB;GACvE,GAAG,QAAQ;GACX,GAAG,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC;GACtD,GAAG,cAAc,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC,CAAC;GAGvD,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,GAAI,CAAC;GACxD,OAAO,CAAC;EACV,OACE,OAAO;CAEX;AACF,CAAC;AAED,MAAM,kBAAkB,cAAuB,KAAK;AAEpD,MAAa,wBACX,WACA,WACG;CACH,MAAM,oBAAoB,YACvB,OAA2B,aAAgC;EAC1D,MAAM,mBAAmB,WAAW,eAAe;EAEnD,MAAM,UAAU,MAAM;EACtB,MAAM,eAAe,OAAoB,IAAI;EAE7C,MAAM,MAAM,OAAO;EAEnB,MAAM,EAAE,WAAW,aAAa,UAAU,CAAC;EAC3C,gBAAgB;GACd,OAAO,IAAI,aAAa,EAAE,SAAS,EACjC,uBAAuB;IACrB,OAAO;KACL,OAAO;MACL,GAAI,YAAY,EAAE,MAAM,IAAI,CAAC;MAC7B,GAAI,WAAW,EAAE,KAAK,IAAI,CAAC;KAC7B;KACA,QAAQ,CAAC,mBACL,aAAa,SAAS,YACtB,KAAA;IACN;GACF,EACF,CAAC;EACH,GAAG;GAAC;GAAkB;GAAK;GAAW;EAAQ,CAAC;EAE/C,MAAM,MAAM,gBAAgB,cAAc,QAAQ;EAElD,OACE,oBAAC,gBAAgB,UAAjB;GAA0B,OAAO;aAC/B,oBAAC,WAAD;IACE,GAAK;IACL,GAAK,QAAQ,YAAY,EAAE,iBAAiB,QAAQ,IAAI,CAAC;IACzD,GAAK,QAAQ,WAAW,EAAE,gBAAgB,QAAQ,IAAI,CAAC;IAClD;GACN,CAAA;EACuB,CAAA;CAE9B,CACF;CAEA,kBAAkB,cAAc,UAAU;CAE1C,OAAO;AACT"}
1
+ {"version":3,"file":"makeAssistantVisible.js","names":[],"sources":["../../src/model-context/makeAssistantVisible.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useRef,\n forwardRef,\n type ComponentType,\n type ForwardedRef,\n type PropsWithoutRef,\n useId,\n createContext,\n useContext,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { tool } from \"@assistant-ui/core\";\n\nconst click = tool({\n parameters: {\n type: \"object\",\n properties: {\n clickId: {\n type: \"string\",\n },\n },\n required: [\"clickId\"],\n },\n execute: async ({ clickId }: { clickId: string }) => {\n const escapedClickId = CSS.escape(clickId);\n const el = document.querySelector(`[data-click-id='${escapedClickId}']`);\n if (el instanceof HTMLElement) {\n el.click();\n\n // todo make adjustable\n await new Promise((resolve) => setTimeout(resolve, 2000));\n return {};\n } else {\n return \"Element not found\";\n }\n },\n});\n\nconst edit = tool({\n parameters: {\n type: \"object\",\n properties: {\n editId: {\n type: \"string\",\n },\n value: {\n type: \"string\",\n },\n },\n required: [\"editId\", \"value\"],\n },\n execute: async ({ editId, value }: { editId: string; value: string }) => {\n const escapedEditId = CSS.escape(editId);\n const el = document.querySelector(`[data-edit-id='${escapedEditId}']`);\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n el.value = value;\n el.dispatchEvent(new Event(\"input\", { bubbles: true }));\n el.dispatchEvent(new Event(\"change\", { bubbles: true }));\n\n // todo make adjustable\n await new Promise((resolve) => setTimeout(resolve, 2000));\n return {};\n } else {\n return \"Element not found\";\n }\n },\n});\n\nconst ReadableContext = createContext<boolean>(false);\n\nexport const makeAssistantVisible = <T extends ComponentType<any>>(\n Component: T,\n config?: { clickable?: boolean | undefined; editable?: boolean | undefined },\n) => {\n const ReadableComponent = forwardRef(\n (props: PropsWithoutRef<T>, outerRef: ForwardedRef<any>) => {\n const isNestedReadable = useContext(ReadableContext);\n\n const clickId = useId();\n const componentRef = useRef<HTMLElement>(null);\n\n const aui = useAui();\n\n const { clickable, editable } = config ?? {};\n useEffect(() => {\n return aui.modelContext().register({\n getModelContext: () => {\n return {\n tools: {\n ...(clickable ? { click } : {}),\n ...(editable ? { edit } : {}),\n },\n system: !isNestedReadable // only pass content if this readable isn't nested in another readable\n ? componentRef.current?.outerHTML\n : undefined,\n };\n },\n });\n }, [isNestedReadable, aui, clickable, editable]);\n\n const ref = useComposedRefs(componentRef, outerRef);\n\n return (\n <ReadableContext.Provider value={true}>\n <Component\n {...(props as any)}\n {...(config?.clickable ? { \"data-click-id\": clickId } : {})}\n {...(config?.editable ? { \"data-edit-id\": clickId } : {})}\n ref={ref}\n />\n </ReadableContext.Provider>\n );\n },\n );\n\n ReadableComponent.displayName = Component.displayName;\n\n return ReadableComponent as unknown as T;\n};\n\nexport default makeAssistantVisible;\n"],"mappings":";;;;;;;AAiBA,MAAM,QAAQ,KAAK;CACjB,YAAY;EACV,MAAM;EACN,YAAY,EACV,SAAS,EACP,MAAM,SACR,EACF;EACA,UAAU,CAAC,SAAS;CACtB;CACA,SAAS,OAAO,EAAE,cAAmC;EACnD,MAAM,iBAAiB,IAAI,OAAO,OAAO;EACzC,MAAM,KAAK,SAAS,cAAc,mBAAmB,eAAe,GAAG;EACvE,IAAI,cAAc,aAAa;GAC7B,GAAG,MAAM;GAGT,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,GAAI,CAAC;GACxD,OAAO,CAAC;EACV,OACE,OAAO;CAEX;AACF,CAAC;AAED,MAAM,OAAO,KAAK;CAChB,YAAY;EACV,MAAM;EACN,YAAY;GACV,QAAQ,EACN,MAAM,SACR;GACA,OAAO,EACL,MAAM,SACR;EACF;EACA,UAAU,CAAC,UAAU,OAAO;CAC9B;CACA,SAAS,OAAO,EAAE,QAAQ,YAA+C;EACvE,MAAM,gBAAgB,IAAI,OAAO,MAAM;EACvC,MAAM,KAAK,SAAS,cAAc,kBAAkB,cAAc,GAAG;EACrE,IAAI,cAAc,oBAAoB,cAAc,qBAAqB;GACvE,GAAG,QAAQ;GACX,GAAG,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC;GACtD,GAAG,cAAc,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC,CAAC;GAGvD,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,GAAI,CAAC;GACxD,OAAO,CAAC;EACV,OACE,OAAO;CAEX;AACF,CAAC;AAED,MAAM,kBAAkB,cAAuB,KAAK;AAEpD,MAAa,wBACX,WACA,WACG;CACH,MAAM,oBAAoB,YACvB,OAA2B,aAAgC;EAC1D,MAAM,mBAAmB,WAAW,eAAe;EAEnD,MAAM,UAAU,MAAM;EACtB,MAAM,eAAe,OAAoB,IAAI;EAE7C,MAAM,MAAM,OAAO;EAEnB,MAAM,EAAE,WAAW,aAAa,UAAU,CAAC;EAC3C,gBAAgB;GACd,OAAO,IAAI,aAAa,CAAC,CAAC,SAAS,EACjC,uBAAuB;IACrB,OAAO;KACL,OAAO;MACL,GAAI,YAAY,EAAE,MAAM,IAAI,CAAC;MAC7B,GAAI,WAAW,EAAE,KAAK,IAAI,CAAC;KAC7B;KACA,QAAQ,CAAC,mBACL,aAAa,SAAS,YACtB,KAAA;IACN;GACF,EACF,CAAC;EACH,GAAG;GAAC;GAAkB;GAAK;GAAW;EAAQ,CAAC;EAE/C,MAAM,MAAM,gBAAgB,cAAc,QAAQ;EAElD,OACE,oBAAC,gBAAgB,UAAjB;GAA0B,OAAO;aAC/B,oBAAC,WAAD;IACE,GAAK;IACL,GAAK,QAAQ,YAAY,EAAE,iBAAiB,QAAQ,IAAI,CAAC;IACzD,GAAK,QAAQ,WAAW,EAAE,gBAAgB,QAAQ,IAAI,CAAC;IAClD;GACN,CAAA;EACuB,CAAA;CAE9B,CACF;CAEA,kBAAkB,cAAc,UAAU;CAE1C,OAAO;AACT"}
@@ -2,7 +2,7 @@
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
4
  import { useActionBarCopy } from "@assistant-ui/core/react";
5
- import { forwardRef } from "react";
5
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { composeEventHandlers } from "@radix-ui/primitive";
8
8
  //#region src/primitives/actionBar/ActionBarCopy.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAui, useAuiState } from "@assistant-ui/store";
4
- import { forwardRef, useCallback } from "react";
4
+ import { forwardRef, useCallback } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { composeEventHandlers } from "@radix-ui/primitive";
7
7
  //#region src/primitives/actionBar/ActionBarExportMarkdown.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBarExportMarkdown.js","names":[],"sources":["../../../src/primitives/actionBar/ActionBarExportMarkdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useCallback } from \"react\";\nimport type { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\n\nconst useActionBarExportMarkdown = ({\n filename,\n onExport,\n}: {\n filename?: string | undefined;\n onExport?: ((content: string) => void | Promise<void>) | undefined;\n} = {}) => {\n const aui = useAui();\n const hasExportableContent = useAuiState((s) => {\n return (\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n\n const callback = useCallback(async () => {\n const content = aui.message().getCopyText();\n if (!content) return;\n\n if (onExport) {\n await onExport(content);\n return;\n }\n\n const blob = new Blob([content], { type: \"text/markdown\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = filename ?? `message-${Date.now()}.md`;\n a.click();\n URL.revokeObjectURL(url);\n }, [aui, filename, onExport]);\n\n if (!hasExportableContent) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveExportMarkdown {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarExportMarkdown>;\n}\n\nexport const ActionBarPrimitiveExportMarkdown = forwardRef<\n ActionBarPrimitiveExportMarkdown.Element,\n ActionBarPrimitiveExportMarkdown.Props\n>(({ filename, onExport, onClick, disabled, ...props }, forwardedRef) => {\n const callback = useActionBarExportMarkdown({ filename, onExport });\n return (\n <Primitive.button\n type=\"button\"\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveExportMarkdown.displayName =\n \"ActionBarPrimitive.ExportMarkdown\";\n"],"mappings":";;;;;;;AAQA,MAAM,8BAA8B,EAClC,UACA,aAIE,CAAC,MAAM;CACT,MAAM,MAAM,OAAO;CACnB,MAAM,uBAAuB,aAAa,MAAM;EAC9C,QACG,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CAED,MAAM,WAAW,YAAY,YAAY;EACvC,MAAM,UAAU,IAAI,QAAQ,EAAE,YAAY;EAC1C,IAAI,CAAC,SAAS;EAEd,IAAI,UAAU;GACZ,MAAM,SAAS,OAAO;GACtB;EACF;EAEA,MAAM,OAAO,IAAI,KAAK,CAAC,OAAO,GAAG,EAAE,MAAM,gBAAgB,CAAC;EAC1D,MAAM,MAAM,IAAI,gBAAgB,IAAI;EACpC,MAAM,IAAI,SAAS,cAAc,GAAG;EACpC,EAAE,OAAO;EACT,EAAE,WAAW,YAAY,WAAW,KAAK,IAAI,EAAE;EAC/C,EAAE,MAAM;EACR,IAAI,gBAAgB,GAAG;CACzB,GAAG;EAAC;EAAK;EAAU;CAAQ,CAAC;CAE5B,IAAI,CAAC,sBAAsB,OAAO;CAClC,OAAO;AACT;AAOA,MAAa,mCAAmC,YAG7C,EAAE,UAAU,UAAU,SAAS,UAAU,GAAG,SAAS,iBAAiB;CACvE,MAAM,WAAW,2BAA2B;EAAE;EAAU;CAAS,CAAC;CAClE,OACE,oBAAC,UAAU,QAAX;EACE,MAAK;EACL,GAAI;EACJ,KAAK;EACL,UAAU,YAAY,CAAC;EACvB,SAAS,qBAAqB,eAAe;GAC3C,WAAW;EACb,CAAC;CACF,CAAA;AAEL,CAAC;AAED,iCAAiC,cAC/B"}
1
+ {"version":3,"file":"ActionBarExportMarkdown.js","names":[],"sources":["../../../src/primitives/actionBar/ActionBarExportMarkdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useCallback } from \"react\";\nimport type { ActionButtonProps } from \"../../utils/createActionButton\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\n\nconst useActionBarExportMarkdown = ({\n filename,\n onExport,\n}: {\n filename?: string | undefined;\n onExport?: ((content: string) => void | Promise<void>) | undefined;\n} = {}) => {\n const aui = useAui();\n const hasExportableContent = useAuiState((s) => {\n return (\n (s.message.role !== \"assistant\" ||\n s.message.status?.type !== \"running\") &&\n s.message.parts.some((c) => c.type === \"text\" && c.text.length > 0)\n );\n });\n\n const callback = useCallback(async () => {\n const content = aui.message().getCopyText();\n if (!content) return;\n\n if (onExport) {\n await onExport(content);\n return;\n }\n\n const blob = new Blob([content], { type: \"text/markdown\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = filename ?? `message-${Date.now()}.md`;\n a.click();\n URL.revokeObjectURL(url);\n }, [aui, filename, onExport]);\n\n if (!hasExportableContent) return null;\n return callback;\n};\n\nexport namespace ActionBarPrimitiveExportMarkdown {\n export type Element = HTMLButtonElement;\n export type Props = ActionButtonProps<typeof useActionBarExportMarkdown>;\n}\n\nexport const ActionBarPrimitiveExportMarkdown = forwardRef<\n ActionBarPrimitiveExportMarkdown.Element,\n ActionBarPrimitiveExportMarkdown.Props\n>(({ filename, onExport, onClick, disabled, ...props }, forwardedRef) => {\n const callback = useActionBarExportMarkdown({ filename, onExport });\n return (\n <Primitive.button\n type=\"button\"\n {...props}\n ref={forwardedRef}\n disabled={disabled || !callback}\n onClick={composeEventHandlers(onClick, () => {\n callback?.();\n })}\n />\n );\n});\n\nActionBarPrimitiveExportMarkdown.displayName =\n \"ActionBarPrimitive.ExportMarkdown\";\n"],"mappings":";;;;;;;AAQA,MAAM,8BAA8B,EAClC,UACA,aAIE,CAAC,MAAM;CACT,MAAM,MAAM,OAAO;CACnB,MAAM,uBAAuB,aAAa,MAAM;EAC9C,QACG,EAAE,QAAQ,SAAS,eAClB,EAAE,QAAQ,QAAQ,SAAS,cAC7B,EAAE,QAAQ,MAAM,MAAM,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,SAAS,CAAC;CAEtE,CAAC;CAED,MAAM,WAAW,YAAY,YAAY;EACvC,MAAM,UAAU,IAAI,QAAQ,CAAC,CAAC,YAAY;EAC1C,IAAI,CAAC,SAAS;EAEd,IAAI,UAAU;GACZ,MAAM,SAAS,OAAO;GACtB;EACF;EAEA,MAAM,OAAO,IAAI,KAAK,CAAC,OAAO,GAAG,EAAE,MAAM,gBAAgB,CAAC;EAC1D,MAAM,MAAM,IAAI,gBAAgB,IAAI;EACpC,MAAM,IAAI,SAAS,cAAc,GAAG;EACpC,EAAE,OAAO;EACT,EAAE,WAAW,YAAY,WAAW,KAAK,IAAI,EAAE;EAC/C,EAAE,MAAM;EACR,IAAI,gBAAgB,GAAG;CACzB,GAAG;EAAC;EAAK;EAAU;CAAQ,CAAC;CAE5B,IAAI,CAAC,sBAAsB,OAAO;CAClC,OAAO;AACT;AAOA,MAAa,mCAAmC,YAG7C,EAAE,UAAU,UAAU,SAAS,UAAU,GAAG,SAAS,iBAAiB;CACvE,MAAM,WAAW,2BAA2B;EAAE;EAAU;CAAS,CAAC;CAClE,OACE,oBAAC,UAAU,QAAX;EACE,MAAK;EACL,GAAI;EACJ,KAAK;EACL,UAAU,YAAY,CAAC;EACvB,SAAS,qBAAqB,eAAe;GAC3C,WAAW;EACb,CAAC;CACF,CAAA;AAEL,CAAC;AAED,iCAAiC,cAC/B"}
@@ -2,7 +2,7 @@
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
4
  import { useActionBarFeedbackNegative } from "@assistant-ui/core/react";
5
- import { forwardRef } from "react";
5
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { composeEventHandlers } from "@radix-ui/primitive";
8
8
  //#region src/primitives/actionBar/ActionBarFeedbackNegative.tsx
@@ -2,7 +2,7 @@
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
4
  import { useActionBarFeedbackPositive } from "@assistant-ui/core/react";
5
- import { forwardRef } from "react";
5
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { composeEventHandlers } from "@radix-ui/primitive";
8
8
  //#region src/primitives/actionBar/ActionBarFeedbackPositive.tsx
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { createContext, useContext } from "react";
2
+ import { createContext, useContext } from "@assistant-ui/tap/react-shim";
3
3
  //#region src/primitives/actionBar/ActionBarInteractionContext.ts
4
4
  const ActionBarInteractionContext = createContext(null);
5
5
  const useActionBarInteractionContext = () => useContext(ActionBarInteractionContext);
@@ -2,7 +2,7 @@
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useActionBarFloatStatus } from "./useActionBarFloatStatus.js";
4
4
  import { ActionBarInteractionContext } from "./ActionBarInteractionContext.js";
5
- import { forwardRef, useCallback, useMemo, useState } from "react";
5
+ import { forwardRef, useCallback, useMemo, useState } from "@assistant-ui/tap/react-shim";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/primitives/actionBar/ActionBarRoot.tsx
8
8
  /**
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useActionBarStopSpeaking } from "@assistant-ui/core/react";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { composeEventHandlers } from "@radix-ui/primitive";
7
7
  import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useDropdownMenuScope } from "./scope.js";
3
3
  import { DropdownMenuRenderContent } from "../dropdownMenuRenderPrimitives.js";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { DropdownMenu } from "radix-ui";
7
7
  //#region src/primitives/actionBarMore/ActionBarMoreContent.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useDropdownMenuScope } from "./scope.js";
3
3
  import { DropdownMenuRenderItem } from "../dropdownMenuRenderPrimitives.js";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/primitives/actionBarMore/ActionBarMoreItem.tsx
7
7
  const ActionBarMorePrimitiveItem = forwardRef(({ __scopeActionBarMore, ...rest }, ref) => {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useActionBarInteractionContext } from "../actionBar/ActionBarInteractionContext.js";
3
3
  import { useDropdownMenuScope } from "./scope.js";
4
- import { useCallback, useEffect, useRef } from "react";
4
+ import { useCallback, useEffect, useRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { DropdownMenu } from "radix-ui";
7
7
  //#region src/primitives/actionBarMore/ActionBarMoreRoot.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useDropdownMenuScope } from "./scope.js";
3
3
  import { DropdownMenuRenderSeparator } from "../dropdownMenuRenderPrimitives.js";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/primitives/actionBarMore/ActionBarMoreSeparator.tsx
7
7
  const ActionBarMorePrimitiveSeparator = forwardRef(({ __scopeActionBarMore, ...rest }, ref) => {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useDropdownMenuScope } from "./scope.js";
3
3
  import { DropdownMenuRenderTrigger } from "../dropdownMenuRenderPrimitives.js";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/primitives/actionBarMore/ActionBarMoreTrigger.tsx
7
7
  const ActionBarMorePrimitiveTrigger = forwardRef(({ __scopeActionBarMore, ...rest }, ref) => {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { usePopoverScope } from "./scope.js";
3
- import { forwardRef } from "react";
3
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Popover } from "radix-ui";
6
6
  //#region src/primitives/assistantModal/AssistantModalAnchor.tsx
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { usePopoverScope } from "./scope.js";
3
- import { forwardRef } from "react";
3
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { composeEventHandlers } from "@radix-ui/primitive";
6
6
  import { Popover } from "radix-ui";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { usePopoverScope } from "./scope.js";
3
3
  import { useAui } from "@assistant-ui/store";
4
- import { useEffect, useState } from "react";
4
+ import { useEffect, useState } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { Popover } from "radix-ui";
7
7
  //#region src/primitives/assistantModal/AssistantModalRoot.tsx
@@ -1,5 +1,5 @@
1
1
  import { usePopoverScope } from "./scope.js";
2
- import { forwardRef } from "react";
2
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { Popover } from "radix-ui";
5
5
  //#region src/primitives/assistantModal/AssistantModalTrigger.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useAui } from "@assistant-ui/store";
4
- import { useCallback } from "react";
4
+ import { useCallback } from "@assistant-ui/tap/react-shim";
5
5
  //#region src/primitives/attachment/AttachmentRemove.ts
6
6
  const useAttachmentRemove = () => {
7
7
  const aui = useAui();
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentRemove.js","names":[],"sources":["../../../src/primitives/attachment/AttachmentRemove.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nconst useAttachmentRemove = () => {\n const aui = useAui();\n\n const handleRemoveAttachment = useCallback(() => {\n aui.attachment().remove();\n }, [aui]);\n\n return handleRemoveAttachment;\n};\n\nexport namespace AttachmentPrimitiveRemove {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useAttachmentRemove>;\n}\n\nexport const AttachmentPrimitiveRemove = createActionButton(\n \"AttachmentPrimitive.Remove\",\n useAttachmentRemove,\n);\n"],"mappings":";;;;;AAUA,MAAM,4BAA4B;CAChC,MAAM,MAAM,OAAO;CAMnB,OAJ+B,kBAAkB;EAC/C,IAAI,WAAW,EAAE,OAAO;CAC1B,GAAG,CAAC,GAAG,CAEqB;AAC9B;AAOA,MAAa,4BAA4B,mBACvC,8BACA,mBACF"}
1
+ {"version":3,"file":"AttachmentRemove.js","names":[],"sources":["../../../src/primitives/attachment/AttachmentRemove.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nconst useAttachmentRemove = () => {\n const aui = useAui();\n\n const handleRemoveAttachment = useCallback(() => {\n aui.attachment().remove();\n }, [aui]);\n\n return handleRemoveAttachment;\n};\n\nexport namespace AttachmentPrimitiveRemove {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useAttachmentRemove>;\n}\n\nexport const AttachmentPrimitiveRemove = createActionButton(\n \"AttachmentPrimitive.Remove\",\n useAttachmentRemove,\n);\n"],"mappings":";;;;;AAUA,MAAM,4BAA4B;CAChC,MAAM,MAAM,OAAO;CAMnB,OAJ+B,kBAAkB;EAC/C,IAAI,WAAW,CAAC,CAAC,OAAO;CAC1B,GAAG,CAAC,GAAG,CAEqB;AAC9B;AAOA,MAAa,4BAA4B,mBACvC,8BACA,mBACF"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
- import { forwardRef } from "react";
3
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/primitives/attachment/AttachmentRoot.tsx
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsxs } from "react/jsx-runtime";
6
6
  //#region src/primitives/attachment/AttachmentThumb.tsx
7
7
  const AttachmentPrimitiveThumb = forwardRef((props, ref) => {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { MessagePrimitiveIf } from "../message/MessageIf.js";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/primitives/branchPicker/BranchPickerRoot.tsx
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useAui, useAuiState } from "@assistant-ui/store";
4
- import { useCallback } from "react";
4
+ import { useCallback } from "@assistant-ui/tap/react-shim";
5
5
  //#region src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.ts
6
6
  const useChainOfThoughtAccordionTrigger = () => {
7
7
  const aui = useAui();
@@ -1 +1 @@
1
- {"version":3,"file":"ChainOfThoughtAccordionTrigger.js","names":[],"sources":["../../../src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\n\nconst useChainOfThoughtAccordionTrigger = () => {\n const aui = useAui();\n const collapsed = useAuiState((s) => s.chainOfThought.collapsed);\n\n const callback = useCallback(() => {\n aui.chainOfThought().setCollapsed(!collapsed);\n }, [aui, collapsed]);\n\n return callback;\n};\n\nexport namespace ChainOfThoughtPrimitiveAccordionTrigger {\n export type Element = ActionButtonElement;\n /**\n * Props for the ChainOfThoughtPrimitive.AccordionTrigger component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<\n typeof useChainOfThoughtAccordionTrigger\n >;\n}\n\n/**\n * A button component that toggles the collapsed state of the chain of thought accordion.\n *\n * This component automatically handles the toggle functionality, expanding or collapsing\n * the chain of thought parts when clicked.\n *\n * @example\n * ```tsx\n * <ChainOfThoughtPrimitive.AccordionTrigger>\n * Toggle Reasoning\n * </ChainOfThoughtPrimitive.AccordionTrigger>\n * ```\n */\nexport const ChainOfThoughtPrimitiveAccordionTrigger = createActionButton(\n \"ChainOfThoughtPrimitive.AccordionTrigger\",\n useChainOfThoughtAccordionTrigger,\n);\n"],"mappings":";;;;;AAUA,MAAM,0CAA0C;CAC9C,MAAM,MAAM,OAAO;CACnB,MAAM,YAAY,aAAa,MAAM,EAAE,eAAe,SAAS;CAM/D,OAJiB,kBAAkB;EACjC,IAAI,eAAe,EAAE,aAAa,CAAC,SAAS;CAC9C,GAAG,CAAC,KAAK,SAAS,CAEJ;AAChB;;;;;;;;;;;;;;AA0BA,MAAa,0CAA0C,mBACrD,4CACA,iCACF"}
1
+ {"version":3,"file":"ChainOfThoughtAccordionTrigger.js","names":[],"sources":["../../../src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\n\nconst useChainOfThoughtAccordionTrigger = () => {\n const aui = useAui();\n const collapsed = useAuiState((s) => s.chainOfThought.collapsed);\n\n const callback = useCallback(() => {\n aui.chainOfThought().setCollapsed(!collapsed);\n }, [aui, collapsed]);\n\n return callback;\n};\n\nexport namespace ChainOfThoughtPrimitiveAccordionTrigger {\n export type Element = ActionButtonElement;\n /**\n * Props for the ChainOfThoughtPrimitive.AccordionTrigger component.\n * Inherits all button element props and action button functionality.\n */\n export type Props = ActionButtonProps<\n typeof useChainOfThoughtAccordionTrigger\n >;\n}\n\n/**\n * A button component that toggles the collapsed state of the chain of thought accordion.\n *\n * This component automatically handles the toggle functionality, expanding or collapsing\n * the chain of thought parts when clicked.\n *\n * @example\n * ```tsx\n * <ChainOfThoughtPrimitive.AccordionTrigger>\n * Toggle Reasoning\n * </ChainOfThoughtPrimitive.AccordionTrigger>\n * ```\n */\nexport const ChainOfThoughtPrimitiveAccordionTrigger = createActionButton(\n \"ChainOfThoughtPrimitive.AccordionTrigger\",\n useChainOfThoughtAccordionTrigger,\n);\n"],"mappings":";;;;;AAUA,MAAM,0CAA0C;CAC9C,MAAM,MAAM,OAAO;CACnB,MAAM,YAAY,aAAa,MAAM,EAAE,eAAe,SAAS;CAM/D,OAJiB,kBAAkB;EACjC,IAAI,eAAe,CAAC,CAAC,aAAa,CAAC,SAAS;CAC9C,GAAG,CAAC,KAAK,SAAS,CAEJ;AAChB;;;;;;;;;;;;;;AA0BA,MAAa,0CAA0C,mBACrD,4CACA,iCACF"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
- import { forwardRef } from "react";
3
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/primitives/chainOfThought/ChainOfThoughtRoot.tsx
6
6
  /**
@@ -2,7 +2,7 @@
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useAui } from "@assistant-ui/store";
4
4
  import { useComposerAddAttachment } from "@assistant-ui/core/react";
5
- import { useCallback } from "react";
5
+ import { useCallback } from "@assistant-ui/tap/react-shim";
6
6
  //#region src/primitives/composer/ComposerAddAttachment.ts
7
7
  const useComposerAddAttachment$1 = ({ multiple = true } = {}) => {
8
8
  const { disabled, addAttachment } = useComposerAddAttachment();
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerAddAttachment.js","names":["useComposerAddAttachment","useComposerAddAttachmentBehavior"],"sources":["../../../src/primitives/composer/ComposerAddAttachment.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useComposerAddAttachment as useComposerAddAttachmentBehavior } from \"@assistant-ui/core/react\";\n\nconst useComposerAddAttachment = ({\n multiple = true,\n}: {\n /** allow selecting multiple files */\n multiple?: boolean | undefined;\n} = {}) => {\n const { disabled, addAttachment } = useComposerAddAttachmentBehavior();\n const aui = useAui();\n\n const callback = useCallback(() => {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n input.multiple = multiple;\n input.hidden = true;\n\n const attachmentAccept = aui.composer().getState().attachmentAccept;\n if (attachmentAccept !== \"*\") {\n input.accept = attachmentAccept;\n }\n\n document.body.appendChild(input);\n\n input.onchange = (e) => {\n const fileList = (e.target as HTMLInputElement).files;\n if (!fileList) return;\n for (const file of fileList) {\n addAttachment(file);\n }\n\n document.body.removeChild(input);\n };\n\n input.oncancel = () => {\n if (!input.files || input.files.length === 0) {\n document.body.removeChild(input);\n }\n };\n\n input.click();\n }, [aui, multiple, addAttachment]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveAddAttachment {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerAddAttachment>;\n}\n\nexport const ComposerPrimitiveAddAttachment = createActionButton(\n \"ComposerPrimitive.AddAttachment\",\n useComposerAddAttachment,\n [\"multiple\"],\n);\n"],"mappings":";;;;;;AAWA,MAAMA,8BAA4B,EAChC,WAAW,SAIT,CAAC,MAAM;CACT,MAAM,EAAE,UAAU,kBAAkBC,yBAAiC;CACrE,MAAM,MAAM,OAAO;CAEnB,MAAM,WAAW,kBAAkB;EACjC,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,OAAO;EACb,MAAM,WAAW;EACjB,MAAM,SAAS;EAEf,MAAM,mBAAmB,IAAI,SAAS,EAAE,SAAS,EAAE;EACnD,IAAI,qBAAqB,KACvB,MAAM,SAAS;EAGjB,SAAS,KAAK,YAAY,KAAK;EAE/B,MAAM,YAAY,MAAM;GACtB,MAAM,WAAY,EAAE,OAA4B;GAChD,IAAI,CAAC,UAAU;GACf,KAAK,MAAM,QAAQ,UACjB,cAAc,IAAI;GAGpB,SAAS,KAAK,YAAY,KAAK;EACjC;EAEA,MAAM,iBAAiB;GACrB,IAAI,CAAC,MAAM,SAAS,MAAM,MAAM,WAAW,GACzC,SAAS,KAAK,YAAY,KAAK;EAEnC;EAEA,MAAM,MAAM;CACd,GAAG;EAAC;EAAK;EAAU;CAAa,CAAC;CAEjC,IAAI,UAAU,OAAO;CACrB,OAAO;AACT;AAOA,MAAa,iCAAiC,mBAC5C,mCACAD,4BACA,CAAC,UAAU,CACb"}
1
+ {"version":3,"file":"ComposerAddAttachment.js","names":["useComposerAddAttachment","useComposerAddAttachmentBehavior"],"sources":["../../../src/primitives/composer/ComposerAddAttachment.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useComposerAddAttachment as useComposerAddAttachmentBehavior } from \"@assistant-ui/core/react\";\n\nconst useComposerAddAttachment = ({\n multiple = true,\n}: {\n /** allow selecting multiple files */\n multiple?: boolean | undefined;\n} = {}) => {\n const { disabled, addAttachment } = useComposerAddAttachmentBehavior();\n const aui = useAui();\n\n const callback = useCallback(() => {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n input.multiple = multiple;\n input.hidden = true;\n\n const attachmentAccept = aui.composer().getState().attachmentAccept;\n if (attachmentAccept !== \"*\") {\n input.accept = attachmentAccept;\n }\n\n document.body.appendChild(input);\n\n input.onchange = (e) => {\n const fileList = (e.target as HTMLInputElement).files;\n if (!fileList) return;\n for (const file of fileList) {\n addAttachment(file);\n }\n\n document.body.removeChild(input);\n };\n\n input.oncancel = () => {\n if (!input.files || input.files.length === 0) {\n document.body.removeChild(input);\n }\n };\n\n input.click();\n }, [aui, multiple, addAttachment]);\n\n if (disabled) return null;\n return callback;\n};\n\nexport namespace ComposerPrimitiveAddAttachment {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useComposerAddAttachment>;\n}\n\nexport const ComposerPrimitiveAddAttachment = createActionButton(\n \"ComposerPrimitive.AddAttachment\",\n useComposerAddAttachment,\n [\"multiple\"],\n);\n"],"mappings":";;;;;;AAWA,MAAMA,8BAA4B,EAChC,WAAW,SAIT,CAAC,MAAM;CACT,MAAM,EAAE,UAAU,kBAAkBC,yBAAiC;CACrE,MAAM,MAAM,OAAO;CAEnB,MAAM,WAAW,kBAAkB;EACjC,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,OAAO;EACb,MAAM,WAAW;EACjB,MAAM,SAAS;EAEf,MAAM,mBAAmB,IAAI,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;EACnD,IAAI,qBAAqB,KACvB,MAAM,SAAS;EAGjB,SAAS,KAAK,YAAY,KAAK;EAE/B,MAAM,YAAY,MAAM;GACtB,MAAM,WAAY,EAAE,OAA4B;GAChD,IAAI,CAAC,UAAU;GACf,KAAK,MAAM,QAAQ,UACjB,cAAc,IAAI;GAGpB,SAAS,KAAK,YAAY,KAAK;EACjC;EAEA,MAAM,iBAAiB;GACrB,IAAI,CAAC,MAAM,SAAS,MAAM,MAAM,WAAW,GACzC,SAAS,KAAK,YAAY,KAAK;EAEnC;EAEA,MAAM,MAAM;CACd,GAAG;EAAC;EAAK;EAAU;CAAa,CAAC;CAEjC,IAAI,UAAU,OAAO;CACrB,OAAO;AACT;AAOA,MAAa,iCAAiC,mBAC5C,mCACAD,4BACA,CAAC,UAAU,CACb"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useAui } from "@assistant-ui/store";
3
- import { cloneElement, forwardRef, isValidElement, useCallback, useState } from "react";
3
+ import { cloneElement, forwardRef, isValidElement, useCallback, useState } from "@assistant-ui/tap/react-shim";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { composeEventHandlers } from "@radix-ui/primitive";
6
6
  import { Slot } from "radix-ui";
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerAttachmentDropzone.js","names":[],"sources":["../../../src/primitives/composer/ComposerAttachmentDropzone.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useState,\n type ReactElement,\n cloneElement,\n isValidElement,\n} from \"react\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Slot } from \"radix-ui\";\nimport type React from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nexport namespace ComposerPrimitiveAttachmentDropzone {\n export type Element = HTMLDivElement;\n export type Props = React.HTMLAttributes<HTMLDivElement> & {\n asChild?: boolean | undefined;\n render?: ReactElement | undefined;\n disabled?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveAttachmentDropzone = forwardRef<\n HTMLDivElement,\n ComposerPrimitiveAttachmentDropzone.Props\n>(({ disabled, asChild = false, render, children, ...rest }, ref) => {\n const [isDragging, setIsDragging] = useState(false);\n const aui = useAui();\n\n const handleDragEnterCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(true);\n },\n [disabled],\n );\n\n const handleDragOverCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n if (!isDragging) setIsDragging(true);\n },\n [disabled, isDragging],\n );\n\n const handleDragLeaveCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n const next = e.relatedTarget as Node | null;\n if (next && e.currentTarget.contains(next)) {\n return;\n }\n setIsDragging(false);\n },\n [disabled],\n );\n\n const handleDrop = useCallback(\n async (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(false);\n const files = Array.from(e.dataTransfer.files);\n await Promise.all(\n files.map(async (file) => {\n try {\n await aui.composer().addAttachment(file);\n } catch (error) {\n console.error(\"Failed to add attachment:\", error);\n }\n }),\n );\n },\n [disabled, aui],\n );\n\n const mergedProps = {\n ...(isDragging ? { \"data-dragging\": \"true\" } : null),\n ...rest,\n onDragEnterCapture: composeEventHandlers(\n rest.onDragEnterCapture,\n handleDragEnterCapture,\n ),\n onDragOverCapture: composeEventHandlers(\n rest.onDragOverCapture,\n handleDragOverCapture,\n ),\n onDragLeaveCapture: composeEventHandlers(\n rest.onDragLeaveCapture,\n handleDragLeaveCapture,\n ),\n onDropCapture: composeEventHandlers(rest.onDropCapture, handleDrop),\n ref,\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n children !== undefined\n ? children\n : (render.props as Record<string, unknown>).children;\n return (\n <Slot.Root {...mergedProps}>\n {cloneElement(render, undefined, renderChildren as React.ReactNode)}\n </Slot.Root>\n );\n }\n\n const Comp = asChild ? Slot.Root : \"div\";\n return <Comp {...mergedProps}>{children}</Comp>;\n});\n\nComposerPrimitiveAtt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,eAAe,UAAU;EAClE;CACF;CAEA,IAAI,UAAU,eAAe,MAAM,GAAG;EACpC,MAAM,iBACJ,aAAa,KAAA,IACT,WACC,OAAO,MAAkC;EAChD,OACE,oBAAC,KAAK,MAAN;GAAW,GAAI;aACZ,aAAa,QAAQ,KAAA,GAAW,cAAiC;EACzD,CAAA;CAEf;CAGA,OAAO,oBADM,UAAU,KAAK,OAAO,OAC5B;EAAM,GAAI;EAAc;CAAe,CAAA;AAChD,CAAC;AAED,oCAAoC,cAClC"}
1
+ {"version":3,"file":"ComposerAttachmentDropzone.js","names":[],"sources":["../../../src/primitives/composer/ComposerAttachmentDropzone.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useState,\n type ReactElement,\n cloneElement,\n isValidElement,\n} from \"react\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Slot } from \"radix-ui\";\nimport type React from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\n\nexport namespace ComposerPrimitiveAttachmentDropzone {\n export type Element = HTMLDivElement;\n export type Props = React.HTMLAttributes<HTMLDivElement> & {\n asChild?: boolean | undefined;\n render?: ReactElement | undefined;\n disabled?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveAttachmentDropzone = forwardRef<\n HTMLDivElement,\n ComposerPrimitiveAttachmentDropzone.Props\n>(({ disabled, asChild = false, render, children, ...rest }, ref) => {\n const [isDragging, setIsDragging] = useState(false);\n const aui = useAui();\n\n const handleDragEnterCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(true);\n },\n [disabled],\n );\n\n const handleDragOverCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n if (!isDragging) setIsDragging(true);\n },\n [disabled, isDragging],\n );\n\n const handleDragLeaveCapture = useCallback(\n (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n const next = e.relatedTarget as Node | null;\n if (next && e.currentTarget.contains(next)) {\n return;\n }\n setIsDragging(false);\n },\n [disabled],\n );\n\n const handleDrop = useCallback(\n async (e: React.DragEvent) => {\n if (disabled) return;\n e.preventDefault();\n setIsDragging(false);\n const files = Array.from(e.dataTransfer.files);\n await Promise.all(\n files.map(async (file) => {\n try {\n await aui.composer().addAttachment(file);\n } catch (error) {\n console.error(\"Failed to add attachment:\", error);\n }\n }),\n );\n },\n [disabled, aui],\n );\n\n const mergedProps = {\n ...(isDragging ? { \"data-dragging\": \"true\" } : null),\n ...rest,\n onDragEnterCapture: composeEventHandlers(\n rest.onDragEnterCapture,\n handleDragEnterCapture,\n ),\n onDragOverCapture: composeEventHandlers(\n rest.onDragOverCapture,\n handleDragOverCapture,\n ),\n onDragLeaveCapture: composeEventHandlers(\n rest.onDragLeaveCapture,\n handleDragLeaveCapture,\n ),\n onDropCapture: composeEventHandlers(rest.onDropCapture, handleDrop),\n ref,\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n children !== undefined\n ? children\n : (render.props as Record<string, unknown>).children;\n return (\n <Slot.Root {...mergedProps}>\n {cloneElement(render, undefined, renderChildren as React.ReactNode)}\n </Slot.Root>\n );\n }\n\n const Comp = asChild ? Slot.Root : \"div\";\n return <Comp {...mergedProps}>{children}</Comp>;\n});\n\nComposerPrimitiveAttachmentDropzone.displayName =\n \"ComposerPrimitive.AttachmentDropzone\";\n"],"mappings":";;;;;;;AAyBA,MAAa,sCAAsC,YAGhD,EAAE,UAAU,UAAU,OAAO,QAAQ,UAAU,GAAG,QAAQ,QAAQ;CACnE,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,MAAM,OAAO;CAEnB,MAAM,yBAAyB,aAC5B,MAAuB;EACtB,IAAI,UAAU;EACd,EAAE,eAAe;EACjB,cAAc,IAAI;CACpB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,wBAAwB,aAC3B,MAAuB;EACtB,IAAI,UAAU;EACd,EAAE,eAAe;EACjB,IAAI,CAAC,YAAY,cAAc,IAAI;CACrC,GACA,CAAC,UAAU,UAAU,CACvB;CAEA,MAAM,yBAAyB,aAC5B,MAAuB;EACtB,IAAI,UAAU;EACd,EAAE,eAAe;EACjB,MAAM,OAAO,EAAE;EACf,IAAI,QAAQ,EAAE,cAAc,SAAS,IAAI,GACvC;EAEF,cAAc,KAAK;CACrB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,aAAa,YACjB,OAAO,MAAuB;EAC5B,IAAI,UAAU;EACd,EAAE,eAAe;EACjB,cAAc,KAAK;EACnB,MAAM,QAAQ,MAAM,KAAK,EAAE,aAAa,KAAK;EAC7C,MAAM,QAAQ,IACZ,MAAM,IAAI,OAAO,SAAS;GACxB,IAAI;IACF,MAAM,IAAI,SAAS,CAAC,CAAC,cAAc,IAAI;GACzC,SAAS,OAAO;IACd,QAAQ,MAAM,6BAA6B,KAAK;GAClD;EACF,CAAC,CACH;CACF,GACA,CAAC,UAAU,GAAG,CAChB;CAEA,MAAM,cAAc;EAClB,GAAI,aAAa,EAAE,iBAAiB,OAAO,IAAI;EAC/C,GAAG;EACH,oBAAoB,qBAClB,KAAK,oBACL,sBACF;EACA,mBAAmB,qBACjB,KAAK,mBACL,qBACF;EACA,oBAAoB,qBAClB,KAAK,oBACL,sBACF;EACA,eAAe,qBAAqB,KAAK,eAAe,UAAU;EAClE;CACF;CAEA,IAAI,UAAU,eAAe,MAAM,GAAG;EACpC,MAAM,iBACJ,aAAa,KAAA,IACT,WACC,OAAO,MAAkC;EAChD,OACE,oBAAC,KAAK,MAAN;GAAW,GAAI;aACZ,aAAa,QAAQ,KAAA,GAAW,cAAiC;EACzD,CAAA;CAEf;CAGA,OAAO,oBADM,UAAU,KAAK,OAAO,OAC5B;EAAM,GAAI;EAAc;CAAe,CAAA;AAChD,CAAC;AAED,oCAAoC,cAClC"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
- import { forwardRef } from "react";
4
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/primitives/composer/ComposerDictationTranscript.tsx
7
7
  /**
@@ -4,7 +4,7 @@ import { useMediaQuery } from "../../utils/hooks/useMediaQuery.js";
4
4
  import { useComposerInputPluginRegistryOptional } from "./ComposerInputPluginContext.js";
5
5
  import { useTriggerPopoverActiveAriaOptional } from "./trigger/TriggerPopoverRootContext.js";
6
6
  import { useAui, useAuiState } from "@assistant-ui/store";
7
- import { cloneElement, forwardRef, isValidElement, useCallback, useEffect, useRef } from "react";
7
+ import { cloneElement, forwardRef, isValidElement, useCallback, useEffect, useRef } from "@assistant-ui/tap/react-shim";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
10
10
  import { composeEventHandlers } from "@radix-ui/primitive";
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerInput.js","names":[],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"radix-ui\";\nimport {\n type ClipboardEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n cloneElement,\n isValidElement,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useMediaQuery } from \"../../utils/hooks/useMediaQuery\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\nimport { flushResourcesSync } from \"@assistant-ui/tap\";\nimport { useComposerInputPluginRegistryOptional } from \"./ComposerInputPluginContext\";\nimport { useTriggerPopoverActiveAriaOptional } from \"./trigger/TriggerPopoverRootContext\";\n\nconst TOUCH_PRIMARY_QUERY = \"(pointer: coarse) and (not (any-pointer: fine))\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n\n type BaseProps = {\n /**\n * Whether to render as a child component using Slot.\n * When true, the component will merge its props with its child.\n */\n asChild?: boolean | undefined;\n /**\n * A React element to use as the input container, with props merged in.\n */\n render?: ReactElement | undefined;\n /**\n * Whether to cancel message composition when Escape is pressed.\n * @default true\n */\n cancelOnEscape?: boolean | undefined;\n /**\n * Whether to automatically focus the input when a new run starts.\n * @default true\n */\n unstable_focusOnRunStart?: boolean | undefined;\n /**\n * Whether to automatically focus the input when scrolling to bottom.\n * @default true\n */\n unstable_focusOnScrollToBottom?: boolean | undefined;\n /**\n * Whether to automatically focus the input when switching threads.\n * @default true\n */\n unstable_focusOnThreadSwitched?: boolean | undefined;\n /**\n * Whether plain Enter on a touch-primary device should insert a newline\n * instead of submitting, detected via\n * `(pointer: coarse) and (not (any-pointer: fine))`. Only takes effect\n * when `submitMode` resolves to `\"enter\"`.\n * @default false\n */\n unstable_insertNewlineOnTouchEnter?: boolean | undefined;\n /**\n * Whether to automatically add pasted files as attachments.\n * @default true\n */\n addAttachmentOnPaste?: boolean | undefined;\n };\n\n type SubmitModeProps =\n | {\n /**\n * Controls how the Enter key submits messages.\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"ctrlEnter\": Ctrl/Cmd+Enter submits (plain Enter for newline)\n * - \"none\": Keyboard submission disabled\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"ctrlEnter\" | \"none\" | undefined;\n /**\n * @deprecated Use `submitMode` instead\n * @ignore\n */\n submitOnEnter?: never;\n }\n | {\n submitMode?: never;\n /**\n * Whether to submit the message when Enter is pressed (without Shift).\n * @default true\n * @deprecated Use `submitMode` instead. Will be removed in a future version.\n */\n submitOnEnter?: boolean | undefined;\n };\n\n export type Props = TextareaAutosizeProps & BaseProps & SubmitModeProps;\n}\n\n/**\n * A text input component for composing messages.\n *\n * This component provides a rich text input experience with automatic resizing,\n * keyboard shortcuts, file paste support, and intelligent focus management.\n * It integrates with the composer context to manage message state and submission.\n *\n * When rendered inside `Unstable_TriggerPopoverRoot` and a popover is open, the\n * underlying `<textarea>` automatically receives `aria-controls`,\n * `aria-expanded`, `aria-haspopup`, and `aria-activedescendant` for the\n * combobox relationship. These computed attributes override user-provided\n * values for those four ARIA props while the popover is open.\n *\n * @example\n * ```tsx\n * // Ctrl/Cmd+Enter to submit (plain Enter inserts newline)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitMode=\"ctrlEnter\"\n * />\n *\n * // Insert a newline on Enter on touch-primary devices.\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * unstable_insertNewlineOnTouchEnter\n * />\n *\n * // Old API (deprecated, still supported)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitOnEnter={true}\n * />\n * ```\n */\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n render,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n onPaste,\n onSelect,\n submitOnEnter,\n submitMode,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n unstable_insertNewlineOnTouchEnter = false,\n addAttachmentOnPaste = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const aui = useAui();\n const pluginRegistry = useComposerInputPluginRegistryOptional();\n const activeAria = useTriggerPopoverActiveAriaOptional();\n\n const declaredSubmitMode =\n submitMode ?? (submitOnEnter === false ? \"none\" : \"enter\");\n const isTouchPrimary = useMediaQuery(\n unstable_insertNewlineOnTouchEnter ? TOUCH_PRIMARY_QUERY : null,\n );\n const effectiveSubmitMode =\n unstable_insertNewlineOnTouchEnter &&\n isTouchPrimary &&\n declaredSubmitMode === \"enter\"\n ? \"none\"\n : declaredSubmitMode;\n\n const value = useAuiState((s) => {\n if (!s.composer.isEditing) return \"\";\n return s.composer.text;\n });\n\n const isDisabled =\n useAuiState(\n (s) => s.thread.isDisabled || s.composer.dictation?.inputDisabled,\n ) || disabledProp;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n // suppress text/cursor broadcasts during IME composition\n const compositionRef = useRef(false);\n\n useEscapeKeydown((e) => {\n // Only handle ESC if it originated from within this input\n if (!textareaRef.current?.contains(e.target as Node)) return;\n\n // Let registered plugins (mention, slash command, etc.) handle Escape first\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n if (plugin.handleKeyDown(e)) return;\n }\n }\n\n if (!cancelOnEscape) return;\n\n const composer = aui.composer();\n if (composer.getState().canCancel) {\n composer.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n // Let registered plugins (mention, slash command, etc.) handle keyboard events first\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n if (plugin.handleKeyDown(e)) return;\n }\n }\n\n if (e.key === \"Enter\") {\n const threadState = aui.thread().getState();\n const hasQueue = threadState.capabilities.queue;\n\n // Steer hotkey: Cmd/Ctrl+Shift+Enter (respects submitMode=\"none\" and canSend)\n if (\n e.shiftKey &&\n (e.ctrlKey || e.metaKey) &&\n hasQueue &&\n declaredSubmitMode !== \"none\" &&\n aui.composer().getState().canSend\n ) {\n e.preventDefault();\n aui.composer().send({ steer: true });\n return;\n }\n\n // Regular newline: Shift+Enter\n if (e.shiftKey) return;\n\n // Block submission when running unless queue is supported\n if (threadState.isRunning && !hasQueue) return;\n\n let shouldSubmit = false;\n if (effectiveSubmitMode === \"ctrlEnter\") {\n shouldSubmit = e.ctrlKey || e.metaKey;\n } else if (effectiveSubmitMode === \"enter\") {\n shouldSubmit = true;\n }\n\n if (shouldSubmit) {\n e.preventDefault();\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const handlePaste = async (e: ClipboardEvent<HTMLTextAreaElement>) => {\n if (!addAttachmentOnPaste) return;\n const threadCapabilities = aui.thread().getState().capabilities;\n const files = Array.from(e.clipboardData?.files || []);\n\n if (threadCapabilities.attachments && files.length > 0) {\n try {\n e.preventDefault();\n await Promise.all(\n files.map((file) => aui.composer().addAttachment(file)),\n );\n } catch (error) {\n console.error(\"Error adding attachment:\", error);\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (\n aui.composer().getState().type === \"thread\" &&\n unstable_focusOnScrollToBottom\n ) {\n focus();\n }\n });\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnRunStart\n )\n return undefined;\n\n return aui.on(\"thread.runStart\", focus);\n }, [unstable_focusOnRunStart, focus, aui]);\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnThreadSwitched\n )\n return undefined;\n\n return aui.on(\"threadListItem.switchedTo\", focus);\n }, [unstable_focusOnThreadSwitched, focus, aui]);\n\n const ariaComboboxProps = activeAria\n ? {\n \"aria-controls\": activeAria.popoverId,\n \"aria-expanded\": true as const,\n \"aria-haspopup\": \"listbox\" as const,\n \"aria-activedescendant\": activeAria.highlightedItemId,\n }\n : {};\n\n const inputProps = {\n name: \"input\" as const,\n value,\n ...rest,\n ...ariaComboboxProps,\n ref: ref as React.ForwardedRef<HTMLTextAreaElement>,\n disabled: isDisabled,\n onChange: composeEventHandlers(\n onChange,\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!aui.composer().getState().isEditing) return;\n const nativeIsComposing =\n (e.nativeEvent as { isComposing?: boolean }).isComposing === true;\n // recover stuck compositionRef when the browser drops compositionend\n if (compositionRef.current && !nativeIsComposing) {\n compositionRef.current = false;\n }\n const isComposing = nativeIsComposing || compositionRef.current;\n // keep controlled value in sync mid-IME so react does not reset the textarea to a stale value\n flushResourcesSync(() => {\n aui.composer().setText(e.target.value);\n });\n if (isComposing) return;\n const pos = e.target.selectionStart ?? e.target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onKeyDown: composeEventHandlers(onKeyDown, handleKeyPress),\n onCompositionStart: composeEventHandlers(\n (rest as { onCompositionStart?: React.CompositionEventHandler })\n .onCompositionStart,\n () => {\n compositionRef.current = true;\n },\n ),\n onCompositionEnd: composeEventHandlers(\n (rest as { onCompositionEnd?: React.CompositionEventHandler })\n .onCompositionEnd,\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = false;\n if (!aui.composer().getState().isEditing) return;\n const target = e.target as HTMLTextAreaElement;\n flushResourcesSync(() => {\n aui.composer().setText(target.value);\n });\n const pos = target.selectionStart ?? target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onSelect: composeEventHandlers(\n onSelect,\n (e: React.SyntheticEvent<HTMLTextAreaElement>) => {\n if (compositionRef.current) return;\n const target = e.target as HTMLTextAreaElement;\n const pos = target.selectionStart ?? target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onPaste: composeEventHandlers(onPaste, handlePaste),\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n (rest as any).children !== undefined\n ? ((rest as any).children as ReactNode)\n : ((render.props as Record<string, unknown>).children as ReactNode);\n return (\n <Slot.Root {...inputProps}>\n {cloneElement(render, undefined, renderChildren)}\n </Slot.Root>\n );\n }\n\n const Component = asChild ? Slot.Root : TextareaAutosize;\n return <Component {...inputProps} />;\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiH5B,MAAa,yBAAyB,YAKlC,EACE,YAAY,OACZ,SACA,QACA,UAAU,cACV,UACA,WACA,SACA,UACA,eACA,YACA,iBAAiB,MACjB,2BAA2B,MAC3B,iCAAiC,MACjC,iCAAiC,MACjC,qCAAqC,OACrC,uBAAuB,MACvB,GAAG,QAEL,iBACG;CACH,MAAM,MAAM,OAAO;CACnB,MAAM,iBAAiB,uCAAuC;CAC9D,MAAM,aAAa,oCAAoC;CAEvD,MAAM,qBACJ,eAAe,kBAAkB,QAAQ,SAAS;CACpD,MAAM,iBAAiB,cACrB,qCAAqC,sBAAsB,IAC7D;CACA,MAAM,sBACJ,sCACA,kBACA,uBAAuB,UACnB,SACA;CAEN,MAAM,QAAQ,aAAa,MAAM;EAC/B,IAAI,CAAC,EAAE,SAAS,WAAW,OAAO;EAClC,OAAO,EAAE,SAAS;CACpB,CAAC;CAED,MAAM,aACJ,aACG,MAAM,EAAE,OAAO,cAAc,EAAE,SAAS,WAAW,aACtD,KAAK;CACP,MAAM,cAAc,OAA4B,IAAI;CACpD,MAAM,MAAM,gBAAgB,cAAc,WAAW;CAErD,MAAM,iBAAiB,OAAO,KAAK;CAEnC,kBAAkB,MAAM;EAEtB,IAAI,CAAC,YAAY,SAAS,SAAS,EAAE,MAAc,GAAG;EAGtD,IAAI;QACG,MAAM,UAAU,eAAe,WAAW,GAC7C,IAAI,OAAO,cAAc,CAAC,GAAG;EAAA;EAIjC,IAAI,CAAC,gBAAgB;EAErB,MAAM,WAAW,IAAI,SAAS;EAC9B,IAAI,SAAS,SAAS,EAAE,WAAW;GACjC,SAAS,OAAO;GAChB,EAAE,eAAe;EACnB;CACF,CAAC;CAED,MAAM,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A,WAAW,qBAAqB,WAAW,cAAc;EACzD,oBAAoB,qBACjB,KACE,0BACG;GACJ,eAAe,UAAU;EAC3B,CACF;EACA,kBAAkB,qBACf,KACE,mBACF,MAAmD;GAClD,eAAe,UAAU;GACzB,IAAI,CAAC,IAAI,SAAS,EAAE,SAAS,EAAE,WAAW;GAC1C,MAAM,SAAS,EAAE;GACjB,yBAAyB;IACvB,IAAI,SAAS,EAAE,QAAQ,OAAO,KAAK;GACrC,CAAC;GACD,MAAM,MAAM,OAAO,kBAAkB,OAAO,MAAM;GAClD,IAAI,gBACF,KAAK,MAAM,UAAU,eAAe,WAAW,GAC7C,OAAO,kBAAkB,GAAG;EAGlC,CACF;EACA,UAAU,qBACR,WACC,MAAiD;GAChD,IAAI,eAAe,SAAS;GAC5B,MAAM,SAAS,EAAE;GACjB,MAAM,MAAM,OAAO,kBAAkB,OAAO,MAAM;GAClD,IAAI,gBACF,KAAK,MAAM,UAAU,eAAe,WAAW,GAC7C,OAAO,kBAAkB,GAAG;EAGlC,CACF;EACA,SAAS,qBAAqB,SAAS,WAAW;CACpD;CAEA,IAAI,UAAU,eAAe,MAAM,GAAG;EACpC,MAAM,iBACH,KAAa,aAAa,KAAA,IACrB,KAAa,WACb,OAAO,MAAkC;EACjD,OACE,oBAAC,KAAK,MAAN;GAAW,GAAI;aACZ,aAAa,QAAQ,KAAA,GAAW,cAAc;EACtC,CAAA;CAEf;CAGA,OAAO,oBADW,UAAU,KAAK,OAAO,kBACjC,EAAW,GAAI,WAAa,CAAA;AACrC,CACF;AAEA,uBAAuB,cAAc"}
1
+ {"version":3,"file":"ComposerInput.js","names":[],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"radix-ui\";\nimport {\n type ClipboardEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n cloneElement,\n isValidElement,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useMediaQuery } from \"../../utils/hooks/useMediaQuery\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\nimport { flushResourcesSync } from \"@assistant-ui/tap\";\nimport { useComposerInputPluginRegistryOptional } from \"./ComposerInputPluginContext\";\nimport { useTriggerPopoverActiveAriaOptional } from \"./trigger/TriggerPopoverRootContext\";\n\nconst TOUCH_PRIMARY_QUERY = \"(pointer: coarse) and (not (any-pointer: fine))\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n\n type BaseProps = {\n /**\n * Whether to render as a child component using Slot.\n * When true, the component will merge its props with its child.\n */\n asChild?: boolean | undefined;\n /**\n * A React element to use as the input container, with props merged in.\n */\n render?: ReactElement | undefined;\n /**\n * Whether to cancel message composition when Escape is pressed.\n * @default true\n */\n cancelOnEscape?: boolean | undefined;\n /**\n * Whether to automatically focus the input when a new run starts.\n * @default true\n */\n unstable_focusOnRunStart?: boolean | undefined;\n /**\n * Whether to automatically focus the input when scrolling to bottom.\n * @default true\n */\n unstable_focusOnScrollToBottom?: boolean | undefined;\n /**\n * Whether to automatically focus the input when switching threads.\n * @default true\n */\n unstable_focusOnThreadSwitched?: boolean | undefined;\n /**\n * Whether plain Enter on a touch-primary device should insert a newline\n * instead of submitting, detected via\n * `(pointer: coarse) and (not (any-pointer: fine))`. Only takes effect\n * when `submitMode` resolves to `\"enter\"`.\n * @default false\n */\n unstable_insertNewlineOnTouchEnter?: boolean | undefined;\n /**\n * Whether to automatically add pasted files as attachments.\n * @default true\n */\n addAttachmentOnPaste?: boolean | undefined;\n };\n\n type SubmitModeProps =\n | {\n /**\n * Controls how the Enter key submits messages.\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"ctrlEnter\": Ctrl/Cmd+Enter submits (plain Enter for newline)\n * - \"none\": Keyboard submission disabled\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"ctrlEnter\" | \"none\" | undefined;\n /**\n * @deprecated Use `submitMode` instead\n * @ignore\n */\n submitOnEnter?: never;\n }\n | {\n submitMode?: never;\n /**\n * Whether to submit the message when Enter is pressed (without Shift).\n * @default true\n * @deprecated Use `submitMode` instead. Will be removed in a future version.\n */\n submitOnEnter?: boolean | undefined;\n };\n\n export type Props = TextareaAutosizeProps & BaseProps & SubmitModeProps;\n}\n\n/**\n * A text input component for composing messages.\n *\n * This component provides a rich text input experience with automatic resizing,\n * keyboard shortcuts, file paste support, and intelligent focus management.\n * It integrates with the composer context to manage message state and submission.\n *\n * When rendered inside `Unstable_TriggerPopoverRoot` and a popover is open, the\n * underlying `<textarea>` automatically receives `aria-controls`,\n * `aria-expanded`, `aria-haspopup`, and `aria-activedescendant` for the\n * combobox relationship. These computed attributes override user-provided\n * values for those four ARIA props while the popover is open.\n *\n * @example\n * ```tsx\n * // Ctrl/Cmd+Enter to submit (plain Enter inserts newline)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitMode=\"ctrlEnter\"\n * />\n *\n * // Insert a newline on Enter on touch-primary devices.\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * unstable_insertNewlineOnTouchEnter\n * />\n *\n * // Old API (deprecated, still supported)\n * <ComposerPrimitive.Input\n * placeholder=\"Type your message...\"\n * submitOnEnter={true}\n * />\n * ```\n */\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n render,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n onPaste,\n onSelect,\n submitOnEnter,\n submitMode,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n unstable_insertNewlineOnTouchEnter = false,\n addAttachmentOnPaste = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const aui = useAui();\n const pluginRegistry = useComposerInputPluginRegistryOptional();\n const activeAria = useTriggerPopoverActiveAriaOptional();\n\n const declaredSubmitMode =\n submitMode ?? (submitOnEnter === false ? \"none\" : \"enter\");\n const isTouchPrimary = useMediaQuery(\n unstable_insertNewlineOnTouchEnter ? TOUCH_PRIMARY_QUERY : null,\n );\n const effectiveSubmitMode =\n unstable_insertNewlineOnTouchEnter &&\n isTouchPrimary &&\n declaredSubmitMode === \"enter\"\n ? \"none\"\n : declaredSubmitMode;\n\n const value = useAuiState((s) => {\n if (!s.composer.isEditing) return \"\";\n return s.composer.text;\n });\n\n const isDisabled =\n useAuiState(\n (s) => s.thread.isDisabled || s.composer.dictation?.inputDisabled,\n ) || disabledProp;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n // suppress text/cursor broadcasts during IME composition\n const compositionRef = useRef(false);\n\n useEscapeKeydown((e) => {\n // Only handle ESC if it originated from within this input\n if (!textareaRef.current?.contains(e.target as Node)) return;\n\n // Let registered plugins (mention, slash command, etc.) handle Escape first\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n if (plugin.handleKeyDown(e)) return;\n }\n }\n\n if (!cancelOnEscape) return;\n\n const composer = aui.composer();\n if (composer.getState().canCancel) {\n composer.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n // Let registered plugins (mention, slash command, etc.) handle keyboard events first\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n if (plugin.handleKeyDown(e)) return;\n }\n }\n\n if (e.key === \"Enter\") {\n const threadState = aui.thread().getState();\n const hasQueue = threadState.capabilities.queue;\n\n // Steer hotkey: Cmd/Ctrl+Shift+Enter (respects submitMode=\"none\" and canSend)\n if (\n e.shiftKey &&\n (e.ctrlKey || e.metaKey) &&\n hasQueue &&\n declaredSubmitMode !== \"none\" &&\n aui.composer().getState().canSend\n ) {\n e.preventDefault();\n aui.composer().send({ steer: true });\n return;\n }\n\n // Regular newline: Shift+Enter\n if (e.shiftKey) return;\n\n // Block submission when running unless queue is supported\n if (threadState.isRunning && !hasQueue) return;\n\n let shouldSubmit = false;\n if (effectiveSubmitMode === \"ctrlEnter\") {\n shouldSubmit = e.ctrlKey || e.metaKey;\n } else if (effectiveSubmitMode === \"enter\") {\n shouldSubmit = true;\n }\n\n if (shouldSubmit) {\n e.preventDefault();\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const handlePaste = async (e: ClipboardEvent<HTMLTextAreaElement>) => {\n if (!addAttachmentOnPaste) return;\n const threadCapabilities = aui.thread().getState().capabilities;\n const files = Array.from(e.clipboardData?.files || []);\n\n if (threadCapabilities.attachments && files.length > 0) {\n try {\n e.preventDefault();\n await Promise.all(\n files.map((file) => aui.composer().addAttachment(file)),\n );\n } catch (error) {\n console.error(\"Error adding attachment:\", error);\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (\n aui.composer().getState().type === \"thread\" &&\n unstable_focusOnScrollToBottom\n ) {\n focus();\n }\n });\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnRunStart\n )\n return undefined;\n\n return aui.on(\"thread.runStart\", focus);\n }, [unstable_focusOnRunStart, focus, aui]);\n\n useEffect(() => {\n if (\n aui.composer().getState().type !== \"thread\" ||\n !unstable_focusOnThreadSwitched\n )\n return undefined;\n\n return aui.on(\"threadListItem.switchedTo\", focus);\n }, [unstable_focusOnThreadSwitched, focus, aui]);\n\n const ariaComboboxProps = activeAria\n ? {\n \"aria-controls\": activeAria.popoverId,\n \"aria-expanded\": true as const,\n \"aria-haspopup\": \"listbox\" as const,\n \"aria-activedescendant\": activeAria.highlightedItemId,\n }\n : {};\n\n const inputProps = {\n name: \"input\" as const,\n value,\n ...rest,\n ...ariaComboboxProps,\n ref: ref as React.ForwardedRef<HTMLTextAreaElement>,\n disabled: isDisabled,\n onChange: composeEventHandlers(\n onChange,\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!aui.composer().getState().isEditing) return;\n const nativeIsComposing =\n (e.nativeEvent as { isComposing?: boolean }).isComposing === true;\n // recover stuck compositionRef when the browser drops compositionend\n if (compositionRef.current && !nativeIsComposing) {\n compositionRef.current = false;\n }\n const isComposing = nativeIsComposing || compositionRef.current;\n // keep controlled value in sync mid-IME so react does not reset the textarea to a stale value\n flushResourcesSync(() => {\n aui.composer().setText(e.target.value);\n });\n if (isComposing) return;\n const pos = e.target.selectionStart ?? e.target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onKeyDown: composeEventHandlers(onKeyDown, handleKeyPress),\n onCompositionStart: composeEventHandlers(\n (rest as { onCompositionStart?: React.CompositionEventHandler })\n .onCompositionStart,\n () => {\n compositionRef.current = true;\n },\n ),\n onCompositionEnd: composeEventHandlers(\n (rest as { onCompositionEnd?: React.CompositionEventHandler })\n .onCompositionEnd,\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = false;\n if (!aui.composer().getState().isEditing) return;\n const target = e.target as HTMLTextAreaElement;\n flushResourcesSync(() => {\n aui.composer().setText(target.value);\n });\n const pos = target.selectionStart ?? target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onSelect: composeEventHandlers(\n onSelect,\n (e: React.SyntheticEvent<HTMLTextAreaElement>) => {\n if (compositionRef.current) return;\n const target = e.target as HTMLTextAreaElement;\n const pos = target.selectionStart ?? target.value.length;\n if (pluginRegistry) {\n for (const plugin of pluginRegistry.getPlugins()) {\n plugin.setCursorPosition(pos);\n }\n }\n },\n ),\n onPaste: composeEventHandlers(onPaste, handlePaste),\n };\n\n if (render && isValidElement(render)) {\n const renderChildren =\n (rest as any).children !== undefined\n ? ((rest as any).children as ReactNode)\n : ((render.props as Record<string, unknown>).children as ReactNode);\n return (\n <Slot.Root {...inputProps}>\n {cloneElement(render, undefined, renderChildren)}\n </Slot.Root>\n );\n }\n\n const Component = asChild ? Slot.Root : TextareaAutosize;\n return <Component {...inputProps} />;\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiH5B,MAAa,yBAAyB,YAKlC,EACE,YAAY,OACZ,SACA,QACA,UAAU,cACV,UACA,WACA,SACA,UACA,eACA,YACA,iBAAiB,MACjB,2BAA2B,MAC3B,iCAAiC,MACjC,iCAAiC,MACjC,qCAAqC,OACrC,uBAAuB,MACvB,GAAG,QAEL,iBACG;CACH,MAAM,MAAM,OAAO;CACnB,MAAM,iBAAiB,uCAAuC;CAC9D,MAAM,aAAa,oCAAoC;CAEvD,MAAM,qBACJ,eAAe,kBAAkB,QAAQ,SAAS;CACpD,MAAM,iBAAiB,cACrB,qCAAqC,sBAAsB,IAC7D;CACA,MAAM,sBACJ,sCACA,kBACA,uBAAuB,UACnB,SACA;CAEN,MAAM,QAAQ,aAAa,MAAM;EAC/B,IAAI,CAAC,EAAE,SAAS,WAAW,OAAO;EAClC,OAAO,EAAE,SAAS;CACpB,CAAC;CAED,MAAM,aACJ,aACG,MAAM,EAAE,OAAO,cAAc,EAAE,SAAS,WAAW,aACtD,KAAK;CAC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,UAAU,eAAe,MAAM,GAAG;EACpC,MAAM,iBACH,KAAa,aAAa,KAAA,IACrB,KAAa,WACb,OAAO,MAAkC;EACjD,OACE,oBAAC,KAAK,MAAN;GAAW,GAAI;aACZ,aAAa,QAAQ,KAAA,GAAW,cAAc;EACtC,CAAA;CAEf;CAGA,OAAO,oBADW,UAAU,KAAK,OAAO,kBACjC,EAAW,GAAI,WAAa,CAAA;AACrC,CACF;AAEA,uBAAuB,cAAc"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { createContext, useCallback, useContext, useMemo, useRef } from "react";
2
+ import { createContext, useCallback, useContext, useMemo, useRef } from "@assistant-ui/tap/react-shim";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/primitives/composer/ComposerInputPluginContext.tsx
5
5
  const ComposerInputPluginRegistryContext = createContext(null);
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Primitive } from "../../utils/Primitive.js";
3
3
  import { useAui, useAuiState } from "@assistant-ui/store";
4
- import { forwardRef, useCallback } from "react";
4
+ import { forwardRef, useCallback } from "@assistant-ui/tap/react-shim";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { composeEventHandlers } from "@radix-ui/primitive";
7
7
  //#region src/primitives/composer/ComposerQuote.tsx