veryfront 0.1.198 → 0.1.200
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/esm/deno.js +1 -1
- package/esm/src/agent/ag-ui-browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui-browser-encoder.js +97 -34
- package/esm/src/agent/react/use-voice-input.js +3 -4
- package/esm/src/agent/runtime/chat-stream-handler.d.ts +1 -0
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +149 -9
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +0 -2
- package/esm/src/chat/index.d.ts +0 -1
- package/esm/src/chat/index.js +0 -1
- package/esm/src/markdown/index.d.ts +0 -1
- package/esm/src/markdown/index.js +0 -1
- package/esm/src/mdx/index.d.ts +0 -1
- package/esm/src/mdx/index.js +0 -1
- package/esm/src/platform/compat/runtime.js +10 -11
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +23 -12
- package/esm/src/react/components/Head.d.ts +0 -1
- package/esm/src/react/components/Head.js +0 -1
- package/esm/src/react/components/chat/chat/components/code-block.js +1 -2
- package/esm/src/react/components/chat/chat/components/inline-citation.js +2 -3
- package/esm/src/react/components/chat/chat/components/message-actions.js +1 -2
- package/esm/src/react/components/chat/chat/components/reasoning.js +1 -2
- package/esm/src/react/components/chat/chat/hooks/use-threads.js +1 -2
- package/esm/src/react/components/chat/markdown.js +2 -2
- package/esm/src/react/context/index.d.ts +0 -1
- package/esm/src/react/context/index.js +0 -1
- package/esm/src/react/fonts/index.d.ts +0 -1
- package/esm/src/react/fonts/index.js +0 -1
- package/esm/src/react/router/index.d.ts +0 -1
- package/esm/src/react/router/index.js +0 -1
- package/esm/src/security/client/html-sanitizer.js +1 -2
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +5 -3
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/ag-ui-browser-encoder.ts +101 -31
- package/src/src/agent/runtime/chat-stream-handler.ts +172 -9
- package/src/src/agent/runtime/index.ts +0 -3
- package/src/src/provider/runtime-loader.ts +28 -8
- package/src/src/react/components/chat/markdown.tsx +2 -2
- package/src/src/server/handlers/dev/framework-candidates.generated.ts +5 -3
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag-ui-browser-encoder.d.ts","sourceRoot":"","sources":["../../../src/src/agent/ag-ui-browser-encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE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,CAAC;CAClC;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE;AAuND,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,EAAE,CAyM3B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,EAC9B,QAAQ,EAAE,aAAa,GAAG,IAAI,GAC7B,uBAAuB,EAAE,CA8B3B"}
|
|
@@ -153,6 +153,24 @@ function createTextEvent(messageId, type, delta = "") {
|
|
|
153
153
|
: { messageId },
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
+
function closeOpenTextEvent(state) {
|
|
157
|
+
if (!state.textOpen) {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
state.textOpen = false;
|
|
161
|
+
return [createTextEvent(getMessageId(state, { type: "text-end" }), "TextMessageEnd")];
|
|
162
|
+
}
|
|
163
|
+
function closeOpenReasoningEvent(state) {
|
|
164
|
+
if (state.reasoningMessageId === null) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
const messageId = state.reasoningMessageId;
|
|
168
|
+
state.reasoningMessageId = null;
|
|
169
|
+
return [{
|
|
170
|
+
event: "ReasoningMessageEnd",
|
|
171
|
+
payload: { messageId },
|
|
172
|
+
}];
|
|
173
|
+
}
|
|
156
174
|
export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
157
175
|
if (event.type.startsWith("data-")) {
|
|
158
176
|
const name = event.type.slice("data-".length);
|
|
@@ -167,24 +185,26 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
|
167
185
|
getMessageId(state, event);
|
|
168
186
|
return [];
|
|
169
187
|
case "text-start": {
|
|
188
|
+
const events = closeOpenReasoningEvent(state);
|
|
170
189
|
if (state.textOpen)
|
|
171
190
|
return [];
|
|
172
191
|
const messageId = getMessageId(state, event);
|
|
173
192
|
state.textOpen = true;
|
|
174
193
|
state.sawVisibleOutput = true;
|
|
175
|
-
|
|
194
|
+
events.push(createTextEvent(messageId, "TextMessageStart"));
|
|
195
|
+
return events;
|
|
176
196
|
}
|
|
177
197
|
case "text-delta": {
|
|
198
|
+
const events = closeOpenReasoningEvent(state);
|
|
178
199
|
const messageId = getMessageId(state, event);
|
|
179
200
|
state.sawVisibleOutput = true;
|
|
180
201
|
if (!state.textOpen) {
|
|
181
202
|
state.textOpen = true;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
createTextEvent(messageId, "TextMessageContent", typeof event.delta === "string" ? event.delta : ""),
|
|
185
|
-
];
|
|
203
|
+
events.push(createTextEvent(messageId, "TextMessageStart"), createTextEvent(messageId, "TextMessageContent", typeof event.delta === "string" ? event.delta : ""));
|
|
204
|
+
return events;
|
|
186
205
|
}
|
|
187
|
-
|
|
206
|
+
events.push(createTextEvent(messageId, "TextMessageContent", typeof event.delta === "string" ? event.delta : ""));
|
|
207
|
+
return events;
|
|
188
208
|
}
|
|
189
209
|
case "text-end": {
|
|
190
210
|
if (!state.textOpen)
|
|
@@ -192,26 +212,42 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
|
192
212
|
state.textOpen = false;
|
|
193
213
|
return [createTextEvent(getMessageId(state, event), "TextMessageEnd")];
|
|
194
214
|
}
|
|
195
|
-
case "reasoning-start":
|
|
215
|
+
case "reasoning-start": {
|
|
216
|
+
const events = closeOpenTextEvent(state);
|
|
217
|
+
events.push(...closeOpenReasoningEvent(state));
|
|
196
218
|
state.sawVisibleOutput = true;
|
|
197
|
-
|
|
198
|
-
|
|
219
|
+
events.push(createReasoningEvent(state, event, "ReasoningMessageStart"));
|
|
220
|
+
return events;
|
|
221
|
+
}
|
|
222
|
+
case "reasoning-delta": {
|
|
223
|
+
const events = closeOpenTextEvent(state);
|
|
199
224
|
state.sawVisibleOutput = true;
|
|
200
|
-
|
|
225
|
+
if (state.reasoningMessageId === null) {
|
|
226
|
+
events.push(createReasoningEvent(state, event, "ReasoningMessageStart"));
|
|
227
|
+
}
|
|
228
|
+
events.push(createReasoningEvent(state, event, "ReasoningMessageContent"));
|
|
229
|
+
return events;
|
|
230
|
+
}
|
|
201
231
|
case "reasoning-end": {
|
|
202
232
|
const reasoningEvent = createReasoningEvent(state, event, "ReasoningMessageEnd");
|
|
203
233
|
state.reasoningMessageId = null;
|
|
204
234
|
return [reasoningEvent];
|
|
205
235
|
}
|
|
206
|
-
case "tool-input-start":
|
|
236
|
+
case "tool-input-start": {
|
|
237
|
+
const events = [
|
|
238
|
+
...closeOpenTextEvent(state),
|
|
239
|
+
...closeOpenReasoningEvent(state),
|
|
240
|
+
];
|
|
207
241
|
state.sawVisibleOutput = true;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
242
|
+
events.push({
|
|
243
|
+
event: "ToolCallStart",
|
|
244
|
+
payload: {
|
|
245
|
+
toolCallId: event.toolCallId,
|
|
246
|
+
toolCallName: event.toolName,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
return events;
|
|
250
|
+
}
|
|
215
251
|
case "tool-input-delta":
|
|
216
252
|
state.sawVisibleOutput = true;
|
|
217
253
|
if (typeof event.toolCallId === "string") {
|
|
@@ -226,11 +262,19 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
|
226
262
|
}];
|
|
227
263
|
case "tool-input-available": {
|
|
228
264
|
state.sawVisibleOutput = true;
|
|
229
|
-
return
|
|
265
|
+
return [
|
|
266
|
+
...closeOpenTextEvent(state),
|
|
267
|
+
...closeOpenReasoningEvent(state),
|
|
268
|
+
...completeToolInput(state, event),
|
|
269
|
+
];
|
|
230
270
|
}
|
|
231
271
|
case "tool-input-error": {
|
|
232
272
|
state.sawVisibleOutput = true;
|
|
233
|
-
const events =
|
|
273
|
+
const events = [
|
|
274
|
+
...closeOpenTextEvent(state),
|
|
275
|
+
...closeOpenReasoningEvent(state),
|
|
276
|
+
...completeToolInput(state, event),
|
|
277
|
+
];
|
|
234
278
|
events.push({
|
|
235
279
|
event: "ToolCallResult",
|
|
236
280
|
payload: {
|
|
@@ -245,32 +289,56 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
|
245
289
|
}
|
|
246
290
|
case "tool-output-available":
|
|
247
291
|
state.sawVisibleOutput = true;
|
|
248
|
-
return [
|
|
292
|
+
return [
|
|
293
|
+
...closeOpenTextEvent(state),
|
|
294
|
+
...closeOpenReasoningEvent(state),
|
|
295
|
+
createToolResultEvent(event.toolCallId, event.output),
|
|
296
|
+
];
|
|
249
297
|
case "tool-output-error":
|
|
250
298
|
state.sawVisibleOutput = true;
|
|
251
|
-
return [
|
|
299
|
+
return [
|
|
300
|
+
...closeOpenTextEvent(state),
|
|
301
|
+
...closeOpenReasoningEvent(state),
|
|
302
|
+
createToolResultEvent(event.toolCallId, { error: event.errorText }, true),
|
|
303
|
+
];
|
|
252
304
|
case "tool-output-denied":
|
|
253
305
|
state.sawVisibleOutput = true;
|
|
254
|
-
return [
|
|
306
|
+
return [
|
|
307
|
+
...closeOpenTextEvent(state),
|
|
308
|
+
...closeOpenReasoningEvent(state),
|
|
309
|
+
createToolResultEvent(event.toolCallId, { error: "Tool output denied" }, true),
|
|
310
|
+
];
|
|
255
311
|
case "step-start":
|
|
256
312
|
case "start-step":
|
|
257
313
|
state.sawVisibleOutput = true;
|
|
258
|
-
return [
|
|
314
|
+
return [
|
|
315
|
+
...closeOpenTextEvent(state),
|
|
316
|
+
...closeOpenReasoningEvent(state),
|
|
317
|
+
createStepEvent(state, "StepStarted"),
|
|
318
|
+
];
|
|
259
319
|
case "step-end":
|
|
260
320
|
case "finish-step":
|
|
261
321
|
state.sawVisibleOutput = true;
|
|
262
|
-
return [
|
|
322
|
+
return [
|
|
323
|
+
...closeOpenTextEvent(state),
|
|
324
|
+
...closeOpenReasoningEvent(state),
|
|
325
|
+
createStepEvent(state, "StepFinished"),
|
|
326
|
+
];
|
|
263
327
|
case "data":
|
|
264
328
|
applyDataMetadata(state, event);
|
|
265
329
|
return [];
|
|
266
330
|
case "error":
|
|
267
331
|
state.sawTerminalError = true;
|
|
268
|
-
return [
|
|
332
|
+
return [
|
|
333
|
+
...closeOpenTextEvent(state),
|
|
334
|
+
...closeOpenReasoningEvent(state),
|
|
335
|
+
{
|
|
269
336
|
event: "RunError",
|
|
270
337
|
payload: {
|
|
271
338
|
message: typeof event.error === "string" ? event.error : "Agent run failed",
|
|
272
339
|
},
|
|
273
|
-
}
|
|
340
|
+
},
|
|
341
|
+
];
|
|
274
342
|
default:
|
|
275
343
|
return [];
|
|
276
344
|
}
|
|
@@ -291,13 +359,8 @@ export function finalizeAgUiBrowserEvents(state, response) {
|
|
|
291
359
|
}];
|
|
292
360
|
}
|
|
293
361
|
const events = [];
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
events.push({
|
|
297
|
-
event: "TextMessageEnd",
|
|
298
|
-
payload: { messageId: getMessageId(state, { type: "text-end" }) },
|
|
299
|
-
});
|
|
300
|
-
}
|
|
362
|
+
events.push(...closeOpenTextEvent(state));
|
|
363
|
+
events.push(...closeOpenReasoningEvent(state));
|
|
301
364
|
events.push({
|
|
302
365
|
event: "RunFinished",
|
|
303
366
|
payload: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
export function useVoiceInput(options = {}) {
|
|
4
3
|
const { language, continuous = false, interimResults = true, onTranscript, onError, onStart, onEnd, } = options;
|
|
@@ -7,15 +6,15 @@ export function useVoiceInput(options = {}) {
|
|
|
7
6
|
const [error, setError] = React.useState(null);
|
|
8
7
|
const recognitionRef = React.useRef(null);
|
|
9
8
|
const isSupported = React.useMemo(() => {
|
|
10
|
-
if (typeof
|
|
9
|
+
if (typeof globalThis === "undefined")
|
|
11
10
|
return false;
|
|
12
|
-
const g =
|
|
11
|
+
const g = globalThis;
|
|
13
12
|
return Boolean(g.SpeechRecognition ?? g.webkitSpeechRecognition);
|
|
14
13
|
}, []);
|
|
15
14
|
React.useEffect(() => {
|
|
16
15
|
if (!isSupported)
|
|
17
16
|
return;
|
|
18
|
-
const g =
|
|
17
|
+
const g = globalThis;
|
|
19
18
|
const SpeechRecognitionAPI = g.SpeechRecognition ?? g.webkitSpeechRecognition;
|
|
20
19
|
if (!SpeechRecognitionAPI)
|
|
21
20
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-stream-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/chat-stream-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAYtF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1C,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,KAAK,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAChF;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ;AAyED,wBAAgB,iBAAiB,IAAI,eAAe,CAQnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,+BAA+B,EAC3C,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,CAAC,EAAE,mBAAmB,EAC/B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"chat-stream-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/chat-stream-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAYtF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1C,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,KAAK,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAChF;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ;AAyED,wBAAgB,iBAAiB,IAAI,eAAe,CAQnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,+BAA+B,EAC3C,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,CAAC,EAAE,mBAAmB,EAC/B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,IAAI,CAAC,CAuZf"}
|
|
@@ -86,6 +86,114 @@ export function createStreamState() {
|
|
|
86
86
|
export function processStream(result, state, controller, encoder, textPartId, callbacks, abortSignal) {
|
|
87
87
|
return withSpan("agent.runtime.processStream", async () => {
|
|
88
88
|
let eventCount = 0;
|
|
89
|
+
let textOpen = false;
|
|
90
|
+
let activeReasoningId = null;
|
|
91
|
+
const normalizeReasoningId = (part) => typeof part.id === "string" && part.id.length > 0 ? part.id : "reasoning";
|
|
92
|
+
const openTextSegment = () => {
|
|
93
|
+
if (textOpen) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
textOpen = true;
|
|
97
|
+
sendSSE(controller, encoder, {
|
|
98
|
+
type: "text-start",
|
|
99
|
+
id: textPartId,
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const closeTextSegment = () => {
|
|
103
|
+
if (!textOpen) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
textOpen = false;
|
|
107
|
+
sendSSE(controller, encoder, {
|
|
108
|
+
type: "text-end",
|
|
109
|
+
id: textPartId,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const openReasoningSegment = (reasoningId) => {
|
|
113
|
+
if (activeReasoningId === reasoningId) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (activeReasoningId !== null) {
|
|
117
|
+
sendSSE(controller, encoder, {
|
|
118
|
+
type: "reasoning-end",
|
|
119
|
+
id: activeReasoningId,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
activeReasoningId = reasoningId;
|
|
123
|
+
sendSSE(controller, encoder, {
|
|
124
|
+
type: "reasoning-start",
|
|
125
|
+
id: reasoningId,
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const closeReasoningSegment = () => {
|
|
129
|
+
if (activeReasoningId === null) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
sendSSE(controller, encoder, {
|
|
133
|
+
type: "reasoning-end",
|
|
134
|
+
id: activeReasoningId,
|
|
135
|
+
});
|
|
136
|
+
activeReasoningId = null;
|
|
137
|
+
};
|
|
138
|
+
const ensureToolLifecycle = (part) => {
|
|
139
|
+
const dynamic = part.dynamic ?? isDynamicTool(part.toolName);
|
|
140
|
+
const existing = state.toolCalls.get(part.toolCallId);
|
|
141
|
+
if (!existing) {
|
|
142
|
+
const normalizedInput = parseToolInputObject(part.input);
|
|
143
|
+
state.toolCalls.set(part.toolCallId, {
|
|
144
|
+
id: part.toolCallId,
|
|
145
|
+
name: part.toolName,
|
|
146
|
+
arguments: normalizeToolInputString(part.input),
|
|
147
|
+
inputAvailable: true,
|
|
148
|
+
...(part.providerExecuted !== undefined
|
|
149
|
+
? { providerExecuted: part.providerExecuted }
|
|
150
|
+
: {}),
|
|
151
|
+
...(dynamic ? { dynamic: true } : {}),
|
|
152
|
+
});
|
|
153
|
+
sendSSE(controller, encoder, {
|
|
154
|
+
type: "tool-input-start",
|
|
155
|
+
toolCallId: part.toolCallId,
|
|
156
|
+
toolName: part.toolName,
|
|
157
|
+
...(dynamic ? { dynamic: true } : {}),
|
|
158
|
+
});
|
|
159
|
+
sendSSE(controller, encoder, {
|
|
160
|
+
type: "tool-input-available",
|
|
161
|
+
toolCallId: part.toolCallId,
|
|
162
|
+
toolName: part.toolName,
|
|
163
|
+
input: normalizedInput,
|
|
164
|
+
...(part.providerExecuted !== undefined
|
|
165
|
+
? { providerExecuted: part.providerExecuted }
|
|
166
|
+
: {}),
|
|
167
|
+
...(dynamic ? { dynamic: true } : {}),
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (existing.inputAvailable) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const resolvedArguments = part.input !== undefined
|
|
175
|
+
? mergeToolCallInput(existing.arguments, normalizeToolInputString(part.input))
|
|
176
|
+
: existing.arguments;
|
|
177
|
+
const resolvedInput = parseToolInputObject(resolvedArguments);
|
|
178
|
+
existing.arguments = resolvedArguments;
|
|
179
|
+
existing.inputAvailable = true;
|
|
180
|
+
if (part.providerExecuted !== undefined) {
|
|
181
|
+
existing.providerExecuted = part.providerExecuted;
|
|
182
|
+
}
|
|
183
|
+
if (dynamic) {
|
|
184
|
+
existing.dynamic = true;
|
|
185
|
+
}
|
|
186
|
+
sendSSE(controller, encoder, {
|
|
187
|
+
type: "tool-input-available",
|
|
188
|
+
toolCallId: part.toolCallId,
|
|
189
|
+
toolName: existing.name,
|
|
190
|
+
input: resolvedInput,
|
|
191
|
+
...(existing.providerExecuted !== undefined
|
|
192
|
+
? { providerExecuted: existing.providerExecuted }
|
|
193
|
+
: {}),
|
|
194
|
+
...(existing.dynamic ? { dynamic: true } : {}),
|
|
195
|
+
});
|
|
196
|
+
};
|
|
89
197
|
throwIfAborted(abortSignal);
|
|
90
198
|
for await (const part of result.fullStream) {
|
|
91
199
|
throwIfAborted(abortSignal);
|
|
@@ -96,6 +204,8 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
96
204
|
const typedPart = part;
|
|
97
205
|
switch (typedPart.type) {
|
|
98
206
|
case "text-delta": {
|
|
207
|
+
closeReasoningSegment();
|
|
208
|
+
openTextSegment();
|
|
99
209
|
state.accumulatedText += typedPart.text;
|
|
100
210
|
sendSSE(controller, encoder, {
|
|
101
211
|
type: "text-delta",
|
|
@@ -106,33 +216,37 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
106
216
|
break;
|
|
107
217
|
}
|
|
108
218
|
case "reasoning-start": {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
id: typeof typedPart.id === "string" ? typedPart.id : "reasoning",
|
|
112
|
-
});
|
|
219
|
+
closeTextSegment();
|
|
220
|
+
openReasoningSegment(normalizeReasoningId(typedPart));
|
|
113
221
|
break;
|
|
114
222
|
}
|
|
115
223
|
case "reasoning-delta": {
|
|
224
|
+
closeTextSegment();
|
|
225
|
+
openReasoningSegment(normalizeReasoningId(typedPart));
|
|
116
226
|
sendSSE(controller, encoder, {
|
|
117
227
|
type: "reasoning-delta",
|
|
118
|
-
id:
|
|
228
|
+
id: normalizeReasoningId(typedPart),
|
|
119
229
|
delta: typeof typedPart.delta === "string" ? typedPart.delta : "",
|
|
120
230
|
});
|
|
121
231
|
break;
|
|
122
232
|
}
|
|
123
233
|
case "reasoning-end": {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
234
|
+
closeTextSegment();
|
|
235
|
+
if (activeReasoningId === null) {
|
|
236
|
+
activeReasoningId = normalizeReasoningId(typedPart);
|
|
237
|
+
}
|
|
238
|
+
closeReasoningSegment();
|
|
128
239
|
break;
|
|
129
240
|
}
|
|
130
241
|
case "tool-input-start": {
|
|
242
|
+
closeTextSegment();
|
|
243
|
+
closeReasoningSegment();
|
|
131
244
|
const toolId = typedPart.id;
|
|
132
245
|
state.toolCalls.set(toolId, {
|
|
133
246
|
id: toolId,
|
|
134
247
|
name: typedPart.toolName,
|
|
135
248
|
arguments: "",
|
|
249
|
+
inputAvailable: false,
|
|
136
250
|
providerExecuted: typedPart.providerExecuted,
|
|
137
251
|
dynamic: typedPart.dynamic,
|
|
138
252
|
});
|
|
@@ -146,6 +260,7 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
146
260
|
break;
|
|
147
261
|
}
|
|
148
262
|
case "tool-input-delta": {
|
|
263
|
+
closeReasoningSegment();
|
|
149
264
|
const toolId = typedPart.id;
|
|
150
265
|
const tc = state.toolCalls.get(toolId);
|
|
151
266
|
if (!tc)
|
|
@@ -159,6 +274,8 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
159
274
|
break;
|
|
160
275
|
}
|
|
161
276
|
case "tool-call": {
|
|
277
|
+
closeTextSegment();
|
|
278
|
+
closeReasoningSegment();
|
|
162
279
|
// tool-call fires when the full tool call is available
|
|
163
280
|
const toolId = typedPart.toolCallId;
|
|
164
281
|
const inputStr = normalizeToolInputString(typedPart.input);
|
|
@@ -168,6 +285,7 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
168
285
|
id: toolId,
|
|
169
286
|
name: typedPart.toolName,
|
|
170
287
|
arguments: resolvedArguments,
|
|
288
|
+
inputAvailable: true,
|
|
171
289
|
providerExecuted: typedPart.providerExecuted,
|
|
172
290
|
dynamic: typedPart.dynamic,
|
|
173
291
|
});
|
|
@@ -186,6 +304,15 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
186
304
|
break;
|
|
187
305
|
}
|
|
188
306
|
case "tool-result": {
|
|
307
|
+
closeTextSegment();
|
|
308
|
+
closeReasoningSegment();
|
|
309
|
+
ensureToolLifecycle({
|
|
310
|
+
toolCallId: typedPart.toolCallId,
|
|
311
|
+
toolName: typedPart.toolName,
|
|
312
|
+
input: typedPart.input,
|
|
313
|
+
providerExecuted: typedPart.providerExecuted,
|
|
314
|
+
dynamic: typedPart.dynamic,
|
|
315
|
+
});
|
|
189
316
|
const isError = typedPart.isError === true;
|
|
190
317
|
logProviderToolPart("tool-result", {
|
|
191
318
|
toolCallId: typedPart.toolCallId,
|
|
@@ -241,6 +368,15 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
241
368
|
break;
|
|
242
369
|
}
|
|
243
370
|
case "tool-error": {
|
|
371
|
+
closeTextSegment();
|
|
372
|
+
closeReasoningSegment();
|
|
373
|
+
ensureToolLifecycle({
|
|
374
|
+
toolCallId: typedPart.toolCallId,
|
|
375
|
+
toolName: typedPart.toolName,
|
|
376
|
+
input: typedPart.input,
|
|
377
|
+
providerExecuted: typedPart.providerExecuted,
|
|
378
|
+
dynamic: typedPart.dynamic,
|
|
379
|
+
});
|
|
244
380
|
logProviderToolPart("tool-error", {
|
|
245
381
|
toolCallId: typedPart.toolCallId,
|
|
246
382
|
toolName: typedPart.toolName,
|
|
@@ -270,6 +406,8 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
270
406
|
break;
|
|
271
407
|
}
|
|
272
408
|
case "finish": {
|
|
409
|
+
closeTextSegment();
|
|
410
|
+
closeReasoningSegment();
|
|
273
411
|
state.finishReason = typedPart.finishReason ?? null;
|
|
274
412
|
if (typedPart.totalUsage) {
|
|
275
413
|
const input = typedPart.totalUsage.inputTokens ?? 0;
|
|
@@ -284,6 +422,8 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
284
422
|
break;
|
|
285
423
|
}
|
|
286
424
|
case "error": {
|
|
425
|
+
closeTextSegment();
|
|
426
|
+
closeReasoningSegment();
|
|
287
427
|
logger.warn("Runtime stream error:", typedPart.error);
|
|
288
428
|
sendSSE(controller, encoder, {
|
|
289
429
|
type: "error",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,OAAO,EAGZ,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAS/D,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,E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;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAI5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -299,12 +299,10 @@ export class AgentRuntime {
|
|
|
299
299
|
model: effectiveModel,
|
|
300
300
|
},
|
|
301
301
|
});
|
|
302
|
-
sendSSE(controller, encoder, { type: "text-start", id: textPartId });
|
|
303
302
|
const response = await this.executeAgentLoopStreaming(systemPrompt, memoryMessages, controller, encoder, callbacks, textPartId, toolContext, context, resolvedModelString, languageModel, transport.headers, transport.providerOptions, maxOutputTokensOverride, streamAbortSignal);
|
|
304
303
|
throwIfAborted(streamAbortSignal);
|
|
305
304
|
callbacks?.onFinish?.(response);
|
|
306
305
|
throwIfAborted(streamAbortSignal);
|
|
307
|
-
sendSSE(controller, encoder, { type: "text-end", id: textPartId });
|
|
308
306
|
sendSSE(controller, encoder, { type: "message-finish" });
|
|
309
307
|
closeSSEStream(controller);
|
|
310
308
|
}
|
package/esm/src/chat/index.d.ts
CHANGED
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
* </Message.Root>
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
import "../../_dnt.polyfills.js";
|
|
51
50
|
export { Chat, ChatComponents, type ChatProps } from "../react/components/chat/chat.js";
|
|
52
51
|
export { ChatComposer, type ChatComposerProps, ChatEmpty, type ChatEmptyProps, ChatIf, type ChatIfProps, ChatMessageList, type ChatMessageListProps, ChatRoot, type ChatRootProps, ErrorBanner, type ErrorBannerProps, Message, type MessageRootProps, ModelAvatar, type ModelAvatarProps, } from "../react/components/chat/chat.js";
|
|
53
52
|
export { ChatContextProvider, type ChatContextValue, ComposerContextProvider, type ComposerContextValue, MessageContextProvider, type MessageContextValue, ThreadListContextProvider, type ThreadListContextValue, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, useThreadListContext, useThreadListContextOptional, } from "../react/components/chat/chat.js";
|
package/esm/src/chat/index.js
CHANGED
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
* </Message.Root>
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
import "../../_dnt.polyfills.js";
|
|
51
50
|
export { Chat, ChatComponents } from "../react/components/chat/chat.js";
|
|
52
51
|
export { ChatComposer, ChatEmpty, ChatIf, ChatMessageList, ChatRoot, ErrorBanner, Message, ModelAvatar, } from "../react/components/chat/chat.js";
|
|
53
52
|
export { ChatContextProvider, ComposerContextProvider, MessageContextProvider, ThreadListContextProvider, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, useThreadListContext, useThreadListContextOptional, } from "../react/components/chat/chat.js";
|
|
@@ -10,6 +10,5 @@
|
|
|
10
10
|
* <Markdown># Hello{"\n\n"}Some **bold** text with `code`.</Markdown>
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
import "../../_dnt.polyfills.js";
|
|
14
13
|
export { type CodeBlockProps, Markdown, type MarkdownProps, } from "../react/components/chat/markdown.js";
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/src/mdx/index.d.ts
CHANGED
|
@@ -14,6 +14,5 @@
|
|
|
14
14
|
*
|
|
15
15
|
* For runtime markdown string rendering, use `veryfront/markdown` instead.
|
|
16
16
|
*/
|
|
17
|
-
import "../../_dnt.polyfills.js";
|
|
18
17
|
export { MDXProvider, type MDXProviderProps, useMDXComponents, } from "../react/components/MDXProvider.js";
|
|
19
18
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/src/mdx/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
1
|
function hasNodeProcess() {
|
|
3
|
-
const global =
|
|
2
|
+
const global = globalThis;
|
|
4
3
|
return global.process?.versions?.node != null && !global.process?.versions?.deno;
|
|
5
4
|
}
|
|
6
5
|
function hasBunGlobal() {
|
|
7
|
-
return
|
|
6
|
+
return globalThis.Bun != null;
|
|
8
7
|
}
|
|
9
8
|
function hasRealDeno() {
|
|
10
|
-
return (typeof
|
|
11
|
-
typeof
|
|
12
|
-
typeof
|
|
13
|
-
typeof
|
|
9
|
+
return (typeof globalThis.Deno !== "undefined" &&
|
|
10
|
+
typeof globalThis.Deno.version === "object" &&
|
|
11
|
+
typeof globalThis.Deno.build === "object" &&
|
|
12
|
+
typeof globalThis.Deno.build.os === "string");
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Check if an executable path is a compiled Deno binary.
|
|
@@ -30,7 +29,7 @@ function isDenoCompiledBinary() {
|
|
|
30
29
|
if (!hasRealDeno())
|
|
31
30
|
return false;
|
|
32
31
|
try {
|
|
33
|
-
return testDenoCompiledDetection(
|
|
32
|
+
return testDenoCompiledDetection(globalThis.Deno.execPath());
|
|
34
33
|
}
|
|
35
34
|
catch (_) {
|
|
36
35
|
/* expected: Deno.execPath() may not be available in all environments */
|
|
@@ -38,7 +37,7 @@ function isDenoCompiledBinary() {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
function hasCloudflareGlobals() {
|
|
41
|
-
return "caches" in
|
|
40
|
+
return "caches" in globalThis && "WebSocketPair" in globalThis;
|
|
42
41
|
}
|
|
43
42
|
/** True if running in Bun runtime (check first since Bun has process.versions.node) */
|
|
44
43
|
export const isBun = hasBunGlobal();
|
|
@@ -77,10 +76,10 @@ export function isNodeRuntime() {
|
|
|
77
76
|
* @see plans/architecture-audit/006.1-ssr-detection-inconsistencies.md
|
|
78
77
|
*/
|
|
79
78
|
export function isServerEnvironment() {
|
|
80
|
-
const ssrFlag =
|
|
79
|
+
const ssrFlag = globalThis.__VERYFRONT_SSR__;
|
|
81
80
|
if (ssrFlag === true)
|
|
82
81
|
return true;
|
|
83
|
-
return typeof
|
|
82
|
+
return typeof globalThis === "undefined";
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Detect if code is executing in a browser environment.
|