@assistant-ui/react 0.14.16 → 0.14.18
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.
- package/dist/client/ExternalThread.d.ts +4 -3
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +46 -21
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/client/InMemoryThreadList.d.ts +1 -1
- package/dist/client/InMemoryThreadList.d.ts.map +1 -1
- package/dist/client/InMemoryThreadList.js +7 -5
- package/dist/client/InMemoryThreadList.js.map +1 -1
- package/dist/client/SingleThreadList.d.ts +1 -6
- package/dist/client/SingleThreadList.d.ts.map +1 -1
- package/dist/client/SingleThreadList.js +6 -4
- package/dist/client/SingleThreadList.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts +2 -10
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +3 -2
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts +1 -8
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js +3 -2
- package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +3 -3
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts +2 -10
- package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverResource.js +3 -2
- package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -1
- package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts +2 -6
- package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerDetectionResource.js +3 -2
- package/dist/primitives/composer/trigger/triggerDetectionResource.js.map +1 -1
- package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts +2 -17
- package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerKeyboardResource.js +3 -2
- package/dist/primitives/composer/trigger/triggerKeyboardResource.js.map +1 -1
- package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts +2 -10
- package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerNavigationResource.js +3 -2
- package/dist/primitives/composer/trigger/triggerNavigationResource.js.map +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts +2 -10
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.js +3 -2
- package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
- package/dist/primitives/messagePart/MessagePartText.d.ts +5 -2
- package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartText.js.map +1 -1
- package/dist/primitives/reasoning/useScrollLock.js +11 -2
- package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +5 -0
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/unstable/useComposerInputHistory.d.ts +30 -0
- package/dist/unstable/useComposerInputHistory.d.ts.map +1 -0
- package/dist/unstable/useComposerInputHistory.js +117 -0
- package/dist/unstable/useComposerInputHistory.js.map +1 -0
- package/dist/utils/smooth/useSmooth.d.ts +40 -2
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +48 -9
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/package.json +4 -4
- package/src/client/ExternalThread.ts +70 -27
- package/src/client/InMemoryThreadList.ts +11 -7
- package/src/client/SingleThreadList.ts +29 -27
- package/src/index.ts +8 -0
- package/src/mcp-apps/McpAppRenderer.tsx +5 -3
- package/src/mcp-apps/McpAppsRemoteHost.ts +5 -3
- package/src/primitives/composer/ComposerInput.test.tsx +1 -1
- package/src/primitives/composer/ComposerInput.tsx +3 -3
- package/src/primitives/composer/trigger/TriggerPopoverResource.ts +5 -3
- package/src/primitives/composer/trigger/triggerDetectionResource.ts +21 -21
- package/src/primitives/composer/trigger/triggerKeyboardResource.test.ts +5 -4
- package/src/primitives/composer/trigger/triggerKeyboardResource.ts +99 -101
- package/src/primitives/composer/trigger/triggerNavigationResource.ts +92 -98
- package/src/primitives/composer/trigger/triggerSelectionResource.ts +76 -76
- package/src/primitives/messagePart/MessagePartText.tsx +3 -2
- package/src/primitives/reasoning/useScrollLock.ts +25 -2
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +8 -0
- package/src/tests/external-thread-branches.test.tsx +160 -0
- package/src/tests/shouldContinue.test.ts +33 -0
- package/src/unstable/useComposerInputHistory.test.tsx +201 -0
- package/src/unstable/useComposerInputHistory.ts +160 -0
- package/src/utils/smooth/useSmooth.test.tsx +95 -0
- package/src/utils/smooth/useSmooth.ts +82 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientOutput } from "@assistant-ui/store";
|
|
2
|
-
import { AppendMessage, ExternalThreadQueueAdapter, ThreadMessage } from "@assistant-ui/core";
|
|
2
|
+
import { AppendMessage, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, ThreadMessage } from "@assistant-ui/core";
|
|
3
3
|
|
|
4
4
|
//#region src/client/ExternalThread.d.ts
|
|
5
5
|
type ExternalThreadMessage = ThreadMessage & {
|
|
@@ -24,9 +24,10 @@ type ExternalThreadProps = {
|
|
|
24
24
|
onReload?: (parentId: string | null) => void;
|
|
25
25
|
onStartRun?: () => void;
|
|
26
26
|
onCancel?: () => void; /** Queue adapter for runtimes that support message queuing and steering. */
|
|
27
|
-
queue?: ExternalThreadQueueAdapter;
|
|
27
|
+
queue?: ExternalThreadQueueAdapter; /** Branch adapter for runtimes that track sibling variants of messages. */
|
|
28
|
+
branches?: ExternalThreadBranchAdapter;
|
|
28
29
|
};
|
|
29
|
-
declare const ExternalThread:
|
|
30
|
+
declare const ExternalThread: import("@assistant-ui/tap").Resource<ClientOutput<"thread">, [ExternalThreadProps]>;
|
|
30
31
|
//#endregion
|
|
31
32
|
export { ExternalThread, ExternalThreadMessage, ExternalThreadProps };
|
|
32
33
|
//# sourceMappingURL=ExternalThread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalThread.d.ts","names":[],"sources":["../../src/client/ExternalThread.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ExternalThread.d.ts","names":[],"sources":["../../src/client/ExternalThread.ts"],"mappings":";;;;KA+BY,qBAAA,GAAwB,aAAa;EAC/C,EAAE;AAAA;AAAA,KAGQ,mBAAA;EACV,QAAA,WAAmB,qBAAA;EACnB,SAAA;EALE;AAGJ;;;;;EASE,cAAA;EAWQ;;;;EANR,KAAA,IAAS,OAAA,EAAS,aAAA;EAClB,MAAA,IAAU,OAAA,EAAS,aAAA;EACnB,QAAA,IAAY,QAAA;EACZ,UAAA;EACA,QAAA,eAJkB;EAMlB,KAAA,GAAQ,0BAAA,EALR;EAOA,QAAA,GAAW,2BAAA;AAAA;AAAA,cAqkBA,cAAA,8BAAc,QAAA,CAAA,YAAA,aAAA,mBAAA"}
|
|
@@ -4,9 +4,11 @@ import { DataRenderers, Tools } from "@assistant-ui/core/react";
|
|
|
4
4
|
import { useEffect, useEffectEvent, useMemo, useState } from "@assistant-ui/tap/react-shim";
|
|
5
5
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
6
6
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
7
|
+
import { getThreadMessageText } from "@assistant-ui/core/internal";
|
|
7
8
|
//#region src/client/ExternalThread.ts
|
|
8
9
|
const EMPTY_QUEUE_ITEMS = [];
|
|
9
|
-
const
|
|
10
|
+
const EMPTY_BRANCH_IDS = [];
|
|
11
|
+
const useMessageClient = ({ message, index, onEdit, onReload, queue, branches }) => {
|
|
10
12
|
const [isCopied, setIsCopied] = useState(false);
|
|
11
13
|
const [isHovering, setIsHovering] = useState(false);
|
|
12
14
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -40,14 +42,18 @@ const MessageClient = resource(function MessageClient({ message, index, onEdit,
|
|
|
40
42
|
message,
|
|
41
43
|
queue
|
|
42
44
|
}));
|
|
45
|
+
const branchIds = branches?.getBranches(message.id) ?? EMPTY_BRANCH_IDS;
|
|
46
|
+
const branchIndex = branchIds.indexOf(message.id);
|
|
47
|
+
const branchNumber = branchIndex === -1 ? 1 : branchIndex + 1;
|
|
48
|
+
const branchCount = branchIndex === -1 ? 1 : branchIds.length;
|
|
43
49
|
const state = useMemo(() => {
|
|
44
50
|
return {
|
|
45
51
|
...message,
|
|
46
52
|
attachments: message.attachments ?? [],
|
|
47
53
|
parentId: null,
|
|
48
54
|
isLast: false,
|
|
49
|
-
branchNumber
|
|
50
|
-
branchCount
|
|
55
|
+
branchNumber,
|
|
56
|
+
branchCount,
|
|
51
57
|
speech: void 0,
|
|
52
58
|
parts: partClients.state,
|
|
53
59
|
isCopied,
|
|
@@ -61,19 +67,26 @@ const MessageClient = resource(function MessageClient({ message, index, onEdit,
|
|
|
61
67
|
isHovering,
|
|
62
68
|
index,
|
|
63
69
|
composerClient.state,
|
|
64
|
-
partClients.state
|
|
70
|
+
partClients.state,
|
|
71
|
+
branchNumber,
|
|
72
|
+
branchCount
|
|
65
73
|
]);
|
|
66
74
|
return {
|
|
67
75
|
getState: () => state,
|
|
68
76
|
composer: () => composerClient.methods,
|
|
77
|
+
delete: () => {},
|
|
69
78
|
reload: () => {
|
|
70
79
|
onReload?.();
|
|
71
80
|
},
|
|
72
81
|
speak: () => {},
|
|
73
82
|
stopSpeaking: () => {},
|
|
74
83
|
submitFeedback: () => {},
|
|
75
|
-
switchToBranch: () => {
|
|
76
|
-
|
|
84
|
+
switchToBranch: ({ position, branchId }) => {
|
|
85
|
+
if (!branches) return;
|
|
86
|
+
const target = branchId ?? (branchIndex === -1 ? void 0 : position === "previous" ? branchIds[branchIndex - 1] : position === "next" ? branchIds[branchIndex + 1] : void 0);
|
|
87
|
+
if (target !== void 0 && target !== message.id) branches.switchToBranch(target);
|
|
88
|
+
},
|
|
89
|
+
getCopyText: () => getThreadMessageText(message),
|
|
77
90
|
part: (selector) => {
|
|
78
91
|
if ("index" in selector) return partClients.get(selector);
|
|
79
92
|
const partIndex = state.parts.findIndex((p) => p.type === "tool-call" && p.toolCallId === selector.toolCallId);
|
|
@@ -86,8 +99,9 @@ const MessageClient = resource(function MessageClient({ message, index, onEdit,
|
|
|
86
99
|
setIsCopied,
|
|
87
100
|
setIsHovering
|
|
88
101
|
};
|
|
89
|
-
}
|
|
90
|
-
const
|
|
102
|
+
};
|
|
103
|
+
const MessageClient = resource(useMessageClient);
|
|
104
|
+
const usePartResource = ({ part }) => {
|
|
91
105
|
const state = useMemo(() => ({
|
|
92
106
|
...part,
|
|
93
107
|
status: { type: "complete" }
|
|
@@ -98,23 +112,26 @@ const PartResource = resource(function PartResource({ part }) {
|
|
|
98
112
|
resumeToolCall: () => {},
|
|
99
113
|
respondToToolApproval: () => {}
|
|
100
114
|
};
|
|
101
|
-
}
|
|
102
|
-
const
|
|
115
|
+
};
|
|
116
|
+
const PartResource = resource(usePartResource);
|
|
117
|
+
const useAttachmentResource = ({ attachment, onRemove }) => {
|
|
103
118
|
return {
|
|
104
119
|
getState: () => attachment,
|
|
105
120
|
remove: async () => {
|
|
106
121
|
onRemove?.();
|
|
107
122
|
}
|
|
108
123
|
};
|
|
109
|
-
}
|
|
110
|
-
const
|
|
124
|
+
};
|
|
125
|
+
const AttachmentResource = resource(useAttachmentResource);
|
|
126
|
+
const useQueueItemClient = ({ item, onSteer, onRemove }) => {
|
|
111
127
|
return {
|
|
112
128
|
getState: () => item,
|
|
113
129
|
steer: onSteer,
|
|
114
130
|
remove: onRemove
|
|
115
131
|
};
|
|
116
|
-
}
|
|
117
|
-
const
|
|
132
|
+
};
|
|
133
|
+
const QueueItemClient = resource(useQueueItemClient);
|
|
134
|
+
const useComposerClientResource = ({ type, isEditing, canCancel, isSendDisabled = false, onCancel, onBeginEdit, onSend, message, queue }) => {
|
|
118
135
|
const [text, setText] = useState("");
|
|
119
136
|
const [role, setRole] = useState("user");
|
|
120
137
|
const [runConfig, setRunConfig] = useState({});
|
|
@@ -249,8 +266,9 @@ const ComposerClientResource = resource(function ComposerClientResource({ type,
|
|
|
249
266
|
return queueItemClients.get(selector);
|
|
250
267
|
}
|
|
251
268
|
};
|
|
252
|
-
}
|
|
253
|
-
const
|
|
269
|
+
};
|
|
270
|
+
const ComposerClientResource = resource(useComposerClientResource);
|
|
271
|
+
const useExternalThread = ({ messages, isRunning = false, isSendDisabled = false, onNew, onEdit, onReload, onStartRun, onCancel, queue, branches }) => {
|
|
254
272
|
const handleReload = (messageId) => {
|
|
255
273
|
const messageIndex = messages.findIndex((m) => m.id === messageId);
|
|
256
274
|
if (messageIndex === -1) return;
|
|
@@ -263,14 +281,16 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
263
281
|
message: msg,
|
|
264
282
|
index,
|
|
265
283
|
onReload: () => handleReload(msg.id),
|
|
266
|
-
queue
|
|
284
|
+
queue,
|
|
285
|
+
branches
|
|
267
286
|
};
|
|
268
287
|
if (onEdit) props.onEdit = onEdit;
|
|
269
288
|
return withKey(msg.id, MessageClient(props));
|
|
270
289
|
}), [
|
|
271
290
|
messages,
|
|
272
291
|
onEdit,
|
|
273
|
-
queue
|
|
292
|
+
queue,
|
|
293
|
+
branches
|
|
274
294
|
]);
|
|
275
295
|
const handleCancelRun = () => {
|
|
276
296
|
queue?.clear("cancel-run");
|
|
@@ -289,6 +309,7 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
289
309
|
queue
|
|
290
310
|
}));
|
|
291
311
|
const hasQueue = !!queue;
|
|
312
|
+
const hasBranches = !!branches;
|
|
292
313
|
const state = useMemo(() => {
|
|
293
314
|
const messageStates = messageClients.state.map((s, idx, arr) => ({
|
|
294
315
|
...s,
|
|
@@ -301,13 +322,14 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
301
322
|
isRunning,
|
|
302
323
|
capabilities: {
|
|
303
324
|
edit: false,
|
|
325
|
+
delete: false,
|
|
304
326
|
reload: false,
|
|
305
327
|
cancel: isRunning,
|
|
306
328
|
speech: false,
|
|
307
329
|
attachments: false,
|
|
308
330
|
feedback: false,
|
|
309
331
|
voice: false,
|
|
310
|
-
switchToBranch:
|
|
332
|
+
switchToBranch: hasBranches,
|
|
311
333
|
switchBranchDuringRun: false,
|
|
312
334
|
unstable_copy: false,
|
|
313
335
|
dictation: false,
|
|
@@ -325,6 +347,7 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
325
347
|
messages,
|
|
326
348
|
isRunning,
|
|
327
349
|
hasQueue,
|
|
350
|
+
hasBranches,
|
|
328
351
|
messageClients.state,
|
|
329
352
|
composerClient.state
|
|
330
353
|
]);
|
|
@@ -358,6 +381,7 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
358
381
|
if (queue) queue.enqueue(appendMessage, { steer: false });
|
|
359
382
|
else onNew?.(appendMessage);
|
|
360
383
|
},
|
|
384
|
+
deleteMessage: () => {},
|
|
361
385
|
startRun: () => {
|
|
362
386
|
onStartRun?.();
|
|
363
387
|
},
|
|
@@ -382,8 +406,9 @@ const ExternalThread = resource(function ExternalThread({ messages, isRunning =
|
|
|
382
406
|
muteVoice: () => {},
|
|
383
407
|
unmuteVoice: () => {}
|
|
384
408
|
};
|
|
385
|
-
}
|
|
386
|
-
|
|
409
|
+
};
|
|
410
|
+
const ExternalThread = resource(useExternalThread);
|
|
411
|
+
attachTransformScopes(useExternalThread, (scopes, parent) => {
|
|
387
412
|
if (!scopes.threads && parent.threads.source === null) {
|
|
388
413
|
const threadElement = scopes.thread;
|
|
389
414
|
scopes.threads = SingleThreadList({ thread: threadElement });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalThread.js","names":[],"sources":["../../src/client/ExternalThread.ts"],"sourcesContent":["import { useState, useMemo, useEffect, useEffectEvent } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport {\n type ClientElement,\n type ClientOutput,\n useClientLookup,\n attachTransformScopes,\n useClientResource,\n Derived,\n} from \"@assistant-ui/store\";\n\nimport type {\n AppendMessage,\n Attachment,\n CreateAttachment,\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n ExternalThreadQueueAdapter,\n} from \"@assistant-ui/core\";\nimport type { QueueItemState } from \"@assistant-ui/core/store\";\nimport type { ComposerSendOptions } from \"@assistant-ui/core/store\";\nimport { ModelContext, Suggestions } from \"@assistant-ui/core/store\";\nimport { Tools, DataRenderers } from \"@assistant-ui/core/react\";\nimport { SingleThreadList } from \"./SingleThreadList\";\n\nconst EMPTY_QUEUE_ITEMS: readonly QueueItemState[] = [];\n\nexport type ExternalThreadMessage = ThreadMessage & {\n id: string;\n};\n\nexport type ExternalThreadProps = {\n messages: readonly ExternalThreadMessage[];\n isRunning?: boolean;\n /**\n * Whether sending new messages is currently disabled. When `true`, the\n * thread composer's input remains usable but `send()` is a no-op and\n * `composer.canSend` is `false`. Edit composers (saving message edits)\n * intentionally ignore this flag.\n */\n isSendDisabled?: boolean;\n /**\n * Callback for new messages (non-queue runtimes).\n * @note Unused when `queue` is provided — new messages are routed through `queue.enqueue` instead.\n */\n onNew?: (message: AppendMessage) => void;\n onEdit?: (message: AppendMessage) => void;\n onReload?: (parentId: string | null) => void;\n onStartRun?: () => void;\n onCancel?: () => void;\n /** Queue adapter for runtimes that support message queuing and steering. */\n queue?: ExternalThreadQueueAdapter;\n};\n\ntype MessageClientProps = {\n message: ExternalThreadMessage;\n index: number;\n onEdit?: (message: AppendMessage) => void;\n onReload?: () => void;\n queue?: ExternalThreadQueueAdapter | undefined;\n};\n\n// Message Client - minimal implementation\nconst MessageClient = resource(function MessageClient({\n message,\n index,\n onEdit,\n onReload,\n queue,\n}: MessageClientProps): ClientOutput<\"message\"> {\n const [isCopied, setIsCopied] = useState(false);\n const [isHovering, setIsHovering] = useState(false);\n const [isEditing, setIsEditing] = useState(false);\n\n const partClients = useClientLookup(\n () =>\n message.content.map((part, idx) => withKey(idx, PartResource({ part }))),\n [message.content],\n );\n\n const attachmentClients = useClientLookup(\n () =>\n (message.attachments ?? []).map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {},\n }),\n ),\n ),\n [message.attachments],\n );\n\n const handleBeginEdit = () => {\n setIsEditing(true);\n };\n\n const handleCancelEdit = () => {\n setIsEditing(false);\n };\n\n const handleSendEdit = (msg: AppendMessage) => {\n queue?.clear(\"edit\");\n onEdit?.({\n ...msg,\n parentId: message.id,\n sourceId: message.id,\n });\n setIsEditing(false);\n };\n\n const composerClient = useClientResource(\n ComposerClientResource({\n type: \"edit\",\n isEditing,\n canCancel: true,\n onCancel: handleCancelEdit,\n onBeginEdit: handleBeginEdit,\n onSend: handleSendEdit,\n message,\n queue,\n }),\n );\n\n const state = useMemo(() => {\n return {\n ...message,\n attachments: message.attachments ?? [],\n parentId: null,\n isLast: false, // Will be set by thread\n branchNumber: 1,\n branchCount: 1,\n speech: undefined,\n parts: partClients.state,\n isCopied,\n isHovering,\n index,\n composer: composerClient.state,\n };\n }, [\n message,\n isCopied,\n isHovering,\n index,\n composerClient.state,\n partClients.state,\n ]);\n\n return {\n getState: () => state,\n composer: () => composerClient.methods,\n reload: () => {\n onReload?.();\n },\n speak: () => {},\n stopSpeaking: () => {},\n submitFeedback: () => {},\n switchToBranch: () => {},\n getCopyText: () =>\n message.content.map((c) => (\"text\" in c ? c.text : \"\")).join(\"\"),\n part: (selector) => {\n if (\"index\" in selector) {\n return partClients.get(selector);\n }\n const partIndex = state.parts.findIndex(\n (p) => p.type === \"tool-call\" && p.toolCallId === selector.toolCallId,\n );\n return partClients.get({ index: partIndex });\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachmentClients.get({ key: selector.id });\n }\n return attachmentClients.get(selector);\n },\n setIsCopied,\n setIsHovering,\n };\n});\n\ntype PartResourceProps = {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n};\n\n// Part Client - minimal implementation\nconst PartResource = resource(function PartResource({\n part,\n}: PartResourceProps): ClientOutput<\"part\"> {\n const state = useMemo(\n () => ({\n ...part,\n status: { type: \"complete\" as const },\n }),\n [part],\n );\n\n return {\n getState: () => state,\n addToolResult: () => {},\n resumeToolCall: () => {},\n respondToToolApproval: () => {},\n };\n});\n\ntype AttachmentResourceProps = {\n attachment: Attachment;\n onRemove?: () => void;\n};\n\n// Attachment Client - minimal implementation\nconst AttachmentResource = resource(function AttachmentResource({\n attachment,\n onRemove,\n}: AttachmentResourceProps): ClientOutput<\"attachment\"> {\n return {\n getState: () => attachment,\n remove: async () => {\n onRemove?.();\n },\n };\n});\n\ntype ComposerClientResourceProps = {\n type: \"thread\" | \"edit\";\n isEditing: boolean;\n canCancel: boolean;\n isSendDisabled?: boolean;\n onCancel: () => void;\n onBeginEdit?: () => void;\n onSend?: (message: AppendMessage) => void;\n message?: ExternalThreadMessage;\n queue?: ExternalThreadQueueAdapter | undefined;\n};\n\nconst QueueItemClient = resource(function QueueItemClient({\n item,\n onSteer,\n onRemove,\n}: {\n item: QueueItemState;\n onSteer: () => void;\n onRemove: () => void;\n}): ClientOutput<\"queueItem\"> {\n return {\n getState: () => item,\n steer: onSteer,\n remove: onRemove,\n };\n});\n\n// Composer Client - minimal implementation\nconst ComposerClientResource = resource(function ComposerClientResource({\n type,\n isEditing,\n canCancel,\n isSendDisabled = false,\n onCancel,\n onBeginEdit,\n onSend,\n message,\n queue,\n}: ComposerClientResourceProps): ClientOutput<\"composer\"> {\n const [text, setText] = useState(\"\");\n const [role, setRole] = useState<\"user\" | \"assistant\" | \"system\">(\"user\");\n const [runConfig, setRunConfig] = useState<Record<string, unknown>>({});\n const [attachments, setAttachments] = useState<readonly Attachment[]>([]);\n const [quote, setQuote] = useState<\n { readonly text: string; readonly messageId: string } | undefined\n >(undefined);\n\n // Update composer values when editing begins\n const updateFromMessage = useEffectEvent(() => {\n if (message) {\n // Extract text from message content (text parts only)\n const textParts = message.content.filter((part) => part.type === \"text\");\n const messageText = textParts\n .map((part) => (\"text\" in part ? part.text : \"\"))\n .join(\"\\n\\n\");\n\n setText(messageText);\n setRole(message.role);\n setAttachments(message.attachments ?? []);\n }\n });\n\n useEffect(() => {\n if (isEditing) {\n updateFromMessage();\n }\n }, [isEditing]);\n\n const attachmentClients = useClientLookup(\n () =>\n attachments.map((attachment, idx) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {\n setAttachments(attachments.filter((_, i) => i !== idx));\n },\n }),\n ),\n ),\n [attachments],\n );\n\n const queueItems = queue?.items ?? EMPTY_QUEUE_ITEMS;\n const queueItemClients = useClientLookup(\n () =>\n queueItems.map((item) =>\n withKey(\n item.id,\n QueueItemClient({\n item,\n onSteer: () => queue?.steer(item.id),\n onRemove: () => queue?.remove(item.id),\n }),\n ),\n ),\n [queueItems],\n );\n\n const state = useMemo(() => {\n const isEmpty = !text.trim() && !attachments.length;\n return {\n text,\n role,\n attachments: attachmentClients.state,\n runConfig,\n isEditing,\n canCancel,\n canSend: isEditing && !isEmpty && !isSendDisabled,\n attachmentAccept: \"*\",\n isEmpty,\n type,\n dictation: undefined,\n quote,\n queue: queueItems,\n };\n }, [\n text,\n role,\n attachmentClients.state,\n runConfig,\n isEditing,\n canCancel,\n isSendDisabled,\n type,\n attachments.length,\n quote,\n queueItems,\n ]);\n\n return {\n getState: () => state,\n setText,\n setRole,\n setRunConfig,\n addAttachment: async (fileOrAttachment: File | CreateAttachment) => {\n if (fileOrAttachment instanceof File) {\n const newAttachment: Attachment = {\n id: Math.random().toString(36).substring(7),\n type: \"file\",\n name: fileOrAttachment.name,\n contentType: fileOrAttachment.type,\n file: fileOrAttachment,\n status: { type: \"complete\" },\n content: [],\n };\n setAttachments([...attachments, newAttachment]);\n } else {\n const newAttachment: Attachment = {\n id: fileOrAttachment.id ?? Math.random().toString(36).substring(7),\n type: fileOrAttachment.type ?? \"document\",\n name: fileOrAttachment.name,\n contentType: fileOrAttachment.contentType,\n content: fileOrAttachment.content,\n status: { type: \"complete\" },\n };\n setAttachments([...attachments, newAttachment]);\n }\n },\n clearAttachments: async () => {\n setAttachments([]);\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachmentClients.get({ key: selector.id });\n }\n return attachmentClients.get(selector);\n },\n reset: async () => {\n setText(\"\");\n setRole(\"user\");\n setRunConfig({});\n setAttachments([]);\n setQuote(undefined);\n },\n send: (opts?: ComposerSendOptions) => {\n if (!state.canSend) return;\n\n const currentQuote = quote;\n const composedMessage: AppendMessage = {\n role,\n content: text ? [{ type: \"text\" as const, text }] : [],\n attachments: attachments as any,\n createdAt: new Date(),\n parentId: null,\n sourceId: null,\n runConfig,\n startRun: opts?.startRun,\n metadata: {\n custom: { ...(currentQuote ? { quote: currentQuote } : {}) },\n },\n };\n if (queue) {\n queue.enqueue(composedMessage, { steer: opts?.steer ?? false });\n } else {\n onSend?.(composedMessage);\n }\n setText(\"\");\n setAttachments([]);\n setQuote(undefined);\n },\n cancel: onCancel,\n beginEdit: () => {\n onBeginEdit?.();\n },\n startDictation: () => {},\n stopDictation: () => {},\n setQuote,\n queueItem: (selector: { index: number }) => {\n return queueItemClients.get(selector);\n },\n };\n});\n\n// External Thread Client\nexport const ExternalThread = resource(function ExternalThread({\n messages,\n isRunning = false,\n isSendDisabled = false,\n onNew,\n onEdit,\n onReload,\n onStartRun,\n onCancel,\n queue,\n}: ExternalThreadProps): ClientOutput<\"thread\"> {\n const handleReload = (messageId: string) => {\n const messageIndex = messages.findIndex((m) => m.id === messageId);\n if (messageIndex === -1) return;\n\n const parentId = messageIndex > 0 ? messages[messageIndex - 1]!.id : null;\n queue?.clear(\"reload\");\n onReload?.(parentId);\n };\n\n const messageClients = useClientLookup(\n () =>\n messages.map((msg, index) => {\n const props: MessageClientProps = {\n message: msg,\n index,\n onReload: () => handleReload(msg.id),\n queue,\n };\n if (onEdit) props.onEdit = onEdit;\n return withKey(msg.id, MessageClient(props));\n }),\n [messages, onEdit, queue],\n );\n\n const handleCancelRun = () => {\n queue?.clear(\"cancel-run\");\n onCancel?.();\n };\n\n const handleSendNew = (message: AppendMessage) => {\n onNew?.(message);\n };\n\n const composerClient = useClientResource(\n ComposerClientResource({\n type: \"thread\",\n isEditing: true,\n canCancel: isRunning,\n isSendDisabled,\n onCancel: handleCancelRun,\n onSend: handleSendNew,\n queue,\n }),\n );\n\n const hasQueue = !!queue;\n const state = useMemo(() => {\n const messageStates = messageClients.state.map((s, idx, arr) => ({\n ...s,\n isLast: idx === arr.length - 1,\n }));\n\n return {\n isEmpty: messages.length === 0,\n isDisabled: false,\n isLoading: false,\n isRunning,\n capabilities: {\n edit: false,\n reload: false,\n cancel: isRunning,\n speech: false,\n attachments: false,\n feedback: false,\n voice: false,\n switchToBranch: false,\n switchBranchDuringRun: false,\n unstable_copy: false,\n dictation: false,\n queue: hasQueue,\n },\n messages: messageStates,\n state: {},\n suggestions: [],\n extras: undefined,\n speech: undefined,\n voice: undefined,\n composer: composerClient.state,\n };\n }, [\n messages,\n isRunning,\n hasQueue,\n messageClients.state,\n composerClient.state,\n ]);\n\n return {\n getState: () => state,\n composer: () => composerClient.methods,\n append: (message) => {\n const appendMessage: AppendMessage =\n typeof message === \"string\"\n ? {\n createdAt: new Date(),\n parentId: messages.at(-1)?.id ?? null,\n sourceId: null,\n runConfig: {},\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n metadata: { custom: {} },\n }\n : {\n createdAt: message.createdAt ?? new Date(),\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n sourceId: message.sourceId ?? null,\n role: message.role ?? \"user\",\n content: message.content,\n attachments: message.attachments ?? [],\n metadata: message.metadata ?? { custom: {} },\n runConfig: message.runConfig ?? {},\n startRun: message.startRun,\n };\n if (queue) {\n queue.enqueue(appendMessage, { steer: false });\n } else {\n onNew?.(appendMessage);\n }\n },\n startRun: () => {\n onStartRun?.();\n },\n resumeRun: () => {},\n cancelRun: handleCancelRun,\n getModelContext: () => ({ tools: {}, config: {} }),\n export: () => ({ messages: [] }),\n import: () => {},\n reset: () => {},\n message: (selector) => {\n if (\"id\" in selector) {\n return messageClients.get({ key: selector.id });\n }\n return messageClients.get(selector);\n },\n stopSpeaking: () => {},\n connectVoice: () => {},\n disconnectVoice: () => {},\n getVoiceVolume: () => 0,\n subscribeVoiceVolume: () => () => {},\n muteVoice: () => {},\n unmuteVoice: () => {},\n };\n});\n\nattachTransformScopes(ExternalThread, (scopes, parent) => {\n if (!scopes.threads && parent.threads.source === null) {\n const threadElement = scopes.thread as ClientElement<\"thread\">;\n scopes.threads = SingleThreadList({ thread: threadElement });\n scopes.thread = Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n }\n\n if (!scopes.threadListItem && parent.threadListItem.source === null) {\n scopes.threadListItem = Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n }\n\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.thread().composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.tools && parent.tools.source === null) {\n scopes.tools = Tools({});\n }\n if (!scopes.dataRenderers && parent.dataRenderers.source === null) {\n scopes.dataRenderers = DataRenderers();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n});\n"],"mappings":";;;;;;;AA0BA,MAAM,oBAA+C,CAAC;AAsCtD,MAAM,gBAAgB,SAA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AAW,MAC3C,OAAO,QAAQ,MAAM,CAAC,CAAC;CAEzB,IAAI,CAAC,OAAO,iBAAiB,OAAO,cAAc,WAAW,MAC3D,OAAO,gBAAgB,cAAc;CAEvC,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,WAAW,MACvD,OAAO,cAAc,YAAY;AAErC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ExternalThread.js","names":[],"sources":["../../src/client/ExternalThread.ts"],"sourcesContent":["import { useState, useMemo, useEffect, useEffectEvent } from \"react\";\nimport { resource, withKey } from \"@assistant-ui/tap\";\nimport {\n type ClientElement,\n type ClientOutput,\n useClientLookup,\n attachTransformScopes,\n useClientResource,\n Derived,\n} from \"@assistant-ui/store\";\n\nimport type {\n AppendMessage,\n Attachment,\n CreateAttachment,\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n ExternalThreadQueueAdapter,\n ExternalThreadBranchAdapter,\n} from \"@assistant-ui/core\";\nimport type { QueueItemState } from \"@assistant-ui/core/store\";\nimport type { ComposerSendOptions } from \"@assistant-ui/core/store\";\nimport { getThreadMessageText } from \"@assistant-ui/core/internal\";\nimport { ModelContext, Suggestions } from \"@assistant-ui/core/store\";\nimport { Tools, DataRenderers } from \"@assistant-ui/core/react\";\nimport { SingleThreadList } from \"./SingleThreadList\";\n\nconst EMPTY_QUEUE_ITEMS: readonly QueueItemState[] = [];\nconst EMPTY_BRANCH_IDS: readonly string[] = [];\n\nexport type ExternalThreadMessage = ThreadMessage & {\n id: string;\n};\n\nexport type ExternalThreadProps = {\n messages: readonly ExternalThreadMessage[];\n isRunning?: boolean;\n /**\n * Whether sending new messages is currently disabled. When `true`, the\n * thread composer's input remains usable but `send()` is a no-op and\n * `composer.canSend` is `false`. Edit composers (saving message edits)\n * intentionally ignore this flag.\n */\n isSendDisabled?: boolean;\n /**\n * Callback for new messages (non-queue runtimes).\n * @note Unused when `queue` is provided — new messages are routed through `queue.enqueue` instead.\n */\n onNew?: (message: AppendMessage) => void;\n onEdit?: (message: AppendMessage) => void;\n onReload?: (parentId: string | null) => void;\n onStartRun?: () => void;\n onCancel?: () => void;\n /** Queue adapter for runtimes that support message queuing and steering. */\n queue?: ExternalThreadQueueAdapter;\n /** Branch adapter for runtimes that track sibling variants of messages. */\n branches?: ExternalThreadBranchAdapter;\n};\n\ntype MessageClientProps = {\n message: ExternalThreadMessage;\n index: number;\n onEdit?: (message: AppendMessage) => void;\n onReload?: () => void;\n queue?: ExternalThreadQueueAdapter | undefined;\n branches?: ExternalThreadBranchAdapter | undefined;\n};\n\n// Message Client - minimal implementation\nconst useMessageClient = ({\n message,\n index,\n onEdit,\n onReload,\n queue,\n branches,\n}: MessageClientProps): ClientOutput<\"message\"> => {\n const [isCopied, setIsCopied] = useState(false);\n const [isHovering, setIsHovering] = useState(false);\n const [isEditing, setIsEditing] = useState(false);\n\n const partClients = useClientLookup(\n () =>\n message.content.map((part, idx) => withKey(idx, PartResource({ part }))),\n [message.content],\n );\n\n const attachmentClients = useClientLookup(\n () =>\n (message.attachments ?? []).map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {},\n }),\n ),\n ),\n [message.attachments],\n );\n\n const handleBeginEdit = () => {\n setIsEditing(true);\n };\n\n const handleCancelEdit = () => {\n setIsEditing(false);\n };\n\n const handleSendEdit = (msg: AppendMessage) => {\n queue?.clear(\"edit\");\n onEdit?.({\n ...msg,\n parentId: message.id,\n sourceId: message.id,\n });\n setIsEditing(false);\n };\n\n const composerClient = useClientResource(\n ComposerClientResource({\n type: \"edit\",\n isEditing,\n canCancel: true,\n onCancel: handleCancelEdit,\n onBeginEdit: handleBeginEdit,\n onSend: handleSendEdit,\n message,\n queue,\n }),\n );\n\n const branchIds = branches?.getBranches(message.id) ?? EMPTY_BRANCH_IDS;\n const branchIndex = branchIds.indexOf(message.id);\n const branchNumber = branchIndex === -1 ? 1 : branchIndex + 1;\n const branchCount = branchIndex === -1 ? 1 : branchIds.length;\n\n const state = useMemo(() => {\n return {\n ...message,\n attachments: message.attachments ?? [],\n parentId: null,\n isLast: false, // Will be set by thread\n branchNumber,\n branchCount,\n speech: undefined,\n parts: partClients.state,\n isCopied,\n isHovering,\n index,\n composer: composerClient.state,\n };\n }, [\n message,\n isCopied,\n isHovering,\n index,\n composerClient.state,\n partClients.state,\n branchNumber,\n branchCount,\n ]);\n\n return {\n getState: () => state,\n composer: () => composerClient.methods,\n delete: () => {},\n reload: () => {\n onReload?.();\n },\n speak: () => {},\n stopSpeaking: () => {},\n submitFeedback: () => {},\n switchToBranch: ({ position, branchId }) => {\n if (!branches) return;\n const target =\n branchId ??\n (branchIndex === -1\n ? undefined\n : position === \"previous\"\n ? branchIds[branchIndex - 1]\n : position === \"next\"\n ? branchIds[branchIndex + 1]\n : undefined);\n if (target !== undefined && target !== message.id)\n branches.switchToBranch(target);\n },\n getCopyText: () => getThreadMessageText(message),\n part: (selector) => {\n if (\"index\" in selector) {\n return partClients.get(selector);\n }\n const partIndex = state.parts.findIndex(\n (p) => p.type === \"tool-call\" && p.toolCallId === selector.toolCallId,\n );\n return partClients.get({ index: partIndex });\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachmentClients.get({ key: selector.id });\n }\n return attachmentClients.get(selector);\n },\n setIsCopied,\n setIsHovering,\n };\n};\n\nconst MessageClient = resource(useMessageClient);\n\ntype PartResourceProps = {\n part: ThreadAssistantMessagePart | ThreadUserMessagePart;\n};\n\n// Part Client - minimal implementation\nconst usePartResource = ({ part }: PartResourceProps): ClientOutput<\"part\"> => {\n const state = useMemo(\n () => ({\n ...part,\n status: { type: \"complete\" as const },\n }),\n [part],\n );\n\n return {\n getState: () => state,\n addToolResult: () => {},\n resumeToolCall: () => {},\n respondToToolApproval: () => {},\n };\n};\n\nconst PartResource = resource(usePartResource);\n\ntype AttachmentResourceProps = {\n attachment: Attachment;\n onRemove?: () => void;\n};\n\n// Attachment Client - minimal implementation\nconst useAttachmentResource = ({\n attachment,\n onRemove,\n}: AttachmentResourceProps): ClientOutput<\"attachment\"> => {\n return {\n getState: () => attachment,\n remove: async () => {\n onRemove?.();\n },\n };\n};\n\nconst AttachmentResource = resource(useAttachmentResource);\n\ntype ComposerClientResourceProps = {\n type: \"thread\" | \"edit\";\n isEditing: boolean;\n canCancel: boolean;\n isSendDisabled?: boolean;\n onCancel: () => void;\n onBeginEdit?: () => void;\n onSend?: (message: AppendMessage) => void;\n message?: ExternalThreadMessage;\n queue?: ExternalThreadQueueAdapter | undefined;\n};\n\nconst useQueueItemClient = ({\n item,\n onSteer,\n onRemove,\n}: {\n item: QueueItemState;\n onSteer: () => void;\n onRemove: () => void;\n}): ClientOutput<\"queueItem\"> => {\n return {\n getState: () => item,\n steer: onSteer,\n remove: onRemove,\n };\n};\n\nconst QueueItemClient = resource(useQueueItemClient);\n\n// Composer Client - minimal implementation\nconst useComposerClientResource = ({\n type,\n isEditing,\n canCancel,\n isSendDisabled = false,\n onCancel,\n onBeginEdit,\n onSend,\n message,\n queue,\n}: ComposerClientResourceProps): ClientOutput<\"composer\"> => {\n const [text, setText] = useState(\"\");\n const [role, setRole] = useState<\"user\" | \"assistant\" | \"system\">(\"user\");\n const [runConfig, setRunConfig] = useState<Record<string, unknown>>({});\n const [attachments, setAttachments] = useState<readonly Attachment[]>([]);\n const [quote, setQuote] = useState<\n { readonly text: string; readonly messageId: string } | undefined\n >(undefined);\n\n // Update composer values when editing begins\n const updateFromMessage = useEffectEvent(() => {\n if (message) {\n // Extract text from message content (text parts only)\n const textParts = message.content.filter((part) => part.type === \"text\");\n const messageText = textParts\n .map((part) => (\"text\" in part ? part.text : \"\"))\n .join(\"\\n\\n\");\n\n setText(messageText);\n setRole(message.role);\n setAttachments(message.attachments ?? []);\n }\n });\n\n useEffect(() => {\n if (isEditing) {\n updateFromMessage();\n }\n }, [isEditing]);\n\n const attachmentClients = useClientLookup(\n () =>\n attachments.map((attachment, idx) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {\n setAttachments(attachments.filter((_, i) => i !== idx));\n },\n }),\n ),\n ),\n [attachments],\n );\n\n const queueItems = queue?.items ?? EMPTY_QUEUE_ITEMS;\n const queueItemClients = useClientLookup(\n () =>\n queueItems.map((item) =>\n withKey(\n item.id,\n QueueItemClient({\n item,\n onSteer: () => queue?.steer(item.id),\n onRemove: () => queue?.remove(item.id),\n }),\n ),\n ),\n [queueItems],\n );\n\n const state = useMemo(() => {\n const isEmpty = !text.trim() && !attachments.length;\n return {\n text,\n role,\n attachments: attachmentClients.state,\n runConfig,\n isEditing,\n canCancel,\n canSend: isEditing && !isEmpty && !isSendDisabled,\n attachmentAccept: \"*\",\n isEmpty,\n type,\n dictation: undefined,\n quote,\n queue: queueItems,\n };\n }, [\n text,\n role,\n attachmentClients.state,\n runConfig,\n isEditing,\n canCancel,\n isSendDisabled,\n type,\n attachments.length,\n quote,\n queueItems,\n ]);\n\n return {\n getState: () => state,\n setText,\n setRole,\n setRunConfig,\n addAttachment: async (fileOrAttachment: File | CreateAttachment) => {\n if (fileOrAttachment instanceof File) {\n const newAttachment: Attachment = {\n id: Math.random().toString(36).substring(7),\n type: \"file\",\n name: fileOrAttachment.name,\n contentType: fileOrAttachment.type,\n file: fileOrAttachment,\n status: { type: \"complete\" },\n content: [],\n };\n setAttachments([...attachments, newAttachment]);\n } else {\n const newAttachment: Attachment = {\n id: fileOrAttachment.id ?? Math.random().toString(36).substring(7),\n type: fileOrAttachment.type ?? \"document\",\n name: fileOrAttachment.name,\n contentType: fileOrAttachment.contentType,\n content: fileOrAttachment.content,\n status: { type: \"complete\" },\n };\n setAttachments([...attachments, newAttachment]);\n }\n },\n clearAttachments: async () => {\n setAttachments([]);\n },\n attachment: (selector) => {\n if (\"id\" in selector) {\n return attachmentClients.get({ key: selector.id });\n }\n return attachmentClients.get(selector);\n },\n reset: async () => {\n setText(\"\");\n setRole(\"user\");\n setRunConfig({});\n setAttachments([]);\n setQuote(undefined);\n },\n send: (opts?: ComposerSendOptions) => {\n if (!state.canSend) return;\n\n const currentQuote = quote;\n const composedMessage: AppendMessage = {\n role,\n content: text ? [{ type: \"text\" as const, text }] : [],\n attachments: attachments as any,\n createdAt: new Date(),\n parentId: null,\n sourceId: null,\n runConfig,\n startRun: opts?.startRun,\n metadata: {\n custom: { ...(currentQuote ? { quote: currentQuote } : {}) },\n },\n };\n if (queue) {\n queue.enqueue(composedMessage, { steer: opts?.steer ?? false });\n } else {\n onSend?.(composedMessage);\n }\n setText(\"\");\n setAttachments([]);\n setQuote(undefined);\n },\n cancel: onCancel,\n beginEdit: () => {\n onBeginEdit?.();\n },\n startDictation: () => {},\n stopDictation: () => {},\n setQuote,\n queueItem: (selector: { index: number }) => {\n return queueItemClients.get(selector);\n },\n };\n};\n\nconst ComposerClientResource = resource(useComposerClientResource);\n\n// External Thread Client\nconst useExternalThread = ({\n messages,\n isRunning = false,\n isSendDisabled = false,\n onNew,\n onEdit,\n onReload,\n onStartRun,\n onCancel,\n queue,\n branches,\n}: ExternalThreadProps): ClientOutput<\"thread\"> => {\n const handleReload = (messageId: string) => {\n const messageIndex = messages.findIndex((m) => m.id === messageId);\n if (messageIndex === -1) return;\n\n const parentId = messageIndex > 0 ? messages[messageIndex - 1]!.id : null;\n queue?.clear(\"reload\");\n onReload?.(parentId);\n };\n\n const messageClients = useClientLookup(\n () =>\n messages.map((msg, index) => {\n const props: MessageClientProps = {\n message: msg,\n index,\n onReload: () => handleReload(msg.id),\n queue,\n branches,\n };\n if (onEdit) props.onEdit = onEdit;\n return withKey(msg.id, MessageClient(props));\n }),\n [messages, onEdit, queue, branches],\n );\n\n const handleCancelRun = () => {\n queue?.clear(\"cancel-run\");\n onCancel?.();\n };\n\n const handleSendNew = (message: AppendMessage) => {\n onNew?.(message);\n };\n\n const composerClient = useClientResource(\n ComposerClientResource({\n type: \"thread\",\n isEditing: true,\n canCancel: isRunning,\n isSendDisabled,\n onCancel: handleCancelRun,\n onSend: handleSendNew,\n queue,\n }),\n );\n\n const hasQueue = !!queue;\n const hasBranches = !!branches;\n const state = useMemo(() => {\n const messageStates = messageClients.state.map((s, idx, arr) => ({\n ...s,\n isLast: idx === arr.length - 1,\n }));\n\n return {\n isEmpty: messages.length === 0,\n isDisabled: false,\n isLoading: false,\n isRunning,\n capabilities: {\n edit: false,\n delete: false,\n reload: false,\n cancel: isRunning,\n speech: false,\n attachments: false,\n feedback: false,\n voice: false,\n switchToBranch: hasBranches,\n switchBranchDuringRun: false,\n unstable_copy: false,\n dictation: false,\n queue: hasQueue,\n },\n messages: messageStates,\n state: {},\n suggestions: [],\n extras: undefined,\n speech: undefined,\n voice: undefined,\n composer: composerClient.state,\n };\n }, [\n messages,\n isRunning,\n hasQueue,\n hasBranches,\n messageClients.state,\n composerClient.state,\n ]);\n\n return {\n getState: () => state,\n composer: () => composerClient.methods,\n append: (message) => {\n const appendMessage: AppendMessage =\n typeof message === \"string\"\n ? {\n createdAt: new Date(),\n parentId: messages.at(-1)?.id ?? null,\n sourceId: null,\n runConfig: {},\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n metadata: { custom: {} },\n }\n : {\n createdAt: message.createdAt ?? new Date(),\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n sourceId: message.sourceId ?? null,\n role: message.role ?? \"user\",\n content: message.content,\n attachments: message.attachments ?? [],\n metadata: message.metadata ?? { custom: {} },\n runConfig: message.runConfig ?? {},\n startRun: message.startRun,\n };\n if (queue) {\n queue.enqueue(appendMessage, { steer: false });\n } else {\n onNew?.(appendMessage);\n }\n },\n deleteMessage: () => {},\n startRun: () => {\n onStartRun?.();\n },\n resumeRun: () => {},\n cancelRun: handleCancelRun,\n getModelContext: () => ({ tools: {}, config: {} }),\n export: () => ({ messages: [] }),\n import: () => {},\n reset: () => {},\n message: (selector) => {\n if (\"id\" in selector) {\n return messageClients.get({ key: selector.id });\n }\n return messageClients.get(selector);\n },\n stopSpeaking: () => {},\n connectVoice: () => {},\n disconnectVoice: () => {},\n getVoiceVolume: () => 0,\n subscribeVoiceVolume: () => () => {},\n muteVoice: () => {},\n unmuteVoice: () => {},\n };\n};\n\nexport const ExternalThread = resource(useExternalThread);\n\nattachTransformScopes(useExternalThread, (scopes, parent) => {\n if (!scopes.threads && parent.threads.source === null) {\n const threadElement = scopes.thread as ClientElement<\"thread\">;\n scopes.threads = SingleThreadList({ thread: threadElement });\n scopes.thread = Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n }\n\n if (!scopes.threadListItem && parent.threadListItem.source === null) {\n scopes.threadListItem = Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n }\n\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.thread().composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.tools && parent.tools.source === null) {\n scopes.tools = Tools({});\n }\n if (!scopes.dataRenderers && parent.dataRenderers.source === null) {\n scopes.dataRenderers = DataRenderers();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,oBAA+C,CAAC;AACtD,MAAM,mBAAsC,CAAC;AAyC7C,MAAM,oBAAoB,EACxB,SACA,OACA,QACA,UACA,OACA,eACiD;CACjD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAEhD,MAAM,cAAc,sBAEhB,QAAQ,QAAQ,KAAK,MAAM,QAAQ,QAAQ,KAAK,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,GACzE,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,oBAAoB,uBAErB,QAAQ,eAAe,CAAC,EAAA,CAAG,KAAK,eAC/B,QACE,WAAW,IACX,mBAAmB;EACjB;EACA,gBAAgB,CA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O,aAAa,WAAW,MACzD,OAAO,eAAe,aAAa;CAErC,IAAI,CAAC,OAAO,SAAS,OAAO,MAAM,WAAW,MAC3C,OAAO,QAAQ,MAAM,CAAC,CAAC;CAEzB,IAAI,CAAC,OAAO,iBAAiB,OAAO,cAAc,WAAW,MAC3D,OAAO,gBAAgB,cAAc;CAEvC,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,WAAW,MACvD,OAAO,cAAc,YAAY;AAErC,CAAC"}
|
|
@@ -7,7 +7,7 @@ type InMemoryThreadListProps = {
|
|
|
7
7
|
onSwitchToThread?: (threadId: string) => void;
|
|
8
8
|
onSwitchToNewThread?: () => void;
|
|
9
9
|
};
|
|
10
|
-
declare const InMemoryThreadList: (
|
|
10
|
+
declare const InMemoryThreadList: import("@assistant-ui/tap").Resource<ClientOutput<"threads">, [props: InMemoryThreadListProps]>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { InMemoryThreadList, InMemoryThreadListProps };
|
|
13
13
|
//# sourceMappingURL=InMemoryThreadList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryThreadList.d.ts","names":[],"sources":["../../src/client/InMemoryThreadList.ts"],"mappings":";;;;KAeY,uBAAA;EACV,MAAA,GAAS,QAAA,aAAqB,eAAe,CAAC,YAAA;EAC9C,gBAAA,IAAoB,QAAA;EACpB,mBAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"InMemoryThreadList.d.ts","names":[],"sources":["../../src/client/InMemoryThreadList.ts"],"mappings":";;;;KAeY,uBAAA;EACV,MAAA,GAAS,QAAA,aAAqB,eAAe,CAAC,YAAA;EAC9C,gBAAA,IAAoB,QAAA;EACpB,mBAAA;AAAA;AAAA,cA4KW,kBAAA,8BAAkB,QAAA,CAAA,YAAA,cAAA,KAAA,EAAA,uBAAA"}
|
|
@@ -5,7 +5,7 @@ import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
|
5
5
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
6
6
|
//#region src/client/InMemoryThreadList.ts
|
|
7
7
|
const RESOLVED_PROMISE = Promise.resolve();
|
|
8
|
-
const
|
|
8
|
+
const useThreadListItemClient = (props) => {
|
|
9
9
|
const { data, onSwitchTo, onUpdateCustom, onArchive, onUnarchive, onDelete } = props;
|
|
10
10
|
const state = useMemo(() => ({
|
|
11
11
|
id: data.id,
|
|
@@ -35,8 +35,9 @@ const ThreadListItemClient = resource(function ThreadListItemClient(props) {
|
|
|
35
35
|
}),
|
|
36
36
|
detach: () => {}
|
|
37
37
|
};
|
|
38
|
-
}
|
|
39
|
-
const
|
|
38
|
+
};
|
|
39
|
+
const ThreadListItemClient = resource(useThreadListItemClient);
|
|
40
|
+
const useInMemoryThreadList = (props) => {
|
|
40
41
|
const { thread: threadFactory, onSwitchToThread, onSwitchToNewThread } = props;
|
|
41
42
|
const [mainThreadId, setMainThreadId] = useState("main");
|
|
42
43
|
const [threads, setThreads] = useState(() => [{
|
|
@@ -129,8 +130,9 @@ const InMemoryThreadList = resource(function InMemoryThreadList(props) {
|
|
|
129
130
|
},
|
|
130
131
|
thread: () => mainThreadClient.methods
|
|
131
132
|
};
|
|
132
|
-
}
|
|
133
|
-
|
|
133
|
+
};
|
|
134
|
+
const InMemoryThreadList = resource(useInMemoryThreadList);
|
|
135
|
+
attachTransformScopes(useInMemoryThreadList, (scopes, parent) => {
|
|
134
136
|
scopes.thread ??= Derived({
|
|
135
137
|
source: "threads",
|
|
136
138
|
query: { type: "main" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryThreadList.js","names":[],"sources":["../../src/client/InMemoryThreadList.ts"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport { resource, withKey, type ResourceElement } from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n useClientLookup,\n Derived,\n attachTransformScopes,\n useClientResource,\n} from \"@assistant-ui/store\";\n\nimport { ModelContext, Suggestions } from \"@assistant-ui/core/store\";\nimport { Tools, DataRenderers } from \"@assistant-ui/core/react\";\n\nconst RESOLVED_PROMISE = Promise.resolve();\n\nexport type InMemoryThreadListProps = {\n thread: (threadId: string) => ResourceElement<ClientOutput<\"thread\">>;\n onSwitchToThread?: (threadId: string) => void;\n onSwitchToNewThread?: () => void;\n};\n\ntype ThreadData = {\n id: string;\n title?: string;\n status: \"regular\" | \"archived\";\n custom?: Record<string, unknown> | undefined;\n};\n\n// ThreadListItem Client\nconst
|
|
1
|
+
{"version":3,"file":"InMemoryThreadList.js","names":[],"sources":["../../src/client/InMemoryThreadList.ts"],"sourcesContent":["import { useState, useMemo } from \"react\";\nimport { resource, withKey, type ResourceElement } from \"@assistant-ui/tap\";\nimport {\n type ClientOutput,\n useClientLookup,\n Derived,\n attachTransformScopes,\n useClientResource,\n} from \"@assistant-ui/store\";\n\nimport { ModelContext, Suggestions } from \"@assistant-ui/core/store\";\nimport { Tools, DataRenderers } from \"@assistant-ui/core/react\";\n\nconst RESOLVED_PROMISE = Promise.resolve();\n\nexport type InMemoryThreadListProps = {\n thread: (threadId: string) => ResourceElement<ClientOutput<\"thread\">>;\n onSwitchToThread?: (threadId: string) => void;\n onSwitchToNewThread?: () => void;\n};\n\ntype ThreadData = {\n id: string;\n title?: string;\n status: \"regular\" | \"archived\";\n custom?: Record<string, unknown> | undefined;\n};\n\n// ThreadListItem Client\nconst useThreadListItemClient = (props: {\n data: ThreadData;\n onSwitchTo: () => void;\n onUpdateCustom: (custom: Record<string, unknown> | undefined) => void;\n onArchive: () => void;\n onUnarchive: () => void;\n onDelete: () => void;\n}): ClientOutput<\"threadListItem\"> => {\n const { data, onSwitchTo, onUpdateCustom, onArchive, onUnarchive, onDelete } =\n props;\n const state = useMemo(\n () => ({\n id: data.id,\n remoteId: undefined,\n externalId: undefined,\n title: data.title,\n status: data.status,\n custom: data.custom,\n }),\n [data.id, data.title, data.status, data.custom],\n );\n\n return {\n getState: () => state,\n switchTo: onSwitchTo,\n rename: () => {},\n updateCustom: onUpdateCustom,\n archive: onArchive,\n unarchive: onUnarchive,\n delete: onDelete,\n generateTitle: () => {},\n initialize: async () => ({ remoteId: data.id, externalId: undefined }),\n detach: () => {},\n };\n};\n\nconst ThreadListItemClient = resource(useThreadListItemClient);\n\n// InMemoryThreadList Client\nconst useInMemoryThreadList = (\n props: InMemoryThreadListProps,\n): ClientOutput<\"threads\"> => {\n const {\n thread: threadFactory,\n onSwitchToThread,\n onSwitchToNewThread,\n } = props;\n\n const [mainThreadId, setMainThreadId] = useState(\"main\");\n const [threads, setThreads] = useState<readonly ThreadData[]>(() => [\n { id: \"main\", title: \"Main Thread\", status: \"regular\" },\n ]);\n\n const handleSwitchToThread = (threadId: string) => {\n setMainThreadId(threadId);\n onSwitchToThread?.(threadId);\n };\n\n const handleArchive = (threadId: string) => {\n setThreads((prev) =>\n prev.map((t) =>\n t.id === threadId ? { ...t, status: \"archived\" as const } : t,\n ),\n );\n };\n\n const handleUnarchive = (threadId: string) => {\n setThreads((prev) =>\n prev.map((t) =>\n t.id === threadId ? { ...t, status: \"regular\" as const } : t,\n ),\n );\n };\n\n const handleUpdateCustom = (\n threadId: string,\n custom: Record<string, unknown> | undefined,\n ) => {\n setThreads((prev) =>\n prev.map((t) => (t.id === threadId ? { ...t, custom } : t)),\n );\n };\n\n const handleDelete = (threadId: string) => {\n setThreads((prev) => prev.filter((t) => t.id !== threadId));\n if (mainThreadId === threadId) {\n const remaining = threads.filter((t) => t.id !== threadId);\n setMainThreadId(remaining[0]?.id || \"main\");\n }\n };\n\n const handleSwitchToNewThread = () => {\n const newId = `thread-${Date.now()}`;\n setThreads((prev) => [\n ...prev,\n { id: newId, title: \"New Thread\", status: \"regular\" },\n ]);\n setMainThreadId(newId);\n onSwitchToNewThread?.();\n };\n\n const threadListItems = useClientLookup(\n () =>\n threads.map((t) =>\n withKey(\n t.id,\n ThreadListItemClient({\n data: t,\n onSwitchTo: () => handleSwitchToThread(t.id),\n onUpdateCustom: (custom) => handleUpdateCustom(t.id, custom),\n onArchive: () => handleArchive(t.id),\n onUnarchive: () => handleUnarchive(t.id),\n onDelete: () => handleDelete(t.id),\n }),\n ),\n ),\n [threads],\n );\n\n // Create the main thread\n const mainThreadClient = useClientResource(threadFactory(mainThreadId));\n\n const state = useMemo(() => {\n const regularThreads = threads.filter((t) => t.status === \"regular\");\n const archivedThreads = threads.filter((t) => t.status === \"archived\");\n\n return {\n mainThreadId,\n newThreadId: null,\n isLoading: false,\n isLoadingMore: false,\n hasMore: false,\n threadIds: regularThreads.map((t) => t.id),\n archivedThreadIds: archivedThreads.map((t) => t.id),\n threadItems: threadListItems.state,\n main: mainThreadClient.state,\n };\n }, [mainThreadId, threads, threadListItems.state, mainThreadClient.state]);\n\n return {\n getState: () => state,\n switchToThread: handleSwitchToThread,\n switchToNewThread: handleSwitchToNewThread,\n getLoadThreadsPromise: () => RESOLVED_PROMISE,\n reload: () => RESOLVED_PROMISE,\n loadMore: () => RESOLVED_PROMISE,\n item: (selector) => {\n if (selector === \"main\") {\n const index = threads.findIndex((t) => t.id === mainThreadId);\n return threadListItems.get({ index: index === -1 ? 0 : index });\n }\n if (\"id\" in selector) {\n const index = threads.findIndex((t) => t.id === selector.id);\n return threadListItems.get({ index });\n }\n return threadListItems.get(selector);\n },\n thread: () => mainThreadClient.methods,\n };\n};\n\nexport const InMemoryThreadList = resource(useInMemoryThreadList);\n\nattachTransformScopes(useInMemoryThreadList, (scopes, parent) => {\n scopes.thread ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().thread(\"main\"),\n });\n scopes.threadListItem ??= Derived({\n source: \"threads\",\n query: { type: \"main\" },\n get: (aui) => aui.threads().item(\"main\"),\n });\n scopes.composer ??= Derived({\n source: \"thread\",\n query: {},\n get: (aui) => aui.threads().thread(\"main\").composer(),\n });\n\n if (!scopes.modelContext && parent.modelContext.source === null) {\n scopes.modelContext = ModelContext();\n }\n if (!scopes.tools && parent.tools.source === null) {\n scopes.tools = Tools({});\n }\n if (!scopes.dataRenderers && parent.dataRenderers.source === null) {\n scopes.dataRenderers = DataRenderers();\n }\n if (!scopes.suggestions && parent.suggestions.source === null) {\n scopes.suggestions = Suggestions();\n }\n});\n"],"mappings":";;;;;;AAaA,MAAM,mBAAmB,QAAQ,QAAQ;AAgBzC,MAAM,2BAA2B,UAOK;CACpC,MAAM,EAAE,MAAM,YAAY,gBAAgB,WAAW,aAAa,aAChE;CACF,MAAM,QAAQ,eACL;EACL,IAAI,KAAK;EACT,UAAU,KAAA;EACV,YAAY,KAAA;EACZ,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,QAAQ,KAAK;CACf,IACA;EAAC,KAAK;EAAI,KAAK;EAAO,KAAK;EAAQ,KAAK;CAAM,CAChD;CAEA,OAAO;EACL,gBAAgB;EAChB,UAAU;EACV,cAAc,CAAC;EACf,cAAc;EACd,SAAS;EACT,WAAW;EACX,QAAQ;EACR,qBAAqB,CAAC;EACtB,YAAY,aAAa;GAAE,UAAU,KAAK;GAAI,YAAY,KAAA;EAAU;EACpE,cAAc,CAAC;CACjB;AACF;AAEA,MAAM,uBAAuB,SAAS,uBAAuB;AAG7D,MAAM,yBACJ,UAC4B;CAC5B,MAAM,EACJ,QAAQ,eACR,kBACA,wBACE;CAEJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CACvD,MAAM,CAAC,SAAS,cAAc,eAAsC,CAClE;EAAE,IAAI;EAAQ,OAAO;EAAe,QAAQ;CAAU,CACxD,CAAC;CAED,MAAM,wBAAwB,aAAqB;EACjD,gBAAgB,QAAQ;EACxB,mBAAmB,QAAQ;CAC7B;CAEA,MAAM,iBAAiB,aAAqB;EAC1C,YAAY,SACV,KAAK,KAAK,MACR,EAAE,OAAO,WAAW;GAAE,GAAG;GAAG,QAAQ;EAAoB,IAAI,CAC9D,CACF;CACF;CAEA,MAAM,mBAAmB,aAAqB;EAC5C,YAAY,SACV,KAAK,KAAK,MACR,EAAE,OAAO,WAAW;GAAE,GAAG;GAAG,QAAQ;EAAmB,IAAI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,OAAO,cAAc,WAAW,MAC3D,OAAO,gBAAgB,cAAc;CAEvC,IAAI,CAAC,OAAO,eAAe,OAAO,YAAY,WAAW,MACvD,OAAO,cAAc,YAAY;AAErC,CAAC"}
|
|
@@ -4,12 +4,7 @@ import { ClientElement, ClientOutput } from "@assistant-ui/store";
|
|
|
4
4
|
type SingleThreadListProps = {
|
|
5
5
|
thread: ClientElement<"thread">;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
* A minimal threads scope that wraps a single thread.
|
|
9
|
-
* Automatically provided by ExternalThread when no threads scope exists.
|
|
10
|
-
* Mounts the provided thread resource element.
|
|
11
|
-
*/
|
|
12
|
-
declare const SingleThreadList: (props: SingleThreadListProps) => import("@assistant-ui/tap").ResourceElement<ClientOutput<"threads">, SingleThreadListProps>;
|
|
7
|
+
declare const SingleThreadList: import("@assistant-ui/tap").Resource<ClientOutput<"threads">, [SingleThreadListProps]>;
|
|
13
8
|
//#endregion
|
|
14
9
|
export { SingleThreadList };
|
|
15
10
|
//# sourceMappingURL=SingleThreadList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleThreadList.d.ts","names":[],"sources":["../../src/client/SingleThreadList.ts"],"mappings":";;;KAqCK,qBAAA;EACH,MAAA,EAAQ,aAAa;AAAA
|
|
1
|
+
{"version":3,"file":"SingleThreadList.d.ts","names":[],"sources":["../../src/client/SingleThreadList.ts"],"mappings":";;;KAqCK,qBAAA;EACH,MAAA,EAAQ,aAAa;AAAA;AAAA,cAuEV,gBAAA,8BAAgB,QAAA,CAAA,YAAA,cAAA,qBAAA"}
|
|
@@ -4,7 +4,7 @@ import { resource } from "@assistant-ui/tap";
|
|
|
4
4
|
//#region src/client/SingleThreadList.ts
|
|
5
5
|
const RESOLVED_PROMISE = Promise.resolve();
|
|
6
6
|
const THREAD_ID = "default";
|
|
7
|
-
const
|
|
7
|
+
const useSingleThreadListItem = () => {
|
|
8
8
|
const [custom, setCustom] = useState();
|
|
9
9
|
return {
|
|
10
10
|
getState: () => ({
|
|
@@ -28,13 +28,14 @@ const SingleThreadListItem = resource(function SingleThreadListItem() {
|
|
|
28
28
|
}),
|
|
29
29
|
detach: () => {}
|
|
30
30
|
};
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
|
+
const SingleThreadListItem = resource(useSingleThreadListItem);
|
|
32
33
|
/**
|
|
33
34
|
* A minimal threads scope that wraps a single thread.
|
|
34
35
|
* Automatically provided by ExternalThread when no threads scope exists.
|
|
35
36
|
* Mounts the provided thread resource element.
|
|
36
37
|
*/
|
|
37
|
-
const
|
|
38
|
+
const useSingleThreadList = ({ thread }) => {
|
|
38
39
|
const itemClient = useClientResource(SingleThreadListItem());
|
|
39
40
|
const threadClient = useClientResource(thread);
|
|
40
41
|
const state = useMemo(() => ({
|
|
@@ -68,7 +69,8 @@ const SingleThreadList = resource(function SingleThreadList({ thread }) {
|
|
|
68
69
|
return threadClient.methods;
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
|
-
}
|
|
72
|
+
};
|
|
73
|
+
const SingleThreadList = resource(useSingleThreadList);
|
|
72
74
|
//#endregion
|
|
73
75
|
export { SingleThreadList };
|
|
74
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleThreadList.js","names":[],"sources":["../../src/client/SingleThreadList.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport {\n type ClientElement,\n type ClientOutput,\n useClientResource,\n} from \"@assistant-ui/store\";\n\nconst RESOLVED_PROMISE = Promise.resolve();\nconst THREAD_ID = \"default\";\n\nconst
|
|
1
|
+
{"version":3,"file":"SingleThreadList.js","names":[],"sources":["../../src/client/SingleThreadList.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport {\n type ClientElement,\n type ClientOutput,\n useClientResource,\n} from \"@assistant-ui/store\";\n\nconst RESOLVED_PROMISE = Promise.resolve();\nconst THREAD_ID = \"default\";\n\nconst useSingleThreadListItem = (): ClientOutput<\"threadListItem\"> => {\n const [custom, setCustom] = useState<Record<string, unknown> | undefined>();\n\n return {\n getState: () => ({\n id: THREAD_ID,\n remoteId: undefined,\n externalId: undefined,\n title: undefined,\n status: \"regular\",\n custom,\n }),\n switchTo: () => {},\n rename: () => {},\n updateCustom: setCustom,\n archive: () => {},\n unarchive: () => {},\n delete: () => {},\n generateTitle: () => {},\n initialize: async () => ({ remoteId: THREAD_ID, externalId: undefined }),\n detach: () => {},\n };\n};\n\nconst SingleThreadListItem = resource(useSingleThreadListItem);\n\ntype SingleThreadListProps = {\n thread: ClientElement<\"thread\">;\n};\n\n/**\n * A minimal threads scope that wraps a single thread.\n * Automatically provided by ExternalThread when no threads scope exists.\n * Mounts the provided thread resource element.\n */\nconst useSingleThreadList = ({\n thread,\n}: SingleThreadListProps): ClientOutput<\"threads\"> => {\n const itemClient = useClientResource(SingleThreadListItem());\n const threadClient = useClientResource(thread);\n\n const state = useMemo(\n () => ({\n mainThreadId: THREAD_ID,\n newThreadId: null,\n isLoading: false,\n isLoadingMore: false,\n hasMore: false,\n threadIds: [THREAD_ID],\n archivedThreadIds: [],\n threadItems: [itemClient.state],\n main: threadClient.state,\n }),\n [itemClient.state, threadClient.state],\n );\n\n return {\n getState: () => state,\n switchToThread: () => {\n throw new Error(\"SingleThreadList does not support switchToThread\");\n },\n switchToNewThread: () => {\n throw new Error(\"SingleThreadList does not support switchToNewThread\");\n },\n getLoadThreadsPromise: () => RESOLVED_PROMISE,\n reload: () => RESOLVED_PROMISE,\n loadMore: () => RESOLVED_PROMISE,\n item: (selector) => {\n if (\n selector !== \"main\" &&\n !(\n typeof selector === \"object\" &&\n \"id\" in selector &&\n selector.id === THREAD_ID\n ) &&\n !(\n typeof selector === \"object\" &&\n \"index\" in selector &&\n selector.index === 0\n )\n ) {\n throw new Error(\n `SingleThreadList: unknown item selector ${JSON.stringify(selector)}`,\n );\n }\n return itemClient.methods;\n },\n thread: (selector) => {\n if (selector !== \"main\" && selector !== THREAD_ID) {\n throw new Error(\n `SingleThreadList: unknown thread selector ${JSON.stringify(selector)}`,\n );\n }\n return threadClient.methods;\n },\n };\n};\n\nexport const SingleThreadList = resource(useSingleThreadList);\n"],"mappings":";;;;AAQA,MAAM,mBAAmB,QAAQ,QAAQ;AACzC,MAAM,YAAY;AAElB,MAAM,gCAAgE;CACpE,MAAM,CAAC,QAAQ,aAAa,SAA8C;CAE1E,OAAO;EACL,iBAAiB;GACf,IAAI;GACJ,UAAU,KAAA;GACV,YAAY,KAAA;GACZ,OAAO,KAAA;GACP,QAAQ;GACR;EACF;EACA,gBAAgB,CAAC;EACjB,cAAc,CAAC;EACf,cAAc;EACd,eAAe,CAAC;EAChB,iBAAiB,CAAC;EAClB,cAAc,CAAC;EACf,qBAAqB,CAAC;EACtB,YAAY,aAAa;GAAE,UAAU;GAAW,YAAY,KAAA;EAAU;EACtE,cAAc,CAAC;CACjB;AACF;AAEA,MAAM,uBAAuB,SAAS,uBAAuB;;;;;;AAW7D,MAAM,uBAAuB,EAC3B,aACoD;CACpD,MAAM,aAAa,kBAAkB,qBAAqB,CAAC;CAC3D,MAAM,eAAe,kBAAkB,MAAM;CAE7C,MAAM,QAAQ,eACL;EACL,cAAc;EACd,aAAa;EACb,WAAW;EACX,eAAe;EACf,SAAS;EACT,WAAW,CAAC,SAAS;EACrB,mBAAmB,CAAC;EACpB,aAAa,CAAC,WAAW,KAAK;EAC9B,MAAM,aAAa;CACrB,IACA,CAAC,WAAW,OAAO,aAAa,KAAK,CACvC;CAEA,OAAO;EACL,gBAAgB;EAChB,sBAAsB;GACpB,MAAM,IAAI,MAAM,kDAAkD;EACpE;EACA,yBAAyB;GACvB,MAAM,IAAI,MAAM,qDAAqD;EACvE;EACA,6BAA6B;EAC7B,cAAc;EACd,gBAAgB;EAChB,OAAO,aAAa;GAClB,IACE,aAAa,UACb,EACE,OAAO,aAAa,YACpB,QAAQ,YACR,SAAS,OAAO,cAElB,EACE,OAAO,aAAa,YACpB,WAAW,YACX,SAAS,UAAU,IAGrB,MAAM,IAAI,MACR,2CAA2C,KAAK,UAAU,QAAQ,GACpE;GAEF,OAAO,WAAW;EACpB;EACA,SAAS,aAAa;GACpB,IAAI,aAAa,UAAU,aAAa,WACtC,MAAM,IAAI,MACR,6CAA6C,KAAK,UAAU,QAAQ,GACtE;GAEF,OAAO,aAAa;EACtB;CACF;AACF;AAEA,MAAa,mBAAmB,SAAS,mBAAmB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ import { RegisteredTrigger, useTriggerPopoverRootContext, useTriggerPopoverRootC
|
|
|
49
49
|
import { useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional } from "./primitives/composer/trigger/TriggerPopover.js";
|
|
50
50
|
import { composer_d_exports } from "./primitives/composer.js";
|
|
51
51
|
import { queueItem_d_exports } from "./primitives/queueItem.js";
|
|
52
|
+
import { SmoothOptions, useSmooth } from "./utils/smooth/useSmooth.js";
|
|
52
53
|
import { messagePart_d_exports } from "./primitives/messagePart.js";
|
|
53
54
|
import { error_d_exports } from "./primitives/error.js";
|
|
54
55
|
import { message_d_exports } from "./primitives/message.js";
|
|
@@ -69,6 +70,7 @@ import { useScrollLock } from "./primitives/reasoning/useScrollLock.js";
|
|
|
69
70
|
import { ToolExecutionStatus, internal_d_exports } from "./internal.js";
|
|
70
71
|
import { Unstable_IconComponent, Unstable_Mention, Unstable_MentionCategory, Unstable_MentionDirective, Unstable_ModelContextToolsOptions, Unstable_UseMentionAdapterOptions, unstable_useMentionAdapter } from "./unstable/useMentionAdapter.js";
|
|
71
72
|
import { Unstable_SlashCommand, Unstable_SlashCommandAction, Unstable_UseSlashCommandAdapterOptions, unstable_useSlashCommandAdapter } from "./unstable/useSlashCommandAdapter.js";
|
|
73
|
+
import { Unstable_ComposerInputHistory, unstable_useComposerInputHistory } from "./unstable/useComposerInputHistory.js";
|
|
72
74
|
import { McpAppDisplayMode, McpAppHostContext, McpAppHostInfo, McpAppMetadata, McpAppResource, McpAppResourceCSP, McpAppResourceMeta, McpAppSandboxConfig, McpAppToolCallParams, McpAppsHost, McpAppsRemoteHostOptions, ToolCallMessagePartMcpMetadata } from "./mcp-apps/types.js";
|
|
73
75
|
import { McpAppRenderer, McpAppRendererOptions } from "./mcp-apps/McpAppRenderer.js";
|
|
74
76
|
import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
|
|
@@ -76,7 +78,7 @@ import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
|
|
|
76
78
|
import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
77
79
|
import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, EnrichedPartState, FileMessagePartComponent, FileMessagePartProps, GenerativeUIComponentRegistry, GenerativeUIMessagePartComponent, GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, GenerativeUIRenderProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpAppResourceOutput, McpToolkitDefinition, PartState, ProviderToolConfig, QuoteMessagePartComponent, QuoteMessagePartProps, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
78
80
|
import { AssistantCloud } from "assistant-cloud";
|
|
79
|
-
import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolCallMessagePart, ToolCallMessagePartStatus, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
|
|
81
|
+
import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolCallMessagePart, ToolCallMessagePartStatus, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
|
|
80
82
|
import { Tool } from "assistant-stream";
|
|
81
83
|
import { ChainOfThoughtClient, ComposerSendOptions, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
|
|
82
|
-
export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useMentionAdapter, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
84
|
+
export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useComposerInputHistory, unstable_useMentionAdapter, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|