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
Studio: stream a reply without re-rendering every message client per token (#17305)
Daniel Hanc5c41626e7b8
diff --git a/studio/frontend/src/lib/assistant-ui-tap-react.ts b/studio/frontend/src/lib/assistant-ui-tap-react.tsnew file mode 100644index 00000000000..00a6cd7cbd8--- /dev/null+++ b/studio/frontend/src/lib/assistant-ui-tap-react.ts@@ -0,0 +1,6 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// `@assistant-ui/tap/react` through the same files as the `@assistant-ui/tap` alias, so the dev server's+// prebundled dependencies and the app share one copy of tap's fiber internals.+export * from "../../node_modules/@assistant-ui/tap/dist/react/index.js";diff --git a/studio/frontend/src/lib/assistant-ui-tap-resources.ts b/studio/frontend/src/lib/assistant-ui-tap-resources.tsnew file mode 100644index 00000000000..65af5b0e4a7--- /dev/null+++ b/studio/frontend/src/lib/assistant-ui-tap-resources.ts@@ -0,0 +1,205 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/*+ * @assistant-ui/tap's `tapResources` with a bail-out. Upstream re-renders every child whenever its+ * element list is rebuilt, and the thread rebuilds the list of message clients on every thread update,+ * so each streamed token re-rendered every message's client: O(messages) work per token, which is+ * what made a reply stream slower the longer the chat (tap reducer 98 -> 729 ms, GC 116 -> 589 ms from+ * 40 to 200 turns). Here a child re-renders only when it marked itself dirty, its element changed, or+ * a context value provided above it changed; otherwise its last committed output is reused, like+ * React.memo. Everything else follows upstream 0.5.10 (src/hooks/tap-resources.ts).+ *+ * Bookkeeping only moves at commit: a render that is thrown away leaves a child dirty and its cached+ * output untouched, so the next render re-renders it.+ */++import {+ tapCallback,+ tapConst,+ tapEffect,+ tapMemo,+ tapRef,+} from "../../node_modules/@assistant-ui/tap/dist/index.js";+import {+ commitResourceFiber,+ createResourceFiber,+ renderResourceFiber,+ unmountResourceFiber,+} from "../../node_modules/@assistant-ui/tap/dist/core/ResourceFiber.js";+import { withContextProvider as upstreamWithContextProvider } from "../../node_modules/@assistant-ui/tap/dist/core/context.js";+import { getCurrentResourceFiber } from "../../node_modules/@assistant-ui/tap/dist/core/helpers/execution-context.js";++type Element = { type: unknown; props: unknown; key?: string | number };+type Fiber = ReturnType<typeof createResourceFiber>;+type Rendered = ReturnType<typeof renderResourceFiber>;+type Slot = {+ fiber: Fiber;+ /** Rendered and not yet committed: a result, a replacement fiber, a removal, or nothing (reused). */+ next: Rendered | [Fiber, Rendered] | "delete" | null;+ /** Set by the child's own updates; cleared when a render of it commits. */+ dirty: boolean;+ /** The last committed render, re-committed if the child was unmounted under it (see the commit effect). */+ committed: Rendered | null;+};++/** Context values provided above the resource being rendered, outermost first. */+const provided: unknown[] = [];++export function withContextProvider<T, R>(context: Parameters<typeof upstreamWithContextProvider>[0], value: T, fn: () => R): R {+ provided.push(value);+ try {+ return upstreamWithContextProvider(context, value, fn) as R;+ } finally {+ provided.pop();+ }+}++const isElement = (value: unknown): value is Element =>+ typeof value === "object" && value !== null && "type" in value && "props" in value;++/** Props equal key by key; nested resource elements are equal when type, key and props are. */+export function propsEqual(a: unknown, b: unknown): boolean {+ if (Object.is(a, b)) return true;+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;+ // A wrapper resource's props are themselves an element (tapClientLookup's ClientResourceWithKey).+ if (isElement(a) || isElement(b)) {+ return isElement(a) && isElement(b) && a.type === b.type && a.key === b.key && propsEqual(a.props, b.props);+ }+ if (Array.isArray(a) || Array.isArray(b)) return false;+ const ka = Object.keys(a);+ const kb = Object.keys(b);+ if (ka.length !== kb.length) return false;+ for (const key of ka) {+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;+ const x = (a as Record<string, unknown>)[key];+ const y = (b as Record<string, unknown>)[key];+ if (Object.is(x, y)) continue;+ if (isElement(x) && isElement(y) && x.type === y.type && x.key === y.key && propsEqual(x.props, y.props)) continue;+ return false;+ }+ return true;+}++/** Equal by identity, or one level deep: the root provides `{ clientRef, emit }` as a new literal per render. */+export const sameContextValue = (a: unknown, b: unknown): boolean => {+ if (Object.is(a, b)) return true;+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;+ if (Array.isArray(a) || Array.isArray(b)) {+ return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => Object.is(v, b[i]));+ }+ const ka = Object.keys(a);+ if (ka.length !== Object.keys(b).length) return false;+ return ka.every(+ (k) => Object.prototype.hasOwnProperty.call(b, k) && Object.is((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k]),+ );+};++const sameValues = (a: readonly unknown[], b: readonly unknown[]): boolean =>+ a.length === b.length && a.every((value, i) => sameContextValue(value, b[i]));++/** The context each render saw, for its commit. */+const renderedContext = new WeakMap<object, unknown[]>();++export function tapResources(getElements: () => Element[], getElementsDeps?: readonly unknown[]): unknown[] {+ const versionRef = tapRef(0);+ const version = versionRef.current;+ const parentFiber = tapConst(getCurrentResourceFiber, []) as Fiber & { markDirty?: () => void };+ const slots = tapConst(() => new Map<string | number, Slot>(), []);+ const committedContext = tapRef<unknown[] | null>(null);+ const getElementsMemo = getElementsDeps+ ? // deps are the caller's, as upstream+ tapCallback(getElements, getElementsDeps)+ : getElements;++ const fiberFor = (slot: Slot | null, type: unknown): [Fiber, Slot] => {+ const owner: Slot = slot ?? { fiber: undefined as unknown as Fiber, next: null, dirty: false, committed: null };+ const fiber = createResourceFiber(type as never, parentFiber.root, () => {+ owner.dirty = true;+ versionRef.current++;+ parentFiber.markDirty?.();+ });+ return [fiber, owner];+ };++ const res = tapMemo(() => {+ void version;+ const elements = getElementsMemo();+ const context = provided.slice();+ const contextSame = committedContext.current !== null && sameValues(committedContext.current, context);+ const seen = new Set<string | number>();+ const results: unknown[] = [];+ let created = 0;+ for (let i = 0; i < elements.length; i++) {+ const element = elements[i];+ const key = element.key;+ if (key === undefined) throw new Error(`tapResources did not provide a key for array at index ${i}`);+ if (seen.has(key)) throw new Error(`Duplicate key ${key} in tapResources`);+ seen.add(key);+ const slot = slots.get(key);+ if (!slot) {+ const [fiber, owner] = fiberFor(null, element.type);+ owner.fiber = fiber;+ owner.next = renderResourceFiber(fiber, element.props);+ slots.set(key, owner);+ created++;+ results.push(owner.next.output);+ } else if (slot.fiber.type !== element.type) {+ const [fiber] = fiberFor(slot, element.type);+ const result = renderResourceFiber(fiber, element.props);+ slot.next = [fiber, result];+ results.push(result.output);+ } else if (contextSame && !slot.dirty && slot.committed !== null && propsEqual(slot.committed.props, element.props)) {+ slot.next = null;+ results.push(slot.committed.output);+ } else {+ const result = renderResourceFiber(slot.fiber, element.props);+ slot.next = result;+ results.push(result.output);+ }+ }+ if (slots.size > results.length - created) {+ for (const [key, slot] of slots) if (!seen.has(key)) slot.next = "delete";+ }+ renderedContext.set(results, context);+ return results;+ }, [getElementsMemo, version]);++ tapEffect(() => {+ return () => {+ for (const slot of slots.values()) unmountResourceFiber(slot.fiber);+ };+ }, []);++ tapEffect(() => {+ for (const [key, slot] of slots) {+ const next = slot.next;+ if (next === "delete") {+ if (slot.fiber.isMounted) unmountResourceFiber(slot.fiber);+ slots.delete(key);+ continue;+ }+ if (next === null) {+ // Reused, but tap's dev strict mode runs this fiber's effects, cleans them up (unmounting+ // every child) and runs them again on first mount: remount from the last commit, as upstream+ // re-commits its kept result.+ if (!slot.fiber.isMounted && slot.committed !== null) commitResourceFiber(slot.fiber, slot.committed);+ continue;+ }+ if (Array.isArray(next)) {+ unmountResourceFiber(slot.fiber);+ slot.fiber = next[0];+ commitResourceFiber(slot.fiber, next[1]);+ slot.committed = next[1];+ } else {+ commitResourceFiber(slot.fiber, next);+ slot.committed = next;+ }+ slot.dirty = false;+ slot.next = null;+ }+ committedContext.current = renderedContext.get(res) ?? null;+ }, [res]);++ return res;+}diff --git a/studio/frontend/src/lib/assistant-ui-tap.ts b/studio/frontend/src/lib/assistant-ui-tap.tsnew file mode 100644index 00000000000..4cc44cf1ff1--- /dev/null+++ b/studio/frontend/src/lib/assistant-ui-tap.ts@@ -0,0 +1,7 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// `@assistant-ui/tap` as the app and assistant-ui load it (a vite alias): upstream, except `tapResources`,+// which skips children whose element and context did not change (./assistant-ui-tap-resources.ts).+export * from "../../node_modules/@assistant-ui/tap/dist/index.js";+export { tapResources, withContextProvider } from "./assistant-ui-tap-resources";diff --git a/studio/frontend/tests/assistant-ui-tap-resources-strict.test.ts b/studio/frontend/tests/assistant-ui-tap-resources-strict.test.tsnew file mode 100644index 00000000000..939c044c720--- /dev/null+++ b/studio/frontend/tests/assistant-ui-tap-resources-strict.test.ts@@ -0,0 +1,44 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++// tap reads NODE_ENV at import: in development a root mounts in strict mode, running its effects,+// cleaning them up (which unmounts every tapResources child) and running them again, as the dev+// server does under React's StrictMode.+process.env.NODE_ENV = "development";+delete (globalThis as { MessageChannel?: unknown }).MessageChannel;+const { createResourceRoot, flushResourcesSync, resource, tapEffect, tapResources: upstreamTapResources, tapState, withKey } = await import(+ "../node_modules/@assistant-ui/tap/dist/index.js"+);+const { tapResources } = await import("../src/lib/assistant-ui-tap-resources.ts");++const mount = (impl: typeof tapResources) => {+ const setters = new Map<string, (v: number) => void>();+ const live = new Set<string>();+ const Child = resource(({ id }: { id: string }) => {+ const [count, setCount] = tapState(0);+ setters.set(id, setCount);+ tapEffect(() => {+ live.add(id);+ return () => void live.delete(id);+ }, []);+ return `${id}:${count}`;+ });+ const Parent = resource(({ ids }: { ids: string[] }) => impl(() => ids.map((id) => withKey(id, Child({ id })) as never), [ids]));+ const root = createResourceRoot();+ const ids = ["a", "b"];+ const sub = root.render(Parent({ ids }) as never) as { getValue: () => string[] };+ return { sub, setters, live, render: () => (flushResourcesSync(() => root.render(Parent({ ids }) as never)) as typeof sub).getValue() };+};++test("children stay mounted after tap's strict-mode effect cleanup, as upstream", () => {+ for (const impl of [upstreamTapResources as typeof tapResources, tapResources]) {+ const m = mount(impl);+ assert.deepEqual([...m.live].sort(), ["a", "b"], "every child's effects are live after the strict remount");+ flushResourcesSync(() => m.setters.get("b")!(3));+ assert.deepEqual(m.sub.getValue(), ["a:0", "b:3"], "a child's own update still renders");+ assert.deepEqual(m.render(), ["a:0", "b:3"]);+ }+});diff --git a/studio/frontend/tests/assistant-ui-tap-resources.test.ts b/studio/frontend/tests/assistant-ui-tap-resources.test.tsnew file mode 100644index 00000000000..1e33386f5da--- /dev/null+++ b/studio/frontend/tests/assistant-ui-tap-resources.test.ts@@ -0,0 +1,161 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";+import { readFileSync } from "node:fs";++// tap schedules flushes on a MessageChannel created at import, which keeps Node's event loop alive after+// the tests; without one it falls back to setTimeout.+delete (globalThis as { MessageChannel?: unknown }).MessageChannel;+const {+ createResourceRoot,+ flushResourcesSync,+ resource,+ tapEffect,+ tapResources: upstreamTapResources,+ tapState,+ withKey,+} = await import("../node_modules/@assistant-ui/tap/dist/index.js");+const { propsEqual, sameContextValue, tapResources, withContextProvider } = await import("../src/lib/assistant-ui-tap-resources.ts");+const { createResourceContext, tap } = await import("../node_modules/@assistant-ui/tap/dist/index.js");++type Probe = { renders: Map<string, number>; setters: Map<string, (v: number) => void>; unmounted: string[] };++const harness = (impl: typeof tapResources) => {+ const probe: Probe = { renders: new Map(), setters: new Map(), unmounted: [] };+ const Child = resource(({ id, label }: { id: string; label: string }) => {+ probe.renders.set(id, (probe.renders.get(id) ?? 0) + 1);+ const [count, setCount] = tapState(0);+ probe.setters.set(id, setCount);+ tapEffect(() => () => void probe.unmounted.push(id), []);+ return `${id}:${label}:${count}`;+ });+ // The shape tapClientLookup hands tapResources: a wrapper element whose props are a fresh inner element.+ const Wrapper = resource((inner: { type: unknown; props: unknown; key: string }) => {+ const [out] = upstreamTapResources(() => [inner as never], [inner]);+ return out;+ });+ const Parent = resource(({ items }: { items: { id: string; label: string }[] }) =>+ impl(+ () => items.map((it) => withKey(it.id, Wrapper(withKey(it.id, Child({ id: it.id, label: it.label })) as never)) as never),+ [items],+ ),+ );+ const root = createResourceRoot();+ type Sub = { getValue: () => unknown; subscribe: (f: () => void) => () => void };+ root.render(Parent({ items: [] }) as never);+ const render = (items: { id: string; label: string }[]) =>+ (flushResourcesSync(() => root.render(Parent({ items }) as never)) as Sub).getValue() as string[];+ return { probe, render, root };+};++const items = (labels: Record<string, string>) => Object.entries(labels).map(([id, label]) => ({ id, label }));+const snapshot = (p: Probe) => Object.fromEntries(p.renders);++test("an equal element list re-renders no child; upstream re-renders all of them", () => {+ for (const [impl, expectSkip] of [[tapResources, true], [upstreamTapResources as typeof tapResources, false]] as const) {+ const h = harness(impl);+ h.render(items({ a: "x", b: "y", c: "z" }));+ const before = snapshot(h.probe);+ const out = h.render(items({ a: "x", b: "y", c: "z" }));+ const after = snapshot(h.probe);+ assert.deepEqual(out, ["a:x:0", "b:y:0", "c:z:0"]);+ if (expectSkip) assert.deepEqual(after, before, "no child re-rendered");+ else assert.ok(Object.keys(before).every((k) => after[k] > before[k]), "upstream re-renders every child");+ }+});++test("a changed child re-renders alone and its new output shows", () => {+ const h = harness(tapResources);+ h.render(items({ a: "x", b: "y", c: "z" }));+ const before = snapshot(h.probe);+ const out = h.render(items({ a: "x", b: "Y", c: "z" }));+ const after = snapshot(h.probe);+ assert.deepEqual(out, ["a:x:0", "b:Y:0", "c:z:0"]);+ assert.equal(after.a, before.a);+ assert.equal(after.c, before.c);+ assert.ok(after.b > before.b);+});++test("a child's own update re-renders only that child", () => {+ const h = harness(tapResources);+ h.render(items({ a: "x", b: "y", c: "z" }));+ const before = snapshot(h.probe);+ flushResourcesSync(() => h.probe.setters.get("c")!(5));+ const after = snapshot(h.probe);+ assert.equal(after.a, before.a);+ assert.equal(after.b, before.b);+ assert.ok(after.c > before.c);+ // A later equal render still shows the updated state (the cached output is the committed one).+ assert.deepEqual(h.render(items({ a: "x", b: "y", c: "z" })), ["a:x:0", "b:y:0", "c:z:5"]);+});++test("a removed key unmounts and an added key mounts, in order", () => {+ const h = harness(tapResources);+ h.render(items({ a: "x", b: "y", c: "z" }));+ const out = h.render(items({ c: "z", a: "x", d: "w" }));+ assert.deepEqual(out, ["c:z:0", "a:x:0", "d:w:0"]);+ assert.ok(h.probe.unmounted.includes("b"));+ assert.ok(!h.probe.unmounted.includes("a"));+});++test("props compare key by key and nested resource elements by type, key and props", () => {+ const T = () => null;+ const el = (props: object, key = "k") => ({ type: T, props, key });+ const runtime = {};+ assert.ok(propsEqual({ a: 1, r: runtime }, { a: 1, r: runtime }));+ assert.ok(!propsEqual({ a: 1 }, { a: 2 }));+ assert.ok(!propsEqual({ a: 1 }, { a: 1, b: 2 }));+ assert.ok(propsEqual(el({ id: "m1", runtime }), el({ id: "m1", runtime })));+ assert.ok(!propsEqual(el({ id: "m1", runtime }), el({ id: "m2", runtime })));+ assert.ok(!propsEqual(el({ id: "m1" }, "k1"), el({ id: "m1" }, "k2")));+ assert.ok(!propsEqual(el({ r: {} }), el({ r: {} })), "a new object prop is a change");+ assert.ok(!propsEqual([1], [1]), "arrays are compared by identity");+});++test("the app and assistant-ui load tap through the stand-in, and only tapResources and withContextProvider differ", () => {+ const vite = readFileSync(new URL("../vite.config.ts", import.meta.url), "utf8");+ assert.match(vite, /\["@assistant-ui\/tap", path\.resolve\(__dirname, "\.\/src\/lib\/assistant-ui-tap\.ts"\)\]/);+ assert.match(vite, /\["@assistant-ui\/tap\/react", path\.resolve\(__dirname, "\.\/src\/lib\/assistant-ui-tap-react\.ts"\)\]/);+ // The build resolves the stand-in with the plugin, the dev server's optimizer with the same plugin; a+ // resolve alias would send the app's own import to tap's raw files on the dev server, a second copy.+ assert.match(vite, /plugins: \[[^\]]*\{ \.\.\.assistantUiTapStandIn\(\), apply: "build", enforce: "pre" \}/);+ assert.match(vite, /rolldownOptions: \{ plugins: \[assistantUiTapStandIn\(\)\] \}/);+ assert.doesNotMatch(vite, /find: \/\^@assistant-ui\\\/tap/);+ const shim = readFileSync(new URL("../src/lib/assistant-ui-tap.ts", import.meta.url), "utf8");+ assert.match(shim, /export \* from "\.\.\/\.\.\/node_modules\/@assistant-ui\/tap\/dist\/index\.js";\nexport \{ tapResources, withContextProvider \} from "\.\/assistant-ui-tap-resources";/);+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));+ assert.equal(pkg.dependencies["@assistant-ui/tap"], "0.5.10", "the stand-in follows tap 0.5.10's tapResources; re-check it on upgrade");+});++test("context values compare by identity or one level deep, so a fresh { clientRef, emit } literal is equal", () => {+ const clientRef = { current: null };+ const emit = () => undefined;+ assert.ok(sameContextValue({ clientRef, emit }, { clientRef, emit }));+ assert.ok(!sameContextValue({ clientRef, emit }, { clientRef, emit: () => undefined }));+ const stack = [{}];+ assert.ok(sameContextValue(stack, [stack[0]]));+ assert.ok(!sameContextValue([{}], [{}]));+});++test("a changed context value above the list re-renders every child; an equal fresh one re-renders none", () => {+ const Ctx = createResourceContext({ v: 0 });+ const renders: number[] = [];+ const Child = resource(({ i }: { i: number }) => {+ renders[i] = (renders[i] ?? 0) + 1;+ return `${i}:${(tap(Ctx) as { v: number }).v}`;+ });+ const Parent = resource(({ v }: { v: number }) =>+ // No deps: the list is rebuilt on every render, as the thread's message list is on every update.+ withContextProvider(Ctx as never, { v }, () => tapResources(() => [0, 1].map((i) => withKey(String(i), Child({ i })) as never))),+ );+ const root = createResourceRoot();+ const render = (v: number) => (flushResourcesSync(() => root.render(Parent({ v }) as never)) as { getValue: () => string[] }).getValue();+ assert.deepEqual(render(1), ["0:1", "1:1"]);+ const before = [...renders];+ assert.deepEqual(render(1), ["0:1", "1:1"]);+ assert.deepEqual(renders, before, "a fresh but equal context value re-renders no child");+ assert.deepEqual(render(2), ["0:2", "1:2"]);+ assert.ok(renders.every((n, i) => n > before[i]), "a changed context value re-renders every child");+});diff --git a/studio/frontend/vite.config.ts b/studio/frontend/vite.config.tsindex 20866ce8026..6dc94968372 100644--- a/studio/frontend/vite.config.ts+++ b/studio/frontend/vite.config.ts@@ -13,6 +13,31 @@ import { preloadNonceInHead } from "./vite-plugin-preload-nonce";import { viewportMediaGate } from "./vite-plugin-viewport-media";import { previewRuntime } from "./vite-preview-runtime.ts";+// assistant-ui's tap re-rendered every message client on each streamed token (O(messages) per+// token); the stand-in skips unchanged children (src/lib/assistant-ui-tap-resources.ts). Not a+// resolve alias: on the dev server that also sends the app's own `@assistant-ui/tap` import to+// tap's raw files, a second copy beside the one prebundled into assistant-ui, and the thread never+// renders. The build resolves the stand-in with this plugin; on the dev server the dependency+// optimizer does, for assistant-ui's imports and for the app's `@assistant-ui/tap` entry, so both+// share the one prebundled copy.+const TAP_STAND_IN = new Map([+ ["@assistant-ui/tap", path.resolve(__dirname, "./src/lib/assistant-ui-tap.ts")],+ ["@assistant-ui/tap/react", path.resolve(__dirname, "./src/lib/assistant-ui-tap-react.ts")],+]);+const TAP_ENTRIES = new Map([+ [path.resolve(__dirname, "./node_modules/@assistant-ui/tap/dist/index.js"), TAP_STAND_IN.get("@assistant-ui/tap")],+ [path.resolve(__dirname, "./node_modules/@assistant-ui/tap/dist/react/index.js"), TAP_STAND_IN.get("@assistant-ui/tap/react")],+]);++function assistantUiTapStandIn() {+ return {+ name: "assistant-ui-tap-stand-in",+ resolveId(id: string, _importer?: string, options?: { isEntry?: boolean }) {+ return TAP_STAND_IN.get(id) ?? (options?.isEntry ? TAP_ENTRIES.get(id) : undefined) ?? null;+ },+ };+}+function smokeModuleDelay(): Plugin {const match = process.env.SMOKE_MODULE_DELAY_MATCH;const delayMs = Number(process.env.SMOKE_MODULE_DELAY_MS ?? "0");@@ -36,7 +61,7 @@ export default defineConfig({cacheDir: process.env.VITE_TEST_CACHE_DIR || "node_modules/.vite",// Reasoning's highlighter loads only the grammar it needs in its module worker.worker: { format: "es" },- plugins: [react(), tailwindcss(), childSelectorOrder(), hasAnchorOrder(), viewportMediaGate(), smokeModuleDelay(), previewRuntime(), chatPagePreload(), katexWoff2Only(), preloadNonceInHead()],+ plugins: [react(), tailwindcss(), childSelectorOrder(), hasAnchorOrder(), viewportMediaGate(), { ...assistantUiTapStandIn(), apply: "build", enforce: "pre" }, smokeModuleDelay(), previewRuntime(), chatPagePreload(), katexWoff2Only(), preloadNonceInHead()],// prevent ancestor PostCSS configs from leaking into installs; Tailwind uses its Vite plugin.css: {postcss: {@@ -48,6 +73,7 @@ export default defineConfig({// which the dev server's first scan does not see; found later, it forces a re-optimize and a// full reload that native Safari does not recover from.include: ["@dagrejs/dagre", "@dagrejs/graphlib", "react-remove-scroll/UI"],+ rolldownOptions: { plugins: [assistantUiTapStandIn()] },},server: {host: "0.0.0.0",