@assistant-ui/react 0.15.28 → 0.15.29
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/adapters/OpenAIRealtimeVoiceAdapter.d.ts +22 -0
- package/dist/adapters/OpenAIRealtimeVoiceAdapter.d.ts.map +1 -0
- package/dist/adapters/OpenAIRealtimeVoiceAdapter.js +297 -0
- package/dist/adapters/OpenAIRealtimeVoiceAdapter.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.js +1 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +5 -1
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.d.ts.map +1 -1
- package/dist/model-context/frame/useAssistantFrameHost.js +67 -46
- package/dist/model-context/frame/useAssistantFrameHost.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +28 -10
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +4 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +15 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverAction.js +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverDirective.js +1 -1
- package/dist/unstable/useMentionAdapter.js +1 -1
- package/dist/utils/Primitive.d.ts +14 -14
- package/package.json +4 -4
- package/src/adapters/OpenAIRealtimeVoiceAdapter.test.ts +748 -0
- package/src/adapters/OpenAIRealtimeVoiceAdapter.ts +388 -0
- package/src/index.ts +4 -0
- package/src/mcp-apps/McpAppRenderer.test.tsx +65 -0
- package/src/mcp-apps/McpAppRenderer.tsx +13 -2
- package/src/model-context/frame/useAssistantFrameHost.detach.test.tsx +145 -0
- package/src/model-context/frame/useAssistantFrameHost.reload.test.tsx +106 -0
- package/src/model-context/frame/useAssistantFrameHost.test.tsx +3 -1
- package/src/model-context/frame/useAssistantFrameHost.ts +72 -24
- package/src/primitives/composer/ComposerAddAttachment.test.tsx +1 -0
- package/src/primitives/composer/ComposerAddAttachment.thread-scope.test.tsx +202 -0
- package/src/primitives/composer/ComposerAddAttachment.ts +11 -1
- package/src/primitives/composer/ComposerInput.focus-on-run-start.test.tsx +130 -0
- package/src/primitives/composer/ComposerInput.tsx +29 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RealtimeVoiceAdapter } from "@assistant-ui/core";
|
|
2
|
+
/** Options for a browser WebRTC connection to OpenAI Realtime. */
|
|
3
|
+
export type OpenAIRealtimeVoiceAdapterOptions = {
|
|
4
|
+
/** Exchange the browser's SDP offer for an answer through your authenticated server. Keep the API key and session configuration on the server. */
|
|
5
|
+
exchangeSdp: (sdp: string, options: {
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
}) => Promise<string>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Connects browser microphone audio directly to OpenAI Realtime over WebRTC.
|
|
11
|
+
* Configure audio output, input transcription, and automatic turn detection on
|
|
12
|
+
* the server. Each connection starts a new conversation; existing thread history
|
|
13
|
+
* and assistant-ui tools are not sent to the voice model.
|
|
14
|
+
*/
|
|
15
|
+
export declare class OpenAIRealtimeVoiceAdapter implements RealtimeVoiceAdapter {
|
|
16
|
+
private readonly options;
|
|
17
|
+
constructor(options: OpenAIRealtimeVoiceAdapterOptions);
|
|
18
|
+
connect(options: {
|
|
19
|
+
abortSignal?: AbortSignal;
|
|
20
|
+
}): RealtimeVoiceAdapter.Session;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=OpenAIRealtimeVoiceAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAIRealtimeVoiceAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/OpenAIRealtimeVoiceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B,kEAAkE;AAClE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,kJAAkJ;IAClJ,WAAW,EAAE,CACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,KAC7B,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAOF;;;;;GAKG;AACH,qBAAa,0BAA2B,YAAW,oBAAoB;IACrE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;gBAEhD,OAAO,EAAE,iCAAiC;IAItD,OAAO,CAAC,OAAO,EAAE;QACf,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,GAAG,oBAAoB,CAAC,OAAO;CAiWjC"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { createVoiceSession } from "@assistant-ui/core";
|
|
2
|
+
//#region src/adapters/OpenAIRealtimeVoiceAdapter.ts
|
|
3
|
+
const asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Connects browser microphone audio directly to OpenAI Realtime over WebRTC.
|
|
6
|
+
* Configure audio output, input transcription, and automatic turn detection on
|
|
7
|
+
* the server. Each connection starts a new conversation; existing thread history
|
|
8
|
+
* and assistant-ui tools are not sent to the voice model.
|
|
9
|
+
*/
|
|
10
|
+
var OpenAIRealtimeVoiceAdapter = class {
|
|
11
|
+
options;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
}
|
|
15
|
+
connect(options) {
|
|
16
|
+
return createVoiceSession(options, async (session) => {
|
|
17
|
+
if (typeof RTCPeerConnection === "undefined" || typeof document === "undefined" || typeof navigator === "undefined" || !navigator.mediaDevices?.getUserMedia) throw new Error("OpenAI Realtime voice requires a browser with WebRTC and microphone access.");
|
|
18
|
+
const controller = new AbortController();
|
|
19
|
+
const peer = new RTCPeerConnection();
|
|
20
|
+
const channel = peer.createDataChannel("oai-events");
|
|
21
|
+
const audio = document.createElement("audio");
|
|
22
|
+
audio.autoplay = true;
|
|
23
|
+
let microphone;
|
|
24
|
+
let muted = false;
|
|
25
|
+
let closed = false;
|
|
26
|
+
let generating = false;
|
|
27
|
+
let speaking = false;
|
|
28
|
+
let transcribing = false;
|
|
29
|
+
let volumeTimer;
|
|
30
|
+
let connectionTimer;
|
|
31
|
+
let assistantTranscript;
|
|
32
|
+
const transcriptQueue = [];
|
|
33
|
+
const pendingTranscripts = /* @__PURE__ */ new Map();
|
|
34
|
+
const flushTranscripts = () => {
|
|
35
|
+
while (transcriptQueue[0]?.ready) {
|
|
36
|
+
const item = transcriptQueue[0];
|
|
37
|
+
item.ready = false;
|
|
38
|
+
if (item.value?.isFinal !== false) transcriptQueue.shift();
|
|
39
|
+
if (item.value) session.emitTranscript(item.value);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const finishUserTranscript = (id, value) => {
|
|
43
|
+
const item = typeof id === "string" ? pendingTranscripts.get(id) : void 0;
|
|
44
|
+
if (item) {
|
|
45
|
+
item.ready = true;
|
|
46
|
+
item.value = value;
|
|
47
|
+
pendingTranscripts.delete(id);
|
|
48
|
+
} else if (value) transcriptQueue.push({
|
|
49
|
+
ready: true,
|
|
50
|
+
value
|
|
51
|
+
});
|
|
52
|
+
flushTranscripts();
|
|
53
|
+
};
|
|
54
|
+
const pending = /* @__PURE__ */ new Map();
|
|
55
|
+
const disconnect = () => {
|
|
56
|
+
if (closed) return;
|
|
57
|
+
closed = true;
|
|
58
|
+
controller.abort();
|
|
59
|
+
clearInterval(volumeTimer);
|
|
60
|
+
clearTimeout(connectionTimer);
|
|
61
|
+
for (const id of pending.keys()) settle(id, /* @__PURE__ */ new Error("OpenAI Realtime session disconnected before accepting the message."));
|
|
62
|
+
pendingTranscripts.clear();
|
|
63
|
+
transcriptQueue.length = 0;
|
|
64
|
+
channel.onopen = channel.onmessage = channel.onclose = channel.onerror = null;
|
|
65
|
+
peer.ontrack = peer.onconnectionstatechange = null;
|
|
66
|
+
for (const track of microphone?.getTracks() ?? []) track.stop();
|
|
67
|
+
audio.pause();
|
|
68
|
+
audio.srcObject = null;
|
|
69
|
+
channel.close();
|
|
70
|
+
peer.close();
|
|
71
|
+
};
|
|
72
|
+
const end = (reason, error) => {
|
|
73
|
+
session.end(reason, error);
|
|
74
|
+
disconnect();
|
|
75
|
+
};
|
|
76
|
+
const send = (event) => {
|
|
77
|
+
if (closed || channel.readyState !== "open") throw new Error("OpenAI Realtime session is not connected.");
|
|
78
|
+
channel.send(JSON.stringify(event));
|
|
79
|
+
};
|
|
80
|
+
const request = (id, event) => new Promise((resolve, reject) => {
|
|
81
|
+
const timer = setTimeout(() => {
|
|
82
|
+
reject(/* @__PURE__ */ new Error("OpenAI Realtime did not acknowledge the message."));
|
|
83
|
+
}, 1e4);
|
|
84
|
+
pending.set(id, {
|
|
85
|
+
resolve,
|
|
86
|
+
reject,
|
|
87
|
+
timer
|
|
88
|
+
});
|
|
89
|
+
send({
|
|
90
|
+
...event,
|
|
91
|
+
event_id: id
|
|
92
|
+
});
|
|
93
|
+
}).finally(() => settle(id));
|
|
94
|
+
const settle = (id, error) => {
|
|
95
|
+
if (typeof id !== "string") return false;
|
|
96
|
+
const message = pending.get(id);
|
|
97
|
+
if (!message) return false;
|
|
98
|
+
clearTimeout(message.timer);
|
|
99
|
+
pending.delete(id);
|
|
100
|
+
if (error) message.reject(error);
|
|
101
|
+
else message.resolve();
|
|
102
|
+
return true;
|
|
103
|
+
};
|
|
104
|
+
const setSpeaking = (value) => {
|
|
105
|
+
speaking = value;
|
|
106
|
+
session.emitMode(value ? "speaking" : "listening");
|
|
107
|
+
};
|
|
108
|
+
channel.onmessage = ({ data }) => {
|
|
109
|
+
if (closed) return;
|
|
110
|
+
let event;
|
|
111
|
+
try {
|
|
112
|
+
event = asRecord(JSON.parse(data));
|
|
113
|
+
} catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!event) return;
|
|
117
|
+
switch (event.type) {
|
|
118
|
+
case "session.created":
|
|
119
|
+
case "session.updated": {
|
|
120
|
+
const audio = asRecord(asRecord(event.session)?.audio);
|
|
121
|
+
const input = asRecord(audio?.input);
|
|
122
|
+
transcribing = asRecord(input?.transcription) !== void 0;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case "input_audio_buffer.committed":
|
|
126
|
+
if (transcribing && typeof event.item_id === "string" && !pendingTranscripts.has(event.item_id)) {
|
|
127
|
+
const item = {
|
|
128
|
+
ready: false,
|
|
129
|
+
value: void 0
|
|
130
|
+
};
|
|
131
|
+
pendingTranscripts.set(event.item_id, item);
|
|
132
|
+
transcriptQueue.push(item);
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "conversation.item.input_audio_transcription.completed":
|
|
136
|
+
if (typeof event.transcript === "string") finishUserTranscript(event.item_id, {
|
|
137
|
+
role: "user",
|
|
138
|
+
text: event.transcript,
|
|
139
|
+
isFinal: true
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case "response.output_audio_transcript.delta":
|
|
143
|
+
case "response.output_audio_transcript.done": {
|
|
144
|
+
if (typeof event.item_id !== "string") break;
|
|
145
|
+
const final = event.type === "response.output_audio_transcript.done";
|
|
146
|
+
const text = final ? event.transcript : event.delta;
|
|
147
|
+
if (typeof text !== "string") break;
|
|
148
|
+
if (assistantTranscript?.id !== event.item_id) {
|
|
149
|
+
assistantTranscript = {
|
|
150
|
+
id: event.item_id,
|
|
151
|
+
ready: false,
|
|
152
|
+
value: void 0
|
|
153
|
+
};
|
|
154
|
+
transcriptQueue.push(assistantTranscript);
|
|
155
|
+
}
|
|
156
|
+
assistantTranscript.ready = true;
|
|
157
|
+
assistantTranscript.value = {
|
|
158
|
+
role: "assistant",
|
|
159
|
+
text: final ? text : (assistantTranscript.value?.text ?? "") + text,
|
|
160
|
+
isFinal: final
|
|
161
|
+
};
|
|
162
|
+
flushTranscripts();
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case "response.created":
|
|
166
|
+
generating = true;
|
|
167
|
+
settle(asRecord(asRecord(event.response)?.metadata)?.aui_request_id);
|
|
168
|
+
break;
|
|
169
|
+
case "response.done": {
|
|
170
|
+
generating = false;
|
|
171
|
+
const response = asRecord(event.response);
|
|
172
|
+
if (assistantTranscript?.value?.isFinal === false) {
|
|
173
|
+
assistantTranscript.value = {
|
|
174
|
+
...assistantTranscript.value,
|
|
175
|
+
isFinal: true
|
|
176
|
+
};
|
|
177
|
+
assistantTranscript.ready = true;
|
|
178
|
+
flushTranscripts();
|
|
179
|
+
}
|
|
180
|
+
if (response?.status === "failed") console.warn("OpenAI Realtime response failed.", response.status_details);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case "output_audio_buffer.started":
|
|
184
|
+
setSpeaking(true);
|
|
185
|
+
break;
|
|
186
|
+
case "output_audio_buffer.stopped":
|
|
187
|
+
case "output_audio_buffer.cleared":
|
|
188
|
+
setSpeaking(false);
|
|
189
|
+
break;
|
|
190
|
+
case "conversation.item.added":
|
|
191
|
+
settle(asRecord(event.item)?.id);
|
|
192
|
+
break;
|
|
193
|
+
case "conversation.item.input_audio_transcription.failed":
|
|
194
|
+
finishUserTranscript(event.item_id);
|
|
195
|
+
console.warn("OpenAI Realtime transcription failed.", event.error);
|
|
196
|
+
break;
|
|
197
|
+
case "error": {
|
|
198
|
+
const error = asRecord(event.error);
|
|
199
|
+
if (error?.code === "response_cancel_not_active") break;
|
|
200
|
+
if (!settle(error?.event_id, new Error(typeof error?.message === "string" ? error.message : "OpenAI Realtime rejected the message."))) console.warn("OpenAI Realtime error.", event.error);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
channel.onopen = () => {
|
|
206
|
+
if (closed) return;
|
|
207
|
+
clearTimeout(connectionTimer);
|
|
208
|
+
session.setStatus({ type: "running" });
|
|
209
|
+
if (closed) return;
|
|
210
|
+
session.emitMode("listening");
|
|
211
|
+
if (closed) return;
|
|
212
|
+
volumeTimer = setInterval(() => {
|
|
213
|
+
peer.getStats().then((report) => {
|
|
214
|
+
if (closed) return;
|
|
215
|
+
let volume = 0;
|
|
216
|
+
report.forEach((stat) => {
|
|
217
|
+
if ((stat.type === "inbound-rtp" || !muted && stat.type === "media-source") && typeof stat.audioLevel === "number") volume = Math.max(volume, stat.audioLevel);
|
|
218
|
+
});
|
|
219
|
+
session.emitVolume(Math.min(1, volume));
|
|
220
|
+
}).catch(() => {});
|
|
221
|
+
}, 100);
|
|
222
|
+
};
|
|
223
|
+
channel.onclose = () => end("finished");
|
|
224
|
+
channel.onerror = () => end("error", /* @__PURE__ */ new Error("OpenAI Realtime data channel failed."));
|
|
225
|
+
peer.onconnectionstatechange = () => {
|
|
226
|
+
if (peer.connectionState === "failed") end("error", /* @__PURE__ */ new Error("OpenAI Realtime connection failed."));
|
|
227
|
+
else if (peer.connectionState === "closed") end("finished");
|
|
228
|
+
};
|
|
229
|
+
peer.ontrack = ({ track }) => {
|
|
230
|
+
if (closed || track.kind !== "audio") return;
|
|
231
|
+
audio.srcObject = new MediaStream([track]);
|
|
232
|
+
audio.play().catch((error) => end("error", error));
|
|
233
|
+
};
|
|
234
|
+
const start = async () => {
|
|
235
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
236
|
+
if (closed || session.isDisposed()) {
|
|
237
|
+
for (const track of stream.getTracks()) track.stop();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
microphone = stream;
|
|
241
|
+
for (const track of stream.getAudioTracks()) {
|
|
242
|
+
track.enabled = !muted;
|
|
243
|
+
peer.addTrack(track, stream);
|
|
244
|
+
}
|
|
245
|
+
connectionTimer = setTimeout(() => end("error", /* @__PURE__ */ new Error("OpenAI Realtime connection timed out.")), 3e4);
|
|
246
|
+
const offer = await peer.createOffer();
|
|
247
|
+
if (closed) return;
|
|
248
|
+
await peer.setLocalDescription(offer);
|
|
249
|
+
if (closed) return;
|
|
250
|
+
const answer = await this.options.exchangeSdp(offer.sdp, { signal: controller.signal });
|
|
251
|
+
if (closed) return;
|
|
252
|
+
await peer.setRemoteDescription({
|
|
253
|
+
type: "answer",
|
|
254
|
+
sdp: answer
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
start().catch((error) => end("error", error));
|
|
258
|
+
return {
|
|
259
|
+
disconnect,
|
|
260
|
+
mute: () => {
|
|
261
|
+
muted = true;
|
|
262
|
+
for (const track of microphone?.getAudioTracks() ?? []) track.enabled = false;
|
|
263
|
+
},
|
|
264
|
+
unmute: () => {
|
|
265
|
+
muted = false;
|
|
266
|
+
for (const track of microphone?.getAudioTracks() ?? []) track.enabled = true;
|
|
267
|
+
},
|
|
268
|
+
sendText: async (text) => {
|
|
269
|
+
if (generating) send({ type: "response.cancel" });
|
|
270
|
+
if (speaking) send({ type: "output_audio_buffer.clear" });
|
|
271
|
+
const id = crypto.randomUUID().replaceAll("-", "");
|
|
272
|
+
await request(id, {
|
|
273
|
+
type: "conversation.item.create",
|
|
274
|
+
item: {
|
|
275
|
+
id,
|
|
276
|
+
type: "message",
|
|
277
|
+
role: "user",
|
|
278
|
+
content: [{
|
|
279
|
+
type: "input_text",
|
|
280
|
+
text
|
|
281
|
+
}]
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
const responseId = crypto.randomUUID().replaceAll("-", "");
|
|
285
|
+
await request(responseId, {
|
|
286
|
+
type: "response.create",
|
|
287
|
+
response: { metadata: { aui_request_id: responseId } }
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
//#endregion
|
|
295
|
+
export { OpenAIRealtimeVoiceAdapter };
|
|
296
|
+
|
|
297
|
+
//# sourceMappingURL=OpenAIRealtimeVoiceAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAIRealtimeVoiceAdapter.js","names":["createVoiceSession","RealtimeVoiceAdapter","OpenAIRealtimeVoiceAdapterOptions","exchangeSdp","sdp","options","signal","AbortSignal","Promise","asRecord","value","Record","Array","isArray","undefined","OpenAIRealtimeVoiceAdapter","constructor","connect","abortSignal","Session","session","RTCPeerConnection","document","navigator","mediaDevices","getUserMedia","Error","controller","AbortController","peer","channel","createDataChannel","audio","createElement","autoplay","microphone","MediaStream","muted","closed","generating","speaking","transcribing","volumeTimer","ReturnType","setInterval","connectionTimer","setTimeout","Transcript","ready","TranscriptItem","assistantTranscript","id","transcriptQueue","pendingTranscripts","Map","flushTranscripts","item","isFinal","shift","emitTranscript","finishUserTranscript","get","delete","push","pending","resolve","reject","error","timer","disconnect","abort","clearInterval","clearTimeout","keys","settle","clear","length","onopen","onmessage","onclose","onerror","ontrack","onconnectionstatechange","track","getTracks","stop","pause","srcObject","close","end","reason","send","event","readyState","JSON","stringify","request","set","event_id","finally","message","setSpeaking","emitMode","data","parse","type","input","transcription","item_id","has","transcript","role","text","final","delta","response","metadata","aui_request_id","status","console","warn","status_details","code","setStatus","getStats","then","report","volume","forEach","stat","audioLevel","Math","max","emitVolume","min","catch","connectionState","kind","play","start","stream","isDisposed","getAudioTracks","enabled","addTrack","offer","createOffer","setLocalDescription","answer","setRemoteDescription","mute","unmute","sendText","crypto","randomUUID","replaceAll","content","responseId"],"sources":["../../src/adapters/OpenAIRealtimeVoiceAdapter.ts"],"sourcesContent":["import {\n createVoiceSession,\n type RealtimeVoiceAdapter,\n} from \"@assistant-ui/core\";\n\n/** Options for a browser WebRTC connection to OpenAI Realtime. */\nexport type OpenAIRealtimeVoiceAdapterOptions = {\n /** Exchange the browser's SDP offer for an answer through your authenticated server. Keep the API key and session configuration on the server. */\n exchangeSdp: (\n sdp: string,\n options: { signal: AbortSignal },\n ) => Promise<string>;\n};\n\nconst asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n\n/**\n * Connects browser microphone audio directly to OpenAI Realtime over WebRTC.\n * Configure audio output, input transcription, and automatic turn detection on\n * the server. Each connection starts a new conversation; existing thread history\n * and assistant-ui tools are not sent to the voice model.\n */\nexport class OpenAIRealtimeVoiceAdapter implements RealtimeVoiceAdapter {\n private readonly options: OpenAIRealtimeVoiceAdapterOptions;\n\n constructor(options: OpenAIRealtimeVoiceAdapterOptions) {\n this.options = options;\n }\n\n connect(options: {\n abortSignal?: AbortSignal;\n }): RealtimeVoiceAdapter.Session {\n return createVoiceSession(options, async (session) => {\n if (\n typeof RTCPeerConnection === \"undefined\" ||\n typeof document === \"undefined\" ||\n typeof navigator === \"undefined\" ||\n !navigator.mediaDevices?.getUserMedia\n ) {\n throw new Error(\n \"OpenAI Realtime voice requires a browser with WebRTC and microphone access.\",\n );\n }\n\n const controller = new AbortController();\n const peer = new RTCPeerConnection();\n const channel = peer.createDataChannel(\"oai-events\");\n const audio = document.createElement(\"audio\");\n audio.autoplay = true;\n let microphone: MediaStream | undefined;\n let muted = false;\n let closed = false;\n let generating = false;\n let speaking = false;\n let transcribing = false;\n let volumeTimer: ReturnType<typeof setInterval> | undefined;\n let connectionTimer: ReturnType<typeof setTimeout> | undefined;\n type Transcript = {\n ready: boolean;\n value: RealtimeVoiceAdapter.TranscriptItem | undefined;\n };\n let assistantTranscript: (Transcript & { id: string }) | undefined;\n const transcriptQueue: Transcript[] = [];\n const pendingTranscripts = new Map<string, Transcript>();\n const flushTranscripts = () => {\n while (transcriptQueue[0]?.ready) {\n const item = transcriptQueue[0];\n item.ready = false;\n if (item.value?.isFinal !== false) transcriptQueue.shift();\n if (item.value) session.emitTranscript(item.value);\n }\n };\n const finishUserTranscript = (\n id: unknown,\n value?: RealtimeVoiceAdapter.TranscriptItem,\n ) => {\n const item =\n typeof id === \"string\" ? pendingTranscripts.get(id) : undefined;\n if (item) {\n item.ready = true;\n item.value = value;\n pendingTranscripts.delete(id as string);\n } else if (value) transcriptQueue.push({ ready: true, value });\n flushTranscripts();\n };\n const pending = new Map<\n string,\n {\n resolve: () => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n }\n >();\n\n const disconnect = () => {\n if (closed) return;\n closed = true;\n controller.abort();\n clearInterval(volumeTimer);\n clearTimeout(connectionTimer);\n for (const id of pending.keys())\n settle(\n id,\n new Error(\n \"OpenAI Realtime session disconnected before accepting the message.\",\n ),\n );\n pendingTranscripts.clear();\n transcriptQueue.length = 0;\n channel.onopen =\n channel.onmessage =\n channel.onclose =\n channel.onerror =\n null;\n peer.ontrack = peer.onconnectionstatechange = null;\n for (const track of microphone?.getTracks() ?? []) track.stop();\n audio.pause();\n audio.srcObject = null;\n channel.close();\n peer.close();\n };\n\n const end = (reason: \"finished\" | \"error\", error?: unknown) => {\n session.end(reason, error);\n disconnect();\n };\n\n const send = (event: Record<string, unknown>) => {\n if (closed || channel.readyState !== \"open\")\n throw new Error(\"OpenAI Realtime session is not connected.\");\n channel.send(JSON.stringify(event));\n };\n\n const request = (id: string, event: Record<string, unknown>) =>\n new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(\n new Error(\"OpenAI Realtime did not acknowledge the message.\"),\n );\n }, 10_000);\n pending.set(id, { resolve, reject, timer });\n send({ ...event, event_id: id });\n }).finally(() => settle(id));\n\n const settle = (id: unknown, error?: Error) => {\n if (typeof id !== \"string\") return false;\n const message = pending.get(id);\n if (!message) return false;\n clearTimeout(message.timer);\n pending.delete(id);\n if (error) message.reject(error);\n else message.resolve();\n return true;\n };\n\n const setSpeaking = (value: boolean) => {\n speaking = value;\n session.emitMode(value ? \"speaking\" : \"listening\");\n };\n\n channel.onmessage = ({ data }) => {\n if (closed) return;\n let event: Record<string, unknown> | undefined;\n try {\n event = asRecord(JSON.parse(data));\n } catch {\n return;\n }\n if (!event) return;\n switch (event.type) {\n case \"session.created\":\n case \"session.updated\": {\n const audio = asRecord(asRecord(event.session)?.audio);\n const input = asRecord(audio?.input);\n transcribing = asRecord(input?.transcription) !== undefined;\n break;\n }\n case \"input_audio_buffer.committed\":\n if (\n transcribing &&\n typeof event.item_id === \"string\" &&\n !pendingTranscripts.has(event.item_id)\n ) {\n const item = { ready: false, value: undefined };\n pendingTranscripts.set(event.item_id, item);\n transcriptQueue.push(item);\n }\n break;\n case \"conversation.item.input_audio_transcription.completed\":\n if (typeof event.transcript === \"string\")\n finishUserTranscript(event.item_id, {\n role: \"user\",\n text: event.transcript,\n isFinal: true,\n });\n break;\n case \"response.output_audio_transcript.delta\":\n case \"response.output_audio_transcript.done\": {\n if (typeof event.item_id !== \"string\") break;\n const final =\n event.type === \"response.output_audio_transcript.done\";\n const text = final ? event.transcript : event.delta;\n if (typeof text !== \"string\") break;\n if (assistantTranscript?.id !== event.item_id) {\n assistantTranscript = {\n id: event.item_id,\n ready: false,\n value: undefined,\n };\n transcriptQueue.push(assistantTranscript);\n }\n assistantTranscript.ready = true;\n assistantTranscript.value = {\n role: \"assistant\",\n text: final\n ? text\n : (assistantTranscript.value?.text ?? \"\") + text,\n isFinal: final,\n };\n flushTranscripts();\n break;\n }\n case \"response.created\":\n generating = true;\n settle(\n asRecord(asRecord(event.response)?.metadata)?.aui_request_id,\n );\n break;\n case \"response.done\": {\n generating = false;\n const response = asRecord(event.response);\n if (assistantTranscript?.value?.isFinal === false) {\n assistantTranscript.value = {\n ...assistantTranscript.value,\n isFinal: true,\n };\n assistantTranscript.ready = true;\n flushTranscripts();\n }\n if (response?.status === \"failed\")\n console.warn(\n \"OpenAI Realtime response failed.\",\n response.status_details,\n );\n break;\n }\n case \"output_audio_buffer.started\":\n setSpeaking(true);\n break;\n case \"output_audio_buffer.stopped\":\n case \"output_audio_buffer.cleared\":\n setSpeaking(false);\n break;\n case \"conversation.item.added\":\n settle(asRecord(event.item)?.id);\n break;\n case \"conversation.item.input_audio_transcription.failed\":\n finishUserTranscript(event.item_id);\n console.warn(\"OpenAI Realtime transcription failed.\", event.error);\n break;\n case \"error\": {\n const error = asRecord(event.error);\n if (error?.code === \"response_cancel_not_active\") break;\n if (\n !settle(\n error?.event_id,\n new Error(\n typeof error?.message === \"string\"\n ? error.message\n : \"OpenAI Realtime rejected the message.\",\n ),\n )\n )\n console.warn(\"OpenAI Realtime error.\", event.error);\n break;\n }\n }\n };\n channel.onopen = () => {\n if (closed) return;\n clearTimeout(connectionTimer);\n session.setStatus({ type: \"running\" });\n if (closed) return;\n session.emitMode(\"listening\");\n if (closed) return;\n volumeTimer = setInterval(() => {\n void peer\n .getStats()\n .then((report) => {\n if (closed) return;\n let volume = 0;\n report.forEach((stat) => {\n if (\n (stat.type === \"inbound-rtp\" ||\n (!muted && stat.type === \"media-source\")) &&\n typeof stat.audioLevel === \"number\"\n )\n volume = Math.max(volume, stat.audioLevel);\n });\n session.emitVolume(Math.min(1, volume));\n })\n .catch(() => {});\n }, 100);\n };\n channel.onclose = () => end(\"finished\");\n channel.onerror = () =>\n end(\"error\", new Error(\"OpenAI Realtime data channel failed.\"));\n peer.onconnectionstatechange = () => {\n if (peer.connectionState === \"failed\") {\n end(\"error\", new Error(\"OpenAI Realtime connection failed.\"));\n } else if (peer.connectionState === \"closed\") {\n end(\"finished\");\n }\n };\n peer.ontrack = ({ track }) => {\n if (closed || track.kind !== \"audio\") return;\n audio.srcObject = new MediaStream([track]);\n void audio.play().catch((error: unknown) => end(\"error\", error));\n };\n\n const start = async () => {\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: true,\n });\n if (closed || session.isDisposed()) {\n for (const track of stream.getTracks()) track.stop();\n return;\n }\n microphone = stream;\n for (const track of stream.getAudioTracks()) {\n track.enabled = !muted;\n peer.addTrack(track, stream);\n }\n connectionTimer = setTimeout(\n () =>\n end(\"error\", new Error(\"OpenAI Realtime connection timed out.\")),\n 30_000,\n );\n const offer = await peer.createOffer();\n if (closed) return;\n await peer.setLocalDescription(offer);\n if (closed) return;\n const answer = await this.options.exchangeSdp(offer.sdp!, {\n signal: controller.signal,\n });\n if (closed) return;\n await peer.setRemoteDescription({ type: \"answer\", sdp: answer });\n };\n void start().catch((error: unknown) => end(\"error\", error));\n\n return {\n disconnect,\n mute: () => {\n muted = true;\n for (const track of microphone?.getAudioTracks() ?? [])\n track.enabled = false;\n },\n unmute: () => {\n muted = false;\n for (const track of microphone?.getAudioTracks() ?? [])\n track.enabled = true;\n },\n sendText: async (text) => {\n if (generating) send({ type: \"response.cancel\" });\n if (speaking) send({ type: \"output_audio_buffer.clear\" });\n const id = crypto.randomUUID().replaceAll(\"-\", \"\");\n await request(id, {\n type: \"conversation.item.create\",\n item: {\n id,\n type: \"message\",\n role: \"user\",\n content: [{ type: \"input_text\", text }],\n },\n });\n const responseId = crypto.randomUUID().replaceAll(\"-\", \"\");\n await request(responseId, {\n type: \"response.create\",\n response: { metadata: { aui_request_id: responseId } },\n });\n },\n };\n });\n }\n}\n"],"mappings":";;AAcA,MAAMS,YAAYC,UAChBA,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACE,MAAMC,QAAQH,KAAK,IAC9DA,QACDI,KAAAA;;;;;;;AAQN,IAAaC,6BAAb,MAAwE;CACtE;CAEAC,YAAYX,SAA4C;EACtD,KAAKA,UAAUA;CACjB;CAEAY,QAAQZ,SAEyB;EAC/B,OAAOL,mBAAmBK,SAAS,OAAOe,YAAY;GACpD,IACE,OAAOC,sBAAsB,eAC7B,OAAOC,aAAa,eACpB,OAAOC,cAAc,eACrB,CAACA,UAAUC,cAAcC,cAEzB,MAAM,IAAIC,MACR,6EACF;GAGF,MAAMC,aAAa,IAAIC,gBAAgB;GACvC,MAAMC,OAAO,IAAIR,kBAAkB;GACnC,MAAMS,UAAUD,KAAKE,kBAAkB,YAAY;GACnD,MAAMC,QAAQV,SAASW,cAAc,OAAO;GAC5CD,MAAME,WAAW;GACjB,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SimpleTextAttachmentAdapter, CompositeAtt
|
|
|
9
9
|
export { CloudFileAttachmentAdapter } from "./legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js";
|
|
10
10
|
export type { RealtimeVoiceAdapter } from "@assistant-ui/core";
|
|
11
11
|
export { createVoiceSession } from "@assistant-ui/core";
|
|
12
|
+
export { OpenAIRealtimeVoiceAdapter, type OpenAIRealtimeVoiceAdapterOptions, } from "./adapters/OpenAIRealtimeVoiceAdapter.js";
|
|
12
13
|
export type { VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, } from "@assistant-ui/core";
|
|
13
14
|
export { useVoiceState, useVoiceVolume, useVoiceControls, } from "@assistant-ui/core/react";
|
|
14
15
|
export type { FeedbackAdapter } from "@assistant-ui/core";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,o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BAAmB;AACpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EACL,0BAA0B,EAC1B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,GACnC,+CAA4C;AAC7C,OAAO;AACL,+GAA+G;AAC/G,mBAAmB,IAAI,4BAA4B,GACpD,0CAAuC;AAGxC,YAAY,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACV,WAAW,EACX,uBAAuB,EACvB,SAAS,EACT,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACn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B,WAAW,EACX,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,8BAA8B,GAC/B,4BAAmB;AACpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EACL,0BAA0B,EAC1B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,GACnC,+CAA4C;AAC7C,OAAO;AACL,+GAA+G;AAC/G,mBAAmB,IAAI,4BAA4B,GACpD,0CAAuC;AAGxC,YAAY,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACV,WAAW,EACX,uBAAuB,EACvB,SAAS,EACT,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OpenAIRealtimeVoiceAdapter } from "./adapters/OpenAIRealtimeVoiceAdapter.js";
|
|
1
2
|
import { useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState } from "./assistant-transport.js";
|
|
2
3
|
import { useThreadViewport, useThreadViewportStore } from "./context/react/ThreadViewportContext.js";
|
|
3
4
|
import { DevToolsHooks, DevToolsProviderApi } from "./devtools/DevToolsHooks.js";
|
|
@@ -64,9 +65,9 @@ import { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
|
|
|
64
65
|
import { McpAppsRemoteHost } from "./mcp-apps/McpAppsRemoteHost.js";
|
|
65
66
|
import { defaultWebMcpFilter } from "./unstable/webmcp/convertTools.js";
|
|
66
67
|
import { unstable_useWebMcpProvider } from "./unstable/webmcp/useWebMcpProvider.js";
|
|
68
|
+
import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, MessageNotSentError, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defaultDirectiveFormatter, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
67
69
|
import { ChainOfThoughtPartByIndexProvider, DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactables, RuntimeAdapterProvider, Tools, createSimpleTitleAdapter, createThreadRowsSelector, 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";
|
|
68
70
|
import { AuiConfig, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
69
71
|
import { ChainOfThoughtClient, ExternalThread, InMemoryThreadList, ModelContext as ModelContextClient, RemoteThreadList, SingleThreadList, Suggestions } from "@assistant-ui/core/store";
|
|
70
|
-
import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, MessageNotSentError, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createSuggestionAdapter, createVoiceSession, defaultDirectiveFormatter, fromThreadMessageLike, generateId, getExternalStoreMessages, isMessageNotSentError, mergeModelContexts, pickExternalStoreSharedOptions, tool, toolApprovalAcceptsText, unstable_defaultDirectiveFormatter, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
71
72
|
import { AssistantCloud, readAnonymousRefreshToken } from "assistant-cloud";
|
|
72
|
-
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, ChainOfThoughtPartByIndexProvider, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, CloudRendererHost, 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, createSimpleTitleAdapter, createSuggestionAdapter, createThreadRowsSelector, createVoiceSession, defaultDirectiveFormatter, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, readAnonymousRefreshToken, stubTool, tool, toolApprovalAcceptsText, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createExternalMessageConversionCache as unstable_createExternalMessageConversionCache, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, defaultWebMcpFilter as unstable_defaultWebMcpFilter, 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, unstable_useWebMcpProvider, 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 };
|
|
73
|
+
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, ChainOfThoughtPartByIndexProvider, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, CloudRendererHost, 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, OpenAIRealtimeVoiceAdapter, 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, createSimpleTitleAdapter, createSuggestionAdapter, createThreadRowsSelector, createVoiceSession, defaultDirectiveFormatter, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, isMessageNotSentError, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, readAnonymousRefreshToken, stubTool, tool, toolApprovalAcceptsText, unstable_Interactables, convertExternalMessages as unstable_convertExternalMessages, createExternalMessageConversionCache as unstable_createExternalMessageConversionCache, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, defaultWebMcpFilter as unstable_defaultWebMcpFilter, 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, unstable_useWebMcpProvider, 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAppRenderer.d.ts","sourceRoot":"","sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,KAAK,EAGV,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,EACnB,WAAW,EACZ,mBAAgB;AAIjB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,uEAAuE;IACvE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CA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AAM,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,2GAA2G;IAC3G,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,IAAI,CACb,oBAAoB,EACpB,UAAU,GAAG,cAAc,GAAG,eAAe,CAC9C,CAAC;IACF,wGAAwG;IACxG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sEAAsE;IACtE,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,uEAAuE;IACvE,aAAa,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD;;;;OAIG;IACH,IAAI,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACnC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,iBAAiB,CAAC;CAC5D,CAAC;AAySF,eAAO,MAAM,cAAc;qBA3BL,4BAA4B;oCA2BO,CAAC"}
|
|
@@ -31,7 +31,11 @@ function extractSendMessageTexts(params) {
|
|
|
31
31
|
if (typeof obj["prompt"] === "string") return [obj["prompt"]];
|
|
32
32
|
if (typeof obj["text"] === "string") return [obj["text"]];
|
|
33
33
|
if (typeof obj["message"] === "string") return [obj["message"]];
|
|
34
|
-
|
|
34
|
+
const content = obj["content"];
|
|
35
|
+
if (Array.isArray(content)) return Object.keys(content).filter((key) => {
|
|
36
|
+
const index = Number(key);
|
|
37
|
+
return Number.isInteger(index) && index >= 0 && index < content.length && String(index) === key;
|
|
38
|
+
}).map((key) => content[Number(key)]).filter((block) => isRecord(block) && block["type"] === "text" && typeof block["text"] === "string").map((block) => block.text);
|
|
35
39
|
}
|
|
36
40
|
function extractSendMessageContent(params) {
|
|
37
41
|
const texts = extractSendMessageTexts(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAppRenderer.js","names":["useEffect","useMemo","useRef","useState","ReactNode","useIsomorphicLayoutEffect","McpAppMetadata","TextMessagePart","ToolCallMessagePart","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppPartOptions","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","McpAppRendererOptions","host","forPart","part","LoadedResourceState","resourceUri","serverId","RendererState","options","UseRendererStore","isSameOptions","a","b","aKeys","Object","keys","filter","key","bKeys","length","aValues","Record","bValues","every","hasOwn","is","getInput","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageTexts","params","obj","Array","isArray","block","text","map","extractSendMessageContent","content","reason","texts","resolvePartOptions","overrides","InlineRenderer","useRendererStore","aui","rendererOptions","state","opts","app","cachedAppRef","current","appForRender","loadedResource","setLoadedResource","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","Promise","resolve","getState","res","uri","String","bridgeHandlers","openLink","sendMessage","result","isError","ok","thread","append","callTool","readResource","listResources","loadedResourceForApp","appResource","useMcpAppRenderer","render","setState","prev","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\nimport type {\n McpAppMetadata,\n TextMessagePart,\n ToolCallMessagePart,\n} from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\n/**\n * Options that apply to a single MCP app. `McpAppRenderer` takes them as\n * thread-wide defaults, and its `forPart` resolver overrides them for one part.\n */\nexport type McpAppPartOptions = {\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n *\n * Which handlers a widget may call is captured when its frame mounts, so a\n * `forPart` resolver returns the same handler keys for a part on every\n * render even when the implementations change.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\nexport type McpAppRendererOptions = McpAppPartOptions & {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /**\n * Resolves the options for one part. Each returned value replaces the\n * thread-wide option of the same name, so a host can give every MCP app its\n * own display mode and answer `requestDisplayMode` for the part that asked.\n *\n * `handlers` is the exception and merges per key. Its keys are capabilities\n * negotiated with the widget rather than data, so replacing the whole bag to\n * add one handler would withdraw the others from that part's widget with\n * nothing to observe it by.\n */\n forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype RendererState = {\n host: McpAppsHost;\n options: McpAppRendererOptions;\n};\n\ntype UseRendererStore = UseBoundStore<StoreApi<RendererState>>;\n\n// Callers pass options as an object literal, so the resource hands this a fresh\n// identity on every run; comparing the values keeps an unchanged run from\n// re-rendering every mounted part. `host` is excluded because it is an element\n// rebuilt on every run, and the store carries the resolved host separately.\nconst isSameOptions = (\n a: McpAppRendererOptions,\n b: McpAppRendererOptions,\n): boolean => {\n const aKeys = Object.keys(a).filter((key) => key !== \"host\");\n const bKeys = Object.keys(b).filter((key) => key !== \"host\");\n if (aKeys.length !== bKeys.length) return false;\n const aValues = a as Record<string, unknown>;\n const bValues = b as Record<string, unknown>;\n return aKeys.every(\n (key) =>\n Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]),\n );\n};\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageTexts(params: unknown): string[] | undefined {\n if (typeof params === \"string\") return [params];\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return [obj[\"prompt\"]];\n if (typeof obj[\"text\"] === \"string\") return [obj[\"text\"]];\n if (typeof obj[\"message\"] === \"string\") return [obj[\"message\"]];\n if (Array.isArray(obj[\"content\"])) {\n return obj[\"content\"]\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n isRecord(block) &&\n block[\"type\"] === \"text\" &&\n typeof block[\"text\"] === \"string\",\n )\n .map((block) => block.text);\n }\n return undefined;\n}\n\nfunction extractSendMessageContent(\n params: unknown,\n): { content: TextMessagePart[] } | { reason: string } {\n const texts = extractSendMessageTexts(params);\n if (!texts) return { reason: \"unrecognised params shape\" };\n const content = texts\n .filter((text) => text !== \"\")\n .map((text): TextMessagePart => ({ type: \"text\", text }));\n if (content.length === 0) {\n return { reason: \"no text content to append\" };\n }\n return { content };\n}\n\nfunction resolvePartOptions(\n options: McpAppRendererOptions,\n part: ToolCallMessagePartProps,\n): McpAppRendererOptions {\n const overrides = options.forPart?.(part);\n if (!overrides) return options;\n const handlers =\n options.handlers && overrides.handlers\n ? { ...options.handlers, ...overrides.handlers }\n : (overrides.handlers ?? options.handlers);\n return {\n ...options,\n ...overrides,\n ...(handlers === undefined ? {} : { handlers }),\n };\n}\n\nfunction InlineRenderer({\n part,\n useRendererStore,\n}: {\n part: ToolCallMessagePartProps;\n useRendererStore: UseRendererStore;\n}) {\n const aui = useAui();\n const rendererOptions = useRendererStore((state) => state.options);\n const opts = resolvePartOptions(rendererOptions, part);\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useIsomorphicLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useRendererStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n // Host changes are published later in this passive flush. Defer until that\n // publication lands, then verify this effect still owns the current host.\n const loadResource = async () => {\n await Promise.resolve();\n if (cancelled || useRendererStore.getState().host !== targetHost) return;\n try {\n const res = await targetHost.loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n });\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n } catch (error: unknown) {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n };\n void loadResource();\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId, useRendererStore]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const result = extractSendMessageContent(params);\n if (\"reason\" in result) {\n return { isError: true, ok: false, reason: result.reason };\n }\n aui.thread.append({ content: result.content });\n return { ok: true };\n }),\n callTool: (params) =>\n useRendererStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useRendererStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useRendererStore.getState().host.listResources(params);\n }\n return useRendererStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useRendererStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n // The rendered component identity has to stay stable, or every part remounts\n // its frame; options reach the parts through the store instead of props.\n const [useRendererStore] = useState(() =>\n create<RendererState>(() => ({ host, options })),\n );\n useEffect(() => {\n useRendererStore.setState((prev) =>\n prev.host === host && isSameOptions(prev.options, options)\n ? prev\n : { host, options },\n );\n }, [host, options, useRendererStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer part={props} useRendererStore={useRendererStore} />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useRendererStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;;AAwGA,MAAMiD,iBACJC,GACAC,MACY;CACZ,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC,CAAC,CAACK,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,MAAMC,QAAQJ,OAAOC,KAAKH,CAAC,CAAC,CAACI,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,IAAIJ,MAAMM,WAAWD,MAAMC,QAAQ,OAAO;CAC1C,MAAMC,UAAUT;CAChB,MAAMW,UAAUV;CA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P,IAAI;CAIrC,MAAM,CAACkD,oBAAoBvF,eACzBS,cAA6B;EAAE4B;EAAMO;CAAQ,EAAE,CACjD;CACA/C,gBAAgB;EACd0F,iBAAiBsC,UAAUC,SACzBA,KAAKzF,SAASA,QAAQS,cAAcgF,KAAKlF,SAASA,OAAO,IACrDkF,OACA;GAAEzF;GAAMO;EAAQ,CACtB;CACF,GAAG;EAACP;EAAMO;EAAS2C;CAAgB,CAAC;CAUpC,OAAO,EAAEqC,QARM9H,cAA4C;EACzD,MAAMiI,UAAwCC,UAC5C,oBAAC,gBAAD;GAAgB,MAAMA;GAAyBzC;EAAiB,CAAA;EAElEwC,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAACxC,gBAAgB,CAEXqC,EAAO;AAClB;AAEA,MAAaM,iBAAiBrH,SAAS8G,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"McpAppRenderer.js","names":["useEffect","useMemo","useRef","useState","ReactNode","useIsomorphicLayoutEffect","McpAppMetadata","TextMessagePart","ToolCallMessagePart","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppPartOptions","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","McpAppRendererOptions","host","forPart","part","LoadedResourceState","resourceUri","serverId","RendererState","options","UseRendererStore","isSameOptions","a","b","aKeys","Object","keys","filter","key","bKeys","length","aValues","Record","bValues","every","hasOwn","is","getInput","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageTexts","params","obj","content","Array","isArray","index","Number","isInteger","String","map","block","text","extractSendMessageContent","reason","texts","resolvePartOptions","overrides","InlineRenderer","useRendererStore","aui","rendererOptions","state","opts","app","cachedAppRef","current","appForRender","loadedResource","setLoadedResource","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","Promise","resolve","getState","res","uri","bridgeHandlers","openLink","sendMessage","result","isError","ok","thread","append","callTool","readResource","listResources","loadedResourceForApp","appResource","useMcpAppRenderer","render","setState","prev","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\nimport type {\n McpAppMetadata,\n TextMessagePart,\n ToolCallMessagePart,\n} from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\n/**\n * Options that apply to a single MCP app. `McpAppRenderer` takes them as\n * thread-wide defaults, and its `forPart` resolver overrides them for one part.\n */\nexport type McpAppPartOptions = {\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n *\n * Which handlers a widget may call is captured when its frame mounts, so a\n * `forPart` resolver returns the same handler keys for a part on every\n * render even when the implementations change.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\nexport type McpAppRendererOptions = McpAppPartOptions & {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /**\n * Resolves the options for one part. Each returned value replaces the\n * thread-wide option of the same name, so a host can give every MCP app its\n * own display mode and answer `requestDisplayMode` for the part that asked.\n *\n * `handlers` is the exception and merges per key. Its keys are capabilities\n * negotiated with the widget rather than data, so replacing the whole bag to\n * add one handler would withdraw the others from that part's widget with\n * nothing to observe it by.\n */\n forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype RendererState = {\n host: McpAppsHost;\n options: McpAppRendererOptions;\n};\n\ntype UseRendererStore = UseBoundStore<StoreApi<RendererState>>;\n\n// Callers pass options as an object literal, so the resource hands this a fresh\n// identity on every run; comparing the values keeps an unchanged run from\n// re-rendering every mounted part. `host` is excluded because it is an element\n// rebuilt on every run, and the store carries the resolved host separately.\nconst isSameOptions = (\n a: McpAppRendererOptions,\n b: McpAppRendererOptions,\n): boolean => {\n const aKeys = Object.keys(a).filter((key) => key !== \"host\");\n const bKeys = Object.keys(b).filter((key) => key !== \"host\");\n if (aKeys.length !== bKeys.length) return false;\n const aValues = a as Record<string, unknown>;\n const bValues = b as Record<string, unknown>;\n return aKeys.every(\n (key) =>\n Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]),\n );\n};\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageTexts(params: unknown): string[] | undefined {\n if (typeof params === \"string\") return [params];\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return [obj[\"prompt\"]];\n if (typeof obj[\"text\"] === \"string\") return [obj[\"text\"]];\n if (typeof obj[\"message\"] === \"string\") return [obj[\"message\"]];\n const content = obj[\"content\"];\n if (Array.isArray(content)) {\n return Object.keys(content)\n .filter((key) => {\n const index = Number(key);\n return (\n Number.isInteger(index) &&\n index >= 0 &&\n index < content.length &&\n String(index) === key\n );\n })\n .map((key) => content[Number(key)])\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n isRecord(block) &&\n block[\"type\"] === \"text\" &&\n typeof block[\"text\"] === \"string\",\n )\n .map((block) => block.text);\n }\n return undefined;\n}\n\nfunction extractSendMessageContent(\n params: unknown,\n): { content: TextMessagePart[] } | { reason: string } {\n const texts = extractSendMessageTexts(params);\n if (!texts) return { reason: \"unrecognised params shape\" };\n const content = texts\n .filter((text) => text !== \"\")\n .map((text): TextMessagePart => ({ type: \"text\", text }));\n if (content.length === 0) {\n return { reason: \"no text content to append\" };\n }\n return { content };\n}\n\nfunction resolvePartOptions(\n options: McpAppRendererOptions,\n part: ToolCallMessagePartProps,\n): McpAppRendererOptions {\n const overrides = options.forPart?.(part);\n if (!overrides) return options;\n const handlers =\n options.handlers && overrides.handlers\n ? { ...options.handlers, ...overrides.handlers }\n : (overrides.handlers ?? options.handlers);\n return {\n ...options,\n ...overrides,\n ...(handlers === undefined ? {} : { handlers }),\n };\n}\n\nfunction InlineRenderer({\n part,\n useRendererStore,\n}: {\n part: ToolCallMessagePartProps;\n useRendererStore: UseRendererStore;\n}) {\n const aui = useAui();\n const rendererOptions = useRendererStore((state) => state.options);\n const opts = resolvePartOptions(rendererOptions, part);\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useIsomorphicLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useRendererStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n // Host changes are published later in this passive flush. Defer until that\n // publication lands, then verify this effect still owns the current host.\n const loadResource = async () => {\n await Promise.resolve();\n if (cancelled || useRendererStore.getState().host !== targetHost) return;\n try {\n const res = await targetHost.loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n });\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n } catch (error: unknown) {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n };\n void loadResource();\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId, useRendererStore]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const result = extractSendMessageContent(params);\n if (\"reason\" in result) {\n return { isError: true, ok: false, reason: result.reason };\n }\n aui.thread.append({ content: result.content });\n return { ok: true };\n }),\n callTool: (params) =>\n useRendererStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useRendererStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useRendererStore.getState().host.listResources(params);\n }\n return useRendererStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useRendererStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n // The rendered component identity has to stay stable, or every part remounts\n // its frame; options reach the parts through the store instead of props.\n const [useRendererStore] = useState(() =>\n create<RendererState>(() => ({ host, options })),\n );\n useEffect(() => {\n useRendererStore.setState((prev) =>\n prev.host === host && isSameOptions(prev.options, options)\n ? prev\n : { host, options },\n );\n }, [host, options, useRendererStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer part={props} useRendererStore={useRendererStore} />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useRendererStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;;AAwGA,MAAMiD,iBACJC,GACAC,MACY;CACZ,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC,CAAC,CAACK,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,MAAMC,QAAQJ,OAAOC,KAAKH,CAAC,CAAC,CAACI,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,IAAIJ,MAAMM,WAAWD,MAAMC,QAAQ,OAAO;CAC1C,MAAMC,UAAUT;CAChB,MAAMW,UAAUV;CAChB,OAAOC,MAAMU,OACVN,QACCH,OAAOU,OAAOF,SAASL,GAAG,KAAKH,OAAOW,GAAGL,QAAQH,MAAMK,QAAQL,IAAI,CACvE;AACF;AAEA,SAASS,SAASvB,MAIN;CACV,IACEA,KAAKwB,OAAOC,SAAS,cACpBzB,KAAK0B,aAAa,MAAM1B,KAAK0B,aAAa,OAE3C;CAEF,OAAO1B,KAAK2B;AACd;AAEA,MAAME,mBAAmB,EAAEC,UAA2B;CACpDC,OAAOC,KAAKF,KAAK,UAAU,qBAAqB;AAClD;AAEA,SAASG,wBAAwBC,QAAuC;CACtE,IAAI,OAAOA,WAAW,UAAU,OAAO,CAACA,MAAM;CAC9C,IAAI,CAACA,UAAU,OAAOA,WAAW,UAAU,OAAON,KAAAA;CAClD,MAAMO,MAAMD;CACZ,IAAI,OAAOC,IAAI,cAAc,UAAU,OAAO,CAACA,IAAI,SAAS;CAC5D,IAAI,OAAOA,IAAI,YAAY,UAAU,OAAO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AAwCC,UAC5C,oBAAC,gBAAD;GAAgB,MAAMA;GAAyBxC;EAAiB,CAAA;EAElEuC,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAACvC,gBAAgB,CAEXoC,EAAO;AAClB;AAEA,MAAaM,iBAAiBxH,SAASiH,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantFrameHost.d.ts","sourceRoot":"","sources":["../../../src/model-context/frame/useAssistantFrameHost.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,KAAK,4BAA4B,GAAG;IAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,WAAW,CAAC;CAC1D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,GAAI,wCAInC,4BAA4B,KAAG,
|
|
1
|
+
{"version":3,"file":"useAssistantFrameHost.d.ts","sourceRoot":"","sources":["../../../src/model-context/frame/useAssistantFrameHost.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,KAAK,4BAA4B,GAAG;IAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,WAAW,CAAC;CAC1D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,GAAI,wCAInC,4BAA4B,KAAG,IAqFjC,CAAC"}
|