@assistant-ui/core 0.2.17 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/dist/adapters/thread-history.d.ts +2 -0
  2. package/dist/adapters/thread-history.d.ts.map +1 -1
  3. package/dist/index.d.ts +4 -2
  4. package/dist/index.js +3 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal.d.ts +2 -1
  7. package/dist/internal.js +2 -1
  8. package/dist/model-context/interactable-composer-metadata.d.ts +105 -0
  9. package/dist/model-context/interactable-composer-metadata.d.ts.map +1 -0
  10. package/dist/model-context/interactable-composer-metadata.js +259 -0
  11. package/dist/model-context/interactable-composer-metadata.js.map +1 -0
  12. package/dist/model-context/registry.d.ts.map +1 -1
  13. package/dist/model-context/registry.js +1 -0
  14. package/dist/model-context/registry.js.map +1 -1
  15. package/dist/model-context/types.d.ts +6 -0
  16. package/dist/model-context/types.d.ts.map +1 -1
  17. package/dist/model-context/types.js +4 -0
  18. package/dist/model-context/types.js.map +1 -1
  19. package/dist/react/AssistantProvider.d.ts +1 -1
  20. package/dist/react/AssistantProvider.js +1 -1
  21. package/dist/react/AssistantRuntimeProvider.d.ts +1 -1
  22. package/dist/react/RuntimeAdapter.js +1 -1
  23. package/dist/react/client/Interactables.d.ts +8 -2
  24. package/dist/react/client/Interactables.d.ts.map +1 -1
  25. package/dist/react/client/Interactables.js +190 -94
  26. package/dist/react/client/Interactables.js.map +1 -1
  27. package/dist/react/client/Tools.js +1 -1
  28. package/dist/react/client/interactable-model-context.d.ts +9 -6
  29. package/dist/react/client/interactable-model-context.d.ts.map +1 -1
  30. package/dist/react/client/interactable-model-context.js +154 -32
  31. package/dist/react/client/interactable-model-context.js.map +1 -1
  32. package/dist/react/index.d.ts +15 -6
  33. package/dist/react/index.js +12 -5
  34. package/dist/react/interactables-legacy/Interactables.d.ts +12 -0
  35. package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -0
  36. package/dist/react/interactables-legacy/Interactables.js +264 -0
  37. package/dist/react/interactables-legacy/Interactables.js.map +1 -0
  38. package/dist/react/interactables-legacy/interactable-model-context.d.ts +12 -0
  39. package/dist/react/interactables-legacy/interactable-model-context.d.ts.map +1 -0
  40. package/dist/react/interactables-legacy/interactable-model-context.js +54 -0
  41. package/dist/react/interactables-legacy/interactable-model-context.js.map +1 -0
  42. package/dist/react/interactables-legacy/scopes.d.ts +58 -0
  43. package/dist/react/interactables-legacy/scopes.d.ts.map +1 -0
  44. package/dist/react/interactables-legacy/scopes.js +0 -0
  45. package/dist/react/interactables-legacy/useAssistantInteractable.d.ts +31 -0
  46. package/dist/react/interactables-legacy/useAssistantInteractable.d.ts.map +1 -0
  47. package/dist/react/{model-context → interactables-legacy}/useAssistantInteractable.js +6 -2
  48. package/dist/react/interactables-legacy/useAssistantInteractable.js.map +1 -0
  49. package/dist/react/interactables-legacy/useInteractableState.d.ts +21 -0
  50. package/dist/react/interactables-legacy/useInteractableState.d.ts.map +1 -0
  51. package/dist/react/interactables-legacy/useInteractableState.js +84 -0
  52. package/dist/react/interactables-legacy/useInteractableState.js.map +1 -0
  53. package/dist/react/model-context/interactableTool.d.ts +53 -0
  54. package/dist/react/model-context/interactableTool.d.ts.map +1 -0
  55. package/dist/react/model-context/interactableTool.js +188 -0
  56. package/dist/react/model-context/interactableTool.js.map +1 -0
  57. package/dist/react/model-context/useAssistantContext.js +1 -1
  58. package/dist/react/model-context/useAssistantDataUI.js +1 -1
  59. package/dist/react/model-context/useAssistantInstructions.js +1 -1
  60. package/dist/react/model-context/useAssistantTool.js +1 -1
  61. package/dist/react/model-context/useAssistantToolUI.js +1 -1
  62. package/dist/react/model-context/useAuiToolOverrides.js +1 -1
  63. package/dist/react/model-context/useInteractable.d.ts +73 -0
  64. package/dist/react/model-context/useInteractable.d.ts.map +1 -0
  65. package/dist/react/model-context/useInteractable.js +100 -0
  66. package/dist/react/model-context/useInteractable.js.map +1 -0
  67. package/dist/react/model-context/useInteractableState.d.ts +8 -5
  68. package/dist/react/model-context/useInteractableState.d.ts.map +1 -1
  69. package/dist/react/model-context/useInteractableState.js +48 -48
  70. package/dist/react/model-context/useInteractableState.js.map +1 -1
  71. package/dist/react/model-context/useInteractableVersions.d.ts +19 -0
  72. package/dist/react/model-context/useInteractableVersions.d.ts.map +1 -0
  73. package/dist/react/model-context/useInteractableVersions.js +51 -0
  74. package/dist/react/model-context/useInteractableVersions.js.map +1 -0
  75. package/dist/react/primitive-hooks/useThreadMessageIds.d.ts +15 -0
  76. package/dist/react/primitive-hooks/useThreadMessageIds.d.ts.map +1 -0
  77. package/dist/react/primitive-hooks/useThreadMessageIds.js +26 -0
  78. package/dist/react/primitive-hooks/useThreadMessageIds.js.map +1 -0
  79. package/dist/react/primitive-hooks/useVoice.js +1 -1
  80. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +1 -1
  81. package/dist/react/primitives/composer/ComposerAttachments.js +1 -1
  82. package/dist/react/primitives/composer/ComposerQueue.js +1 -1
  83. package/dist/react/primitives/generativeUI/GenerativeUI.js +1 -1
  84. package/dist/react/primitives/message/MessageAttachments.js +1 -1
  85. package/dist/react/primitives/message/MessageGroupedParts.js +1 -1
  86. package/dist/react/primitives/message/MessageParts.js +1 -1
  87. package/dist/react/primitives/message/MessageQuote.js +1 -1
  88. package/dist/react/primitives/part/PartMessages.d.ts +5 -2
  89. package/dist/react/primitives/part/PartMessages.d.ts.map +1 -1
  90. package/dist/react/primitives/part/PartMessages.js +8 -8
  91. package/dist/react/primitives/part/PartMessages.js.map +1 -1
  92. package/dist/react/primitives/thread/ThreadMessages.d.ts +31 -1
  93. package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
  94. package/dist/react/primitives/thread/ThreadMessages.js +64 -2
  95. package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
  96. package/dist/react/primitives/thread/ThreadSuggestions.js +1 -1
  97. package/dist/react/primitives/threadList/ThreadListItems.js +1 -1
  98. package/dist/react/providers/MessageByIdProvider.d.ts +9 -0
  99. package/dist/react/providers/MessageByIdProvider.d.ts.map +1 -0
  100. package/dist/react/providers/MessageByIdProvider.js +57 -0
  101. package/dist/react/providers/MessageByIdProvider.js.map +1 -0
  102. package/dist/react/providers/ReadonlyThreadProvider.js +1 -1
  103. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +1 -1
  104. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +3 -0
  105. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  106. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +16 -1
  107. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  108. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +1 -1
  109. package/dist/react/runtimes/cloud/auiV0.js +1 -1
  110. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +1 -1
  111. package/dist/react/runtimes/createRuntimeExtras.d.ts +20 -0
  112. package/dist/react/runtimes/createRuntimeExtras.d.ts.map +1 -0
  113. package/dist/react/runtimes/createRuntimeExtras.js +43 -0
  114. package/dist/react/runtimes/createRuntimeExtras.js.map +1 -0
  115. package/dist/react/runtimes/useLocalRuntime.js +1 -1
  116. package/dist/react/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
  117. package/dist/react/runtimes/useRemoteThreadListRuntime.js +6 -2
  118. package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  119. package/dist/react/runtimes/useStreamingTiming.d.ts +26 -0
  120. package/dist/react/runtimes/useStreamingTiming.d.ts.map +1 -0
  121. package/dist/react/runtimes/useStreamingTiming.js +43 -0
  122. package/dist/react/runtimes/useStreamingTiming.js.map +1 -0
  123. package/dist/react/types/scopes/interactables.d.ts +40 -24
  124. package/dist/react/types/scopes/interactables.d.ts.map +1 -1
  125. package/dist/react/types/store-augmentation.d.ts +3 -1
  126. package/dist/react/types/store-augmentation.d.ts.map +1 -1
  127. package/dist/react/utils/useJSONEqual.d.ts +11 -0
  128. package/dist/react/utils/useJSONEqual.d.ts.map +1 -0
  129. package/dist/react/utils/useJSONEqual.js +30 -0
  130. package/dist/react/utils/useJSONEqual.js.map +1 -0
  131. package/dist/runtime/base/base-composer-runtime-core.d.ts +5 -0
  132. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  133. package/dist/runtime/base/base-composer-runtime-core.js +13 -0
  134. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  135. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
  136. package/dist/runtime/base/default-edit-composer-runtime-core.js +6 -1
  137. package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
  138. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  139. package/dist/runtime/base/default-thread-composer-runtime-core.js +4 -1
  140. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  141. package/dist/runtime/utils/message-repository.d.ts +1 -0
  142. package/dist/runtime/utils/message-repository.d.ts.map +1 -1
  143. package/dist/runtime/utils/message-repository.js +6 -3
  144. package/dist/runtime/utils/message-repository.js.map +1 -1
  145. package/dist/runtime/utils/streaming-timing.d.ts +59 -0
  146. package/dist/runtime/utils/streaming-timing.d.ts.map +1 -0
  147. package/dist/runtime/utils/streaming-timing.js +76 -0
  148. package/dist/runtime/utils/streaming-timing.js.map +1 -0
  149. package/dist/runtime/utils/thread-message-like.d.ts +3 -0
  150. package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
  151. package/dist/runtime/utils/thread-message-like.js +5 -1
  152. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  153. package/dist/runtimes/external-store/external-store-adapter.d.ts +26 -1
  154. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  155. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +9 -0
  156. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  157. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +19 -0
  158. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  159. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  160. package/dist/runtimes/local/local-thread-runtime-core.js +1 -1
  161. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  162. package/dist/runtimes/remote-thread-list/types.d.ts +12 -0
  163. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  164. package/dist/store/clients/suggestions.js +1 -1
  165. package/dist/store/clients/thread-message-client.js +1 -1
  166. package/dist/store/runtime-clients/composer-runtime-client.js +1 -1
  167. package/dist/store/runtime-clients/message-runtime-client.js +1 -1
  168. package/dist/store/runtime-clients/thread-list-item-runtime-client.js +1 -1
  169. package/dist/store/runtime-clients/thread-runtime-client.js +1 -1
  170. package/dist/tests/remote-thread-list-test-helpers.d.ts +1 -1
  171. package/dist/tests/remote-thread-list-test-helpers.d.ts.map +1 -1
  172. package/dist/tests/remote-thread-list-test-helpers.js +3 -2
  173. package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
  174. package/dist/utils/id.d.ts +3 -0
  175. package/dist/utils/id.d.ts.map +1 -1
  176. package/dist/utils/id.js +3 -0
  177. package/dist/utils/id.js.map +1 -1
  178. package/package.json +9 -9
  179. package/src/adapters/thread-history.ts +7 -1
  180. package/src/index.ts +17 -0
  181. package/src/internal.ts +7 -0
  182. package/src/model-context/interactable-composer-metadata.test.ts +550 -0
  183. package/src/model-context/interactable-composer-metadata.ts +395 -0
  184. package/src/model-context/registry.ts +5 -0
  185. package/src/model-context/types.ts +12 -0
  186. package/src/react/client/Interactables.test.ts +358 -0
  187. package/src/react/client/Interactables.ts +339 -86
  188. package/src/react/client/interactable-model-context.test.ts +418 -0
  189. package/src/react/client/interactable-model-context.ts +252 -58
  190. package/src/react/index.ts +72 -3
  191. package/src/react/interactables-legacy/Interactables.ts +332 -0
  192. package/src/react/interactables-legacy/interactable-model-context.test.ts +54 -0
  193. package/src/react/interactables-legacy/interactable-model-context.ts +80 -0
  194. package/src/react/interactables-legacy/scopes.ts +66 -0
  195. package/src/react/{model-context → interactables-legacy}/useAssistantInteractable.ts +10 -1
  196. package/src/react/interactables-legacy/useInteractableState.ts +67 -0
  197. package/src/react/model-context/interactableTool.tsx +175 -0
  198. package/src/react/model-context/useInteractable.ts +233 -0
  199. package/src/react/model-context/useInteractableState.ts +31 -23
  200. package/src/react/model-context/useInteractableVersions.ts +48 -0
  201. package/src/react/primitive-hooks/useThreadMessageIds.ts +27 -0
  202. package/src/react/primitives/part/PartMessages.test.tsx +17 -0
  203. package/src/react/primitives/part/PartMessages.tsx +13 -8
  204. package/src/react/primitives/thread/ThreadMessages.tsx +67 -0
  205. package/src/react/providers/MessageByIdProvider.tsx +23 -0
  206. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +21 -1
  207. package/src/react/runtimes/createRuntimeExtras.test.ts +58 -0
  208. package/src/react/runtimes/createRuntimeExtras.ts +68 -0
  209. package/src/react/runtimes/createRuntimeExtras.use.test.ts +50 -0
  210. package/src/react/runtimes/useRemoteThreadListRuntime.ts +13 -1
  211. package/src/react/runtimes/useStreamingTiming.ts +68 -0
  212. package/src/react/types/scopes/interactables.ts +45 -23
  213. package/src/react/types/store-augmentation.ts +4 -2
  214. package/src/react/utils/useJSONEqual.ts +20 -0
  215. package/src/runtime/base/base-composer-runtime-core.ts +13 -0
  216. package/src/runtime/base/default-edit-composer-runtime-core.ts +18 -1
  217. package/src/runtime/base/default-thread-composer-runtime-core.ts +11 -1
  218. package/src/runtime/utils/message-repository.ts +11 -7
  219. package/src/runtime/utils/streaming-timing.test.ts +301 -0
  220. package/src/runtime/utils/streaming-timing.ts +161 -0
  221. package/src/runtime/utils/thread-message-like.ts +5 -1
  222. package/src/runtimes/external-store/external-store-adapter.ts +28 -0
  223. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +33 -1
  224. package/src/runtimes/local/local-thread-runtime-core.ts +4 -1
  225. package/src/runtimes/remote-thread-list/types.ts +13 -0
  226. package/src/tests/MessageRepository.test.ts +2 -0
  227. package/src/tests/composer-can-send.test.ts +1 -0
  228. package/src/tests/default-edit-composer-runtime-core.test.ts +78 -1
  229. package/src/tests/default-thread-composer-runtime-core.test.ts +82 -0
  230. package/src/tests/external-store-thread-runtime-core.test.ts +337 -0
  231. package/src/tests/groupParts.test.ts +32 -0
  232. package/src/tests/remote-thread-list-reactive-threadId.test.ts +90 -0
  233. package/src/tests/remote-thread-list-test-helpers.ts +2 -1
  234. package/src/tests/thread-message-like.test.ts +50 -0
  235. package/src/utils/id.ts +3 -0
  236. package/dist/react/model-context/useAssistantInteractable.d.ts +0 -22
  237. package/dist/react/model-context/useAssistantInteractable.d.ts.map +0 -1
  238. package/dist/react/model-context/useAssistantInteractable.js.map +0 -1
