veryfront 0.1.868 → 0.1.869

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.
Files changed (104) hide show
  1. package/esm/cli/commands/demo/steps.js +1 -1
  2. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  3. package/esm/cli/commands/dev/command.js +6 -1
  4. package/esm/cli/commands/start/command.d.ts +12 -0
  5. package/esm/cli/commands/start/command.d.ts.map +1 -1
  6. package/esm/cli/commands/start/command.js +32 -6
  7. package/esm/cli/shared/runtime-auth.d.ts +12 -0
  8. package/esm/cli/shared/runtime-auth.d.ts.map +1 -0
  9. package/esm/cli/shared/runtime-auth.js +34 -0
  10. package/esm/deno.js +1 -1
  11. package/esm/src/agent/ag-ui/handler.d.ts.map +1 -1
  12. package/esm/src/agent/ag-ui/handler.js +17 -5
  13. package/esm/src/agent/react/index.d.ts +1 -1
  14. package/esm/src/agent/react/index.d.ts.map +1 -1
  15. package/esm/src/agent/react/use-chat/index.d.ts +1 -1
  16. package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
  17. package/esm/src/agent/react/use-chat/types.d.ts +2 -10
  18. package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
  19. package/esm/src/agent/react/use-chat/use-chat.d.ts +3 -4
  20. package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
  21. package/esm/src/agent/react/use-chat/use-chat.js +16 -107
  22. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  23. package/esm/src/agent/runtime/index.js +6 -11
  24. package/esm/src/agent/runtime/model-resolution.d.ts +2 -2
  25. package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
  26. package/esm/src/agent/runtime/model-resolution.js +59 -13
  27. package/esm/src/agent/types.d.ts +2 -2
  28. package/esm/src/chat/index.d.ts +2 -2
  29. package/esm/src/chat/index.d.ts.map +1 -1
  30. package/esm/src/chat/index.js +1 -1
  31. package/esm/src/embedding/upload-handler.d.ts +2 -1
  32. package/esm/src/embedding/upload-handler.d.ts.map +1 -1
  33. package/esm/src/embedding/upload-handler.js +2 -1
  34. package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
  35. package/esm/src/html/styles-builder/plugin-loader.js +2 -12
  36. package/esm/src/integrations/feature-flags.d.ts.map +1 -1
  37. package/esm/src/integrations/feature-flags.js +2 -10
  38. package/esm/src/platform/compat/dns.d.ts +6 -0
  39. package/esm/src/platform/compat/dns.d.ts.map +1 -0
  40. package/esm/src/platform/compat/dns.js +34 -0
  41. package/esm/src/platform/compat/opaque-dependency-versions.d.ts +1 -1
  42. package/esm/src/platform/compat/opaque-dependency-versions.js +1 -1
  43. package/esm/src/platform/index.d.ts +1 -0
  44. package/esm/src/platform/index.d.ts.map +1 -1
  45. package/esm/src/platform/index.js +2 -0
  46. package/esm/src/provider/index.d.ts +1 -1
  47. package/esm/src/provider/index.d.ts.map +1 -1
  48. package/esm/src/provider/index.js +1 -1
  49. package/esm/src/provider/local/env.d.ts +3 -0
  50. package/esm/src/provider/local/env.d.ts.map +1 -1
  51. package/esm/src/provider/local/env.js +31 -0
  52. package/esm/src/provider/local/local-engine.d.ts +38 -5
  53. package/esm/src/provider/local/local-engine.d.ts.map +1 -1
  54. package/esm/src/provider/local/local-engine.js +191 -19
  55. package/esm/src/provider/local/model-catalog.d.ts +8 -4
  56. package/esm/src/provider/local/model-catalog.d.ts.map +1 -1
  57. package/esm/src/provider/local/model-catalog.js +36 -41
  58. package/esm/src/provider/local/model-runtime-adapter.js +5 -5
  59. package/esm/src/provider/model-registry.d.ts +2 -12
  60. package/esm/src/provider/model-registry.d.ts.map +1 -1
  61. package/esm/src/provider/model-registry.js +4 -92
  62. package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +2 -3
  63. package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -1
  64. package/esm/src/react/components/chat/chat/components/inference-badge.js +3 -31
  65. package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +1 -2
  66. package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
  67. package/esm/src/react/components/chat/chat/composition/chat-message-list.js +5 -11
  68. package/esm/src/react/components/chat/chat/index.d.ts +2 -4
  69. package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
  70. package/esm/src/react/components/chat/chat/index.js +4 -6
  71. package/esm/src/react/components/chat/chat-with-sidebar.d.ts +0 -1
  72. package/esm/src/react/components/chat/chat-with-sidebar.d.ts.map +1 -1
  73. package/esm/src/react/components/chat/chat-with-sidebar.js +0 -1
  74. package/esm/src/react/components/chat/chat.d.ts +1 -1
  75. package/esm/src/react/components/chat/chat.d.ts.map +1 -1
  76. package/esm/src/react/components/chat/chat.js +1 -1
  77. package/esm/src/security/sandbox/worker-egress-guard.d.ts +1 -1
  78. package/esm/src/security/sandbox/worker-egress-guard.d.ts.map +1 -1
  79. package/esm/src/security/sandbox/worker-egress-guard.js +4 -17
  80. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  81. package/esm/src/server/handlers/dev/framework-candidates.generated.js +3 -54
  82. package/esm/src/utils/version-constant.d.ts +1 -1
  83. package/esm/src/utils/version-constant.js +1 -1
  84. package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts +3 -2
  85. package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts.map +1 -1
  86. package/esm/src/workflow/worker/run-entrypoint.d.ts +6 -4
  87. package/esm/src/workflow/worker/run-entrypoint.d.ts.map +1 -1
  88. package/esm/src/workflow/worker/run-entrypoint.js +3 -2
  89. package/package.json +2 -2
  90. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts +0 -18
  91. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts.map +0 -1
  92. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.js +0 -62
  93. package/esm/src/agent/react/use-chat/browser-inference/types.d.ts +0 -44
  94. package/esm/src/agent/react/use-chat/browser-inference/types.d.ts.map +0 -1
  95. package/esm/src/agent/react/use-chat/browser-inference/types.js +0 -4
  96. package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts +0 -30
  97. package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts.map +0 -1
  98. package/esm/src/agent/react/use-chat/browser-inference/worker-client.js +0 -66
  99. package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts +0 -8
  100. package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts.map +0 -1
  101. package/esm/src/agent/react/use-chat/browser-inference/worker-script.js +0 -97
  102. package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts +0 -9
  103. package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts.map +0 -1
  104. package/esm/src/react/components/chat/chat/components/upgrade-cta.js +0 -35
