veryfront 0.1.867 → 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 (106) 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 +7 -12
  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/tool/project-scoped-remote-tools.d.ts.map +1 -1
  83. package/esm/src/tool/project-scoped-remote-tools.js +17 -2
  84. package/esm/src/utils/version-constant.d.ts +1 -1
  85. package/esm/src/utils/version-constant.js +1 -1
  86. package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts +3 -2
  87. package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts.map +1 -1
  88. package/esm/src/workflow/worker/run-entrypoint.d.ts +6 -4
  89. package/esm/src/workflow/worker/run-entrypoint.d.ts.map +1 -1
  90. package/esm/src/workflow/worker/run-entrypoint.js +3 -2
  91. package/package.json +2 -2
  92. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts +0 -18
  93. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts.map +0 -1
  94. package/esm/src/agent/react/use-chat/browser-inference/browser-engine.js +0 -62
  95. package/esm/src/agent/react/use-chat/browser-inference/types.d.ts +0 -44
  96. package/esm/src/agent/react/use-chat/browser-inference/types.d.ts.map +0 -1
  97. package/esm/src/agent/react/use-chat/browser-inference/types.js +0 -4
  98. package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts +0 -30
  99. package/esm/src/agent/react/use-chat/browser-inference/worker-client.d.ts.map +0 -1
  100. package/esm/src/agent/react/use-chat/browser-inference/worker-client.js +0 -66
  101. package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts +0 -8
  102. package/esm/src/agent/react/use-chat/browser-inference/worker-script.d.ts.map +0 -1
  103. package/esm/src/agent/react/use-chat/browser-inference/worker-script.js +0 -97
  104. package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts +0 -9
  105. package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts.map +0 -1
  106. package/esm/src/react/components/chat/chat/components/upgrade-cta.js +0 -35
@@ -3,7 +3,7 @@ export const DEMO_STEPS = [
3
3
  id: "intro",
4
4
  title: "Welcome to Veryfront",
5
5
  description: [
6
- "Veryfront is a zero-config React meta-framework with AI-native capabilities.",
6
+ "Veryfront is a React framework with AI-native capabilities.",
7
7
  "This demo will walk you through creating, running, and deploying your first app.",
8
8
  ],
9
9
  },
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/dev/command.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoSzE"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/dev/command.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwSzE"}
@@ -13,6 +13,7 @@ import { validateProviderConfig } from "../../../src/discovery/index.js";
13
13
  import { yellow } from "../../ui/index.js";
14
14
  import { exitProcess, registerTerminationSignals } from "../../utils/index.js";
15
15
  import { banner, brand, dim, error as errorColor, success } from "../../ui/index.js";
16
+ import { applyRuntimeAuthContext } from "../../shared/runtime-auth.js";
16
17
  import { createKeyboardHandler } from "../../ui/keyboard.js";
17
18
  import { openBrowser } from "../../auth/browser.js";
18
19
  import { createMCPServer } from "../../mcp/server.js";
