veryfront 0.1.198 → 0.1.199
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/react/use-voice-input.js +3 -4
- 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/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,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;
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AA8pDD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAkDd;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,MAAM,GACd,YAAY,CA4Dd;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAkDd;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CA0ClB;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CAgDlB"}
|
|
@@ -258,6 +258,20 @@ function toSnakeCaseRecord(record) {
|
|
|
258
258
|
value,
|
|
259
259
|
]));
|
|
260
260
|
}
|
|
261
|
+
function pushAnthropicUserContent(messages, content) {
|
|
262
|
+
if (content.length === 0) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const lastMessage = messages.at(-1);
|
|
266
|
+
if (lastMessage?.role === "user") {
|
|
267
|
+
lastMessage.content.push(...content);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
messages.push({
|
|
271
|
+
role: "user",
|
|
272
|
+
content,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
261
275
|
function toAnthropicMessages(prompt) {
|
|
262
276
|
const systemParts = [];
|
|
263
277
|
const messages = [];
|
|
@@ -269,10 +283,10 @@ function toAnthropicMessages(prompt) {
|
|
|
269
283
|
}
|
|
270
284
|
break;
|
|
271
285
|
case "user":
|
|
272
|
-
messages
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
pushAnthropicUserContent(messages, [{
|
|
287
|
+
type: "text",
|
|
288
|
+
text: readTextParts(message.content),
|
|
289
|
+
}]);
|
|
276
290
|
break;
|
|
277
291
|
case "assistant":
|
|
278
292
|
messages.push({
|
|
@@ -286,14 +300,11 @@ function toAnthropicMessages(prompt) {
|
|
|
286
300
|
});
|
|
287
301
|
break;
|
|
288
302
|
case "tool":
|
|
289
|
-
messages.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
content: stringifyJsonValue(part.output.value),
|
|
295
|
-
})),
|
|
296
|
-
});
|
|
303
|
+
pushAnthropicUserContent(messages, message.content.map((part) => ({
|
|
304
|
+
type: "tool_result",
|
|
305
|
+
tool_use_id: part.toolCallId,
|
|
306
|
+
content: stringifyJsonValue(part.output.value),
|
|
307
|
+
})));
|
|
297
308
|
break;
|
|
298
309
|
}
|
|
299
310
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { cn } from "../../theme.js";
|
|
4
3
|
import { CheckIcon, CopyIcon } from "../../icons/index.js";
|
|
@@ -18,7 +17,7 @@ export const RichCodeBlock = React.forwardRef(function RichCodeBlock({ language,
|
|
|
18
17
|
document.body.removeChild(textarea);
|
|
19
18
|
}
|
|
20
19
|
setCopied(true);
|
|
21
|
-
|
|
20
|
+
globalThis.setTimeout(() => setCopied(false), 2000);
|
|
22
21
|
}, [code]);
|
|
23
22
|
if (inline) {
|
|
24
23
|
return (React.createElement("code", { className: cn("bg-[var(--accent)] px-1.5 py-0.5 rounded text-sm font-mono", className) }, code));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { cn } from "../../theme.js";
|
|
4
3
|
export function InlineCitation({ index, source, className, onClick, }) {
|
|
@@ -8,7 +7,7 @@ export function InlineCitation({ index, source, className, onClick, }) {
|
|
|
8
7
|
const [cardStyle, setCardStyle] = React.useState({});
|
|
9
8
|
const show = React.useCallback(() => {
|
|
10
9
|
clearTimeout(timerRef.current);
|
|
11
|
-
timerRef.current =
|
|
10
|
+
timerRef.current = globalThis.setTimeout(() => {
|
|
12
11
|
// Position the card using fixed positioning to prevent overflow clipping
|
|
13
12
|
const el = buttonRef.current;
|
|
14
13
|
if (el) {
|
|
@@ -25,7 +24,7 @@ export function InlineCitation({ index, source, className, onClick, }) {
|
|
|
25
24
|
}, []);
|
|
26
25
|
const hide = React.useCallback(() => {
|
|
27
26
|
clearTimeout(timerRef.current);
|
|
28
|
-
timerRef.current =
|
|
27
|
+
timerRef.current = globalThis.setTimeout(() => setShowCard(false), 100);
|
|
29
28
|
}, []);
|
|
30
29
|
React.useEffect(() => () => clearTimeout(timerRef.current), []);
|
|
31
30
|
return (React.createElement(React.Fragment, null,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { cn } from "../../theme.js";
|
|
4
3
|
import { CheckIcon, CopyIcon } from "../../icons/index.js";
|
|
@@ -7,7 +6,7 @@ export const MessageActions = React.forwardRef(function MessageActions({ content
|
|
|
7
6
|
const [copied, setCopied] = React.useState(false);
|
|
8
7
|
const setCopiedWithTimeout = React.useCallback(() => {
|
|
9
8
|
setCopied(true);
|
|
10
|
-
|
|
9
|
+
globalThis.setTimeout(() => setCopied(false), 2000);
|
|
11
10
|
}, []);
|
|
12
11
|
const fallbackCopy = React.useCallback(() => {
|
|
13
12
|
const textarea = document.createElement("textarea");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { cn } from "../../theme.js";
|
|
4
3
|
import { Markdown } from "../../markdown.js";
|
|
@@ -10,7 +9,7 @@ export const ReasoningCard = React.forwardRef(function ReasoningCard({ text, isS
|
|
|
10
9
|
React.useEffect(() => {
|
|
11
10
|
if (isStreaming || !isOpen || userToggledRef.current)
|
|
12
11
|
return;
|
|
13
|
-
const timer =
|
|
12
|
+
const timer = globalThis.setTimeout(() => setIsOpen(false), 1000);
|
|
14
13
|
return () => clearTimeout(timer);
|
|
15
14
|
}, [isStreaming, isOpen]);
|
|
16
15
|
const label = isStreaming ? React.createElement(Shimmer, null, "Thinking...") : React.createElement("span", null, "Thought process");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { isBrowserEnvironment } from "../../../../../platform/compat/runtime.js";
|
|
4
3
|
function generateId() {
|
|
@@ -85,7 +84,7 @@ export function useThreads(options) {
|
|
|
85
84
|
React.useEffect(() => () => clearTimeout(saveTimerRef.current), []);
|
|
86
85
|
const persistThreads = React.useCallback((updated) => {
|
|
87
86
|
clearTimeout(saveTimerRef.current);
|
|
88
|
-
saveTimerRef.current =
|
|
87
|
+
saveTimerRef.current = globalThis.setTimeout(() => {
|
|
89
88
|
saveIndex(storageKey, { ids: updated.map((t) => t.id) });
|
|
90
89
|
for (const thread of updated) {
|
|
91
90
|
saveThread(storageKey, thread);
|
|
@@ -3,12 +3,12 @@ import { cn } from "./theme.js";
|
|
|
3
3
|
import { isBrowserEnvironment } from "../../../platform/compat/runtime.js";
|
|
4
4
|
import { validateTrustedHtml } from "../../../security/client/html-sanitizer.js";
|
|
5
5
|
import { RichCodeBlock } from "./chat/components/code-block.js";
|
|
6
|
-
const ESM_REACT_MARKDOWN = "https://esm.sh/react-markdown@9.0.3?
|
|
6
|
+
const ESM_REACT_MARKDOWN = "https://esm.sh/react-markdown@9.0.3?target=es2022&pin=v135&deps=react@19.2.4";
|
|
7
7
|
const ESM_REMARK_GFM = "https://esm.sh/remark-gfm@4.0.1?target=es2022&pin=v135";
|
|
8
8
|
const ESM_REHYPE_HIGHLIGHT = "https://esm.sh/rehype-highlight@7.0.2?target=es2022&pin=v135";
|
|
9
9
|
const ESM_MERMAID = "https://esm.sh/mermaid@11.4.1?pin=v135";
|
|
10
10
|
async function importFromUrl(url) {
|
|
11
|
-
return await import(url);
|
|
11
|
+
return await import(/* @vite-ignore */ url);
|
|
12
12
|
}
|
|
13
13
|
// deno-lint-ignore no-explicit-any
|
|
14
14
|
let ReactMarkdown = null;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* import { PageContextProvider, usePageContext } from "veryfront/context";
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
import "../../../_dnt.polyfills.js";
|
|
11
10
|
export { PageContextProvider, usePageContext } from "../runtime/core.js";
|
|
12
11
|
export type { MdxHeading, PageContextProviderProps, PageContextValue } from "../runtime/core.js";
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* import { Link, RouterProvider, useRouter } from "veryfront/router";
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
import "../../../_dnt.polyfills.js";
|
|
11
10
|
export { Link, Router, RouterProvider, useRouter } from "../runtime/core.js";
|
|
12
11
|
export type { LinkProps, RouterProviderProps, RouterValue } from "../runtime/core.js";
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* - Error messages and debug info are untrusted and must be escaped
|
|
7
7
|
* - validateTrustedHtml() provides defense-in-depth for server HTML
|
|
8
8
|
*/
|
|
9
|
-
import * as dntShim from "../../../_dnt.shims.js";
|
|
10
9
|
import { escapeHtml } from "../../html/html-escape.js";
|
|
11
10
|
import { SECURITY_VIOLATION } from "../../errors/error-registry.js";
|
|
12
11
|
export { escapeHtml };
|
|
@@ -21,7 +20,7 @@ const SUSPICIOUS_PATTERNS = [
|
|
|
21
20
|
{ pattern: /data:\s*text\/html/gi, name: "data: HTML URL" },
|
|
22
21
|
];
|
|
23
22
|
function isDevMode() {
|
|
24
|
-
const g =
|
|
23
|
+
const g = globalThis;
|
|
25
24
|
return g.__VERYFRONT_DEV__ === true || g.Deno?.env?.get?.("VERYFRONT_ENV") === "development";
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAmxKjD,CAAC"}
|
|
@@ -528,6 +528,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
528
528
|
"@internal",
|
|
529
529
|
"@media(prefers-color-scheme:dark){[data-vf-chat]:not([data-vf-theme]){${dark}}}",
|
|
530
530
|
"@module",
|
|
531
|
+
"@vite-ignore",
|
|
531
532
|
"A",
|
|
532
533
|
"ACTION_BUTTON",
|
|
533
534
|
"AI",
|
|
@@ -2601,6 +2602,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
2601
2602
|
"deno-lint-ignore",
|
|
2602
2603
|
"dependency)",
|
|
2603
2604
|
"deprecated,",
|
|
2605
|
+
"deps=react@19.2.4",
|
|
2604
2606
|
"desc",
|
|
2605
2607
|
"descendant",
|
|
2606
2608
|
"describe(",
|
|
@@ -3142,7 +3144,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
3142
3144
|
"html><html><head><style",
|
|
3143
3145
|
"https://ai-sdk.dev/elements)",
|
|
3144
3146
|
"https://esm.sh/mermaid@11.4.1?pin=v135",
|
|
3145
|
-
"https://esm.sh/react-markdown@9.0.3?
|
|
3147
|
+
"https://esm.sh/react-markdown@9.0.3?target=es2022",
|
|
3146
3148
|
"https://esm.sh/rehype-highlight@7.0.2?target=es2022",
|
|
3147
3149
|
"https://esm.sh/remark-gfm@4.0.1?target=es2022",
|
|
3148
3150
|
"https://example.com/",
|
|
@@ -3189,7 +3191,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
3189
3191
|
"if",
|
|
3190
3192
|
"ignores",
|
|
3191
3193
|
"import",
|
|
3192
|
-
"import(
|
|
3194
|
+
"import(/*",
|
|
3193
3195
|
"importFromUrl<DefaultModule<unknown>>(ESM_REACT_MARKDOWN),",
|
|
3194
3196
|
"importFromUrl<DefaultModule<unknown>>(ESM_REHYPE_HIGHLIGHT),",
|
|
3195
3197
|
"importFromUrl<DefaultModule<unknown>>(ESM_REMARK_GFM),",
|
|
@@ -4882,7 +4884,6 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
4882
4884
|
"take",
|
|
4883
4885
|
"target",
|
|
4884
4886
|
"target=",
|
|
4885
|
-
"target=es2022",
|
|
4886
4887
|
"tbody>",
|
|
4887
4888
|
"tc1",
|
|
4888
4889
|
"td",
|
|
@@ -5205,6 +5206,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
5205
5206
|
"upward",
|
|
5206
5207
|
"url",
|
|
5207
5208
|
"url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600",
|
|
5209
|
+
"url)",
|
|
5208
5210
|
"url:",
|
|
5209
5211
|
"url;",
|
|
5210
5212
|
"url?:",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.199";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -538,6 +538,26 @@ function toSnakeCaseRecord(record: Record<string, unknown>): Record<string, unkn
|
|
|
538
538
|
);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
+
function pushAnthropicUserContent(
|
|
542
|
+
messages: AnthropicCompatibleMessage[],
|
|
543
|
+
content: Array<Record<string, unknown>>,
|
|
544
|
+
): void {
|
|
545
|
+
if (content.length === 0) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const lastMessage = messages.at(-1);
|
|
550
|
+
if (lastMessage?.role === "user") {
|
|
551
|
+
lastMessage.content.push(...content);
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
messages.push({
|
|
556
|
+
role: "user",
|
|
557
|
+
content,
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
|
|
541
561
|
function toAnthropicMessages(
|
|
542
562
|
prompt: RuntimePromptMessage[],
|
|
543
563
|
): { system?: string; messages: AnthropicCompatibleMessage[] } {
|
|
@@ -552,10 +572,10 @@ function toAnthropicMessages(
|
|
|
552
572
|
}
|
|
553
573
|
break;
|
|
554
574
|
case "user":
|
|
555
|
-
messages
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
});
|
|
575
|
+
pushAnthropicUserContent(messages, [{
|
|
576
|
+
type: "text",
|
|
577
|
+
text: readTextParts(message.content),
|
|
578
|
+
}]);
|
|
559
579
|
break;
|
|
560
580
|
case "assistant":
|
|
561
581
|
messages.push({
|
|
@@ -571,14 +591,14 @@ function toAnthropicMessages(
|
|
|
571
591
|
});
|
|
572
592
|
break;
|
|
573
593
|
case "tool":
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
594
|
+
pushAnthropicUserContent(
|
|
595
|
+
messages,
|
|
596
|
+
message.content.map((part) => ({
|
|
577
597
|
type: "tool_result",
|
|
578
598
|
tool_use_id: part.toolCallId,
|
|
579
599
|
content: stringifyJsonValue(part.output.value),
|
|
580
600
|
})),
|
|
581
|
-
|
|
601
|
+
);
|
|
582
602
|
break;
|
|
583
603
|
}
|
|
584
604
|
}
|
|
@@ -22,7 +22,7 @@ export interface CodeBlockProps {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const ESM_REACT_MARKDOWN =
|
|
25
|
-
"https://esm.sh/react-markdown@9.0.3?
|
|
25
|
+
"https://esm.sh/react-markdown@9.0.3?target=es2022&pin=v135&deps=react@19.2.4";
|
|
26
26
|
const ESM_REMARK_GFM = "https://esm.sh/remark-gfm@4.0.1?target=es2022&pin=v135";
|
|
27
27
|
const ESM_REHYPE_HIGHLIGHT = "https://esm.sh/rehype-highlight@7.0.2?target=es2022&pin=v135";
|
|
28
28
|
const ESM_MERMAID = "https://esm.sh/mermaid@11.4.1?pin=v135";
|
|
@@ -41,7 +41,7 @@ type MermaidModule = {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
async function importFromUrl<T>(url: string): Promise<T> {
|
|
44
|
-
return await import(url) as T;
|
|
44
|
+
return await import(/* @vite-ignore */ url) as T;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// deno-lint-ignore no-explicit-any
|
|
@@ -529,6 +529,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
529
529
|
"@internal",
|
|
530
530
|
"@media(prefers-color-scheme:dark){[data-vf-chat]:not([data-vf-theme]){${dark}}}",
|
|
531
531
|
"@module",
|
|
532
|
+
"@vite-ignore",
|
|
532
533
|
"A",
|
|
533
534
|
"ACTION_BUTTON",
|
|
534
535
|
"AI",
|
|
@@ -2602,6 +2603,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
2602
2603
|
"deno-lint-ignore",
|
|
2603
2604
|
"dependency)",
|
|
2604
2605
|
"deprecated,",
|
|
2606
|
+
"deps=react@19.2.4",
|
|
2605
2607
|
"desc",
|
|
2606
2608
|
"descendant",
|
|
2607
2609
|
"describe(",
|
|
@@ -3143,7 +3145,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
3143
3145
|
"html><html><head><style",
|
|
3144
3146
|
"https://ai-sdk.dev/elements)",
|
|
3145
3147
|
"https://esm.sh/mermaid@11.4.1?pin=v135",
|
|
3146
|
-
"https://esm.sh/react-markdown@9.0.3?
|
|
3148
|
+
"https://esm.sh/react-markdown@9.0.3?target=es2022",
|
|
3147
3149
|
"https://esm.sh/rehype-highlight@7.0.2?target=es2022",
|
|
3148
3150
|
"https://esm.sh/remark-gfm@4.0.1?target=es2022",
|
|
3149
3151
|
"https://example.com/",
|
|
@@ -3190,7 +3192,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
3190
3192
|
"if",
|
|
3191
3193
|
"ignores",
|
|
3192
3194
|
"import",
|
|
3193
|
-
"import(
|
|
3195
|
+
"import(/*",
|
|
3194
3196
|
"importFromUrl<DefaultModule<unknown>>(ESM_REACT_MARKDOWN),",
|
|
3195
3197
|
"importFromUrl<DefaultModule<unknown>>(ESM_REHYPE_HIGHLIGHT),",
|
|
3196
3198
|
"importFromUrl<DefaultModule<unknown>>(ESM_REMARK_GFM),",
|
|
@@ -4883,7 +4885,6 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
4883
4885
|
"take",
|
|
4884
4886
|
"target",
|
|
4885
4887
|
"target=",
|
|
4886
|
-
"target=es2022",
|
|
4887
4888
|
"tbody>",
|
|
4888
4889
|
"tc1",
|
|
4889
4890
|
"td",
|
|
@@ -5206,6 +5207,7 @@ export const FRAMEWORK_CANDIDATES: readonly string[] = [
|
|
|
5206
5207
|
"upward",
|
|
5207
5208
|
"url",
|
|
5208
5209
|
"url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600",
|
|
5210
|
+
"url)",
|
|
5209
5211
|
"url:",
|
|
5210
5212
|
"url;",
|
|
5211
5213
|
"url?:",
|