@@ -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 { DEFAULT_LOCAL_MODEL } from "../../provider/local/model-catalog.js";
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 `local/${DEFAULT_LOCAL_MODEL}`;
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` still defaults to `local/*`
88
- * - `local/*` upgrades to the first available cloud model when bootstrap exists
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
- if (isUnsupportedVeryfrontCloudMistralModel(configuredModel)) {
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 findAvailableCloudModel() ?? configuredModel;
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
- const runtimeProvider = DIRECT_RUNTIME_PROVIDER_ALIASES[provider] ?? provider;
118
- return `${runtimeProvider}/${modelId}`;
164
+ return toDirectRuntimeModel(provider, modelId);
119
165
  }
120
166
  return `veryfront-cloud/${provider}/${modelId}`;
121
167
  }
@@ -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
- * local inference by default, automatically upgrading to an available cloud
94
- * provider when bootstrap credentials are present.
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>);
@@ -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, UpgradeCTA, type UpgradeCTAProps, type UploadedFile, UploadsPanel, type UploadsPanelProps, useThreads, type UseThreadsOptions, type UseThreadsResult, } 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, 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 BrowserInferenceStatus, 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";
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,EAC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,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,6BAA6B,EAC7B,mCAAmC,EACnC,2CAA2C,EAC3C,8BAA8B,EAC9B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
@@ -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, UpgradeCTA, UploadsPanel, useThreads, } 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, 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 = Deno.env.get("UPLOAD_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,oBA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ACjC,KAAK,EAAE,QAAQ,EACf,MAAM,CAAC,EAAE,mBAAmB;oBAKC,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;oBAiF3B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;sBAc7C,OAAO,WACP;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC1C,OAAO,CAAC,QAAQ,CAAC;EA6BrB"}
@@ -165,12 +165,13 @@ function getSourceBlobStorage() {
165
165
  * ```ts
166
166
  * // app/api/uploads/route.ts
167
167
  * import { createUploadHandler } from "veryfront/embedding";
168
+ * import { getEnv } from "veryfront";
168
169
  * import { store } from "lib/store.ts";
169
170
  *
170
171
  * export const { POST, GET } = createUploadHandler(store, {
171
172
  * auth: {
172
173
  * authorize: (request) => {
173
- * const token = Deno.env.get("UPLOAD_TOKEN");
174
+ * const token = getEnv("UPLOAD_TOKEN");
174
175
  * return token !== undefined &&
175
176
  * request.headers.get("authorization") === `Bearer ${token}`;
176
177
  * },
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/plugin-loader.ts"],"names":[],"mappings":"AA0GA;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBpE;AAwBD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6D/E;AAED,wBAAsB,UAAU,CAC9B,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CAwClB"}
1
+ {"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/plugin-loader.ts"],"names":[],"mappings":"AA4FA;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBpE;AAwBD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6D/E;AAED,wBAAsB,UAAU,CAC9B,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CAsClB"}
@@ -10,6 +10,7 @@ import * as dntShim from "../../../_dnt.shims.js";
10
10
  import { serverLogger } from "../../utils/index.js";
11
11
  import { getErrorBySlug, IMPORT_RESOLUTION_ERROR, NETWORK_ERROR, VeryfrontError, } from "../../errors/index.js";
12
12
  import { getTailwindPluginBundleUrl } from "../../build/binary-plugin-includes.js";
13
+ import { isDeno } from "../../platform/compat/runtime.js";
13
14
  import { bareName, PACKAGE_SPEC_RE, TAILWIND_PLUGIN_ALLOWLIST, } from "./tailwind-plugin-allowlist.js";
14
15
  const logger = serverLogger.component("tailwind");
15
16
  /**
@@ -54,16 +55,6 @@ catch {
54
55
  // `tailwindcss/colors` used by dynamically loaded plugin bundles are installed
55
56
  // by the `@veryfront/ext-css-tailwind` extension's `setup()` hook — they depend on
56
57
  // tailwindcss imports that live in the extension package, not in core.
57
- function isRealDenoRuntime() {
58
- const global = dntShim.dntGlobalThis;
59
- const isNodeLike = global.process?.versions?.node != null && !global.process?.versions?.deno;
60
- return !global.Bun &&
61
- !isNodeLike &&
62
- typeof dntShim.Deno !== "undefined" &&
63
- typeof dntShim.Deno.version === "object" &&
64
- typeof dntShim.Deno.build === "object" &&
65
- typeof dntShim.Deno.build.os === "string";
66
- }
67
58
  function encodeToBase64(source) {
68
59
  const bufferCtor = dntShim.dntGlobalThis.Buffer;
69
60
  if (bufferCtor?.from) {
@@ -87,7 +78,7 @@ export function rewriteEsmShRootRelativeImports(code) {
87
78
  .replace(/\b(import\s*\(\s*)(["'])(\/(?!\/)[^"']+)\2/g, (_match, prefix, quote, specifier) => `${prefix}${quote}https://esm.sh${specifier}${quote}`);
88
79
  }
89
80
  async function importBundledModule(code) {
90
- if (!isRealDenoRuntime()) {
81
+ if (!isDeno) {
91
82
  const dataUrl = `data:text/javascript;base64,${encodeToBase64(code)}`;
92
83
  return await import(dataUrl);
93
84
  }
@@ -169,7 +160,6 @@ export async function loadPlugin(id, pluginCache, pluginErrors) {
169
160
  if (pluginCache.has(id)) {
170
161
  return pluginCache.get(id);
171
162
  }
172
- const { isDeno } = await import("../../platform/compat/runtime.js");
173
163
  try {
174
164
  let mod;
175
165
  if (isDeno) {
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/feature-flags.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,6BAA6B,wCAAwC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,qPAuB9B,CAAC;AAEX,eAAO,MAAM,0BAA0B,63EA8M7B,CAAC;AAqBX,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE9E;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE/E;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAezF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAChF,YAAY,EAAE,SAAS,CAAC,EAAE,GACzB,CAAC,EAAE,CAIL"}
1
+ {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/src/integrations/feature-flags.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,wCAAwC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,qPAuB9B,CAAC;AAEX,eAAO,MAAM,0BAA0B,63EA8M7B,CAAC;AAaX,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE9E;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE/E;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAezF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAChF,YAAY,EAAE,SAAS,CAAC,EAAE,GACzB,CAAC,EAAE,CAIL"}
@@ -1,4 +1,4 @@
1
- import * as dntShim from "../../_dnt.shims.js";
1
+ import { getHostEnv } from "../platform/compat/process.js";
2
2
  export const EXPERIMENTAL_INTEGRATIONS_ENV = "VERYFRONT_EXPERIMENTAL_INTEGRATIONS";
3
3
  export const SUPPORTED_INTEGRATION_NAMES = [
4
4
  "airtable",
@@ -237,15 +237,7 @@ function normalizeIntegrationName(name) {
237
237
  return name.trim().toLowerCase();
238
238
  }
239
239
  function readEnv(name) {
240
- try {
241
- return dntShim.dntGlobalThis.Deno?.env?.get(name);
242
- }
243
- catch {
244
- // Deno throws without --allow-env. Treat missing permission like an unset flag.
245
- }
246
- const processEnv = dntShim.dntGlobalThis
247
- .process?.env;
248
- return processEnv?.[name];
240
+ return getHostEnv(name);
249
241
  }
250
242
  export function isDeclaredIntegration(name) {
251
243
  return typeof name === "string" && declaredIntegrations.has(normalizeIntegrationName(name));
@@ -0,0 +1,6 @@
1
+ export type DnsAddressRecordType = "A" | "AAAA";
2
+ export interface ResolveHostAddressesOptions {
3
+ recordTypes?: readonly DnsAddressRecordType[];
4
+ }
5
+ export declare function resolveHostAddresses(hostname: string, options?: ResolveHostAddressesOptions): Promise<string[]>;
6
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/dns.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG,GAAG,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC/C;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB"}
@@ -0,0 +1,34 @@
1
+ import { getDenoRuntime, isBun, isDeno, isNode } from "./runtime.js";
2
+ export async function resolveHostAddresses(hostname, options = {}) {
3
+ const recordTypes = options.recordTypes ?? ["A", "AAAA"];
4
+ const results = [];
5
+ if (isDeno) {
6
+ const deno = getDenoRuntime();
7
+ if (!deno)
8
+ return results;
9
+ for (const recordType of recordTypes) {
10
+ try {
11
+ results.push(...await deno.resolveDns(hostname, recordType));
12
+ }
13
+ catch {
14
+ // A host may legitimately have only one address family.
15
+ }
16
+ }
17
+ return results;
18
+ }
19
+ if (isNode || isBun) {
20
+ const dns = await import("node:dns/promises");
21
+ for (const recordType of recordTypes) {
22
+ try {
23
+ const addresses = recordType === "A"
24
+ ? await dns.resolve4(hostname)
25
+ : await dns.resolve6(hostname);
26
+ results.push(...addresses);
27
+ }
28
+ catch {
29
+ // A host may legitimately have only one address family.
30
+ }
31
+ }
32
+ }
33
+ return results;
34
+ }
@@ -1,5 +1,5 @@
1
1
  export declare const OPAQUE_DEPENDENCY_VERSIONS: {
2
2
  readonly "@anthropic-ai/claude-agent-sdk": "0.2.37";
3
- readonly "@huggingface/transformers": "3.4.2";
3
+ readonly "@huggingface/transformers": "4.2.0";
4
4
  };
5
5
  //# sourceMappingURL=opaque-dependency-versions.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const OPAQUE_DEPENDENCY_VERSIONS = {
2
2
  "@anthropic-ai/claude-agent-sdk": "0.2.37",
3
- "@huggingface/transformers": "3.4.2",
3
+ "@huggingface/transformers": "4.2.0",
4
4
  };
@@ -12,6 +12,7 @@ export { chdir, type CommandResult, cwd, env, exit, getArgs, getEnv, getOsType,
12
12
  export { createFileSystem, exists, type FileSystem, mkdir, readDir, readTextFile, remove, writeTextFile, } from "./compat/fs.js";
13
13
  export { createEscapeBuffer, getStdinReader, setRawMode, type StdinReader, } from "./compat/stdin.js";
14
14
  export { lookup as lookupMimeType } from "./compat/media-types.js";
15
+ export { resolveHostAddresses, type ResolveHostAddressesOptions } from "./compat/dns.js";
15
16
  export { createKVStore, MemoryKv } from "./compat/kv/index.js";
16
17
  export { isDeno } from "./compat/runtime.js";
17
18
  export { createFSAdapter, VeryfrontFSAdapter } from "./adapters/fs/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EACL,KAAK,EACL,KAAK,aAAa,EAClB,GAAG,EACH,GAAG,EACH,IAAI,EACJ,OAAO,EACP,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,E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AAU,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,KAAK,UAAU,EACf,KAAK,EACL,OAAO,EACP,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAGzF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC"}
@@ -16,6 +16,8 @@ export { createFileSystem, exists, mkdir, readDir, readTextFile, remove, writeTe
16
16
  export { createEscapeBuffer, getStdinReader, setRawMode, } from "./compat/stdin.js";
17
17
  // Compat: media types
18
18
  export { lookup as lookupMimeType } from "./compat/media-types.js";
19
+ // Compat: DNS
20
+ export { resolveHostAddresses } from "./compat/dns.js";
19
21
  // Compat: KV store
20
22
  export { createKVStore, MemoryKv } from "./compat/kv/index.js";
21
23
  // Compat: runtime detection
@@ -11,7 +11,7 @@
11
11
  * ```
12
12
  */
