@assistant-ui/core 0.3.0 → 0.3.2

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 (143) hide show
  1. package/dist/internal.d.ts +1 -2
  2. package/dist/internal.js +1 -2
  3. package/dist/react/AssistantProvider.d.ts +1 -1
  4. package/dist/react/AssistantProvider.d.ts.map +1 -1
  5. package/dist/react/AssistantProvider.js +35 -9
  6. package/dist/react/AssistantProvider.js.map +1 -1
  7. package/dist/react/AssistantRuntimeProvider.d.ts +1 -1
  8. package/dist/react/AssistantRuntimeProvider.js +1 -1
  9. package/dist/react/RuntimeAdapter.js +2 -2
  10. package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
  11. package/dist/react/adapters/LocalStorageThreadListAdapter.js +17 -33
  12. package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
  13. package/dist/react/client/DataRenderers.js +1 -1
  14. package/dist/react/client/Interactables.js +1 -1
  15. package/dist/react/client/Tools.js +2 -2
  16. package/dist/react/index.d.ts +2 -1
  17. package/dist/react/index.js +2 -1
  18. package/dist/react/interactables-legacy/Interactables.js +1 -1
  19. package/dist/react/interactables-legacy/useAssistantInteractable.js +1 -1
  20. package/dist/react/interactables-legacy/useInteractableState.js +2 -2
  21. package/dist/react/model-context/useAssistantContext.js +1 -1
  22. package/dist/react/model-context/useAssistantDataUI.js +2 -2
  23. package/dist/react/model-context/useAssistantInstructions.js +2 -2
  24. package/dist/react/model-context/useAssistantTool.js +2 -2
  25. package/dist/react/model-context/useAssistantToolUI.js +2 -2
  26. package/dist/react/model-context/useAuiToolOverrides.js +1 -1
  27. package/dist/react/model-context/useInlineRender.js +1 -1
  28. package/dist/react/model-context/useInteractable.d.ts.map +1 -1
  29. package/dist/react/model-context/useInteractable.js +3 -5
  30. package/dist/react/model-context/useInteractable.js.map +1 -1
  31. package/dist/react/model-context/useInteractableState.js +2 -2
  32. package/dist/react/model-context/useInteractableVersions.js +2 -2
  33. package/dist/react/model-context/useToolArgsStatus.js +2 -2
  34. package/dist/react/primitive-hooks/useActionBarCopy.js +2 -2
  35. package/dist/react/primitive-hooks/useActionBarEdit.js +2 -2
  36. package/dist/react/primitive-hooks/useActionBarFeedback.js +2 -2
  37. package/dist/react/primitive-hooks/useActionBarReload.js +2 -2
  38. package/dist/react/primitive-hooks/useActionBarSpeak.js +2 -2
  39. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +2 -2
  40. package/dist/react/primitive-hooks/useBranchPickerNext.js +2 -2
  41. package/dist/react/primitive-hooks/useBranchPickerPrevious.js +2 -2
  42. package/dist/react/primitive-hooks/useComposerAddAttachment.js +2 -2
  43. package/dist/react/primitive-hooks/useComposerCancel.js +2 -2
  44. package/dist/react/primitive-hooks/useComposerDictate.js +2 -2
  45. package/dist/react/primitive-hooks/useComposerSend.js +2 -2
  46. package/dist/react/primitive-hooks/useEditComposerCancel.js +2 -2
  47. package/dist/react/primitive-hooks/useEditComposerSend.js +2 -2
  48. package/dist/react/primitive-hooks/useMessageBranching.js +2 -2
  49. package/dist/react/primitive-hooks/useMessageReload.js +2 -2
  50. package/dist/react/primitive-hooks/useSuggestionTrigger.js +2 -2
  51. package/dist/react/primitive-hooks/useThreadListItemArchive.js +2 -2
  52. package/dist/react/primitive-hooks/useThreadListItemDelete.js +2 -2
  53. package/dist/react/primitive-hooks/useThreadListItemTrigger.js +2 -2
  54. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +2 -2
  55. package/dist/react/primitive-hooks/useThreadListLoadMore.js +2 -2
  56. package/dist/react/primitive-hooks/useThreadListNew.js +2 -2
  57. package/dist/react/primitive-hooks/useThreadMessageIds.js +1 -1
  58. package/dist/react/primitive-hooks/useVoice.js +2 -2
  59. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +2 -2
  60. package/dist/react/primitives/composer/ComposerAttachments.js +2 -2
  61. package/dist/react/primitives/composer/ComposerIf.js +1 -1
  62. package/dist/react/primitives/composer/ComposerQueue.js +1 -1
  63. package/dist/react/primitives/generativeUI/GenerativeUI.js +2 -2
  64. package/dist/react/primitives/message/MessageAttachments.js +2 -2
  65. package/dist/react/primitives/message/MessageGroupedParts.js +1 -1
  66. package/dist/react/primitives/message/MessageParts.js +2 -2
  67. package/dist/react/primitives/message/MessageQuote.js +2 -2
  68. package/dist/react/primitives/part/PartMessages.js +2 -2
  69. package/dist/react/primitives/thread/ThreadMessages.js +2 -2
  70. package/dist/react/primitives/thread/ThreadSuggestions.js +2 -2
  71. package/dist/react/primitives/threadList/ThreadListItems.js +2 -2
  72. package/dist/react/primitives/threadListItem/ThreadListItemTitle.js +1 -1
  73. package/dist/react/providers/AttachmentByIndexProvider.js +1 -1
  74. package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +1 -1
  75. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +1 -1
  76. package/dist/react/providers/MessageByIdProvider.js +1 -1
  77. package/dist/react/providers/MessageByIndexProvider.js +1 -1
  78. package/dist/react/providers/PartByIndexProvider.js +1 -1
  79. package/dist/react/providers/QueueItemByIndexProvider.js +1 -1
  80. package/dist/react/providers/ReadonlyThreadProvider.js +2 -2
  81. package/dist/react/providers/SuggestionByIndexProvider.js +1 -1
  82. package/dist/react/providers/TextMessagePartProvider.js +2 -2
  83. package/dist/react/providers/ThreadListItemByIndexProvider.js +1 -1
  84. package/dist/react/providers/ThreadListItemRuntimeProvider.js +1 -1
  85. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  86. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +14 -13
  87. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  88. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +3 -0
  89. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  90. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +22 -12
  91. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  92. package/dist/react/runtimes/RuntimeAdapterProvider.js +1 -1
  93. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +9 -23
  94. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  95. package/dist/react/runtimes/external-message-converter.js +1 -1
  96. package/dist/react/runtimes/useExternalStoreRuntime.js +1 -1
  97. package/dist/react/runtimes/useExternalStoreSharedOptions.js +1 -1
  98. package/dist/react/runtimes/useLocalRuntime.js +1 -1
  99. package/dist/react/runtimes/useRemoteThreadListRuntime.js +7 -13
  100. package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  101. package/dist/react/utils/useJSONEqual.js +1 -1
  102. package/dist/runtime/utils/thread-message-like.js +2 -2
  103. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  104. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  105. package/dist/runtimes/local/local-thread-runtime-core.js +4 -3
  106. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  107. package/dist/runtimes/remote-thread-list/types.d.ts +5 -4
  108. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  109. package/dist/store/clients/chain-of-thought-client.js +1 -1
  110. package/dist/store/clients/model-context-client.js +1 -1
  111. package/dist/store/clients/no-op-composer-client.js +1 -1
  112. package/dist/store/clients/suggestions.js +2 -2
  113. package/dist/store/clients/thread-message-client.js +2 -2
  114. package/dist/store/runtime-clients/composer-runtime-client.js +2 -2
  115. package/dist/store/runtime-clients/message-runtime-client.js +2 -2
  116. package/dist/store/runtime-clients/thread-list-item-runtime-client.js +2 -2
  117. package/dist/store/runtime-clients/thread-list-runtime-client.js +2 -2
  118. package/dist/store/runtime-clients/thread-runtime-client.js +2 -2
  119. package/dist/store/scopes/thread.d.ts +1 -1
  120. package/dist/store/scopes/thread.d.ts.map +1 -1
  121. package/dist/utils/data-url.js +2 -2
  122. package/dist/utils/data-url.js.map +1 -1
  123. package/package.json +4 -4
  124. package/src/internal.ts +0 -7
  125. package/src/react/AssistantProvider.tsx +28 -15
  126. package/src/react/AssistantRuntimeProvider.test.tsx +101 -0
  127. package/src/react/adapters/LocalStorageThreadListAdapter.tsx +28 -7
  128. package/src/react/index.ts +4 -0
  129. package/src/react/model-context/useInteractable.ts +2 -6
  130. package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +16 -13
  131. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +53 -10
  132. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +7 -5
  133. package/src/react/runtimes/useRemoteThreadListRuntime.ts +9 -15
  134. package/src/runtime/utils/thread-message-like.ts +2 -2
  135. package/src/runtimes/local/local-thread-runtime-core.test.ts +38 -0
  136. package/src/runtimes/local/local-thread-runtime-core.ts +6 -3
  137. package/src/runtimes/remote-thread-list/types.ts +5 -4
  138. package/src/store/scopes/thread.ts +1 -1
  139. package/src/tests/remote-thread-list-reactive-threadId.test.ts +0 -92
  140. package/src/tests/thread-message-like.test.ts +15 -0
  141. package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +293 -0
  142. package/src/utils/data-url.test.ts +26 -2
  143. package/src/utils/data-url.ts +2 -2