@@ -48,7 +49,11 @@ export function devCommand(options) {
48
49
  const enableHMR = config?.dev?.hmr !== false && hmr;
49
50
  const env = getEnvironmentConfig();
50
51
  const isProxyMode = config?.fs?.veryfront?.proxyMode === true;
51
- const projectSlug = config?.fs?.veryfront?.projectSlug ?? env.projectSlug;
52
+ const runtimeAuth = await applyRuntimeAuthContext({
53
+ projectDir,
54
+ projectSlug: config?.fs?.veryfront?.projectSlug ?? env.projectSlug,
55
+ });
56
+ const projectSlug = runtimeAuth.projectSlug;
52
57
  // Validate provider config and print warnings (framework returns plain text, CLI adds colors)
53
58
  const aiValidation = validateProviderConfig(config);
54
59
  if (aiValidation.warnings.length > 0) {
@@ -3,5 +3,17 @@ export interface StartOptions {
3
3
  projectPath: string | null;
4
4
  headless: boolean;
5
5
  }
6
+ interface DiscoveredProjects {
7
+ projects: Map<string, string>;
8
+ examples: Map<string, string>;
9
+ defaultProject: string | null;
10
+ }
11
+ export interface StartProjectSelection {
12
+ projectDir: string;
13
+ projectSlug: string | undefined;
14
+ }
15
+ export declare function shouldSkipProjectDirectory(name: string): boolean;
16
+ export declare function selectStartProject(discovered: DiscoveredProjects, fallbackDir: string): StartProjectSelection;
6
17
  export declare function startCommand(options: StartOptions): Promise<void>;
18
+ export {};
7
19
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/start/command.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AA8GD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8HvE"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/start/command.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAOD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAMD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE;AAoED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,MAAM,GAClB,qBAAqB,CAgBvB;AAiCD,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkIvE"}
@@ -6,10 +6,14 @@ import { exitProcess, registerTerminationSignals } from "../../utils/index.js";
6
6
  import { generateDefaultProjectId } from "../../utils/project.js";
7
7
  import { clearAllLocalCaches } from "../../../src/transforms/mdx/esm-module-loader/cache/index.js";
8
8
  import { startCliDevServer, startCliProxyModeServer } from "../../shared/server-startup.js";
9
+ import { applyRuntimeAuthContext } from "../../shared/runtime-auth.js";
9
10
  const logger = cliLogger.component("global");
10
11
  function getProjectSlug(path) {
11
12
  return path.replace(/\/+$/, "").split("/").pop() ?? "";
12
13
  }
14
+ export function shouldSkipProjectDirectory(name) {
15
+ return name.startsWith(".") || name.startsWith("_");
16
+ }
13
17
  async function isVeryFrontProject(projectPath) {
14
18
  const fs = createFileSystem();
15
19
  const markers = ["app", "pages", "components"];
@@ -25,7 +29,7 @@ async function findProjectsInDirs(baseDirs) {
25
29
  continue;
26
30
  try {
27
31
  for await (const entry of fs.readDir(absoluteBase)) {
28
- if (!entry.isDirectory || entry.name.startsWith("."))
32
+ if (!entry.isDirectory || shouldSkipProjectDirectory(entry.name))
29
33
  continue;
30
34
  const projectPath = join(absoluteBase, entry.name);
31
35
  if (!(await isVeryFrontProject(projectPath)))
@@ -64,6 +68,24 @@ async function discoverProjects(explicitPath) {
64
68
  }
65
69
  return { projects, examples, defaultProject };
66
70
  }
71
+ function firstBySlug(map) {
72
+ return [...map.entries()].sort(([a], [b]) => a.localeCompare(b))[0];
73
+ }
74
+ export function selectStartProject(discovered, fallbackDir) {
75
+ if (discovered.defaultProject) {
76
+ const projectDir = discovered.projects.get(discovered.defaultProject) ??
77
+ discovered.examples.get(discovered.defaultProject);
78
+ if (projectDir) {
79
+ return { projectDir, projectSlug: discovered.defaultProject };
80
+ }
81
+ }
82
+ const fallbackProject = firstBySlug(discovered.projects) ?? firstBySlug(discovered.examples);
83
+ if (fallbackProject) {
84
+ const [projectSlug, projectDir] = fallbackProject;
85
+ return { projectDir, projectSlug };
86
+ }
87
+ return { projectDir: fallbackDir, projectSlug: undefined };
88
+ }
67
89
  async function trySetupProxy(localProjects) {
68
90
  try {
69
91
  // Proxy is only available in local dev, not in the npm package
@@ -139,14 +161,18 @@ export async function startCommand(options) {
139
161
  if (!headless) {
140
162
  await showStartup(["Loading configuration", "Discovering projects", "Starting server"]);
141
163
  }
164
+ let server;
165
+ const selectedProject = selectStartProject(discovered, cwd());
166
+ const projectDir = selectedProject.projectDir;
167
+ const runtimeAuth = await applyRuntimeAuthContext({
168
+ projectDir,
169
+ projectSlug: selectedProject.projectSlug,
170
+ });
171
+ const fallbackProjectSlug = runtimeAuth.projectSlug;
142
172
  const allProjects = new Map([...discovered.projects, ...discovered.examples]);
143
173
  const proxy = await trySetupProxy(allProjects);
144
174
  const shutdownController = new AbortController();
145
175
  const useProxy = typeof proxy.interceptor === "function";
146
- let server;
147
- const projectDir = discovered.defaultProject
148
- ? discovered.projects.get(discovered.defaultProject) ?? cwd()
149
- : cwd();
150
176
  if (useProxy) {
151
177
  const defaultProjectId = generateDefaultProjectId(cwd());
152
178
  const requestInterceptor = proxy.interceptor;
@@ -160,7 +186,7 @@ export async function startCommand(options) {
160
186
  requestInterceptor,
161
187
  defaultProjectSlug: defaultProjectId,
162
188
  defaultProjectId,
163
- fallbackProjectSlug: discovered.defaultProject ?? undefined,
189
+ fallbackProjectSlug,
164
190
  });
165
191
  }
166
192
  else {
@@ -0,0 +1,12 @@
1
+ export interface RuntimeAuthOptions {
2
+ projectDir: string;
3
+ projectSlug?: string;
4
+ }
5
+ export interface RuntimeAuthContext {
6
+ apiToken?: string;
7
+ projectSlug?: string;
8
+ }
9
+ export declare function inferRuntimeProjectSlug(projectDir: string): string | undefined;
10
+ export declare function resolveRuntimeAuthContext(options: RuntimeAuthOptions): Promise<RuntimeAuthContext>;
11
+ export declare function applyRuntimeAuthContext(options: RuntimeAuthOptions): Promise<RuntimeAuthContext>;
12
+ //# sourceMappingURL=runtime-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-auth.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/runtime-auth.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI9E;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAa7B;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
@@ -0,0 +1,34 @@
1
+ import { getEnv, setEnv } from "../../src/platform/index.js";
2
+ import { basename } from "../../src/platform/compat/path/index.js";
3
+ import { readToken } from "../auth/token-store.js";
4
+ function normalizeEnvValue(value) {
5
+ const normalized = value?.trim();
6
+ return normalized ? normalized : undefined;
7
+ }
8
+ export function inferRuntimeProjectSlug(projectDir) {
9
+ const dirName = basename(projectDir).replace(/^@[^/]+[/\\]/, "");
10
+ const slug = dirName.replace(/[^a-z0-9-]/gi, "-").toLowerCase();
11
+ return slug || undefined;
12
+ }
13
+ export async function resolveRuntimeAuthContext(options) {
14
+ const envToken = normalizeEnvValue(getEnv("VERYFRONT_API_TOKEN"));
15
+ const storedToken = envToken ? undefined : normalizeEnvValue(await readToken() ?? undefined);
16
+ const apiToken = envToken ?? storedToken;
17
+ const envProjectSlug = normalizeEnvValue(getEnv("VERYFRONT_PROJECT_SLUG"));
18
+ const projectSlug = envProjectSlug ?? normalizeEnvValue(options.projectSlug) ??
19
+ inferRuntimeProjectSlug(options.projectDir);
20
+ return {
21
+ ...(apiToken ? { apiToken } : {}),
22
+ ...(projectSlug ? { projectSlug } : {}),
23
+ };
24
+ }
25
+ export async function applyRuntimeAuthContext(options) {
26
+ const context = await resolveRuntimeAuthContext(options);
27
+ if (context.apiToken && !normalizeEnvValue(getEnv("VERYFRONT_API_TOKEN"))) {
28
+ setEnv("VERYFRONT_API_TOKEN", context.apiToken);
29
+ }
30
+ if (context.apiToken && context.projectSlug && !normalizeEnvValue(getEnv("VERYFRONT_PROJECT_SLUG"))) {
31
+ setEnv("VERYFRONT_PROJECT_SLUG", context.projectSlug);
32
+ }
33
+ return context;
34
+ }
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.867",
3
+ "version": "0.1.869",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,kB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,kBAAkB,CAAC;AAE9E,OAAO,EACL,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAuU3B,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACvF,cAAc,CAAC,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED,+DAA+D;AAC/D,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,KAAK,EAAE,KAAK,CAAC;CACd;AAUD,gCAAgC;AAChC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,kBAAkB,GAC3B,CAAC,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChD,gCAAgC;AAChC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,0BAA0B,EAClC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,CAAC,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC"}
@@ -2,7 +2,6 @@ import * as dntShim from "../../../_dnt.shims.js";
2
2
  import { isResponseLike } from "../service/response-like.js";
3
3
  import { getAgent } from "../composition/index.js";
4
4
  import { fromError } from "../../errors/veryfront-error.js";
5
- import { DEFAULT_LOCAL_MODEL } from "../../provider/local/model-catalog.js";
6
5
  import { AgentRuntime, RunAlreadyExistsError, } from "../runtime/index.js";
7
6
  import { createStreamTransformState, finalizeRunEvents, formatAgUiEvent, mapRuntimeEventToAgUi, } from "../../internal-agents/ag-ui-sse.js";
8
7
  import { streamDataStreamEvents } from "../streaming/data-stream.js";
@@ -17,6 +16,20 @@ const AG_UI_HEADERS = {
17
16
  "Cache-Control": "no-cache",
18
17
  Connection: "keep-alive",
19
18
  };
19
+ function isModelCredentialError(error) {
20
+ if (!error)
21
+ return false;
22
+ if (error.type === "no_ai_available")
23
+ return true;
24
+ if (error.type !== "config")
25
+ return false;
26
+ const message = error.message.toLowerCase();
27
+ return ((message.includes("not set") || message.includes("missing credentials")) &&
28
+ (message.includes("api_key") ||
29
+ message.includes("api token") ||
30
+ message.includes("veryfront_api_token") ||
31
+ message.includes("credentials")));
32
+ }
20
33
  function generateRunId() {
21
34
  return `run_${dntShim.crypto.randomUUID().replaceAll("-", "")}`;
22
35
  }
@@ -304,11 +317,10 @@ export function createAgUiHandler(agentIdOrConfig, options) {
304
317
  }, { status: 400 });
305
318
  }
306
319
  const vfError = fromError(error);
307
- if (vfError?.type === "no_ai_available") {
320
+ if (isModelCredentialError(vfError)) {
308
321
  return Response.json({
309
- code: "NO_AI_AVAILABLE",
310
- fallback: "browser",
311
- model: DEFAULT_LOCAL_MODEL,
322
+ code: vfError?.type === "no_ai_available" ? "NO_AI_AVAILABLE" : "NO_MODEL_CREDENTIALS",
323
+ error: "No model credentials configured. Run veryfront login or set VERYFRONT_API_TOKEN, OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.",
312
324
  }, { status: 503 });
313
325
  }
314
326
  return Response.json({ error: "Internal server error" }, { status: 500 });
@@ -4,7 +4,7 @@
4
4
  * @module agent/react
5
5
  */
6
6
  export { useChat } from "./use-chat/index.js";
7
- export type { BranchInfo, BrowserInferenceStatus, ChatDynamicToolPart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
7
+ export type { BranchInfo, ChatDynamicToolPart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
8
8
  export { useAgent } from "./use-agent.js";
9
9
  export type { UseAgentOptions, UseAgentResult } from "./use-agent.js";
10
10
  export { useCompletion } from "./use-completion.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EACV,UAAU,EACV,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -5,6 +5,6 @@
5
5
  * Build any interface you want.
6
6
  */
7
7
  export { useChat } from "./use-chat.js";
8
- export type { BranchInfo, BrowserInferenceStatus, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
8
+ export type { BranchInfo, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
9
9
  export type { ChatFinishReason, ChatStreamEvent, } from "./stream-protocol.js";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import type { ChatDataPart, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState } from "../../../chat/protocol.js";
2
- /** Where inference is happening */
3
- export type InferenceMode = "cloud" | "server-local" | "browser";
4
- /** Browser-side model loading and inference status */
5
- export type BrowserInferenceStatus = "idle" | "loading-runtime" | "downloading-model" | "ready" | "generating" | "error";
2
+ /** Where inference is happening. */
3
+ export type InferenceMode = "cloud" | "server-local";
6
4
  export type { ChatDataPart, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, };
7
5
  type ToolOutputState = "output-available" | "output-error";
8
6
  /** Output from tool. */
@@ -34,10 +32,6 @@ export interface UseChatOptions {
34
32
  credentials?: RequestCredentials;
35
33
  /** Override model at runtime (e.g. "openai/gpt-4o", "Anthropic/claude-sonnet-4-5-20250929") */
36
34
  model?: string;
37
- /** System prompt for browser-side inference (server uses agent config) */
38
- systemPrompt?: string;
39
- /** Enable/disable browser fallback when server can't provide a runtime. Default: true */
40
- browserFallback?: boolean;
41
35
  onResponse?: (response: Response) => void;
42
36
  onFinish?: (message: ChatMessage) => void;
43
37
  onError?: (error: Error) => void;
@@ -60,8 +54,6 @@ export interface UseChatResult {
60
54
  activeModel: string | undefined;
61
55
  /** Where inference is currently happening */
62
56
  inferenceMode: InferenceMode;
63
- /** Browser-side model loading/inference status (null when not using browser fallback) */
64
- browserStatus: BrowserInferenceStatus | null;
65
57
  setInput: (input: string) => void;
66
58
  /** Change the model for subsequent requests */
67
59
  setModel: (model: string | undefined) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;AAEjE,sDAAsD;AACtD,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,iBAAiB,GACjB,mBAAmB,GACnB,OAAO,GACP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;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC1F,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,sFAAsF;IACtF,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACjF,iFAAiF;IACjF,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,kFAAkF;IAClF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACpD"}
@@ -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 three inference modes:
8
- * - cloud: API key present, normal server-side inference
9
- * - server-local: No API key, server runs local model via ONNX
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 { handleAgUiStreamingResponse } from "./streaming/index.js";
13
12
  import type { ChatMessage, UseChatOptions, UseChatResult } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAGV,WAAW,EAIX,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AAGpB,KAAK,oBAAoB,GAAG,OAAO,2BAA2B,CAAC;AAE/D,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AAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,MAAM,CAIR;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAGtB;AAOD,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAmZnE"}
@@ -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 three inference modes:
8
- * - cloud: API key present, normal server-side inference
9
- * - server-local: No API key, server runs local model via ONNX
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
- // Handle 503 — server can't provide a runtime, fall back to browser
189
- if (response.status === 503 && (options.browserFallback ?? true)) {
115
+ if (!response.ok) {
116
+ let message = `API error: ${response.status}`;
190
117
  try {
191
- const body = await response.json();
192
- if (body.code === "NO_AI_AVAILABLE") {
193
- setInferenceMode("browser");
194
- setBrowserStatus("idle");
195
- await doBrowserInference(allMessages);
196
- return;
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
- /* expected: non-JSON 503 response body, fall through to normal error handling */
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: `API error: ${response.status}`,
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, inferenceMode, doBrowserInference]);
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(async () => {
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":"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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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 (not the string),
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 with browser fallback info
229
- // instead of swallowing it as an in-band SSE error in a 200 response.
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. When resolveModel falls back from
254
- // cloud to local (e.g. missing API key), use the resolved object's
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: effectiveModel,
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));
@@ -694,7 +689,7 @@ export class AgentRuntime {
694
689
  ];
695
690
  currentMessages.push({
696
691
  id: `runtime_note_${Date.now()}_${step}`,
697
- role: "system",
692
+ role: "user",
698
693
  parts: [{
699
694
  type: "text",
700
695
  text: `Runtime recovery: ignored unavailable tool call(s): ${unavailableNames.join(", ")}. Continue using only currently available tools: ${runtimeToolNames.join(", ")}.`,
@@ -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` still defaults to `local/*`
9
- * - `local/*` upgrades to the first available cloud model when bootstrap exists
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