13
13
  import "../../_dnt.polyfills.js";
14
- export { clearModelProviders, ensureModelReady, findAvailableCloudModel, getRegisteredModelProviders, hasModelProvider, registerModelProvider, resolveModel, } from "./model-registry.js";
14
+ export { clearModelProviders, ensureModelReady, getRegisteredModelProviders, hasModelProvider, registerModelProvider, resolveModel, } from "./model-registry.js";
15
15
  export type { ModelProviderFactory } from "./model-registry.js";
16
16
  export type { ModelRuntime } from "./types.js";
17
17
  export { runWithVeryfrontCloudContext, runWithVeryfrontCloudContextAsync, } from "./veryfront-cloud/context.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACL,gCAAgC,EAChC,uBAAuB,EACvB,gCAAgC,EAChC,oCAAoC,EACpC,mCAAmC,EACnC,8BAA8B,EAC9B,kCAAkC,EAClC,mCAAmC,EACnC,4BAA4B,EAC5B,kCAAkC,EAClC,4CAA4C,EAC5C,uCAAuC,EACvC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACL,gCAAgC,EAChC,uBAAuB,EACvB,gCAAgC,EAChC,oCAAoC,EACpC,mCAAmC,EACnC,8BAA8B,EAC9B,kCAAkC,EAClC,mCAAmC,EACnC,4BAA4B,EAC5B,kCAAkC,EAClC,4CAA4C,EAC5C,uCAAuC,EACvC,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,oCAAoC,CAAC"}
