Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Make the two ineffective import() calls static, fail the build on the next one, and re-measure the startup budget (#11676)
Daniel Hanfef4775af59f
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.tsindex 23ac833870a..4daf81ee873 100644--- a/studio/frontend/scripts/check-bundle-budget.ts+++ b/studio/frontend/scripts/check-bundle-budget.ts@@ -33,13 +33,14 @@ const DIST = resolve(HERE, "..", "dist");*/export const BUDGET = {// Measured, one machine and one build per side, so the pair is comparable to itself rather- // than to a runner's: 5,384.0 KB raw / 1,610.2 KB transfer at the merge base, leaving- // 211.7 KB and 64.6 KB spare. Both halves are re-measured TOGETHER, or each drags main red- // on its own; the previous four raises each bought a few kilobytes and were spent within- // days, charging the next PR for drift it did not cause. The eager set has not gained a- // member across any of it, so what runs out is headroom, not laziness.- transferBytes: 1_715_000,- rawBytes: 5_730_000,+ // than to a runner's: 5,599.7 KB raw / 1,663.4 KB transfer at 0065fade6 once its two+ // ineffective import() calls were made static, leaving 210.8 KB and 65.1 KB spare, the margin+ // the previous raise chose. Both halves are re-measured TOGETHER, or each drags main red on+ // its own. Since that raise the eager set gained one 303-byte chunk (#11607's+ // thread-message-slot split) and otherwise grew inside chunks already eager: #11607's fork+ // boundary and #11648's UI scale, so what ran out is headroom, not laziness.+ transferBytes: 1_770_000,+ rawBytes: 5_950_000,};// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering thediff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 7a19af62f16..8229edffe21 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -249,6 +249,10 @@ import {type SidebarSection,} from "@/features/chat";import { ShutdownDialog } from "@/components/shutdown-dialog";+import {+ buildChatItemMarkdown,+ saveChatItemAsProjectSource,+} from "@/features/chat/prompt-storage/prompt-storage-dialog";import { translate, useT, type TranslationKey } from "@/i18n";const RECENT_SLOT_NUMBERS = [1, 2, 3, 4, 5, 6] as const;@@ -458,9 +462,6 @@ async function saveChatToProjectSources(item: SidebarItem,projectId: string,): Promise<void> {- const { saveChatItemAsProjectSource } = await import(- "@/features/chat/prompt-storage/prompt-storage-dialog"- );await saveChatItemAsProjectSource(item, projectId);}@@ -2788,9 +2789,6 @@ export function AppSidebar() {// The read runs inside the write: Safari drops the gesture across an// await, and a chord has no second one to fall back on.const copied = await copyToClipboardFrom(async () => {- const { buildChatItemMarkdown } = await import(- "@/features/chat/prompt-storage/prompt-storage-dialog"- );// A compare row is two threads: keep both, each under its model's name.const markdown = await buildChatItemMarkdown(item);if (!markdown) {diff --git a/studio/frontend/src/features/chat/api/skills-api.ts b/studio/frontend/src/features/chat/api/skills-api.tsindex c0dc860ca4e..9a0baac3108 100644--- a/studio/frontend/src/features/chat/api/skills-api.ts+++ b/studio/frontend/src/features/chat/api/skills-api.ts@@ -4,6 +4,7 @@import { authFetch } from "@/features/auth";import { AUTH_SESSION_CLEARED_EVENT } from "@/features/auth/session";import { useEffect, useSyncExternalStore } from "react";+import { refreshContextUsage } from "../utils/refresh-context-usage";export type SkillRecord = {name: string;@@ -135,9 +136,7 @@ export async function setSkillEnabled(error: null,});channel?.postMessage("changed");- void import("../utils/refresh-context-usage").then(- ({ refreshContextUsage }) => refreshContextUsage({ invalidate: true }),- );+ void refreshContextUsage({ invalidate: true });return updated;}@@ -204,7 +203,5 @@ if (typeof window !== "undefined") {channel?.addEventListener("message", () => {void listSkills(true).catch(() => undefined);- void import("../utils/refresh-context-usage").then(- ({ refreshContextUsage }) => refreshContextUsage({ invalidate: true }),- );+ void refreshContextUsage({ invalidate: true });});diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsxindex e9a4772efcc..e4545f83db5 100644--- a/studio/frontend/src/features/chat/chat-page.tsx+++ b/studio/frontend/src/features/chat/chat-page.tsx@@ -251,6 +251,14 @@ import {consumeProjectSourcesPending,hasProjectSourcesPending,} from "@/features/rag/components/project-source-dropzone";+import {+ exportConversationCsv,+ exportConversationMarkdown,+ exportConversationMessagesJsonl,+ exportConversationRawJsonl,+ exportConversationShareGPT,+ saveChatItemAsProjectSource,+} from "./prompt-storage/prompt-storage-dialog";const ProjectSourcesPanel = lazy(() =>import("@/features/rag/components/project-sources-panel").then((module) => ({@@ -1263,14 +1271,13 @@ async function exportProjectConversation(threadId: string,format: ProjectChatExportFormat,): Promise<void> {- const exports = await import("./prompt-storage/prompt-storage-dialog");- if (format === "raw-jsonl") return exports.exportConversationRawJsonl(threadId);+ if (format === "raw-jsonl") return exportConversationRawJsonl(threadId);if (format === "messages-jsonl")- return exports.exportConversationMessagesJsonl(threadId);- if (format === "csv") return exports.exportConversationCsv(threadId);+ return exportConversationMessagesJsonl(threadId);+ if (format === "csv") return exportConversationCsv(threadId);if (format === CONVERSATION_MARKDOWN_FORMAT)- return exports.exportConversationMarkdown(threadId);- if (format === "sharegpt-jsonl") return exports.exportConversationShareGPT(threadId);+ return exportConversationMarkdown(threadId);+ if (format === "sharegpt-jsonl") return exportConversationShareGPT(threadId);// Was a fallthrough return, so an unhandled format silently exported ShareGPT.const unhandled: never = format;throw new Error(`Unhandled export format: ${String(unhandled)}`);@@ -1291,9 +1298,6 @@ async function saveProjectChatItemAsSource(item: SidebarItem,projectId: string,): Promise<void> {- const { saveChatItemAsProjectSource } = await import(- "./prompt-storage/prompt-storage-dialog"- );await saveChatItemAsProjectSource(item, projectId);}diff --git a/studio/frontend/src/features/chat/components/chat-row-menu.ts b/studio/frontend/src/features/chat/components/chat-row-menu.tsindex 277c35589bf..d8f579dafdb 100644--- a/studio/frontend/src/features/chat/components/chat-row-menu.ts+++ b/studio/frontend/src/features/chat/components/chat-row-menu.ts@@ -16,6 +16,13 @@ import { liveThreadBranch } from "../utils/live-thread-head";import { forkChatThread } from "../api/chat-api";import { settleThreadScopedSettingsForCopy } from "../stores/chat-runtime-store";import type { SidebarItem } from "../hooks/use-chat-sidebar-items";+import {+ exportConversationCsv,+ exportConversationMarkdown,+ exportConversationMessagesJsonl,+ exportConversationRawJsonl,+ exportConversationShareGPT,+} from "../prompt-storage/prompt-storage-dialog";import { listStoredChatMessages } from "../utils/chat-history-storage";export type ConversationExportFormat =@@ -44,18 +51,17 @@ export async function exportConversationByFormat(threadId: string,format: ConversationExportFormat,): Promise<void> {- const exports = await import("../prompt-storage/prompt-storage-dialog");switch (format) {case "raw-jsonl":- return exports.exportConversationRawJsonl(threadId);+ return exportConversationRawJsonl(threadId);case "messages-jsonl":- return exports.exportConversationMessagesJsonl(threadId);+ return exportConversationMessagesJsonl(threadId);case "csv":- return exports.exportConversationCsv(threadId);+ return exportConversationCsv(threadId);case "sharegpt-jsonl":- return exports.exportConversationShareGPT(threadId);+ return exportConversationShareGPT(threadId);case CONVERSATION_MARKDOWN_FORMAT:- return exports.exportConversationMarkdown(threadId);+ return exportConversationMarkdown(threadId);default: {// Exhaustive: a new format is a build error, not a menu item that does nothing.const unhandled: never = format;diff --git a/studio/frontend/vite.config.ts b/studio/frontend/vite.config.tsindex f804b645def..0b24777958f 100644--- a/studio/frontend/vite.config.ts+++ b/studio/frontend/vite.config.ts@@ -86,5 +86,15 @@ export default defineConfig({commonjsOptions: {include: [/node_modules/, /@dagrejs\/dagre/, /@dagrejs\/graphlib/],},+ rolldownOptions: {+ // import() of a module the app already imports statically defers nothing, and it splits+ // that module's graph into extra startup chunks (#11588). Fail the build rather than warn.+ onLog(level, log, handler) {+ if (log.code === "INEFFECTIVE_DYNAMIC_IMPORT") {+ throw new Error(log.message);+ }+ handler(level, log);+ },+ },},});