@@ -2,18 +2,16 @@
2
2
  import { interactableToolName, unstable_getInteractableVersions } from "../../model-context/interactable-composer-metadata.js";
3
3
  import { unstable_useInteractableState } from "./useInteractableState.js";
4
4
  import { useJSONEqual } from "../utils/useJSONEqual.js";
5
- import { useAui, useAuiState } from "@assistant-ui/store";
6
5
  import { useEffect, useId, useMemo, useRef } from "@assistant-ui/tap/react-shim";
6
+ import { useAui, useAuiState } from "@assistant-ui/store";
7
7
  //#region src/react/model-context/useInteractable.ts
8
8
  const useInteractable = (name, config) => {
9
9
  const aui = useAui();
10
10
  const autoId = useId().replace(/[^a-zA-Z0-9]/g, "");
11
- const inPart = aui.part.source != null;
12
11
  const updateToolName = interactableToolName(name);
13
12
  const part = useAuiState((s) => {
14
- if (!inPart) return void 0;
15
- const p = s.part;
16
- return p.type === "tool-call" ? p : void 0;
13
+ const p = s.optional.part;
14
+ return p?.type === "tool-call" ? p : void 0;
17
15
  });
18
16
  let inferredId;
19
17
  if (part?.toolName === updateToolName) {
@@ -1 +1 @@
1
- {"version":3,"file":"useInteractable.js","names":["useEffect","useId","useMemo","useRef","useAui","useAuiState","Unstable_InteractableStateSchema","ToolCallMessagePartComponent","unstable_getInteractableVersions","getInteractableVersions","interactableToolName","unstable_useInteractableState","useInteractableState","useJSONEqual","Unstable_InferInteractableState","TSchema","types","output","TOutput","Unstable_InteractableVersionInfo","state","TState","isLatest","restore","Unstable_InteractableConfig","description","stateSchema","initialState","id","updateRender","useInteractable","name","config","version","setState","updater","prev","isPending","error","flush","Promise","aui","autoId","replace","inPart","part","source","updateToolName","s","undefined","p","type","inferredId","toolName","result","Record","args","success","internalScope","stateSchemaRef","current","initialStateRef","interactables","unstable_interactables","register","scope","Parameters","myToolCallId","toolCallId","registeredState","methods","versionValue","versions","thread","messages","some","v","origin","mine","find","latestToolCallId","findLast","const","unstable_useInteractable"],"sources":["../../../src/react/model-context/useInteractable.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useMemo, useRef } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { Unstable_InteractableStateSchema } from \"../types/scopes/interactables\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\nimport {\n unstable_getInteractableVersions as getInteractableVersions,\n interactableToolName,\n} from \"../../model-context/interactable-composer-metadata\";\nimport { unstable_useInteractableState as useInteractableState } from \"./useInteractableState\";\nimport { useJSONEqual } from \"../utils/useJSONEqual\";\n\n/**\n * The state type described by an interactable's `stateSchema`. Resolves the\n * output type of a StandardSchemaV1 schema (e.g. Zod); plain JSON Schema\n * falls back to `unknown`.\n */\nexport type Unstable_InferInteractableState<TSchema> = TSchema extends {\n \"~standard\": { types?: { output: infer TOutput } | undefined };\n}\n ? TOutput\n : unknown;\n\n/**\n * One message's version of an interactable, for components rendered inside\n * tool-call parts. Show `state` to display history; call `restore()` to set\n * the live instance back to it.\n */\nexport type Unstable_InteractableVersionInfo<TState> = {\n /** The interactable's state as it was at this message. */\n state: TState;\n /** Whether this message holds the instance's most recent tool-driven version. */\n isLatest: boolean;\n /** Sets the live state back to this version. */\n restore: () => void;\n};\n\n/**\n * Unstable / Experimental — the interactables API is still evolving and may change in any release.\n * @deprecated Unstable / Experimental (not actually removed).\n */\nexport type Unstable_InteractableConfig<\n TSchema extends Unstable_InteractableStateSchema,\n> = {\n description: string;\n stateSchema: TSchema;\n initialState: Unstable_InferInteractableState<TSchema>;\n /** Unique instance ID; required to address this instance when multiple interactables share a name. Auto-generated if omitted. */\n id?: string | undefined;\n /**\n * Component installed as the tool UI for this interactable's `update_{name}`\n * tool calls, so a model edit re-renders the interactable at the message\n * that made it instead of only mutating an earlier one. Prefer\n * `unstable_interactableTool`, which wires this up. Pass a stable component reference;\n * changing identity re-registers the tool UI.\n */\n updateRender?: ToolCallMessagePartComponent | undefined;\n};\n\nconst useInteractable = <TSchema extends Unstable_InteractableStateSchema>(\n name: string,\n config: Unstable_InteractableConfig<TSchema>,\n): readonly [\n Unstable_InferInteractableState<TSchema>,\n {\n id: string;\n /**\n * This message's version of the instance, when rendered inside a\n * tool-created interactable message part; `undefined` elsewhere.\n */\n version:\n | Unstable_InteractableVersionInfo<\n Unstable_InferInteractableState<TSchema>\n >\n | undefined;\n setState: (\n updater:\n | Unstable_InferInteractableState<TSchema>\n | ((\n prev: Unstable_InferInteractableState<TSchema>,\n ) => Unstable_InferInteractableState<TSchema>),\n ) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] => {\n const aui = useAui();\n\n const autoId = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n\n // Whether this component renders inside a message part is fixed for its\n // lifetime, so conditioning the selectors on it is safe.\n const inPart = aui.part.source != null;\n const updateToolName = interactableToolName(name);\n const part = useAuiState((s) => {\n if (!inPart) return undefined;\n const p = s.part;\n return p.type === \"tool-call\" ? p : undefined;\n });\n\n // Inside an update_{name} part, the instance id comes from the call itself:\n // the result's resolved id (covers id-less calls), or the id argument.\n let inferredId: string | undefined;\n if (part?.toolName === updateToolName) {\n const result = part.result as Record<string, unknown> | undefined;\n const args = part.args as Record<string, unknown> | undefined;\n if (result?.success !== false) {\n if (typeof result?.id === \"string\") inferredId = result.id;\n else if (typeof args?.id === \"string\") inferredId = args.id;\n }\n }\n\n const id = config.id ?? inferredId ?? autoId;\n const internalScope =\n part?.toolName === name || part?.toolName === updateToolName\n ? \"thread\"\n : undefined;\n\n const stateSchemaRef = useRef(config.stateSchema);\n stateSchemaRef.current = config.stateSchema;\n const initialStateRef = useRef(config.initialState);\n initialStateRef.current = config.initialState;\n\n const interactables = useAuiState(() => aui.unstable_interactables);\n\n useEffect(() => {\n return interactables.register({\n id,\n name,\n description: config.description,\n stateSchema: stateSchemaRef.current,\n initialState: initialStateRef.current,\n updateRender: config.updateRender,\n ...(internalScope ? { scope: internalScope } : {}),\n } as Parameters<typeof interactables.register>[0] & {\n scope?: \"thread\" | undefined;\n });\n }, [\n interactables,\n id,\n name,\n config.description,\n internalScope,\n config.updateRender,\n ]);\n\n const myToolCallId = part?.toolCallId;\n\n const [registeredState, methods] =\n useInteractableState<Unstable_InferInteractableState<TSchema>>(id);\n const { setState } = methods;\n\n const versionValue = useAuiState(\n useJSONEqual((s) => {\n if (!internalScope || !myToolCallId) return undefined;\n const versions = getInteractableVersions(s.thread.messages, id, name);\n if (!versions.some((v) => v.origin === \"create\" && v.toolCallId === id)) {\n return undefined;\n }\n const mine = versions.find((v) => v.toolCallId === myToolCallId);\n if (!mine) return undefined;\n const latestToolCallId = versions.findLast(\n (v) => v.toolCallId !== undefined,\n )?.toolCallId;\n return { state: mine.state, isLatest: latestToolCallId === myToolCallId };\n }),\n );\n\n const version = useMemo(\n () =>\n versionValue && {\n state: versionValue.state as Unstable_InferInteractableState<TSchema>,\n isLatest: versionValue.isLatest,\n restore: () =>\n setState(\n versionValue.state as Unstable_InferInteractableState<TSchema>,\n ),\n },\n [versionValue, setState],\n );\n\n const state =\n registeredState === undefined ? config.initialState : registeredState;\n\n return [state, { id, version, ...methods }] as const;\n};\n\n/**\n * Registers an interactable with the AI assistant and returns its live state,\n * like `useState` that the model can also read and update.\n *\n * Call this once per place that shows the interactable. Other components can\n * read and write the same instance by passing its `id` to\n * `unstable_useInteractableState`.\n *\n * For tool-created interactables rendered inside tool-call message parts,\n * `version` carries this message's version of the instance — its state as of\n * that point in the conversation, whether it is the most recent tool-driven\n * version, and a `restore()` back to it. Whether older messages render frozen history or stay\n * live-editable is the component's choice. Inside an `update_{name}` part the\n * instance `id` is inferred from the call, so the same component works at the\n * creating call and at update calls.\n *\n * @deprecated Unstable / Experimental (not actually removed).\n */\nexport const unstable_useInteractable: <\n TSchema extends Unstable_InteractableStateSchema,\n>(\n name: string,\n config: Unstable_InteractableConfig<TSchema>,\n) => readonly [\n Unstable_InferInteractableState<TSchema>,\n {\n id: string;\n version:\n | Unstable_InteractableVersionInfo<\n Unstable_InferInteractableState<TSchema>\n >\n | undefined;\n setState: (\n updater:\n | Unstable_InferInteractableState<TSchema>\n | ((\n prev: Unstable_InferInteractableState<TSchema>,\n ) => Unstable_InferInteractableState<TSchema>),\n ) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] = useInteractable;\n"],"mappings":";;;;;;;AA4DA,MAAM8B,mBACJC,MACAC,WAyBG;CACH,MAAMS,MAAMrC,OAAO;CAEnB,MAAMsC,SAASzC,MAAM,CAAC,CAAC0C,QAAQ,iBAAiB,EAAE;CAIlD,MAAMC,SAASH,IAAII,KAAKC,UAAU;CAClC,MAAMC,iBAAiBrC,qBAAqBqB,IAAI;CAChD,MAAMc,OAAOxC,aAAa2C,MAAM;EAC9B,IAAI,CAACJ,QAAQ,OAAOK,KAAAA;EACpB,MAAMC,IAAIF,EAAEH;EACZ,OAAOK,EAAEC,SAAS,cAAcD,IAAID,KAAAA;CACtC,CAAC;CAID,IAAIG;CACJ,IAAIP,MAAMQ,aAAaN,gBAAgB;EACrC,MAAMO,SAAST,KAAKS;EACpB,MAAME,OAAOX,KAAKW;EAClB,IAAIF,QAAQG,YAAY,OAClB;OAAA,OAAOH,QAAQ1B,OAAO,UAAUwB,aAAaE,OAAO1B;QACnD,IAAI,OAAO4B,MAAM5B,OAAO,UAAUwB,aAAaI,KAAK5B;EAAAA;CAE7D;CAEA,MAAMA,KAAKI,OAAOJ,MAAMwB,cAAcV;CACtC,MAAMgB,gBACJb,MAAMQ,aAAatB,QAAQc,MAAMQ,aAAaN,iBAC1C,WACAE,KAAAA;CAEN,MAAMU,iBAAiBxD,OAAO6B,OAAON,WAAW;CAChDiC,eAAeC,UAAU5B,OAAON;CAChC,MAAMmC,kBAAkB1D,OAAO6B,OAAOL,YAAY;CAClDkC,gBAAgBD,UAAU5B,OAAOL;CAEjC,MAAMmC,gBAAgBzD,kBAAkBoC,IAAIsB,sBAAsB;CAElE/D,gBAAgB;EACd,OAAO8D,cAAcE,SAAS;GAC5BpC;GACAG;GACAN,aAAaO,OAAOP;GACpBC,aAAaiC,eAAeC;GAC5BjC,cAAckC,gBAAgBD;GAC9B/B,cAAcG,OAAOH;GACrB,GAAI6B,gBAAgB,EAAEO,OAAOP,cAAc,IAAI,CAAC;EAClD,CAEC;CACH,GAAG;EACDI;EACAlC;EACAG;EACAC,OAAOP;EACPiC;EACA1B,OAAOH;CAAY,CACpB;CAED,MAAMsC,eAAetB,MAAMuB;CAE3B,MAAM,CAACC,iBAAiBC,WACtB1D,8BAA+DgB,EAAE;CACnE,MAAM,EAAEM,aAAaoC;CAErB,MAAMC,eAAelE,YACnBQ,cAAcmC,QAAM;EAClB,IAAI,CAACU,iBAAiB,CAACS,cAAc,OAAOlB,KAAAA;EAC5C,MAAMuB,WAAW/D,iCAAwBuC,IAAEyB,OAAOC,UAAU9C,IAAIG,IAAI;EACpE,IAAI,CAACyC,SAASG,MAAMC,MAAMA,EAAEC,WAAW,YAAYD,EAAER,eAAexC,EAAE,GACpE;EAEF,MAAMkD,OAAON,SAASO,MAAMH,QAAMA,IAAER,eAAeD,YAAY;EAC/D,IAAI,CAACW,MAAM,OAAO7B,KAAAA;EAClB,MAAM+B,mBAAmBR,SAASS,UAC/BL,QAAMA,IAAER,eAAenB,KAAAA,CAC1B,CAAC,EAAEmB;EACH,OAAO;GAAEhD,OAAO0D,KAAK1D;GAAOE,UAAU0D,qBAAqBb;EAAa;CAC1E,CAAC,CACH;CAEA,MAAMlC,UAAU/B,cAEZqE,gBAAgB;EACdnD,OAAOmD,aAAanD;EACpBE,UAAUiD,aAAajD;EACvBC,eACEW,SACEqC,aAAanD,KACf;CACJ,GACF,CAACmD,cAAcrC,QAAQ,CACzB;CAKA,OAAO,CAFLmC,oBAAoBpB,KAAAA,IAAYjB,OAAOL,eAAe0C,iBAEzC;EAAEzC;EAAIK;EAAS,GAAGqC;CAAQ,CAAC;AAC5C;;;;;;;;;;;;;;;;;;;AAoBA,MAAaa,2BAyBTrD"}
1
+ {"version":3,"file":"useInteractable.js","names":["useEffect","useId","useMemo","useRef","useAui","useAuiState","Unstable_InteractableStateSchema","ToolCallMessagePartComponent","unstable_getInteractableVersions","getInteractableVersions","interactableToolName","unstable_useInteractableState","useInteractableState","useJSONEqual","Unstable_InferInteractableState","TSchema","types","output","TOutput","Unstable_InteractableVersionInfo","state","TState","isLatest","restore","Unstable_InteractableConfig","description","stateSchema","initialState","id","updateRender","useInteractable","name","config","version","setState","updater","prev","isPending","error","flush","Promise","aui","autoId","replace","updateToolName","part","s","p","optional","type","undefined","inferredId","toolName","result","Record","args","success","internalScope","stateSchemaRef","current","initialStateRef","interactables","unstable_interactables","register","scope","Parameters","myToolCallId","toolCallId","registeredState","methods","versionValue","versions","thread","messages","some","v","origin","mine","find","latestToolCallId","findLast","const","unstable_useInteractable"],"sources":["../../../src/react/model-context/useInteractable.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useMemo, useRef } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport type { Unstable_InteractableStateSchema } from \"../types/scopes/interactables\";\nimport type { ToolCallMessagePartComponent } from \"../types/MessagePartComponentTypes\";\nimport {\n unstable_getInteractableVersions as getInteractableVersions,\n interactableToolName,\n} from \"../../model-context/interactable-composer-metadata\";\nimport { unstable_useInteractableState as useInteractableState } from \"./useInteractableState\";\nimport { useJSONEqual } from \"../utils/useJSONEqual\";\n\n/**\n * The state type described by an interactable's `stateSchema`. Resolves the\n * output type of a StandardSchemaV1 schema (e.g. Zod); plain JSON Schema\n * falls back to `unknown`.\n */\nexport type Unstable_InferInteractableState<TSchema> = TSchema extends {\n \"~standard\": { types?: { output: infer TOutput } | undefined };\n}\n ? TOutput\n : unknown;\n\n/**\n * One message's version of an interactable, for components rendered inside\n * tool-call parts. Show `state` to display history; call `restore()` to set\n * the live instance back to it.\n */\nexport type Unstable_InteractableVersionInfo<TState> = {\n /** The interactable's state as it was at this message. */\n state: TState;\n /** Whether this message holds the instance's most recent tool-driven version. */\n isLatest: boolean;\n /** Sets the live state back to this version. */\n restore: () => void;\n};\n\n/**\n * Unstable / Experimental — the interactables API is still evolving and may change in any release.\n * @deprecated Unstable / Experimental (not actually removed).\n */\nexport type Unstable_InteractableConfig<\n TSchema extends Unstable_InteractableStateSchema,\n> = {\n description: string;\n stateSchema: TSchema;\n initialState: Unstable_InferInteractableState<TSchema>;\n /** Unique instance ID; required to address this instance when multiple interactables share a name. Auto-generated if omitted. */\n id?: string | undefined;\n /**\n * Component installed as the tool UI for this interactable's `update_{name}`\n * tool calls, so a model edit re-renders the interactable at the message\n * that made it instead of only mutating an earlier one. Prefer\n * `unstable_interactableTool`, which wires this up. Pass a stable component reference;\n * changing identity re-registers the tool UI.\n */\n updateRender?: ToolCallMessagePartComponent | undefined;\n};\n\nconst useInteractable = <TSchema extends Unstable_InteractableStateSchema>(\n name: string,\n config: Unstable_InteractableConfig<TSchema>,\n): readonly [\n Unstable_InferInteractableState<TSchema>,\n {\n id: string;\n /**\n * This message's version of the instance, when rendered inside a\n * tool-created interactable message part; `undefined` elsewhere.\n */\n version:\n | Unstable_InteractableVersionInfo<\n Unstable_InferInteractableState<TSchema>\n >\n | undefined;\n setState: (\n updater:\n | Unstable_InferInteractableState<TSchema>\n | ((\n prev: Unstable_InferInteractableState<TSchema>,\n ) => Unstable_InferInteractableState<TSchema>),\n ) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] => {\n const aui = useAui();\n\n const autoId = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n\n const updateToolName = interactableToolName(name);\n const part = useAuiState((s) => {\n const p = s.optional.part;\n return p?.type === \"tool-call\" ? p : undefined;\n });\n\n // Inside an update_{name} part, the instance id comes from the call itself:\n // the result's resolved id (covers id-less calls), or the id argument.\n let inferredId: string | undefined;\n if (part?.toolName === updateToolName) {\n const result = part.result as Record<string, unknown> | undefined;\n const args = part.args as Record<string, unknown> | undefined;\n if (result?.success !== false) {\n if (typeof result?.id === \"string\") inferredId = result.id;\n else if (typeof args?.id === \"string\") inferredId = args.id;\n }\n }\n\n const id = config.id ?? inferredId ?? autoId;\n const internalScope =\n part?.toolName === name || part?.toolName === updateToolName\n ? \"thread\"\n : undefined;\n\n const stateSchemaRef = useRef(config.stateSchema);\n stateSchemaRef.current = config.stateSchema;\n const initialStateRef = useRef(config.initialState);\n initialStateRef.current = config.initialState;\n\n const interactables = useAuiState(() => aui.unstable_interactables);\n\n useEffect(() => {\n return interactables.register({\n id,\n name,\n description: config.description,\n stateSchema: stateSchemaRef.current,\n initialState: initialStateRef.current,\n updateRender: config.updateRender,\n ...(internalScope ? { scope: internalScope } : {}),\n } as Parameters<typeof interactables.register>[0] & {\n scope?: \"thread\" | undefined;\n });\n }, [\n interactables,\n id,\n name,\n config.description,\n internalScope,\n config.updateRender,\n ]);\n\n const myToolCallId = part?.toolCallId;\n\n const [registeredState, methods] =\n useInteractableState<Unstable_InferInteractableState<TSchema>>(id);\n const { setState } = methods;\n\n const versionValue = useAuiState(\n useJSONEqual((s) => {\n if (!internalScope || !myToolCallId) return undefined;\n const versions = getInteractableVersions(s.thread.messages, id, name);\n if (!versions.some((v) => v.origin === \"create\" && v.toolCallId === id)) {\n return undefined;\n }\n const mine = versions.find((v) => v.toolCallId === myToolCallId);\n if (!mine) return undefined;\n const latestToolCallId = versions.findLast(\n (v) => v.toolCallId !== undefined,\n )?.toolCallId;\n return { state: mine.state, isLatest: latestToolCallId === myToolCallId };\n }),\n );\n\n const version = useMemo(\n () =>\n versionValue && {\n state: versionValue.state as Unstable_InferInteractableState<TSchema>,\n isLatest: versionValue.isLatest,\n restore: () =>\n setState(\n versionValue.state as Unstable_InferInteractableState<TSchema>,\n ),\n },\n [versionValue, setState],\n );\n\n const state =\n registeredState === undefined ? config.initialState : registeredState;\n\n return [state, { id, version, ...methods }] as const;\n};\n\n/**\n * Registers an interactable with the AI assistant and returns its live state,\n * like `useState` that the model can also read and update.\n *\n * Call this once per place that shows the interactable. Other components can\n * read and write the same instance by passing its `id` to\n * `unstable_useInteractableState`.\n *\n * For tool-created interactables rendered inside tool-call message parts,\n * `version` carries this message's version of the instance — its state as of\n * that point in the conversation, whether it is the most recent tool-driven\n * version, and a `restore()` back to it. Whether older messages render frozen history or stay\n * live-editable is the component's choice. Inside an `update_{name}` part the\n * instance `id` is inferred from the call, so the same component works at the\n * creating call and at update calls.\n *\n * @deprecated Unstable / Experimental (not actually removed).\n */\nexport const unstable_useInteractable: <\n TSchema extends Unstable_InteractableStateSchema,\n>(\n name: string,\n config: Unstable_InteractableConfig<TSchema>,\n) => readonly [\n Unstable_InferInteractableState<TSchema>,\n {\n id: string;\n version:\n | Unstable_InteractableVersionInfo<\n Unstable_InferInteractableState<TSchema>\n >\n | undefined;\n setState: (\n updater:\n | Unstable_InferInteractableState<TSchema>\n | ((\n prev: Unstable_InferInteractableState<TSchema>,\n ) => Unstable_InferInteractableState<TSchema>),\n ) => void;\n isPending: boolean;\n error: unknown;\n flush: () => Promise<void>;\n },\n] = useInteractable;\n"],"mappings":";;;;;;;AA4DA,MAAM8B,mBACJC,MACAC,WAyBG;CACH,MAAMS,MAAMrC,OAAO;CAEnB,MAAMsC,SAASzC,MAAM,CAAC,CAAC0C,QAAQ,iBAAiB,EAAE;CAElD,MAAMC,iBAAiBlC,qBAAqBqB,IAAI;CAChD,MAAMc,OAAOxC,aAAayC,MAAM;EAC9B,MAAMC,IAAID,EAAEE,SAASH;EACrB,OAAOE,GAAGE,SAAS,cAAcF,IAAIG,KAAAA;CACvC,CAAC;CAID,IAAIC;CACJ,IAAIN,MAAMO,aAAaR,gBAAgB;EACrC,MAAMS,SAASR,KAAKQ;EACpB,MAAME,OAAOV,KAAKU;EAClB,IAAIF,QAAQG,YAAY,OAClB;OAAA,OAAOH,QAAQzB,OAAO,UAAUuB,aAAaE,OAAOzB;QACnD,IAAI,OAAO2B,MAAM3B,OAAO,UAAUuB,aAAaI,KAAK3B;EAAAA;CAE7D;CAEA,MAAMA,KAAKI,OAAOJ,MAAMuB,cAAcT;CACtC,MAAMe,gBACJZ,MAAMO,aAAarB,QAAQc,MAAMO,aAAaR,iBAC1C,WACAM,KAAAA;CAEN,MAAMQ,iBAAiBvD,OAAO6B,OAAON,WAAW;CAChDgC,eAAeC,UAAU3B,OAAON;CAChC,MAAMkC,kBAAkBzD,OAAO6B,OAAOL,YAAY;CAClDiC,gBAAgBD,UAAU3B,OAAOL;CAEjC,MAAMkC,gBAAgBxD,kBAAkBoC,IAAIqB,sBAAsB;CAElE9D,gBAAgB;EACd,OAAO6D,cAAcE,SAAS;GAC5BnC;GACAG;GACAN,aAAaO,OAAOP;GACpBC,aAAagC,eAAeC;GAC5BhC,cAAciC,gBAAgBD;GAC9B9B,cAAcG,OAAOH;GACrB,GAAI4B,gBAAgB,EAAEO,OAAOP,cAAc,IAAI,CAAC;EAClD,CAEC;CACH,GAAG;EACDI;EACAjC;EACAG;EACAC,OAAOP;EACPgC;EACAzB,OAAOH;CAAY,CACpB;CAED,MAAMqC,eAAerB,MAAMsB;CAE3B,MAAM,CAACC,iBAAiBC,WACtBzD,8BAA+DgB,EAAE;CACnE,MAAM,EAAEM,aAAamC;CAErB,MAAMC,eAAejE,YACnBQ,cAAciC,QAAM;EAClB,IAAI,CAACW,iBAAiB,CAACS,cAAc,OAAOhB,KAAAA;EAC5C,MAAMqB,WAAW9D,iCAAwBqC,IAAE0B,OAAOC,UAAU7C,IAAIG,IAAI;EACpE,IAAI,CAACwC,SAASG,MAAMC,MAAMA,EAAEC,WAAW,YAAYD,EAAER,eAAevC,EAAE,GACpE;EAEF,MAAMiD,OAAON,SAASO,MAAMH,QAAMA,IAAER,eAAeD,YAAY;EAC/D,IAAI,CAACW,MAAM,OAAO3B,KAAAA;EAClB,MAAM6B,mBAAmBR,SAASS,UAC/BL,QAAMA,IAAER,eAAejB,KAAAA,CAC1B,CAAC,EAAEiB;EACH,OAAO;GAAE/C,OAAOyD,KAAKzD;GAAOE,UAAUyD,qBAAqBb;EAAa;CAC1E,CAAC,CACH;CAEA,MAAMjC,UAAU/B,cAEZoE,gBAAgB;EACdlD,OAAOkD,aAAalD;EACpBE,UAAUgD,aAAahD;EACvBC,eACEW,SACEoC,aAAalD,KACf;CACJ,GACF,CAACkD,cAAcpC,QAAQ,CACzB;CAKA,OAAO,CAFLkC,oBAAoBlB,KAAAA,IAAYlB,OAAOL,eAAeyC,iBAEzC;EAAExC;EAAIK;EAAS,GAAGoC;CAAQ,CAAC;AAC5C;;;;;;;;;;;;;;;;;;;AAoBA,MAAaa,2BAyBTpD"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { useAui, useAuiState } from "@assistant-ui/store";
3
- import "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import "@assistant-ui/tap/react-shim";
4
+ import { useAui, useAuiState } from "@assistant-ui/store";
5
5
  //#region src/react/model-context/useInteractableState.ts
6
6
  const useInteractableState = (id) => {
7
7
  const $ = c(17);
@@ -1,9 +1,9 @@
1
1
  import { unstable_getInteractableVersions } from "../../model-context/interactable-composer-metadata.js";
2
2
  import { unstable_useInteractableState } from "./useInteractableState.js";
3
3
  import { useJSONEqual } from "../utils/useJSONEqual.js";
4
- import { useAuiState } from "@assistant-ui/store";
5
- import "@assistant-ui/tap/react-shim";
6
4
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
5
+ import "@assistant-ui/tap/react-shim";
6
+ import { useAuiState } from "@assistant-ui/store";
7
7
  //#region src/react/model-context/useInteractableVersions.ts
8
8
  const useInteractableVersions = (id, name) => {
9
9
  const $ = c(8);
@@ -1,7 +1,7 @@
1
1
  import { getPartialJsonObjectFieldState, getPartialJsonObjectMeta } from "assistant-stream/utils";
2
- import { useAuiState } from "@assistant-ui/store";
3
- import "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import "@assistant-ui/tap/react-shim";
4
+ import { useAuiState } from "@assistant-ui/store";
5
5
  //#region src/react/model-context/useToolArgsStatus.ts
6
6
  /**
7
7
  * Reads whether each argument field for the current tool-call message part is
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarCopy.ts
5
5
  const useActionBarCopy = (t0) => {
6
6
  const $ = c(12);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarEdit.ts
5
5
  const useActionBarEdit = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarFeedback.ts
5
5
  const useActionBarFeedbackPositive = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarReload.ts
5
5
  const useActionBarReload = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarSpeak.ts
5
5
  const useActionBarSpeak = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useActionBarStopSpeaking.ts
5
5
  const useActionBarStopSpeaking = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useBranchPickerNext.ts
5
5
  const useBranchPickerNext = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useBranchPickerPrevious.ts
5
5
  const useBranchPickerPrevious = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useComposerAddAttachment.ts
5
5
  const useComposerAddAttachment = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useComposerCancel.ts
5
5
  const useComposerCancel = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useComposerDictate.ts
5
5
  const useComposerDictate = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useComposerSend.ts
5
5
  const useComposerSend = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useEditComposerCancel.ts
5
5
  const useEditComposerCancel = () => {
6
6
  const $ = c(4);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useEditComposerSend.ts
5
5
  const useEditComposerSend = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useMessageBranching.ts
5
5
  const useMessageBranching = () => {
6
6
  const $ = c(9);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useMessageReload.ts
5
5
  const useMessageReload = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useSuggestionTrigger.ts
5
5
  const useSuggestionTrigger = (t0) => {
6
6
  const $ = c(8);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListItemArchive.ts
5
5
  const useThreadListItemArchive = () => {
6
6
  const $ = c(4);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListItemDelete.ts
5
5
  const useThreadListItemDelete = () => {
6
6
  const $ = c(4);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListItemTrigger.ts
5
5
  const useThreadListItemTrigger = () => {
6
6
  const $ = c(4);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListItemUnarchive.ts
5
5
  const useThreadListItemUnarchive = () => {
6
6
  const $ = c(4);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListLoadMore.ts
5
5
  const useThreadListLoadMore = () => {
6
6
  const $ = c(5);
@@ -1,6 +1,6 @@
1
- import { useAui } from "@assistant-ui/store";
2
- import "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import "@assistant-ui/tap/react-shim";
3
+ import { useAui } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useThreadListNew.ts
5
5
  const useThreadListNew = () => {
6
6
  const $ = c(4);
@@ -1,5 +1,5 @@
1
- import { useAuiState } from "@assistant-ui/store";
2
1
  import { useRef } from "@assistant-ui/tap/react-shim";
2
+ import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/react/primitive-hooks/useThreadMessageIds.ts
4
4
  const useThreadMessageIds = () => {
5
5
  const messages = useAuiState((s) => s.thread.messages);
@@ -1,6 +1,6 @@
1
- import { useAui, useAuiState } from "@assistant-ui/store";
2
- import { useSyncExternalStore } from "@assistant-ui/tap/react-shim";
3
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { useSyncExternalStore } from "@assistant-ui/tap/react-shim";
3
+ import { useAui, useAuiState } from "@assistant-ui/store";
4
4
  //#region src/react/primitive-hooks/useVoice.ts
5
5
  const useVoiceState = () => {
6
6
  return useAuiState(_temp);
@@ -1,8 +1,8 @@
1
1
  import { ChainOfThoughtPartByIndexProvider } from "../../providers/ChainOfThoughtPartByIndexProvider.js";
2
2
  import { MessagePartComponent } from "../message/MessageParts.js";
3
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
4
- import { useMemo } from "@assistant-ui/tap/react-shim";
5
3
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
4
+ import { useMemo } from "@assistant-ui/tap/react-shim";
5
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/react/primitives/chainOfThought/ChainOfThoughtParts.tsx
8
8
  const ChainOfThoughtPrimitivePartsInner = ({ children }) => {
@@ -1,7 +1,7 @@
1
1
  import { ComposerAttachmentByIndexProvider } from "../../providers/AttachmentByIndexProvider.js";
2
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
3
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/composer/ComposerAttachments.tsx
7
7
  const getComponent = (components, attachment) => {
@@ -1,5 +1,5 @@
1
- import { useAuiState } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { useAuiState } from "@assistant-ui/store";
3
3
  //#region src/react/primitives/composer/ComposerIf.tsx
4
4
  const useComposerIf = (props) => {
5
5
  const $ = c(3);
@@ -1,6 +1,6 @@
1
1
  import { QueueItemByIndexProvider } from "../../providers/QueueItemByIndexProvider.js";
2
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
3
2
  import { memo, useMemo } from "@assistant-ui/tap/react-shim";
3
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/primitives/composer/ComposerQueue.tsx
6
6
  const ComposerPrimitiveQueueInner = ({ children }) => {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { useAuiState } from "@assistant-ui/store";
3
- import { createElement } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { createElement } from "@assistant-ui/tap/react-shim";
4
+ import { useAuiState } from "@assistant-ui/store";
5
5
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/generativeUI/GenerativeUI.tsx
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { MessageAttachmentByIndexProvider } from "../../providers/AttachmentByIndexProvider.js";
2
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
3
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/message/MessageAttachments.tsx
7
7
  const getComponent = (components, attachment) => {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { MessagePartChildren } from "./MessageParts.js";
3
3
  import { GROUPBY_MEMO_KEY, buildGroupTree } from "../../utils/groupParts.js";
4
- import { useAuiState } from "@assistant-ui/store";
5
4
  import { Fragment, useMemo } from "@assistant-ui/tap/react-shim";
5
+ import { useAuiState } from "@assistant-ui/store";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useShallow } from "zustand/shallow";
8
8
  //#region src/react/primitives/message/MessageGroupedParts.tsx
@@ -4,9 +4,9 @@ import { TextMessagePartProvider } from "../../providers/TextMessagePartProvider
4
4
  import { ChainOfThoughtByIndicesProvider } from "../../providers/ChainOfThoughtByIndicesProvider.js";
5
5
  import { getMessageQuote } from "../../utils/getMessageQuote.js";
6
6
  import { GenerativeUIRender } from "../generativeUI/GenerativeUI.js";
7
- import { RenderChildrenWithAccessor, useAui, useAuiState } from "@assistant-ui/store";
8
- import { memo } from "@assistant-ui/tap/react-shim";
9
7
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
8
+ import { memo } from "@assistant-ui/tap/react-shim";
9
+ import { RenderChildrenWithAccessor, useAui, useAuiState } from "@assistant-ui/store";
10
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { useShallow } from "zustand/shallow";
12
12
  //#region src/react/primitives/message/MessageParts.tsx
@@ -1,7 +1,7 @@
1
1
  import { getMessageQuote } from "../../utils/getMessageQuote.js";
2
- import { useAuiState } from "@assistant-ui/store";
3
- import { memo } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { memo } from "@assistant-ui/tap/react-shim";
4
+ import { useAuiState } from "@assistant-ui/store";
5
5
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/message/MessageQuote.tsx
7
7
  /**
@@ -1,8 +1,8 @@
1
1
  import { ReadonlyThreadProvider } from "../../providers/ReadonlyThreadProvider.js";
2
2
  import { ThreadPrimitiveMessagesImpl } from "../thread/ThreadMessages.js";
3
- import { useAuiState } from "@assistant-ui/store";
4
- import { memo } from "@assistant-ui/tap/react-shim";
5
3
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
4
+ import { memo } from "@assistant-ui/tap/react-shim";
5
+ import { useAuiState } from "@assistant-ui/store";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/react/primitives/part/PartMessages.tsx
8
8
  const usePartMessages = () => {
@@ -1,8 +1,8 @@
1
1
  import { MessageByIndexProvider } from "../../providers/MessageByIndexProvider.js";
2
2
  import { MessageByIdProvider } from "../../providers/MessageByIdProvider.js";
3
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
4
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
5
3
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
4
+ import { memo, useMemo } from "@assistant-ui/tap/react-shim";
5
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/react/primitives/thread/ThreadMessages.tsx
8
8
  const isComponentsSame = (prev, next) => {
@@ -1,7 +1,7 @@
1
1
  import { SuggestionByIndexProvider } from "../../providers/SuggestionByIndexProvider.js";
2
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
3
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/thread/ThreadSuggestions.tsx
7
7
  const SuggestionComponent = (t0) => {
@@ -1,7 +1,7 @@
1
1
  import { ThreadListItemByIndexProvider } from "../../providers/ThreadListItemByIndexProvider.js";
2
- import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
3
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { memo, useMemo } from "@assistant-ui/tap/react-shim";
4
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/primitives/threadList/ThreadListItems.tsx
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { useAuiState } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { useAuiState } from "@assistant-ui/store";
3
3
  import { Fragment, jsx } from "react/jsx-runtime";
4
4
  //#region src/react/primitives/threadListItem/ThreadListItemTitle.tsx
5
5
  const ThreadListItemPrimitiveTitle = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/AttachmentByIndexProvider.tsx
5
5
  const MessageAttachmentByIndexProvider = (t0) => {
@@ -1,6 +1,6 @@
1
1
  import { ChainOfThoughtClient } from "../../store/clients/chain-of-thought-client.js";
2
- import { AuiProvider, useAui, useAuiState } from "@assistant-ui/store";
3
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { AuiProvider, useAui, useAuiState } from "@assistant-ui/store";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/providers/ChainOfThoughtByIndicesProvider.tsx
6
6
  const ChainOfThoughtByIndicesProvider = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/ChainOfThoughtPartByIndexProvider.tsx
5
5
  const ChainOfThoughtPartByIndexProvider = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/MessageByIdProvider.tsx
5
5
  const MessageByIdProvider = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/MessageByIndexProvider.tsx
5
5
  const MessageByIndexProvider = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/PartByIndexProvider.tsx
5
5
  const PartByIndexProvider = (t0) => {
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/QueueItemByIndexProvider.tsx
5
5
  const QueueItemByIndexProvider = (t0) => {
@@ -1,9 +1,9 @@
1
1
  import { ThreadRuntimeImpl } from "../../runtime/api/thread-runtime.js";
2
2
  import { ReadonlyThreadRuntimeCore } from "../../runtimes/readonly/ReadonlyThreadRuntimeCore.js";
3
3
  import { ThreadClient } from "../../store/runtime-clients/thread-runtime-client.js";
4
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
5
- import { useEffect, useState } from "@assistant-ui/tap/react-shim";
6
4
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
5
+ import { useEffect, useState } from "@assistant-ui/tap/react-shim";
6
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  //#region src/react/providers/ReadonlyThreadProvider.tsx
9
9
  const READONLY_THREAD_PATH = Object.freeze({
@@ -1,5 +1,5 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
1
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
+ import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/react/providers/SuggestionByIndexProvider.tsx
5
5
  const SuggestionByIndexProvider = (t0) => {