@@ -11,6 +11,6 @@
11
11
  * ```
12
12
  */
13
13
  import "../../_dnt.polyfills.js";
14
- export { clearModelProviders, ensureModelReady, findAvailableCloudModel, getRegisteredModelProviders, hasModelProvider, registerModelProvider, resolveModel, } from "./model-registry.js";
14
+ export { clearModelProviders, ensureModelReady, getRegisteredModelProviders, hasModelProvider, registerModelProvider, resolveModel, } from "./model-registry.js";
15
15
  export { runWithVeryfrontCloudContext, runWithVeryfrontCloudContextAsync, } from "./veryfront-cloud/context.js";
16
16
  export { DEFAULT_VERYFRONT_CLOUD_MODEL_ID, findVeryfrontCloudModel, findVeryfrontCloudModelByModelId, getVeryfrontCloudProviderFromModelId, groupVeryfrontCloudModelsByProvider, normalizeVeryfrontCloudModelId, resolveHostedVeryfrontCloudModelId, resolveVeryfrontCloudGatewayModelId, resolveVeryfrontCloudModelId, resolveVeryfrontCloudModelThinking, resolveVeryfrontCloudThinkingProviderOptions, tryGetVeryfrontCloudProviderFromModelId, VERYFRONT_CLOUD_CHAT_MODELS, VERYFRONT_CLOUD_MODEL_PREFIX, } from "./veryfront-cloud/model-catalog.js";
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @module provider/local
8
8
  */
9
+ export type LocalAIDevice = "cpu" | "webgpu";
9
10
  /**
10
11
  * Check whether local AI is explicitly disabled via environment variable.
11
12
  * Works in Deno, Node, and compiled binaries.
@@ -13,4 +14,6 @@
13
14
  export declare function isLocalAIDisabled(): boolean;
14
15
  export declare function createLocalAIDisabledError(): Error;
15
16
  export declare function throwIfLocalAIDisabled(): void;
17
+ export declare function getLocalAIDevice(): LocalAIDevice;
18
+ export declare function getLocalAIThinkingEnabled(): boolean;
16
19
  //# sourceMappingURL=env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/local/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAOlD;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/local/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAOlD;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAgBhD;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAsBnD"}
@@ -9,6 +9,8 @@
9
9
  import { createError, toError } from "../../errors/veryfront-error.js";
10
10
  import { getHostEnv } from "../../platform/compat/process.js";
11
11
  const LOCAL_AI_DISABLED_MESSAGE = "Local AI disabled via VERYFRONT_DISABLE_LOCAL_AI environment variable.";
12
+ const LOCAL_AI_DEVICE_ENV = "VERYFRONT_LOCAL_AI_DEVICE";
13
+ const LOCAL_AI_THINKING_ENV = "VERYFRONT_LOCAL_AI_THINKING";
12
14
  /**
13
15
  * Check whether local AI is explicitly disabled via environment variable.
14
16
  * Works in Deno, Node, and compiled binaries.
@@ -27,3 +29,32 @@ export function throwIfLocalAIDisabled() {
27
29
  throw createLocalAIDisabledError();
28
30
  }
29
31
  }
32
+ export function getLocalAIDevice() {
33
+ const value = getHostEnv(LOCAL_AI_DEVICE_ENV);
34
+ if (!value)
35
+ return "cpu";
36
+ const normalized = value.trim().toLowerCase();
37
+ if (normalized === "cpu" || normalized === "webgpu") {
38
+ return normalized;
39
+ }
40
+ throw toError(createError({
41
+ type: "config",
42
+ message: `Invalid ${LOCAL_AI_DEVICE_ENV} value "${value}". Supported values are "cpu" and "webgpu".`,
43
+ }));
44
+ }
45
+ export function getLocalAIThinkingEnabled() {
46
+ const value = getHostEnv(LOCAL_AI_THINKING_ENV);
47
+ if (!value)
48
+ return false;
49
+ const normalized = value.trim().toLowerCase();
50
+ if (normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on") {
51
+ return true;
52
+ }
53
+ if (normalized === "0" || normalized === "false" || normalized === "no" || normalized === "off") {
54
+ return false;
55
+ }
56
+ throw toError(createError({
57
+ type: "config",
58
+ message: `Invalid ${LOCAL_AI_THINKING_ENV} value "${value}". Supported values are "1", "true", "yes", "on", "0", "false", "no", and "off".`,
59
+ }));
60
+ }
@@ -5,11 +5,13 @@
5
5
  * local LLM inference. Provides lazy model loading and streaming text
6
6
  * generation via async generators.
7
7
  *
8
- * Uses ONNX Runtime for inference with q4 quantization NOT q4f16
8
+ * Uses ONNX Runtime for inference with q4 quantization, not q4f16,
9
9
  * due to a known ONNX bug with f16 LayerNorm on CPU.
10
10
  *
11
11
  * @module provider/local
12
12
  */
13
+ import { type ModelInfo } from "./model-catalog.js";
14
+ import { type LocalAIDevice } from "./env.js";
13
15
  /** Chat message format expected by Transformers.js */
14
16
  export interface ChatMessage {
15
17
  role: "system" | "user" | "assistant";
@@ -27,6 +29,14 @@ interface TransformersEnv {
27
29
  cacheDir: string;
28
30
  useBrowserCache: boolean;
29
31
  }
32
+ interface TransformersOnnxBackend {
33
+ webgpu?: {
34
+ powerPreference?: string;
35
+ };
36
+ }
37
+ interface TransformersBackendConfig {
38
+ onnx?: TransformersOnnxBackend;
39
+ }
30
40
  /** Minimal Transformers.js stopping-criteria contract (see generation/stopping_criteria.js). */
31
41
  interface StoppingCriteriaInstance {
32
42
  _call(inputIds: number[][], scores: unknown): boolean[];
@@ -37,10 +47,16 @@ interface StoppingCriteriaListInstance extends StoppingCriteriaInstance {
37
47
  }
38
48
  interface TransformersModule {
39
49
  env: TransformersEnv;
50
+ backends?: TransformersBackendConfig;
40
51
  pipeline: (task: string, model: string, options: {
41
- dtype: string;
42
- device: string;
52
+ dtype: ModelInfo["dtype"];
53
+ device: LocalAIDevice;
43
54
  }) => Promise<unknown>;
55
+ AutoProcessor: {
56
+ from_pretrained(model: string): Promise<ConditionalProcessor>;
57
+ };
58
+ Gemma4ForConditionalGeneration: ConditionalModelConstructor;
59
+ Qwen3_5ForConditionalGeneration: ConditionalModelConstructor;
44
60
  TextStreamer: new (tokenizer: unknown, options: {
45
61
  skip_prompt: boolean;
46
62
  skip_special_tokens: boolean;
@@ -49,6 +65,21 @@ interface TransformersModule {
49
65
  StoppingCriteria: new () => StoppingCriteriaInstance;
50
66
  StoppingCriteriaList: new () => StoppingCriteriaListInstance;
51
67
  }
68
+ interface ConditionalProcessor {
69
+ tokenizer: unknown;
70
+ apply_chat_template(messages: unknown[], options: Record<string, unknown>): string;
71
+ batch_decode(outputs: unknown, options: Record<string, unknown>): string[];
72
+ (...args: unknown[]): Promise<Record<string, unknown>>;
73
+ }
74
+ interface ConditionalModel {
75
+ generate(options: Record<string, unknown>): Promise<unknown>;
76
+ }
77
+ interface ConditionalModelConstructor {
78
+ from_pretrained(model: string, options: {
79
+ dtype: ModelInfo["dtype"];
80
+ device: LocalAIDevice;
81
+ }): Promise<ConditionalModel>;
82
+ }
52
83
  /** Tokenizer surface used to decode generated token ids back to text. */
53
84
  interface DecodingTokenizer {
54
85
  decode(tokens: number[]): string;
@@ -76,13 +107,15 @@ export declare function buildPipeOptions(options: GenerateOptions, transformers:
76
107
  * Only loads when actually needed, keeping startup fast when API keys are present.
77
108
  */
78
109
  export declare function getTransformers(): Promise<TransformersModule>;
110
+ export declare function buildConditionalGenerateOptions(options: GenerateOptions, transformers: Pick<TransformersModule, "StoppingCriteria" | "StoppingCriteriaList">, tokenizer: DecodingTokenizer, streamer: unknown): PipeOptions;
111
+ export declare function buildConditionalChatTemplateOptions(modelInfo: Pick<ModelInfo, "modelClass">): Record<string, unknown>;
79
112
  /**
80
113
  * Eagerly verify that the local AI runtime (@huggingface/transformers + ONNX)
81
114
  * is available by loading the default model pipeline.
82
115
  *
83
116
  * Call this *before* creating the HTTP response stream so that failures surface
84
- * as a thrown error (503) rather than being swallowed inside a ReadableStream
85
- * (200 with in-band SSE error).
117
+ * as a thrown error (503) rather than being swallowed inside a ReadableStream
118
+ * (200 with in-band SSE error).
86
119
  *
87
120
  * In compiled binaries, `import("@huggingface/transformers")` itself fails
88
121
  * because `onnxruntime-node` eagerly `require()`s a native `.node` addon at
@@ -1 +1 @@
1
- {"version":3,"file":"local-engine.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/local/local-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAcH,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kCAAkC;AAClC,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CA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