@assistant-ui/react 0.15.14 → 0.15.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant-transport.d.ts +32 -0
- package/dist/assistant-transport.d.ts.map +1 -0
- package/dist/assistant-transport.js +27 -0
- package/dist/assistant-transport.js.map +1 -0
- package/dist/context/providers/MessageProvider.js +1 -1
- package/dist/hooks/useMessageQuote.js +1 -1
- package/dist/hooks/useToolCallElapsed.js +1 -1
- package/dist/index.d.ts +4 -7
- package/dist/index.js +6 -8
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js +18 -2
- package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
- package/dist/mcp-apps/bridge.js +39 -24
- package/dist/mcp-apps/bridge.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +24 -37
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
- package/dist/primitives/attachment/AttachmentName.js +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js +1 -1
- package/dist/primitives/composer/ComposerInput.js +2 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerQuote.js +1 -1
- package/dist/primitives/composer/ComposerRoot.js +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js +1 -1
- package/dist/primitives/composer/trigger/TriggerPopover.js +1 -1
- package/dist/primitives/composer/useComposerInputState.js +1 -1
- package/dist/primitives/message/MessageIf.js +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +1 -1
- package/dist/primitives/message/MessageRoot.js +1 -1
- package/dist/primitives/queueItem/QueueItemRemove.js +1 -1
- package/dist/primitives/queueItem/QueueItemSteer.js +1 -1
- package/dist/primitives/queueItem/QueueItemText.js +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.js +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.js +1 -1
- package/dist/primitives/thread/ThreadIf.js +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadRoot.js +41 -9
- package/dist/primitives/thread/ThreadRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +2 -13
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +23 -8
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +1 -1
- package/dist/sandbox-host/SandboxHost.js +2 -0
- package/dist/sandbox-host/SandboxHost.js.map +1 -1
- package/dist/unstable/useComposerInput.d.ts +2 -2
- package/dist/unstable/useComposerInput.js +1 -1
- package/dist/unstable/useComposerInput.js.map +1 -1
- package/dist/unstable/useComposerInputHistory.js +1 -1
- package/dist/unstable/useComposerInputHistory.js.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.d.ts +5 -0
- package/dist/unstable/useLiveCompletionAdapter.d.ts.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.js +16 -3
- package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
- package/dist/unstable/useMentionAdapter.d.ts +1 -1
- package/dist/utils/smooth/SmoothContext.js +1 -1
- package/dist/utils/useToolArgsFieldStatus.js +1 -1
- package/package.json +9 -9
- package/src/assistant-transport.ts +94 -0
- package/src/index.ts +8 -4
- package/src/mcp-apps/McpAppsRemoteHost.test.ts +29 -3
- package/src/mcp-apps/McpAppsRemoteHost.ts +42 -7
- package/src/mcp-apps/bridge.test.ts +132 -0
- package/src/mcp-apps/bridge.ts +54 -30
- package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +0 -9
- package/src/primitives/composer/ComposerInput.tsx +1 -1
- package/src/primitives/thread/ThreadRoot.test.tsx +251 -0
- package/src/primitives/thread/ThreadRoot.tsx +30 -0
- package/src/primitives/thread/ThreadViewport.tsx +1 -8
- package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +152 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +26 -19
- package/src/sandbox-host/SandboxHost.test.tsx +29 -0
- package/src/sandbox-host/SandboxHost.tsx +2 -0
- package/src/tests/RemoteThreadListRuntime.adapterProvider.test.tsx +24 -3
- package/src/tests/RemoteThreadListRuntime.reloadMainThread.test.tsx +1 -2
- package/src/tests/augmentations.test.ts +49 -0
- package/src/tests/in-memory-thread-list.test.tsx +1 -1
- package/src/tests/threadMessageById.test.tsx +61 -1
- package/src/unstable/useComposerInput.ts +2 -2
- package/src/unstable/useComposerInputHistory.test.tsx +4 -4
- package/src/unstable/useComposerInputHistory.ts +1 -1
- package/src/unstable/useLiveCompletionAdapter.test.tsx +100 -0
- package/src/unstable/useLiveCompletionAdapter.ts +41 -17
- package/dist/client/InMemoryThreadList.d.ts +0 -12
- package/dist/client/InMemoryThreadList.d.ts.map +0 -1
- package/dist/client/InMemoryThreadList.js +0 -374
- package/dist/client/InMemoryThreadList.js.map +0 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +0 -119
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +0 -1
- package/dist/legacy-runtime/cloud/auiV0.js +0 -137
- package/dist/legacy-runtime/cloud/auiV0.js.map +0 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts +0 -16
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js +0 -36
- package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts +0 -17
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js +0 -55
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.d.ts +0 -11
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.js +0 -165
- package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts +0 -15
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js +0 -81
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +0 -126
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js +0 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts +0 -14
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +0 -290
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.d.ts +0 -7
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js +0 -25
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.d.ts +0 -7
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.d.ts.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.js +0 -27
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.js.map +0 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.d.ts +0 -2
- package/dist/legacy-runtime/runtime-cores/assistant-transport/utils.js +0 -2
- package/src/client/InMemoryThreadList.ts +0 -247
- package/src/legacy-runtime/cloud/auiV0.ts +0 -331
- package/src/legacy-runtime/cloud/useCloudThreadListRuntime.ts +0 -31
- package/src/legacy-runtime/runtime-cores/assistant-transport/commandQueue.ts +0 -68
- package/src/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.test.ts +0 -455
- package/src/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.ts +0 -172
- package/src/legacy-runtime/runtime-cores/assistant-transport/runManager.ts +0 -113
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-delivery.test.tsx +0 -79
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-parentid.test.tsx +0 -97
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-scheduling.test.ts +0 -307
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +0 -170
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransport.spec.md +0 -141
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.test.tsx +0 -585
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +0 -476
- package/src/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.ts +0 -20
- package/src/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.ts +0 -9
- package/src/legacy-runtime/runtime-cores/assistant-transport/utils.ts +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UserCommands as UserCommands$1, UserExternalState } from "./augmentations.js";
|
|
2
|
+
import { AssistantTransportCommand as AssistantTransportCommand$1, AssistantTransportConnectionMetadata as AssistantTransportConnectionMetadata$1, AssistantTransportOptions as AssistantTransportOptions$1, AssistantTransportProtocol, SendCommandsRequestBody as SendCommandsRequestBody$1 } from "@assistant-ui/core/react";
|
|
3
|
+
import { AssistantRuntime, UserCommands } from "@assistant-ui/core";
|
|
4
|
+
//#region src/assistant-transport.d.ts
|
|
5
|
+
type SendCommandsRequestBody = Omit<SendCommandsRequestBody$1, "commands"> & {
|
|
6
|
+
commands: AssistantTransportCommand[];
|
|
7
|
+
};
|
|
8
|
+
type AssistantTransportCommand = Exclude<AssistantTransportCommand$1, UserCommands> | UserCommands$1;
|
|
9
|
+
type AssistantTransportConnectionMetadata = Omit<AssistantTransportConnectionMetadata$1, "pendingCommands"> & {
|
|
10
|
+
pendingCommands: AssistantTransportCommand[];
|
|
11
|
+
};
|
|
12
|
+
type AssistantTransportStateConverter<T> = (state: T, connectionMetadata: AssistantTransportConnectionMetadata) => ReturnType<AssistantTransportOptions$1<T>["converter"]>;
|
|
13
|
+
type AssistantTransportOptions<T> = Omit<AssistantTransportOptions$1<T>, "converter" | "prepareSendCommandsRequest" | "onError" | "onCancel"> & {
|
|
14
|
+
converter: AssistantTransportStateConverter<T>;
|
|
15
|
+
prepareSendCommandsRequest?: (body: SendCommandsRequestBody) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
16
|
+
onError?: (error: Error, params: {
|
|
17
|
+
commands: AssistantTransportCommand[];
|
|
18
|
+
updateState: (updater: (state: T) => T) => void;
|
|
19
|
+
}) => void | Promise<void>;
|
|
20
|
+
onCancel?: (params: {
|
|
21
|
+
commands: AssistantTransportCommand[];
|
|
22
|
+
updateState: (updater: (state: T) => T) => void;
|
|
23
|
+
error?: Error;
|
|
24
|
+
}) => void;
|
|
25
|
+
};
|
|
26
|
+
declare const useAssistantTransportRuntime: <T>(options: AssistantTransportOptions<T>) => AssistantRuntime;
|
|
27
|
+
declare const useAssistantTransportSendCommand: () => (command: AssistantTransportCommand) => void;
|
|
28
|
+
declare function useAssistantTransportState(): UserExternalState;
|
|
29
|
+
declare function useAssistantTransportState<T>(selector: (state: UserExternalState) => T): T;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AssistantTransportCommand, AssistantTransportConnectionMetadata, AssistantTransportOptions, type AssistantTransportProtocol, AssistantTransportStateConverter, SendCommandsRequestBody, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState };
|
|
32
|
+
//# sourceMappingURL=assistant-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-transport.d.ts","names":[],"sources":["../src/assistant-transport.ts"],"mappings":";;;;KAuBY,0BAA0B,KACpC;EAGA,UAAU;;KAGA,4BACR,QAAQ,6BAA+B,gBACvC;KAEQ,uCAAuC,KACjD;EAGA,iBAAiB;;KAGP,iCAAiC,MAC3C,OAAO,GACP,oBAAoB,yCACjB,WAAW,4BAA8B;KAElC,0BAA0B,KAAK,KACzC,4BAA8B;EAG9B,WAAW,iCAAiC;EAC5C,8BACE,MAAM,4BACH,0BAA0B,QAAQ;EACvC,WACE,OAAO,OACP;IACE,UAAU;IACV,cAAc,UAAU,OAAO,MAAM;eAE7B;EACZ,YAAY;IACV,UAAU;IACV,cAAc,UAAU,OAAO,MAAM;IACrC,QAAQ;;;cAIC,+BAAgC,GAC3C,SAAS,0BAA0B,OAClC;cAMU,yCAEH,SAAS;iBAKH,8BAA8B;iBAC9B,2BAA2B,GACzC,WAAW,OAAO,sBAAsB,IACvC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
|
+
import { useAssistantTransportRuntime as useAssistantTransportRuntime$1, useAssistantTransportSendCommand as useAssistantTransportSendCommand$1, useAssistantTransportState as useAssistantTransportState$1 } from "@assistant-ui/core/react";
|
|
4
|
+
//#region src/assistant-transport.ts
|
|
5
|
+
const useAssistantTransportRuntime = (options) => {
|
|
6
|
+
return useAssistantTransportRuntime$1(options);
|
|
7
|
+
};
|
|
8
|
+
const useAssistantTransportSendCommand = () => {
|
|
9
|
+
const $ = c(2);
|
|
10
|
+
const send = useAssistantTransportSendCommand$1();
|
|
11
|
+
let t0;
|
|
12
|
+
if ($[0] !== send) {
|
|
13
|
+
t0 = (command) => {
|
|
14
|
+
send(command);
|
|
15
|
+
};
|
|
16
|
+
$[0] = send;
|
|
17
|
+
$[1] = t0;
|
|
18
|
+
} else t0 = $[1];
|
|
19
|
+
return t0;
|
|
20
|
+
};
|
|
21
|
+
function useAssistantTransportState(selector = (state) => state) {
|
|
22
|
+
return useAssistantTransportState$1(selector);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=assistant-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-transport.js","names":["c","_c","AssistantRuntime","UserCommands","CoreUserCommands","UserExternalState","CoreUserExternalState","useAssistantTransportRuntime","useCoreAssistantTransportRuntime","useAssistantTransportSendCommand","useCoreAssistantTransportSendCommand","useAssistantTransportState","useCoreAssistantTransportState","AssistantTransportCommand","CoreAssistantTransportCommand","AssistantTransportConnectionMetadata","CoreAssistantTransportConnectionMetadata","AssistantTransportOptions","CoreAssistantTransportOptions","AssistantTransportProtocol","SendCommandsRequestBody","CoreSendCommandsRequestBody","Omit","commands","Exclude","pendingCommands","AssistantTransportStateConverter","state","T","connectionMetadata","ReturnType","converter","prepareSendCommandsRequest","body","Record","Promise","onError","error","Error","params","updateState","updater","onCancel","options","$","send","t0","command","selector"],"sources":["../src/assistant-transport.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n AssistantRuntime,\n UserCommands as CoreUserCommands,\n UserExternalState as CoreUserExternalState,\n} from \"@assistant-ui/core\";\nimport {\n useAssistantTransportRuntime as useCoreAssistantTransportRuntime,\n useAssistantTransportSendCommand as useCoreAssistantTransportSendCommand,\n useAssistantTransportState as useCoreAssistantTransportState,\n} from \"@assistant-ui/core/react\";\nimport type {\n AssistantTransportCommand as CoreAssistantTransportCommand,\n AssistantTransportConnectionMetadata as CoreAssistantTransportConnectionMetadata,\n AssistantTransportOptions as CoreAssistantTransportOptions,\n AssistantTransportProtocol,\n SendCommandsRequestBody as CoreSendCommandsRequestBody,\n} from \"@assistant-ui/core/react\";\nimport type { UserCommands, UserExternalState } from \"./augmentations\";\n\nexport type { AssistantTransportProtocol };\n\nexport type SendCommandsRequestBody = Omit<\n CoreSendCommandsRequestBody,\n \"commands\"\n> & {\n commands: AssistantTransportCommand[];\n};\n\nexport type AssistantTransportCommand =\n | Exclude<CoreAssistantTransportCommand, CoreUserCommands>\n | UserCommands;\n\nexport type AssistantTransportConnectionMetadata = Omit<\n CoreAssistantTransportConnectionMetadata,\n \"pendingCommands\"\n> & {\n pendingCommands: AssistantTransportCommand[];\n};\n\nexport type AssistantTransportStateConverter<T> = (\n state: T,\n connectionMetadata: AssistantTransportConnectionMetadata,\n) => ReturnType<CoreAssistantTransportOptions<T>[\"converter\"]>;\n\nexport type AssistantTransportOptions<T> = Omit<\n CoreAssistantTransportOptions<T>,\n \"converter\" | \"prepareSendCommandsRequest\" | \"onError\" | \"onCancel\"\n> & {\n converter: AssistantTransportStateConverter<T>;\n prepareSendCommandsRequest?: (\n body: SendCommandsRequestBody,\n ) => Record<string, unknown> | Promise<Record<string, unknown>>;\n onError?: (\n error: Error,\n params: {\n commands: AssistantTransportCommand[];\n updateState: (updater: (state: T) => T) => void;\n },\n ) => void | Promise<void>;\n onCancel?: (params: {\n commands: AssistantTransportCommand[];\n updateState: (updater: (state: T) => T) => void;\n error?: Error;\n }) => void;\n};\n\nexport const useAssistantTransportRuntime = <T>(\n options: AssistantTransportOptions<T>,\n): AssistantRuntime => {\n return useCoreAssistantTransportRuntime(\n options as CoreAssistantTransportOptions<T>,\n );\n};\n\nexport const useAssistantTransportSendCommand = () => {\n const send = useCoreAssistantTransportSendCommand();\n return (command: AssistantTransportCommand) => {\n send(command as CoreAssistantTransportCommand);\n };\n};\n\nexport function useAssistantTransportState(): UserExternalState;\nexport function useAssistantTransportState<T>(\n selector: (state: UserExternalState) => T,\n): T;\nexport function useAssistantTransportState<T>(\n selector: (state: UserExternalState) => T = (state) => state as T,\n): T | UserExternalState {\n return useCoreAssistantTransportState(\n selector as (state: CoreUserExternalState) => T,\n );\n}\n"],"mappings":";;;;AAoEA,MAAaO,gCAA+BoC,YAAA;CAAA,OAGnCnC,+BACLmC,OACF;AAAC;AAGH,MAAalC,yCAAmC;CAAA,MAAAmC,IAAA3C,EAAA,CAAA;CAC9C,MAAA4C,OAAanC,mCAAqC;CAAE,IAAAoC;CAAA,IAAAF,EAAA,OAAAC,MAAA;EAC7CC,MAAAC,YAAA;GACLF,KAAKE,OAAwC;EAAC;EAC/CH,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAFME;AAEN;AAOH,SAAgBnC,2BACdqC,YAA6CrB,UAAUA,OAChC;CACvB,OAAOf,6BACLoC,QACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { AuiConfig, AuiProvider, useAui } from "@assistant-ui/store";
|
|
3
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
|
+
import { AuiConfig, AuiProvider, useAui } from "@assistant-ui/store";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { ThreadMessageClient } from "@assistant-ui/core/store";
|
|
6
6
|
//#region src/context/providers/MessageProvider.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
3
2
|
import { getMessageQuote } from "@assistant-ui/core/react";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
4
|
//#region src/hooks/useMessageQuote.ts
|
|
5
5
|
/**
|
|
6
6
|
* Hook that returns the quote info for the current message, if any.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
3
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
4
4
|
import { useEffect, useState } from "@assistant-ui/tap/react-shim";
|
|
5
5
|
//#region src/hooks/useToolCallElapsed.ts
|
|
6
6
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@assistant-ui/core/react" />
|
|
2
2
|
import { Assistant } from "./augmentations.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AssistantTransportCommand, AssistantTransportConnectionMetadata, AssistantTransportProtocol, SendCommandsRequestBody, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState } from "./assistant-transport.js";
|
|
4
4
|
import { AssistantRuntimeProvider } from "./legacy-runtime/AssistantRuntimeProvider.js";
|
|
5
5
|
import { ThreadListItemByIndexProvider, ThreadListItemRuntimeProvider } from "./context/providers/ThreadListItemProvider.js";
|
|
6
6
|
import { MessageByIndexProvider } from "./context/providers/MessageByIndexProvider.js";
|
|
@@ -17,10 +17,7 @@ import { DevToolsHooks, DevToolsProviderApi } from "./devtools/DevToolsHooks.js"
|
|
|
17
17
|
import { useMessageQuote } from "./hooks/useMessageQuote.js";
|
|
18
18
|
import { useMessageTiming } from "./hooks/useMessageTiming.js";
|
|
19
19
|
import { useToolCallElapsed } from "./hooks/useToolCallElapsed.js";
|
|
20
|
-
import { useCloudThreadListRuntime } from "./legacy-runtime/cloud/useCloudThreadListRuntime.js";
|
|
21
20
|
import { CloudFileAttachmentAdapter } from "./legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js";
|
|
22
|
-
import { AssistantTransportCommand, AssistantTransportConnectionMetadata, AssistantTransportProtocol, SendCommandsRequestBody } from "./legacy-runtime/runtime-cores/assistant-transport/types.js";
|
|
23
|
-
import { useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState } from "./legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js";
|
|
24
21
|
import { useExternalStoreRuntime } from "./legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js";
|
|
25
22
|
import { convertExternalMessages, useExternalMessageConverter } from "./legacy-runtime/runtime-cores/external-store/external-message-converter.js";
|
|
26
23
|
import { createMessageConverter } from "./legacy-runtime/runtime-cores/external-store/createMessageConverter.js";
|
|
@@ -72,10 +69,10 @@ import { McpAppRenderer, McpAppRendererOptions } from "./mcp-apps/McpAppRenderer
|
|
|
72
69
|
import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
|
|
73
70
|
import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
|
|
74
71
|
import "./mcp-apps/index.js";
|
|
72
|
+
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, useCloudThreadListRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
75
73
|
import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiConfig, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
76
|
-
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";
|
|
77
74
|
import { AssistantCloud } from "assistant-cloud";
|
|
78
75
|
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, MessageNotSentError, MessagePartRuntime, MessagePartState, MessagePartStatus, MessagePartStreamStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PartProviderMetadata, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RemoteThreadListProviderComponent, 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, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
76
|
+
import { ChainOfThoughtClient, ComposerSendOptions, ExternalThread, ExternalThreadMessage, ExternalThreadProps, InMemoryThreadList, InMemoryThreadListProps, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, RemoteThreadList, RemoteThreadListProps, SingleThreadList, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
|
|
79
77
|
import { Tool } from "assistant-stream";
|
|
80
|
-
import { ChainOfThoughtClient, ComposerSendOptions, ExternalThread, ExternalThreadMessage, ExternalThreadProps, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, SingleThreadList, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
|
|
81
|
-
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, AuiConfig, 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, MessageNotSentError, 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 RemoteThreadListProviderComponent, 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, isMessageNotSentError, 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 };
|
|
78
|
+
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, AuiConfig, 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, MessageNotSentError, 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, RemoteThreadList, type RemoteThreadListAdapter, type RemoteThreadListProps, type RemoteThreadListProviderComponent, 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, isMessageNotSentError, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCloudThreadListAdapter } from "./legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js";
|
|
3
|
-
import { useCloudThreadListRuntime } from "./legacy-runtime/cloud/useCloudThreadListRuntime.js";
|
|
1
|
+
import { useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState } from "./assistant-transport.js";
|
|
4
2
|
import { CloudFileAttachmentAdapter } from "./legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js";
|
|
5
3
|
import { useExternalStoreRuntime } from "./legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js";
|
|
6
|
-
import { useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState } from "./legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js";
|
|
7
4
|
import { convertExternalMessages, useExternalMessageConverter } from "./legacy-runtime/runtime-cores/external-store/external-message-converter.js";
|
|
8
5
|
import { createMessageConverter } from "./legacy-runtime/runtime-cores/external-store/createMessageConverter.js";
|
|
9
6
|
import { useLocalRuntime } from "./legacy-runtime/runtime-cores/local/useLocalRuntime.js";
|
|
7
|
+
import { useRemoteThreadListRuntime } from "./legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js";
|
|
8
|
+
import { useCloudThreadListAdapter } from "./legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js";
|
|
10
9
|
import { useThreadViewport, useThreadViewportStore } from "./context/react/ThreadViewportContext.js";
|
|
11
10
|
import { DevToolsHooks, DevToolsProviderApi } from "./devtools/DevToolsHooks.js";
|
|
12
11
|
import { AssistantRuntimeProvider } from "./legacy-runtime/AssistantRuntimeProvider.js";
|
|
@@ -53,7 +52,6 @@ import { useMessageQuote } from "./hooks/useMessageQuote.js";
|
|
|
53
52
|
import { useMessageTiming } from "./hooks/useMessageTiming.js";
|
|
54
53
|
import { useToolCallElapsed } from "./hooks/useToolCallElapsed.js";
|
|
55
54
|
import { unstable_useMessageStallDetection } from "./unstable/useMessageStallDetection.js";
|
|
56
|
-
import { InMemoryThreadList } from "./client/InMemoryThreadList.js";
|
|
57
55
|
import { internal_exports } from "./internal.js";
|
|
58
56
|
import { unstable_useMentionAdapter } from "./unstable/useMentionAdapter.js";
|
|
59
57
|
import { unstable_useSlashCommandAdapter } from "./unstable/useSlashCommandAdapter.js";
|
|
@@ -63,9 +61,9 @@ import { unstable_useComposerInput, unstable_useTriggerPopoverAriaProps } from "
|
|
|
63
61
|
import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
|
|
64
62
|
import { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
|
|
65
63
|
import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
|
|
64
|
+
import { DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, RuntimeAdapterProvider, Tools, 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, useCloudThreadListRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
66
65
|
import { AuiConfig, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
67
|
-
import { DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, RuntimeAdapterProvider, Tools, 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";
|
|
68
66
|
import { AssistantCloud } from "assistant-cloud";
|
|
69
67
|
import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, MessageNotSentError, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
70
|
-
import { ChainOfThoughtClient, ExternalThread, ModelContext as ModelContextClient, SingleThreadList, Suggestions } from "@assistant-ui/core/store";
|
|
71
|
-
export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiConfig, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessageNotSentError, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, 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 };
|
|
68
|
+
import { ChainOfThoughtClient, ExternalThread, InMemoryThreadList, ModelContext as ModelContextClient, RemoteThreadList, SingleThreadList, Suggestions } from "@assistant-ui/core/store";
|
|
69
|
+
export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiConfig, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, MessageNotSentError, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RemoteThreadList, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, 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,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ThreadPrimitiveViewportProvider } from "../context/providers/ThreadViewportProvider.js";
|
|
3
3
|
import { DevToolsProviderApi } from "../devtools/DevToolsHooks.js";
|
|
4
|
-
import { useAui } from "@assistant-ui/store";
|
|
5
4
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
6
5
|
import { AssistantProviderBase } from "@assistant-ui/core/react";
|
|
6
|
+
import { useAui } from "@assistant-ui/store";
|
|
7
7
|
import { memo, useEffect } from "@assistant-ui/tap/react-shim";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/legacy-runtime/AssistantRuntimeProvider.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAppsRemoteHost.d.ts","names":[],"sources":["../../src/mcp-apps/McpAppsRemoteHost.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"McpAppsRemoteHost.d.ts","names":[],"sources":["../../src/mcp-apps/McpAppsRemoteHost.ts"],"mappings":";;cAgJa,+CAAiB,SAAA,cAAA,SAAA"}
|
|
@@ -28,6 +28,15 @@ const readErrorBody = async (res) => {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
const invalidMcpAppResource = (options) => {
|
|
32
|
+
throw new Error(`Invalid MCP App host response "mcp-apps/read-resource" from "${options.url}": expected a resource with non-empty string "uri" and "html" fields`);
|
|
33
|
+
};
|
|
34
|
+
const parseMcpAppResource = (value, options) => {
|
|
35
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return invalidMcpAppResource(options);
|
|
36
|
+
const resource = value;
|
|
37
|
+
if (typeof resource.uri !== "string" || resource.uri.trim() === "" || typeof resource.html !== "string" || resource.html.trim() === "") return invalidMcpAppResource(options);
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
31
40
|
async function postToHost(options, method, params) {
|
|
32
41
|
const doFetch = options.fetch ?? fetch;
|
|
33
42
|
const extraHeaders = typeof options.headers === "function" ? await options.headers() : options.headers ?? {};
|
|
@@ -47,7 +56,11 @@ async function postToHost(options, method, params) {
|
|
|
47
56
|
const body = await readErrorBody(res);
|
|
48
57
|
throw new Error(`MCP App host request "${method}" to "${options.url}" failed with ${status}${body ? `: ${body}` : ""}`);
|
|
49
58
|
}
|
|
50
|
-
|
|
59
|
+
try {
|
|
60
|
+
return await res.json();
|
|
61
|
+
} catch (cause) {
|
|
62
|
+
throw new Error(`Invalid MCP App host response "${method}" from "${options.url}": expected valid JSON`, { cause });
|
|
63
|
+
}
|
|
51
64
|
}
|
|
52
65
|
/**
|
|
53
66
|
* Creates the default HTTP host for MCP App widgets.
|
|
@@ -70,7 +83,10 @@ const useMcpAppsRemoteHost = (options) => {
|
|
|
70
83
|
};
|
|
71
84
|
};
|
|
72
85
|
return {
|
|
73
|
-
loadResource: (params) =>
|
|
86
|
+
loadResource: async (params) => {
|
|
87
|
+
const options_0 = getCurrentOptions();
|
|
88
|
+
return parseMcpAppResource(await postToHost(options_0, "mcp-apps/read-resource", params), options_0);
|
|
89
|
+
},
|
|
74
90
|
callTool: (params_0) => postToHost(getCurrentOptions(), "tools/call", params_0),
|
|
75
91
|
readResource: (params_1) => postToHost(getCurrentOptions(), "resources/read", params_1),
|
|
76
92
|
listResources: (params_2) => postToHost(getCurrentOptions(), "resources/list", params_2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAppsRemoteHost.js","names":["useMemo","useRef","resource","McpAppResource","McpAppsHost","McpAppsRemoteHostOptions","truncateBody","body","length","slice","extractErrorBody","trimmed","trim","undefined","parsed","JSON","parse","record","Record","message","error","readErrorBody","res","Response","Promise","text","
|
|
1
|
+
{"version":3,"file":"McpAppsRemoteHost.js","names":["useMemo","useRef","resource","McpAppResource","McpAppsHost","McpAppsRemoteHostOptions","truncateBody","body","length","slice","extractErrorBody","trimmed","trim","undefined","parsed","JSON","parse","record","Record","message","error","readErrorBody","res","Response","Promise","text","invalidMcpAppResource","options","Error","url","parseMcpAppResource","value","Array","isArray","uri","html","postToHost","method","params","doFetch","fetch","extraHeaders","headers","stringify","ok","status","statusText","json","cause","useMcpAppsRemoteHost","optionsRef","current","getCurrentOptions","loadResource","callTool","readResource","listResources","McpAppsRemoteHost"],"sources":["../../src/mcp-apps/McpAppsRemoteHost.ts"],"sourcesContent":["import { useMemo, useRef } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type {\n McpAppResource,\n McpAppsHost,\n McpAppsRemoteHostOptions,\n} from \"./types\";\n\nconst truncateBody = (body: string) =>\n body.length > 500 ? `${body.slice(0, 500)}...` : body;\n\nconst extractErrorBody = (body: string): string | undefined => {\n const trimmed = body.trim();\n if (!trimmed) return undefined;\n\n try {\n const parsed = JSON.parse(trimmed) as unknown;\n if (parsed && typeof parsed === \"object\") {\n const record = parsed as Record<string, unknown>;\n if (typeof record.message === \"string\") return record.message;\n if (typeof record.error === \"string\") return record.error;\n if (record.error && typeof record.error === \"object\") {\n const error = record.error as Record<string, unknown>;\n if (typeof error.message === \"string\") return error.message;\n }\n }\n } catch {\n return truncateBody(trimmed);\n }\n\n return truncateBody(trimmed);\n};\n\nconst readErrorBody = async (res: Response): Promise<string | undefined> => {\n try {\n return extractErrorBody(await res.text());\n } catch {\n return undefined;\n }\n};\n\nconst invalidMcpAppResource = (options: McpAppsRemoteHostOptions): never => {\n throw new Error(\n `Invalid MCP App host response \"mcp-apps/read-resource\" from \"${options.url}\": expected a resource with non-empty string \"uri\" and \"html\" fields`,\n );\n};\n\nconst parseMcpAppResource = (\n value: unknown,\n options: McpAppsRemoteHostOptions,\n): McpAppResource => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return invalidMcpAppResource(options);\n }\n\n const resource = value as Record<string, unknown>;\n if (\n typeof resource.uri !== \"string\" ||\n resource.uri.trim() === \"\" ||\n typeof resource.html !== \"string\" ||\n resource.html.trim() === \"\"\n ) {\n return invalidMcpAppResource(options);\n }\n\n return value as McpAppResource;\n};\n\nasync function postToHost(\n options: McpAppsRemoteHostOptions,\n method: string,\n params: unknown,\n): Promise<unknown> {\n const doFetch = options.fetch ?? fetch;\n const extraHeaders =\n typeof options.headers === \"function\"\n ? await options.headers()\n : (options.headers ?? {});\n const res = await doFetch(options.url, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", ...extraHeaders },\n body: JSON.stringify({ method, params }),\n });\n if (!res.ok) {\n const status = res.statusText\n ? `${res.status} ${res.statusText}`\n : `${res.status}`;\n const body = await readErrorBody(res);\n throw new Error(\n `MCP App host request \"${method}\" to \"${options.url}\" failed with ${status}${body ? `: ${body}` : \"\"}`,\n );\n }\n try {\n return await res.json();\n } catch (cause) {\n throw new Error(\n `Invalid MCP App host response \"${method}\" from \"${options.url}\": expected valid JSON`,\n { cause },\n );\n }\n}\n\n/**\n * Creates the default HTTP host for MCP App widgets.\n *\n * The host POSTs widget requests to the configured route as `{ method,\n * params }`, using the method names expected by the assistant-ui MCP Apps\n * guide.\n */\nconst useMcpAppsRemoteHost = (\n options: McpAppsRemoteHostOptions,\n): McpAppsHost => {\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n const url = options.url;\n\n return useMemo((): McpAppsHost => {\n const getCurrentOptions = (): McpAppsRemoteHostOptions => {\n const current = optionsRef.current;\n return {\n url,\n ...(current.fetch !== undefined ? { fetch: current.fetch } : {}),\n ...(current.headers !== undefined ? { headers: current.headers } : {}),\n };\n };\n return {\n loadResource: async (params) => {\n const options = getCurrentOptions();\n return parseMcpAppResource(\n await postToHost(options, \"mcp-apps/read-resource\", params),\n options,\n );\n },\n callTool: (params) =>\n postToHost(getCurrentOptions(), \"tools/call\", params),\n readResource: (params) =>\n postToHost(getCurrentOptions(), \"resources/read\", params),\n listResources: (params) =>\n postToHost(getCurrentOptions(), \"resources/list\", params),\n };\n }, [url]);\n};\n\nexport const McpAppsRemoteHost = resource(useMcpAppsRemoteHost);\n"],"mappings":";;;AAQA,MAAMM,gBAAgBC,SACpBA,KAAKC,SAAS,MAAM,GAAGD,KAAKE,MAAM,GAAG,GAAG,EAAC,OAAQF;AAEnD,MAAMG,oBAAoBH,SAAqC;CAC7D,MAAMI,UAAUJ,KAAKK,KAAK;CAC1B,IAAI,CAACD,SAAS,OAAOE,KAAAA;CAErB,IAAI;EACF,MAAMC,SAASC,KAAKC,MAAML,OAAO;EACjC,IAAIG,UAAU,OAAOA,WAAW,UAAU;GACxC,MAAMG,SAASH;GACf,IAAI,OAAOG,OAAOE,YAAY,UAAU,OAAOF,OAAOE;GACtD,IAAI,OAAOF,OAAOG,UAAU,UAAU,OAAOH,OAAOG;GACpD,IAAIH,OAAOG,SAAS,OAAOH,OAAOG,UAAU,UAAU;IACpD,MAAMA,QAAQH,OAAOG;IACrB,IAAI,OAAOA,MAAMD,YAAY,UAAU,OAAOC,MAAMD;GACtD;EACF;CACF,QAAQ;EACN,OAAOb,aAAaK,OAAO;CAC7B;CAEA,OAAOL,aAAaK,OAAO;AAC7B;AAEA,MAAMU,gBAAgB,OAAOC,QAA+C;CAC1E,IAAI;EACF,OAAOZ,iBAAiB,MAAMY,IAAIG,KAAK,CAAC;CAC1C,QAAQ;EACN;CACF;AACF;AAEA,MAAMC,yBAAyBC,YAA6C;CAC1E,MAAM,IAAIC,MACR,gEAAgED,QAAQE,IAAG,qEAC7E;AACF;AAEA,MAAMC,uBACJC,OACAJ,YACmB;CACnB,IAAI,OAAOI,UAAU,YAAYA,UAAU,QAAQC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C;GAC3B,OAAO;IACLtB;IACA,GAAIsB,QAAQX,UAAU3B,KAAAA,IAAY,EAAE2B,OAAOW,QAAQX,MAAM,IAAI,CAAC;IAC9D,GAAIW,QAAQT,YAAY7B,KAAAA,IAAY,EAAE6B,SAASS,QAAQT,QAAQ,IAAI,CAAC;GACtE;EACF;EACA,OAAO;GACLW,cAAc,OAAOf,WAAW;IAC9B,MAAMX,YAAUyB,kBAAkB;IAClC,OAAOtB,oBACL,MAAMM,WAAWT,WAAS,0BAA0BW,MAAM,GAC1DX,SACF;GACF;GACA2B,WAAWhB,aACTF,WAAWgB,kBAAkB,GAAG,cAAcd,QAAM;GACtDiB,eAAejB,aACbF,WAAWgB,kBAAkB,GAAG,kBAAkBd,QAAM;GAC1DkB,gBAAgBlB,aACdF,WAAWgB,kBAAkB,GAAG,kBAAkBd,QAAM;EAC5D;CACF,GAAG,CAACT,GAAG,CAAC;AACV;AAEA,MAAa4B,oBAAoBvD,SAAS+C,oBAAoB"}
|
package/dist/mcp-apps/bridge.js
CHANGED
|
@@ -58,6 +58,16 @@ function createMcpAppBridge(opts) {
|
|
|
58
58
|
...data !== void 0 ? { data } : {}
|
|
59
59
|
} });
|
|
60
60
|
};
|
|
61
|
+
const reportErrorCallbackFailure = (error) => {
|
|
62
|
+
console.error("[assistant-ui] MCP App onError callback threw an error", error);
|
|
63
|
+
};
|
|
64
|
+
const reportError = (error) => {
|
|
65
|
+
try {
|
|
66
|
+
Promise.resolve(handlers.onError?.(error)).catch(reportErrorCallbackFailure);
|
|
67
|
+
} catch (callbackError) {
|
|
68
|
+
reportErrorCallbackFailure(callbackError);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
61
71
|
const handleRequest = async (req) => {
|
|
62
72
|
try {
|
|
63
73
|
const params = req.params;
|
|
@@ -194,35 +204,40 @@ function createMcpAppBridge(opts) {
|
|
|
194
204
|
}
|
|
195
205
|
} catch (err) {
|
|
196
206
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
197
|
-
|
|
207
|
+
reportError(error);
|
|
198
208
|
errorResponse(req.id, JSONRPC_ERROR.internalError, error.message);
|
|
199
209
|
}
|
|
200
210
|
};
|
|
201
211
|
const handleNotification = (note) => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
212
|
+
try {
|
|
213
|
+
switch (normalizeMethod(note.method)) {
|
|
214
|
+
case "notifications/initialized":
|
|
215
|
+
handlers.onInitialized?.();
|
|
216
|
+
return;
|
|
217
|
+
case "notifications/size_changed": {
|
|
218
|
+
const p = note.params ?? {};
|
|
219
|
+
handlers.onSizeChange?.({
|
|
220
|
+
...typeof p.width === "number" ? { width: p.width } : {},
|
|
221
|
+
...typeof p.height === "number" ? { height: p.height } : {}
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
case "notifications/log":
|
|
226
|
+
handlers.onLog?.(note.params);
|
|
227
|
+
return;
|
|
228
|
+
case "notifications/request_teardown":
|
|
229
|
+
handlers.onRequestTeardown?.(note.params);
|
|
230
|
+
return;
|
|
231
|
+
case "notifications/error": {
|
|
232
|
+
const p = note.params ?? {};
|
|
233
|
+
reportError(new Error(typeof p.message === "string" ? p.message : "Widget error"));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
default: return;
|
|
224
237
|
}
|
|
225
|
-
|
|
238
|
+
} catch (err) {
|
|
239
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
240
|
+
reportError(error);
|
|
226
241
|
}
|
|
227
242
|
};
|
|
228
243
|
const onMessage = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","names":["SandboxHostFrame","MCP_APP_PROTOCOL_VERSION","McpAppBridgeHandlers","McpAppDisplayMode","McpAppHostContext","McpAppHostInfo","McpAppJsonRpcMessage","McpAppJsonRpcNotification","McpAppJsonRpcRequest","McpAppJsonRpcResponse","isRecord","VALID_DISPLAY_MODES","const","McpAppBridgeFrame","CreateMcpAppBridgeOptions","frame","handlers","hostInfo","hostContext","McpAppBridge","onMessage","event","MessageEvent","dispose","notifyToolInput","input","notifyToolResult","result","notifyHostContextChanged","DEFAULT_HOST_INFO","name","version","METHOD_ALIASES","Record","normalizeMethod","method","JSONRPC_ERROR","parseError","invalidRequest","methodNotFound","invalidParams","internalError","isJsonRpcMessage","value","v","jsonrpc","isRequest","msg","isNotification","createMcpAppBridge","opts","post","sendMessage","respond","id","payload","error","code","message","data","res","errorResponse","undefined","handleRequest","req","params","requestedProtocolVersion","protocolVersion","host","capabilities","tools","callTool","resources","readResource","listResources","ui","openLink","requestDisplayMode","updateModelContext","hostCapabilities","openLinks","serverTools","serverResources","text","onLog","logging","callParams","arguments","allowedTools","includes","callArgs","Array","isArray","readParams","uri","linkParams","url","linkProtocol","URL","protocol","modeParams","mode","err","Error","String","onError","handleNotification","note","onInitialized","p","width","height","onSizeChange","onRequestTeardown","content","type","ctx"],"sources":["../../src/mcp-apps/bridge.ts"],"sourcesContent":["import type { SandboxHostFrame } from \"../sandbox-host/SandboxHost\";\nimport {\n MCP_APP_PROTOCOL_VERSION,\n type McpAppBridgeHandlers,\n type McpAppDisplayMode,\n type McpAppHostContext,\n type McpAppHostInfo,\n type McpAppJsonRpcMessage,\n type McpAppJsonRpcNotification,\n type McpAppJsonRpcRequest,\n type McpAppJsonRpcResponse,\n} from \"./types\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\nconst VALID_DISPLAY_MODES = [\n \"inline\",\n \"fullscreen\",\n \"pip\",\n] as const satisfies readonly McpAppDisplayMode[];\n\nexport type McpAppBridgeFrame = SandboxHostFrame;\n\nexport type CreateMcpAppBridgeOptions = {\n frame: McpAppBridgeFrame;\n handlers?: McpAppBridgeHandlers | undefined;\n hostInfo?: McpAppHostInfo | undefined;\n hostContext?: McpAppHostContext | undefined;\n};\n\nexport type McpAppBridge = {\n onMessage: (event: MessageEvent) => void;\n dispose: () => void;\n notifyToolInput: (input: unknown) => void;\n notifyToolResult: (result: unknown) => void;\n notifyHostContextChanged: (hostContext: McpAppHostContext) => void;\n};\n\nconst DEFAULT_HOST_INFO: McpAppHostInfo = {\n name: \"assistant-ui\",\n version: \"0.1\",\n};\n\n// Accept both the legacy method names and the MCP-UI 2026-01-26 names that\n// `ui/*` capable widgets (e.g. xmcp's host-bridge) emit. Normalize on input\n// so downstream switch statements only need to know the legacy names.\nconst METHOD_ALIASES: Record<string, string> = {\n \"ui/notifications/initialized\": \"notifications/initialized\",\n \"ui/notifications/size-changed\": \"notifications/size_changed\",\n \"ui/request-display-mode\": \"requestDisplayMode\",\n \"ui/open-link\": \"openLink\",\n \"ui/update-model-context\": \"updateModelContext\",\n \"ui/message\": \"sendMessage\",\n \"notifications/message\": \"notifications/log\",\n};\n\nconst normalizeMethod = (method: string): string =>\n METHOD_ALIASES[method] ?? method;\n\nconst JSONRPC_ERROR = {\n parseError: -32700,\n invalidRequest: -32600,\n methodNotFound: -32601,\n invalidParams: -32602,\n internalError: -32603,\n} as const;\n\nfunction isJsonRpcMessage(value: unknown): value is McpAppJsonRpcMessage {\n if (!value || typeof value !== \"object\") return false;\n const v = value as Record<string, unknown>;\n return v.jsonrpc === \"2.0\" && typeof v.method === \"string\";\n}\n\nfunction isRequest(msg: McpAppJsonRpcMessage): msg is McpAppJsonRpcRequest {\n return \"id\" in msg;\n}\n\nfunction isNotification(\n msg: McpAppJsonRpcMessage,\n): msg is McpAppJsonRpcNotification {\n return !(\"id\" in msg);\n}\n\nexport function createMcpAppBridge(\n opts: CreateMcpAppBridgeOptions,\n): McpAppBridge {\n const {\n frame,\n handlers = {},\n hostInfo = DEFAULT_HOST_INFO,\n hostContext = {},\n } = opts;\n\n const post = (msg: McpAppJsonRpcMessage) => {\n frame.sendMessage(msg);\n };\n\n const respond = (\n id: McpAppJsonRpcRequest[\"id\"],\n payload:\n | { result: unknown }\n | { error: { code: number; message: string; data?: unknown } },\n ) => {\n const res: McpAppJsonRpcResponse = {\n jsonrpc: \"2.0\",\n id,\n ...payload,\n };\n post(res);\n };\n\n const errorResponse = (\n id: McpAppJsonRpcRequest[\"id\"],\n code: number,\n message: string,\n data?: unknown,\n ) => {\n respond(id, {\n error: {\n code,\n message,\n ...(data !== undefined ? { data } : {}),\n },\n });\n };\n\n const handleRequest = async (req: McpAppJsonRpcRequest) => {\n try {\n const params = req.params;\n\n switch (normalizeMethod(req.method)) {\n case \"ui/initialize\": {\n const requestedProtocolVersion =\n isRecord(params) && typeof params.protocolVersion === \"string\"\n ? params.protocolVersion\n : MCP_APP_PROTOCOL_VERSION;\n respond(req.id, {\n result: {\n protocolVersion: requestedProtocolVersion,\n host: hostInfo,\n hostInfo,\n hostContext,\n capabilities: {\n tools: handlers.callTool ? {} : undefined,\n resources:\n handlers.readResource || handlers.listResources\n ? {}\n : undefined,\n ui: {\n sendMessage: !!handlers.sendMessage,\n openLink: !!handlers.openLink,\n requestDisplayMode: !!handlers.requestDisplayMode,\n updateModelContext: !!handlers.updateModelContext,\n },\n },\n hostCapabilities: {\n ...(handlers.openLink ? { openLinks: {} } : {}),\n ...(handlers.callTool ? { serverTools: {} } : {}),\n ...(handlers.readResource || handlers.listResources\n ? { serverResources: {} }\n : {}),\n ...(handlers.updateModelContext\n ? { updateModelContext: { text: {} } }\n : {}),\n ...(handlers.sendMessage ? { message: { text: {} } } : {}),\n ...(handlers.onLog ? { logging: {} } : {}),\n },\n },\n });\n return;\n }\n\n case \"tools/call\": {\n if (!handlers.callTool) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"tools/call is not supported by this host\",\n );\n return;\n }\n const callParams = (params ?? {}) as {\n name?: unknown;\n arguments?: unknown;\n };\n if (typeof callParams.name !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"tools/call requires a string 'name'\",\n );\n return;\n }\n if (\n handlers.allowedTools &&\n !handlers.allowedTools.includes(callParams.name)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n `tool '${callParams.name}' is not allowed for this app`,\n );\n return;\n }\n let callArgs: Record<string, unknown> | undefined;\n if (callParams.arguments !== undefined) {\n if (\n callParams.arguments === null ||\n typeof callParams.arguments !== \"object\" ||\n Array.isArray(callParams.arguments)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"tools/call 'arguments' must be an object\",\n );\n return;\n }\n callArgs = callParams.arguments as Record<string, unknown>;\n }\n const result = await handlers.callTool({\n name: callParams.name,\n ...(callArgs !== undefined ? { arguments: callArgs } : {}),\n });\n respond(req.id, { result });\n return;\n }\n\n case \"resources/read\": {\n if (!handlers.readResource) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"resources/read is not supported by this host\",\n );\n return;\n }\n const readParams = (params ?? {}) as { uri?: unknown };\n if (typeof readParams.uri !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"resources/read requires a string 'uri'\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.readResource({ uri: readParams.uri }),\n });\n return;\n }\n\n case \"resources/list\": {\n if (!handlers.listResources) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"resources/list is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.listResources(params)) ?? null,\n });\n return;\n }\n\n case \"openLink\": {\n if (!handlers.openLink) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"openLink is not supported by this host\",\n );\n return;\n }\n const linkParams = (params ?? {}) as { url?: unknown };\n if (typeof linkParams.url !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink requires a string 'url'\",\n );\n return;\n }\n let linkProtocol: string;\n try {\n linkProtocol = new URL(linkParams.url).protocol;\n } catch {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink requires a valid URL\",\n );\n return;\n }\n if (linkProtocol !== \"https:\" && linkProtocol !== \"http:\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink only accepts http(s) URLs\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.openLink({ url: linkParams.url }),\n });\n return;\n }\n\n case \"sendMessage\": {\n if (!handlers.sendMessage) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"sendMessage is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.sendMessage(params)) ?? null,\n });\n return;\n }\n\n case \"updateModelContext\": {\n if (!handlers.updateModelContext) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"updateModelContext is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.updateModelContext(params)) ?? null,\n });\n return;\n }\n\n case \"requestDisplayMode\": {\n if (!handlers.requestDisplayMode) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"requestDisplayMode is not supported by this host\",\n );\n return;\n }\n const modeParams = (params ?? {}) as { mode?: unknown };\n if (\n typeof modeParams.mode !== \"string\" ||\n !VALID_DISPLAY_MODES.includes(modeParams.mode as McpAppDisplayMode)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"requestDisplayMode requires a valid 'mode'\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.requestDisplayMode({\n mode: modeParams.mode as McpAppDisplayMode,\n }),\n });\n return;\n }\n\n default: {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n `Unknown method: ${req.method}`,\n );\n }\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n handlers.onError?.(error);\n errorResponse(req.id, JSONRPC_ERROR.internalError, error.message);\n }\n };\n\n const handleNotification = (note: McpAppJsonRpcNotification) => {\n switch (normalizeMethod(note.method)) {\n case \"notifications/initialized\": {\n handlers.onInitialized?.();\n return;\n }\n case \"notifications/size_changed\": {\n const p = (note.params ?? {}) as { width?: number; height?: number };\n handlers.onSizeChange?.({\n ...(typeof p.width === \"number\" ? { width: p.width } : {}),\n ...(typeof p.height === \"number\" ? { height: p.height } : {}),\n });\n return;\n }\n case \"notifications/log\": {\n handlers.onLog?.(note.params);\n return;\n }\n case \"notifications/request_teardown\": {\n handlers.onRequestTeardown?.(note.params);\n return;\n }\n case \"notifications/error\": {\n const p = (note.params ?? {}) as { message?: string };\n handlers.onError?.(\n new Error(typeof p.message === \"string\" ? p.message : \"Widget error\"),\n );\n return;\n }\n default:\n return;\n }\n };\n\n // The host applies the cross-origin guard before delegating; this only\n // validates the JSON-RPC envelope.\n const onMessage = (event: MessageEvent) => {\n if (!isJsonRpcMessage(event.data)) return;\n\n const msg = event.data;\n if (isRequest(msg)) {\n void handleRequest(msg);\n } else if (isNotification(msg)) {\n handleNotification(msg);\n }\n };\n\n return {\n onMessage,\n dispose: () => {},\n notifyToolInput: (input: unknown) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/tools/call/input\",\n params: { input },\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/tool-input\",\n params: isRecord(input) ? { arguments: input } : {},\n });\n },\n notifyToolResult: (result: unknown) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/tools/call/result\",\n params: { result },\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/tool-result\",\n params: isRecord(result)\n ? result\n : { content: [{ type: \"text\", text: String(result) }] },\n });\n },\n notifyHostContextChanged: (ctx: McpAppHostContext) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/host_context/changed\",\n params: ctx,\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/host-context-changed\",\n params: ctx,\n });\n },\n };\n}\n"],"mappings":";;;AAcA,MAAMW,sBAAsB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EACAG,eAAe,CAAC;EAChBC,kBAAkBC,UAAmB;GACnC0B,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQ,EAAExC,MAAM;GAClB,CAAC;GACD0B,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQvD,SAASe,KAAK,IAAI,EAAE8D,WAAW9D,MAAM,IAAI,CAAC;GACpD,CAAC;EACH;EACAC,mBAAmBC,WAAoB;GACrCwB,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQ,EAAEtC,OAAO;GACnB,CAAC;GACDwB,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQvD,SAASiB,MAAM,IACnBA,SACA,EAAEuF,SAAS,CAAC;KAAEC,MAAM;KAAQhC,MAAMqB,OAAO7E,MAAM;IAAE,CAAC,EAAE;GAC1D,CAAC;EACH;EACAC,2BAA2BwF,QAA2B;GACpDjE,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQmD;GACV,CAAC;GACDjE,KAAK;IACHN,SAAS;IACTV,QAAQ;IACR8B,QAAQmD;GACV,CAAC;EACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"bridge.js","names":["SandboxHostFrame","MCP_APP_PROTOCOL_VERSION","McpAppBridgeHandlers","McpAppDisplayMode","McpAppHostContext","McpAppHostInfo","McpAppJsonRpcMessage","McpAppJsonRpcNotification","McpAppJsonRpcRequest","McpAppJsonRpcResponse","isRecord","VALID_DISPLAY_MODES","const","McpAppBridgeFrame","CreateMcpAppBridgeOptions","frame","handlers","hostInfo","hostContext","McpAppBridge","onMessage","event","MessageEvent","dispose","notifyToolInput","input","notifyToolResult","result","notifyHostContextChanged","DEFAULT_HOST_INFO","name","version","METHOD_ALIASES","Record","normalizeMethod","method","JSONRPC_ERROR","parseError","invalidRequest","methodNotFound","invalidParams","internalError","isJsonRpcMessage","value","v","jsonrpc","isRequest","msg","isNotification","createMcpAppBridge","opts","post","sendMessage","respond","id","payload","error","code","message","data","res","errorResponse","undefined","reportErrorCallbackFailure","console","reportError","Error","Promise","resolve","onError","catch","callbackError","handleRequest","req","params","requestedProtocolVersion","protocolVersion","host","capabilities","tools","callTool","resources","readResource","listResources","ui","openLink","requestDisplayMode","updateModelContext","hostCapabilities","openLinks","serverTools","serverResources","text","onLog","logging","callParams","arguments","allowedTools","includes","callArgs","Array","isArray","readParams","uri","linkParams","url","linkProtocol","URL","protocol","modeParams","mode","err","String","handleNotification","note","onInitialized","p","width","height","onSizeChange","onRequestTeardown","content","type","ctx"],"sources":["../../src/mcp-apps/bridge.ts"],"sourcesContent":["import type { SandboxHostFrame } from \"../sandbox-host/SandboxHost\";\nimport {\n MCP_APP_PROTOCOL_VERSION,\n type McpAppBridgeHandlers,\n type McpAppDisplayMode,\n type McpAppHostContext,\n type McpAppHostInfo,\n type McpAppJsonRpcMessage,\n type McpAppJsonRpcNotification,\n type McpAppJsonRpcRequest,\n type McpAppJsonRpcResponse,\n} from \"./types\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\nconst VALID_DISPLAY_MODES = [\n \"inline\",\n \"fullscreen\",\n \"pip\",\n] as const satisfies readonly McpAppDisplayMode[];\n\nexport type McpAppBridgeFrame = SandboxHostFrame;\n\nexport type CreateMcpAppBridgeOptions = {\n frame: McpAppBridgeFrame;\n handlers?: McpAppBridgeHandlers | undefined;\n hostInfo?: McpAppHostInfo | undefined;\n hostContext?: McpAppHostContext | undefined;\n};\n\nexport type McpAppBridge = {\n onMessage: (event: MessageEvent) => void;\n dispose: () => void;\n notifyToolInput: (input: unknown) => void;\n notifyToolResult: (result: unknown) => void;\n notifyHostContextChanged: (hostContext: McpAppHostContext) => void;\n};\n\nconst DEFAULT_HOST_INFO: McpAppHostInfo = {\n name: \"assistant-ui\",\n version: \"0.1\",\n};\n\n// Accept both the legacy method names and the MCP-UI 2026-01-26 names that\n// `ui/*` capable widgets (e.g. xmcp's host-bridge) emit. Normalize on input\n// so downstream switch statements only need to know the legacy names.\nconst METHOD_ALIASES: Record<string, string> = {\n \"ui/notifications/initialized\": \"notifications/initialized\",\n \"ui/notifications/size-changed\": \"notifications/size_changed\",\n \"ui/request-display-mode\": \"requestDisplayMode\",\n \"ui/open-link\": \"openLink\",\n \"ui/update-model-context\": \"updateModelContext\",\n \"ui/message\": \"sendMessage\",\n \"notifications/message\": \"notifications/log\",\n};\n\nconst normalizeMethod = (method: string): string =>\n METHOD_ALIASES[method] ?? method;\n\nconst JSONRPC_ERROR = {\n parseError: -32700,\n invalidRequest: -32600,\n methodNotFound: -32601,\n invalidParams: -32602,\n internalError: -32603,\n} as const;\n\nfunction isJsonRpcMessage(value: unknown): value is McpAppJsonRpcMessage {\n if (!value || typeof value !== \"object\") return false;\n const v = value as Record<string, unknown>;\n return v.jsonrpc === \"2.0\" && typeof v.method === \"string\";\n}\n\nfunction isRequest(msg: McpAppJsonRpcMessage): msg is McpAppJsonRpcRequest {\n return \"id\" in msg;\n}\n\nfunction isNotification(\n msg: McpAppJsonRpcMessage,\n): msg is McpAppJsonRpcNotification {\n return !(\"id\" in msg);\n}\n\nexport function createMcpAppBridge(\n opts: CreateMcpAppBridgeOptions,\n): McpAppBridge {\n const {\n frame,\n handlers = {},\n hostInfo = DEFAULT_HOST_INFO,\n hostContext = {},\n } = opts;\n\n const post = (msg: McpAppJsonRpcMessage) => {\n frame.sendMessage(msg);\n };\n\n const respond = (\n id: McpAppJsonRpcRequest[\"id\"],\n payload:\n | { result: unknown }\n | { error: { code: number; message: string; data?: unknown } },\n ) => {\n const res: McpAppJsonRpcResponse = {\n jsonrpc: \"2.0\",\n id,\n ...payload,\n };\n post(res);\n };\n\n const errorResponse = (\n id: McpAppJsonRpcRequest[\"id\"],\n code: number,\n message: string,\n data?: unknown,\n ) => {\n respond(id, {\n error: {\n code,\n message,\n ...(data !== undefined ? { data } : {}),\n },\n });\n };\n\n const reportErrorCallbackFailure = (error: unknown) => {\n console.error(\n \"[assistant-ui] MCP App onError callback threw an error\",\n error,\n );\n };\n\n const reportError = (error: Error) => {\n try {\n void Promise.resolve(handlers.onError?.(error)).catch(\n reportErrorCallbackFailure,\n );\n } catch (callbackError) {\n reportErrorCallbackFailure(callbackError);\n }\n };\n\n const handleRequest = async (req: McpAppJsonRpcRequest) => {\n try {\n const params = req.params;\n\n switch (normalizeMethod(req.method)) {\n case \"ui/initialize\": {\n const requestedProtocolVersion =\n isRecord(params) && typeof params.protocolVersion === \"string\"\n ? params.protocolVersion\n : MCP_APP_PROTOCOL_VERSION;\n respond(req.id, {\n result: {\n protocolVersion: requestedProtocolVersion,\n host: hostInfo,\n hostInfo,\n hostContext,\n capabilities: {\n tools: handlers.callTool ? {} : undefined,\n resources:\n handlers.readResource || handlers.listResources\n ? {}\n : undefined,\n ui: {\n sendMessage: !!handlers.sendMessage,\n openLink: !!handlers.openLink,\n requestDisplayMode: !!handlers.requestDisplayMode,\n updateModelContext: !!handlers.updateModelContext,\n },\n },\n hostCapabilities: {\n ...(handlers.openLink ? { openLinks: {} } : {}),\n ...(handlers.callTool ? { serverTools: {} } : {}),\n ...(handlers.readResource || handlers.listResources\n ? { serverResources: {} }\n : {}),\n ...(handlers.updateModelContext\n ? { updateModelContext: { text: {} } }\n : {}),\n ...(handlers.sendMessage ? { message: { text: {} } } : {}),\n ...(handlers.onLog ? { logging: {} } : {}),\n },\n },\n });\n return;\n }\n\n case \"tools/call\": {\n if (!handlers.callTool) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"tools/call is not supported by this host\",\n );\n return;\n }\n const callParams = (params ?? {}) as {\n name?: unknown;\n arguments?: unknown;\n };\n if (typeof callParams.name !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"tools/call requires a string 'name'\",\n );\n return;\n }\n if (\n handlers.allowedTools &&\n !handlers.allowedTools.includes(callParams.name)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n `tool '${callParams.name}' is not allowed for this app`,\n );\n return;\n }\n let callArgs: Record<string, unknown> | undefined;\n if (callParams.arguments !== undefined) {\n if (\n callParams.arguments === null ||\n typeof callParams.arguments !== \"object\" ||\n Array.isArray(callParams.arguments)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"tools/call 'arguments' must be an object\",\n );\n return;\n }\n callArgs = callParams.arguments as Record<string, unknown>;\n }\n const result = await handlers.callTool({\n name: callParams.name,\n ...(callArgs !== undefined ? { arguments: callArgs } : {}),\n });\n respond(req.id, { result });\n return;\n }\n\n case \"resources/read\": {\n if (!handlers.readResource) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"resources/read is not supported by this host\",\n );\n return;\n }\n const readParams = (params ?? {}) as { uri?: unknown };\n if (typeof readParams.uri !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"resources/read requires a string 'uri'\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.readResource({ uri: readParams.uri }),\n });\n return;\n }\n\n case \"resources/list\": {\n if (!handlers.listResources) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"resources/list is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.listResources(params)) ?? null,\n });\n return;\n }\n\n case \"openLink\": {\n if (!handlers.openLink) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"openLink is not supported by this host\",\n );\n return;\n }\n const linkParams = (params ?? {}) as { url?: unknown };\n if (typeof linkParams.url !== \"string\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink requires a string 'url'\",\n );\n return;\n }\n let linkProtocol: string;\n try {\n linkProtocol = new URL(linkParams.url).protocol;\n } catch {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink requires a valid URL\",\n );\n return;\n }\n if (linkProtocol !== \"https:\" && linkProtocol !== \"http:\") {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"openLink only accepts http(s) URLs\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.openLink({ url: linkParams.url }),\n });\n return;\n }\n\n case \"sendMessage\": {\n if (!handlers.sendMessage) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"sendMessage is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.sendMessage(params)) ?? null,\n });\n return;\n }\n\n case \"updateModelContext\": {\n if (!handlers.updateModelContext) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"updateModelContext is not supported by this host\",\n );\n return;\n }\n respond(req.id, {\n result: (await handlers.updateModelContext(params)) ?? null,\n });\n return;\n }\n\n case \"requestDisplayMode\": {\n if (!handlers.requestDisplayMode) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n \"requestDisplayMode is not supported by this host\",\n );\n return;\n }\n const modeParams = (params ?? {}) as { mode?: unknown };\n if (\n typeof modeParams.mode !== \"string\" ||\n !VALID_DISPLAY_MODES.includes(modeParams.mode as McpAppDisplayMode)\n ) {\n errorResponse(\n req.id,\n JSONRPC_ERROR.invalidParams,\n \"requestDisplayMode requires a valid 'mode'\",\n );\n return;\n }\n respond(req.id, {\n result: await handlers.requestDisplayMode({\n mode: modeParams.mode as McpAppDisplayMode,\n }),\n });\n return;\n }\n\n default: {\n errorResponse(\n req.id,\n JSONRPC_ERROR.methodNotFound,\n `Unknown method: ${req.method}`,\n );\n }\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n reportError(error);\n errorResponse(req.id, JSONRPC_ERROR.internalError, error.message);\n }\n };\n\n const handleNotification = (note: McpAppJsonRpcNotification) => {\n try {\n switch (normalizeMethod(note.method)) {\n case \"notifications/initialized\": {\n handlers.onInitialized?.();\n return;\n }\n case \"notifications/size_changed\": {\n const p = (note.params ?? {}) as { width?: number; height?: number };\n handlers.onSizeChange?.({\n ...(typeof p.width === \"number\" ? { width: p.width } : {}),\n ...(typeof p.height === \"number\" ? { height: p.height } : {}),\n });\n return;\n }\n case \"notifications/log\": {\n handlers.onLog?.(note.params);\n return;\n }\n case \"notifications/request_teardown\": {\n handlers.onRequestTeardown?.(note.params);\n return;\n }\n case \"notifications/error\": {\n const p = (note.params ?? {}) as { message?: string };\n reportError(\n new Error(\n typeof p.message === \"string\" ? p.message : \"Widget error\",\n ),\n );\n return;\n }\n default:\n return;\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n reportError(error);\n }\n };\n\n // The host applies the cross-origin guard before delegating; this only\n // validates the JSON-RPC envelope.\n const onMessage = (event: MessageEvent) => {\n if (!isJsonRpcMessage(event.data)) return;\n\n const msg = event.data;\n if (isRequest(msg)) {\n void handleRequest(msg);\n } else if (isNotification(msg)) {\n handleNotification(msg);\n }\n };\n\n return {\n onMessage,\n dispose: () => {},\n notifyToolInput: (input: unknown) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/tools/call/input\",\n params: { input },\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/tool-input\",\n params: isRecord(input) ? { arguments: input } : {},\n });\n },\n notifyToolResult: (result: unknown) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/tools/call/result\",\n params: { result },\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/tool-result\",\n params: isRecord(result)\n ? result\n : { content: [{ type: \"text\", text: String(result) }] },\n });\n },\n notifyHostContextChanged: (ctx: McpAppHostContext) => {\n post({\n jsonrpc: \"2.0\",\n method: \"notifications/host_context/changed\",\n params: ctx,\n });\n post({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/host-context-changed\",\n params: ctx,\n });\n },\n };\n}\n"],"mappings":";;;AAcA,MAAMW,sBAAsB;CAC1B;CACA;CACA;AAAK;AAoBP,MAAMkB,oBAAoC;CACxCC,MAAM;CACNC,SAAS;AACX;AAKA,MAAMC,iBAAyC;CAC7C,gCAAgC;CAChC,iCAAiC;CACjC,2BAA2B;CAC3B,gBAAgB;CAChB,2BAA2B;CAC3B,cAAc;CACd,yBAA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AI,GAAG;EAEnC,MAAMZ,MAAM1B,MAAMsC;EAClB,IAAIb,UAAUC,GAAG,GACf,cAAmBA,GAAG;OACjB,IAAIC,eAAeD,GAAG,GAC3BkE,mBAAmBlE,GAAG;CAE1B;CAEA,OAAO;EACL3B;EACAG,eAAe,CAAC;EAChBC,kBAAkBC,UAAmB;GACnC0B,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQ,EAAEjD,MAAM;GAClB,CAAC;GACD0B,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQhE,SAASe,KAAK,IAAI,EAAEuE,WAAWvE,MAAM,IAAI,CAAC;GACpD,CAAC;EACH;EACAC,mBAAmBC,WAAoB;GACrCwB,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQ,EAAE/C,OAAO;GACnB,CAAC;GACDwB,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQhE,SAASiB,MAAM,IACnBA,SACA,EAAE8F,SAAS,CAAC;KAAEC,MAAM;KAAQ9B,MAAMoB,OAAOrF,MAAM;IAAE,CAAC,EAAE;GAC1D,CAAC;EACH;EACAC,2BAA2B+F,QAA2B;GACpDxE,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQiD;GACV,CAAC;GACDxE,KAAK;IACHN,SAAS;IACTV,QAAQ;IACRuC,QAAQiD;GACV,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useAui } from "@assistant-ui/store";
|
|
3
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
|
+
import { useAui } from "@assistant-ui/store";
|
|
4
4
|
import { tool } from "@assistant-ui/core";
|
|
5
5
|
import { createContext, forwardRef, useContext, useEffect, useId, useRef } from "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Primitive } from "../../utils/Primitive.js";
|
|
3
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
4
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
5
4
|
import { useActionBarCopy } from "@assistant-ui/core/react";
|
|
5
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
6
6
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Primitive } from "../../utils/Primitive.js";
|
|
3
|
-
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
4
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
|
+
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { composeEventHandlers } from "@radix-ui/primitive";
|