@@ -1,12 +1,85 @@
1
+ import { isRecord } from "../../utils/json/is-json.js";
2
+ import { interactableToolName, shallowMergeInteractableState } from "../../model-context/interactable-composer-metadata.js";
3
+ import { generateId } from "../../utils/id.js";
1
4
  //#region src/react/client/interactable-model-context.ts
2
- function shallowMerge(prev, partial) {
3
- if (typeof prev !== "object" || prev === null || typeof partial !== "object" || partial === null || Array.isArray(prev) || Array.isArray(partial)) return partial;
5
+ const ID_PROPERTY = {
6
+ type: "string",
7
+ description: "The id of the instance to update, as shown in its state snapshot in the conversation."
8
+ };
9
+ const hasIdProperty = (schema) => {
10
+ const properties = schema.properties;
11
+ return isRecord(properties) && properties.id !== void 0;
12
+ };
13
+ const withRequiredItemId = (schema) => ({
14
+ ...schema,
15
+ required: ["id"]
16
+ });
17
+ const withoutItemId = (schema) => {
18
+ const { id: _omitted, ...properties } = isRecord(schema.properties) ? schema.properties : {};
19
+ const required = Array.isArray(schema.required) ? schema.required.filter((key) => key !== "id") : schema.required;
4
20
  return {
5
- ...prev,
6
- ...partial
21
+ ...schema,
22
+ properties,
23
+ required
24
+ };
25
+ };
26
+ const toArrayUpdateSchema = (schema, field) => {
27
+ if (!isRecord(schema) || schema.type !== "array") return schema;
28
+ const itemSchema = schema.items;
29
+ if (Array.isArray(itemSchema) || !isRecord(itemSchema)) return schema;
30
+ const idKeyed = hasIdProperty(itemSchema);
31
+ const properties = {
32
+ add: {
33
+ type: "array",
34
+ items: idKeyed ? withoutItemId(itemSchema) : itemSchema
35
+ },
36
+ remove: {
37
+ type: "array",
38
+ items: idKeyed ? ID_PROPERTY : itemSchema
39
+ },
40
+ clear: { type: "boolean" }
41
+ };
42
+ if (idKeyed) properties.update = {
43
+ type: "array",
44
+ items: withRequiredItemId(itemSchema)
45
+ };
46
+ return {
47
+ type: "object",
48
+ description: `Operations for array field "${field}". To change one item use update with its id; add new items (their ids are assigned for you), remove items by id, or clear to empty. Change only the items you mean to — never resend the whole array to edit one item.`,
49
+ properties,
50
+ additionalProperties: false
51
+ };
52
+ };
53
+ const idKeyedArrayFieldNames = (properties) => {
54
+ const names = /* @__PURE__ */ new Set();
55
+ for (const [key, value] of Object.entries(properties)) if (isRecord(value) && value.type === "array" && isRecord(value.items) && hasIdProperty(value.items)) names.add(key);
56
+ return names;
57
+ };
58
+ const withArrayUpdateSchemas = (properties) => Object.fromEntries(Object.entries(properties).map(([key, value]) => [key, toArrayUpdateSchema(value, key)]));
59
+ /**
60
+ * Wraps an interactable's partial state schema with the required `id`
61
+ * parameter. Falls back to a permissive schema when the partial conversion
62
+ * failed at registration time.
63
+ */
64
+ function withRequiredId(partial) {
65
+ if (!partial || typeof partial !== "object" || partial.type !== "object") return {
66
+ type: "object",
67
+ properties: { id: ID_PROPERTY },
68
+ required: ["id"],
69
+ additionalProperties: true
70
+ };
71
+ if (process.env.NODE_ENV !== "production" && partial.properties?.id) console.warn("[Interactables] a top-level \"id\" field in an interactable's stateSchema is reserved for instance addressing by the update tool and cannot be updated by the model. Rename the field to make it model-writable.");
72
+ const { id: _reserved, ...properties } = partial.properties ?? {};
73
+ return {
74
+ ...partial,
75
+ properties: {
76
+ id: ID_PROPERTY,
77
+ ...withArrayUpdateSchemas(properties)
78
+ },
79
+ required: ["id"]
7
80
  };
8
81
  }
9
- function buildInteractableModelContext(definitions, partialSchemaCache, setDefState) {
82
+ function buildInteractableModelContext(definitions, partialSchemaCache, setDefState, streamBaselines = /* @__PURE__ */ new Map()) {
10
83
  const entries = Object.values(definitions);
11
84
  if (entries.length === 0) return void 0;
12
85
  const byName = /* @__PURE__ */ new Map();
@@ -15,40 +88,89 @@ function buildInteractableModelContext(definitions, partialSchemaCache, setDefSt
15
88
  list.push(def);
16
89
  byName.set(def.name, list);
17
90
  }
18
- const systemParts = [];
19
91
  const tools = {};
20
92
  for (const [name, instances] of byName) {
21
- const isMulti = instances.length > 1;
22
- for (const def of instances) {
23
- const selectedTag = def.selected ? " (SELECTED)" : "";
24
- const idTag = isMulti ? ` [id="${def.id}"]` : "";
25
- systemParts.push(`Interactable component "${name}"${idTag}${selectedTag} (${def.description}). Current state: ${JSON.stringify(def.state)}`);
26
- const safeName = name.replace(/[^a-zA-Z0-9_-]/g, "_");
27
- const safeId = def.id.replace(/[^a-zA-Z0-9_-]/g, "_");
28
- const toolName = isMulti ? `update_${safeName}_${safeId}` : `update_${safeName}`;
29
- const partialSchema = partialSchemaCache.get(def.id) ?? def.stateSchema;
30
- tools[toolName] = {
31
- type: "frontend",
32
- description: `Update the state of interactable component "${name}"${isMulti ? ` (id: ${def.id})` : ""}. Only include the fields you want to change; omitted fields keep their current values. ${def.description}`,
33
- parameters: partialSchema,
34
- streamCall: async (reader) => {
35
- try {
36
- for await (const partialArgs of reader.args.streamValues()) setDefState(def.id, (prev) => shallowMerge(prev, partialArgs));
37
- } catch {}
38
- },
39
- execute: async (partialState) => {
40
- setDefState(def.id, (prev) => shallowMerge(prev, partialState));
41
- return { success: true };
42
- }
43
- };
93
+ const toolName = interactableToolName(name);
94
+ if (tools[toolName]) {
95
+ if (process.env.NODE_ENV !== "production") console.warn(`[Interactables] interactable names "${name}" and another registered name both sanitize to the tool name "${toolName}". Rename one of them.`);
96
+ continue;
44
97
  }
98
+ const first = instances[0];
99
+ const partialSchema = partialSchemaCache.get(first.id);
100
+ const idKeyedFields = partialSchema && isRecord(partialSchema.properties) ? idKeyedArrayFieldNames(partialSchema.properties) : /* @__PURE__ */ new Set();
101
+ const resolveTarget = (id) => {
102
+ if (typeof id === "string") {
103
+ const def = definitions[id];
104
+ return def?.name === name ? def : void 0;
105
+ }
106
+ return instances.length === 1 ? first : void 0;
107
+ };
108
+ tools[toolName] = {
109
+ type: "frontend",
110
+ description: `Update the state of interactable component "${name}". ${first.description} Pass the id of the instance to update — instance ids and current state appear in the conversation as state snapshots. Only include the fields you want to change; omitted fields keep their current values.`,
111
+ parameters: withRequiredId(partialSchema),
112
+ streamCall: async (reader, { toolCallId }) => {
113
+ try {
114
+ for await (const partialArgs of reader.args.streamValues()) {
115
+ if (!partialArgs || typeof partialArgs !== "object") continue;
116
+ const args = partialArgs;
117
+ const keys = Object.keys(args);
118
+ if (keys.indexOf("id") === keys.length - 1) continue;
119
+ const { id, ...partial } = args;
120
+ if (Object.keys(partial).length === 0) continue;
121
+ const target = resolveTarget(id);
122
+ if (!target) continue;
123
+ const baseline = streamBaselines.get(toolCallId);
124
+ const arrayBaseline = baseline?.targetId === target.id ? baseline.state : target.state;
125
+ if (!baseline || baseline.targetId !== target.id) streamBaselines.set(toolCallId, {
126
+ targetId: target.id,
127
+ state: target.state
128
+ });
129
+ setDefState(target.id, (prev) => shallowMergeInteractableState(prev, partial, { arrayBaseline }));
130
+ }
131
+ } catch {}
132
+ },
133
+ execute: async (args, { toolCallId }) => {
134
+ const { id, ...partial } = args ?? {};
135
+ const target = resolveTarget(id);
136
+ if (!target) {
137
+ const validIds = instances.map((d) => d.id);
138
+ return {
139
+ success: false,
140
+ error: `Unknown id ${JSON.stringify(id)} for interactable "${name}". Valid ids: ${validIds.join(", ")}`
141
+ };
142
+ }
143
+ const baseline = streamBaselines.get(toolCallId);
144
+ streamBaselines.delete(toolCallId);
145
+ const addedItemIds = {};
146
+ setDefState(target.id, (prev) => shallowMergeInteractableState(prev, partial, {
147
+ arrayBaseline: baseline?.targetId === target.id ? baseline.state : void 0,
148
+ idFactory: (field) => {
149
+ const itemId = generateId();
150
+ (addedItemIds[field] ??= []).push(itemId);
151
+ return itemId;
152
+ },
153
+ idKeyedFields
154
+ }));
155
+ const result = {
156
+ success: true,
157
+ id: target.id
158
+ };
159
+ if (Object.keys(addedItemIds).length > 0) result.addedItemIds = addedItemIds;
160
+ return result;
161
+ }
162
+ };
45
163
  }
46
164
  return {
47
- system: systemParts.join("\n"),
48
- tools
165
+ tools,
166
+ unstable_composerMetadata: { interactables: entries.map((def) => ({
167
+ id: def.id,
168
+ name: def.name,
169
+ state: def.state
170
+ })) }
49
171
  };
50
172
  }
51
173
  //#endregion
52
- export { buildInteractableModelContext, shallowMerge };
174
+ export { buildInteractableModelContext };
53
175
 
54
176
  //# sourceMappingURL=interactable-model-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactable-model-context.js","names":["Tool","InteractableDefinition","InteractableStateSchema","shallowMerge","prev","partial","Array","isArray","Record","buildInteractableModelContext","definitions","partialSchemaCache","Map","setDefState","id","updater","system","tools","entries","Object","values","length","undefined","byName","def","list","get","name","push","set","systemParts","instances","isMulti","selectedTag","selected","idTag","description","JSON","stringify","state","safeName","replace","safeId","toolName","partialSchema","stateSchema","type","const","parameters","streamCall","reader","partialArgs","args","streamValues","execute","partialState","success","join"],"sources":["../../../src/react/client/interactable-model-context.ts"],"sourcesContent":["import type { Tool } from \"assistant-stream\";\nimport type {\n InteractableDefinition,\n InteractableStateSchema,\n} from \"../types/scopes/interactables\";\n\nexport function shallowMerge(prev: unknown, partial: unknown): unknown {\n if (\n typeof prev !== \"object\" ||\n prev === null ||\n typeof partial !== \"object\" ||\n partial === null ||\n Array.isArray(prev) ||\n Array.isArray(partial)\n ) {\n return partial;\n }\n return {\n ...(prev as Record<string, unknown>),\n ...(partial as Record<string, unknown>),\n };\n}\n\nexport function buildInteractableModelContext(\n definitions: Record<string, InteractableDefinition>,\n partialSchemaCache: Map<string, InteractableStateSchema>,\n setDefState: (id: string, updater: (prev: unknown) => unknown) => void,\n): { system: string; tools: Record<string, Tool<any, any>> } | undefined {\n const entries = Object.values(definitions);\n if (entries.length === 0) return undefined;\n\n const byName = new Map<string, InteractableDefinition[]>();\n for (const def of entries) {\n const list = byName.get(def.name) ?? [];\n list.push(def);\n byName.set(def.name, list);\n }\n\n const systemParts: string[] = [];\n const tools: Record<string, Tool<any, any>> = {};\n\n for (const [name, instances] of byName) {\n const isMulti = instances.length > 1;\n\n for (const def of instances) {\n const selectedTag = def.selected ? \" (SELECTED)\" : \"\";\n const idTag = isMulti ? ` [id=\"${def.id}\"]` : \"\";\n\n systemParts.push(\n `Interactable component \"${name}\"${idTag}${selectedTag} (${def.description}). Current state: ${JSON.stringify(def.state)}`,\n );\n\n const safeName = name.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n const safeId = def.id.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n const toolName = isMulti\n ? `update_${safeName}_${safeId}`\n : `update_${safeName}`;\n\n const partialSchema = partialSchemaCache.get(def.id) ?? def.stateSchema;\n\n tools[toolName] = {\n type: \"frontend\" as const,\n description: `Update the state of interactable component \"${name}\"${isMulti ? ` (id: ${def.id})` : \"\"}. Only include the fields you want to change; omitted fields keep their current values. ${def.description}`,\n parameters: partialSchema,\n streamCall: async (reader) => {\n try {\n for await (const partialArgs of reader.args.streamValues()) {\n setDefState(def.id, (prev) => shallowMerge(prev, partialArgs));\n }\n } catch {\n // Non-fatal: execute handles the final state\n }\n },\n execute: async (partialState: unknown) => {\n setDefState(def.id, (prev) => shallowMerge(prev, partialState));\n return { success: true };\n },\n };\n }\n }\n\n return { system: systemParts.join(\"\\n\"), tools };\n}\n"],"mappings":";AAMA,SAAgBG,aAAaC,MAAeC,SAA2B;CACrE,IACE,OAAOD,SAAS,YAChBA,SAAS,QACT,OAAOC,YAAY,YACnBA,YAAY,QACZC,MAAMC,QAAQH,IAAI,KA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AAMC,eAAeD,OAAOE,KAAKC,aAAa,GACvDxC,YAAYW,IAAIV,KAAKV,SAASD,aAAaC,MAAM+C,WAAW,CAAC;KAEjE,QAAQ,CACN;IAEJ;IACAG,SAAS,OAAOC,iBAA0B;KACxC1C,YAAYW,IAAIV,KAAKV,SAASD,aAAaC,MAAMmD,YAAY,CAAC;KAC9D,OAAO,EAAEC,SAAS,KAAK;IACzB;GACF;EACF;CACF;CAEA,OAAO;EAAExC,QAAQc,YAAY2B,KAAK,IAAI;EAAGxC;CAAM;AACjD"}
1
+ {"version":3,"file":"interactable-model-context.js","names":["Tool","toJSONSchema","Unstable_InteractableDefinition","interactableToolName","shallowMergeInteractableState","Unstable_InteractableSnapshotEntry","generateId","isRecord","PartialJSONSchema","ReturnType","ID_PROPERTY","type","const","description","hasIdProperty","schema","Record","properties","id","undefined","withRequiredItemId","required","withoutItemId","_omitted","Array","isArray","filter","key","toArrayUpdateSchema","field","itemSchema","items","idKeyed","add","remove","clear","update","additionalProperties","idKeyedArrayFieldNames","Set","names","value","Object","entries","withArrayUpdateSchemas","fromEntries","map","withRequiredId","partial","process","env","NODE_ENV","console","warn","_reserved","buildInteractableModelContext","definitions","partialSchemaCache","Map","setDefState","updater","prev","streamBaselines","targetId","state","tools","unstable_composerMetadata","values","length","byName","def","list","get","name","push","set","instances","toolName","first","partialSchema","idKeyedFields","resolveTarget","parameters","streamCall","reader","toolCallId","partialArgs","args","streamValues","keys","idIndex","indexOf","target","baseline","arrayBaseline","execute","validIds","d","success","error","JSON","stringify","join","delete","addedItemIds","idFactory","itemId","result","interactables"],"sources":["../../../src/react/client/interactable-model-context.ts"],"sourcesContent":["import type { Tool } from \"assistant-stream\";\nimport { toJSONSchema } from \"assistant-stream\";\nimport type { Unstable_InteractableDefinition } from \"../types/scopes/interactables\";\nimport {\n interactableToolName,\n shallowMergeInteractableState,\n type Unstable_InteractableSnapshotEntry,\n} from \"../../model-context/interactable-composer-metadata\";\nimport { generateId } from \"../../utils/id\";\nimport { isRecord } from \"../../utils/json/is-json\";\n\nexport type PartialJSONSchema = ReturnType<typeof toJSONSchema>;\n\nconst ID_PROPERTY = {\n type: \"string\" as const,\n description:\n \"The id of the instance to update, as shown in its state snapshot in the conversation.\",\n};\n\nconst hasIdProperty = (schema: Record<string, unknown>) => {\n const properties = schema.properties;\n return isRecord(properties) && properties.id !== undefined;\n};\n\nconst withRequiredItemId = (schema: Record<string, unknown>) => ({\n ...schema,\n required: [\"id\"],\n});\n\n// The framework assigns ids to new items, so the model never sees the `id`\n// field when adding (it can't address an item that doesn't exist yet).\nconst withoutItemId = (schema: Record<string, unknown>) => {\n const { id: _omitted, ...properties } = isRecord(schema.properties)\n ? schema.properties\n : {};\n const required = Array.isArray(schema.required)\n ? schema.required.filter((key) => key !== \"id\")\n : schema.required;\n return { ...schema, properties, required };\n};\n\nconst toArrayUpdateSchema = (schema: unknown, field: string) => {\n if (!isRecord(schema) || schema.type !== \"array\") return schema;\n const itemSchema = schema.items;\n if (Array.isArray(itemSchema) || !isRecord(itemSchema)) return schema;\n\n const idKeyed = hasIdProperty(itemSchema);\n const properties: Record<string, unknown> = {\n add: {\n type: \"array\",\n items: idKeyed ? withoutItemId(itemSchema) : itemSchema,\n },\n remove: {\n type: \"array\",\n items: idKeyed ? ID_PROPERTY : itemSchema,\n },\n clear: { type: \"boolean\" },\n };\n\n if (idKeyed) {\n properties.update = {\n type: \"array\",\n items: withRequiredItemId(itemSchema),\n };\n }\n\n return {\n type: \"object\" as const,\n description:\n `Operations for array field \"${field}\". To change one item use update ` +\n `with its id; add new items (their ids are assigned for you), remove items ` +\n `by id, or clear to empty. Change only the items you mean to — never resend ` +\n `the whole array to edit one item.`,\n properties,\n additionalProperties: false,\n };\n};\n\n// Top-level array fields whose items carry an `id` — the fields the framework\n// mints ids for on add.\nconst idKeyedArrayFieldNames = (\n properties: Record<string, unknown>,\n): Set<string> => {\n const names = new Set<string>();\n for (const [key, value] of Object.entries(properties)) {\n if (\n isRecord(value) &&\n value.type === \"array\" &&\n isRecord(value.items) &&\n hasIdProperty(value.items)\n ) {\n names.add(key);\n }\n }\n return names;\n};\n\nconst withArrayUpdateSchemas = (properties: Record<string, unknown>) =>\n Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key,\n toArrayUpdateSchema(value, key),\n ]),\n );\n\n/**\n * Wraps an interactable's partial state schema with the required `id`\n * parameter. Falls back to a permissive schema when the partial conversion\n * failed at registration time.\n */\nfunction withRequiredId(partial: PartialJSONSchema | undefined) {\n if (!partial || typeof partial !== \"object\" || partial.type !== \"object\") {\n return {\n type: \"object\" as const,\n properties: { id: ID_PROPERTY },\n required: [\"id\"],\n additionalProperties: true,\n };\n }\n if (process.env.NODE_ENV !== \"production\" && partial.properties?.id) {\n console.warn(\n `[Interactables] a top-level \"id\" field in an interactable's stateSchema is ` +\n `reserved for instance addressing by the update tool and cannot be updated ` +\n `by the model. Rename the field to make it model-writable.`,\n );\n }\n const { id: _reserved, ...properties } = partial.properties ?? {};\n return {\n ...partial,\n properties: { id: ID_PROPERTY, ...withArrayUpdateSchemas(properties) },\n required: [\"id\"],\n };\n}\n\nexport function buildInteractableModelContext(\n definitions: Record<string, Unstable_InteractableDefinition>,\n partialSchemaCache: Map<string, PartialJSONSchema>,\n setDefState: (id: string, updater: (prev: unknown) => unknown) => void,\n streamBaselines = new Map<string, { targetId: string; state: unknown }>(),\n):\n | {\n tools: Record<string, Tool<any, any>>;\n unstable_composerMetadata?: Record<string, unknown>;\n }\n | undefined {\n const entries = Object.values(definitions);\n if (entries.length === 0) return undefined;\n\n const byName = new Map<string, Unstable_InteractableDefinition[]>();\n for (const def of entries) {\n const list = byName.get(def.name) ?? [];\n list.push(def);\n byName.set(def.name, list);\n }\n\n const tools: Record<string, Tool<any, any>> = {};\n\n for (const [name, instances] of byName) {\n const toolName = interactableToolName(name);\n if (tools[toolName]) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(\n `[Interactables] interactable names \"${name}\" and another registered name ` +\n `both sanitize to the tool name \"${toolName}\". Rename one of them.`,\n );\n }\n continue;\n }\n\n const first = instances[0]!;\n const partialSchema = partialSchemaCache.get(first.id);\n const idKeyedFields =\n partialSchema && isRecord(partialSchema.properties)\n ? idKeyedArrayFieldNames(partialSchema.properties)\n : new Set<string>();\n\n // `id` resolves to a definition of this name; an id-less call is accepted\n // only while exactly one instance exists.\n const resolveTarget = (\n id: unknown,\n ): Unstable_InteractableDefinition | undefined => {\n if (typeof id === \"string\") {\n const def = definitions[id];\n return def?.name === name ? def : undefined;\n }\n return instances.length === 1 ? first : undefined;\n };\n\n tools[toolName] = {\n type: \"frontend\",\n description:\n `Update the state of interactable component \"${name}\". ${first.description} ` +\n `Pass the id of the instance to update — instance ids and current state ` +\n `appear in the conversation as state snapshots. Only include the fields ` +\n `you want to change; omitted fields keep their current values.`,\n parameters: withRequiredId(partialSchema),\n streamCall: async (reader, { toolCallId }) => {\n try {\n for await (const partialArgs of reader.args.streamValues()) {\n if (!partialArgs || typeof partialArgs !== \"object\") continue;\n const args = partialArgs as Record<string, unknown>;\n const keys = Object.keys(args);\n const idIndex = keys.indexOf(\"id\");\n if (idIndex === keys.length - 1) continue;\n\n const { id, ...partial } = args;\n if (Object.keys(partial).length === 0) continue;\n const target = resolveTarget(id);\n if (!target) continue;\n\n const baseline = streamBaselines.get(toolCallId);\n const arrayBaseline =\n baseline?.targetId === target.id ? baseline.state : target.state;\n if (!baseline || baseline.targetId !== target.id) {\n streamBaselines.set(toolCallId, {\n targetId: target.id,\n state: target.state,\n });\n }\n\n setDefState(target.id, (prev) =>\n shallowMergeInteractableState(prev, partial, { arrayBaseline }),\n );\n }\n } catch {\n // Non-fatal: execute handles the final state\n }\n },\n execute: async (args: unknown, { toolCallId }) => {\n const { id, ...partial } = (args ?? {}) as Record<string, unknown>;\n const target = resolveTarget(id);\n if (!target) {\n const validIds = instances.map((d) => d.id);\n return {\n success: false,\n error: `Unknown id ${JSON.stringify(id)} for interactable \"${name}\". Valid ids: ${validIds.join(\", \")}`,\n };\n }\n const baseline = streamBaselines.get(toolCallId);\n streamBaselines.delete(toolCallId);\n const addedItemIds: Record<string, string[]> = {};\n setDefState(target.id, (prev) =>\n shallowMergeInteractableState(prev, partial, {\n arrayBaseline:\n baseline?.targetId === target.id ? baseline.state : undefined,\n idFactory: (field) => {\n const itemId = generateId();\n (addedItemIds[field] ??= []).push(itemId);\n return itemId;\n },\n idKeyedFields,\n }),\n );\n // The resolved id lets an id-less call's UI (and the model) address\n // the instance that was actually updated.\n const result: {\n success: true;\n id: string;\n addedItemIds?: Record<string, string[]>;\n } = { success: true, id: target.id };\n if (Object.keys(addedItemIds).length > 0) {\n result.addedItemIds = addedItemIds;\n }\n return result;\n },\n };\n }\n\n const interactables: Unstable_InteractableSnapshotEntry[] = entries.map(\n (def) => ({\n id: def.id,\n name: def.name,\n state: def.state,\n }),\n );\n return { tools, unstable_composerMetadata: { interactables } };\n}\n"],"mappings":";;;;AAaA,MAAMU,cAAc;CAClBC,MAAM;CACNE,aACE;AACJ;AAEA,MAAMC,iBAAiBC,WAAoC;CACzD,MAAME,aAAaF,OAAOE;CAC1B,OAAOV,SAASU,UAAU,KAAKA,WAAWC,OAAOC,KAAAA;AACnD;AAEA,MAAMC,sBAAsBL,YAAqC;CAC/D,GAAGA;CACHM,UAAU,CAAC,IAAI;AACjB;AAIA,MAAMC,iBAAiBP,WAAoC;CACzD,MAAM,EAAEG,IAAIK,UAAU,GAAGN,eAAeV,SAASQ,OAAOE,UAAU,IAC9DF,OAAOE,aACP,CAAC;CACL,MAAMI,WAAWG,MAAMC,QAAQV,OAAOM,QAAQ,IAC1CN,OAAOM,SAASK,QAAQC,QAAQA,QAAQ,IAAI,IAC5CZ,OAAOM;CACX,OAAO;EAAE,GAAGN;EAAQE;EAAYI;CAAS;AAC3C;AAEA,MAAMO,uBAAuBb,QAAiBc,UAAkB;CAC9D,IAAI,CAACtB,SAASQ,MAAM,KAAKA,OAAOJ,SAAS,SAAS,OAAOI;CACzD,MAAMe,aA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UnF,EAAE,EAAC,qBAAsBuD,KAAI,gBAAiBuB,SAASM,KAAK,IAAI;KACtG;IACF;IACA,MAAMT,WAAW/B,gBAAgBU,IAAIa,UAAU;IAC/CvB,gBAAgByC,OAAOlB,UAAU;IACjC,MAAMmB,eAAyC,CAAC;IAChD7C,YAAYiC,OAAO1E,KAAK2C,SACtBzD,8BAA8ByD,MAAMb,SAAS;KAC3C8C,eACED,UAAU9B,aAAa6B,OAAO1E,KAAK2E,SAAS7B,QAAQ7C,KAAAA;KACtDsF,YAAY5E,UAAU;MACpB,MAAM6E,SAASpG,WAAW;MAC1B,CAACkG,aAAa3E,WAAW,CAAA,EAAA,CAAI6C,KAAKgC,MAAM;MACxC,OAAOA;KACT;KACA1B;IACF,CAAC,CACH;IAGA,MAAM2B,SAIF;KAAET,SAAS;KAAMhF,IAAI0E,OAAO1E;IAAG;IACnC,IAAIwB,OAAO+C,KAAKe,YAAY,CAAC,CAACpC,SAAS,GACrCuC,OAAOH,eAAeA;IAExB,OAAOG;GACT;EACF;CACF;CASA,OAAO;EAAE1C;EAAOC,2BAA2B,EAAE0C,eAPejE,QAAQG,KACjEwB,SAAS;GACRpD,IAAIoD,IAAIpD;GACRuD,MAAMH,IAAIG;GACVT,OAAOM,IAAIN;EACb,EAE2C4C,EAAc;CAAE;AAC/D"}
@@ -2,18 +2,19 @@
2
2
  /// <reference path="./types/store-augmentation.d.ts" />
3
3
  import { AssistantContextConfig } from "../model-context/types.js";
4
4
  import { PartState } from "../store/scopes/part.js";
5
+ import { StreamingTimingAccessors, StreamingTimingOptions, StreamingTimingState } from "../runtime/utils/streaming-timing.js";
5
6
  import { AssistantProviderBase, AssistantProviderBaseProps, getRenderComponent } from "./AssistantProvider.js";
6
7
  import { AssistantRuntimeProvider } from "./AssistantRuntimeProvider.js";
7
8
  import { RuntimeAdapter } from "./RuntimeAdapter.js";
8
9
  import { TitleGenerationAdapter, createSimpleTitleAdapter } from "./adapters/TitleGenerationAdapter.js";
9
10
  import { AsyncStorageLike, createLocalStorageAdapter } from "./adapters/LocalStorageThreadListAdapter.js";
10
11
  import { DataRenderers } from "./client/DataRenderers.js";
11
- import { Interactables } from "./client/Interactables.js";
12
12
  import { DataMessagePartComponent, DataMessagePartProps, EmptyMessagePartComponent, EmptyMessagePartProps, FileMessagePartComponent, FileMessagePartProps, GenerativeUIComponentRegistry, GenerativeUIMessagePartComponent, GenerativeUIMessagePartProps, GenerativeUIRenderProps, ImageMessagePartComponent, ImageMessagePartProps, QuoteMessagePartComponent, QuoteMessagePartProps, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, SourceMessagePartComponent, SourceMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ToolCallMessagePartComponent, ToolCallMessagePartProps, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps } from "./types/MessagePartComponentTypes.js";
13
+ import { Unstable_InteractableDefinition, Unstable_InteractablePersistedState, Unstable_InteractablePersistenceAdapter, Unstable_InteractablePersistenceStatus, Unstable_InteractableRegistration, Unstable_InteractableStateSchema, Unstable_InteractablesClientSchema, Unstable_InteractablesConfig, Unstable_InteractablesMethods, Unstable_InteractablesState } from "./types/scopes/interactables.js";
14
+ import { unstable_Interactables } from "./client/Interactables.js";
13
15
  import { McpAppResourceOutput, ToolsClientSchema, ToolsMethods, ToolsState } from "./types/scopes/tools.js";
14
16
  import { ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry } from "./model-context/toolbox.js";
15
17
  import { Tools } from "./client/Tools.js";
16
- import { InteractableDefinition, InteractablePersistedState, InteractablePersistenceAdapter, InteractablePersistenceStatus, InteractableRegistration, InteractableStateSchema, InteractablesClientSchema, InteractablesMethods, InteractablesState } from "./types/scopes/interactables.js";
17
18
  import { AssistantToolProps, useAssistantTool } from "./model-context/useAssistantTool.js";
18
19
  import { AssistantTool, makeAssistantTool } from "./model-context/makeAssistantTool.js";
19
20
  import { AssistantToolUIProps, useAssistantToolUI } from "./model-context/useAssistantToolUI.js";
@@ -30,9 +31,15 @@ import { useAuiToolOverrides } from "./model-context/useAuiToolOverrides.js";
30
31
  import { hitl, hitlTool, humanTool } from "./model-context/human-tool.js";
31
32
  import { ProviderToolConfig, providerTool } from "./model-context/provider-tool.js";
32
33
  import { McpToolkitDefinition, defineMcpToolkit } from "./model-context/define-mcp-toolkit.js";
33
- import { AssistantInteractableProps, useAssistantInteractable } from "./model-context/useAssistantInteractable.js";
34
- import { useInteractableState } from "./model-context/useInteractableState.js";
34
+ import { InteractableDefinition, InteractablePersistedState, InteractablePersistenceAdapter, InteractablePersistenceStatus, InteractableRegistration, InteractableStateSchema, InteractablesClientSchema, InteractablesMethods, InteractablesState } from "./interactables-legacy/scopes.js";
35
+ import { AssistantInteractableProps, useAssistantInteractable } from "./interactables-legacy/useAssistantInteractable.js";
36
+ import { useInteractableState } from "./interactables-legacy/useInteractableState.js";
37
+ import { Unstable_InferInteractableState, Unstable_InteractableConfig, Unstable_InteractableVersionInfo, unstable_useInteractable } from "./model-context/useInteractable.js";
38
+ import { unstable_useInteractableState } from "./model-context/useInteractableState.js";
39
+ import { unstable_useInteractableVersions } from "./model-context/useInteractableVersions.js";
40
+ import { Unstable_InteractableToolConfig, Unstable_InteractableToolRenderProps, unstable_interactableTool } from "./model-context/interactableTool.js";
35
41
  import { ToolArgsStatus, useToolArgsStatus } from "./model-context/useToolArgsStatus.js";
42
+ import { Interactables } from "./interactables-legacy/Interactables.js";
36
43
  import { DataRenderersClientSchema, DataRenderersMethods, DataRenderersState } from "./types/scopes/dataRenderers.js";
37
44
  import { ComposerAttachmentByIndexProvider, MessageAttachmentByIndexProvider } from "./providers/AttachmentByIndexProvider.js";
38
45
  import { ThreadListItemRuntimeProvider } from "./providers/ThreadListItemRuntimeProvider.js";
@@ -50,13 +57,14 @@ import { useExternalStoreRuntime } from "./runtimes/useExternalStoreRuntime.js";
50
57
  import { useExternalStoreSharedOptions } from "./runtimes/useExternalStoreSharedOptions.js";
51
58
  import { JoinStrategy, convertExternalMessages, useExternalMessageConverter } from "./runtimes/external-message-converter.js";
52
59
  import { createMessageConverter } from "./runtimes/createMessageConverter.js";
60
+ import { useStreamingTiming } from "./runtimes/useStreamingTiming.js";
53
61
  import { RemoteThreadListHookInstanceManager } from "./runtimes/RemoteThreadListHookInstanceManager.js";
54
62
  import { RemoteThreadListThreadListRuntimeCore } from "./runtimes/RemoteThreadListThreadListRuntimeCore.js";
55
63
  import { useRemoteThreadListRuntime } from "./runtimes/useRemoteThreadListRuntime.js";
56
64
  import { useCloudThreadListAdapter } from "./runtimes/cloud/useCloudThreadListAdapter.js";
57
65
  import { useAssistantCloudThreadHistoryAdapter } from "./runtimes/cloud/AssistantCloudThreadHistoryAdapter.js";
58
66
  import { CloudFileAttachmentAdapter } from "./runtimes/cloud/CloudFileAttachmentAdapter.js";
59
- import { ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl } from "./primitives/thread/ThreadMessages.js";
67
+ import { ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveUnstable_MessageById } from "./primitives/thread/ThreadMessages.js";
60
68
  import { EnrichedPartState, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents } from "./primitives/message/MessageParts.js";
61
69
  import { GroupByContext, groupPartByType } from "./utils/groupParts.js";
62
70
  import { MessagePrimitiveGroupedParts } from "./primitives/message/MessageGroupedParts.js";
@@ -74,6 +82,7 @@ import { ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPri
74
82
  import { ComposerPrimitiveIf, UseComposerIfProps } from "./primitives/composer/ComposerIf.js";
75
83
  import { getMessageQuote } from "./utils/getMessageQuote.js";
76
84
  import { useThreadMessages } from "./primitive-hooks/useThreadMessages.js";
85
+ import { unstable_useThreadMessageIds } from "./primitive-hooks/useThreadMessageIds.js";
77
86
  import { useThreadIsRunning } from "./primitive-hooks/useThreadIsRunning.js";
78
87
  import { useThreadIsEmpty } from "./primitive-hooks/useThreadIsEmpty.js";
79
88
  import { useComposerSend } from "./primitive-hooks/useComposerSend.js";
@@ -102,4 +111,4 @@ import { useEditComposerCancel } from "./primitive-hooks/useEditComposerCancel.j
102
111
  import { useEditComposerSend } from "./primitive-hooks/useEditComposerSend.js";
103
112
  import { useMessageError } from "./primitive-hooks/useMessageError.js";
104
113
  import { LocalRuntimeOptions, splitLocalRuntimeOptions, useLocalRuntime } from "./runtimes/useLocalRuntime.js";
105
- export { type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantInteractableProps, AssistantProviderBase, type AssistantProviderBaseProps, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AsyncStorageLike, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ChainOfThoughtPrimitiveParts, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, ComposerPrimitiveAttachmentByIndex, ComposerPrimitiveAttachments, ComposerPrimitiveIf, ComposerPrimitiveQueue, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, type DataRenderersClientSchema, type DataRenderersMethods, type DataRenderersState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, type FileMessagePartComponent, type FileMessagePartProps, type GenerativeUIComponentRegistry, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GroupByContext, type ImageMessagePartComponent, type ImageMessagePartProps, type InteractableDefinition, type InteractablePersistedState, type InteractablePersistenceAdapter, type InteractablePersistenceStatus, type InteractableRegistration, type InteractableStateSchema, Interactables, type InteractablesClientSchema, type InteractablesMethods, type InteractablesState, type JoinStrategy, type LocalRuntimeOptions, type McpAppResourceOutput, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessagePartComponent, MessagePartPrimitiveInProgress, MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments, MessagePrimitiveGenerativeUI, MessagePrimitiveGroupedParts, MessagePrimitivePartByIndex, MessagePrimitiveParts, MessagePrimitiveQuote, PartByIndexProvider, PartPrimitiveMessages, PartPrimitiveMessagesImpl, type PartState, type ProviderToolConfig, QueueItemByIndexProvider, type QueueItemByIndexProviderProps, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, RemoteThreadListHookInstanceManager, RemoteThreadListThreadListRuntimeCore, RuntimeAdapter, RuntimeAdapterProvider, type RuntimeAdapters, type SourceMessagePartComponent, type SourceMessagePartProps, SuggestionByIndexProvider, type SuggestionByIndexProviderProps, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemPrimitiveTitle, ThreadListItemRuntimeProvider, ThreadListPrimitiveItemByIndex, ThreadListPrimitiveItems, ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPrimitiveSuggestionsImpl, type TitleGenerationAdapter, type ToolArgsStatus, type ToolCallMessagePartComponent, type ToolCallMessagePartProps, type ToolCallText, type ToolDefinition, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type ToolsClientSchema, type ToolsMethods, type ToolsState, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type UseActionBarCopyOptions, type UseComposerIfProps, type UseSuggestionTriggerOptions, convertExternalMessages, createLocalStorageAdapter, createMessageConverter, createSimpleTitleAdapter, defineMcpToolkit, defineToolkit, externalTool, getMessageQuote, getRenderComponent, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, defaultComponents as messagePartsDefaultComponents, providerTool, splitLocalRuntimeOptions, stubTool, useActionBarCopy, useActionBarEdit, useActionBarFeedbackNegative, useActionBarFeedbackPositive, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAssistantCloudThreadHistoryAdapter, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useBranchPickerNext, useBranchPickerPrevious, useCloudThreadListAdapter, useComposerAddAttachment, useComposerCancel, useComposerDictate, useComposerSend, useEditComposerCancel, useEditComposerSend, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessageBranching, useMessageError, useMessageReload, useRemoteThreadListRuntime, useRuntimeAdapters, useSuggestionTrigger, useThreadIsEmpty, useThreadIsRunning, useThreadListItemArchive, useThreadListItemDelete, useThreadListItemTrigger, useThreadListItemUnarchive, useThreadListLoadMore, useThreadListNew, useThreadMessages, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
114
+ export { type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantInteractableProps, AssistantProviderBase, type AssistantProviderBaseProps, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AsyncStorageLike, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ChainOfThoughtPrimitiveParts, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, ComposerPrimitiveAttachmentByIndex, ComposerPrimitiveAttachments, ComposerPrimitiveIf, ComposerPrimitiveQueue, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, type DataRenderersClientSchema, type DataRenderersMethods, type DataRenderersState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, type FileMessagePartComponent, type FileMessagePartProps, type GenerativeUIComponentRegistry, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GroupByContext, type ImageMessagePartComponent, type ImageMessagePartProps, type InteractableDefinition, type InteractablePersistedState, type InteractablePersistenceAdapter, type InteractablePersistenceStatus, type InteractableRegistration, type InteractableStateSchema, Interactables, type InteractablesClientSchema, type InteractablesMethods, type InteractablesState, type JoinStrategy, type LocalRuntimeOptions, type McpAppResourceOutput, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessagePartComponent, MessagePartPrimitiveInProgress, MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments, MessagePrimitiveGenerativeUI, MessagePrimitiveGroupedParts, MessagePrimitivePartByIndex, MessagePrimitiveParts, MessagePrimitiveQuote, PartByIndexProvider, PartPrimitiveMessages, PartPrimitiveMessagesImpl, type PartState, type ProviderToolConfig, QueueItemByIndexProvider, type QueueItemByIndexProviderProps, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, RemoteThreadListHookInstanceManager, RemoteThreadListThreadListRuntimeCore, RuntimeAdapter, RuntimeAdapterProvider, type RuntimeAdapters, type SourceMessagePartComponent, type SourceMessagePartProps, type StreamingTimingAccessors, type StreamingTimingOptions, type StreamingTimingState, SuggestionByIndexProvider, type SuggestionByIndexProviderProps, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemPrimitiveTitle, ThreadListItemRuntimeProvider, ThreadListPrimitiveItemByIndex, ThreadListPrimitiveItems, ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPrimitiveSuggestionsImpl, ThreadPrimitiveUnstable_MessageById, type TitleGenerationAdapter, type ToolArgsStatus, type ToolCallMessagePartComponent, type ToolCallMessagePartProps, type ToolCallText, type ToolDefinition, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type ToolsClientSchema, type ToolsMethods, type ToolsState, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type UseActionBarCopyOptions, type UseComposerIfProps, type UseSuggestionTriggerOptions, convertExternalMessages, createLocalStorageAdapter, createMessageConverter, createSimpleTitleAdapter, defineMcpToolkit, defineToolkit, externalTool, getMessageQuote, getRenderComponent, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, defaultComponents as messagePartsDefaultComponents, providerTool, splitLocalRuntimeOptions, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useActionBarCopy, useActionBarEdit, useActionBarFeedbackNegative, useActionBarFeedbackPositive, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAssistantCloudThreadHistoryAdapter, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useBranchPickerNext, useBranchPickerPrevious, useCloudThreadListAdapter, useComposerAddAttachment, useComposerCancel, useComposerDictate, useComposerSend, useEditComposerCancel, useEditComposerSend, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessageBranching, useMessageError, useMessageReload, useRemoteThreadListRuntime, useRuntimeAdapters, useStreamingTiming, useSuggestionTrigger, useThreadIsEmpty, useThreadIsRunning, useThreadListItemArchive, useThreadListItemDelete, useThreadListItemTrigger, useThreadListItemUnarchive, useThreadListLoadMore, useThreadListNew, useThreadMessages, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
@@ -19,10 +19,15 @@ import { useAuiToolOverrides } from "./model-context/useAuiToolOverrides.js";
19
19
  import { hitl, hitlTool, humanTool } from "./model-context/human-tool.js";
20
20
  import { providerTool } from "./model-context/provider-tool.js";
21
21
  import { defineMcpToolkit } from "./model-context/define-mcp-toolkit.js";
22
- import { useAssistantInteractable } from "./model-context/useAssistantInteractable.js";
23
- import { useInteractableState } from "./model-context/useInteractableState.js";
22
+ import { useAssistantInteractable } from "./interactables-legacy/useAssistantInteractable.js";
23
+ import { useInteractableState } from "./interactables-legacy/useInteractableState.js";
24
+ import { unstable_useInteractableState } from "./model-context/useInteractableState.js";
25
+ import { unstable_useInteractable } from "./model-context/useInteractable.js";
26
+ import { unstable_useInteractableVersions } from "./model-context/useInteractableVersions.js";
27
+ import { unstable_interactableTool } from "./model-context/interactableTool.js";
24
28
  import { useToolArgsStatus } from "./model-context/useToolArgsStatus.js";
25
- import { Interactables } from "./client/Interactables.js";
29
+ import { Interactables } from "./interactables-legacy/Interactables.js";
30
+ import { unstable_Interactables } from "./client/Interactables.js";
26
31
  import { ComposerAttachmentByIndexProvider, MessageAttachmentByIndexProvider } from "./providers/AttachmentByIndexProvider.js";
27
32
  import { ThreadListItemRuntimeProvider } from "./providers/ThreadListItemRuntimeProvider.js";
28
33
  import { MessageByIndexProvider } from "./providers/MessageByIndexProvider.js";
@@ -39,6 +44,7 @@ import { useExternalStoreRuntime } from "./runtimes/useExternalStoreRuntime.js";
39
44
  import { useExternalStoreSharedOptions } from "./runtimes/useExternalStoreSharedOptions.js";
40
45
  import { convertExternalMessages, useExternalMessageConverter } from "./runtimes/external-message-converter.js";
41
46
  import { createMessageConverter } from "./runtimes/createMessageConverter.js";
47
+ import { useStreamingTiming } from "./runtimes/useStreamingTiming.js";
42
48
  import { RemoteThreadListHookInstanceManager } from "./runtimes/RemoteThreadListHookInstanceManager.js";
43
49
  import { RemoteThreadListThreadListRuntimeCore } from "./runtimes/RemoteThreadListThreadListRuntimeCore.js";
44
50
  import { useRemoteThreadListRuntime } from "./runtimes/useRemoteThreadListRuntime.js";
@@ -47,7 +53,7 @@ import { CloudFileAttachmentAdapter } from "./runtimes/cloud/CloudFileAttachment
47
53
  import { useCloudThreadListAdapter } from "./runtimes/cloud/useCloudThreadListAdapter.js";
48
54
  import { createLocalStorageAdapter } from "./adapters/LocalStorageThreadListAdapter.js";
49
55
  import { createSimpleTitleAdapter } from "./adapters/TitleGenerationAdapter.js";
50
- import { ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl } from "./primitives/thread/ThreadMessages.js";
56
+ import { ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveUnstable_MessageById } from "./primitives/thread/ThreadMessages.js";
51
57
  import { getMessageQuote } from "./utils/getMessageQuote.js";
52
58
  import { GenerativeUIRender, GenerativeUIRenderError, MessagePrimitiveGenerativeUI } from "./primitives/generativeUI/GenerativeUI.js";
53
59
  import { MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents } from "./primitives/message/MessageParts.js";
@@ -65,6 +71,7 @@ import { ThreadListItemPrimitiveTitle } from "./primitives/threadListItem/Thread
65
71
  import { ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPrimitiveSuggestionsImpl } from "./primitives/thread/ThreadSuggestions.js";
66
72
  import { ComposerPrimitiveIf } from "./primitives/composer/ComposerIf.js";
67
73
  import { useThreadMessages } from "./primitive-hooks/useThreadMessages.js";
74
+ import { unstable_useThreadMessageIds } from "./primitive-hooks/useThreadMessageIds.js";
68
75
  import { useThreadIsRunning } from "./primitive-hooks/useThreadIsRunning.js";
69
76
  import { useThreadIsEmpty } from "./primitive-hooks/useThreadIsEmpty.js";
70
77
  import { useComposerSend } from "./primitive-hooks/useComposerSend.js";
@@ -93,4 +100,4 @@ import { useEditComposerCancel } from "./primitive-hooks/useEditComposerCancel.j
93
100
  import { useEditComposerSend } from "./primitive-hooks/useEditComposerSend.js";
94
101
  import { useMessageError } from "./primitive-hooks/useMessageError.js";
95
102
  import { splitLocalRuntimeOptions, useLocalRuntime } from "./runtimes/useLocalRuntime.js";
96
- export { AssistantProviderBase, AssistantRuntimeProvider, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ChainOfThoughtPrimitiveParts, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, ComposerPrimitiveAttachmentByIndex, ComposerPrimitiveAttachments, ComposerPrimitiveIf, ComposerPrimitiveQueue, DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessagePartComponent, MessagePartPrimitiveInProgress, MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments, MessagePrimitiveGenerativeUI, MessagePrimitiveGroupedParts, MessagePrimitivePartByIndex, MessagePrimitiveParts, MessagePrimitiveQuote, PartByIndexProvider, PartPrimitiveMessages, PartPrimitiveMessagesImpl, QueueItemByIndexProvider, ReadonlyThreadProvider, RemoteThreadListHookInstanceManager, RemoteThreadListThreadListRuntimeCore, RuntimeAdapter, RuntimeAdapterProvider, SuggestionByIndexProvider, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemPrimitiveTitle, ThreadListItemRuntimeProvider, ThreadListPrimitiveItemByIndex, ThreadListPrimitiveItems, ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPrimitiveSuggestionsImpl, Tools, convertExternalMessages, createLocalStorageAdapter, createMessageConverter, createSimpleTitleAdapter, defineMcpToolkit, defineToolkit, externalTool, getMessageQuote, getRenderComponent, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, defaultComponents as messagePartsDefaultComponents, providerTool, splitLocalRuntimeOptions, stubTool, useActionBarCopy, useActionBarEdit, useActionBarFeedbackNegative, useActionBarFeedbackPositive, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAssistantCloudThreadHistoryAdapter, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useBranchPickerNext, useBranchPickerPrevious, useCloudThreadListAdapter, useComposerAddAttachment, useComposerCancel, useComposerDictate, useComposerSend, useEditComposerCancel, useEditComposerSend, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessageBranching, useMessageError, useMessageReload, useRemoteThreadListRuntime, useRuntimeAdapters, useSuggestionTrigger, useThreadIsEmpty, useThreadIsRunning, useThreadListItemArchive, useThreadListItemDelete, useThreadListItemTrigger, useThreadListItemUnarchive, useThreadListLoadMore, useThreadListNew, useThreadMessages, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
103
+ export { AssistantProviderBase, AssistantRuntimeProvider, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ChainOfThoughtPrimitiveParts, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, ComposerPrimitiveAttachmentByIndex, ComposerPrimitiveAttachments, ComposerPrimitiveIf, ComposerPrimitiveQueue, DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessagePartComponent, MessagePartPrimitiveInProgress, MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments, MessagePrimitiveGenerativeUI, MessagePrimitiveGroupedParts, MessagePrimitivePartByIndex, MessagePrimitiveParts, MessagePrimitiveQuote, PartByIndexProvider, PartPrimitiveMessages, PartPrimitiveMessagesImpl, QueueItemByIndexProvider, ReadonlyThreadProvider, RemoteThreadListHookInstanceManager, RemoteThreadListThreadListRuntimeCore, RuntimeAdapter, RuntimeAdapterProvider, SuggestionByIndexProvider, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemPrimitiveTitle, ThreadListItemRuntimeProvider, ThreadListPrimitiveItemByIndex, ThreadListPrimitiveItems, ThreadPrimitiveMessageByIndex, ThreadPrimitiveMessages, ThreadPrimitiveMessagesImpl, ThreadPrimitiveSuggestionByIndex, ThreadPrimitiveSuggestions, ThreadPrimitiveSuggestionsImpl, ThreadPrimitiveUnstable_MessageById, Tools, convertExternalMessages, createLocalStorageAdapter, createMessageConverter, createSimpleTitleAdapter, defineMcpToolkit, defineToolkit, externalTool, getMessageQuote, getRenderComponent, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, defaultComponents as messagePartsDefaultComponents, providerTool, splitLocalRuntimeOptions, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useActionBarCopy, useActionBarEdit, useActionBarFeedbackNegative, useActionBarFeedbackPositive, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAssistantCloudThreadHistoryAdapter, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useBranchPickerNext, useBranchPickerPrevious, useCloudThreadListAdapter, useComposerAddAttachment, useComposerCancel, useComposerDictate, useComposerSend, useEditComposerCancel, useEditComposerSend, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessageBranching, useMessageError, useMessageReload, useRemoteThreadListRuntime, useRuntimeAdapters, useStreamingTiming, useSuggestionTrigger, useThreadIsEmpty, useThreadIsRunning, useThreadListItemArchive, useThreadListItemDelete, useThreadListItemTrigger, useThreadListItemUnarchive, useThreadListLoadMore, useThreadListNew, useThreadMessages, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
@@ -0,0 +1,12 @@
1
+ import { ClientOutput } from "@assistant-ui/store";
2
+
3
+ //#region src/react/interactables-legacy/Interactables.d.ts
4
+ /**
5
+ * @deprecated Since 2026-06-14 — migrate to the Unstable / Experimental API.
6
+ * Scheduled for removal on/after 2026-09-14. See
7
+ * {@link https://www.assistant-ui.com/docs/tools/interactables#migrating-from-the-previous-api | Interactables migration guide}.
8
+ */
9
+ declare const Interactables: import("@assistant-ui/tap").Resource<ClientOutput<"interactables">, []>;
10
+ //#endregion
11
+ export { Interactables };
12
+ //# sourceMappingURL=Interactables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Interactables.d.ts","names":[],"sources":["../../../src/react/interactables-legacy/Interactables.ts"],"mappings":";;;;;AAqUA;;;cAAa,aAAA,8BAAa,QAAA,CAAA,YAAA"}