veryfront 0.1.868 → 0.1.870
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/cli/commands/demo/steps.js +1 -1
- package/esm/cli/commands/dev/command.d.ts.map +1 -1
- package/esm/cli/commands/dev/command.js +6 -1
- package/esm/cli/commands/start/command.d.ts +12 -0
- package/esm/cli/commands/start/command.d.ts.map +1 -1
- package/esm/cli/commands/start/command.js +32 -6
- package/esm/cli/shared/runtime-auth.d.ts +12 -0
- package/esm/cli/shared/runtime-auth.d.ts.map +1 -0
- package/esm/cli/shared/runtime-auth.js +34 -0
- package/esm/deno.js +1 -1
- package/esm/src/agent/ag-ui/handler.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/handler.js +17 -5
- package/esm/src/agent/composition/composition.d.ts.map +1 -1
- package/esm/src/agent/composition/composition.js +41 -6
- package/esm/src/agent/react/index.d.ts +1 -1
- package/esm/src/agent/react/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +2 -10
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts +3 -4
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +16 -107
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +20 -3
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +15 -17
- package/esm/src/agent/runtime/model-resolution.d.ts +2 -2
- package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-resolution.js +59 -13
- package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-result-continuation.js +17 -0
- package/esm/src/agent/types.d.ts +2 -2
- package/esm/src/chat/index.d.ts +2 -2
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +1 -1
- package/esm/src/embedding/upload-handler.d.ts +2 -1
- package/esm/src/embedding/upload-handler.d.ts.map +1 -1
- package/esm/src/embedding/upload-handler.js +2 -1
- package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
- package/esm/src/html/styles-builder/plugin-loader.js +2 -12
- package/esm/src/integrations/feature-flags.d.ts.map +1 -1
- package/esm/src/integrations/feature-flags.js +2 -10
- package/esm/src/platform/compat/dns.d.ts +6 -0
- package/esm/src/platform/compat/dns.d.ts.map +1 -0
- package/esm/src/platform/compat/dns.js +34 -0
- package/esm/src/platform/compat/opaque-dependency-versions.d.ts +1 -1
- package/esm/src/platform/compat/opaque-dependency-versions.js +1 -1
- package/esm/src/platform/index.d.ts +1 -0
- package/esm/src/platform/index.d.ts.map +1 -1
- package/esm/src/platform/index.js +2 -0
- package/esm/src/provider/index.d.ts +1 -1
- package/esm/src/provider/index.d.ts.map +1 -1
- package/esm/src/provider/index.js +1 -1
- package/esm/src/provider/local/env.d.ts +3 -0
- package/esm/src/provider/local/env.d.ts.map +1 -1
- package/esm/src/provider/local/env.js +31 -0
- package/esm/src/provider/local/local-engine.d.ts +38 -5
- package/esm/src/provider/local/local-engine.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.js +191 -19
- package/esm/src/provider/local/model-catalog.d.ts +8 -4
- package/esm/src/provider/local/model-catalog.d.ts.map +1 -1
- package/esm/src/provider/local/model-catalog.js +36 -41
- package/esm/src/provider/local/model-runtime-adapter.js +5 -5
- package/esm/src/provider/model-registry.d.ts +2 -12
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +4 -92
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +2 -3
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/inference-badge.js +3 -31
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +1 -2
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-message-list.js +5 -11
- package/esm/src/react/components/chat/chat/index.d.ts +2 -4
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +4 -6
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts +0 -1
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat-with-sidebar.js +0 -1
- package/esm/src/react/components/chat/chat.d.ts +1 -1
- package/esm/src/react/components/chat/chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat.js +1 -1
- package/esm/src/security/sandbox/worker-egress-guard.d.ts +1 -1
- package/esm/src/security/sandbox/worker-egress-guard.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-egress-guard.js +4 -17
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +3 -54
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts +3 -2
- package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/run-entrypoint.d.ts +6 -4
- package/esm/src/workflow/worker/run-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/run-entrypoint.js +3 -2
- package/package.json +2 -2
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts +0 -18
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts.map +0 -1
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.js +0 -62
- package/esm/src/agent/react/use-chat/browser-inference/types.d.ts +0 -44
- package/esm/src/agent/react/use-chat/browser-inference/types.d.ts.map +0 -1
- package/esm/src/agent/react/use-chat/browser-inference/types.js +0 -4
- package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts +0 -30
- package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts.map +0 -1
- package/esm/src/agent/react/use-chat/browser-inference/worker-client.js +0 -66
- package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts +0 -8
- package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts.map +0 -1
- package/esm/src/agent/react/use-chat/browser-inference/worker-script.js +0 -97
- package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts +0 -9
- package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/components/upgrade-cta.js +0 -35
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* Complete chat state management with zero UI.
|
|
5
5
|
* Consumes AG-UI SSE by default.
|
|
6
6
|
*
|
|
7
|
-
* Supports
|
|
8
|
-
* - cloud:
|
|
9
|
-
* - server-local:
|
|
10
|
-
* - browser: Server can't run ONNX (compiled binary), falls back to browser Worker
|
|
7
|
+
* Supports two inference modes:
|
|
8
|
+
* - cloud: server-side provider inference
|
|
9
|
+
* - server-local: explicit local model on the server
|
|
11
10
|
*/
|
|
12
11
|
import { useCallback, useEffect, useRef, useState } from "../../../../react/react.js";
|
|
13
12
|
import { createError, ensureError, toError } from "../../../errors/veryfront-error.js";
|
|
@@ -43,16 +42,11 @@ export function useChat(options = {}) {
|
|
|
43
42
|
const [model, setModel] = useState(options.model);
|
|
44
43
|
const [inferenceMode, setInferenceMode] = useState("cloud");
|
|
45
44
|
const [activeModel, setActiveModel] = useState(undefined);
|
|
46
|
-
const [browserStatus, setBrowserStatus] = useState(null);
|
|
47
45
|
const abortControllerRef = useRef(null);
|
|
48
46
|
const requestIdRef = useRef(0);
|
|
49
|
-
const browserInferenceActiveRef = useRef(false);
|
|
50
|
-
const browserInferenceRejectRef = useRef(null);
|
|
51
47
|
// Branch tracking: keyed by the message ID at the edit point
|
|
52
48
|
const branchMapRef = useRef(new Map());
|
|
53
49
|
const branchKeyByMessageIdRef = useRef(new Map());
|
|
54
|
-
// System prompt for browser fallback (from 503 response or options)
|
|
55
|
-
const systemPromptRef = useRef(options.systemPrompt ?? "You are a helpful assistant.");
|
|
56
50
|
// Track pending tool outputs for addToolOutput
|
|
57
51
|
const pendingToolOutputsRef = useRef(new Map());
|
|
58
52
|
// Abort in-flight request on unmount
|
|
@@ -83,68 +77,6 @@ export function useChat(options = {}) {
|
|
|
83
77
|
}),
|
|
84
78
|
})));
|
|
85
79
|
}, []);
|
|
86
|
-
/**
|
|
87
|
-
* Run inference in the browser via Web Worker.
|
|
88
|
-
* Lazily imports the browser-inference module to avoid bundling it
|
|
89
|
-
* when server-side inference works fine.
|
|
90
|
-
*/
|
|
91
|
-
const doBrowserInference = useCallback(async (allMessages) => {
|
|
92
|
-
browserInferenceActiveRef.current = true;
|
|
93
|
-
try {
|
|
94
|
-
const { runBrowserInference } = await import("./browser-inference/browser-engine.js");
|
|
95
|
-
await new Promise((resolve, reject) => {
|
|
96
|
-
browserInferenceRejectRef.current = reject;
|
|
97
|
-
let hasAddedMessage = false;
|
|
98
|
-
runBrowserInference(allMessages, systemPromptRef.current, {
|
|
99
|
-
onUpdate: (parts, messageId) => {
|
|
100
|
-
if (!hasAddedMessage) {
|
|
101
|
-
hasAddedMessage = true;
|
|
102
|
-
setMessages((prev) => [
|
|
103
|
-
...prev,
|
|
104
|
-
{
|
|
105
|
-
id: messageId,
|
|
106
|
-
role: "assistant",
|
|
107
|
-
parts,
|
|
108
|
-
metadata: { model: model ?? "browser" },
|
|
109
|
-
},
|
|
110
|
-
]);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
setMessages((prev) => prev.map((m) => (m.id === messageId ? { ...m, parts } : m)));
|
|
114
|
-
},
|
|
115
|
-
onMessage: (assistantMessage) => {
|
|
116
|
-
const withMeta = {
|
|
117
|
-
...assistantMessage,
|
|
118
|
-
metadata: { ...assistantMessage.metadata, model: model ?? "browser" },
|
|
119
|
-
};
|
|
120
|
-
setMessages((prev) => {
|
|
121
|
-
if (!hasAddedMessage)
|
|
122
|
-
return [...prev, withMeta];
|
|
123
|
-
return prev.map((m) => m.id === assistantMessage.id
|
|
124
|
-
? { ...withMeta, metadata: { ...m.metadata, ...withMeta.metadata } }
|
|
125
|
-
: m);
|
|
126
|
-
});
|
|
127
|
-
options.onFinish?.(withMeta);
|
|
128
|
-
browserInferenceRejectRef.current = null;
|
|
129
|
-
resolve();
|
|
130
|
-
},
|
|
131
|
-
onStatusChange: (status) => {
|
|
132
|
-
setBrowserStatus(status);
|
|
133
|
-
},
|
|
134
|
-
onDownloadProgress: () => {
|
|
135
|
-
// Progress is tracked via onStatusChange("downloading-model")
|
|
136
|
-
},
|
|
137
|
-
onError: (err) => {
|
|
138
|
-
browserInferenceRejectRef.current = null;
|
|
139
|
-
reject(err);
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
finally {
|
|
145
|
-
browserInferenceActiveRef.current = false;
|
|
146
|
-
}
|
|
147
|
-
}, [options]);
|
|
148
80
|
/**
|
|
149
81
|
* Send a message and stream assistant updates.
|
|
150
82
|
*/
|
|
@@ -164,11 +96,6 @@ export function useChat(options = {}) {
|
|
|
164
96
|
setError(null);
|
|
165
97
|
try {
|
|
166
98
|
const allMessages = [...base, userMessage];
|
|
167
|
-
// If already in browser mode, skip fetch entirely
|
|
168
|
-
if (inferenceMode === "browser") {
|
|
169
|
-
await doBrowserInference(allMessages);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
99
|
const abortController = new AbortController();
|
|
173
100
|
abortControllerRef.current = abortController;
|
|
174
101
|
const response = await fetch(api, {
|
|
@@ -185,25 +112,23 @@ export function useChat(options = {}) {
|
|
|
185
112
|
}),
|
|
186
113
|
signal: abortController.signal,
|
|
187
114
|
});
|
|
188
|
-
|
|
189
|
-
|
|
115
|
+
if (!response.ok) {
|
|
116
|
+
let message = `API error: ${response.status}`;
|
|
190
117
|
try {
|
|
191
|
-
const body = await response.json();
|
|
192
|
-
if (body
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
118
|
+
const body = await response.clone().json();
|
|
119
|
+
if (body && typeof body === "object" && "error" in body) {
|
|
120
|
+
const errorMessage = body.error;
|
|
121
|
+
if (typeof errorMessage === "string" && errorMessage.trim()) {
|
|
122
|
+
message = errorMessage;
|
|
123
|
+
}
|
|
197
124
|
}
|
|
198
125
|
}
|
|
199
|
-
catch
|
|
200
|
-
|
|
126
|
+
catch {
|
|
127
|
+
// Ignore non-JSON error responses.
|
|
201
128
|
}
|
|
202
|
-
}
|
|
203
|
-
if (!response.ok) {
|
|
204
129
|
throw toError(createError({
|
|
205
130
|
type: "agent",
|
|
206
|
-
message
|
|
131
|
+
message,
|
|
207
132
|
}));
|
|
208
133
|
}
|
|
209
134
|
options.onResponse?.(response);
|
|
@@ -281,7 +206,7 @@ export function useChat(options = {}) {
|
|
|
281
206
|
abortControllerRef.current = null;
|
|
282
207
|
}
|
|
283
208
|
}
|
|
284
|
-
}, [model, options
|
|
209
|
+
}, [model, options]);
|
|
285
210
|
/**
|
|
286
211
|
* Reload last message
|
|
287
212
|
*/
|
|
@@ -302,24 +227,9 @@ export function useChat(options = {}) {
|
|
|
302
227
|
/**
|
|
303
228
|
* Stop generation
|
|
304
229
|
*/
|
|
305
|
-
const stop = useCallback(
|
|
230
|
+
const stop = useCallback(() => {
|
|
306
231
|
abortControllerRef.current?.abort();
|
|
307
232
|
abortControllerRef.current = null;
|
|
308
|
-
// Also stop browser inference Worker if active
|
|
309
|
-
if (browserInferenceActiveRef.current) {
|
|
310
|
-
// Settle the pending doBrowserInference promise before terminating the Worker
|
|
311
|
-
browserInferenceRejectRef.current?.(new Error("Generation stopped by user"));
|
|
312
|
-
browserInferenceRejectRef.current = null;
|
|
313
|
-
try {
|
|
314
|
-
const { stopBrowserInference } = await import("./browser-inference/browser-engine.js");
|
|
315
|
-
stopBrowserInference();
|
|
316
|
-
}
|
|
317
|
-
catch (_) {
|
|
318
|
-
/* expected: Worker module may already be terminated or unavailable */
|
|
319
|
-
}
|
|
320
|
-
browserInferenceActiveRef.current = false;
|
|
321
|
-
setBrowserStatus("ready");
|
|
322
|
-
}
|
|
323
233
|
setIsLoading(false);
|
|
324
234
|
}, []);
|
|
325
235
|
/**
|
|
@@ -440,7 +350,6 @@ export function useChat(options = {}) {
|
|
|
440
350
|
model,
|
|
441
351
|
activeModel,
|
|
442
352
|
inferenceMode,
|
|
443
|
-
browserStatus,
|
|
444
353
|
setInput,
|
|
445
354
|
setModel,
|
|
446
355
|
sendMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-stream-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/chat-stream-handler.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA0BtF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,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,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE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C;IACvC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAuBD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAevE;
|
|
1
|
+
{"version":3,"file":"chat-stream-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/chat-stream-handler.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAqB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA0BtF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,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,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,sBAAsB,EAAE,CAAC;IACzC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,GAAG,CAA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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,CA6qBf"}
|
|
@@ -66,6 +66,18 @@ function resolveToolResultOutput(part) {
|
|
|
66
66
|
}
|
|
67
67
|
return undefined;
|
|
68
68
|
}
|
|
69
|
+
function getMcpToolErrorMessage(value) {
|
|
70
|
+
if (!isRecord(value)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (typeof value.error !== "string" || value.error.length === 0) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value.message === "string" && value.message.trim().length > 0) {
|
|
77
|
+
return value.message;
|
|
78
|
+
}
|
|
79
|
+
return value.error;
|
|
80
|
+
}
|
|
69
81
|
function logProviderToolPart(partType, part) {
|
|
70
82
|
if (!isAnyDebugEnabled({ get: getHostEnv })) {
|
|
71
83
|
return;
|
|
@@ -649,7 +661,12 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
649
661
|
dynamic: typedPart.dynamic,
|
|
650
662
|
});
|
|
651
663
|
const toolResultOutput = resolveToolResultOutput(typedPart);
|
|
652
|
-
const
|
|
664
|
+
const mcpToolErrorMessage = getMcpToolErrorMessage(toolResultOutput);
|
|
665
|
+
const isExplicitError = typedPart.isError === true;
|
|
666
|
+
const isError = isExplicitError || mcpToolErrorMessage !== undefined;
|
|
667
|
+
const toolResultError = isExplicitError
|
|
668
|
+
? toolResultOutput
|
|
669
|
+
: mcpToolErrorMessage ?? toolResultOutput;
|
|
653
670
|
logProviderToolPart("tool-result", {
|
|
654
671
|
toolCallId: typedPart.toolCallId,
|
|
655
672
|
toolName: typedPart.toolName,
|
|
@@ -664,14 +681,14 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
664
681
|
state.toolResults.push({
|
|
665
682
|
toolCallId: typedPart.toolCallId,
|
|
666
683
|
toolName: typedPart.toolName,
|
|
667
|
-
error:
|
|
684
|
+
error: toolResultError,
|
|
668
685
|
...(providerExecuted !== undefined ? { providerExecuted } : {}),
|
|
669
686
|
...(typedPart.dynamic ? { dynamic: true } : {}),
|
|
670
687
|
});
|
|
671
688
|
sendSSE(controller, encoder, {
|
|
672
689
|
type: "tool-output-error",
|
|
673
690
|
toolCallId: typedPart.toolCallId,
|
|
674
|
-
errorText: stringifyToolError(
|
|
691
|
+
errorText: stringifyToolError(toolResultError),
|
|
675
692
|
...(providerExecuted !== undefined ? { providerExecuted } : {}),
|
|
676
693
|
...(typedPart.dynamic ? { dynamic: true } : {}),
|
|
677
694
|
});
|
|
@@ -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,EAGd,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAsDpE,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;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AAM,GAC/B,OAAO,CAAC,aAAa,CAAC;IAoDzB;;;OAGG;IACG,MAAM,CACV,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;QACV,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;QAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;KAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAmJtC;;OAEG;YACW,gBAAgB;IA6T9B;;;;OAIG;YACW,yBAAyB;IA6evC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,mBAAmB;IAOjC;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,sBAAsB;IAoB9B;;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"}
|
|
@@ -219,14 +219,13 @@ export class AgentRuntime {
|
|
|
219
219
|
// (e.g., no_ai_available), the error propagates to the caller who can
|
|
220
220
|
// return a proper error response (503) instead of a 200 with an error event.
|
|
221
221
|
const languageModel = transport.languageModel;
|
|
222
|
-
// Determine inference mode from the resolved model object
|
|
223
|
-
// because resolveModel may internally fall back from cloud to local.
|
|
222
|
+
// Determine inference mode from the resolved model object, not the string.
|
|
224
223
|
const isLocal = isLocalModelRuntime(languageModel);
|
|
225
224
|
// Eagerly verify the model runtime is available. For local models this
|
|
226
225
|
// checks that @huggingface/transformers can be imported. Must happen
|
|
227
226
|
// BEFORE creating the ReadableStream so no_ai_available errors propagate
|
|
228
|
-
// to the route handler, which returns a 503
|
|
229
|
-
//
|
|
227
|
+
// to the route handler, which returns a 503 instead of swallowing it as an
|
|
228
|
+
// in-band SSE error in a 200 response.
|
|
230
229
|
await ensureModelReady(languageModel);
|
|
231
230
|
const agentContext = {
|
|
232
231
|
agentId: this.id,
|
|
@@ -250,17 +249,13 @@ export class AgentRuntime {
|
|
|
250
249
|
this.status = "streaming";
|
|
251
250
|
const messageId = generateMessageId();
|
|
252
251
|
sendSSE(controller, encoder, { type: "message-start", messageId });
|
|
253
|
-
// Report the effective model
|
|
254
|
-
//
|
|
255
|
-
// modelId so the client avatar matches the actual provider.
|
|
256
|
-
const effectiveModel = isLocal && !resolvedModelString.startsWith("local/")
|
|
257
|
-
? `local/${languageModel.modelId ?? "unknown"}`
|
|
258
|
-
: resolvedModelString;
|
|
252
|
+
// Report the effective model after resolution so the client can show
|
|
253
|
+
// whether inference is cloud or explicit server-local.
|
|
259
254
|
sendSSE(controller, encoder, {
|
|
260
255
|
type: "data",
|
|
261
256
|
data: {
|
|
262
257
|
inferenceMode: isLocal ? "server-local" : "cloud",
|
|
263
|
-
model:
|
|
258
|
+
model: resolvedModelString,
|
|
264
259
|
},
|
|
265
260
|
});
|
|
266
261
|
inFlight = chain.execute(agentContext, () => this.executeAgentLoopStreaming(systemPrompt, memoryMessages, controller, encoder, callbacks, textPartId, toolContext, context, resolvedModelString, languageModel, transport.headers, transport.providerOptions, maxOutputTokensOverride, streamAbortSignal, requestedModel));
|
|
@@ -765,6 +760,9 @@ export class AgentRuntime {
|
|
|
765
760
|
const persistedResult = currentStepToolResults.get(tc.id);
|
|
766
761
|
if (matchingResult) {
|
|
767
762
|
await persistToolResult(matchingResult);
|
|
763
|
+
if (tc.name === "create_agent") {
|
|
764
|
+
toolsDisabledForFinalResponse = true;
|
|
765
|
+
}
|
|
768
766
|
toolCall.status = matchingResult.error === undefined ? "completed" : "error";
|
|
769
767
|
toolCall.result = matchingResult.output;
|
|
770
768
|
toolCall.error = matchingResult.error === undefined
|
|
@@ -783,14 +781,14 @@ export class AgentRuntime {
|
|
|
783
781
|
hasSubmittedFormInputInLoop = true;
|
|
784
782
|
currentRuntimeContext = markSubmittedFormInputRuntimeContext(currentRuntimeContext);
|
|
785
783
|
}
|
|
786
|
-
if (tc.name === "create_agent") {
|
|
787
|
-
toolsDisabledForFinalResponse = true;
|
|
788
|
-
}
|
|
789
784
|
}
|
|
790
785
|
continue;
|
|
791
786
|
}
|
|
792
787
|
if (persistedResult) {
|
|
793
788
|
const persistedError = getToolResultError(persistedResult.result);
|
|
789
|
+
if (tc.name === "create_agent") {
|
|
790
|
+
toolsDisabledForFinalResponse = true;
|
|
791
|
+
}
|
|
794
792
|
toolCall.status = persistedError === undefined ? "completed" : "error";
|
|
795
793
|
toolCall.result = persistedResult.result;
|
|
796
794
|
toolCall.error = persistedError;
|
|
@@ -807,9 +805,6 @@ export class AgentRuntime {
|
|
|
807
805
|
hasSubmittedFormInputInLoop = true;
|
|
808
806
|
currentRuntimeContext = markSubmittedFormInputRuntimeContext(currentRuntimeContext);
|
|
809
807
|
}
|
|
810
|
-
if (tc.name === "create_agent") {
|
|
811
|
-
toolsDisabledForFinalResponse = true;
|
|
812
|
-
}
|
|
813
808
|
}
|
|
814
809
|
continue;
|
|
815
810
|
}
|
|
@@ -898,6 +893,9 @@ export class AgentRuntime {
|
|
|
898
893
|
catch (error) {
|
|
899
894
|
const errorStr = error instanceof Error ? error.message : String(error);
|
|
900
895
|
await this.recordToolError(toolCall, errorStr, controller, encoder, currentMessages, toolCalls);
|
|
896
|
+
if (tc.name === "create_agent") {
|
|
897
|
+
toolsDisabledForFinalResponse = true;
|
|
898
|
+
}
|
|
901
899
|
}
|
|
902
900
|
}
|
|
903
901
|
for (const toolResult of finalToolResults.values()) {
|
|
@@ -5,8 +5,8 @@ export declare function resolveConfiguredAgentModel(model?: string): string;
|
|
|
5
5
|
* Resolve the effective runtime model string for agent execution.
|
|
6
6
|
*
|
|
7
7
|
* Runtime-only rewrites happen here:
|
|
8
|
-
* - `auto`
|
|
9
|
-
*
|
|
8
|
+
* - `auto` uses Veryfront Cloud when bootstrap is available, otherwise a
|
|
9
|
+
* configured direct provider key when one exists
|
|
10
10
|
* - explicit hosted-provider models (`openai/*`, `anthropic/*`, `google/*`)
|
|
11
11
|
* transparently route through `veryfront-cloud/*` when the runtime has
|
|
12
12
|
* request-scoped Veryfront bootstrap but no direct provider API key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-resolution.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-resolution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-resolution.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-resolution.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAkDvC,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAWlE;AA+ED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAoC1D"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getAnthropicEnvConfig, getGoogleGenAIEnvConfig, getMistralEnvConfig, getOpenAIEnvConfig, } from "../../config/env.js";
|
|
2
|
-
import { findAvailableCloudModel } from "../../provider/index.js";
|
|
3
2
|
import { findVeryfrontCloudModelByModelId } from "../../provider/veryfront-cloud/model-catalog.js";
|
|
4
|
-
import {
|
|
5
|
-
import { isVeryfrontCloudEnabled } from "../../platform/cloud/resolver.js";
|
|
3
|
+
import { getDefaultVeryfrontCloudModel, isVeryfrontCloudEnabled, } from "../../platform/cloud/resolver.js";
|
|
6
4
|
export const AUTO_AGENT_MODEL = "auto";
|
|
7
5
|
const HOSTED_PROVIDER_NAMES = new Set([
|
|
8
6
|
"anthropic",
|
|
@@ -18,6 +16,12 @@ const DIRECT_CREDENTIAL_PROVIDER_ALIASES = {
|
|
|
18
16
|
const DIRECT_RUNTIME_PROVIDER_ALIASES = {
|
|
19
17
|
"google-ai-studio": "google",
|
|
20
18
|
};
|
|
19
|
+
const DIRECT_AUTO_MODEL_DEFAULTS = [
|
|
20
|
+
{ provider: "openai", modelId: "gpt-5.5" },
|
|
21
|
+
{ provider: "anthropic", modelId: "claude-sonnet-4-6" },
|
|
22
|
+
{ provider: "google-ai-studio", modelId: "gemini-3.5-flash" },
|
|
23
|
+
{ provider: "mistral", modelId: "mistral-large-2512" },
|
|
24
|
+
];
|
|
21
25
|
const LEGACY_MODEL_ALIASES = {
|
|
22
26
|
opus: "anthropic/claude-opus-4-8",
|
|
23
27
|
sonnet: "anthropic/claude-sonnet-4-6",
|
|
@@ -52,7 +56,7 @@ export function normalizeAgentModelConfig(model) {
|
|
|
52
56
|
export function resolveConfiguredAgentModel(model) {
|
|
53
57
|
const normalized = normalizeAgentModelConfig(model);
|
|
54
58
|
if (normalized === AUTO_AGENT_MODEL) {
|
|
55
|
-
return
|
|
59
|
+
return getDefaultVeryfrontCloudModel();
|
|
56
60
|
}
|
|
57
61
|
if (normalized.includes("/")) {
|
|
58
62
|
return normalized;
|
|
@@ -80,26 +84,69 @@ function isUnsupportedVeryfrontCloudMistralModel(modelId) {
|
|
|
80
84
|
return modelId.startsWith("veryfront-cloud/mistral/") &&
|
|
81
85
|
!findVeryfrontCloudModelByModelId(modelId);
|
|
82
86
|
}
|
|
87
|
+
function normalizeVeryfrontCloudRuntimeModel(modelId) {
|
|
88
|
+
if (isUnsupportedVeryfrontCloudMistralModel(modelId)) {
|
|
89
|
+
throw new Error(`Unsupported Mistral model "${modelId}"`);
|
|
90
|
+
}
|
|
91
|
+
return modelId;
|
|
92
|
+
}
|
|
93
|
+
function toDirectRuntimeModel(provider, modelId) {
|
|
94
|
+
const runtimeProvider = DIRECT_RUNTIME_PROVIDER_ALIASES[provider] ?? provider;
|
|
95
|
+
return `${runtimeProvider}/${modelId}`;
|
|
96
|
+
}
|
|
97
|
+
function resolveDirectRuntimeModelForDefault(modelId) {
|
|
98
|
+
const normalized = modelId.startsWith("veryfront-cloud/")
|
|
99
|
+
? modelId.slice("veryfront-cloud/".length)
|
|
100
|
+
: modelId;
|
|
101
|
+
const slashIndex = normalized.indexOf("/");
|
|
102
|
+
if (slashIndex === -1)
|
|
103
|
+
return undefined;
|
|
104
|
+
const provider = normalized.slice(0, slashIndex);
|
|
105
|
+
const providerModelId = normalized.slice(slashIndex + 1);
|
|
106
|
+
if (!provider || !providerModelId || !hasDirectProviderCredentials(provider)) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return toDirectRuntimeModel(provider, providerModelId);
|
|
110
|
+
}
|
|
111
|
+
function resolveDirectAutoRuntimeModel() {
|
|
112
|
+
const configuredDefault = resolveDirectRuntimeModelForDefault(getDefaultVeryfrontCloudModel());
|
|
113
|
+
if (configuredDefault) {
|
|
114
|
+
return configuredDefault;
|
|
115
|
+
}
|
|
116
|
+
for (const { provider, modelId } of DIRECT_AUTO_MODEL_DEFAULTS) {
|
|
117
|
+
if (hasDirectProviderCredentials(provider)) {
|
|
118
|
+
return toDirectRuntimeModel(provider, modelId);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
function resolveAutoRuntimeModel() {
|
|
124
|
+
const cloudModel = getDefaultVeryfrontCloudModel();
|
|
125
|
+
if (isVeryfrontCloudEnabled()) {
|
|
126
|
+
return normalizeVeryfrontCloudRuntimeModel(cloudModel);
|
|
127
|
+
}
|
|
128
|
+
return resolveDirectAutoRuntimeModel() ?? normalizeVeryfrontCloudRuntimeModel(cloudModel);
|
|
129
|
+
}
|
|
83
130
|
/**
|
|
84
131
|
* Resolve the effective runtime model string for agent execution.
|
|
85
132
|
*
|
|
86
133
|
* Runtime-only rewrites happen here:
|
|
87
|
-
* - `auto`
|
|
88
|
-
*
|
|
134
|
+
* - `auto` uses Veryfront Cloud when bootstrap is available, otherwise a
|
|
135
|
+
* configured direct provider key when one exists
|
|
89
136
|
* - explicit hosted-provider models (`openai/*`, `anthropic/*`, `google/*`)
|
|
90
137
|
* transparently route through `veryfront-cloud/*` when the runtime has
|
|
91
138
|
* request-scoped Veryfront bootstrap but no direct provider API key
|
|
92
139
|
*/
|
|
93
140
|
export function resolveRuntimeModel(model) {
|
|
141
|
+
if (normalizeAgentModelConfig(model) === AUTO_AGENT_MODEL) {
|
|
142
|
+
return resolveAutoRuntimeModel();
|
|
143
|
+
}
|
|
94
144
|
const configuredModel = resolveConfiguredAgentModel(model);
|
|
95
145
|
if (configuredModel.startsWith("veryfront-cloud/")) {
|
|
96
|
-
|
|
97
|
-
throw new Error(`Unsupported Mistral model "${configuredModel}"`);
|
|
98
|
-
}
|
|
99
|
-
return configuredModel;
|
|
146
|
+
return normalizeVeryfrontCloudRuntimeModel(configuredModel);
|
|
100
147
|
}
|
|
101
148
|
if (configuredModel.startsWith("local/")) {
|
|
102
|
-
return
|
|
149
|
+
return configuredModel;
|
|
103
150
|
}
|
|
104
151
|
const slashIndex = configuredModel.indexOf("/");
|
|
105
152
|
if (slashIndex === -1) {
|
|
@@ -114,8 +161,7 @@ export function resolveRuntimeModel(model) {
|
|
|
114
161
|
return configuredModel;
|
|
115
162
|
}
|
|
116
163
|
if (!isVeryfrontCloudEnabled() || hasDirectProviderCredentials(provider)) {
|
|
117
|
-
|
|
118
|
-
return `${runtimeProvider}/${modelId}`;
|
|
164
|
+
return toDirectRuntimeModel(provider, modelId);
|
|
119
165
|
}
|
|
120
166
|
return `veryfront-cloud/${provider}/${modelId}`;
|
|
121
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-continuation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-result-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result-continuation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-result-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAmBzF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWtE;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,gBAAgB,UAAQ,GACvB,OAAO,CAeT;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAcT;AAED,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,EAAE,CAiB/F;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GAC1C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AAC,EAAE,MAAM,CAAC;CACrB,CAOA;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,GAClD,OAAO,CAET;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,GAAG,WAAW,CAAC,GAChE,OAAO,CAMT;AAED,MAAM,MAAM,+BAA+B,GACvC;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACzD;IACA,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACC;IACA,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEJ,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,iBAAiB,GACpB,+BAA+B,CAoCjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,cAAc,CAE1E"}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { stripLeadingEmptyObjectPlaceholder } from "../streaming/data-stream.js";
|
|
2
2
|
import { parseToolArgs } from "./tool-helpers.js";
|
|
3
3
|
import { stringifyToolError } from "./error-utils.js";
|
|
4
|
+
function getMcpToolErrorMessage(result) {
|
|
5
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const record = result;
|
|
9
|
+
if (typeof record.error !== "string" || record.error.length === 0) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (typeof record.message === "string" && record.message.trim().length > 0) {
|
|
13
|
+
return record.message;
|
|
14
|
+
}
|
|
15
|
+
return record.error;
|
|
16
|
+
}
|
|
4
17
|
export function getToolResultError(result) {
|
|
5
18
|
if (!result || typeof result !== "object" || !("error" in result)) {
|
|
6
19
|
return undefined;
|
|
7
20
|
}
|
|
21
|
+
const mcpToolErrorMessage = getMcpToolErrorMessage(result);
|
|
22
|
+
if (mcpToolErrorMessage !== undefined) {
|
|
23
|
+
return mcpToolErrorMessage;
|
|
24
|
+
}
|
|
8
25
|
return stringifyToolError(result.error);
|
|
9
26
|
}
|
|
10
27
|
export function createToolResultMessage(toolCallId, toolName, result, providerExecuted = false) {
|
package/esm/src/agent/types.d.ts
CHANGED
|
@@ -90,8 +90,8 @@ export interface AgentConfig {
|
|
|
90
90
|
* Optional model string in "provider/model" format.
|
|
91
91
|
*
|
|
92
92
|
* When omitted or set to `"auto"`, Veryfront chooses the runtime default:
|
|
93
|
-
*
|
|
94
|
-
* provider when
|
|
93
|
+
* Veryfront Cloud when bootstrap credentials are present, otherwise a
|
|
94
|
+
* configured direct provider key when one exists.
|
|
95
95
|
*/
|
|
96
96
|
model?: ModelString;
|
|
97
97
|
system: string | (() => string) | (() => Promise<string>);
|
package/esm/src/chat/index.d.ts
CHANGED
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
export { Chat, ChatComponents, type ChatProps } from "../react/components/chat/chat.js";
|
|
51
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";
|
|
52
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";
|
|
53
|
-
export { type AttachmentInfo, AttachmentPill, type AttachmentPillProps, BranchPicker, type BranchPickerProps, ChatSidebar, type ChatSidebarProps, type ChatTab, ChatWithSidebar, type ChatWithSidebarAttachmentConfig, type ChatWithSidebarChatController, type ChatWithSidebarFeatureConfig, type ChatWithSidebarGroupedProps, type ChatWithSidebarMessageConfig, type ChatWithSidebarModelConfig, type ChatWithSidebarProps, type ChatWithSidebarQuickActionsConfig, type ChatWithSidebarSidebarConfig, type ChatWithSidebarTabsConfig, type ChatWithSidebarVoiceConfig, type CodeBlockProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationScrollButton, type ConversationScrollButtonProps, downloadMarkdown, DropZoneOverlay, type DropZoneOverlayProps, exportAsMarkdown, extractSourcesFromParts, FadeIn, type FeedbackValue, getTextContent, groupPartsInOrder, InferenceBadge, type InferenceBadgeProps, InlineCitation, type InlineCitationProps, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActions, type MessageActionsProps, MessageEditForm, type MessageEditFormProps, MessageFeedback, type MessageFeedbackProps, type ModelOption, ModelSelector, type ModelSelectorProps, type PartGroup, type QuickAction, QuickActions, type QuickActionsProps, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, type SkillBadgeProps, type Source, Sources, type SourcesProps, StepIndicator, type StepIndicatorProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, TabSwitcher, type TabSwitcherProps, type Thread, ToolCallCard, ToolStatusBadge,
|
|
53
|
+
export { type AttachmentInfo, AttachmentPill, type AttachmentPillProps, BranchPicker, type BranchPickerProps, ChatSidebar, type ChatSidebarProps, type ChatTab, ChatWithSidebar, type ChatWithSidebarAttachmentConfig, type ChatWithSidebarChatController, type ChatWithSidebarFeatureConfig, type ChatWithSidebarGroupedProps, type ChatWithSidebarMessageConfig, type ChatWithSidebarModelConfig, type ChatWithSidebarProps, type ChatWithSidebarQuickActionsConfig, type ChatWithSidebarSidebarConfig, type ChatWithSidebarTabsConfig, type ChatWithSidebarVoiceConfig, type CodeBlockProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationScrollButton, type ConversationScrollButtonProps, downloadMarkdown, DropZoneOverlay, type DropZoneOverlayProps, exportAsMarkdown, extractSourcesFromParts, FadeIn, type FeedbackValue, getTextContent, groupPartsInOrder, InferenceBadge, type InferenceBadgeProps, InlineCitation, type InlineCitationProps, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActions, type MessageActionsProps, MessageEditForm, type MessageEditFormProps, MessageFeedback, type MessageFeedbackProps, type ModelOption, ModelSelector, type ModelSelectorProps, type PartGroup, type QuickAction, QuickActions, type QuickActionsProps, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, type SkillBadgeProps, type Source, Sources, type SourcesProps, StepIndicator, type StepIndicatorProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, TabSwitcher, type TabSwitcherProps, type Thread, ToolCallCard, ToolStatusBadge, type UploadedFile, UploadsPanel, type UploadsPanelProps, useThreads, type UseThreadsOptions, type UseThreadsResult, } from "../react/components/chat/chat.js";
|
|
54
54
|
export { Message as StandaloneMessage, type MessageProps, StreamingMessage, type StreamingMessageProps, } from "../react/components/chat/message.js";
|
|
55
55
|
export { AgentCard, type AgentCardProps } from "../react/components/chat/agent-card.js";
|
|
56
56
|
export { ChatErrorBoundary, type ChatErrorBoundaryProps, useChatErrorHandler, } from "../react/components/chat/error-boundary.js";
|
|
57
57
|
export type { AgentTheme, ChatTheme } from "../react/components/chat/theme.js";
|
|
58
|
-
export { type BranchInfo, type
|
|
58
|
+
export { type BranchInfo, type ChatDynamicToolPart, type ChatFinishReason, type ChatMessage, type ChatMessagePart, type ChatReasoningPart, type ChatStepPart, type ChatStreamEvent, type ChatTextPart, type ChatToolPart, type ChatToolResultPart, type ChatToolState, type InferenceMode, type OnToolCallArg, type ToolOutput, useChat, type UseChatOptions, type UseChatResult, } from "../agent/react/use-chat/index.js";
|
|
59
59
|
export type { ChatMessageMetadata, ChatMessageMetadataUsage, ChatUiMessageChunk, ChildRunAudit, ChildRunAuditToolCall, ChildRunAuditToolResult, } from "./protocol.js";
|
|
60
60
|
export { useAgent, type UseAgentOptions, type UseAgentResult, } from "../agent/react/use-agent.js";
|
|
61
61
|
export { buildChatStreamChunkMessageMetadata, type BuildChatStreamChunkMessageMetadataInput, dedupeChatUiMessageChunks, extractChatMessageMetadata, normalizeChatMessageMetadata, normalizeChatUiMessageChunk, normalizeChatUiMessageStream, } from "./chat-ui-message-helpers.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,SAAS,EACT,KAAK,cAAc,EACnB,MAAM,EACN,KAAK,WAAW,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,QAAQ,EACR,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,gBAAgB,EACrB,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,sBAAsB,EAC3B,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,mBAAmB,EACxB,YAAY,EACZ,KAAK,iBAAiB,EACtB,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,eAAe,EACf,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EACnB,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,wBAAwB,EACxB,KAAK,6BAA6B,EAClC,gBAAgB,EAChB,eAAe,EACf,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,KAAK,aAAa,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,KAAK,mBAAmB,EACxB,cAAc,EACd,KAAK,mBAAmB,EACxB,eAAe,EACf,eAAe,EACf,UAAU,EACV,MAAM,EACN,cAAc,EACd,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,EACzB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,iBAAiB,EACtB,aAAa,EACb,aAAa,EACb,OAAO,EACP,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,OAAO,EACP,KAAK,YAAY,EACjB,aAAa,EACb,KAAK,kBAAkB,EACvB,UAAU,EACV,KAAK,eAAe,EACpB,WAAW,EACX,KAAK,gBAAgB,EACrB,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,YAAY,EACZ,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/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A4B,EAC5B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
|
package/esm/src/chat/index.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
export { Chat, ChatComponents } from "../react/components/chat/chat.js";
|
|
51
51
|
export { ChatComposer, ChatEmpty, ChatIf, ChatMessageList, ChatRoot, ErrorBanner, Message, ModelAvatar, } from "../react/components/chat/chat.js";
|
|
52
52
|
export { ChatContextProvider, ComposerContextProvider, MessageContextProvider, ThreadListContextProvider, useChatContext, useChatContextOptional, useComposerContext, useComposerContextOptional, useMessageContext, useMessageContextOptional, useThreadListContext, useThreadListContextOptional, } from "../react/components/chat/chat.js";
|
|
53
|
-
export { AttachmentPill, BranchPicker, ChatSidebar, ChatWithSidebar, ConversationEmptyState, ConversationScrollButton, downloadMarkdown, DropZoneOverlay, exportAsMarkdown, extractSourcesFromParts, FadeIn, getTextContent, groupPartsInOrder, InferenceBadge, InlineCitation, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActions, MessageEditForm, MessageFeedback, ModelSelector, QuickActions, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, Sources, StepIndicator, Suggestion, Suggestions, TabSwitcher, ToolCallCard, ToolStatusBadge,
|
|
53
|
+
export { AttachmentPill, BranchPicker, ChatSidebar, ChatWithSidebar, ConversationEmptyState, ConversationScrollButton, downloadMarkdown, DropZoneOverlay, exportAsMarkdown, extractSourcesFromParts, FadeIn, getTextContent, groupPartsInOrder, InferenceBadge, InlineCitation, isReasoningPart, isSkillToolPart, isToolPart, Loader, MessageActions, MessageEditForm, MessageFeedback, ModelSelector, QuickActions, ReasoningCard, RichCodeBlock, Shimmer, SkillBadge, Sources, StepIndicator, Suggestion, Suggestions, TabSwitcher, ToolCallCard, ToolStatusBadge, UploadsPanel, useThreads, } from "../react/components/chat/chat.js";
|
|
54
54
|
export { Message as StandaloneMessage, StreamingMessage, } from "../react/components/chat/message.js";
|
|
55
55
|
export { AgentCard } from "../react/components/chat/agent-card.js";
|
|
56
56
|
export { ChatErrorBoundary, useChatErrorHandler, } from "../react/components/chat/error-boundary.js";
|
|
@@ -31,12 +31,13 @@ export interface UploadHandlerConfig {
|
|
|
31
31
|
* ```ts
|
|
32
32
|
* // app/api/uploads/route.ts
|
|
33
33
|
* import { createUploadHandler } from "veryfront/embedding";
|
|
34
|
+
* import { getEnv } from "veryfront";
|
|
34
35
|
* import { store } from "lib/store.ts";
|
|
35
36
|
*
|
|
36
37
|
* export const { POST, GET } = createUploadHandler(store, {
|
|
37
38
|
* auth: {
|
|
38
39
|
* authorize: (request) => {
|
|
39
|
-
* const token =
|
|
40
|
+
* const token = getEnv("UPLOAD_TOKEN");
|
|
40
41
|
* return token !== undefined &&
|
|
41
42
|
* request.headers.get("authorization") === `Bearer ${token}`;
|
|
42
43
|
* },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-handler.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/upload-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqF3C,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9E,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,OAAO,KACb,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAEpE,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,IAAI,CAAA;CAAE,GAC5C;IAAE,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC;AA6FD
|
|
1
|
+
{"version":3,"file":"upload-handler.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/upload-handler.ts"],"names":[],"mappings":"AAGA,OAAO,K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