@assistant-ui/react 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +42 -47
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/legacy-runtime/cloud/auiV0.d.ts +24 -2
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +24 -5
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
- package/package.json +3 -3
- package/src/client/ExternalThread.ts +4 -16
- package/src/index.ts +1 -0
- package/src/legacy-runtime/cloud/auiV0.ts +51 -12
- package/src/tests/external-thread-parity.test.tsx +108 -16
|
@@ -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":";;;;KAqDY,wBAAwB;EAClC;;KAgBU;EACV,mBAAmB;EACnB;EACA;EACA,QAAQ;EACR;;;;;;;EAOA;;;;;EAKA,SAAS,SAAS;EAClB,UAAU,SAAS;EACnB,YAAY;EACZ;EACA;EACA;EACA,oBAAoB,SAAS;;EAE7B,qBAAqB,SAAS;EAC9B,wBAAwB;EACxB,oBAAoB;;EAEpB,QAAQ;;EAER,WAAW;;EAEX,2BAA2B,SAAS;;cAw0BzB,4CAAc,SAAA,yBAAA"}
|
|
@@ -6,20 +6,14 @@ import { useEffect, useEffectEvent, useRef, useState } from "@assistant-ui/tap/r
|
|
|
6
6
|
import { ToolResponse } from "assistant-stream";
|
|
7
7
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
8
8
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
9
|
-
import { fileMatchesAccept, getThreadMessageText, isCreateAttachment, resolveToolApprovalResponse } from "@assistant-ui/core/internal";
|
|
9
|
+
import { fileMatchesAccept, getThreadMessageText, isCreateAttachment, resolveToolApprovalResponse, toMessagePartStatus } from "@assistant-ui/core/internal";
|
|
10
10
|
//#region src/client/ExternalThread.ts
|
|
11
11
|
const EMPTY_QUEUE_ITEMS = [];
|
|
12
12
|
const EMPTY_BRANCH_IDS = [];
|
|
13
13
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
14
14
|
const derivePartStatus = (message, partIndex, part) => {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
if (!part.result) return message.status;
|
|
18
|
-
return COMPLETE_STATUS;
|
|
19
|
-
}
|
|
20
|
-
const isLastPart = partIndex === Math.max(0, message.content.length - 1);
|
|
21
|
-
if (message.status.type === "requires-action") return COMPLETE_STATUS;
|
|
22
|
-
return isLastPart ? message.status : COMPLETE_STATUS;
|
|
15
|
+
if (!message.status) return COMPLETE_STATUS;
|
|
16
|
+
return toMessagePartStatus(message, partIndex, part);
|
|
23
17
|
};
|
|
24
18
|
const useMessageClient = (t0) => {
|
|
25
19
|
const $ = c(65);
|
|
@@ -255,26 +249,27 @@ const MessageClient = resource(useMessageClient);
|
|
|
255
249
|
const usePartResource = (t0) => {
|
|
256
250
|
const $ = c(20);
|
|
257
251
|
const { part, status, messageId, onRespondToToolApproval, onAddToolResult, onResumeToolCall } = t0;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
252
|
+
const t1 = status;
|
|
253
|
+
let t2;
|
|
254
|
+
if ($[0] !== part || $[1] !== t1) {
|
|
255
|
+
t2 = {
|
|
261
256
|
...part,
|
|
262
|
-
status
|
|
257
|
+
status: t1
|
|
263
258
|
};
|
|
264
259
|
$[0] = part;
|
|
265
|
-
$[1] =
|
|
266
|
-
$[2] =
|
|
267
|
-
} else
|
|
268
|
-
const state =
|
|
269
|
-
let
|
|
260
|
+
$[1] = t1;
|
|
261
|
+
$[2] = t2;
|
|
262
|
+
} else t2 = $[2];
|
|
263
|
+
const state = t2;
|
|
264
|
+
let t3;
|
|
270
265
|
if ($[3] !== state) {
|
|
271
|
-
|
|
266
|
+
t3 = () => state;
|
|
272
267
|
$[3] = state;
|
|
273
|
-
$[4] =
|
|
274
|
-
} else
|
|
275
|
-
let
|
|
268
|
+
$[4] = t3;
|
|
269
|
+
} else t3 = $[4];
|
|
270
|
+
let t4;
|
|
276
271
|
if ($[5] !== messageId || $[6] !== onAddToolResult || $[7] !== part) {
|
|
277
|
-
|
|
272
|
+
t4 = (result) => {
|
|
278
273
|
if (!onAddToolResult) throw new Error("Runtime does not support tool results (onAddToolResult is not set).");
|
|
279
274
|
if (part.type !== "tool-call") throw new Error("Tried to add tool result on non-tool message part");
|
|
280
275
|
const response = ToolResponse.toResponse(result);
|
|
@@ -291,11 +286,11 @@ const usePartResource = (t0) => {
|
|
|
291
286
|
$[5] = messageId;
|
|
292
287
|
$[6] = onAddToolResult;
|
|
293
288
|
$[7] = part;
|
|
294
|
-
$[8] =
|
|
295
|
-
} else
|
|
296
|
-
let
|
|
289
|
+
$[8] = t4;
|
|
290
|
+
} else t4 = $[8];
|
|
291
|
+
let t5;
|
|
297
292
|
if ($[9] !== onResumeToolCall || $[10] !== part) {
|
|
298
|
-
|
|
293
|
+
t5 = (payload) => {
|
|
299
294
|
if (!onResumeToolCall) throw new Error("Runtime does not support resuming tool calls (onResumeToolCall is not set).");
|
|
300
295
|
if (part.type !== "tool-call") throw new Error("Tried to resume tool call on non-tool message part");
|
|
301
296
|
onResumeToolCall({
|
|
@@ -305,11 +300,11 @@ const usePartResource = (t0) => {
|
|
|
305
300
|
};
|
|
306
301
|
$[9] = onResumeToolCall;
|
|
307
302
|
$[10] = part;
|
|
308
|
-
$[11] =
|
|
309
|
-
} else
|
|
310
|
-
let
|
|
303
|
+
$[11] = t5;
|
|
304
|
+
} else t5 = $[11];
|
|
305
|
+
let t6;
|
|
311
306
|
if ($[12] !== onRespondToToolApproval || $[13] !== part) {
|
|
312
|
-
|
|
307
|
+
t6 = (response_0) => {
|
|
313
308
|
if (!onRespondToToolApproval) throw new Error("Runtime does not support tool approvals.");
|
|
314
309
|
if (part.type !== "tool-call") throw new Error("Tried to respond to tool approval on non-tool message part");
|
|
315
310
|
if (!part.approval || part.approval.approved !== void 0 || part.approval.resolution !== void 0) throw new Error("Tool call has no pending approval");
|
|
@@ -317,23 +312,23 @@ const usePartResource = (t0) => {
|
|
|
317
312
|
};
|
|
318
313
|
$[12] = onRespondToToolApproval;
|
|
319
314
|
$[13] = part;
|
|
320
|
-
$[14] =
|
|
321
|
-
} else
|
|
322
|
-
let
|
|
323
|
-
if ($[15] !==
|
|
324
|
-
|
|
325
|
-
getState:
|
|
326
|
-
addToolResult:
|
|
327
|
-
resumeToolCall:
|
|
328
|
-
respondToToolApproval:
|
|
315
|
+
$[14] = t6;
|
|
316
|
+
} else t6 = $[14];
|
|
317
|
+
let t7;
|
|
318
|
+
if ($[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
319
|
+
t7 = {
|
|
320
|
+
getState: t3,
|
|
321
|
+
addToolResult: t4,
|
|
322
|
+
resumeToolCall: t5,
|
|
323
|
+
respondToToolApproval: t6
|
|
329
324
|
};
|
|
330
|
-
$[15] =
|
|
331
|
-
$[16] =
|
|
332
|
-
$[17] =
|
|
333
|
-
$[18] =
|
|
334
|
-
$[19] =
|
|
335
|
-
} else
|
|
336
|
-
return
|
|
325
|
+
$[15] = t3;
|
|
326
|
+
$[16] = t4;
|
|
327
|
+
$[17] = t5;
|
|
328
|
+
$[18] = t6;
|
|
329
|
+
$[19] = t7;
|
|
330
|
+
} else t7 = $[19];
|
|
331
|
+
return t7;
|
|
337
332
|
};
|
|
338
333
|
const PartResource = resource(usePartResource);
|
|
339
334
|
const useAttachmentResource = ({ attachment, onRemove }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalThread.js","names":["useState","useMemo","useEffect","useEffectEvent","useCallback","useRef","resource","withKey","ClientElement","ClientOutput","useClientLookup","attachTransformScopes","useClientResource","Derived","AddToolResultOptions","AppendMessage","Attachment","AttachmentAdapter","CreateAttachment","PendingAttachment","RespondToToolApprovalOptions","ResumeToolCallOptions","MessagePartStatus","ThreadAssistantMessagePart","ThreadUserMessagePart","ThreadMessage","ToolCallMessagePartStatus","ExternalThreadQueueAdapter","ExternalThreadBranchAdapter","ToolResponse","ReadonlyJSONValue","QueueItemState","ComposerSendOptions","fileMatchesAccept","getThreadMessageText","isCreateAttachment","resolveToolApprovalResponse","ModelContext","Suggestions","Tools","DataRenderers","SingleThreadList","EMPTY_QUEUE_ITEMS","EMPTY_BRANCH_IDS","ExternalThreadMessage","id","COMPLETE_STATUS","Object","freeze","type","derivePartStatus","message","partIndex","part","role","status","result","isLastPart","Math","max","content","length","ExternalThreadProps","messages","isRunning","isLoading","state","extras","isSendDisabled","onNew","onEdit","onReload","parentId","onStartRun","onCancel","onResume","onAddToolResult","options","onResumeToolCall","onLoadExternalState","attachmentAdapter","queue","branches","onRespondToToolApproval","MessageClientProps","index","useMessageClient","t0","$","_c","isCopied","setIsCopied","isHovering","setIsHovering","isEditing","setIsEditing","t1","map","idx","PartResource","messageId","partClients","t2","attachments","t3","_temp2","attachmentClients","t4","Symbol","for","handleBeginEdit","t5","handleCancelEdit","t6","msg","clear","sourceId","handleSendEdit","t7","ComposerClientResource","canCancel","onBeginEdit","onSend","composerClient","branchIds","t8","getBranches","indexOf","branchIndex","branchNumber","branchCount","t9","t10","isLast","speech","undefined","parts","composer","t11","t12","methods","t13","t14","t15","position","branchId","target","switchToBranch","t16","selector","get","findIndex","p","toolCallId","t17","selector_0","key","t18","getState","delete","_temp3","reload","speak","_temp4","stopSpeaking","_temp5","submitFeedback","_temp6","getCopyText","attachment","MessageClient","PartResourceProps","usePartResource","Error","response","toResponse","toolName","isError","artifact","modelContent","payload","response_0","approval","approved","resolution","addToolResult","resumeToolCall","respondToToolApproval","AttachmentResourceProps","onRemove","Promise","useAttachmentResource","remove","AttachmentResource","ComposerClientResourceProps","useQueueItemClient","item","onSteer","steer","QueueItemClient","drainAdapterAdd","ReturnType","upsert","asyncIterator","useLiveState","initial","setState","ref","next","current","prev","T","set","const","useComposerClientResource","text","setText","textRef","setRole","roleRef","runConfig","setRunConfig","runConfigRef","setAttachments","attachmentsRef","quote","setQuote","quoteRef","textParts","filter","_temp7","messageText","_temp8","join","updateFromMessage","a","removed","all","_temp9","a_1","removePendingAttachments","attachment_0","prev_0","a_2","upsertAttachment","queueItems","items","queueItemClients","accept","trim","isEmpty","canSend","attachmentAccept","dictation","fileOrAttachment","file","name","contentType","add","newAttachment","random","toString","substring","prev_1","newAttachment_0","prev_2","removed_0","t19","removed_1","t20","opts","currentQuote","currentText","currentAttachments","isEmpty_0","dispatch","sendAttachments","composedMessage","createdAt","Date","startRun","metadata","custom","enqueue","attachment_1","send","then","error","prev_3","prev_4","prev_5","console","t21","t22","t23","addAttachment","clearAttachments","reset","cancel","beginEdit","startDictation","_temp0","stopDictation","_temp1","queueItem","dedupeMessagesById","seenIds","Set","deduped","i","has","warn","push","reverse","useExternalThread","messagesProp","threadState","messageIndex","m","handleReload","props","messageClients","handleCancelRun","at","handleSendNew","headId","message_0","composerQueue","hasQueue","hasBranches","hasEdit","hasReload","hasAttachments","_temp10","messageStates","edit","feedback","voice","switchBranchDuringRun","unstable_copy","isDisabled","capabilities","suggestions","message_1","appendMessage","state_0","t24","t25","append","deleteMessage","_temp11","resumeRun","cancelRun","importExternalState","getModelContext","_temp12","export","_temp13","import","_temp14","_temp15","_temp16","connectVoice","_temp17","disconnectVoice","_temp18","getVoiceVolume","_temp19","subscribeVoiceVolume","_temp21","muteVoice","_temp22","unmuteVoice","_temp23","ExternalThread","scopes","parent","threads","source","threadElement","thread","query","aui","threadListItem","modelContext","tools","dataRenderers","_temp","part_0","a_0","s","arr","config","_temp20"],"sources":["../../src/client/ExternalThread.ts"],"sourcesContent":["import {\n useState,\n useMemo,\n useEffect,\n useEffectEvent,\n useCallback,\n useRef,\n} 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 AddToolResultOptions,\n AppendMessage,\n Attachment,\n AttachmentAdapter,\n CreateAttachment,\n PendingAttachment,\n RespondToToolApprovalOptions,\n ResumeToolCallOptions,\n MessagePartStatus,\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n ToolCallMessagePartStatus,\n ExternalThreadQueueAdapter,\n ExternalThreadBranchAdapter,\n} from \"@assistant-ui/core\";\nimport { ToolResponse } from \"assistant-stream\";\nimport type { ReadonlyJSONValue } from \"assistant-stream/utils\";\nimport type { QueueItemState } from \"@assistant-ui/core/store\";\nimport type { ComposerSendOptions } from \"@assistant-ui/core/store\";\nimport {\n fileMatchesAccept,\n getThreadMessageText,\n isCreateAttachment,\n resolveToolApprovalResponse,\n} 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\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\n// Legacy runtime parity (toMessagePartStatus): a tool call without a result\n// carries its message's status; the last part of a streaming message streams.\nconst derivePartStatus = (\n message: ExternalThreadMessage,\n partIndex: number,\n part: ThreadAssistantMessagePart | ThreadUserMessagePart,\n): ToolCallMessagePartStatus => {\n if (message.role !== \"assistant\" || !message.status) return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) return message.status as ToolCallMessagePartStatus;\n return COMPLETE_STATUS;\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as MessagePartStatus) : COMPLETE_STATUS;\n};\n\nexport type ExternalThreadProps = {\n messages: readonly ExternalThreadMessage[];\n isRunning?: boolean;\n isLoading?: boolean | undefined;\n state?: ReadonlyJSONValue | undefined;\n extras?: unknown;\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 onResume?: (() => void) | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n /** Callback for resuming a tool call that is waiting for human input. */\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n onLoadExternalState?: ((state: unknown) => void) | undefined;\n attachmentAdapter?: AttachmentAdapter | undefined;\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 /** Callback for tool approval decisions. Absent: responding to an approval throws a capability error. */\n onRespondToToolApproval?: (options: RespondToToolApprovalOptions) => void;\n};\n\ntype MessageClientProps = {\n message: ExternalThreadMessage;\n index: number;\n parentId: string | null;\n onEdit?: (message: AppendMessage) => void;\n onReload?: () => void;\n queue?: ExternalThreadQueueAdapter | undefined;\n branches?: ExternalThreadBranchAdapter | undefined;\n onRespondToToolApproval?:\n | ((options: RespondToToolApprovalOptions) => void)\n | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n attachmentAdapter?: AttachmentAdapter | undefined;\n};\n\n// Message Client - minimal implementation\nconst useMessageClient = ({\n message,\n index,\n parentId,\n onEdit,\n onReload,\n queue,\n branches,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n attachmentAdapter,\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 message.content.map((part, idx) =>\n withKey(\n idx,\n PartResource({\n part,\n status: derivePartStatus(message, idx, part),\n messageId: message.id,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n }),\n ),\n ),\n );\n\n const attachmentClients = useClientLookup(\n (message.attachments ?? []).map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {},\n }),\n ),\n ),\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,\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 attachmentAdapter,\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,\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 parentId,\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 status: ToolCallMessagePartStatus;\n messageId: string;\n onRespondToToolApproval?:\n | ((options: RespondToToolApprovalOptions) => void)\n | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n};\n\n// Part Client - minimal implementation\nconst usePartResource = ({\n part,\n status,\n messageId,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n}: PartResourceProps): ClientOutput<\"part\"> => {\n const state = useMemo(\n () => ({\n ...part,\n status,\n }),\n [part, status],\n );\n\n return {\n getState: () => state,\n addToolResult: (result) => {\n if (!onAddToolResult)\n throw new Error(\n \"Runtime does not support tool results (onAddToolResult is not set).\",\n );\n if (part.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result on non-tool message part\");\n\n const response = ToolResponse.toResponse(result);\n onAddToolResult({\n messageId,\n toolName: part.toolName,\n toolCallId: part.toolCallId,\n result: response.result as ReadonlyJSONValue,\n isError: response.isError,\n ...(response.artifact !== undefined && { artifact: response.artifact }),\n ...(response.modelContent !== undefined && {\n modelContent: response.modelContent,\n }),\n });\n },\n resumeToolCall: (payload) => {\n if (!onResumeToolCall)\n throw new Error(\n \"Runtime does not support resuming tool calls (onResumeToolCall is not set).\",\n );\n if (part.type !== \"tool-call\")\n throw new Error(\"Tried to resume tool call on non-tool message part\");\n\n onResumeToolCall({ toolCallId: part.toolCallId, payload });\n },\n respondToToolApproval: (response) => {\n if (!onRespondToToolApproval)\n throw new Error(\"Runtime does not support tool approvals.\");\n\n if (part.type !== \"tool-call\")\n throw new Error(\n \"Tried to respond to tool approval on non-tool message part\",\n );\n\n if (\n !part.approval ||\n part.approval.approved !== undefined ||\n part.approval.resolution !== undefined\n )\n throw new Error(\"Tool call has no pending approval\");\n\n onRespondToToolApproval(\n resolveToolApprovalResponse(part.approval, response),\n );\n },\n };\n};\n\nconst PartResource = resource(usePartResource);\n\ntype AttachmentResourceProps = {\n attachment: Attachment;\n onRemove?: () => void | Promise<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 await 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 attachmentAdapter?: AttachmentAdapter | 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\nconst drainAdapterAdd = async (\n result: ReturnType<AttachmentAdapter[\"add\"]>,\n upsert: (attachment: Attachment) => void,\n) => {\n if (Symbol.asyncIterator in result) {\n for await (const attachment of result) {\n upsert(attachment);\n }\n } else {\n upsert(await result);\n }\n};\n\n// State whose setter tracks the latest value in a ref, so imperative\n// call sequences (setText immediately followed by send) observe the write\n// before React re-renders — legacy composer parity.\nconst useLiveState = <T>(initial: T) => {\n const [state, setState] = useState(initial);\n const ref = useRef(state);\n const set = useCallback((next: T | ((prev: T) => T)) => {\n ref.current =\n typeof next === \"function\" ? (next as (prev: T) => T)(ref.current) : next;\n setState(ref.current);\n }, []);\n return [state, set, ref] as const;\n};\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 attachmentAdapter,\n}: ComposerClientResourceProps): ClientOutput<\"composer\"> => {\n const [text, setText, textRef] = useLiveState(\"\");\n const [role, setRole, roleRef] = useLiveState<\n \"user\" | \"assistant\" | \"system\"\n >(\"user\");\n const [runConfig, setRunConfig, runConfigRef] = useLiveState<\n Record<string, unknown>\n >({});\n const [attachments, setAttachments, attachmentsRef] = useLiveState<\n readonly Attachment[]\n >([]);\n const [quote, setQuote, quoteRef] = useLiveState<\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 attachments.map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: async () => {\n await attachmentAdapter?.remove(attachment);\n setAttachments((prev) =>\n prev.filter((a) => a.id !== attachment.id),\n );\n },\n }),\n ),\n ),\n );\n\n const removePendingAttachments = async (removed: readonly Attachment[]) => {\n if (!attachmentAdapter) return;\n await Promise.all(\n removed\n .filter((a) => a.status.type !== \"complete\")\n .map((a) => attachmentAdapter.remove(a)),\n );\n };\n\n const upsertAttachment = (attachment: Attachment) => {\n setAttachments((prev) => {\n const idx = prev.findIndex((a) => a.id === attachment.id);\n if (idx === -1) return [...prev, attachment];\n const next = [...prev];\n next[idx] = attachment;\n return next;\n });\n };\n\n const queueItems = queue?.items ?? EMPTY_QUEUE_ITEMS;\n const queueItemClients = useClientLookup(\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 );\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: attachmentAdapter?.accept ?? \"*\",\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 attachmentAdapter?.accept,\n ]);\n\n return {\n getState: () => state,\n setText,\n setRole,\n setRunConfig,\n addAttachment: async (fileOrAttachment: File | CreateAttachment) => {\n if (attachmentAdapter) {\n const file = isCreateAttachment(fileOrAttachment)\n ? {\n name: fileOrAttachment.name,\n type: fileOrAttachment.contentType ?? \"\",\n }\n : { name: fileOrAttachment.name, type: fileOrAttachment.type };\n if (!fileMatchesAccept(file, attachmentAdapter.accept))\n throw new Error(\n `File type ${file.type || \"unknown\"} is not accepted. Accepted types: ${attachmentAdapter.accept}`,\n );\n }\n if (!isCreateAttachment(fileOrAttachment) && attachmentAdapter) {\n await drainAdapterAdd(\n attachmentAdapter.add({ file: fileOrAttachment }),\n upsertAttachment,\n );\n } else if (!isCreateAttachment(fileOrAttachment)) {\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((prev) => [...prev, 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((prev) => [...prev, newAttachment]);\n }\n },\n clearAttachments: async () => {\n const removed = attachmentsRef.current;\n setAttachments([]);\n await removePendingAttachments(removed);\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 const removed = attachmentsRef.current;\n setText(\"\");\n setRole(\"user\");\n setRunConfig({});\n setAttachments([]);\n setQuote(undefined);\n await removePendingAttachments(removed);\n },\n send: (opts?: ComposerSendOptions) => {\n const currentQuote = quoteRef.current;\n const currentText = textRef.current;\n const currentAttachments = attachmentsRef.current;\n const isEmpty = !currentText.trim() && !currentAttachments.length;\n if (!isEditing || isEmpty || isSendDisabled) return;\n\n setText(\"\");\n setAttachments([]);\n setQuote(undefined);\n\n const dispatch = (sendAttachments: readonly Attachment[]) => {\n const composedMessage: AppendMessage = {\n role: roleRef.current,\n content: currentText\n ? [{ type: \"text\" as const, text: currentText }]\n : [],\n attachments: sendAttachments as any,\n createdAt: new Date(),\n parentId: null,\n sourceId: null,\n runConfig: runConfigRef.current,\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 };\n\n if (attachmentAdapter && currentAttachments.length > 0) {\n void Promise.all(\n currentAttachments.map((attachment) =>\n attachment.status.type === \"complete\"\n ? attachment\n : attachmentAdapter.send(attachment as PendingAttachment),\n ),\n ).then(dispatch, (error) => {\n // Upload failed: merge the failed send back into the draft.\n setText((prev) =>\n currentText && prev\n ? currentText + \"\\n\" + prev\n : currentText || prev,\n );\n setQuote((prev) => prev ?? currentQuote);\n setAttachments((prev) => [...currentAttachments, ...prev]);\n console.error(\"Failed to send attachments\", error);\n });\n } else {\n dispatch(currentAttachments);\n }\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\nconst dedupeMessagesById = (messages: readonly ExternalThreadMessage[]) => {\n const seenIds = new Set<string>();\n const deduped: ExternalThreadMessage[] = [];\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i]!;\n if (seenIds.has(message.id)) {\n console.warn(\n `ExternalThread: duplicate message id \"${message.id}\" in the provided messages array; keeping the last occurrence.`,\n );\n continue;\n }\n seenIds.add(message.id);\n deduped.push(message);\n }\n return deduped.length === messages.length ? messages : deduped.reverse();\n};\n\n// External Thread Client\nconst useExternalThread = ({\n messages: messagesProp,\n isRunning = false,\n isLoading = false,\n state: threadState,\n extras,\n isSendDisabled = false,\n onNew,\n onEdit,\n onReload,\n onStartRun,\n onCancel,\n onResume,\n onAddToolResult,\n onResumeToolCall,\n onLoadExternalState,\n attachmentAdapter,\n queue,\n branches,\n onRespondToToolApproval,\n}: ExternalThreadProps): ClientOutput<\"thread\"> => {\n const messages = useMemo(\n () => dedupeMessagesById(messagesProp),\n [messagesProp],\n );\n\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 messages.map((msg, index) => {\n const props: MessageClientProps = {\n message: msg,\n index,\n parentId: index > 0 ? messages[index - 1]!.id : null,\n onReload: () => handleReload(msg.id),\n queue,\n branches,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n attachmentAdapter,\n };\n if (onEdit) props.onEdit = onEdit;\n return withKey(msg.id, MessageClient(props));\n }),\n );\n\n const handleCancelRun = () => {\n queue?.clear(\"cancel-run\");\n onCancel?.();\n };\n\n const handleSendNew = (message: AppendMessage) => {\n // The composer does not know the thread; stamp the current head as the\n // parent (legacy composer parity).\n onNew?.({ ...message, parentId: messages.at(-1)?.id ?? null });\n };\n\n const headId = messages.at(-1)?.id ?? null;\n const composerQueue = useMemo(\n (): ExternalThreadQueueAdapter | undefined =>\n queue && {\n ...queue,\n enqueue: (message, options) =>\n queue.enqueue(\n { ...message, parentId: message.parentId ?? headId },\n options,\n ),\n },\n [queue, headId],\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: composerQueue,\n attachmentAdapter,\n }),\n );\n\n const hasQueue = !!queue;\n const hasBranches = !!branches;\n const hasEdit = !!onEdit;\n const hasReload = !!onReload;\n const hasAttachments = !!attachmentAdapter;\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,\n isRunning,\n capabilities: {\n edit: hasEdit,\n delete: false,\n reload: hasReload,\n cancel: isRunning,\n speech: false,\n attachments: hasAttachments,\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: threadState ?? {},\n suggestions: [],\n extras,\n speech: undefined,\n voice: undefined,\n composer: composerClient.state,\n };\n }, [\n messages,\n isRunning,\n isLoading,\n threadState,\n extras,\n hasQueue,\n hasBranches,\n hasEdit,\n hasReload,\n hasAttachments,\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 if (!onResume)\n throw new Error(\n \"Runtime does not support resuming runs (onResume is not set).\",\n );\n onResume();\n },\n cancelRun: handleCancelRun,\n importExternalState: (state: unknown) => {\n if (!onLoadExternalState)\n throw new Error(\n \"Runtime does not support importing external states (onLoadExternalState is not set).\",\n );\n onLoadExternalState(state);\n },\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 mount in key order; re-declare thread after the threads source it resolves from\n delete scopes.thread;\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":";;;;;;;;;;AAiDA,MAAM0C,oBAA+C,CAAA;AACrD,MAAMC,mBAAsC,CAAA;AAM5C,MAAMG,kBAAqCC,OAAOC,OAAO,EACvDC,MAAM,WACR,CAAC;AAID,MAAMC,oBACJC,SACAC,WACAC,SAC8B;CAC9B,IAAIF,QAAQG,SAAS,eAAe,CAACH,QAAQI,QAAQ,OAAOT;CAE5D,IAAIO,KAAKJ,SAAS,aAAa;EAC7B,IAAI,CAACI,KAAKG,QAAQ,OAAOL,QAAQI;EACjC,OAAOT;CACT;CAEA,MAAMW,aAAaL,cAAcM,KAAKC,IAAI,GAAGR,QAAQS,QAAQC,SAAS,CAAC;CACvE,IAAIV,QAAQI,OAAON,SAAS,mBAAmB,O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,UAAA,CAAA;AAAA,SAAAE,UAAA,CAAA;AAAA,SAAAE,UAAA;CAAA,OAmNA;AAAC;AAnND,SAAA0B,UAAA,CAAA;AAAA,SAAAxB,UAAA;CAAA,OAoNMwB;AAAQ;AApNd,SAAAtB,UAAA,CAAA;AAAA,SAAAE,UAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ExternalThread.js","names":["useState","useMemo","useEffect","useEffectEvent","useCallback","useRef","resource","withKey","ClientElement","ClientOutput","useClientLookup","attachTransformScopes","useClientResource","Derived","AddToolResultOptions","AppendMessage","Attachment","AttachmentAdapter","CreateAttachment","PendingAttachment","RespondToToolApprovalOptions","ResumeToolCallOptions","MessagePartStatus","ThreadAssistantMessagePart","ThreadUserMessagePart","ThreadMessage","ToolCallMessagePartStatus","ExternalThreadQueueAdapter","ExternalThreadBranchAdapter","ToolResponse","ReadonlyJSONValue","QueueItemState","ComposerSendOptions","fileMatchesAccept","getThreadMessageText","isCreateAttachment","resolveToolApprovalResponse","toMessagePartStatus","ModelContext","Suggestions","Tools","DataRenderers","SingleThreadList","EMPTY_QUEUE_ITEMS","EMPTY_BRANCH_IDS","ExternalThreadMessage","id","COMPLETE_STATUS","Object","freeze","type","derivePartStatus","message","partIndex","part","status","ExternalThreadProps","messages","isRunning","isLoading","state","extras","isSendDisabled","onNew","onEdit","onReload","parentId","onStartRun","onCancel","onResume","onAddToolResult","options","onResumeToolCall","onLoadExternalState","attachmentAdapter","queue","branches","onRespondToToolApproval","MessageClientProps","index","useMessageClient","t0","$","_c","isCopied","setIsCopied","isHovering","setIsHovering","isEditing","setIsEditing","t1","content","map","idx","PartResource","messageId","partClients","t2","attachments","t3","_temp2","attachmentClients","t4","Symbol","for","handleBeginEdit","t5","handleCancelEdit","t6","msg","clear","sourceId","handleSendEdit","t7","ComposerClientResource","canCancel","onBeginEdit","onSend","composerClient","branchIds","t8","getBranches","indexOf","branchIndex","branchNumber","branchCount","length","t9","t10","isLast","speech","undefined","parts","composer","t11","t12","methods","t13","t14","t15","position","branchId","target","switchToBranch","t16","selector","get","findIndex","p","toolCallId","t17","selector_0","key","t18","getState","delete","_temp3","reload","speak","_temp4","stopSpeaking","_temp5","submitFeedback","_temp6","getCopyText","attachment","MessageClient","PartResourceProps","usePartResource","result","Error","response","toResponse","toolName","isError","artifact","modelContent","payload","response_0","approval","approved","resolution","addToolResult","resumeToolCall","respondToToolApproval","AttachmentResourceProps","onRemove","Promise","useAttachmentResource","remove","AttachmentResource","ComposerClientResourceProps","useQueueItemClient","item","onSteer","steer","QueueItemClient","drainAdapterAdd","ReturnType","upsert","asyncIterator","useLiveState","initial","setState","ref","next","current","prev","T","set","const","useComposerClientResource","text","setText","textRef","role","setRole","roleRef","runConfig","setRunConfig","runConfigRef","setAttachments","attachmentsRef","quote","setQuote","quoteRef","textParts","filter","_temp7","messageText","_temp8","join","updateFromMessage","a","removed","all","_temp9","a_1","removePendingAttachments","attachment_0","prev_0","a_2","upsertAttachment","queueItems","items","queueItemClients","accept","trim","isEmpty","canSend","attachmentAccept","dictation","fileOrAttachment","file","name","contentType","add","newAttachment","Math","random","toString","substring","prev_1","newAttachment_0","prev_2","removed_0","t19","removed_1","t20","opts","currentQuote","currentText","currentAttachments","isEmpty_0","dispatch","sendAttachments","composedMessage","createdAt","Date","startRun","metadata","custom","enqueue","attachment_1","send","then","error","prev_3","prev_4","prev_5","console","t21","t22","t23","addAttachment","clearAttachments","reset","cancel","beginEdit","startDictation","_temp0","stopDictation","_temp1","queueItem","dedupeMessagesById","seenIds","Set","deduped","i","has","warn","push","reverse","useExternalThread","messagesProp","threadState","messageIndex","m","handleReload","props","messageClients","handleCancelRun","at","handleSendNew","headId","message_0","composerQueue","hasQueue","hasBranches","hasEdit","hasReload","hasAttachments","_temp10","messageStates","edit","feedback","voice","switchBranchDuringRun","unstable_copy","isDisabled","capabilities","suggestions","message_1","appendMessage","state_0","t24","t25","append","deleteMessage","_temp11","resumeRun","cancelRun","importExternalState","getModelContext","_temp12","export","_temp13","import","_temp14","_temp15","_temp16","connectVoice","_temp17","disconnectVoice","_temp18","getVoiceVolume","_temp19","subscribeVoiceVolume","_temp21","muteVoice","_temp22","unmuteVoice","_temp23","ExternalThread","scopes","parent","threads","source","threadElement","thread","query","aui","threadListItem","modelContext","tools","dataRenderers","_temp","part_0","a_0","s","arr","config","_temp20"],"sources":["../../src/client/ExternalThread.ts"],"sourcesContent":["import {\n useState,\n useMemo,\n useEffect,\n useEffectEvent,\n useCallback,\n useRef,\n} 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 AddToolResultOptions,\n AppendMessage,\n Attachment,\n AttachmentAdapter,\n CreateAttachment,\n PendingAttachment,\n RespondToToolApprovalOptions,\n ResumeToolCallOptions,\n MessagePartStatus,\n ThreadAssistantMessagePart,\n ThreadUserMessagePart,\n ThreadMessage,\n ToolCallMessagePartStatus,\n ExternalThreadQueueAdapter,\n ExternalThreadBranchAdapter,\n} from \"@assistant-ui/core\";\nimport { ToolResponse } from \"assistant-stream\";\nimport type { ReadonlyJSONValue } from \"assistant-stream/utils\";\nimport type { QueueItemState } from \"@assistant-ui/core/store\";\nimport type { ComposerSendOptions } from \"@assistant-ui/core/store\";\nimport {\n fileMatchesAccept,\n getThreadMessageText,\n isCreateAttachment,\n resolveToolApprovalResponse,\n toMessagePartStatus,\n} 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\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst derivePartStatus = (\n message: ExternalThreadMessage,\n partIndex: number,\n part: ThreadAssistantMessagePart | ThreadUserMessagePart,\n): ToolCallMessagePartStatus => {\n if (!message.status) return COMPLETE_STATUS;\n return toMessagePartStatus(message, partIndex, part);\n};\n\nexport type ExternalThreadProps = {\n messages: readonly ExternalThreadMessage[];\n isRunning?: boolean;\n isLoading?: boolean | undefined;\n state?: ReadonlyJSONValue | undefined;\n extras?: unknown;\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 onResume?: (() => void) | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n /** Callback for resuming a tool call that is waiting for human input. */\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n onLoadExternalState?: ((state: unknown) => void) | undefined;\n attachmentAdapter?: AttachmentAdapter | undefined;\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 /** Callback for tool approval decisions. Absent: responding to an approval throws a capability error. */\n onRespondToToolApproval?: (options: RespondToToolApprovalOptions) => void;\n};\n\ntype MessageClientProps = {\n message: ExternalThreadMessage;\n index: number;\n parentId: string | null;\n onEdit?: (message: AppendMessage) => void;\n onReload?: () => void;\n queue?: ExternalThreadQueueAdapter | undefined;\n branches?: ExternalThreadBranchAdapter | undefined;\n onRespondToToolApproval?:\n | ((options: RespondToToolApprovalOptions) => void)\n | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n attachmentAdapter?: AttachmentAdapter | undefined;\n};\n\n// Message Client - minimal implementation\nconst useMessageClient = ({\n message,\n index,\n parentId,\n onEdit,\n onReload,\n queue,\n branches,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n attachmentAdapter,\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 message.content.map((part, idx) =>\n withKey(\n idx,\n PartResource({\n part,\n status: derivePartStatus(message, idx, part),\n messageId: message.id,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n }),\n ),\n ),\n );\n\n const attachmentClients = useClientLookup(\n (message.attachments ?? []).map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: () => {},\n }),\n ),\n ),\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,\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 attachmentAdapter,\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,\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 parentId,\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 status: ToolCallMessagePartStatus;\n messageId: string;\n onRespondToToolApproval?:\n | ((options: RespondToToolApprovalOptions) => void)\n | undefined;\n onAddToolResult?: ((options: AddToolResultOptions) => void) | undefined;\n onResumeToolCall?: ((options: ResumeToolCallOptions) => void) | undefined;\n};\n\n// Part Client - minimal implementation\nconst usePartResource = ({\n part,\n status,\n messageId,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n}: PartResourceProps): ClientOutput<\"part\"> => {\n const state = useMemo(\n () => ({ ...part, status: status as MessagePartStatus }),\n [part, status],\n );\n\n return {\n getState: () => state,\n addToolResult: (result) => {\n if (!onAddToolResult)\n throw new Error(\n \"Runtime does not support tool results (onAddToolResult is not set).\",\n );\n if (part.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result on non-tool message part\");\n\n const response = ToolResponse.toResponse(result);\n onAddToolResult({\n messageId,\n toolName: part.toolName,\n toolCallId: part.toolCallId,\n result: response.result as ReadonlyJSONValue,\n isError: response.isError,\n ...(response.artifact !== undefined && { artifact: response.artifact }),\n ...(response.modelContent !== undefined && {\n modelContent: response.modelContent,\n }),\n });\n },\n resumeToolCall: (payload) => {\n if (!onResumeToolCall)\n throw new Error(\n \"Runtime does not support resuming tool calls (onResumeToolCall is not set).\",\n );\n if (part.type !== \"tool-call\")\n throw new Error(\"Tried to resume tool call on non-tool message part\");\n\n onResumeToolCall({ toolCallId: part.toolCallId, payload });\n },\n respondToToolApproval: (response) => {\n if (!onRespondToToolApproval)\n throw new Error(\"Runtime does not support tool approvals.\");\n\n if (part.type !== \"tool-call\")\n throw new Error(\n \"Tried to respond to tool approval on non-tool message part\",\n );\n\n if (\n !part.approval ||\n part.approval.approved !== undefined ||\n part.approval.resolution !== undefined\n )\n throw new Error(\"Tool call has no pending approval\");\n\n onRespondToToolApproval(\n resolveToolApprovalResponse(part.approval, response),\n );\n },\n };\n};\n\nconst PartResource = resource(usePartResource);\n\ntype AttachmentResourceProps = {\n attachment: Attachment;\n onRemove?: () => void | Promise<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 await 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 attachmentAdapter?: AttachmentAdapter | 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\nconst drainAdapterAdd = async (\n result: ReturnType<AttachmentAdapter[\"add\"]>,\n upsert: (attachment: Attachment) => void,\n) => {\n if (Symbol.asyncIterator in result) {\n for await (const attachment of result) {\n upsert(attachment);\n }\n } else {\n upsert(await result);\n }\n};\n\n// State whose setter tracks the latest value in a ref, so imperative\n// call sequences (setText immediately followed by send) observe the write\n// before React re-renders — legacy composer parity.\nconst useLiveState = <T>(initial: T) => {\n const [state, setState] = useState(initial);\n const ref = useRef(state);\n const set = useCallback((next: T | ((prev: T) => T)) => {\n ref.current =\n typeof next === \"function\" ? (next as (prev: T) => T)(ref.current) : next;\n setState(ref.current);\n }, []);\n return [state, set, ref] as const;\n};\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 attachmentAdapter,\n}: ComposerClientResourceProps): ClientOutput<\"composer\"> => {\n const [text, setText, textRef] = useLiveState(\"\");\n const [role, setRole, roleRef] = useLiveState<\n \"user\" | \"assistant\" | \"system\"\n >(\"user\");\n const [runConfig, setRunConfig, runConfigRef] = useLiveState<\n Record<string, unknown>\n >({});\n const [attachments, setAttachments, attachmentsRef] = useLiveState<\n readonly Attachment[]\n >([]);\n const [quote, setQuote, quoteRef] = useLiveState<\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 attachments.map((attachment) =>\n withKey(\n attachment.id,\n AttachmentResource({\n attachment,\n onRemove: async () => {\n await attachmentAdapter?.remove(attachment);\n setAttachments((prev) =>\n prev.filter((a) => a.id !== attachment.id),\n );\n },\n }),\n ),\n ),\n );\n\n const removePendingAttachments = async (removed: readonly Attachment[]) => {\n if (!attachmentAdapter) return;\n await Promise.all(\n removed\n .filter((a) => a.status.type !== \"complete\")\n .map((a) => attachmentAdapter.remove(a)),\n );\n };\n\n const upsertAttachment = (attachment: Attachment) => {\n setAttachments((prev) => {\n const idx = prev.findIndex((a) => a.id === attachment.id);\n if (idx === -1) return [...prev, attachment];\n const next = [...prev];\n next[idx] = attachment;\n return next;\n });\n };\n\n const queueItems = queue?.items ?? EMPTY_QUEUE_ITEMS;\n const queueItemClients = useClientLookup(\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 );\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: attachmentAdapter?.accept ?? \"*\",\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 attachmentAdapter?.accept,\n ]);\n\n return {\n getState: () => state,\n setText,\n setRole,\n setRunConfig,\n addAttachment: async (fileOrAttachment: File | CreateAttachment) => {\n if (attachmentAdapter) {\n const file = isCreateAttachment(fileOrAttachment)\n ? {\n name: fileOrAttachment.name,\n type: fileOrAttachment.contentType ?? \"\",\n }\n : { name: fileOrAttachment.name, type: fileOrAttachment.type };\n if (!fileMatchesAccept(file, attachmentAdapter.accept))\n throw new Error(\n `File type ${file.type || \"unknown\"} is not accepted. Accepted types: ${attachmentAdapter.accept}`,\n );\n }\n if (!isCreateAttachment(fileOrAttachment) && attachmentAdapter) {\n await drainAdapterAdd(\n attachmentAdapter.add({ file: fileOrAttachment }),\n upsertAttachment,\n );\n } else if (!isCreateAttachment(fileOrAttachment)) {\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((prev) => [...prev, 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((prev) => [...prev, newAttachment]);\n }\n },\n clearAttachments: async () => {\n const removed = attachmentsRef.current;\n setAttachments([]);\n await removePendingAttachments(removed);\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 const removed = attachmentsRef.current;\n setText(\"\");\n setRole(\"user\");\n setRunConfig({});\n setAttachments([]);\n setQuote(undefined);\n await removePendingAttachments(removed);\n },\n send: (opts?: ComposerSendOptions) => {\n const currentQuote = quoteRef.current;\n const currentText = textRef.current;\n const currentAttachments = attachmentsRef.current;\n const isEmpty = !currentText.trim() && !currentAttachments.length;\n if (!isEditing || isEmpty || isSendDisabled) return;\n\n setText(\"\");\n setAttachments([]);\n setQuote(undefined);\n\n const dispatch = (sendAttachments: readonly Attachment[]) => {\n const composedMessage: AppendMessage = {\n role: roleRef.current,\n content: currentText\n ? [{ type: \"text\" as const, text: currentText }]\n : [],\n attachments: sendAttachments as any,\n createdAt: new Date(),\n parentId: null,\n sourceId: null,\n runConfig: runConfigRef.current,\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 };\n\n if (attachmentAdapter && currentAttachments.length > 0) {\n void Promise.all(\n currentAttachments.map((attachment) =>\n attachment.status.type === \"complete\"\n ? attachment\n : attachmentAdapter.send(attachment as PendingAttachment),\n ),\n ).then(dispatch, (error) => {\n // Upload failed: merge the failed send back into the draft.\n setText((prev) =>\n currentText && prev\n ? currentText + \"\\n\" + prev\n : currentText || prev,\n );\n setQuote((prev) => prev ?? currentQuote);\n setAttachments((prev) => [...currentAttachments, ...prev]);\n console.error(\"Failed to send attachments\", error);\n });\n } else {\n dispatch(currentAttachments);\n }\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\nconst dedupeMessagesById = (messages: readonly ExternalThreadMessage[]) => {\n const seenIds = new Set<string>();\n const deduped: ExternalThreadMessage[] = [];\n for (let i = messages.length - 1; i >= 0; i--) {\n const message = messages[i]!;\n if (seenIds.has(message.id)) {\n console.warn(\n `ExternalThread: duplicate message id \"${message.id}\" in the provided messages array; keeping the last occurrence.`,\n );\n continue;\n }\n seenIds.add(message.id);\n deduped.push(message);\n }\n return deduped.length === messages.length ? messages : deduped.reverse();\n};\n\n// External Thread Client\nconst useExternalThread = ({\n messages: messagesProp,\n isRunning = false,\n isLoading = false,\n state: threadState,\n extras,\n isSendDisabled = false,\n onNew,\n onEdit,\n onReload,\n onStartRun,\n onCancel,\n onResume,\n onAddToolResult,\n onResumeToolCall,\n onLoadExternalState,\n attachmentAdapter,\n queue,\n branches,\n onRespondToToolApproval,\n}: ExternalThreadProps): ClientOutput<\"thread\"> => {\n const messages = useMemo(\n () => dedupeMessagesById(messagesProp),\n [messagesProp],\n );\n\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 messages.map((msg, index) => {\n const props: MessageClientProps = {\n message: msg,\n index,\n parentId: index > 0 ? messages[index - 1]!.id : null,\n onReload: () => handleReload(msg.id),\n queue,\n branches,\n onRespondToToolApproval,\n onAddToolResult,\n onResumeToolCall,\n attachmentAdapter,\n };\n if (onEdit) props.onEdit = onEdit;\n return withKey(msg.id, MessageClient(props));\n }),\n );\n\n const handleCancelRun = () => {\n queue?.clear(\"cancel-run\");\n onCancel?.();\n };\n\n const handleSendNew = (message: AppendMessage) => {\n // The composer does not know the thread; stamp the current head as the\n // parent (legacy composer parity).\n onNew?.({ ...message, parentId: messages.at(-1)?.id ?? null });\n };\n\n const headId = messages.at(-1)?.id ?? null;\n const composerQueue = useMemo(\n (): ExternalThreadQueueAdapter | undefined =>\n queue && {\n ...queue,\n enqueue: (message, options) =>\n queue.enqueue(\n { ...message, parentId: message.parentId ?? headId },\n options,\n ),\n },\n [queue, headId],\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: composerQueue,\n attachmentAdapter,\n }),\n );\n\n const hasQueue = !!queue;\n const hasBranches = !!branches;\n const hasEdit = !!onEdit;\n const hasReload = !!onReload;\n const hasAttachments = !!attachmentAdapter;\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,\n isRunning,\n capabilities: {\n edit: hasEdit,\n delete: false,\n reload: hasReload,\n cancel: isRunning,\n speech: false,\n attachments: hasAttachments,\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: threadState ?? {},\n suggestions: [],\n extras,\n speech: undefined,\n voice: undefined,\n composer: composerClient.state,\n };\n }, [\n messages,\n isRunning,\n isLoading,\n threadState,\n extras,\n hasQueue,\n hasBranches,\n hasEdit,\n hasReload,\n hasAttachments,\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 if (!onResume)\n throw new Error(\n \"Runtime does not support resuming runs (onResume is not set).\",\n );\n onResume();\n },\n cancelRun: handleCancelRun,\n importExternalState: (state: unknown) => {\n if (!onLoadExternalState)\n throw new Error(\n \"Runtime does not support importing external states (onLoadExternalState is not set).\",\n );\n onLoadExternalState(state);\n },\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 mount in key order; re-declare thread after the threads source it resolves from\n delete scopes.thread;\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":";;;;;;;;;;AAkDA,MAAM2C,oBAA+C,CAAA;AACrD,MAAMC,mBAAsC,CAAA;AAM5C,MAAMG,kBAAqCC,OAAOC,OAAO,EACvDC,MAAM,WACR,CAAC;AAED,MAAMC,oBACJC,SACAC,WACAC,SAC8B;CAC9B,IAAI,CAACF,QAAQG,QAAQ,OAAOR;CAC5B,OAAOV,oBAAoBe,SAASC,WAAWC,IAAI;AACrD;AAuDA,MAAM0B,oBAAmBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAA/B,SAAA2B,OAAAb,UAAAF,QAAAC,UAAAU,OAAAC,UAAAC,yBAAAP,iBAAAE,kBAAAE,sBAAAO;CAaxB,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,UAAA,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ import "./mcp-apps/index.js";
|
|
|
77
77
|
import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
78
78
|
import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, EnrichedPartState, FileMessagePartComponent, FileMessagePartProps, GenerativeUIComponentRegistry, GenerativeUIMessagePartComponent, GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, GenerativeUIRenderProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpAppResourceOutput, McpToolkitDefinition, McpToolkitEntry, McpToolkitToolConfig, PartState, ProviderToolConfig, QuoteMessagePartComponent, QuoteMessagePartProps, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, Unstable_InferInteractableState, Unstable_InteractableConfig, Unstable_InteractableDefinition, Unstable_InteractablePersistedState, Unstable_InteractablePersistenceAdapter, Unstable_InteractablePersistenceStatus, Unstable_InteractableRegistration, Unstable_InteractableStateSchema, Unstable_InteractableToolConfig, Unstable_InteractableToolRenderProps, Unstable_InteractableVersionInfo, Unstable_InteractablesClientSchema, Unstable_InteractablesConfig, Unstable_InteractablesMethods, Unstable_InteractablesState, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
79
79
|
import { AssistantCloud } from "assistant-cloud";
|
|
80
|
-
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, ExternalStoreBranchChange, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PartProviderMetadata, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RespondToToolApprovalOptions, 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, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_InteractableSnapshotEntry, Unstable_InteractableVersion, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
80
|
+
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, ExternalStoreBranchChange, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessagePartStreamStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PartProviderMetadata, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RespondToToolApprovalOptions, 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, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_InteractableSnapshotEntry, Unstable_InteractableVersion, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
81
81
|
import { Tool } from "assistant-stream";
|
|
82
82
|
import { ChainOfThoughtClient, ComposerSendOptions, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
|
|
83
|
-
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 ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, 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 PartProviderMetadata, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, type RespondToToolApprovalOptions, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInput, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersion, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_MessageStallDetection, type Unstable_MessageStallDetectionOptions, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_TriggerPopoverAriaProps, type Unstable_UseComposerInputOptions, type Unstable_UseLiveCompletionAdapterOptions, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
83
|
+
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 ExternalStoreBranchChange, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, type McpToolkitEntry, type McpToolkitToolConfig, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, type MessagePartStreamStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartProviderMetadata, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, type RespondToToolApprovalOptions, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInput, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersion, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_MessageStallDetection, type Unstable_MessageStallDetectionOptions, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_TriggerPopoverAriaProps, type Unstable_UseComposerInputOptions, type Unstable_UseLiveCompletionAdapterOptions, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useComposerInput, unstable_useComposerInputHistory, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useLiveCompletionAdapter, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, unstable_useThreadMessageIds, unstable_useTriggerPopoverAriaProps, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExportedMessageRepositoryItem } from "../runtime-cores/utils/MessageRepository.js";
|
|
2
2
|
import { CloudMessage } from "assistant-cloud";
|
|
3
|
-
import { CompleteAttachment,
|
|
3
|
+
import { CompleteAttachment, MessageStatus, SourceProviderMetadata, ThreadMessage, ToolApprovalOption } from "@assistant-ui/core";
|
|
4
4
|
import { ReadonlyJSONObject, ReadonlyJSONValue } from "assistant-stream/utils";
|
|
5
5
|
//#region src/legacy-runtime/cloud/auiV0.d.ts
|
|
6
6
|
type AuiV0ToolApproval = {
|
|
@@ -58,7 +58,29 @@ type AuiV0MessagePart = {
|
|
|
58
58
|
readonly mimeType: string;
|
|
59
59
|
readonly filename?: string;
|
|
60
60
|
};
|
|
61
|
-
type AuiV0AttachmentPart =
|
|
61
|
+
type AuiV0AttachmentPart = {
|
|
62
|
+
readonly type: "text";
|
|
63
|
+
readonly text: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "image";
|
|
66
|
+
readonly image: string;
|
|
67
|
+
readonly filename?: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: "file";
|
|
70
|
+
readonly data: string;
|
|
71
|
+
readonly mimeType: string;
|
|
72
|
+
readonly filename?: string;
|
|
73
|
+
} | {
|
|
74
|
+
readonly type: "audio";
|
|
75
|
+
readonly audio: {
|
|
76
|
+
readonly data: string;
|
|
77
|
+
readonly format: "mp3" | "wav";
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
readonly type: "data";
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly data: ReadonlyJSONValue;
|
|
83
|
+
};
|
|
62
84
|
type AuiV0Attachment = {
|
|
63
85
|
readonly id: string;
|
|
64
86
|
readonly type: CompleteAttachment["type"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auiV0.d.ts","names":[],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"auiV0.d.ts","names":[],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"mappings":";;;;;KAgBK;WACM;WACA;WACA;WACA;WACA,mBAAmB;WACnB;WACA;;KAGN;WAEU;WACA;;WAGA;WACA;;WAGA;WACA;WACA;WACA;WACA;WACA,mBAAmB;;WAGnB;WACA;WACA;WACA;WACA;WACA;WACA,mBAAmB;;WAGnB;WACA;WACA;WACA,MAAM;WACN,SAAS;WACT;WACA,WAAW;;WAGX;WACA;WACA;WACA;WACA,SAAS;WACT;WACA,WAAW;;WAGX;WACA;;WAGA;WACA;WACA;WACA;;KAGV;WAEU;WACA;;WAGA;WACA;WACA;;WAGA;WACA;WACA;WACA;;WAGA;WACA;aACE;aACA;;;WAIF;WACA;WACA,MAAM;;KAGhB;WACM;WACA,MAAM;WACN;WACA;WACA,QAAQ;WACR,kBAAkB;;KAGxB;WACM;WACA,SAAS;WACT,kBAAkB;WAClB,uBAAuB;WACvB;aACE,iBAAiB;aACjB,+BAA+B;aAC/B,wBAAwB;aACxB;eACE;iBACE;iBACA;;;aAGJ,QAAQ;;;iBAwEL,YAAY,SAAS,gBAAgB;iBA6FrC,YACd,cAAc;EAAiB;IAC9B"}
|
|
@@ -4,14 +4,33 @@ import { isJSONValue } from "@assistant-ui/core/internal";
|
|
|
4
4
|
const encodeAttachmentPart = (part) => {
|
|
5
5
|
const type = part.type;
|
|
6
6
|
switch (type) {
|
|
7
|
-
case "text":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
case "text": return {
|
|
8
|
+
type: "text",
|
|
9
|
+
text: part.text
|
|
10
|
+
};
|
|
11
|
+
case "image": return {
|
|
12
|
+
type: "image",
|
|
13
|
+
image: part.image,
|
|
14
|
+
...part.filename != null ? { filename: part.filename } : void 0
|
|
15
|
+
};
|
|
16
|
+
case "file": return {
|
|
17
|
+
type: "file",
|
|
18
|
+
data: part.data,
|
|
19
|
+
mimeType: part.mimeType,
|
|
20
|
+
...part.filename != null ? { filename: part.filename } : void 0
|
|
21
|
+
};
|
|
22
|
+
case "audio": return {
|
|
23
|
+
type: "audio",
|
|
24
|
+
audio: {
|
|
25
|
+
data: part.audio.data,
|
|
26
|
+
format: part.audio.format
|
|
27
|
+
}
|
|
28
|
+
};
|
|
11
29
|
case "data":
|
|
12
30
|
if (!isJSONValue(part.data)) console.warn(`attachment data is not JSON! ${JSON.stringify(part)}`);
|
|
13
31
|
return {
|
|
14
|
-
|
|
32
|
+
type: "data",
|
|
33
|
+
name: part.name,
|
|
15
34
|
data: part.data
|
|
16
35
|
};
|
|
17
36
|
default: throw new Error(`Attachment part type not supported by aui/v0: ${type}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auiV0.js","names":["CompleteAttachment","DataMessagePart","FileMessagePart","ImageMessagePart","MessageStatus","SourceProviderMetadata","ThreadMessage","TextMessagePart","ToolApprovalOption","Unstable_AudioMessagePart","fromThreadMessageLike","CloudMessage","isJSONValue","ReadonlyJSONObject","ReadonlyJSONValue","ExportedMessageRepositoryItem","AuiV0ToolApproval","id","approved","reason","isAutomatic","options","optionId","resolution","AuiV0MessagePart","type","text","sourceType","url","title","providerMetadata","mediaType","filename","toolCallId","toolName","args","result","isError","approval","argsText","image","data","mimeType","AuiV0AttachmentPart","AuiV0Attachment","name","contentType","status","content","AuiV0Message","role","attachments","metadata","unstable_state","unstable_annotations","unstable_data","steps","usage","inputTokens","outputTokens","custom","encodeAttachmentPart","part","console","warn","JSON","stringify","unhandledType","Error","encodeAttachments","message","length","undefined","map","auiV0Encode","auiV0Decode","cloudMessage","format","payload","createdAt","created_at","parentId","parent_id"],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"sourcesContent":["import type {\n CompleteAttachment,\n DataMessagePart,\n FileMessagePart,\n ImageMessagePart,\n MessageStatus,\n SourceProviderMetadata,\n ThreadMessage,\n TextMessagePart,\n ToolApprovalOption,\n Unstable_AudioMessagePart,\n} from \"@assistant-ui/core\";\nimport { fromThreadMessageLike } from \"../runtime-cores/external-store/ThreadMessageLike\";\nimport type { CloudMessage } from \"assistant-cloud\";\nimport { isJSONValue } from \"@assistant-ui/core/internal\";\nimport type {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"assistant-stream/utils\";\nimport type { ExportedMessageRepositoryItem } from \"../runtime-cores/utils/MessageRepository\";\n\ntype AuiV0ToolApproval = {\n readonly id: string;\n readonly approved?: boolean;\n readonly reason?: string;\n readonly isAutomatic?: boolean;\n readonly options?: readonly ToolApprovalOption[];\n readonly optionId?: string;\n readonly resolution?: \"cancelled\" | \"expired\";\n};\n\ntype AuiV0MessagePart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"document\";\n readonly id: string;\n readonly title: string;\n readonly mediaType: string;\n readonly filename?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n readonly approval?: AuiV0ToolApproval;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n readonly approval?: AuiV0ToolApproval;\n }\n | {\n readonly type: \"image\";\n readonly image: string;\n }\n | {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n readonly filename?: string;\n };\n\ntype AuiV0AttachmentPart =\n | TextMessagePart\n | ImageMessagePart\n | FileMessagePart\n | Unstable_AudioMessagePart\n | DataMessagePart<ReadonlyJSONValue>;\n\ntype AuiV0Attachment = {\n readonly id: string;\n readonly type: CompleteAttachment[\"type\"];\n readonly name: string;\n readonly contentType?: string;\n readonly status: CompleteAttachment[\"status\"];\n readonly content: readonly AuiV0AttachmentPart[];\n};\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessagePart[];\n readonly attachments?: readonly AuiV0Attachment[];\n readonly metadata: {\n readonly unstable_state?: ReadonlyJSONValue;\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly inputTokens: number;\n readonly outputTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nconst encodeAttachmentPart = (\n part: CompleteAttachment[\"content\"][number],\n): AuiV0AttachmentPart => {\n const type = part.type;\n switch (type) {\n case \"text\":\n case \"image\":\n case \"file\":\n case \"audio\":\n return part;\n\n case \"data\": {\n if (!isJSONValue(part.data)) {\n console.warn(`attachment data is not JSON! ${JSON.stringify(part)}`);\n }\n return { ...part, data: part.data as ReadonlyJSONValue };\n }\n\n default: {\n const unhandledType: never = type;\n throw new Error(\n `Attachment part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n};\n\nconst encodeAttachments = (\n message: ThreadMessage,\n): readonly AuiV0Attachment[] | undefined => {\n if (message.role !== \"user\" || message.attachments.length === 0) {\n return undefined;\n }\n\n return message.attachments.map(\n ({ id, type, name, contentType, status, content }) => ({\n id,\n type,\n name,\n status,\n ...(contentType != null ? { contentType } : undefined),\n content: content.map(encodeAttachmentPart),\n }),\n );\n};\n\nexport function auiV0Encode(message: ThreadMessage): AuiV0Message {\n // info: ID and createdAt are ignored (we use the server value instead)\n const status: MessageStatus | undefined =\n message.status?.type === \"running\"\n ? { type: \"incomplete\", reason: \"cancelled\" }\n : message.status;\n const attachments = encodeAttachments(message);\n\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\":\n return { type: \"text\", text: part.text };\n\n case \"reasoning\":\n return { type: \"reasoning\", text: part.text };\n\n case \"source\":\n if (part.sourceType === \"url\") {\n return {\n type: \"source\",\n sourceType: \"url\",\n id: part.id,\n url: part.url,\n ...(part.title != null ? { title: part.title } : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n }\n\n return {\n type: \"source\",\n sourceType: \"document\",\n id: part.id,\n title: part.title,\n mediaType: part.mediaType,\n ...(part.filename != null\n ? { filename: part.filename }\n : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n `tool-call result is not JSON! ${JSON.stringify(part)}`,\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? { args: part.args }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : undefined),\n ...(part.isError ? { isError: true } : undefined),\n ...(part.approval ? { approval: part.approval } : undefined),\n };\n }\n\n case \"image\":\n return { type: \"image\", image: part.image };\n\n case \"file\":\n return {\n type: \"file\",\n data: part.data,\n mimeType: part.mimeType,\n ...(part.filename ? { filename: part.filename } : undefined),\n };\n\n default: {\n const unhandledType: \"audio\" | \"data\" | \"generative-ui\" = type;\n throw new Error(\n `Message part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(status ? { status } : undefined),\n ...(attachments ? { attachments } : undefined),\n };\n}\n\nexport function auiV0Decode(\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n { type: \"complete\", reason: \"unknown\" },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n}\n"],"mappings":";;;AAyHA,MAAM6D,wBACJC,SACwB;CACxB,MAAMrC,OAAOqC,KAAKrC;CAClB,QAAQA,MAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAOqC;EAET,KAAK;GACH,IAAI,CAAClD,YAAYkD,KAAKrB,IAAI,GACxBsB,QAAQC,KAAK,gC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cAC+B;CAC/B,MAAME,UAAUF,aAAa5B;CAC7B,MAAMsB,UAAU5D,sBACd;EACEO,IAAI2D,aAAa3D;EACjB8D,WAAWH,aAAaI;EACxB,GAAGF;CACL,GACAF,aAAa3D,IACb;EAAEQ,MAAM;EAAYN,QAAQ;CAAU,CACxC;CAEA,OAAO;EACL8D,UAAUL,aAAaM;EACvBZ;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"auiV0.js","names":["CompleteAttachment","MessageStatus","SourceProviderMetadata","ThreadMessage","ToolApprovalOption","fromThreadMessageLike","CloudMessage","isJSONValue","ReadonlyJSONObject","ReadonlyJSONValue","ExportedMessageRepositoryItem","AuiV0ToolApproval","id","approved","reason","isAutomatic","options","optionId","resolution","AuiV0MessagePart","type","text","sourceType","url","title","providerMetadata","mediaType","filename","toolCallId","toolName","args","result","isError","approval","argsText","image","data","mimeType","AuiV0AttachmentPart","audio","format","name","AuiV0Attachment","contentType","status","content","AuiV0Message","role","attachments","metadata","unstable_state","unstable_annotations","unstable_data","steps","usage","inputTokens","outputTokens","custom","encodeAttachmentPart","part","undefined","console","warn","JSON","stringify","unhandledType","Error","encodeAttachments","message","length","map","auiV0Encode","auiV0Decode","cloudMessage","payload","createdAt","created_at","parentId","parent_id"],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"sourcesContent":["import type {\n CompleteAttachment,\n MessageStatus,\n SourceProviderMetadata,\n ThreadMessage,\n ToolApprovalOption,\n} from \"@assistant-ui/core\";\nimport { fromThreadMessageLike } from \"../runtime-cores/external-store/ThreadMessageLike\";\nimport type { CloudMessage } from \"assistant-cloud\";\nimport { isJSONValue } from \"@assistant-ui/core/internal\";\nimport type {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"assistant-stream/utils\";\nimport type { ExportedMessageRepositoryItem } from \"../runtime-cores/utils/MessageRepository\";\n\ntype AuiV0ToolApproval = {\n readonly id: string;\n readonly approved?: boolean;\n readonly reason?: string;\n readonly isAutomatic?: boolean;\n readonly options?: readonly ToolApprovalOption[];\n readonly optionId?: string;\n readonly resolution?: \"cancelled\" | \"expired\";\n};\n\ntype AuiV0MessagePart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"document\";\n readonly id: string;\n readonly title: string;\n readonly mediaType: string;\n readonly filename?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n readonly approval?: AuiV0ToolApproval;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n readonly approval?: AuiV0ToolApproval;\n }\n | {\n readonly type: \"image\";\n readonly image: string;\n }\n | {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n readonly filename?: string;\n };\n\ntype AuiV0AttachmentPart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"image\";\n readonly image: string;\n readonly filename?: string;\n }\n | {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n readonly filename?: string;\n }\n | {\n readonly type: \"audio\";\n readonly audio: {\n readonly data: string;\n readonly format: \"mp3\" | \"wav\";\n };\n }\n | {\n readonly type: \"data\";\n readonly name: string;\n readonly data: ReadonlyJSONValue;\n };\n\ntype AuiV0Attachment = {\n readonly id: string;\n readonly type: CompleteAttachment[\"type\"];\n readonly name: string;\n readonly contentType?: string;\n readonly status: CompleteAttachment[\"status\"];\n readonly content: readonly AuiV0AttachmentPart[];\n};\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessagePart[];\n readonly attachments?: readonly AuiV0Attachment[];\n readonly metadata: {\n readonly unstable_state?: ReadonlyJSONValue;\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly inputTokens: number;\n readonly outputTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nconst encodeAttachmentPart = (\n part: CompleteAttachment[\"content\"][number],\n): AuiV0AttachmentPart => {\n const type = part.type;\n switch (type) {\n case \"text\":\n return { type: \"text\", text: part.text };\n\n case \"image\":\n return {\n type: \"image\",\n image: part.image,\n ...(part.filename != null ? { filename: part.filename } : undefined),\n };\n\n case \"file\":\n return {\n type: \"file\",\n data: part.data,\n mimeType: part.mimeType,\n ...(part.filename != null ? { filename: part.filename } : undefined),\n };\n\n case \"audio\":\n return {\n type: \"audio\",\n audio: { data: part.audio.data, format: part.audio.format },\n };\n\n case \"data\": {\n if (!isJSONValue(part.data)) {\n console.warn(`attachment data is not JSON! ${JSON.stringify(part)}`);\n }\n return {\n type: \"data\",\n name: part.name,\n data: part.data as ReadonlyJSONValue,\n };\n }\n\n default: {\n const unhandledType: never = type;\n throw new Error(\n `Attachment part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n};\n\nconst encodeAttachments = (\n message: ThreadMessage,\n): readonly AuiV0Attachment[] | undefined => {\n if (message.role !== \"user\" || message.attachments.length === 0) {\n return undefined;\n }\n\n return message.attachments.map(\n ({ id, type, name, contentType, status, content }) => ({\n id,\n type,\n name,\n status,\n ...(contentType != null ? { contentType } : undefined),\n content: content.map(encodeAttachmentPart),\n }),\n );\n};\n\nexport function auiV0Encode(message: ThreadMessage): AuiV0Message {\n // info: ID and createdAt are ignored (we use the server value instead)\n const status: MessageStatus | undefined =\n message.status?.type === \"running\"\n ? { type: \"incomplete\", reason: \"cancelled\" }\n : message.status;\n const attachments = encodeAttachments(message);\n\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\":\n return { type: \"text\", text: part.text };\n\n case \"reasoning\":\n return { type: \"reasoning\", text: part.text };\n\n case \"source\":\n if (part.sourceType === \"url\") {\n return {\n type: \"source\",\n sourceType: \"url\",\n id: part.id,\n url: part.url,\n ...(part.title != null ? { title: part.title } : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n }\n\n return {\n type: \"source\",\n sourceType: \"document\",\n id: part.id,\n title: part.title,\n mediaType: part.mediaType,\n ...(part.filename != null\n ? { filename: part.filename }\n : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n `tool-call result is not JSON! ${JSON.stringify(part)}`,\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? { args: part.args }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : undefined),\n ...(part.isError ? { isError: true } : undefined),\n ...(part.approval ? { approval: part.approval } : undefined),\n };\n }\n\n case \"image\":\n return { type: \"image\", image: part.image };\n\n case \"file\":\n return {\n type: \"file\",\n data: part.data,\n mimeType: part.mimeType,\n ...(part.filename ? { filename: part.filename } : undefined),\n };\n\n default: {\n const unhandledType: \"audio\" | \"data\" | \"generative-ui\" = type;\n throw new Error(\n `Message part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(status ? { status } : undefined),\n ...(attachments ? { attachments } : undefined),\n };\n}\n\nexport function auiV0Decode(\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n { type: \"complete\", reason: \"unknown\" },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n}\n"],"mappings":";;;AA0IA,MAAM0D,wBACJC,SACwB;CACxB,MAAMvC,OAAOuC,KAAKvC;CAClB,QAAQA,MAAR;EACE,KAAK,QACH,OAAO;GAAEA,MAAM;GAAQC,MAAMsC,KAAKtC;EAAK;EAEzC,KAAK,SACH,OAAO;GACLD,MAAM;GACNe,OAAOwB,KAAKxB;GACZ,GAAIwB,KAAKhC,YAAY,OAAO,EAAEA,UAAUgC,KAAKhC,SAAS,IAAIiC,KAAAA;EAC5D;EAEF,KAAK,QACH,OAAO;GACLxC,MAAM;GACNgB,MAAMuB,KAAKvB;GACXC,UAAUsB,KAAKtB;GACf,GAAIsB,KAAKhC,YAAY,OAAO,EAAEA,UAAUgC,KAAKhC,SAAS,IAAIiC,KAAAA;EAC5D;EAEF,KAAK,SACH,OAAO;GACLxC,MAAM;GACNmB,OAAO;IAAEH,MAAMuB,KAAKpB,MAAMH;IAAMI,QAAQmB,KAAKpB,MAAMC;GAAO;EAC5D;EAEF,KAAK;GACH,IAAI,CAACjC,YAAYoD,KAAKvB,IAAI,GACxByB,QAAQC,KAAK,gCAAgCC,KAAKC,UAAUL,IAAI,GAAG;GAErE,OAAO;IACLvC,MAAM;IACNqB,MAAMkB,KAAKlB;IACXL,MAAMuB,KAAKvB;GACb;EAGF,SAEE,MAAM,IAAI8B,MACR,iDAAiDD,MACnD;CAEJ;AACF;AAEA,MAAME,qBACJC,YAC2C;CAC3C,IAAIA,QAAQrB,SAAS,UAAUqB,QAAQpB,YAAYqB,WAAW,GAC5D;CAGF,OAAOD,QAAQpB,YAAYsB,KACxB,EAAE1D,IAAIQ,MAAMqB,MAAME,aAAaC,QAAQC,eAAe;EACrDjC;EACAQ;EACAqB;EACAG;EACA,GAAID,eAAe,OAAO,EAAEA,YAAY,IAAIiB,KAAAA;EAC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,KAAK9B;MACf,GAAIkC,KAAKC,UAAUL,KAAK7B,IAAI,MAAM6B,KAAKzB,WACnC,EAAEJ,MAAM6B,KAAK7B,KAAK,IAClB,EAAEI,UAAUyB,KAAKzB,SAAS;MAC9B,GAAIyB,KAAK5B,SACL,EAAEA,QAAQ4B,KAAK5B,OAA4B,IAC3C6B,KAAAA;MACJ,GAAID,KAAK3B,UAAU,EAAEA,SAAS,KAAK,IAAI4B,KAAAA;MACvC,GAAID,KAAK1B,WAAW,EAAEA,UAAU0B,KAAK1B,SAAS,IAAI2B,KAAAA;KACpD;IAGF,KAAK,SACH,OAAO;KAAExC,MAAM;KAASe,OAAOwB,KAAKxB;IAAM;IAE5C,KAAK,QACH,OAAO;KACLf,MAAM;KACNgB,MAAMuB,KAAKvB;KACXC,UAAUsB,KAAKtB;KACf,GAAIsB,KAAKhC,WAAW,EAAEA,UAAUgC,KAAKhC,SAAS,IAAIiC,KAAAA;IACpD;IAEF,SAEE,MAAM,IAAIM,MACR,8CAA8CD,MAChD;GAEJ;EACF,CAAC;EACDhB,UAAUmB,QAAQnB;EAClB,GAAIL,SAAS,EAAEA,OAAO,IAAIgB,KAAAA;EAC1B,GAAIZ,cAAc,EAAEA,YAAY,IAAIY,KAAAA;CACtC;AACF;AAEA,SAAgBY,YACdC,cAC+B;CAC/B,MAAMC,UAAUD,aAAa5B;CAC7B,MAAMuB,UAAU/D,sBACd;EACEO,IAAI6D,aAAa7D;EACjB+D,WAAWF,aAAaG;EACxB,GAAGF;CACL,GACAD,aAAa7D,IACb;EAAEQ,MAAM;EAAYN,QAAQ;CAAU,CACxC;CAEA,OAAO;EACL+D,UAAUJ,aAAaK;EACvBV;CACF;AACF"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//#region src/utils/useToolArgsFieldStatus.d.ts
|
|
2
2
|
declare const useToolArgsFieldStatus: (fieldPath: (string | number)[]) => {
|
|
3
|
-
type: string;
|
|
4
|
-
} | {
|
|
5
3
|
readonly type: "running";
|
|
6
4
|
} | {
|
|
7
5
|
readonly type: "complete";
|
|
@@ -9,6 +7,8 @@ declare const useToolArgsFieldStatus: (fieldPath: (string | number)[]) => {
|
|
|
9
7
|
readonly type: "incomplete";
|
|
10
8
|
readonly reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
|
11
9
|
readonly error?: unknown;
|
|
10
|
+
} | {
|
|
11
|
+
type: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
export { useToolArgsFieldStatus };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Open-source TypeScript/React library for building production-grade AI chat experiences",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
],
|
|
56
56
|
"sideEffects": false,
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@assistant-ui/core": "^0.3.
|
|
58
|
+
"@assistant-ui/core": "^0.3.3",
|
|
59
59
|
"@assistant-ui/store": "^0.3.1",
|
|
60
|
-
"@assistant-ui/tap": "^0.9.
|
|
60
|
+
"@assistant-ui/tap": "^0.9.9",
|
|
61
61
|
"@radix-ui/primitive": "^1.1.7",
|
|
62
62
|
"@radix-ui/react-collection": "^1.1.15",
|
|
63
63
|
"@radix-ui/react-compose-refs": "^1.1.5",
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
getThreadMessageText,
|
|
43
43
|
isCreateAttachment,
|
|
44
44
|
resolveToolApprovalResponse,
|
|
45
|
+
toMessagePartStatus,
|
|
45
46
|
} from "@assistant-ui/core/internal";
|
|
46
47
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
47
48
|
import { Tools, DataRenderers } from "@assistant-ui/core/react";
|
|
@@ -58,23 +59,13 @@ const COMPLETE_STATUS: MessagePartStatus = Object.freeze({
|
|
|
58
59
|
type: "complete",
|
|
59
60
|
});
|
|
60
61
|
|
|
61
|
-
// Legacy runtime parity (toMessagePartStatus): a tool call without a result
|
|
62
|
-
// carries its message's status; the last part of a streaming message streams.
|
|
63
62
|
const derivePartStatus = (
|
|
64
63
|
message: ExternalThreadMessage,
|
|
65
64
|
partIndex: number,
|
|
66
65
|
part: ThreadAssistantMessagePart | ThreadUserMessagePart,
|
|
67
66
|
): ToolCallMessagePartStatus => {
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
if (part.type === "tool-call") {
|
|
71
|
-
if (!part.result) return message.status as ToolCallMessagePartStatus;
|
|
72
|
-
return COMPLETE_STATUS;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const isLastPart = partIndex === Math.max(0, message.content.length - 1);
|
|
76
|
-
if (message.status.type === "requires-action") return COMPLETE_STATUS;
|
|
77
|
-
return isLastPart ? (message.status as MessagePartStatus) : COMPLETE_STATUS;
|
|
67
|
+
if (!message.status) return COMPLETE_STATUS;
|
|
68
|
+
return toMessagePartStatus(message, partIndex, part);
|
|
78
69
|
};
|
|
79
70
|
|
|
80
71
|
export type ExternalThreadProps = {
|
|
@@ -307,10 +298,7 @@ const usePartResource = ({
|
|
|
307
298
|
onResumeToolCall,
|
|
308
299
|
}: PartResourceProps): ClientOutput<"part"> => {
|
|
309
300
|
const state = useMemo(
|
|
310
|
-
() => ({
|
|
311
|
-
...part,
|
|
312
|
-
status,
|
|
313
|
-
}),
|
|
301
|
+
() => ({ ...part, status: status as MessagePartStatus }),
|
|
314
302
|
[part, status],
|
|
315
303
|
);
|
|
316
304
|
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
CompleteAttachment,
|
|
3
|
-
DataMessagePart,
|
|
4
|
-
FileMessagePart,
|
|
5
|
-
ImageMessagePart,
|
|
6
3
|
MessageStatus,
|
|
7
4
|
SourceProviderMetadata,
|
|
8
5
|
ThreadMessage,
|
|
9
|
-
TextMessagePart,
|
|
10
6
|
ToolApprovalOption,
|
|
11
|
-
Unstable_AudioMessagePart,
|
|
12
7
|
} from "@assistant-ui/core";
|
|
13
8
|
import { fromThreadMessageLike } from "../runtime-cores/external-store/ThreadMessageLike";
|
|
14
9
|
import type { CloudMessage } from "assistant-cloud";
|
|
@@ -85,11 +80,33 @@ type AuiV0MessagePart =
|
|
|
85
80
|
};
|
|
86
81
|
|
|
87
82
|
type AuiV0AttachmentPart =
|
|
88
|
-
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
83
|
+
| {
|
|
84
|
+
readonly type: "text";
|
|
85
|
+
readonly text: string;
|
|
86
|
+
}
|
|
87
|
+
| {
|
|
88
|
+
readonly type: "image";
|
|
89
|
+
readonly image: string;
|
|
90
|
+
readonly filename?: string;
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
readonly type: "file";
|
|
94
|
+
readonly data: string;
|
|
95
|
+
readonly mimeType: string;
|
|
96
|
+
readonly filename?: string;
|
|
97
|
+
}
|
|
98
|
+
| {
|
|
99
|
+
readonly type: "audio";
|
|
100
|
+
readonly audio: {
|
|
101
|
+
readonly data: string;
|
|
102
|
+
readonly format: "mp3" | "wav";
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
| {
|
|
106
|
+
readonly type: "data";
|
|
107
|
+
readonly name: string;
|
|
108
|
+
readonly data: ReadonlyJSONValue;
|
|
109
|
+
};
|
|
93
110
|
|
|
94
111
|
type AuiV0Attachment = {
|
|
95
112
|
readonly id: string;
|
|
@@ -125,16 +142,38 @@ const encodeAttachmentPart = (
|
|
|
125
142
|
const type = part.type;
|
|
126
143
|
switch (type) {
|
|
127
144
|
case "text":
|
|
145
|
+
return { type: "text", text: part.text };
|
|
146
|
+
|
|
128
147
|
case "image":
|
|
148
|
+
return {
|
|
149
|
+
type: "image",
|
|
150
|
+
image: part.image,
|
|
151
|
+
...(part.filename != null ? { filename: part.filename } : undefined),
|
|
152
|
+
};
|
|
153
|
+
|
|
129
154
|
case "file":
|
|
155
|
+
return {
|
|
156
|
+
type: "file",
|
|
157
|
+
data: part.data,
|
|
158
|
+
mimeType: part.mimeType,
|
|
159
|
+
...(part.filename != null ? { filename: part.filename } : undefined),
|
|
160
|
+
};
|
|
161
|
+
|
|
130
162
|
case "audio":
|
|
131
|
-
return
|
|
163
|
+
return {
|
|
164
|
+
type: "audio",
|
|
165
|
+
audio: { data: part.audio.data, format: part.audio.format },
|
|
166
|
+
};
|
|
132
167
|
|
|
133
168
|
case "data": {
|
|
134
169
|
if (!isJSONValue(part.data)) {
|
|
135
170
|
console.warn(`attachment data is not JSON! ${JSON.stringify(part)}`);
|
|
136
171
|
}
|
|
137
|
-
return {
|
|
172
|
+
return {
|
|
173
|
+
type: "data",
|
|
174
|
+
name: part.name,
|
|
175
|
+
data: part.data as ReadonlyJSONValue,
|
|
176
|
+
};
|
|
138
177
|
}
|
|
139
178
|
|
|
140
179
|
default: {
|
|
@@ -36,29 +36,36 @@ const renderThread = (props: ExternalThreadProps) => {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const assistantMessageWithContent = (
|
|
40
40
|
status: ThreadMessage["status"],
|
|
41
|
-
|
|
41
|
+
content: ExternalThreadMessage["content"],
|
|
42
|
+
id = "a1",
|
|
42
43
|
): ExternalThreadMessage =>
|
|
43
44
|
({
|
|
44
|
-
id
|
|
45
|
+
id,
|
|
45
46
|
role: "assistant",
|
|
46
|
-
content
|
|
47
|
-
{ type: "text", text: "let me check" },
|
|
48
|
-
{
|
|
49
|
-
type: "tool-call",
|
|
50
|
-
toolCallId: "tc1",
|
|
51
|
-
toolName: "probe_tool",
|
|
52
|
-
args: {},
|
|
53
|
-
argsText: "{}",
|
|
54
|
-
...(result !== undefined && { result }),
|
|
55
|
-
},
|
|
56
|
-
],
|
|
47
|
+
content,
|
|
57
48
|
createdAt: new Date(0),
|
|
58
49
|
status,
|
|
59
50
|
metadata: { custom: {} },
|
|
60
51
|
}) as unknown as ExternalThreadMessage;
|
|
61
52
|
|
|
53
|
+
const assistantMessage = (
|
|
54
|
+
status: ThreadMessage["status"],
|
|
55
|
+
result?: string,
|
|
56
|
+
): ExternalThreadMessage =>
|
|
57
|
+
assistantMessageWithContent(status, [
|
|
58
|
+
{ type: "text", text: "let me check" },
|
|
59
|
+
{
|
|
60
|
+
type: "tool-call",
|
|
61
|
+
toolCallId: "tc1",
|
|
62
|
+
toolName: "probe_tool",
|
|
63
|
+
args: {},
|
|
64
|
+
argsText: "{}",
|
|
65
|
+
...(result !== undefined && { result }),
|
|
66
|
+
},
|
|
67
|
+
]);
|
|
68
|
+
|
|
62
69
|
describe("ExternalThread part status", () => {
|
|
63
70
|
it("gives an unresolved tool call its message's status", () => {
|
|
64
71
|
const { aui } = renderThread({
|
|
@@ -70,14 +77,99 @@ describe("ExternalThread part status", () => {
|
|
|
70
77
|
expect(part("tc1").status).toEqual({ type: "running" });
|
|
71
78
|
});
|
|
72
79
|
|
|
73
|
-
it("
|
|
80
|
+
it("uses positional fallback for statusless parts and resolved tool calls", () => {
|
|
74
81
|
const { aui } = renderThread({
|
|
75
|
-
messages: [
|
|
82
|
+
messages: [
|
|
83
|
+
assistantMessage({ type: "running" }, "ok"),
|
|
84
|
+
assistantMessageWithContent(
|
|
85
|
+
{ type: "running" },
|
|
86
|
+
[
|
|
87
|
+
{ type: "text", text: "first" },
|
|
88
|
+
{ type: "reasoning", text: "last" },
|
|
89
|
+
],
|
|
90
|
+
"a2",
|
|
91
|
+
),
|
|
92
|
+
],
|
|
76
93
|
isRunning: true,
|
|
77
94
|
});
|
|
78
95
|
const state = aui().thread.message({ id: "a1" }).getState();
|
|
79
96
|
expect(state.parts[0]!.status).toEqual({ type: "complete" });
|
|
80
97
|
expect(state.parts[1]!.status).toEqual({ type: "complete" });
|
|
98
|
+
const fallbackState = aui().thread.message({ id: "a2" }).getState();
|
|
99
|
+
expect(fallbackState.parts[0]!.status).toEqual({ type: "complete" });
|
|
100
|
+
expect(fallbackState.parts[1]!.status).toEqual({ type: "running" });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("honours supplied statuses while the message is running", () => {
|
|
104
|
+
const { aui } = renderThread({
|
|
105
|
+
messages: [
|
|
106
|
+
assistantMessageWithContent({ type: "running" }, [
|
|
107
|
+
{ type: "text", text: "first", status: { type: "running" } },
|
|
108
|
+
{
|
|
109
|
+
type: "reasoning",
|
|
110
|
+
text: "last",
|
|
111
|
+
status: { type: "complete" },
|
|
112
|
+
},
|
|
113
|
+
]),
|
|
114
|
+
],
|
|
115
|
+
isRunning: true,
|
|
116
|
+
});
|
|
117
|
+
const state = aui().thread.message({ id: "a1" }).getState();
|
|
118
|
+
|
|
119
|
+
expect(state.parts[0]!.status).toEqual({ type: "running" });
|
|
120
|
+
expect(state.parts[1]!.status).toEqual({ type: "complete" });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("ignores supplied statuses after the message completes", () => {
|
|
124
|
+
const { aui } = renderThread({
|
|
125
|
+
messages: [
|
|
126
|
+
assistantMessageWithContent({ type: "complete", reason: "stop" }, [
|
|
127
|
+
{ type: "text", text: "truncated", status: { type: "running" } },
|
|
128
|
+
]),
|
|
129
|
+
],
|
|
130
|
+
isRunning: false,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
expect(
|
|
134
|
+
aui().thread.message({ id: "a1" }).part({ index: 0 }).getState().status,
|
|
135
|
+
).toEqual({ type: "complete", reason: "stop" });
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("normalizes supplied upstream statuses", () => {
|
|
139
|
+
const { aui } = renderThread({
|
|
140
|
+
messages: [
|
|
141
|
+
assistantMessageWithContent(
|
|
142
|
+
{ type: "running" },
|
|
143
|
+
// assistant-stream sends shapes core's MessagePartStatus does not
|
|
144
|
+
// declare (a reason on complete, an unlisted incomplete reason);
|
|
145
|
+
// the normalizer absorbs them.
|
|
146
|
+
[
|
|
147
|
+
{
|
|
148
|
+
type: "text",
|
|
149
|
+
text: "done",
|
|
150
|
+
status: { type: "complete", reason: "unknown" },
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "reasoning",
|
|
154
|
+
text: "interrupted",
|
|
155
|
+
status: {
|
|
156
|
+
type: "incomplete",
|
|
157
|
+
reason: "unknown",
|
|
158
|
+
error: "upstream error",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
] as unknown as ExternalThreadMessage["content"],
|
|
162
|
+
),
|
|
163
|
+
],
|
|
164
|
+
isRunning: true,
|
|
165
|
+
});
|
|
166
|
+
const state = aui().thread.message({ id: "a1" }).getState();
|
|
167
|
+
|
|
168
|
+
expect(state.parts[0]!.status).toEqual({ type: "complete" });
|
|
169
|
+
expect(state.parts[1]!.status).toEqual({
|
|
170
|
+
type: "incomplete",
|
|
171
|
+
reason: "other",
|
|
172
|
+
});
|
|
81
173
|
});
|
|
82
174
|
|
|
83
175
|
it("keeps parts complete on requires-action and user messages", () => {
|