dsh-smooth-stream 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +9 -14
- package/README.md +9 -14
- package/lib/client.js +265 -68
- package/lib/client.js.map +1 -1
- package/package.json +7 -2
- package/src/client/TypewriterAssistantNodeView.tsx +226 -49
- package/src/client/teleprompterGlide.ts +64 -1
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css","IconChevronDownOutline14","useState","useRef","useCallback","useRef","useCallback","useRef","useRef","css","useState","useRef","css","MarkdownText","IconThinkOutline14","memo","useMemo","ImageGallery","JsonBlock","useRef","useState","useCallback","createElement","useState","css","IconChevronDownOutline14","IconRefreshOutline14","createSnapshotStore","SETTINGS_NS","useSyncExternalStore","createElement"],"sources":["../src/client/AnimatedDisclosure.tsx","../src/client/useSmoothStreamContent.ts","../src/client/useFpsGuard.ts","../src/client/teleprompterGlide.ts","../src/client/FollowHost.tsx","../src/config.ts","../src/settings.ts","../src/client/TypewriterAssistantNodeView.tsx","../src/client/useProgressiveDomText.ts","../src/client/TypewriterToolNodeView.tsx","../src/client/SmoothStreamCard.tsx","../src/client/smooth-stream-card-controller.ts","../src/settings-api.ts","../src/client/smooth-stream-settings-api.ts","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["// AnimatedDisclosure: the harness DisclosureRow chrome (24px row, hover\n// chevron preview, whole-row click/Enter/Space toggle) with one deliberate\n// difference - the expanded body stays mounted while collapsed and animates\n// between 0fr and 1fr grid tracks, so expand/collapse glides instead of\n// snapping. The harness primitive unmounts closed children (`{open &&\n// children}`) and a plugin cannot change that in place, so this fork mirrors\n// its DOM shape and `data-disclosure-row` contract: host styling keyed on the\n// row attribute and the Think chrome keep working unchanged.\n\nimport { type KeyboardEvent, type ReactNode } from 'react'\nimport { IconChevronDownOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport css from './TypewriterAssistantNodeView.module.css'\n\n/** Class-name join for optional overlay classes over the chrome defaults. */\nfunction cx(...parts: Array<string | undefined>): string {\n return parts.filter(part => part !== undefined && part !== '').join(' ')\n}\n\nexport interface AnimatedDisclosureProps {\n icon: ReactNode\n title: string\n open: boolean\n onToggle: () => void\n collapsedContent?: ReactNode\n children?: ReactNode\n rowClassName?: string | undefined\n leadingClassName?: string | undefined\n titleClassName?: string | undefined\n chevronClassName?: string | undefined\n}\n\n/**\n * Render one disclosure header whose expanded body is height-animated.\n * @param props - Visual content, controlled open state, and the toggle\n * callback fired by row click and Enter/Space.\n * @returns the animated disclosure row.\n */\nexport function AnimatedDisclosure({\n icon,\n title,\n open,\n onToggle,\n collapsedContent,\n children,\n rowClassName,\n leadingClassName,\n titleClassName,\n chevronClassName,\n}: AnimatedDisclosureProps) {\n const toggleFromKeyboard = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Enter' && event.key !== ' ') return\n event.preventDefault()\n onToggle()\n }\n return (\n <div className={css.disclosureRoot} data-open={open || undefined}>\n <div\n className={cx(css.disclosureRow, rowClassName)}\n data-disclosure-row\n data-expandable=\"\"\n role=\"button\"\n tabIndex={0}\n aria-expanded={open}\n onClick={onToggle}\n onKeyDown={toggleFromKeyboard}\n >\n <span className={cx(css.disclosureLeading, leadingClassName)}>\n {open\n ? <IconChevronDownOutline14 className={chevronClassName} />\n : (\n <>\n <span className={css.disclosureIconIdle}>{icon}</span>\n <IconChevronDownOutline14 className={cx(chevronClassName, css.disclosureChevronHover)} />\n </>\n )}\n </span>\n <span className={cx(css.disclosureTitle, titleClassName)}>{title}</span>\n {!open && collapsedContent}\n </div>\n <div className={css.disclosureContent} data-disclosure-content data-collapsed={open ? undefined : ''}>\n {children}\n </div>\n </div>\n )\n}\n","/**\n * Stream-smoothing reveal hook.\n *\n * Buffers the model's chunked text and reveals it at a cadence that tracks\n * the observed arrival rate, so a long reply never dumps whole paragraphs at\n * once and a fast stream never stutters. Port of lobe-ui's smoother: EMA\n * arrival cps + chunk size, backlog pressure, commit-interval widening with\n * tail length, and a flush-speed settle drain once the input idles. The\n * reveal decision is the pure {@link computeRevealStep} for unit tests.\n *\n * `shouldHoldBack` is the performance guard's veto: while it returns true the\n * loop keeps measuring but skips the DOM commit, so an offscreen reply never\n * competes with visible frames when the frame rate is degraded.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nexport type StreamSmoothingPreset = 'realtime' | 'balanced' | 'silky'\n\nexport interface StreamSmoothingPresetConfig {\n readonly activeInputWindowMs: number\n readonly defaultCps: number\n readonly emaAlpha: number\n readonly flushCps: number\n readonly largeAppendChars: number\n readonly maxActiveCps: number\n readonly maxCps: number\n readonly maxFlushCps: number\n readonly minCps: number\n readonly settleAfterMs: number\n readonly settleDrainMaxMs: number\n readonly settleDrainMinMs: number\n readonly targetBufferMs: number\n}\n\nexport const PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig> = {\n balanced: {\n activeInputWindowMs: 220,\n defaultCps: 80,\n emaAlpha: 0.35,\n flushCps: 180,\n largeAppendChars: 120,\n maxActiveCps: 360,\n maxCps: 240,\n maxFlushCps: 480,\n minCps: 24,\n settleAfterMs: 280,\n settleDrainMaxMs: 420,\n settleDrainMinMs: 120,\n targetBufferMs: 40,\n },\n realtime: {\n activeInputWindowMs: 140,\n defaultCps: 120,\n emaAlpha: 0.45,\n flushCps: 240,\n largeAppendChars: 180,\n maxActiveCps: 480,\n maxCps: 320,\n maxFlushCps: 640,\n minCps: 32,\n settleAfterMs: 200,\n settleDrainMaxMs: 280,\n settleDrainMinMs: 100,\n targetBufferMs: 24,\n },\n silky: {\n activeInputWindowMs: 280,\n defaultCps: 64,\n emaAlpha: 0.28,\n flushCps: 140,\n largeAppendChars: 100,\n maxActiveCps: 280,\n maxCps: 180,\n maxFlushCps: 400,\n minCps: 20,\n settleAfterMs: 360,\n settleDrainMaxMs: 520,\n settleDrainMinMs: 160,\n targetBufferMs: 56,\n },\n}\n\n/** Pressure curve from the reference stream renderer. */\nexport const QUEUE_BASE_SPEED_CPS = 90\nexport const QUEUE_ACCEL_EXPONENT = 1.25\nexport const QUEUE_PRESSURE_FACTOR = 0.85\nexport const QUEUE_MAX_SPEED_CPS = 600\n/** Hard cap on how far display may trail a live stream, in characters. */\nexport const LIVE_LAG_CHAR_CEILING = 32\nconst CATCHUP_SECONDS = 0.15\n\nexport const clamp = (value: number, min: number, max: number): number => {\n return Math.min(max, Math.max(min, value))\n}\n\n/**\n * Reference pressure-buffer reveal for a frame that starts without debt.\n * @param backlog - Unrevealed characters.\n * @param dtMs - Frame delta in ms.\n * @returns Characters to reveal this frame.\n */\nexport function computeQueueReveal(backlog: number, dtMs: number): number {\n if (backlog <= 0 || dtMs <= 0) return 0\n return computeAdaptiveQueueStep(backlog, dtMs, 0).revealChars\n}\n\nexport interface AdaptiveQueueStep {\n readonly revealChars: number\n readonly debt: number\n readonly speedCps: number\n}\n\n/** Float-debt queue integration from `ultimate_stream_physics_scroller.html`. */\nexport function computeAdaptiveQueueStep(\n backlog: number,\n dtMs: number,\n debt: number,\n revealScale = 1,\n): AdaptiveQueueStep {\n if (backlog <= 0 || dtMs <= 0) return { revealChars: 0, debt: 0, speedCps: 0 }\n const speedCps = Math.min(\n QUEUE_MAX_SPEED_CPS,\n QUEUE_BASE_SPEED_CPS + Math.pow(backlog, QUEUE_ACCEL_EXPONENT) * QUEUE_PRESSURE_FACTOR,\n )\n const effectiveScale = clamp(revealScale, 0.05, 1)\n const accumulated = Math.max(0, debt) + speedCps * effectiveScale * (dtMs / 1000)\n const revealChars = Math.min(backlog, Math.floor(accumulated))\n return { revealChars, debt: revealChars >= backlog ? 0 : accumulated - revealChars, speedCps }\n}\n\n/** Counts user-perceived characters (code points), not UTF-16 units. */\nexport const countChars = (text: string): number => {\n let count = 0\n for (const char of text) {\n void char\n count += 1\n }\n return count\n}\n\n/**\n * Drain rate for backlog beyond the tail-lag ceiling: the displayed text may\n * trail the stream by at most `backlogCharCeiling` characters for at most\n * `backlogSecondCeiling` seconds. The constants are a smoothness invariant\n * (bounded lag is the reason the reveal never stalls mid-reply), so they are\n * not config fields; the preset multiplier is how a deployment tunes them.\n */\nexport const BACKLOG_CHAR_CEILING = 300\nexport const BACKLOG_SECOND_CEILING = 2\n\nexport interface SettleDrainInput {\n readonly backlog: number\n readonly inputActive: boolean\n readonly settling: boolean\n}\n\n/** Pure settle-drain decision shared by the frame loop and its tests. */\nexport function computeSettleDrain(config: StreamSmoothingPresetConfig, input: SettleDrainInput): number {\n if (input.inputActive || !input.settling) return 0\n // A settled stream must drain fast enough to finish the reply promptly:\n // lag beyond the ceiling drains within the second ceiling.\n const overflow = Math.max(0, input.backlog - BACKLOG_CHAR_CEILING)\n const overflowCps = (overflow * 1000) / BACKLOG_SECOND_CEILING\n const drainTargetMs = clamp(input.backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs)\n const settleCps = (input.backlog * 1000) / drainTargetMs\n return clamp(Math.max(settleCps, overflowCps), config.flushCps, config.maxFlushCps)\n}\n\n/** Fixed velocity that closes a producer-complete queue within its deadline. */\nexport function computeCompletionDrain(\n config: StreamSmoothingPresetConfig,\n backlog: number,\n): number {\n if (backlog <= 0) return 0\n const drainTargetMs = clamp(backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs)\n const deadlineCps = (backlog * 1000) / drainTargetMs\n return Math.max(\n deadlineCps,\n computeSettleDrain(config, { backlog, inputActive: false, settling: true }),\n )\n}\n\n/**\n * Drain rate multiplier once the input ends: leftover backlog reveals at\n * this multiple of the steady rate, so the end never drags.\n */\nexport const SETTLE_DRAIN_MULTIPLIER = 1.8\n\nexport interface RevealStepInput {\n readonly backlog: number\n readonly chunkSizeEma: number\n readonly arrivalCpsEma: number\n readonly emaCps: number\n readonly inputActive: boolean\n readonly settling: boolean\n /** Fixed reveal rate; overrides the arrival-tracking cadence entirely. */\n readonly steadyCps?: number | undefined\n}\n\nexport interface RevealStepResult {\n readonly revealChars: number\n readonly targetLagChars: number\n}\n\n/** Pure per-frame reveal decision shared by the loop and its tests. */\nexport function computeRevealStep(config: StreamSmoothingPresetConfig, input: RevealStepInput, dtSeconds: number): RevealStepResult {\n // Track the faster of the two EMAs and do not clamp to the old low maxCps\n // ceiling — that cap is why a fast model left hundreds of chars unrevealed.\n const trackedCps = Math.max(input.emaCps, input.arrivalCpsEma)\n const baseCps = clamp(trackedCps, config.minCps, config.maxFlushCps)\n const targetLagChars = input.inputActive\n ? Math.max(2, Math.round((baseCps * config.targetBufferMs) / 1000))\n : 0\n\n let currentCps: number\n if (input.steadyCps !== undefined) {\n currentCps = input.inputActive || input.settling\n ? clamp(\n input.steadyCps * (input.inputActive ? 1 : SETTLE_DRAIN_MULTIPLIER),\n config.minCps,\n config.maxFlushCps,\n )\n : 0\n } else if (input.inputActive) {\n const overflow = Math.max(0, input.backlog - LIVE_LAG_CHAR_CEILING)\n const catchup = overflow > 0 ? overflow / CATCHUP_SECONDS : 0\n currentCps = clamp(baseCps * 1.08 + catchup, config.minCps, config.maxFlushCps)\n } else if (input.settling) {\n currentCps = computeSettleDrain(config, input)\n } else {\n const idleFlushCps = Math.max(config.flushCps, baseCps * 1.8, input.arrivalCpsEma * 0.8)\n currentCps = clamp(idleFlushCps, config.flushCps, config.maxFlushCps)\n }\n\n const minRevealChars = input.inputActive ? 1 : 2\n return { revealChars: Math.max(minRevealChars, Math.round(currentCps * dtSeconds)), targetLagChars }\n}\n\nexport interface UseSmoothStreamContentOptions {\n enabled?: boolean\n /** The producer has completed; drain queued text without live backpressure. */\n inputComplete?: boolean\n preset?: StreamSmoothingPreset\n /** Performance guard veto: while true, reveal commits are held back. */\n shouldHoldBack?: (() => boolean) | undefined\n /**\n * Fixed reveal rate in chars/s. When set, the reveal runs at this steady\n * pace while the input streams (instead of tracking the arrival rate) and\n * drains an inferred idle backlog at {@link SETTLE_DRAIN_MULTIPLIER}.\n * Explicit producer completion still uses the bounded completion drain.\n */\n steadyCps?: number | undefined\n /**\n * Seed for the arrival-rate EMA. When omitted, the preset's `defaultCps`\n * is used. The live rate then tracks observed arrival; this is not a cap.\n */\n defaultCps?: number | undefined\n /** Written each commit with the live arrival-rate EMA for the follow lerp. */\n speedCpsRef?: { current: number } | undefined\n /** Live multiplier from the follow spring when safe visual lag is filling. */\n revealScaleRef?: { current: number } | undefined\n}\n\n/**\n * Smooth a chunked content stream into a reveal-paced display string.\n *\n * @param content - The full accumulated input so far.\n * @param options - Preset, guard, and steady-rate wiring.\n * @returns The displayed content, revealed at the smoothed cadence.\n */\nexport function useSmoothStreamContent(\n content: string,\n {\n enabled = true,\n inputComplete = false,\n preset = 'balanced',\n shouldHoldBack,\n steadyCps,\n defaultCps,\n speedCpsRef,\n revealScaleRef,\n }: UseSmoothStreamContentOptions = {},\n): string {\n const config = PRESET_CONFIG[preset]\n const seedCps = defaultCps ?? config.defaultCps\n // A fast provider can fill the first Host render with a large batch. Start\n // an enabled stream behind that batch so it still enters the reveal queue;\n // disabled (settled/history) content must remain immediate.\n const initialContent = enabled ? '' : content\n const [displayedContent, setDisplayedContent] = useState(initialContent)\n\n const displayedContentRef = useRef(initialContent)\n const displayedCountRef = useRef(countChars(initialContent))\n const targetContentRef = useRef(initialContent)\n const targetCharsRef = useRef([...initialContent])\n const targetCountRef = useRef(countChars(initialContent))\n\n const emaCpsRef = useRef(seedCps)\n const lastInputTsRef = useRef(0)\n const lastInputCountRef = useRef(countChars(initialContent))\n const chunkSizeEmaRef = useRef(1)\n const arrivalCpsEmaRef = useRef(seedCps)\n\n const rafRef = useRef<number | null>(null)\n const lastFrameTsRef = useRef<number | null>(null)\n const queueDebtRef = useRef(0)\n const settleCpsRef = useRef<number | null>(null)\n const holdBackRef = useRef(shouldHoldBack)\n const speedOutRef = useRef(speedCpsRef)\n speedOutRef.current = speedCpsRef\n const revealScaleOutRef = useRef(revealScaleRef)\n revealScaleOutRef.current = revealScaleRef\n const inputCompleteRef = useRef(inputComplete)\n inputCompleteRef.current = inputComplete\n\n useEffect(() => {\n holdBackRef.current = shouldHoldBack\n }, [shouldHoldBack])\n\n const stopFrameLoop = useCallback(() => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n lastFrameTsRef.current = null\n }, [])\n\n const startFrameLoopRef = useRef<() => void>(() => {})\n\n const syncImmediate = useCallback(\n (nextContent: string) => {\n stopFrameLoop()\n const chars = [...nextContent]\n const now = performance.now()\n targetContentRef.current = nextContent\n targetCharsRef.current = chars\n targetCountRef.current = chars.length\n displayedContentRef.current = nextContent\n displayedCountRef.current = chars.length\n queueDebtRef.current = 0\n settleCpsRef.current = null\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = seedCps\n setDisplayedContent(nextContent)\n emaCpsRef.current = seedCps\n chunkSizeEmaRef.current = 1\n arrivalCpsEmaRef.current = seedCps\n lastInputTsRef.current = now\n lastInputCountRef.current = chars.length\n },\n [seedCps, stopFrameLoop],\n )\n\n // Producer completion is authoritative. Publish the accumulated source in\n // the same commit instead of leaving a visible typewriter tail after the\n // Agent has already stopped; the conversation follower still glides any\n // resulting layout height before paint.\n useLayoutEffect(() => {\n if (!enabled || !inputComplete || displayedContentRef.current === content) return\n syncImmediate(content)\n }, [content, enabled, inputComplete, syncImmediate])\n\n const startFrameLoop = useCallback(() => {\n if (rafRef.current !== null) return\n\n const tick = (now: number) => {\n const targetCount = targetCountRef.current\n const displayedCount = displayedCountRef.current\n const backlog = targetCount - displayedCount\n\n if (backlog <= 0) {\n queueDebtRef.current = 0\n settleCpsRef.current = null\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = seedCps\n stopFrameLoop()\n return\n }\n\n if (lastFrameTsRef.current === null) {\n lastFrameTsRef.current = now\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n const frameIntervalMs = Math.max(0, now - lastFrameTsRef.current)\n const dtSeconds = Math.max(0.001, Math.min(frameIntervalMs / 1000, 0.12))\n lastFrameTsRef.current = now\n\n const idleMs = now - lastInputTsRef.current\n const producerComplete = inputCompleteRef.current\n const inputActive = !producerComplete && idleMs <= config.activeInputWindowMs\n const settling = producerComplete || (!inputActive && idleMs >= config.settleAfterMs)\n if (!producerComplete) settleCpsRef.current = null\n\n let revealChars: number\n let revealSpeedCps: number\n let nextQueueDebt = 0\n if (producerComplete) {\n // Backpressure protects live layout. Once input has ended, retaining\n // that scale only makes a completed response keep typing onscreen.\n // Keep one drain velocity for the whole completion tail. Recomputing\n // it from the shrinking backlog creates an exponential slow tail.\n const settleCps = settleCpsRef.current ?? computeCompletionDrain(config, backlog)\n settleCpsRef.current = settleCps\n const accumulated = Math.max(0, queueDebtRef.current) + settleCps * dtSeconds\n revealChars = Math.min(backlog, Math.floor(accumulated))\n revealSpeedCps = settleCps\n nextQueueDebt = revealChars >= backlog ? 0 : accumulated - revealChars\n } else if (steadyCps !== undefined) {\n const step = computeRevealStep(\n config,\n {\n backlog,\n chunkSizeEma: chunkSizeEmaRef.current,\n arrivalCpsEma: arrivalCpsEmaRef.current,\n emaCps: emaCpsRef.current,\n inputActive,\n settling,\n steadyCps,\n },\n dtSeconds,\n )\n revealChars = Math.min(step.revealChars, backlog)\n revealSpeedCps = frameIntervalMs > 0 ? (revealChars * 1000) / frameIntervalMs : 0\n } else {\n const step = computeAdaptiveQueueStep(\n backlog,\n frameIntervalMs,\n queueDebtRef.current,\n revealScaleOutRef.current?.current ?? 1,\n )\n revealChars = step.revealChars\n revealSpeedCps = step.speedCps\n nextQueueDebt = step.debt\n }\n\n // Performance guard: while degraded and the reply is offscreen, skip\n // the DOM commit — the backlog keeps accumulating and flushes when the\n // guard clears or the reply scrolls into view.\n if (holdBackRef.current?.() === true) {\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n queueDebtRef.current = nextQueueDebt\n\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = revealSpeedCps\n\n if (revealChars <= 0) {\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n const nextCount = displayedCount + revealChars\n const segment = targetCharsRef.current.slice(displayedCount, nextCount).join('')\n if (segment) {\n const nextDisplayed = displayedContentRef.current + segment\n displayedContentRef.current = nextDisplayed\n displayedCountRef.current = nextCount\n setDisplayedContent(nextDisplayed)\n } else {\n displayedContentRef.current = targetContentRef.current\n displayedCountRef.current = targetCount\n setDisplayedContent(targetContentRef.current)\n }\n\n rafRef.current = requestAnimationFrame(tick)\n }\n\n rafRef.current = requestAnimationFrame(tick)\n }, [config, stopFrameLoop, steadyCps])\n\n useEffect(() => {\n startFrameLoopRef.current = startFrameLoop\n }, [startFrameLoop])\n\n useEffect(() => {\n if (!enabled) {\n syncImmediate(content)\n return\n }\n\n const prevTargetContent = targetContentRef.current\n if (content === prevTargetContent) return\n\n const now = performance.now()\n const appendOnly = content.startsWith(prevTargetContent)\n\n if (!appendOnly) {\n syncImmediate(content)\n return\n }\n\n const appended = content.slice(prevTargetContent.length)\n const appendedChars = [...appended]\n const appendedCount = appendedChars.length\n\n targetContentRef.current = content\n targetCharsRef.current.push(...appendedChars)\n targetCountRef.current += appendedCount\n settleCpsRef.current = null\n\n const hadSample = lastInputTsRef.current > 0\n const deltaChars = targetCountRef.current - lastInputCountRef.current\n const deltaMs = Math.max(1, now - lastInputTsRef.current)\n\n // Skip the first sample: lastInputTs starts at 0, so the interval would\n // be \"time since page load\" (or 1ms under fake timers) and poison the EMA.\n if (hadSample && deltaChars > 0) {\n const instantCps = (deltaChars * 1000) / deltaMs\n const normalizedInstantCps = clamp(instantCps, config.minCps, config.maxFlushCps * 3)\n const chunkEmaAlpha = 0.45\n chunkSizeEmaRef.current = chunkSizeEmaRef.current * (1 - chunkEmaAlpha) + appendedCount * chunkEmaAlpha\n arrivalCpsEmaRef.current = arrivalCpsEmaRef.current * (1 - chunkEmaAlpha) + normalizedInstantCps * chunkEmaAlpha\n emaCpsRef.current = emaCpsRef.current * (1 - config.emaAlpha) + normalizedInstantCps * config.emaAlpha\n }\n\n lastInputTsRef.current = now\n lastInputCountRef.current = targetCountRef.current\n\n startFrameLoop()\n }, [content, enabled, config, startFrameLoop, syncImmediate])\n\n useEffect(() => {\n return () => {\n stopFrameLoop()\n }\n }, [stopFrameLoop])\n\n return displayedContent\n}\n","/**\n * Performance guard for the streaming reveal.\n *\n * Feeds an EMA-smoothed frame-rate monitor from a rAF loop while streaming\n * and tracks whether the reply is on-screen. The returned `shouldHoldBack`\n * predicate is true only while the frame rate is below the threshold AND the\n * reply is offscreen — exactly the spec's \"skip offscreen DOM updates when\n * FPS < 30\" rule. The smoother consumes the predicate as its commit veto.\n */\n\nimport { useCallback, useEffect, useRef } from 'react'\n\nconst FPS_THRESHOLD = 30\nconst FPS_ALPHA = 0.12\nconst RECOVER_FRAMES = 6\nconst MAX_FRAME_MS = 100\n\ninterface MutableFps {\n emaMs: number\n lastMs: number\n healthyRun: number\n degraded: boolean\n}\n\nexport function useFpsGuard(active: boolean): {\n ref: (element: HTMLElement | null) => void\n shouldHoldBack: () => boolean\n} {\n const fpsRef = useRef<MutableFps>({ emaMs: 0, lastMs: 0, healthyRun: 0, degraded: false })\n const visibleRef = useRef(true)\n const elementRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!active) return\n let rafId = 0\n const frame = (now: number) => {\n rafId = requestAnimationFrame(frame)\n const fps = fpsRef.current\n if (fps.lastMs === 0) {\n fps.lastMs = now\n return\n }\n const delta = Math.min(MAX_FRAME_MS, Math.max(1, now - fps.lastMs))\n fps.lastMs = now\n fps.emaMs = fps.emaMs === 0 ? delta : fps.emaMs + FPS_ALPHA * (delta - fps.emaMs)\n const currentFps = 1000 / fps.emaMs\n if (currentFps < FPS_THRESHOLD) {\n fps.healthyRun = 0\n fps.degraded = true\n } else if (fps.degraded) {\n fps.healthyRun += 1\n if (fps.healthyRun >= RECOVER_FRAMES) fps.degraded = false\n }\n }\n rafId = requestAnimationFrame(frame)\n return () => {\n cancelAnimationFrame(rafId)\n fpsRef.current = { emaMs: 0, lastMs: 0, healthyRun: 0, degraded: false }\n }\n }, [active])\n\n const ref = useCallback((element: HTMLElement | null) => {\n elementRef.current = element\n }, [])\n\n useEffect(() => {\n const element = elementRef.current\n if (element === null || typeof IntersectionObserver === 'undefined') return\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) visibleRef.current = entry.isIntersecting\n },\n { rootMargin: '120px 0px' },\n )\n observer.observe(element)\n return () => observer.disconnect()\n })\n\n const shouldHoldBack = useCallback(() => {\n return active && fpsRef.current.degraded && !visibleRef.current\n }, [active])\n\n return { ref, shouldHoldBack }\n}\n","/**\n * Conversation-port follow while an assistant reply streams.\n *\n * A sub-stepped spring physics engine drives a float `animatedH`, rather\n * than restarting native smooth-scroll animations as every glyph lands.\n * Remaining lag rides a small compositor transform while the real scrollport\n * stays at its floor. The transform is bounded by the measured paint gap\n * before conversation chrome. This follower:\n *\n * - marks programmatic writes via `data-follow-owned` for compatible hosts;\n * - sets `overflow-anchor: none` so CSS scroll-anchoring does not snap;\n * - restores `animatedH` in a ResizeObserver (before paint) so a layout\n * pass cannot flash a snapped frame;\n * - expresses safe lag as a compositor transform on message rows;\n * - opens a speed-adaptive layout runway before fast output wraps, preserving\n * the reference spring constants at every reveal speed;\n * - catches up any lag that cannot fit before turn status / composer chrome,\n * so fixed chrome never has to counter-shift and the host stays at-bottom;\n * - never clips or overlays streamed text.\n *\n * A real reader gesture receives the effective visual position before the\n * transform clears. Lifecycle completion instead settles at the floor.\n *\n * Directional wheel/touch intent unpins immediately; pointer/key input falls\n * back to an upward scroll delta from the engine's own written position. A\n * reader release re-acquires only after returning to the real floor.\n */\n\nimport { useEffect, useLayoutEffect, useRef, type RefObject } from 'react'\n\n/**\n * Programmatic follow marker retained for hosts that recognize external\n * scroll ownership. Current Harness also sees the write land at the floor.\n */\nconst FOLLOW_OWNED_ATTR = 'data-follow-owned'\n\n/** Physics parameters from `ultimate_stream_physics_scroller.html`. */\nexport const FOLLOW_SPRING_STIFFNESS = 130\nexport const FOLLOW_SPRING_DAMPING = 24\nexport const FOLLOW_SPRING_MASS = 1\nexport const FOLLOW_SPRING_SUBSTEPS = 4\nexport const FOLLOW_SPRING_MAX_STEP_MS = 32\n\n/** Minimum visible room for one ordinary line-wrap impulse. */\nexport const FOLLOW_RESERVE_MIN_PX = 16\n\n/** Reveal-speed range produced by the pressure-buffer typewriter. */\nexport const FOLLOW_RESERVE_MIN_CPS = 90\nexport const FOLLOW_RESERVE_MAX_CPS = 600\n\n/** Time constant for opening/closing predictive paint room. */\nexport const FOLLOW_RESERVE_RESPONSE_MS = 180\n\n/**\n * The reference engine clamps physical time to one 32ms visual interval.\n * Replaying a 250ms main-thread stall in one paint teleports the transcript;\n * leaving the remaining distance in the spring makes the next frames catch up\n * smoothly instead.\n */\nexport const FOLLOW_MAX_FRAME_MS = 32\n\n/** Retained as the neutral reveal-speed seed for follow hosts. */\nexport const FOLLOW_SPEED_REF_CPS = 35\n\n/** Reader-return / still-pinned boundary, matching ChatView + the demo. */\nexport const FOLLOW_SLACK_PX = 25\n\n/**\n * Fallback upward scroll distance that releases the pin when the browser does\n * not expose a directional wheel/touch event. Directional intent releases\n * immediately even if the follow write erases the small physical delta.\n */\nexport const FOLLOW_UNPIN_GESTURE_PX = 8\n\n/** A reader-released follow only re-acquires at the actual floor. */\nexport const FOLLOW_REPIN_PX = 1\n\n/** ChatView's <=25px bottom band remains host-pinned; release beyond it. */\nexport const FOLLOW_HOST_RELEASE_PX = FOLLOW_SLACK_PX + 1\n\n/** Sub-pixel paint guard before status/composer chrome. */\nexport const FOLLOW_PAINT_GUARD_PX = 1\n\n/**\n * Maximum predictive paint room before status/composer chrome. One rendered\n * line is normally 24-28px; 48px plus the host's existing status gap covers\n * the original spring's measured ~63px worst-case trail at 600cps.\n */\nexport const FOLLOW_STATUS_RUNWAY_PX = 48\n\n/** How long a gesture keeps `isUserInteracting` so the next scroll can unpin. */\nexport const FOLLOW_GESTURE_MS = 800\n\n/** Sub-pixel settle threshold; clearing below this cannot produce a visible rebound. */\nexport const FOLLOW_SETTLE_EPSILON_PX = 0.25\n\n/** Lowest reveal rate retained while the spring is short on paint room. */\nexport const FOLLOW_REVEAL_MIN_SCALE = 0.55\n\n/** Safe-lag occupancy band over which reveal pressure is progressively reduced. */\nexport const FOLLOW_BACKPRESSURE_START_RATIO = 0.25\nexport const FOLLOW_BACKPRESSURE_FULL_RATIO = 0.75\n\n/** Slow release prevents the reveal rate from oscillating around each wrap. */\nexport const FOLLOW_BACKPRESSURE_RELEASE_MS = 240\n\nconst GESTURE_EVENTS = [\n 'wheel',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'keydown',\n] as const\n\n/** Visible runway needed for the current reveal pressure. */\nexport function computeFollowReserve(speedCps: number, runwayPx = FOLLOW_STATUS_RUNWAY_PX): number {\n const available = Math.max(0, runwayPx)\n if (available <= 0) return 0\n if (speedCps <= FOLLOW_RESERVE_MIN_CPS) return 0\n const normalized = Math.min(1, Math.max(0, (\n speedCps - FOLLOW_RESERVE_MIN_CPS\n ) / (FOLLOW_RESERVE_MAX_CPS - FOLLOW_RESERVE_MIN_CPS)))\n const minimum = Math.min(available, FOLLOW_RESERVE_MIN_PX)\n return minimum + normalized * (available - minimum)\n}\n\n/**\n * Reveal-rate multiplier needed to retain one-wrap headroom for the spring.\n * Throttling starts only after a quarter of the safe transform is occupied;\n * a constrained paint lands at the minimum immediately so the next reveal\n * commit cannot keep feeding an already-full visual buffer.\n */\nexport function computeFollowRevealScale(\n lagPx: number,\n capacityPx: number,\n constrained = false,\n): number {\n if (constrained) return FOLLOW_REVEAL_MIN_SCALE\n if (!Number.isFinite(capacityPx)) return 1\n if (capacityPx <= 0) return lagPx > 0 ? FOLLOW_REVEAL_MIN_SCALE : 1\n const ratio = Math.min(1, Math.max(0, lagPx / capacityPx))\n if (ratio >= FOLLOW_BACKPRESSURE_FULL_RATIO) return FOLLOW_REVEAL_MIN_SCALE\n const progress = Math.min(1, Math.max(0, (\n ratio - FOLLOW_BACKPRESSURE_START_RATIO\n ) / (FOLLOW_BACKPRESSURE_FULL_RATIO - FOLLOW_BACKPRESSURE_START_RATIO)))\n const eased = progress * progress * (3 - 2 * progress)\n return 1 - (1 - FOLLOW_REVEAL_MIN_SCALE) * eased\n}\n\nexport interface FollowGlideInput {\n /** How far the interpolated top trails the floor, in px. */\n readonly lag: number\n /** Observed reveal rate, retained for the public follow-step contract. */\n readonly speedEma: number\n /** Physics velocity carried from the previous frame, in px/s. */\n readonly velocityPxPerSec?: number\n}\n\nexport interface FollowGlideStep {\n /** Pixels to advance the floating content extent this frame. */\n readonly advancePx: number\n /** Applied lerp fraction, for tests. */\n readonly lerpStep: number\n /** Physics velocity to carry into the next frame, in px/s. */\n readonly velocityPxPerSec: number\n}\n\n/**\n * Semi-implicit spring integration with four substeps per <=32ms slice.\n * @param dtMs - Frame delta in ms.\n * @param input - Current visible lag and carried physics velocity.\n * @returns The position advance, its fraction, and next velocity.\n */\nexport function computeFollowStep(dtMs: number, input: FollowGlideInput): FollowGlideStep {\n if (input.lag <= 0.1 || dtMs <= 0) {\n return { advancePx: 0, lerpStep: 0, velocityPxPerSec: 0 }\n }\n let lag = input.lag\n let velocity = Math.max(0, input.velocityPxPerSec ?? 0)\n const elapsedMs = Math.min(FOLLOW_MAX_FRAME_MS, dtMs)\n const slices = Math.max(1, Math.ceil(elapsedMs / FOLLOW_SPRING_MAX_STEP_MS))\n const subDt = elapsedMs / 1000 / slices / FOLLOW_SPRING_SUBSTEPS\n\n for (let slice = 0; slice < slices; slice += 1) {\n for (let substep = 0; substep < FOLLOW_SPRING_SUBSTEPS; substep += 1) {\n const acceleration = (\n FOLLOW_SPRING_STIFFNESS * lag - FOLLOW_SPRING_DAMPING * velocity\n ) / FOLLOW_SPRING_MASS\n velocity = Math.max(0, velocity + acceleration * subDt)\n const advance = velocity * subDt\n if (advance >= lag) {\n return { advancePx: input.lag, lerpStep: 1, velocityPxPerSec: 0 }\n }\n lag -= advance\n }\n }\n\n const advancePx = input.lag - lag\n return { advancePx, lerpStep: advancePx / input.lag, velocityPxPerSec: velocity }\n}\n\n/** Element whose resize signals flow growth for the before-paint restore. */\nfunction resizeProxyOf(port: HTMLElement): HTMLElement | null {\n return port.querySelector('[data-chat-transcript]') ?? port.querySelector('[data-chat-flow]')\n}\n\n/** Outermost message surfaces; nested tool rows ride their parent. */\nfunction shiftSurfacesOf(port: HTMLElement): HTMLElement[] {\n const transcript = port.querySelector<HTMLElement>('[data-chat-transcript]')\n if (transcript !== null) return [transcript]\n return [...port.querySelectorAll<HTMLElement>('[data-chat-anchor-key]')]\n .filter(row => row.parentElement?.closest('[data-chat-anchor-key]') === null)\n}\n\nfunction currentShiftOf(element: HTMLElement): number {\n return Number(\n /translate3d\\(0(?:px)?,\\s*(-?[\\d.]+)px,\\s*0(?:px)?\\)/.exec(element.style.transform)?.[1] ?? 0,\n )\n}\n\nfunction setShift(element: HTMLElement, px: number): void {\n if (Math.abs(px) > 0.01) {\n if (\n Math.abs(currentShiftOf(element) - px) <= 0.01\n && element.style.willChange === 'transform'\n && element.style.clipPath === ''\n ) {\n return\n }\n element.style.transform = `translate3d(0, ${px}px, 0)`\n element.style.willChange = 'transform'\n } else {\n if (element.style.transform === '' && element.style.willChange === '' && element.style.clipPath === '') return\n element.style.transform = ''\n element.style.willChange = ''\n }\n // Remove paint state left by v0.3.2 and earlier experimental builds.\n element.style.clipPath = ''\n}\n\nfunction turnStatusOf(port: HTMLElement): HTMLElement | null {\n return port.querySelector<HTMLElement>(\n '[data-chat-turn-status], [data-chat-flow] > [role=\"status\"]',\n )\n}\n\n/** Height committed by one newly mounted Chat row, including its flex gap. */\nfunction entranceExtentOf(root: HTMLElement): number {\n const row = root.closest<HTMLElement>('[data-chat-flow-key]') ?? root\n const rect = row.getBoundingClientRect()\n const height = Math.max(0, rect.height, rect.bottom - rect.top, row.offsetHeight)\n let previous = row.previousElementSibling\n while (previous instanceof HTMLElement) {\n const previousRect = previous.getBoundingClientRect()\n if (previousRect.height > 0 || previousRect.bottom > previousRect.top) {\n return Math.max(height, rect.bottom - previousRect.bottom)\n }\n previous = previous.previousElementSibling\n }\n return height\n}\n\ninterface FollowRunway {\n readonly element: HTMLElement\n readonly offset: number\n readonly original: string\n readonly property: 'marginBottom' | 'marginTop'\n}\n\nconst followRunways = new WeakMap<HTMLElement, FollowRunway>()\n\ninterface FollowPaintLimit {\n readonly clientHeight: number\n readonly limit: number\n readonly measuredAtMs: number\n readonly composer: HTMLElement | null\n readonly status: HTMLElement | null\n readonly surface: HTMLElement | undefined\n}\n\n/**\n * A rect read can force a layout flush. At the floor the flow bottom sits on\n * the scrollport bottom, so while content streams the paint limit (chrome top\n * minus flow bottom) is constant; it only truly changes when the viewport or\n * conversation chrome changes. A measured limit therefore stays trusted for\n * this long even as contentHeight grows, so ordinary glyph frames never pay\n * a forced layout.\n */\nexport const FOLLOW_PAINT_LIMIT_TTL_MS = 250\n\nconst followPaintLimits = new WeakMap<HTMLElement, FollowPaintLimit>()\n\nfunction invalidatePaintLimit(port: HTMLElement): void {\n followPaintLimits.delete(port)\n}\n\ninterface FollowMotionState {\n readonly capacityPx: number\n readonly constrained: boolean\n readonly extent: number\n readonly lagPx: number\n readonly reservePx: number\n readonly velocityPxPerSec: number\n}\n\n/** Logical position and velocity survive a React owner handoff and finish. */\nconst followMotionStates = new WeakMap<HTMLElement, FollowMotionState>()\n\nfunction restoreRunway(port: HTMLElement): void {\n const runway = followRunways.get(port)\n if (runway === undefined) return\n runway.element.style[runway.property] = runway.original\n followRunways.delete(port)\n invalidatePaintLimit(port)\n}\n\nfunction ensureRunway(port: HTMLElement, surfaces: readonly HTMLElement[]): void {\n const status = turnStatusOf(port)\n const composer = port.querySelector<HTMLElement>('[data-composer-seat]')\n const target = status === null\n ? { element: composer === null ? undefined : surfaces.at(-1), property: 'marginBottom' as const }\n : { element: status, property: 'marginTop' as const }\n if (target.element === undefined) {\n restoreRunway(port)\n return\n }\n const element = target.element\n const current = followRunways.get(port)\n if (current?.element === element && current.property === target.property) return\n restoreRunway(port)\n const beforeHeight = port.scrollHeight\n const original = element.style[target.property]\n element.style[target.property] = original === ''\n ? `${FOLLOW_STATUS_RUNWAY_PX}px`\n : `calc(${original} + ${FOLLOW_STATUS_RUNWAY_PX}px)`\n const offset = Math.max(0, port.scrollHeight - beforeHeight)\n followRunways.set(port, { element, offset, property: target.property, original })\n invalidatePaintLimit(port)\n}\n\nfunction runwayOffsetOf(port: HTMLElement): number {\n return followRunways.get(port)?.offset ?? 0\n}\n\n/** Available paint room below the last message before fixed conversation chrome. */\nfunction safeShiftLimit(\n port: HTMLElement,\n surfaces: readonly HTMLElement[],\n): number {\n const last = surfaces.at(-1)\n if (last === undefined) return 0\n const status = turnStatusOf(port)\n const composer = port.querySelector<HTMLElement>('[data-composer-seat]')\n const cached = followPaintLimits.get(port)\n // Content growth alone cannot move the limit (measured at the floor, the\n // flow bottom rides the scrollport bottom), so the cache survives glyph\n // frames and only chrome/viewport changes or the TTL force a re-measure.\n if (\n cached !== undefined\n && performance.now() - cached.measuredAtMs <= FOLLOW_PAINT_LIMIT_TTL_MS\n && cached.clientHeight === port.clientHeight\n && cached.surface === last\n && cached.status === status\n && cached.composer === composer\n ) return cached.limit\n const ceiling = [status, composer]\n .filter((element): element is HTMLElement => element !== null)\n .map(element => ({ element, rect: element.getBoundingClientRect() }))\n // A detached or still-unmeasured sticky seat returns an all-zero rect.\n // It cannot constrain paint yet; a real seat at viewport top remains\n // valid because its bottom is still below its top.\n .filter(({ rect }) => Number.isFinite(rect.top) && Number.isFinite(rect.bottom) && rect.bottom > rect.top)\n .sort((first, second) => first.rect.top - second.rect.top)[0]\n if (ceiling === undefined) {\n // No conversation chrome means there is nothing to overlap. If chrome is\n // mounted but has not measured yet, permit only the runway zero-point\n // until ResizeObserver provides a real ceiling.\n return status === null && composer === null\n ? Number.POSITIVE_INFINITY\n : runwayOffsetOf(port)\n }\n const ceilingTop = ceiling.rect.top - currentShiftOf(ceiling.element)\n const naturalBottom = last.getBoundingClientRect().bottom - currentShiftOf(last)\n const limit = Math.max(0, ceilingTop - naturalBottom - FOLLOW_PAINT_GUARD_PX)\n followPaintLimits.set(port, {\n clientHeight: port.clientHeight,\n limit,\n measuredAtMs: performance.now(),\n composer,\n status,\n surface: last,\n })\n return limit\n}\n\nfunction setFollowScrollTop(port: HTMLElement, nextTop: number): void {\n if (Math.abs(port.scrollTop - nextTop) > 0.01) port.scrollTop = nextTop\n followScrollLedgers.set(port, port.scrollTop)\n const ownedTop = String(port.scrollTop)\n if (port.getAttribute(FOLLOW_OWNED_ATTR) !== ownedTop) {\n port.setAttribute(FOLLOW_OWNED_ATTR, ownedTop)\n }\n}\n\n/**\n * Last scrollTop this engine wrote or accepted, per port. Reader intent is a\n * real upward delta from this ledger; a key press or touch while pinned\n * (typing in the composer) must not release the pin, because a released pin\n * can never re-acquire while content streams away from the reader position.\n */\nconst followScrollLedgers = new WeakMap<HTMLElement, number>()\nconst followActivityAt = new WeakMap<HTMLElement, number>()\n\n/** Whether this port was owned recently enough to identify a closing tail row. */\nexport function hasRecentConversationFollow(port: HTMLElement, windowMs = 250): boolean {\n const last = followActivityAt.get(port)\n return last !== undefined && performance.now() - last <= windowMs\n}\n\nfunction readerScrolledUp(port: HTMLElement): boolean {\n return port.scrollTop < (followScrollLedgers.get(port) ?? 0) - FOLLOW_UNPIN_GESTURE_PX\n}\n\n/**\n * Paint a bounded visual lag and return the effective logical extent.\n *\n * This is the final geometry invariant, not merely an animation preference:\n * any lag beyond the real gap to status/composer chrome is caught up in the\n * same frame. Carrying that excess in `scrollTop` would move the transcript\n * toward fixed chrome and also make the host expose jump-to-bottom.\n */\nfunction applyVisual(\n port: HTMLElement,\n animatedH: number,\n reservePx: number,\n velocityPxPerSec = 0,\n): number {\n const surfaces = shiftSurfacesOf(port)\n ensureRunway(port, surfaces)\n const contentHeight = Math.max(0, port.scrollHeight)\n const runwayOffset = runwayOffsetOf(port)\n const targetHeight = Math.max(0, contentHeight - runwayOffset)\n const floor = Math.max(0, contentHeight - port.clientHeight)\n const extent = Math.min(targetHeight, Math.max(0, animatedH))\n if (port.style.overflowAnchor !== 'none') port.style.overflowAnchor = 'none'\n if (port.style.scrollBehavior !== 'auto') port.style.scrollBehavior = 'auto'\n if (floor <= 0) {\n setFollowScrollTop(port, 0)\n followMotionStates.set(port, {\n capacityPx: Number.POSITIVE_INFINITY,\n constrained: false,\n extent: targetHeight,\n lagPx: 0,\n reservePx: 0,\n velocityPxPerSec: 0,\n })\n for (const surface of surfaces) setShift(surface, 0)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n return targetHeight\n }\n // Measure paint room at the real floor. This write and the final physical\n // position land in the same animation frame, so only the latter is painted.\n setFollowScrollTop(port, floor)\n const limit = floor > 0 ? safeShiftLimit(port, surfaces) : 0\n const visibleReserve = Math.min(runwayOffset, Math.max(0, reservePx))\n const baselineShift = runwayOffset - visibleReserve\n const requestedLag = Math.max(0, targetHeight - extent)\n const shift = Math.min(baselineShift + requestedLag, Math.max(0, limit))\n const effectiveLag = Math.max(0, shift - baselineShift)\n const capacityPx = Math.max(0, limit - baselineShift)\n const effectiveExtent = targetHeight - effectiveLag\n followMotionStates.set(port, {\n capacityPx,\n constrained: requestedLag > effectiveLag + FOLLOW_SETTLE_EPSILON_PX,\n extent: effectiveExtent,\n lagPx: effectiveLag,\n reservePx: visibleReserve,\n velocityPxPerSec,\n })\n for (const surface of surfaces) setShift(surface, shift)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n return effectiveExtent\n}\n\nfunction clearMotion(port: HTMLElement): void {\n port.removeAttribute(FOLLOW_OWNED_ATTR)\n port.style.overflowAnchor = ''\n port.style.scrollBehavior = ''\n for (const surface of shiftSurfacesOf(port)) setShift(surface, 0)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n}\n\nfunction clearVisual(port: HTMLElement): void {\n clearMotion(port)\n restoreRunway(port)\n followMotionStates.delete(port)\n invalidatePaintLimit(port)\n}\n\n/** Keep an already-promoted surface at zero until one stable final paint lands. */\nfunction holdCompositorAtRest(element: HTMLElement): void {\n element.style.transform = 'translate3d(0, 0px, 0)'\n element.style.willChange = 'transform'\n element.style.clipPath = ''\n}\n\n/** Remove equal offsets, land on the floor, then retire the compositor quietly. */\nfunction finishAtNaturalFloor(port: HTMLElement): void {\n const surfaces = shiftSurfacesOf(port)\n const status = turnStatusOf(port)\n const promoted = [...surfaces, ...(status === null ? [] : [status])]\n .filter(element => element.style.transform !== '' || element.style.willChange === 'transform')\n const promotedSet = new Set(promoted)\n restoreRunway(port)\n settleAtFloor(port)\n port.removeAttribute(FOLLOW_OWNED_ATTR)\n port.style.overflowAnchor = ''\n port.style.scrollBehavior = ''\n for (const surface of surfaces) {\n if (promotedSet.has(surface)) holdCompositorAtRest(surface)\n else setShift(surface, 0)\n }\n if (status !== null) {\n if (promotedSet.has(status)) holdCompositorAtRest(status)\n else setShift(status, 0)\n }\n followMotionStates.delete(port)\n if (promoted.length === 0) return\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (port.hasAttribute(FOLLOW_OWNED_ATTR)) return\n for (const element of promoted) {\n if (Math.abs(currentShiftOf(element)) <= 0.01) setShift(element, 0)\n }\n })\n })\n}\n\nfunction settleAtFloor(port: HTMLElement): void {\n const floor = Math.max(0, port.scrollHeight - port.clientHeight)\n setFollowScrollTop(port, floor)\n}\n\ninterface FollowLeader {\n readonly generation: number\n readonly owner: object\n}\n\n/** Only the newest active follower may write one port's shared visual state. */\nconst followLeaders = new WeakMap<HTMLElement, FollowLeader>()\nlet followGeneration = 0\n\n/**\n * Own the conversation scrollport's bottom-follow while `active` is true.\n *\n * @param rootRef - An element inside the conversation scrollport.\n * @param active - True while the reply is still revealing.\n * @param speedCpsRef - Live reveal-rate EMA from the smoother.\n * @param revealScaleRef - Optional backpressure control for text reveal.\n * @param predictive - Whether to reserve paint room ahead of growth.\n * @param entrance - Whether the first committed row height should glide in.\n * @param onEntranceSettled - Releases a one-shot entrance owner after catch-up.\n * @param predictiveRef - Optional live visibility gate for predictive runway.\n * @param entranceExtentRef - Optional measured growth delta for a generic row.\n */\nexport function useConversationFollow(\n rootRef: RefObject<HTMLElement | null>,\n active: boolean,\n speedCpsRef: { current: number },\n revealScaleRef?: { current: number },\n predictive = true,\n entrance = false,\n onEntranceSettled?: () => void,\n predictiveRef?: { current: boolean },\n entranceExtentRef?: { current: number | null },\n): void {\n const activeRef = useRef(active)\n const entranceRef = useRef(entrance)\n const onEntranceSettledRef = useRef(onEntranceSettled)\n entranceRef.current = entrance\n onEntranceSettledRef.current = onEntranceSettled\n useEffect(() => {\n activeRef.current = active\n }, [active])\n\n useLayoutEffect(() => {\n if (!active) return\n const owner = {}\n const generation = ++followGeneration\n let rafId = 0\n let last = performance.now()\n let following = true\n let primed = false\n let animatedH = 0\n let reservePx = 0\n let velocityPxPerSec = 0\n let interacting = false\n let readerGestureIntent = false\n let readerReleased = false\n let touchStartY: number | null = null\n let interactTimer: ReturnType<typeof setTimeout> | null = null\n let port: HTMLElement | null = null\n let resize: ResizeObserver | null = null\n let holding: HTMLElement | null = null\n let entrancePending = entranceRef.current\n\n const finishEntrance = (): void => {\n if (!entrancePending) return\n entrancePending = false\n onEntranceSettledRef.current?.()\n }\n\n const updateRevealScale = (next: HTMLElement, elapsedMs: number, urgent = false): void => {\n if (revealScaleRef === undefined) return\n const state = followMotionStates.get(next)\n const target = state === undefined\n ? 1\n : computeFollowRevealScale(state.lagPx, state.capacityPx, state.constrained)\n const current = Math.min(1, Math.max(FOLLOW_REVEAL_MIN_SCALE, revealScaleRef.current))\n if (target < current || urgent) {\n // Slowing affects only future glyph commits, so it can react at once\n // without producing a visual discontinuity in the current frame.\n revealScaleRef.current = Math.min(current, target)\n return\n }\n const releaseStep = 1 - Math.exp(-Math.max(0, elapsedMs) / FOLLOW_BACKPRESSURE_RELEASE_MS)\n revealScaleRef.current = current + (target - current) * releaseStep\n }\n\n const releaseRevealScale = (): void => {\n if (revealScaleRef !== undefined) revealScaleRef.current = 1\n }\n\n const isLeader = (next: HTMLElement): boolean => followLeaders.get(next)?.owner === owner\n\n const hold = (next: HTMLElement): void => {\n followActivityAt.set(next, performance.now())\n if (holding === next && isLeader(next)) return\n holding = next\n const leader = followLeaders.get(next)\n if (leader === undefined || generation > leader.generation) {\n followLeaders.set(next, { generation, owner })\n }\n }\n\n const drop = (next: HTMLElement): void => {\n if (holding === next) holding = null\n if (isLeader(next)) {\n clearMotion(next)\n followMotionStates.delete(next)\n releaseRevealScale()\n }\n }\n\n const handBackVisual = (next: HTMLElement): void => {\n const shift = currentShiftOf(shiftSurfacesOf(next).at(-1) ?? next)\n const visualTop = Math.max(0, next.scrollTop - Math.max(0, shift))\n const floor = Math.max(0, next.scrollHeight - next.clientHeight)\n // The host keeps its own bottom-follow bit while the reader remains in\n // its 25px slack band. Land one pixel beyond that band so even a light\n // wheel/trackpad/touch intent releases both owners on the same frame.\n next.scrollTop = Math.min(visualTop, Math.max(0, floor - FOLLOW_HOST_RELEASE_PX))\n followScrollLedgers.set(next, next.scrollTop)\n }\n\n const markGesture = (event: Event): void => {\n interacting = true\n if (event.type === 'wheel') {\n const deltaY = (event as WheelEvent).deltaY\n if (Number.isFinite(deltaY) && deltaY < 0) readerGestureIntent = true\n } else if (event.type === 'touchstart') {\n const touch = (event as TouchEvent).touches[0]\n touchStartY = touch?.clientY ?? null\n } else if (event.type === 'touchmove') {\n const touch = (event as TouchEvent).touches[0]\n if (touch !== undefined) {\n if (touchStartY === null) touchStartY = touch.clientY\n // A downward finger drag moves the transcript toward older content.\n if (touch.clientY - touchStartY > 1) readerGestureIntent = true\n }\n } else if (event.type === 'touchend' || event.type === 'touchcancel') {\n touchStartY = null\n }\n if (interactTimer !== null) clearTimeout(interactTimer)\n interactTimer = setTimeout(() => {\n interacting = false\n readerGestureIntent = false\n interactTimer = null\n }, FOLLOW_GESTURE_MS)\n }\n\n const restoreBeforePaint = (): void => {\n if (!following || port === null || !isLeader(port)) return\n invalidatePaintLimit(port)\n animatedH = applyVisual(port, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(port, 0, true)\n }\n\n const bindPort = (next: HTMLElement): void => {\n if (port === next) return\n if (port !== null) {\n for (const name of GESTURE_EVENTS) port.removeEventListener(name, markGesture)\n resize?.disconnect()\n }\n port = next\n invalidatePaintLimit(port)\n for (const name of GESTURE_EVENTS) {\n port.addEventListener(name, markGesture, { passive: true })\n }\n if (typeof ResizeObserver !== 'undefined') {\n resize = new ResizeObserver(restoreBeforePaint)\n resize.observe(port)\n const proxy = resizeProxyOf(port)\n if (proxy !== null) resize.observe(proxy)\n }\n }\n\n const frame = (now: number) => {\n rafId = requestAnimationFrame(frame)\n // Spring time is clamped so one paint after a stall cannot teleport the\n // transcript. Runway response uses real elapsed time, otherwise long\n // frames would open paint room more slowly precisely when it is needed.\n const elapsedMs = Math.max(0.001, now - last)\n const dt = Math.min(FOLLOW_MAX_FRAME_MS, elapsedMs)\n last = now\n const root = rootRef.current\n if (root === null) return\n const nextPort = root.closest<HTMLElement>('[data-conversation-scroll]')\n if (nextPort === null) return\n bindPort(nextPort)\n // A hidden/unmeasured port has no meaningful floor yet. Keep this owner\n // unprimed and let the already-scheduled RAF initialize it after layout.\n if (nextPort.clientHeight <= 0) return\n\n const floor = Math.max(0, nextPort.scrollHeight - nextPort.clientHeight)\n const reportedLag = floor - nextPort.scrollTop\n const extent = Math.min(\n nextPort.scrollHeight,\n Math.max(0, nextPort.scrollHeight - reportedLag),\n )\n\n if (!primed) {\n const inherited = nextPort.hasAttribute(FOLLOW_OWNED_ATTR)\n ? followMotionStates.get(nextPort)\n : undefined\n if (inherited === undefined) {\n // A new Agent row is already part of scrollHeight on its first\n // frame. Start at the pre-insert extent so that initial Context and\n // Tool chrome enters through the same spring as later height growth.\n const entranceExtent = entrancePending\n ? entranceExtentRef?.current ?? entranceExtentOf(root)\n : 0\n animatedH = Math.max(0, nextPort.scrollHeight - entranceExtent)\n reservePx = 0\n velocityPxPerSec = 0\n // The committed row/growth delta has already moved the new floor.\n // Decide ownership from the reader's position before that delta;\n // otherwise any atomic result taller than FOLLOW_SLACK_PX looks\n // indistinguishable from an intentional reader pull-up.\n const lagBeforeEntrance = Math.max(0, reportedLag - entranceExtent)\n following = lagBeforeEntrance <= FOLLOW_SLACK_PX\n } else {\n animatedH = Math.min(nextPort.scrollHeight, inherited.extent)\n reservePx = inherited.reservePx\n velocityPxPerSec = inherited.velocityPxPerSec\n following = true\n }\n if (following) {\n hold(nextPort)\n if (isLeader(nextPort)) {\n animatedH = applyVisual(nextPort, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(nextPort, elapsedMs)\n const runwayOffset = runwayOffsetOf(nextPort)\n const entranceLag = Math.max(0, nextPort.scrollHeight - animatedH - runwayOffset)\n if (entranceLag <= FOLLOW_SETTLE_EPSILON_PX) finishEntrance()\n } else {\n finishEntrance()\n }\n } else {\n finishEntrance()\n }\n primed = true\n return\n }\n\n const repinSlack = readerReleased ? FOLLOW_REPIN_PX : FOLLOW_SLACK_PX\n if (!following && !interacting && reportedLag <= repinSlack) {\n following = true\n readerReleased = false\n animatedH = extent\n reservePx = 0\n velocityPxPerSec = 0\n followScrollLedgers.set(nextPort, nextPort.scrollTop)\n hold(nextPort)\n } else if (following && interacting && (readerGestureIntent || readerScrolledUp(nextPort))) {\n // Directional wheel/touch intent is authoritative even when automatic\n // follow has already overwritten the small physical scroll delta.\n following = false\n readerGestureIntent = false\n readerReleased = true\n handBackVisual(nextPort)\n animatedH = nextPort.scrollHeight\n reservePx = 0\n velocityPxPerSec = 0\n drop(nextPort)\n finishEntrance()\n }\n\n if (!activeRef.current || !following) {\n followScrollLedgers.set(nextPort, nextPort.scrollTop)\n return\n }\n hold(nextPort)\n if (!isLeader(nextPort)) {\n finishEntrance()\n return\n }\n\n // Runway and an equal transform cancel visually. It is the zero point,\n // not residual motion: decaying below it would scroll past the final\n // resting position and rebound when runway is removed.\n const runwayOffset = runwayOffsetOf(nextPort)\n const contentHeight = nextPort.scrollHeight\n const lag = Math.max(0, contentHeight - animatedH - runwayOffset)\n const predictGrowth = predictiveRef?.current ?? predictive\n const reserveTarget = !predictGrowth\n ? 0\n : computeFollowReserve(speedCpsRef.current, runwayOffset)\n const reserveStep = 1 - Math.exp(-elapsedMs / FOLLOW_RESERVE_RESPONSE_MS)\n reservePx += (reserveTarget - reservePx) * reserveStep\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n })\n if (lag <= 0.1) {\n animatedH = contentHeight - runwayOffset\n velocityPxPerSec = 0\n } else {\n const minimumLag = predictGrowth ? 0 : Math.max(0, reservePx)\n animatedH = Math.min(\n contentHeight - runwayOffset - minimumLag,\n animatedH + step.advancePx,\n )\n velocityPxPerSec = step.velocityPxPerSec\n }\n animatedH = applyVisual(nextPort, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(nextPort, elapsedMs)\n const remainingEntranceLag = Math.max(\n 0,\n nextPort.scrollHeight - animatedH - runwayOffsetOf(nextPort),\n )\n if (remainingEntranceLag <= FOLLOW_SETTLE_EPSILON_PX) finishEntrance()\n }\n\n // Prime ownership and the final committed height in this layout phase.\n // A producer-complete text arm can mount and drain before the next RAF;\n // deferring this first pass would let it unmount unprimed after replacing\n // the previous owner, leaving a large final append at the old scrollTop.\n frame(performance.now())\n return () => {\n cancelAnimationFrame(rafId)\n if (interactTimer !== null) clearTimeout(interactTimer)\n resize?.disconnect()\n if (port !== null) {\n for (const name of GESTURE_EVENTS) port.removeEventListener(name, markGesture)\n }\n const root = rootRef.current\n const host = root?.closest<HTMLElement>('[data-conversation-scroll]') ?? port\n if (host === null) return\n holding = null\n if (!isLeader(host)) return\n const preserveReader = interacting && (readerGestureIntent || readerScrolledUp(host))\n if (!following || !primed) {\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n if (preserveReader) {\n handBackVisual(host)\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n\n // Completion can land the final Tool/command height in this same\n // commit. Preserve the logical extent and drain it after unmount instead\n // of clearing the compositor state before the first settled paint.\n ensureRunway(host, shiftSurfacesOf(host))\n const completionRunway = runwayOffsetOf(host)\n const completionMinimumLag = Math.max(0, reservePx)\n animatedH = Math.min(\n animatedH,\n host.scrollHeight - completionRunway - completionMinimumLag,\n )\n settleAtFloor(host)\n animatedH = applyVisual(host, animatedH, reservePx, velocityPxPerSec)\n const runwayOffset = runwayOffsetOf(host)\n const remainingLag = Math.max(0, host.scrollHeight - animatedH - runwayOffset)\n if (remainingLag <= FOLLOW_SETTLE_EPSILON_PX && reservePx <= FOLLOW_SETTLE_EPSILON_PX) {\n finishAtNaturalFloor(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n\n for (const name of GESTURE_EVENTS) {\n host.addEventListener(name, markGesture, { passive: true })\n }\n const stopSettleListeners = (): void => {\n for (const name of GESTURE_EVENTS) host.removeEventListener(name, markGesture)\n if (interactTimer !== null) {\n clearTimeout(interactTimer)\n interactTimer = null\n }\n }\n let settleLast = performance.now()\n const settleFrame = (now: number): void => {\n if (!isLeader(host)) {\n stopSettleListeners()\n return\n }\n if (interacting && (readerGestureIntent || readerScrolledUp(host))) {\n readerGestureIntent = false\n handBackVisual(host)\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n stopSettleListeners()\n return\n }\n const dt = Math.min(FOLLOW_MAX_FRAME_MS, Math.max(0, now - settleLast))\n settleLast = now\n const runwayOffset = runwayOffsetOf(host)\n const lag = Math.max(0, host.scrollHeight - animatedH - runwayOffset)\n const reserveStep = 1 - Math.exp(-dt / FOLLOW_RESERVE_RESPONSE_MS)\n reservePx += (0 - reservePx) * reserveStep\n if (lag <= FOLLOW_SETTLE_EPSILON_PX && reservePx <= FOLLOW_SETTLE_EPSILON_PX) {\n animatedH = host.scrollHeight - runwayOffset\n reservePx = 0\n velocityPxPerSec = 0\n finishAtNaturalFloor(host)\n followLeaders.delete(host)\n releaseRevealScale()\n stopSettleListeners()\n return\n }\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n })\n // The temporary runway is visually neutral only while an equal lag\n // remains in the transform. Do not let the spring outrun the runway's\n // closing reserve or cleanup would reveal an overshoot and rebound.\n const minimumLag = Math.max(0, reservePx)\n animatedH = Math.min(\n host.scrollHeight - runwayOffset - minimumLag,\n animatedH + step.advancePx,\n )\n velocityPxPerSec = step.velocityPxPerSec\n settleAtFloor(host)\n animatedH = applyVisual(host, animatedH, reservePx, velocityPxPerSec)\n requestAnimationFrame(settleFrame)\n }\n requestAnimationFrame(settleFrame)\n }\n }, [active, rootRef, speedCpsRef, revealScaleRef, predictive, predictiveRef])\n}\n","import { useEffect, useRef, type ReactNode } from 'react'\nimport { useConversationFollow } from './teleprompterGlide.ts'\nimport css from './TypewriterAssistantNodeView.module.css'\n\n/**\n * Document-flow host that owns conversation-port follow while `active`.\n * Shared by assistant blocks and every other Agent Chat row. `onGrowth` lets\n * generic wrapped renderers re-arm one glide when their DOM grows without\n * requiring a business-kind-specific lifecycle predicate.\n */\nexport function FollowHost({\n active,\n entrance = false,\n onEntranceSettled,\n onGrowth,\n entranceExtentRef,\n speedCpsRef,\n revealScaleRef,\n predictive = true,\n predictiveRef,\n hostRef,\n children,\n}: {\n active: boolean\n entrance?: boolean\n onEntranceSettled?: (() => void) | undefined\n onGrowth?: ((deltaPx: number) => void) | undefined\n entranceExtentRef?: { current: number | null } | undefined\n speedCpsRef: { current: number }\n revealScaleRef?: { current: number } | undefined\n predictive?: boolean\n predictiveRef?: { current: boolean } | undefined\n hostRef?: { current: HTMLDivElement | null } | undefined\n children: ReactNode\n}) {\n const localRootRef = useRef<HTMLDivElement>(null)\n const rootRef = hostRef ?? localRootRef\n useConversationFollow(\n rootRef,\n active || entrance,\n speedCpsRef,\n revealScaleRef,\n predictive,\n entrance,\n onEntranceSettled,\n predictiveRef,\n entranceExtentRef,\n )\n useEffect(() => {\n if (onGrowth === undefined || typeof ResizeObserver === 'undefined') return\n const root = rootRef.current\n if (root === null) return\n let previousHeight: number | null = null\n const observer = new ResizeObserver(entries => {\n const nextHeight = entries[0]?.contentRect.height ?? root.getBoundingClientRect().height\n if (!Number.isFinite(nextHeight)) return\n if (previousHeight !== null && nextHeight > previousHeight + 0.5) {\n onGrowth(nextHeight - previousHeight)\n }\n previousHeight = nextHeight\n })\n observer.observe(root)\n return () => { observer.disconnect() }\n }, [onGrowth])\n return <div ref={rootRef} className={css.follow}>{children}</div>\n}\n","/**\n * Shared plugin configuration contract. The Host half defines the\n * Schemastery schema over this shape (defaults live here so both halves stay\n * symmetric); the client half falls back to the same defaults when the Host\n * boot-config bridge is absent (client-only composition).\n */\n\nimport type { StreamSmoothingPreset } from './client/useSmoothStreamContent.ts'\n\n/** Legacy render-mode value retained so existing overlays remain valid. */\nexport type StreamMode = 'typewriter' | 'teleprompter'\n\n/** Plugin configuration validated by the Host schema and bridged to the browser half. */\nexport interface StreamConfig {\n /** Compatibility field; both values use the current adaptive reveal engine. */\n readonly mode: StreamMode\n /** Smoothing preset for the reveal cadence. */\n readonly preset: StreamSmoothingPreset\n /**\n * Unused at runtime; kept so existing overlays load. Live reveal tracks\n * observed arrival and ignores this seed.\n */\n readonly revealCharsPerSec: number\n /**\n * Unused at runtime; kept so existing overlays load. Follow is a\n * smooth-damp, not a cruise speed.\n */\n readonly scrollSpeedPxPerSec: number\n /** Unused at runtime; retained so existing overlays continue to load. */\n readonly maxScrollSpeedPxPerSec: number\n}\n\n/** Defaults shared by the Host schema and the client-side fallback. */\nexport const DEFAULT_STREAM_CONFIG: StreamConfig = {\n mode: 'typewriter',\n preset: 'balanced',\n revealCharsPerSec: 80,\n scrollSpeedPxPerSec: 48,\n maxScrollSpeedPxPerSec: 1000,\n}\n\n/**\n * Window global the Host writes into the served index HTML. The browser boot\n * graph carries no per-entry config, so this inline script is the only\n * Host-to-client configuration channel for a composed web plugin.\n */\nexport const STREAM_BOOT_GLOBAL = '__DSH_SMOOTH_STREAM_CONFIG__'\n","/**\n * User-owned settings for the smooth-stream plugin, exposed to the Host\n * settings service and edited from the Web Settings \"plugin configuration\"\n * page. This is the runtime-editable complement to {@link StreamConfig}: that\n * contract is composed at load and bridged once through the boot global, while\n * these preferences live in the durable user-settings document and take effect\n * live.\n */\n\n/** Settings namespace registered by the Host and served through the plugin RPC. */\nexport const STREAM_SETTINGS_NS = 'smooth-stream'\n\n/**\n * Preferences a user may set. Deliberately separate from {@link StreamConfig}\n * because the two change at different times: composition-time values go\n * through the boot global, a live UI edit goes through the protected plugin RPC.\n */\nexport interface StreamSettings {\n /**\n * Whether a reasoning (\"Think\") block auto-expands while it is the\n * streaming tail. Off keeps the block collapsed — the user can still open\n * it by hand — and stops the running state from re-owning the disclosure.\n */\n thinkAutoExpand: boolean\n}\n\n/** Defaults shared by the Host schema and the client-side fallback. */\nexport const DEFAULT_STREAM_SETTINGS: StreamSettings = {\n thinkAutoExpand: true,\n}\n","import { memo, useEffect, useLayoutEffect, useMemo, useRef, useState, type ComponentProps, type ReactNode } from 'react'\nimport { IconThinkOutline14, JsonBlock, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ImageGallery, type ImageLoader, type MessageImageLabels } from '@deepseek-ai/dsh-client-ui-attachment'\nimport type { ChatNodeViewProps, TurnTailOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { AnimatedDisclosure } from './AnimatedDisclosure.tsx'\nimport { useSmoothStreamContent, type StreamSmoothingPreset } from './useSmoothStreamContent.ts'\nimport { useFpsGuard } from './useFpsGuard.ts'\nimport { FollowHost } from './FollowHost.tsx'\nimport { DEFAULT_STREAM_CONFIG, type StreamMode } from '../config.ts'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\nimport css from './TypewriterAssistantNodeView.module.css'\n\ntype AssistantProps = ChatNodeViewProps<'assistant-step'>\ntype MarkdownProps = Pick<ComponentProps<typeof MarkdownText>, 'codeLabels' | 'fileMentions' | 'text'>\n\nfunction usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = useState(\n () => typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true,\n )\n useEffect(() => {\n if (typeof window === 'undefined' || window.matchMedia === undefined) return\n const query = window.matchMedia('(prefers-reduced-motion: reduce)')\n const onChange = () => setReduced(query.matches)\n query.addEventListener('change', onChange)\n return () => query.removeEventListener('change', onChange)\n }, [])\n return reduced\n}\n\ninterface AnimatedMarkdownTextProps extends MarkdownProps {\n streaming: boolean\n announce: boolean\n /** True on the last text block: that block owns conversation follow. */\n ownFollow: boolean\n followSpeedCpsRef?: { current: number } | undefined\n followRevealScaleRef?: { current: number } | undefined\n onPredictiveChange?: ((predictive: boolean) => void) | undefined\n preset: StreamSmoothingPreset\n shouldHoldBack: () => boolean\n}\n\n/** Conservative fallback before the streaming Markdown tail has geometry. */\nconst PREDICTIVE_WRAP_FALLBACK_CHARS = 32\n\nfunction approximateInlineWidth(text: string, emPx: number): number {\n let width = 0\n for (const char of text) {\n if (/\\s/u.test(char)) width += emPx * 0.33\n else if (/^[\\x00-\\x7f]$/u.test(char)) width += emPx * 0.56\n else width += emPx\n }\n return width\n}\n\n/** Whether buffered source can reach a new visual line before it drains. */\nfunction pendingTextCanGrow(root: HTMLElement | null, pending: string): boolean {\n if (pending === '') return false\n if (/[\\r\\n]/u.test(pending)) return true\n const pendingChars = [...pending]\n if (\n root === null\n || typeof document.createTreeWalker !== 'function'\n || typeof NodeFilter === 'undefined'\n ) {\n return pendingChars.length >= PREDICTIVE_WRAP_FALLBACK_CHARS\n }\n\n const rootRect = root.getBoundingClientRect()\n const rootWidth = Math.max(0, rootRect.width, rootRect.right - rootRect.left, root.clientWidth)\n if (rootWidth <= 0) return pendingChars.length >= PREDICTIVE_WRAP_FALLBACK_CHARS\n\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT)\n let tail: Text | null = null\n for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) {\n if ((node.textContent ?? '').length > 0) tail = node as Text\n }\n const parent = tail?.parentElement ?? root\n const fontSize = Number.parseFloat(getComputedStyle(parent).fontSize) || 14\n const pendingWidth = approximateInlineWidth(pending, fontSize)\n if (tail === null || typeof document.createRange !== 'function') {\n return pendingWidth >= rootWidth\n }\n\n try {\n const length = tail.textContent?.length ?? 0\n if (length <= 0) return pendingWidth >= rootWidth\n const range = document.createRange()\n range.setStart(tail, Math.max(0, length - 1))\n range.setEnd(tail, length)\n const tailRect = range.getBoundingClientRect()\n const contentRight = rootRect.right\n if (!Number.isFinite(tailRect.right) || tailRect.right <= rootRect.left || contentRight <= rootRect.left) {\n return pendingWidth >= rootWidth\n }\n const remainingWidth = Math.max(0, contentRight - tailRect.right)\n return pendingWidth >= remainingWidth + fontSize * 0.35\n } catch {\n return pendingWidth >= rootWidth\n }\n}\n\n/**\n * Smooth streaming text arm. While the reply runs, the accumulated source is\n * revealed through the smoother at a rate that tracks the model's arrival\n * and rendered by the Harness `MarkdownText`\n * streaming arm (incremental parse, frozen non-tail blocks), so there is no\n * raw-text tail and no text-to-markdown swap: the tree stays markdown\n * throughout. The last text block owns conversation-port follow so wraps\n * glide instead of snapping. Once the stream closes and the reveal queue\n * drains, the settled full parse (KaTeX math, fence highlighting, file\n * mentions) swaps in exactly once.\n */\nfunction AnimatedMarkdownText({\n text,\n codeLabels,\n fileMentions,\n streaming,\n announce,\n ownFollow,\n followSpeedCpsRef,\n followRevealScaleRef,\n onPredictiveChange,\n preset,\n shouldHoldBack,\n}: AnimatedMarkdownTextProps) {\n const reduced = usePrefersReducedMotion()\n const [typing, setTyping] = useState(streaming)\n const localSpeedCpsRef = useRef(35)\n const followRootRef = useRef<HTMLDivElement>(null)\n const predictionSourceRef = useRef<string | null>(null)\n const predictionStateRef = useRef(false)\n const speedCpsRef = followSpeedCpsRef ?? localSpeedCpsRef\n const displayed = useSmoothStreamContent(text, {\n enabled: typing && !reduced,\n inputComplete: !streaming,\n preset,\n shouldHoldBack,\n speedCpsRef,\n revealScaleRef: followRevealScaleRef,\n })\n const shown = reduced ? text : displayed\n const live = typing && !reduced\n\n useLayoutEffect(() => {\n if (onPredictiveChange === undefined) return\n const pending = text.slice(shown.length)\n const sourceChanged = predictionSourceRef.current !== text\n const next = !live || !streaming || pending === ''\n ? false\n : sourceChanged\n ? pendingTextCanGrow(followRootRef.current, pending)\n : predictionStateRef.current\n predictionSourceRef.current = text\n predictionStateRef.current = next\n onPredictiveChange(next)\n }, [live, onPredictiveChange, shown, streaming, text])\n\n // The stream closed: keep revealing the remaining queue, then swap to the\n // settled parse exactly once. The markdown tree stays mounted until then.\n useEffect(() => {\n if (typing && !streaming && shown.length === text.length) setTyping(false)\n }, [shown, streaming, text, typing])\n\n return (\n <>\n {live && announce && <span className={css.visuallyHidden} aria-live=\"polite\">{text}</span>}\n <FollowHost\n active={live && ownFollow}\n speedCpsRef={speedCpsRef}\n revealScaleRef={followRevealScaleRef}\n predictive={streaming}\n hostRef={followRootRef}\n >\n <MarkdownText\n text={live ? shown : text}\n streaming={live}\n codeLabels={codeLabels}\n fileMentions={live ? undefined : fileMentions}\n />\n </FollowHost>\n </>\n )\n}\n\nfunction imageLabels(t: AssistantProps['t']): MessageImageLabels {\n return {\n image: t('image.label'),\n open: t('image.openOriginal'),\n openNamed: label => t('image.openOriginalLabel', { label }),\n loading: t('image.loading'),\n loadFailed: t('image.loadFailed'),\n lightbox: {\n dialog: t('image.preview'),\n close: t('image.closePreview'),\n },\n }\n}\n\nfunction firstLine(text: string): string {\n const newline = text.indexOf('\\n')\n return newline === -1 ? text : text.slice(0, newline)\n}\n\nfunction latestLine(text: string): string {\n const visible = text.trimEnd()\n const newline = visible.lastIndexOf('\\n')\n return newline === -1 ? visible : visible.slice(newline + 1)\n}\n\n/**\n * Built-in Think disclosure with a smoothed `text` feed. Chevron and row\n * click stay on the disclosure chrome, which the plugin's AnimatedDisclosure\n * renders with a height-animated body (the harness primitive would mount and\n * unmount it, which cannot glide). The row opens only while this block is\n * the streaming tail and closes as soon as thinking ends — a later block,\n * or the assistant node settling — not when the rest of the reply is\n * still streaming.\n */\nfunction AnimatedReasoning({\n text,\n running,\n preset,\n thinkAutoExpand,\n shouldHoldBack,\n followSpeedCpsRef,\n followRevealScaleRef,\n onExpandedChange,\n t,\n}: {\n text: string\n running: boolean\n preset: StreamSmoothingPreset\n thinkAutoExpand: boolean\n shouldHoldBack: () => boolean\n followSpeedCpsRef?: { current: number } | undefined\n followRevealScaleRef?: { current: number } | undefined\n onExpandedChange?: ((expanded: boolean) => void) | undefined\n t: AssistantProps['t']\n}) {\n const reduced = usePrefersReducedMotion()\n const [expanded, setExpanded] = useState(running && thinkAutoExpand)\n const summaryRef = useRef<HTMLSpanElement>(null)\n const displayed = useSmoothStreamContent(text, {\n enabled: running && !reduced,\n preset,\n shouldHoldBack,\n speedCpsRef: followSpeedCpsRef,\n revealScaleRef: followRevealScaleRef,\n })\n const shown = running && !reduced ? displayed : text\n const summary = running ? latestLine(shown) : firstLine(text)\n\n useLayoutEffect(() => {\n // Only the running state owns disclosure while auto-expand is on; with it\n // off, a manual toggle is never wrestled back by the stream.\n if (thinkAutoExpand) setExpanded(running)\n }, [running, thinkAutoExpand])\n\n useLayoutEffect(() => {\n onExpandedChange?.(expanded)\n }, [expanded, onExpandedChange])\n\n useEffect(() => {\n const element = summaryRef.current\n if (element === null) return\n element.scrollLeft = running ? element.scrollWidth - element.clientWidth : 0\n }, [running, summary])\n\n // Preserve FollowHost's layout wrapper without mounting a second scroll owner.\n return (\n <div className={css.follow}>\n <div className={css.think} data-variant=\"think\" data-state={running ? 'running' : 'ok'}>\n {running && <span className={css.visuallyHidden}>{t('row.running')}</span>}\n <AnimatedDisclosure\n rowClassName={css.thinkRow}\n leadingClassName={css.thinkLeading}\n titleClassName={css.thinkTitle}\n chevronClassName={css.thinkChevron}\n icon={<IconThinkOutline14 size={14} />}\n title=\"Think\"\n open={expanded}\n onToggle={() => { setExpanded(value => !value) }}\n collapsedContent={(\n <>\n <span className={css.thinkSeparator} aria-hidden />\n <span ref={summaryRef} className={css.thinkSummary} data-follow-end={running || undefined}>{summary}</span>\n </>\n )}\n >\n <div className={css.thinkBody}>{shown}</div>\n </AnimatedDisclosure>\n </div>\n </div>\n )\n}\n\n/**\n * Assistant node renderer for the typewriter overlay. Text observed while\n * streaming is revealed by the smoother through the Harness Markdown\n * renderer at a rate that tracks arrival. Reasoning blocks keep the\n * built-in Think disclosure and only receive a smoothed text feed; the\n * outer node owns conversation-port follow while streaming; the final text\n * block keeps ownership while its settled reveal queue drains. The FPS guard\n * holds offscreen reveals when the frame rate is degraded. Settled text\n * renders with the full Markdown pipeline.\n */\nexport const TypewriterAssistantNodeView = memo(function TypewriterAssistantNodeView({\n mode: _mode = DEFAULT_STREAM_CONFIG.mode,\n preset = DEFAULT_STREAM_CONFIG.preset,\n revealCharsPerSec: _revealCharsPerSec = DEFAULT_STREAM_CONFIG.revealCharsPerSec,\n scrollSpeedPxPerSec: _scrollSpeedPxPerSec = DEFAULT_STREAM_CONFIG.scrollSpeedPxPerSec,\n maxScrollSpeedPxPerSec: _maxScrollSpeedPxPerSec = DEFAULT_STREAM_CONFIG.maxScrollSpeedPxPerSec,\n thinkAutoExpand = DEFAULT_STREAM_SETTINGS.thinkAutoExpand,\n node,\n useTurnData,\n openFile,\n loadImage,\n fileMentions,\n t,\n}: AssistantProps & {\n mode?: StreamMode\n preset?: StreamSmoothingPreset\n revealCharsPerSec?: number\n scrollSpeedPxPerSec?: number\n maxScrollSpeedPxPerSec?: number\n thinkAutoExpand?: boolean\n}) {\n const data = node.data\n const streaming = data.status === 'running'\n const reduced = usePrefersReducedMotion()\n const { ref: guardRef, shouldHoldBack } = useFpsGuard(streaming)\n const rootSpeedRef = useRef(35)\n const rootRevealScaleRef = useRef(1)\n const reasoningTailIndex = streaming && data.blocks[data.blocks.length - 1]?.kind === 'reasoning'\n ? data.blocks.length - 1\n : -1\n const reasoningOwnsSpeed = reasoningTailIndex !== -1\n const rootPredictiveRef = useRef(false)\n const previousReasoningTailRef = useRef(-1)\n if (reasoningTailIndex !== previousReasoningTailRef.current) {\n rootPredictiveRef.current = reasoningOwnsSpeed ? thinkAutoExpand : false\n if (!reasoningOwnsSpeed) rootSpeedRef.current = 35\n previousReasoningTailRef.current = reasoningTailIndex\n }\n const updateReasoningExpanded = useMemo(\n () => (expanded: boolean): void => { rootPredictiveRef.current = expanded },\n [],\n )\n const updateTextPrediction = useMemo(\n () => (predictive: boolean): void => { rootPredictiveRef.current = predictive },\n [],\n )\n const turn = node.location.kind === 'turn' || node.location.kind === 'step'\n ? node.location.turn\n : undefined\n const tail = useTurnData('turn-tail')\n const owner = useMemo<TurnTailOwnerProps | undefined>(() => {\n if (turn?.status !== 'closed' || data.finalNode === undefined) return undefined\n if (tail?.closing?.finalNode.seq !== data.finalNode.seq) return undefined\n return { turn, seq: data.finalNode.seq, openFile }\n }, [data.finalNode, openFile, tail, turn])\n const mentions = useMemo(\n () => owner === undefined ? undefined : fileMentions(owner),\n [fileMentions, owner],\n )\n const codeLabels = useMemo(() => ({ copyLabel: t('copy'), copiedLabel: t('copied') }), [t])\n const imageLoader: ImageLoader = loadImage ?? (async () => {\n throw new Error(t('image.serviceUnavailable'))\n })\n const hasVisible = streaming\n || data.status === 'interrupted'\n || data.blocks.some(block => block.kind !== 'tool-call')\n if (!hasVisible) return null\n\n const rendered: ReactNode[] = []\n const last = data.blocks.length - 1\n let lastFollow = -1\n for (let index = 0; index < data.blocks.length; index += 1) {\n const kind = data.blocks[index]?.kind\n if (kind === 'text' || kind === 'reasoning') lastFollow = index\n }\n for (let index = 0; index < data.blocks.length; index += 1) {\n const block = data.blocks[index]\n if (block === undefined) continue\n switch (block.kind) {\n case 'text':\n rendered.push(\n <AnimatedMarkdownText\n key={index}\n text={block.text}\n codeLabels={codeLabels}\n fileMentions={mentions}\n streaming={streaming}\n announce={index === last}\n ownFollow={!streaming && index === lastFollow}\n followSpeedCpsRef={index === lastFollow ? rootSpeedRef : undefined}\n followRevealScaleRef={index === lastFollow ? rootRevealScaleRef : undefined}\n onPredictiveChange={index === lastFollow ? updateTextPrediction : undefined}\n preset={preset}\n shouldHoldBack={shouldHoldBack}\n />,\n )\n break\n case 'reasoning':\n rendered.push(\n <AnimatedReasoning\n key={index}\n text={block.text}\n running={streaming && index === last}\n preset={preset}\n thinkAutoExpand={thinkAutoExpand}\n shouldHoldBack={shouldHoldBack}\n followSpeedCpsRef={reasoningOwnsSpeed && index === last ? rootSpeedRef : undefined}\n followRevealScaleRef={reasoningOwnsSpeed && index === last ? rootRevealScaleRef : undefined}\n onExpandedChange={index === reasoningTailIndex ? updateReasoningExpanded : undefined}\n t={t}\n />,\n )\n break\n case 'image': {\n const start = index\n const group = [block]\n while (index + 1 < data.blocks.length) {\n const next = data.blocks[index + 1]\n if (next === undefined || next.kind !== 'image') break\n group.push(next)\n index += 1\n }\n rendered.push(\n <ImageGallery key={start} images={group} load={imageLoader} align=\"start\" labels={imageLabels(t)} />,\n )\n break\n }\n case 'tool-call':\n break\n case 'other':\n rendered.push(\n <JsonBlock\n key={index}\n label={t('message.unknownBlock')}\n payload={block.block}\n truncatedLabel={total => t('json.truncated', { total })}\n />,\n )\n break\n }\n }\n\n return (\n <div ref={guardRef} className={css.root} data-streaming={streaming || undefined}>\n <FollowHost\n active={streaming && !reduced}\n speedCpsRef={rootSpeedRef}\n revealScaleRef={rootRevealScaleRef}\n predictiveRef={rootPredictiveRef}\n >\n <div className={css.body}>\n {rendered}\n {data.status === 'interrupted' && <span className={css.stopped}>{t('message.stopped')}</span>}\n </div>\n </FollowHost>\n </div>\n )\n})\n","/**\n * Progressive text reveal for opaque Agent renderers.\n *\n * Slot renderers own arbitrary React trees, so the generic integration cannot\n * clone or classify their business components. This hook leaves that tree and\n * all of its event handlers in place, and only paces visible Text node data\n * while the row belongs to the live Agent turn. No clip, mask, overlay, or\n * duplicate accessibility tree is introduced.\n */\n\nimport { useLayoutEffect, type RefObject } from 'react'\nimport { computeAdaptiveQueueStep } from './useSmoothStreamContent.ts'\n\ninterface TextRevealRecord {\n chars: readonly string[]\n full: string\n shown: number\n}\n\nconst SKIP_TEXT_SELECTOR = [\n '[aria-hidden=\"true\"]',\n '[aria-live]',\n '[contenteditable=\"true\"]',\n 'script',\n 'style',\n 'textarea',\n].join(',')\n\nfunction revealable(node: Text, root: HTMLElement): boolean {\n if (node.data.trim() === '') return false\n const parent = node.parentElement\n return parent !== null\n && root.contains(parent)\n && parent.closest(SKIP_TEXT_SELECTOR) === null\n}\n\nfunction commonPrefix(left: readonly string[], right: readonly string[]): number {\n const limit = Math.min(left.length, right.length)\n let index = 0\n while (index < limit && left[index] === right[index]) index += 1\n return index\n}\n\n/**\n * Pace text inside a renderer whose React component is intentionally opaque.\n * Initial content is revealed only for a genuinely new row; later mutations\n * stay paced until `enabled` becomes false, at which point the full renderer\n * content is restored synchronously before paint.\n */\nexport function useProgressiveDomText(\n rootRef: RefObject<HTMLElement | null>,\n enabled: boolean,\n revealInitial: boolean,\n speedCpsRef: { current: number },\n onSettled?: (() => void) | undefined,\n): void {\n useLayoutEffect(() => {\n if (!enabled) return\n const root = rootRef.current\n if (root === null || typeof document === 'undefined') return\n\n const records = new Map<Text, TextRevealRecord>()\n const pending = new Set<Text>()\n const internalWrites = new WeakMap<Text, string>()\n let rafId = 0\n let lastFrame: number | null = null\n let debt = 0\n let stopped = false\n let announcedSettled = false\n\n const announceSettled = (): void => {\n lastFrame = null\n debt = 0\n speedCpsRef.current = 35\n if (announcedSettled) return\n announcedSettled = true\n onSettled?.()\n }\n\n const write = (node: Text, value: string): void => {\n if (node.data === value) return\n internalWrites.set(node, value)\n node.data = value\n }\n\n const enqueue = (node: Text, full: string, preserve: TextRevealRecord | undefined): void => {\n if (!revealable(node, root)) return\n const chars = [...full]\n const preserved = preserve === undefined\n ? 0\n : Math.min(preserve.shown, commonPrefix(preserve.chars, chars))\n const record = { chars, full, shown: preserved }\n records.set(node, record)\n if (preserved < chars.length) {\n pending.add(node)\n announcedSettled = false\n } else {\n pending.delete(node)\n }\n write(node, chars.slice(0, preserved).join(''))\n }\n\n const visit = (from: Node, reveal: boolean): void => {\n if (from.nodeType === Node.TEXT_NODE) {\n const text = from as Text\n if (reveal) enqueue(text, text.data, records.get(text))\n return\n }\n const walker = document.createTreeWalker(from, NodeFilter.SHOW_TEXT)\n let current = walker.nextNode()\n while (current !== null) {\n const text = current as Text\n if (reveal) enqueue(text, text.data, records.get(text))\n current = walker.nextNode()\n }\n }\n\n const scheduleFrame = (): void => {\n if (stopped || pending.size === 0 || rafId !== 0) return\n rafId = requestAnimationFrame(frame)\n }\n\n const frame = (now: number): void => {\n rafId = 0\n if (stopped) return\n if (pending.size === 0) {\n announceSettled()\n return\n }\n announcedSettled = false\n if (lastFrame === null) {\n lastFrame = now\n scheduleFrame()\n return\n }\n const elapsed = Math.max(0, now - lastFrame)\n lastFrame = now\n let backlog = 0\n for (const node of pending) {\n const record = records.get(node)\n if (record !== undefined) backlog += record.chars.length - record.shown\n }\n const step = computeAdaptiveQueueStep(backlog, elapsed, debt)\n debt = step.debt\n speedCpsRef.current = step.speedCps\n let remaining = step.revealChars\n for (const node of [...pending]) {\n if (remaining <= 0) break\n const record = records.get(node)\n if (record === undefined || !node.isConnected) {\n pending.delete(node)\n continue\n }\n const amount = Math.min(remaining, record.chars.length - record.shown)\n const shown = record.shown + amount\n const next = { ...record, shown }\n records.set(node, next)\n write(node, next.chars.slice(0, shown).join(''))\n remaining -= amount\n if (shown >= next.chars.length) pending.delete(node)\n }\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n }\n\n if (revealInitial) visit(root, true)\n\n const observer = typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'characterData') {\n const node = mutation.target as Text\n const expected = internalWrites.get(node)\n if (expected === node.data) {\n internalWrites.delete(node)\n continue\n }\n enqueue(node, node.data, records.get(node))\n continue\n }\n for (const added of mutation.addedNodes) visit(added, true)\n }\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n })\n observer?.observe(root, { childList: true, characterData: true, subtree: true })\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n\n return () => {\n stopped = true\n cancelAnimationFrame(rafId)\n observer?.disconnect()\n for (const [node, record] of records) {\n const controlled = record.chars.slice(0, record.shown).join('')\n // React may have committed a terminal replacement in the same mutation\n // phase that disables this hook. Never overwrite that newer renderer\n // value with the previous controlled source during layout cleanup.\n if (node.isConnected && node.data === controlled) write(node, record.full)\n }\n pending.clear()\n speedCpsRef.current = 35\n }\n }, [enabled, onSettled, revealInitial, rootRef, speedCpsRef])\n}\n","import { createElement, useCallback, useEffect, useLayoutEffect, useRef, useState, type ComponentType } from 'react'\nimport { FollowHost } from './FollowHost.tsx'\nimport { useProgressiveDomText } from './useProgressiveDomText.ts'\nimport { hasRecentConversationFollow } from './teleprompterGlide.ts'\n\n/** Props forwarded through a follow wrap; extra kit seats pass through. */\nexport type FollowWrapProps = {\n node?: unknown\n renderSlot?: unknown\n} & Record<string, unknown>\n\nfunction openAgentLocation(node: unknown): boolean {\n if (node === null || typeof node !== 'object' || !('location' in node)) return false\n const location = (node as { location: unknown }).location\n if (location === null || typeof location !== 'object' || !('kind' in location)) return false\n const kind = (location as { kind: unknown }).kind\n if (!('turn' in location)) return false\n const turn = (location as { turn: unknown }).turn\n if (turn === null || typeof turn !== 'object' || !('status' in turn)) return false\n if (kind === 'turn') return (turn as { status: unknown }).status === 'open'\n if (kind !== 'step' || !('step' in location)) return false\n const step = (location as { step: unknown }).step\n return step !== null\n && typeof step === 'object'\n && 'status' in step\n && (step as { status: unknown }).status === 'open'\n}\n\n/**\n * True while a Chat node has an explicitly unfinished lifecycle: an\n * assistant/workflow `status: 'running'` payload, a Tool root that has not\n * settled (`kind` absent), or a model-retry whose current attempt is still\n * `scheduled`. Open-but-otherwise-unknown rows are covered by\n * `isFollowableChatNode` below.\n * @param node - The Chat node's view `node` prop.\n * @returns whether this row should own conversation follow.\n */\nexport function isGrowingChatNode(node: unknown): boolean {\n if (node === null || typeof node !== 'object' || !('data' in node)) return false\n const data = (node as { data: unknown }).data\n if (data === null || typeof data !== 'object') return false\n if ('status' in data && (data as { status: unknown }).status === 'running') return true\n if (\n 'kind' in data\n && (data as { kind: unknown }).kind === 'command'\n && 'outcome' in data\n && (data as { outcome: unknown }).outcome === null\n ) return true\n if ('command' in data) {\n const command = (data as { command: unknown }).command\n if (\n command !== null\n && typeof command === 'object'\n && 'outcome' in command\n && (command as { outcome: unknown }).outcome === null\n ) return true\n }\n if ('root' in data) {\n const root = (data as { root: unknown }).root\n if (root !== null && typeof root === 'object' && !('kind' in root)) return true\n }\n if ('current' in data) {\n const current = (data as { current: unknown }).current\n if (\n current !== null\n && typeof current === 'object'\n && 'retryState' in current\n && (current as { retryState: unknown }).retryState === 'scheduled'\n ) return true\n }\n return false\n}\n\n/**\n * True for any Agent-owned Chat row in the currently open turn/step. This is\n * the extensibility boundary: a newly registered Context, Command, Tool, or\n * workflow renderer is followed without adding another kind-specific branch.\n */\nexport function isFollowableChatNode(node: unknown): boolean {\n return isGrowingChatNode(node) || openAgentLocation(node)\n}\n\n/**\n * True when a newly mounted Agent-owned row belongs to the current open\n * Turn/Step, or is itself an unresolved growing lifecycle.\n * @param node - The Chat node's view `node` prop.\n * @returns whether its initial height should enter through conversation follow.\n */\nexport function shouldAnimateChatNodeEntrance(node: unknown): boolean {\n return isFollowableChatNode(node)\n}\n\n/** Runtime-only fallback for unknown or terminal rows at the active flow tip. */\nfunction liveAgentTailMode(root: HTMLElement): 'turn' | 'handoff' | null {\n const port = root.closest<HTMLElement>('[data-conversation-scroll]')\n if (port === null) return null\n const row = root.closest<HTMLElement>('[data-chat-flow-key]')\n if (row !== null) {\n let sibling = row.nextElementSibling\n while (sibling !== null) {\n if (sibling instanceof HTMLElement && sibling.hasAttribute('data-chat-flow-key')) return null\n sibling = sibling.nextElementSibling\n }\n }\n const flow = root.closest<HTMLElement>('[data-chat-flow]')\n const hasTurnStatus = flow !== null && [...flow.children].some(child =>\n child instanceof HTMLElement\n && child.getAttribute('role') === 'status'\n && !child.hasAttribute('data-chat-flow-key'))\n if (hasTurnStatus) return 'turn'\n return hasRecentConversationFollow(port) ? 'handoff' : null\n}\n\n/**\n * Wrap a prior Agent Chat renderer so its entrance and later growth share\n * conversation follow. Presentation stays with the wrapped component; kit\n * seats (`renderSlot`, locale, inject) pass through unchanged.\n * @param Inner - The already-registered row component.\n * @returns A follow-hosted row.\n */\nexport function wrapFollowNodeView(Inner: ComponentType<FollowWrapProps>) {\n return function TypewriterFollowNodeView(props: FollowWrapProps) {\n const speedCpsRef = useRef(35)\n const hostRef = useRef<HTMLDivElement>(null)\n const growing = isGrowingChatNode(props.node)\n const structurallyFollowable = isFollowableChatNode(props.node)\n const structuralRef = useRef(structurallyFollowable)\n const [runtimeFollowable, setRuntimeFollowable] = useState(false)\n const runtimePersistentRef = useRef(false)\n const runtimeHandledRef = useRef(false)\n const followable = structurallyFollowable || runtimeFollowable\n const revealInitialRef = useRef(true)\n const [entering, setEntering] = useState(() => shouldAnimateChatNodeEntrance(props.node))\n const [growthPulse, setGrowthPulse] = useState(false)\n const followableRef = useRef(false)\n const growingRef = useRef(growing)\n const entranceActiveRef = useRef(entering || growthPulse)\n const growthExtentRef = useRef<number | null>(null)\n const mountedRef = useRef(true)\n const pulseTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n structuralRef.current = structurallyFollowable\n followableRef.current = followable\n growingRef.current = growing\n entranceActiveRef.current = entering || growthPulse\n const finishRuntimeReveal = useCallback(() => {\n if (structuralRef.current || runtimePersistentRef.current) return\n runtimeHandledRef.current = true\n setRuntimeFollowable(false)\n }, [])\n useProgressiveDomText(\n hostRef,\n followable,\n revealInitialRef.current,\n speedCpsRef,\n runtimeFollowable ? finishRuntimeReveal : undefined,\n )\n useLayoutEffect(() => {\n if (structurallyFollowable) return\n const root = hostRef.current\n if (root === null) return\n const mode = liveAgentTailMode(root)\n if (runtimeFollowable) {\n if (runtimePersistentRef.current && mode !== 'turn') {\n runtimePersistentRef.current = false\n runtimeHandledRef.current = true\n setRuntimeFollowable(false)\n }\n return\n }\n if (runtimeHandledRef.current || mode === null) return\n runtimePersistentRef.current = mode === 'turn'\n setRuntimeFollowable(true)\n setEntering(true)\n }, [runtimeFollowable, structurallyFollowable])\n const finishEntrance = useCallback(() => {\n growthExtentRef.current = null\n if (pulseTimerRef.current !== null) {\n clearTimeout(pulseTimerRef.current)\n pulseTimerRef.current = null\n }\n setEntering(false)\n setGrowthPulse(false)\n }, [])\n const onGrowth = useCallback((deltaPx: number) => {\n // A row with an explicit streaming lifecycle keeps its original owner\n // through completion. For every other Agent row, a pure layout increase\n // is enough evidence to glide it; renderer kind and payload shape are\n // intentionally irrelevant.\n if (\n !mountedRef.current\n || !followableRef.current\n || growingRef.current\n || entranceActiveRef.current\n ) return\n growthExtentRef.current = deltaPx\n setGrowthPulse(true)\n if (pulseTimerRef.current !== null) clearTimeout(pulseTimerRef.current)\n pulseTimerRef.current = setTimeout(() => {\n pulseTimerRef.current = null\n setGrowthPulse(false)\n }, 1200)\n }, [])\n useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n if (pulseTimerRef.current !== null) clearTimeout(pulseTimerRef.current)\n }\n }, [])\n return (\n <FollowHost\n active={growing}\n entrance={entering || growthPulse}\n onEntranceSettled={finishEntrance}\n onGrowth={followable ? onGrowth : undefined}\n entranceExtentRef={growthExtentRef}\n speedCpsRef={speedCpsRef}\n // Generic Agent rows reveal and spring their measured growth, but do\n // not continuously reserve space for a future Markdown line wrap.\n // Keeping that assistant-only prediction here creates an idle gap\n // above TurnStatus and a visible return when a short Tool row settles.\n predictive={false}\n hostRef={hostRef}\n >\n {createElement(Inner, props)}\n </FollowHost>\n )\n }\n}\n","/**\n * The smooth-stream plugin configuration card, rendered inside the Web\n * Settings \"plugin configuration\" page. One toggle, staged until the user\n * saves — the same shape as the Host-shipped cards, hand-drawn because the\n * Host cards' chrome is not exported for reuse.\n */\n\nimport { useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\nimport { IconChevronDownOutline14, IconRefreshOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { SmoothStreamCardFace } from './smooth-stream-card-controller.ts'\nimport css from './SmoothStreamCard.module.css'\n\n/** Props the renderer binds for the smooth-stream card. */\nexport type SmoothStreamCardProps =\n PropsRuntime<'settings.plugin.item'>\n & PropsLocale<'settings.smoothStream'>\n & InjectFace<SmoothStreamCardFace>\n\n/** Render the smooth-stream card independently of the core settings namespace allowlist. */\nexport function SmoothStreamCard(props: SmoothStreamCardProps) {\n const { t } = props\n const [open, setOpen] = useState(false)\n const state = props.useSmoothStreamCard(snapshot => snapshot)\n const blocked = !state.dirty || state.saving || state.status !== 'ready'\n const versionLabel = state.version === undefined\n ? null\n : t(state.installation === 'development' ? 'developmentVersion' : 'version')\n .replace('{version}', state.version)\n\n return (\n <li className={open ? `${css.card} ${css.cardOpen}` : css.card}>\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n onClick={() => { setOpen(!open) }}\n >\n <span className={css.headText}>\n <span className={css.name}>{t('title')}</span>\n <span className={css.description}>{t('description')}</span>\n </span>\n {versionLabel === null ? null : <span className={css.version}>{versionLabel}</span>}\n {state.dirty ? <span className={css.pending}>{t('unsaved')}</span> : null}\n <IconChevronDownOutline14 className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron} />\n </button>\n {open\n ? (\n <div className={css.body}>\n {state.status === 'loading' ? <p className={css.readOnly} role=\"status\">{t('loading')}</p> : null}\n {state.status === 'unavailable' ? (\n <div className={css.failure}>\n <p className={css.readOnly} role=\"status\">{t('unavailable')}</p>\n <button type=\"button\" className={css.discard} onClick={props.reload}>{t('retry')}</button>\n </div>\n ) : null}\n {state.status === 'ready' ? (\n <>\n {!state.writable ? <p className={css.readOnly} role=\"status\">{t('readOnly')}</p> : null}\n <label className={css.field}>\n <span className={css.fieldHead}>\n <span className={css.label}>{t('thinkAutoExpand')}</span>\n <input\n type=\"checkbox\"\n className={css.toggle}\n checked={state.thinkAutoExpand}\n disabled={!state.writable}\n onChange={(event) => { props.edit(event.target.checked) }}\n />\n </span>\n <span className={css.hint}>{t('thinkAutoExpandHint')}</span>\n </label>\n <div className={css.updateRow}>\n <span className={css.updateCopy}>\n <span className={css.label}>{t('updates')}</span>\n <span className={css.hint}>\n {state.restartRequired\n ? t('restartRequired')\n : state.installation === 'npm' ? t('updateHint')\n : state.installation === 'development' ? t('developmentBuild') : t('updateUnavailable')}\n </span>\n </span>\n <button\n type=\"button\"\n className={css.update}\n disabled={!state.canUpgrade || state.upgrading || state.restartRequired}\n title={state.canUpgrade ? undefined : t('updateUnavailable')}\n onClick={props.upgrade}\n >\n <span aria-hidden=\"true\"><IconRefreshOutline14 /></span>\n {t(state.upgrading ? 'updating' : 'update')}\n </button>\n </div>\n {state.upgradeFailed ? <p className={css.failed} role=\"status\">{t('updateFailed')}</p> : null}\n <div className={css.footer}>\n {state.failed ? <p className={css.failed} role=\"status\">{t('saveFailed')}</p> : null}\n <button\n type=\"button\"\n className={css.discard}\n disabled={!state.dirty || state.saving}\n onClick={props.discard}\n >\n {t('discard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={blocked}\n onClick={props.save}\n >\n {t(state.saving ? 'saving' : 'save')}\n </button>\n </div>\n </>\n ) : null}\n </div>\n )\n : null}\n </li>\n )\n}\n","/** Staged form state for the plugin-owned smooth-stream settings RPC. */\n\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\nimport type { StreamInstallationKind, StreamSettingsView } from '../settings-api.ts'\nimport type { SmoothStreamSettingsApi } from './smooth-stream-settings-api.ts'\n\n/** What the smooth-stream card renders. It remains visible while its Host RPC loads. */\nexport interface SmoothStreamCardState {\n status: 'loading' | 'ready' | 'unavailable'\n writable: boolean\n dirty: boolean\n saving: boolean\n failed: boolean\n thinkAutoExpand: boolean\n version: string | undefined\n installation: StreamInstallationKind\n canUpgrade: boolean\n upgrading: boolean\n upgradeFailed: boolean\n restartRequired: boolean\n}\n\n/** The registration-side face injected into the settings slot renderer. */\nexport interface SmoothStreamCardFace {\n hooks: {\n smoothStreamCard: SnapshotStore<SmoothStreamCardState>\n }\n edit: (value: boolean) => void\n save: () => void\n discard: () => void\n reload: () => void\n upgrade: () => void\n}\n\n/** Bridges the plugin's protected Host interface onto a staged settings form. */\nexport class SmoothStreamCardController {\n private readonly store = createSnapshotStore<SmoothStreamCardState>(this.projection())\n private loaded: StreamSettingsView | undefined\n private staged: boolean | undefined\n private saving = false\n private failed = false\n private upgrading = false\n private upgradeFailed = false\n private restartRequired = false\n private loadGeneration = 0\n private loadStatus: 'loading' | 'ready' | 'unavailable' = 'loading'\n\n constructor(private readonly api: SmoothStreamSettingsApi) {}\n\n /** Begin the background read after the card has been registered. */\n start(): void {\n void this.load()\n }\n\n /** Ignore a late response after the surrounding optional services unload. */\n stop(): void {\n this.loadGeneration += 1\n }\n\n /** Current card snapshot, also consumed by the streaming preference cell. */\n getSnapshot(): SmoothStreamCardState {\n return this.store.getSnapshot()\n }\n\n /** Subscribe to state changes. */\n subscribe(listener: () => void): () => void {\n return this.store.subscribe(listener)\n }\n\n /** Build the face consumed by the settings slot renderer. */\n inject(): SmoothStreamCardFace {\n return {\n hooks: { smoothStreamCard: this.store },\n edit: (value) => {\n this.staged = value\n this.failed = false\n this.publish()\n },\n save: () => { void this.save() },\n discard: () => {\n if (this.staged === undefined && !this.failed) return\n this.staged = undefined\n this.failed = false\n this.publish()\n },\n reload: () => { void this.load() },\n upgrade: () => { void this.upgrade() },\n }\n }\n\n private projection(): SmoothStreamCardState {\n return {\n status: this.loadStatus,\n writable: this.loaded?.writable ?? false,\n dirty: this.staged !== undefined,\n saving: this.saving,\n failed: this.failed,\n thinkAutoExpand: this.staged ?? this.loaded?.thinkAutoExpand ?? DEFAULT_STREAM_SETTINGS.thinkAutoExpand,\n version: this.loaded?.version,\n installation: this.loaded?.installation ?? 'unmanaged',\n canUpgrade: this.loaded?.canUpgrade ?? false,\n upgrading: this.upgrading,\n upgradeFailed: this.upgradeFailed,\n restartRequired: this.restartRequired,\n }\n }\n\n private async load(): Promise<void> {\n const generation = ++this.loadGeneration\n this.loadStatus = 'loading'\n this.loaded = undefined\n this.publish()\n try {\n const view = await this.api.read()\n if (generation !== this.loadGeneration) return\n this.loaded = view\n this.loadStatus = 'ready'\n } catch {\n if (generation !== this.loadGeneration) return\n this.loaded = undefined\n this.loadStatus = 'unavailable'\n }\n this.publish()\n }\n\n private async save(): Promise<void> {\n if (this.staged === undefined || this.saving || this.loaded?.writable !== true) return\n const value = this.staged\n this.saving = true\n this.failed = false\n this.publish()\n try {\n this.loaded = await this.api.write(value)\n this.staged = undefined\n } catch {\n this.failed = true\n }\n this.saving = false\n this.publish()\n }\n\n private async upgrade(): Promise<void> {\n if (this.loaded?.canUpgrade !== true || this.upgrading) return\n this.upgrading = true\n this.upgradeFailed = false\n this.restartRequired = false\n this.publish()\n try {\n const result = await this.api.upgrade()\n this.restartRequired = result.restartRequired\n } catch {\n this.upgradeFailed = true\n }\n this.upgrading = false\n this.publish()\n }\n\n private publish(): void {\n this.store.set(this.projection())\n }\n}\n","/** Shared wire vocabulary for the plugin-owned settings RPC channel. */\n\n/** Dedicated, loopback-only RPC channel registered by the Host half. */\nexport const STREAM_SETTINGS_RPC_CHANNEL = '/smooth-stream'\n\n/** Endpoints accepted by {@link STREAM_SETTINGS_RPC_CHANNEL}. */\nexport const STREAM_SETTINGS_RPC = {\n read: 'settings.read',\n write: 'settings.write',\n upgrade: 'plugin.upgrade',\n} as const\n\n/** How the active profile supplied this plugin. */\nexport type StreamInstallationKind = 'npm' | 'development' | 'unmanaged'\n\n/** Redacted, plugin-owned configuration state returned to the browser. */\nexport interface StreamSettingsView {\n /** Version of the package currently running in the Host process. */\n version: string\n /** Source class of this package in the active profile. */\n installation: StreamInstallationKind\n /** Whether the Host settings provider permits a write. */\n writable: boolean\n /** Current resolved preference. */\n thinkAutoExpand: boolean\n /** Whether a fixed npm update command is safe to offer. */\n canUpgrade: boolean\n}\n\n/** Successful package update acknowledgement; loading the new code needs a restart. */\nexport interface StreamUpgradeView {\n restartRequired: true\n}\n","/** Browser adapter for the Host-owned smooth-stream settings RPC. */\n\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport {\n STREAM_SETTINGS_RPC,\n STREAM_SETTINGS_RPC_CHANNEL,\n type StreamSettingsView,\n type StreamUpgradeView,\n} from '../settings-api.ts'\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? value as Record<string, unknown>\n : undefined\n}\n\nfunction settingsView(value: unknown): StreamSettingsView {\n const data = record(value)\n if (data === undefined\n || typeof data.version !== 'string'\n || !['npm', 'development', 'unmanaged'].includes(data.installation as string)\n || typeof data.writable !== 'boolean'\n || typeof data.thinkAutoExpand !== 'boolean'\n || typeof data.canUpgrade !== 'boolean') {\n throw new Error('dsh-smooth-stream: malformed settings response')\n }\n return data as unknown as StreamSettingsView\n}\n\nfunction upgradeView(value: unknown): StreamUpgradeView {\n const data = record(value)\n if (data?.restartRequired !== true) throw new Error('dsh-smooth-stream: malformed update response')\n return { restartRequired: true }\n}\n\nfunction accepted(result: Awaited<ReturnType<ConnectionHandle['rpc']['call']>>): unknown {\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n}\n\n/** Narrow client contract consumed by the staged settings-card controller. */\nexport interface SmoothStreamSettingsApi {\n read(): Promise<StreamSettingsView>\n write(thinkAutoExpand: boolean): Promise<StreamSettingsView>\n upgrade(): Promise<StreamUpgradeView>\n}\n\n/** Build the typed facade over the generic Connection RPC service. */\nexport function createSmoothStreamSettingsApi(connection: ConnectionHandle): SmoothStreamSettingsApi {\n return {\n async read(): Promise<StreamSettingsView> {\n return settingsView(accepted(await connection.rpc.call(STREAM_SETTINGS_RPC_CHANNEL, STREAM_SETTINGS_RPC.read, {})))\n },\n async write(thinkAutoExpand: boolean): Promise<StreamSettingsView> {\n return settingsView(accepted(await connection.rpc.call(\n STREAM_SETTINGS_RPC_CHANNEL,\n STREAM_SETTINGS_RPC.write,\n { thinkAutoExpand },\n )))\n },\n async upgrade(): Promise<StreamUpgradeView> {\n return upgradeView(accepted(await connection.rpc.call(STREAM_SETTINGS_RPC_CHANNEL, STREAM_SETTINGS_RPC.upgrade, {})))\n },\n }\n}\n","/** Locale bundles for the smooth-stream plugin configuration card. */\n\n/** Dictionary namespace owned by this plugin's settings card. */\nexport const NS = 'settings.smoothStream'\n\n/** Locale keys the card renders. */\nexport type SmoothStreamLocaleKey =\n | 'title' | 'description'\n | 'thinkAutoExpand' | 'thinkAutoExpandHint'\n | 'readOnly' | 'loading' | 'unavailable' | 'retry'\n | 'version' | 'developmentVersion'\n | 'updates' | 'updateHint' | 'developmentBuild' | 'updateUnavailable'\n | 'update' | 'updating' | 'restartRequired' | 'updateFailed'\n | 'save' | 'saving' | 'discard' | 'unsaved' | 'saveFailed'\n\n/** English copy. */\nexport const en: Record<SmoothStreamLocaleKey, string> = {\n title: 'Smooth stream',\n description: 'How replies are revealed while they stream.',\n thinkAutoExpand: 'Auto-expand thinking',\n thinkAutoExpandHint: 'Open the thinking block while it streams. Turn off to keep it collapsed.',\n readOnly: 'This deployment stores settings read-only.',\n loading: 'Loading plugin settings…',\n unavailable: 'Plugin settings are unavailable in this connection.',\n retry: 'Retry',\n version: 'Version {version}',\n developmentVersion: 'Development version {version}',\n updates: 'Updates',\n updateHint: 'Install the newest npm version, then restart Harness.',\n developmentBuild: 'Linked source; updates are managed in the checkout.',\n updateUnavailable: 'Updates are available only for an npm profile installation.',\n update: 'Update',\n updating: 'Updating…',\n restartRequired: 'Updated. Restart Harness to load the new version.',\n updateFailed: 'The package update failed; your current version is unchanged.',\n save: 'Save',\n saving: 'Saving…',\n discard: 'Discard',\n unsaved: 'Unsaved',\n saveFailed: 'The deployment did not accept these values; they were left for you to correct.',\n}\n\n/** Simplified Chinese copy. */\nexport const zh: Record<SmoothStreamLocaleKey, string> = {\n title: '丝滑流式',\n description: '回复在流式输出时如何逐字展现。',\n thinkAutoExpand: '自动展开思考',\n thinkAutoExpandHint: '思考块在流式时自动展开;关闭后保持折叠,可手动展开。',\n readOnly: '本部署的设置为只读。',\n loading: '正在加载插件设置…',\n unavailable: '当前连接无法访问插件设置。',\n retry: '重试',\n version: '版本 {version}',\n developmentVersion: '开发版本 {version}',\n updates: '更新',\n updateHint: '安装最新 npm 版本后重启 Harness。',\n developmentBuild: '当前为本地链接版本,请在源码目录管理更新。',\n updateUnavailable: '只有 profile 使用 npm 包时才能更新。',\n update: '更新',\n updating: '更新中…',\n restartRequired: '已更新;重启 Harness 后加载新版本。',\n updateFailed: '包更新失败,当前版本未改变。',\n save: '保存',\n saving: '保存中…',\n discard: '放弃修改',\n unsaved: '未保存',\n saveFailed: '本部署没有接受这些值,已保留供你修改。',\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'settings.smoothStream': SmoothStreamLocaleKey\n }\n}\n","import { createElement, useSyncExternalStore, type ComponentType } from 'react'\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: the connection Context merge and the plugins section's SlotMap\n// entry ('settings.plugin.item').\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\nimport type { ChatNodeViewProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { TypewriterAssistantNodeView } from './TypewriterAssistantNodeView.tsx'\nimport { wrapFollowNodeView, type FollowWrapProps } from './TypewriterToolNodeView.tsx'\nimport { SmoothStreamCard } from './SmoothStreamCard.tsx'\nimport { SmoothStreamCardController } from './smooth-stream-card-controller.ts'\nimport { createSmoothStreamSettingsApi } from './smooth-stream-settings-api.ts'\nimport { NS as SETTINGS_NS, en, zh } from './locales.ts'\nimport { DEFAULT_STREAM_CONFIG, STREAM_BOOT_GLOBAL, type StreamConfig } from '../config.ts'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\n\n/**\n * Cordis services required by the browser half. Only `slots` is load-bearing\n * for the stream itself; locale and Connection power the configuration card\n * and are wired through `ctx.inject` below so a deployment without them still\n * streams with defaults.\n */\nexport const inject = ['slots']\n\ntype AssistantProps = ChatNodeViewProps<'assistant-step'>\n\nconst STREAM_MODES: readonly string[] = ['typewriter', 'teleprompter']\nconst STREAM_PRESETS: readonly string[] = ['realtime', 'balanced', 'silky']\n\n/**\n * The assistant renderer owns its own character queue and conversation\n * follower, so wrapping it again would create two scroll owners. Human input\n * stays immediate; every Agent-owned output renderer goes through the same\n * generic follow boundary. This is deliberately keyed by the owner that\n * provides the renderer, not by individual tool names, so new Context,\n * Command, and Tool rows are covered automatically.\n */\nconst SKIP_WRAP = new Set(['assistant-step', 'user', 'steering', 'command-input'])\n\n/** React function/class or an exotic component such as memo/forwardRef/lazy. */\nfunction isWrappableComponent(value: unknown): value is ComponentType<FollowWrapProps> {\n return typeof value === 'function'\n || (value !== null && typeof value === 'object' && '$$typeof' in value)\n}\n\n/**\n * Read the Host-bridged boot config. The inline script is produced by this\n * plugin's Host half from a schema-validated value, so only the structural\n * guarantees that could break between the two halves are re-checked: the\n * global is absent when the client runs without its Host entry (defaults\n * apply), and any present-but-malformed value fails loudly instead of\n * rendering a half-configured view.\n * @returns The resolved configuration for the assistant node view.\n */\nfunction readBootConfig(): StreamConfig {\n const raw = (globalThis as Record<string, unknown>)[STREAM_BOOT_GLOBAL]\n if (raw === undefined) {\n console.info('[dsh-smooth-stream] no host config bridge; using defaults')\n return DEFAULT_STREAM_CONFIG\n }\n if (\n typeof raw !== 'object' || raw === null\n || !STREAM_MODES.includes((raw as StreamConfig).mode)\n || !STREAM_PRESETS.includes((raw as StreamConfig).preset)\n || typeof (raw as StreamConfig).revealCharsPerSec !== 'number'\n || typeof (raw as StreamConfig).scrollSpeedPxPerSec !== 'number'\n || typeof (raw as StreamConfig).maxScrollSpeedPxPerSec !== 'number'\n ) {\n throw new Error(`[dsh-smooth-stream] malformed ${STREAM_BOOT_GLOBAL} boot global: ${JSON.stringify(raw)}`)\n }\n return raw as StreamConfig\n}\n\n/**\n * Wrap every Agent-owned keyed Chat row except the assistant renderer in\n * place. A second\n * register with the same `children` table throws because the child slot is\n * already declared, and only the winning entry receives `renderSlot`;\n * swapping `entry.component` keeps the original children, locale, and inject\n * seats. `assistant-step` is replaced below so text and Think use the\n * typewriter reveal. The wrapper owns only the shared layout-growth/follow\n * lifecycle; the Harness keeps each renderer's controls, disclosures, and\n * cards intact.\n * @param ctx - Browser context carrying the slot registry.\n * @returns Restorer that puts the original components back.\n */\nfunction wrapAgentChatRows(ctx: ClientContext): () => void {\n const restores: Array<() => void> = []\n const wrapped = new WeakSet<object>()\n\n const wrapAll = (): void => {\n for (const entry of ctx.slots.entries('conversation.chat.node')) {\n const key = entry.options.key\n if (key === undefined || SKIP_WRAP.has(key)) continue\n const current = entry.component\n if (!isWrappableComponent(current) || wrapped.has(current)) continue\n const inner = current as ComponentType<FollowWrapProps>\n const next = wrapFollowNodeView(inner)\n wrapped.add(next)\n entry.component = next\n restores.push(() => {\n if (entry.component === next) entry.component = inner\n })\n }\n }\n\n wrapAll()\n const off = ctx.on('slots/changed', (key: string) => {\n if (key === 'conversation.chat.node') wrapAll()\n })\n return () => {\n off()\n for (const restore of restores) restore()\n }\n}\n\n/**\n * A live preference cell read by `useSyncExternalStore`. It starts on the\n * shared default and, once the plugin-owned settings controller is attached,\n * tracks the resolved `thinkAutoExpand` value. A composition (or test) that\n * ships no settings surface keeps the cell on the default.\n */\nclass PreferenceCell {\n private readonly listeners = new Set<() => void>()\n private card: SmoothStreamCardController | undefined\n private value = DEFAULT_STREAM_SETTINGS.thinkAutoExpand\n\n /** Re-point the cell at the plugin-owned settings controller. */\n attach(card: SmoothStreamCardController): () => void {\n this.card = card\n this.refresh()\n const unsubscribe = card.subscribe(() => { this.refresh() })\n return () => {\n unsubscribe()\n if (this.card !== card) return\n this.card = undefined\n this.refresh()\n }\n }\n\n private read(): boolean {\n return this.card?.getSnapshot().thinkAutoExpand ?? DEFAULT_STREAM_SETTINGS.thinkAutoExpand\n }\n\n private refresh(): void {\n const next = this.read()\n if (next === this.value) return\n this.value = next\n for (const listener of this.listeners) listener()\n }\n\n readonly getSnapshot = (): boolean => this.value\n\n readonly subscribe = (listener: () => void): () => void => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n}\n\n/**\n * Register the typewriter renderer after the conversation package declares the\n * keyed Chat node seat. A lower priority shadows the built-in assistant row;\n * every other keyed renderer is wrapped in place so Context, commands, Tool\n * cards, retries, and workflow runs share one extensible follow boundary. The\n * Host-bridged configuration\n * selects the render direction, smoothing preset, and glide speed; the\n * plugin-owned settings RPC supplies the live auto-expand preference when the\n * settings surface is composed.\n * @param ctx - Browser context carrying the shared slot registry.\n */\nexport function apply(ctx: ClientContext): void {\n const config = readBootConfig()\n const preference = new PreferenceCell()\n\n // The card talks to the plugin-owned loopback RPC, so the core settings\n // namespace allowlist cannot make it disappear. The stream still applies\n // with defaults when the optional Settings UI or Connection is absent.\n ctx.inject(['slots', 'locale', 'connection'], (settingsCtx) => {\n const card = new SmoothStreamCardController(\n // The shared Context augmentation also carries the Host-side Connection\n // shape. This browser entry runs after the client provider installs its\n // handle, so narrow through unknown to its client contract here.\n createSmoothStreamSettingsApi(settingsCtx.get('connection') as unknown as ConnectionHandle),\n )\n const detachPreference = preference.attach(card)\n card.start()\n settingsCtx.effect(() => settingsCtx.locale.register(SETTINGS_NS, { zh, en }), 'dsh-smooth-stream: settings dictionaries')\n settingsCtx.slots.inject('settings.plugin.item', () => settingsCtx.slots.register({\n name: 'settings.plugin.item',\n id: 'smooth-stream',\n order: 30,\n locale: SETTINGS_NS,\n inject: () => card.inject(),\n }, SmoothStreamCard))\n return () => {\n card.stop()\n detachPreference()\n }\n })\n\n const configured = function StreamConfiguredView(props: AssistantProps) {\n const thinkAutoExpand = useSyncExternalStore(\n preference.subscribe,\n preference.getSnapshot,\n preference.getSnapshot,\n )\n return createElement(TypewriterAssistantNodeView, {\n ...props,\n mode: config.mode,\n preset: config.preset,\n revealCharsPerSec: config.revealCharsPerSec,\n scrollSpeedPxPerSec: config.scrollSpeedPxPerSec,\n maxScrollSpeedPxPerSec: config.maxScrollSpeedPxPerSec,\n thinkAutoExpand,\n })\n }\n ctx.slots.inject('conversation.chat.node', () => {\n const unwrap = wrapAgentChatRows(ctx)\n const unshadow = ctx.slots.register({\n name: 'conversation.chat.node',\n key: 'assistant-step',\n priority: -100,\n locale: 'conversation',\n registrant: 'dsh-smooth-stream',\n }, configured)\n return () => {\n unshadow()\n unwrap()\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,SAAS,GAAG,GAAG,OAA0C;GACvD,OAAO,MAAM,QAAO,SAAQ,SAAS,KAAA,KAAa,SAAS,EAAE,CAAC,CAAC,KAAK,GAAG;EACzE;;;;;;;EAqBA,SAAgB,mBAAmB,EACjC,MACA,OACA,MACA,UACA,kBACA,UACA,cACA,kBACA,gBACA,oBAC0B;GAC1B,MAAM,sBAAsB,UAAyC;IACnE,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;IAChD,MAAM,eAAe;IACrB,SAAS;GACX;GACA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAWA,+CAAI;IAAgB,aAAW,QAAQ,KAAA;IAAvD,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;KACE,WAAW,GAAGA,+CAAI,eAAe,YAAY;KAC7C,uBAAA;KACA,mBAAgB;KAChB,MAAK;KACL,UAAU;KACV,iBAAe;KACf,SAAS;KACT,WAAW;KARb,UAAA;MAUE,iBAAA,GAAA,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,GAAkBC,MAAAA,qBAAAA,CACtB,WAAW,WACX,WAAW,aACX,WAAW,WACb;IACA,QAAA,GAAOC,MAAAA,cAAAA,CAAc,6BAA6B;KAChD,GAAG;KACH,MAAM,OAAO;KACb,QAAQ,OAAO;KACf,mBAAmB,OAAO;KAC1B,qBAAqB,OAAO;KAC5B,wBAAwB,OAAO;KAC/B;IACF,CAAC;GACH;GACA,IAAI,MAAM,OAAO,gCAAgC;IAC/C,MAAM,SAAS,kBAAkB,GAAG;IACpC,MAAM,WAAW,IAAI,MAAM,SAAS;KAClC,MAAM;KACN,KAAK;KACL,UAAU;KACV,QAAQ;KACR,YAAY;IACd,GAAG,UAAU;IACb,aAAa;KACX,SAAS;KACT,OAAO;IACT;GACF,CAAC;EACH"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["css","IconChevronDownOutline14","useState","useRef","useCallback","useRef","useCallback","useRef","useRef","css","useState","memo","useRef","css","MarkdownText","IconThinkOutline14","useMemo","ImageGallery","JsonBlock","useRef","useState","useCallback","createElement","useState","css","IconChevronDownOutline14","IconRefreshOutline14","createSnapshotStore","SETTINGS_NS","useSyncExternalStore","createElement"],"sources":["../src/client/AnimatedDisclosure.tsx","../src/client/useSmoothStreamContent.ts","../src/client/useFpsGuard.ts","../src/client/teleprompterGlide.ts","../src/client/FollowHost.tsx","../src/config.ts","../src/settings.ts","../src/client/TypewriterAssistantNodeView.tsx","../src/client/useProgressiveDomText.ts","../src/client/TypewriterToolNodeView.tsx","../src/client/SmoothStreamCard.tsx","../src/client/smooth-stream-card-controller.ts","../src/settings-api.ts","../src/client/smooth-stream-settings-api.ts","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["// AnimatedDisclosure: the harness DisclosureRow chrome (24px row, hover\n// chevron preview, whole-row click/Enter/Space toggle) with one deliberate\n// difference - the expanded body stays mounted while collapsed and animates\n// between 0fr and 1fr grid tracks, so expand/collapse glides instead of\n// snapping. The harness primitive unmounts closed children (`{open &&\n// children}`) and a plugin cannot change that in place, so this fork mirrors\n// its DOM shape and `data-disclosure-row` contract: host styling keyed on the\n// row attribute and the Think chrome keep working unchanged.\n\nimport { type KeyboardEvent, type ReactNode } from 'react'\nimport { IconChevronDownOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport css from './TypewriterAssistantNodeView.module.css'\n\n/** Class-name join for optional overlay classes over the chrome defaults. */\nfunction cx(...parts: Array<string | undefined>): string {\n return parts.filter(part => part !== undefined && part !== '').join(' ')\n}\n\nexport interface AnimatedDisclosureProps {\n icon: ReactNode\n title: string\n open: boolean\n onToggle: () => void\n collapsedContent?: ReactNode\n children?: ReactNode\n rowClassName?: string | undefined\n leadingClassName?: string | undefined\n titleClassName?: string | undefined\n chevronClassName?: string | undefined\n}\n\n/**\n * Render one disclosure header whose expanded body is height-animated.\n * @param props - Visual content, controlled open state, and the toggle\n * callback fired by row click and Enter/Space.\n * @returns the animated disclosure row.\n */\nexport function AnimatedDisclosure({\n icon,\n title,\n open,\n onToggle,\n collapsedContent,\n children,\n rowClassName,\n leadingClassName,\n titleClassName,\n chevronClassName,\n}: AnimatedDisclosureProps) {\n const toggleFromKeyboard = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Enter' && event.key !== ' ') return\n event.preventDefault()\n onToggle()\n }\n return (\n <div className={css.disclosureRoot} data-open={open || undefined}>\n <div\n className={cx(css.disclosureRow, rowClassName)}\n data-disclosure-row\n data-expandable=\"\"\n role=\"button\"\n tabIndex={0}\n aria-expanded={open}\n onClick={onToggle}\n onKeyDown={toggleFromKeyboard}\n >\n <span className={cx(css.disclosureLeading, leadingClassName)}>\n {open\n ? <IconChevronDownOutline14 className={chevronClassName} />\n : (\n <>\n <span className={css.disclosureIconIdle}>{icon}</span>\n <IconChevronDownOutline14 className={cx(chevronClassName, css.disclosureChevronHover)} />\n </>\n )}\n </span>\n <span className={cx(css.disclosureTitle, titleClassName)}>{title}</span>\n {!open && collapsedContent}\n </div>\n <div className={css.disclosureContent} data-disclosure-content data-collapsed={open ? undefined : ''}>\n {children}\n </div>\n </div>\n )\n}\n","/**\n * Stream-smoothing reveal hook.\n *\n * Buffers the model's chunked text and reveals it at a cadence that tracks\n * the observed arrival rate, so a long reply never dumps whole paragraphs at\n * once and a fast stream never stutters. Port of lobe-ui's smoother: EMA\n * arrival cps + chunk size, backlog pressure, commit-interval widening with\n * tail length, and a flush-speed settle drain once the input idles. The\n * reveal decision is the pure {@link computeRevealStep} for unit tests.\n *\n * `shouldHoldBack` is the performance guard's veto: while it returns true the\n * loop keeps measuring but skips the DOM commit, so an offscreen reply never\n * competes with visible frames when the frame rate is degraded.\n */\n\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nexport type StreamSmoothingPreset = 'realtime' | 'balanced' | 'silky'\n\nexport interface StreamSmoothingPresetConfig {\n readonly activeInputWindowMs: number\n readonly defaultCps: number\n readonly emaAlpha: number\n readonly flushCps: number\n readonly largeAppendChars: number\n readonly maxActiveCps: number\n readonly maxCps: number\n readonly maxFlushCps: number\n readonly minCps: number\n readonly settleAfterMs: number\n readonly settleDrainMaxMs: number\n readonly settleDrainMinMs: number\n readonly targetBufferMs: number\n}\n\nexport const PRESET_CONFIG: Record<StreamSmoothingPreset, StreamSmoothingPresetConfig> = {\n balanced: {\n activeInputWindowMs: 220,\n defaultCps: 80,\n emaAlpha: 0.35,\n flushCps: 180,\n largeAppendChars: 120,\n maxActiveCps: 360,\n maxCps: 240,\n maxFlushCps: 480,\n minCps: 24,\n settleAfterMs: 280,\n settleDrainMaxMs: 420,\n settleDrainMinMs: 120,\n targetBufferMs: 40,\n },\n realtime: {\n activeInputWindowMs: 140,\n defaultCps: 120,\n emaAlpha: 0.45,\n flushCps: 240,\n largeAppendChars: 180,\n maxActiveCps: 480,\n maxCps: 320,\n maxFlushCps: 640,\n minCps: 32,\n settleAfterMs: 200,\n settleDrainMaxMs: 280,\n settleDrainMinMs: 100,\n targetBufferMs: 24,\n },\n silky: {\n activeInputWindowMs: 280,\n defaultCps: 64,\n emaAlpha: 0.28,\n flushCps: 140,\n largeAppendChars: 100,\n maxActiveCps: 280,\n maxCps: 180,\n maxFlushCps: 400,\n minCps: 20,\n settleAfterMs: 360,\n settleDrainMaxMs: 520,\n settleDrainMinMs: 160,\n targetBufferMs: 56,\n },\n}\n\n/** Pressure curve from the reference stream renderer. */\nexport const QUEUE_BASE_SPEED_CPS = 90\nexport const QUEUE_ACCEL_EXPONENT = 1.25\nexport const QUEUE_PRESSURE_FACTOR = 0.85\nexport const QUEUE_MAX_SPEED_CPS = 600\n/** Hard cap on how far display may trail a live stream, in characters. */\nexport const LIVE_LAG_CHAR_CEILING = 32\nconst CATCHUP_SECONDS = 0.15\n\nexport const clamp = (value: number, min: number, max: number): number => {\n return Math.min(max, Math.max(min, value))\n}\n\n/**\n * Reference pressure-buffer reveal for a frame that starts without debt.\n * @param backlog - Unrevealed characters.\n * @param dtMs - Frame delta in ms.\n * @returns Characters to reveal this frame.\n */\nexport function computeQueueReveal(backlog: number, dtMs: number): number {\n if (backlog <= 0 || dtMs <= 0) return 0\n return computeAdaptiveQueueStep(backlog, dtMs, 0).revealChars\n}\n\nexport interface AdaptiveQueueStep {\n readonly revealChars: number\n readonly debt: number\n readonly speedCps: number\n}\n\n/** Float-debt queue integration from `ultimate_stream_physics_scroller.html`. */\nexport function computeAdaptiveQueueStep(\n backlog: number,\n dtMs: number,\n debt: number,\n revealScale = 1,\n): AdaptiveQueueStep {\n if (backlog <= 0 || dtMs <= 0) return { revealChars: 0, debt: 0, speedCps: 0 }\n const speedCps = Math.min(\n QUEUE_MAX_SPEED_CPS,\n QUEUE_BASE_SPEED_CPS + Math.pow(backlog, QUEUE_ACCEL_EXPONENT) * QUEUE_PRESSURE_FACTOR,\n )\n const effectiveScale = clamp(revealScale, 0.05, 1)\n const accumulated = Math.max(0, debt) + speedCps * effectiveScale * (dtMs / 1000)\n const revealChars = Math.min(backlog, Math.floor(accumulated))\n return { revealChars, debt: revealChars >= backlog ? 0 : accumulated - revealChars, speedCps }\n}\n\n/** Counts user-perceived characters (code points), not UTF-16 units. */\nexport const countChars = (text: string): number => {\n let count = 0\n for (const char of text) {\n void char\n count += 1\n }\n return count\n}\n\n/**\n * Drain rate for backlog beyond the tail-lag ceiling: the displayed text may\n * trail the stream by at most `backlogCharCeiling` characters for at most\n * `backlogSecondCeiling` seconds. The constants are a smoothness invariant\n * (bounded lag is the reason the reveal never stalls mid-reply), so they are\n * not config fields; the preset multiplier is how a deployment tunes them.\n */\nexport const BACKLOG_CHAR_CEILING = 300\nexport const BACKLOG_SECOND_CEILING = 2\n\nexport interface SettleDrainInput {\n readonly backlog: number\n readonly inputActive: boolean\n readonly settling: boolean\n}\n\n/** Pure settle-drain decision shared by the frame loop and its tests. */\nexport function computeSettleDrain(config: StreamSmoothingPresetConfig, input: SettleDrainInput): number {\n if (input.inputActive || !input.settling) return 0\n // A settled stream must drain fast enough to finish the reply promptly:\n // lag beyond the ceiling drains within the second ceiling.\n const overflow = Math.max(0, input.backlog - BACKLOG_CHAR_CEILING)\n const overflowCps = (overflow * 1000) / BACKLOG_SECOND_CEILING\n const drainTargetMs = clamp(input.backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs)\n const settleCps = (input.backlog * 1000) / drainTargetMs\n return clamp(Math.max(settleCps, overflowCps), config.flushCps, config.maxFlushCps)\n}\n\n/** Fixed velocity that closes a producer-complete queue within its deadline. */\nexport function computeCompletionDrain(\n config: StreamSmoothingPresetConfig,\n backlog: number,\n): number {\n if (backlog <= 0) return 0\n const drainTargetMs = clamp(backlog * 8, config.settleDrainMinMs, config.settleDrainMaxMs)\n const deadlineCps = (backlog * 1000) / drainTargetMs\n return Math.max(\n deadlineCps,\n computeSettleDrain(config, { backlog, inputActive: false, settling: true }),\n )\n}\n\n/**\n * Drain rate multiplier once the input ends: leftover backlog reveals at\n * this multiple of the steady rate, so the end never drags.\n */\nexport const SETTLE_DRAIN_MULTIPLIER = 1.8\n\nexport interface RevealStepInput {\n readonly backlog: number\n readonly chunkSizeEma: number\n readonly arrivalCpsEma: number\n readonly emaCps: number\n readonly inputActive: boolean\n readonly settling: boolean\n /** Fixed reveal rate; overrides the arrival-tracking cadence entirely. */\n readonly steadyCps?: number | undefined\n}\n\nexport interface RevealStepResult {\n readonly revealChars: number\n readonly targetLagChars: number\n}\n\n/** Pure per-frame reveal decision shared by the loop and its tests. */\nexport function computeRevealStep(config: StreamSmoothingPresetConfig, input: RevealStepInput, dtSeconds: number): RevealStepResult {\n // Track the faster of the two EMAs and do not clamp to the old low maxCps\n // ceiling — that cap is why a fast model left hundreds of chars unrevealed.\n const trackedCps = Math.max(input.emaCps, input.arrivalCpsEma)\n const baseCps = clamp(trackedCps, config.minCps, config.maxFlushCps)\n const targetLagChars = input.inputActive\n ? Math.max(2, Math.round((baseCps * config.targetBufferMs) / 1000))\n : 0\n\n let currentCps: number\n if (input.steadyCps !== undefined) {\n currentCps = input.inputActive || input.settling\n ? clamp(\n input.steadyCps * (input.inputActive ? 1 : SETTLE_DRAIN_MULTIPLIER),\n config.minCps,\n config.maxFlushCps,\n )\n : 0\n } else if (input.inputActive) {\n const overflow = Math.max(0, input.backlog - LIVE_LAG_CHAR_CEILING)\n const catchup = overflow > 0 ? overflow / CATCHUP_SECONDS : 0\n currentCps = clamp(baseCps * 1.08 + catchup, config.minCps, config.maxFlushCps)\n } else if (input.settling) {\n currentCps = computeSettleDrain(config, input)\n } else {\n const idleFlushCps = Math.max(config.flushCps, baseCps * 1.8, input.arrivalCpsEma * 0.8)\n currentCps = clamp(idleFlushCps, config.flushCps, config.maxFlushCps)\n }\n\n const minRevealChars = input.inputActive ? 1 : 2\n return { revealChars: Math.max(minRevealChars, Math.round(currentCps * dtSeconds)), targetLagChars }\n}\n\nexport interface UseSmoothStreamContentOptions {\n enabled?: boolean\n /** The producer has completed; drain queued text without live backpressure. */\n inputComplete?: boolean\n preset?: StreamSmoothingPreset\n /** Performance guard veto: while true, reveal commits are held back. */\n shouldHoldBack?: (() => boolean) | undefined\n /**\n * Fixed reveal rate in chars/s. When set, the reveal runs at this steady\n * pace while the input streams (instead of tracking the arrival rate) and\n * drains an inferred idle backlog at {@link SETTLE_DRAIN_MULTIPLIER}.\n * Explicit producer completion still uses the bounded completion drain.\n */\n steadyCps?: number | undefined\n /**\n * Seed for the arrival-rate EMA. When omitted, the preset's `defaultCps`\n * is used. The live rate then tracks observed arrival; this is not a cap.\n */\n defaultCps?: number | undefined\n /** Written each commit with the live arrival-rate EMA for the follow lerp. */\n speedCpsRef?: { current: number } | undefined\n /** Live multiplier from the follow spring when safe visual lag is filling. */\n revealScaleRef?: { current: number } | undefined\n}\n\n/**\n * Smooth a chunked content stream into a reveal-paced display string.\n *\n * @param content - The full accumulated input so far.\n * @param options - Preset, guard, and steady-rate wiring.\n * @returns The displayed content, revealed at the smoothed cadence.\n */\nexport function useSmoothStreamContent(\n content: string,\n {\n enabled = true,\n inputComplete = false,\n preset = 'balanced',\n shouldHoldBack,\n steadyCps,\n defaultCps,\n speedCpsRef,\n revealScaleRef,\n }: UseSmoothStreamContentOptions = {},\n): string {\n const config = PRESET_CONFIG[preset]\n const seedCps = defaultCps ?? config.defaultCps\n // A fast provider can fill the first Host render with a large batch. Start\n // an enabled stream behind that batch so it still enters the reveal queue;\n // disabled (settled/history) content must remain immediate.\n const initialContent = enabled ? '' : content\n const [displayedContent, setDisplayedContent] = useState(initialContent)\n\n const displayedContentRef = useRef(initialContent)\n const displayedCountRef = useRef(countChars(initialContent))\n const targetContentRef = useRef(initialContent)\n const targetCharsRef = useRef([...initialContent])\n const targetCountRef = useRef(countChars(initialContent))\n\n const emaCpsRef = useRef(seedCps)\n const lastInputTsRef = useRef(0)\n const lastInputCountRef = useRef(countChars(initialContent))\n const chunkSizeEmaRef = useRef(1)\n const arrivalCpsEmaRef = useRef(seedCps)\n\n const rafRef = useRef<number | null>(null)\n const lastFrameTsRef = useRef<number | null>(null)\n const queueDebtRef = useRef(0)\n const settleCpsRef = useRef<number | null>(null)\n const holdBackRef = useRef(shouldHoldBack)\n const speedOutRef = useRef(speedCpsRef)\n speedOutRef.current = speedCpsRef\n const revealScaleOutRef = useRef(revealScaleRef)\n revealScaleOutRef.current = revealScaleRef\n const inputCompleteRef = useRef(inputComplete)\n inputCompleteRef.current = inputComplete\n\n useEffect(() => {\n holdBackRef.current = shouldHoldBack\n }, [shouldHoldBack])\n\n const stopFrameLoop = useCallback(() => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n lastFrameTsRef.current = null\n }, [])\n\n const startFrameLoopRef = useRef<() => void>(() => {})\n\n const syncImmediate = useCallback(\n (nextContent: string) => {\n stopFrameLoop()\n const chars = [...nextContent]\n const now = performance.now()\n targetContentRef.current = nextContent\n targetCharsRef.current = chars\n targetCountRef.current = chars.length\n displayedContentRef.current = nextContent\n displayedCountRef.current = chars.length\n queueDebtRef.current = 0\n settleCpsRef.current = null\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = seedCps\n setDisplayedContent(nextContent)\n emaCpsRef.current = seedCps\n chunkSizeEmaRef.current = 1\n arrivalCpsEmaRef.current = seedCps\n lastInputTsRef.current = now\n lastInputCountRef.current = chars.length\n },\n [seedCps, stopFrameLoop],\n )\n\n // Producer completion is authoritative. Publish the accumulated source in\n // the same commit instead of leaving a visible typewriter tail after the\n // Agent has already stopped; the conversation follower still glides any\n // resulting layout height before paint.\n useLayoutEffect(() => {\n if (!enabled || !inputComplete || displayedContentRef.current === content) return\n syncImmediate(content)\n }, [content, enabled, inputComplete, syncImmediate])\n\n const startFrameLoop = useCallback(() => {\n if (rafRef.current !== null) return\n\n const tick = (now: number) => {\n const targetCount = targetCountRef.current\n const displayedCount = displayedCountRef.current\n const backlog = targetCount - displayedCount\n\n if (backlog <= 0) {\n queueDebtRef.current = 0\n settleCpsRef.current = null\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = seedCps\n stopFrameLoop()\n return\n }\n\n if (lastFrameTsRef.current === null) {\n lastFrameTsRef.current = now\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n const frameIntervalMs = Math.max(0, now - lastFrameTsRef.current)\n const dtSeconds = Math.max(0.001, Math.min(frameIntervalMs / 1000, 0.12))\n lastFrameTsRef.current = now\n\n const idleMs = now - lastInputTsRef.current\n const producerComplete = inputCompleteRef.current\n const inputActive = !producerComplete && idleMs <= config.activeInputWindowMs\n const settling = producerComplete || (!inputActive && idleMs >= config.settleAfterMs)\n if (!producerComplete) settleCpsRef.current = null\n\n let revealChars: number\n let revealSpeedCps: number\n let nextQueueDebt = 0\n if (producerComplete) {\n // Backpressure protects live layout. Once input has ended, retaining\n // that scale only makes a completed response keep typing onscreen.\n // Keep one drain velocity for the whole completion tail. Recomputing\n // it from the shrinking backlog creates an exponential slow tail.\n const settleCps = settleCpsRef.current ?? computeCompletionDrain(config, backlog)\n settleCpsRef.current = settleCps\n const accumulated = Math.max(0, queueDebtRef.current) + settleCps * dtSeconds\n revealChars = Math.min(backlog, Math.floor(accumulated))\n revealSpeedCps = settleCps\n nextQueueDebt = revealChars >= backlog ? 0 : accumulated - revealChars\n } else if (steadyCps !== undefined) {\n const step = computeRevealStep(\n config,\n {\n backlog,\n chunkSizeEma: chunkSizeEmaRef.current,\n arrivalCpsEma: arrivalCpsEmaRef.current,\n emaCps: emaCpsRef.current,\n inputActive,\n settling,\n steadyCps,\n },\n dtSeconds,\n )\n revealChars = Math.min(step.revealChars, backlog)\n revealSpeedCps = frameIntervalMs > 0 ? (revealChars * 1000) / frameIntervalMs : 0\n } else {\n const step = computeAdaptiveQueueStep(\n backlog,\n frameIntervalMs,\n queueDebtRef.current,\n revealScaleOutRef.current?.current ?? 1,\n )\n revealChars = step.revealChars\n revealSpeedCps = step.speedCps\n nextQueueDebt = step.debt\n }\n\n // Performance guard: while degraded and the reply is offscreen, skip\n // the DOM commit — the backlog keeps accumulating and flushes when the\n // guard clears or the reply scrolls into view.\n if (holdBackRef.current?.() === true) {\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n queueDebtRef.current = nextQueueDebt\n\n const speedOut = speedOutRef.current\n if (speedOut !== undefined) speedOut.current = revealSpeedCps\n\n if (revealChars <= 0) {\n rafRef.current = requestAnimationFrame(tick)\n return\n }\n\n const nextCount = displayedCount + revealChars\n const segment = targetCharsRef.current.slice(displayedCount, nextCount).join('')\n if (segment) {\n const nextDisplayed = displayedContentRef.current + segment\n displayedContentRef.current = nextDisplayed\n displayedCountRef.current = nextCount\n setDisplayedContent(nextDisplayed)\n } else {\n displayedContentRef.current = targetContentRef.current\n displayedCountRef.current = targetCount\n setDisplayedContent(targetContentRef.current)\n }\n\n rafRef.current = requestAnimationFrame(tick)\n }\n\n rafRef.current = requestAnimationFrame(tick)\n }, [config, stopFrameLoop, steadyCps])\n\n useEffect(() => {\n startFrameLoopRef.current = startFrameLoop\n }, [startFrameLoop])\n\n useEffect(() => {\n if (!enabled) {\n syncImmediate(content)\n return\n }\n\n const prevTargetContent = targetContentRef.current\n if (content === prevTargetContent) return\n\n const now = performance.now()\n const appendOnly = content.startsWith(prevTargetContent)\n\n if (!appendOnly) {\n syncImmediate(content)\n return\n }\n\n const appended = content.slice(prevTargetContent.length)\n const appendedChars = [...appended]\n const appendedCount = appendedChars.length\n\n targetContentRef.current = content\n targetCharsRef.current.push(...appendedChars)\n targetCountRef.current += appendedCount\n settleCpsRef.current = null\n\n const hadSample = lastInputTsRef.current > 0\n const deltaChars = targetCountRef.current - lastInputCountRef.current\n const deltaMs = Math.max(1, now - lastInputTsRef.current)\n\n // Skip the first sample: lastInputTs starts at 0, so the interval would\n // be \"time since page load\" (or 1ms under fake timers) and poison the EMA.\n if (hadSample && deltaChars > 0) {\n const instantCps = (deltaChars * 1000) / deltaMs\n const normalizedInstantCps = clamp(instantCps, config.minCps, config.maxFlushCps * 3)\n const chunkEmaAlpha = 0.45\n chunkSizeEmaRef.current = chunkSizeEmaRef.current * (1 - chunkEmaAlpha) + appendedCount * chunkEmaAlpha\n arrivalCpsEmaRef.current = arrivalCpsEmaRef.current * (1 - chunkEmaAlpha) + normalizedInstantCps * chunkEmaAlpha\n emaCpsRef.current = emaCpsRef.current * (1 - config.emaAlpha) + normalizedInstantCps * config.emaAlpha\n }\n\n lastInputTsRef.current = now\n lastInputCountRef.current = targetCountRef.current\n\n startFrameLoop()\n }, [content, enabled, config, startFrameLoop, syncImmediate])\n\n useEffect(() => {\n return () => {\n stopFrameLoop()\n }\n }, [stopFrameLoop])\n\n return displayedContent\n}\n","/**\n * Performance guard for the streaming reveal.\n *\n * Feeds an EMA-smoothed frame-rate monitor from a rAF loop while streaming\n * and tracks whether the reply is on-screen. The returned `shouldHoldBack`\n * predicate is true only while the frame rate is below the threshold AND the\n * reply is offscreen — exactly the spec's \"skip offscreen DOM updates when\n * FPS < 30\" rule. The smoother consumes the predicate as its commit veto.\n */\n\nimport { useCallback, useEffect, useRef } from 'react'\n\nconst FPS_THRESHOLD = 30\nconst FPS_ALPHA = 0.12\nconst RECOVER_FRAMES = 6\nconst MAX_FRAME_MS = 100\n\ninterface MutableFps {\n emaMs: number\n lastMs: number\n healthyRun: number\n degraded: boolean\n}\n\nexport function useFpsGuard(active: boolean): {\n ref: (element: HTMLElement | null) => void\n shouldHoldBack: () => boolean\n} {\n const fpsRef = useRef<MutableFps>({ emaMs: 0, lastMs: 0, healthyRun: 0, degraded: false })\n const visibleRef = useRef(true)\n const elementRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!active) return\n let rafId = 0\n const frame = (now: number) => {\n rafId = requestAnimationFrame(frame)\n const fps = fpsRef.current\n if (fps.lastMs === 0) {\n fps.lastMs = now\n return\n }\n const delta = Math.min(MAX_FRAME_MS, Math.max(1, now - fps.lastMs))\n fps.lastMs = now\n fps.emaMs = fps.emaMs === 0 ? delta : fps.emaMs + FPS_ALPHA * (delta - fps.emaMs)\n const currentFps = 1000 / fps.emaMs\n if (currentFps < FPS_THRESHOLD) {\n fps.healthyRun = 0\n fps.degraded = true\n } else if (fps.degraded) {\n fps.healthyRun += 1\n if (fps.healthyRun >= RECOVER_FRAMES) fps.degraded = false\n }\n }\n rafId = requestAnimationFrame(frame)\n return () => {\n cancelAnimationFrame(rafId)\n fpsRef.current = { emaMs: 0, lastMs: 0, healthyRun: 0, degraded: false }\n }\n }, [active])\n\n const ref = useCallback((element: HTMLElement | null) => {\n elementRef.current = element\n }, [])\n\n useEffect(() => {\n const element = elementRef.current\n if (element === null || typeof IntersectionObserver === 'undefined') return\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) visibleRef.current = entry.isIntersecting\n },\n { rootMargin: '120px 0px' },\n )\n observer.observe(element)\n return () => observer.disconnect()\n })\n\n const shouldHoldBack = useCallback(() => {\n return active && fpsRef.current.degraded && !visibleRef.current\n }, [active])\n\n return { ref, shouldHoldBack }\n}\n","/**\n * Conversation-port follow while an assistant reply streams.\n *\n * A sub-stepped spring physics engine drives a float `animatedH`, rather\n * than restarting native smooth-scroll animations as every glyph lands.\n * Remaining lag rides a small compositor transform while the real scrollport\n * stays at its floor. The transform is bounded by the measured paint gap\n * before conversation chrome. This follower:\n *\n * - marks programmatic writes via `data-follow-owned` for compatible hosts;\n * - sets `overflow-anchor: none` so CSS scroll-anchoring does not snap;\n * - restores `animatedH` in a ResizeObserver (before paint) so a layout\n * pass cannot flash a snapped frame;\n * - expresses safe lag as a compositor transform on message rows;\n * - opens a speed-adaptive layout runway before fast output wraps, preserving\n * the reference spring constants at every reveal speed;\n * - catches up any lag that cannot fit before turn status / composer chrome,\n * so fixed chrome never has to counter-shift and the host stays at-bottom;\n * - never clips or overlays streamed text.\n *\n * A real reader gesture receives the effective visual position before the\n * transform clears. Lifecycle completion instead settles at the floor.\n *\n * Directional wheel/touch intent unpins immediately; pointer/key input falls\n * back to an upward scroll delta from the engine's own written position. A\n * reader release re-acquires only after returning to the real floor.\n */\n\nimport { useEffect, useLayoutEffect, useRef, type RefObject } from 'react'\n\n/**\n * Programmatic follow marker retained for hosts that recognize external\n * scroll ownership. Current Harness also sees the write land at the floor.\n */\nconst FOLLOW_OWNED_ATTR = 'data-follow-owned'\n\n/** Physics parameters from `ultimate_stream_physics_scroller.html`. */\nexport const FOLLOW_SPRING_STIFFNESS = 130\nexport const FOLLOW_SPRING_DAMPING = 24\nexport const FOLLOW_SPRING_MASS = 1\nexport const FOLLOW_SPRING_SUBSTEPS = 4\nexport const FOLLOW_SPRING_MAX_STEP_MS = 32\n\n/** Minimum visible room for one ordinary line-wrap impulse. */\nexport const FOLLOW_RESERVE_MIN_PX = 16\n\n/** Reveal-speed range produced by the pressure-buffer typewriter. */\nexport const FOLLOW_RESERVE_MIN_CPS = 90\nexport const FOLLOW_RESERVE_MAX_CPS = 600\n\n/** Time constant for opening/closing predictive paint room. */\nexport const FOLLOW_RESERVE_RESPONSE_MS = 180\n\n/**\n * The reference engine clamps physical time to one 32ms visual interval.\n * Replaying a 250ms main-thread stall in one paint teleports the transcript;\n * leaving the remaining distance in the spring makes the next frames catch up\n * smoothly instead.\n */\nexport const FOLLOW_MAX_FRAME_MS = 32\n\n/** Retained as the neutral reveal-speed seed for follow hosts. */\nexport const FOLLOW_SPEED_REF_CPS = 35\n\n/** Reader-return / still-pinned boundary, matching ChatView + the demo. */\nexport const FOLLOW_SLACK_PX = 25\n\n/**\n * Fallback upward scroll distance that releases the pin when the browser does\n * not expose a directional wheel/touch event. Directional intent releases\n * immediately even if the follow write erases the small physical delta.\n */\nexport const FOLLOW_UNPIN_GESTURE_PX = 8\n\n/** A reader-released follow only re-acquires at the actual floor. */\nexport const FOLLOW_REPIN_PX = 1\n\n/** ChatView's <=25px bottom band remains host-pinned; release beyond it. */\nexport const FOLLOW_HOST_RELEASE_PX = FOLLOW_SLACK_PX + 1\n\n/** Sub-pixel paint guard before status/composer chrome. */\nexport const FOLLOW_PAINT_GUARD_PX = 1\n\n/**\n * Maximum predictive paint room before status/composer chrome. One rendered\n * line is normally 24-28px; 48px plus the host's existing status gap covers\n * the original spring's measured ~63px worst-case trail at 600cps.\n */\nexport const FOLLOW_STATUS_RUNWAY_PX = 48\n\n/** How long a gesture keeps `isUserInteracting` so the next scroll can unpin. */\nexport const FOLLOW_GESTURE_MS = 800\n\n/** Sub-pixel settle threshold; clearing below this cannot produce a visible rebound. */\nexport const FOLLOW_SETTLE_EPSILON_PX = 0.25\n\n/** Lowest reveal rate retained while the spring is short on paint room. */\nexport const FOLLOW_REVEAL_MIN_SCALE = 0.55\n\n/** Safe-lag occupancy band over which reveal pressure is progressively reduced. */\nexport const FOLLOW_BACKPRESSURE_START_RATIO = 0.25\nexport const FOLLOW_BACKPRESSURE_FULL_RATIO = 0.75\n\n/** Slow release prevents the reveal rate from oscillating around each wrap. */\nexport const FOLLOW_BACKPRESSURE_RELEASE_MS = 240\n\nconst GESTURE_EVENTS = [\n 'wheel',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'keydown',\n] as const\n\n/** Visible runway needed for the current reveal pressure. */\nexport function computeFollowReserve(speedCps: number, runwayPx = FOLLOW_STATUS_RUNWAY_PX): number {\n const available = Math.max(0, runwayPx)\n if (available <= 0) return 0\n if (speedCps <= FOLLOW_RESERVE_MIN_CPS) return 0\n const normalized = Math.min(1, Math.max(0, (\n speedCps - FOLLOW_RESERVE_MIN_CPS\n ) / (FOLLOW_RESERVE_MAX_CPS - FOLLOW_RESERVE_MIN_CPS)))\n const minimum = Math.min(available, FOLLOW_RESERVE_MIN_PX)\n return minimum + normalized * (available - minimum)\n}\n\n/**\n * Reveal-rate multiplier needed to retain one-wrap headroom for the spring.\n * Throttling starts only after a quarter of the safe transform is occupied;\n * a constrained paint lands at the minimum immediately so the next reveal\n * commit cannot keep feeding an already-full visual buffer.\n */\nexport function computeFollowRevealScale(\n lagPx: number,\n capacityPx: number,\n constrained = false,\n): number {\n if (constrained) return FOLLOW_REVEAL_MIN_SCALE\n if (!Number.isFinite(capacityPx)) return 1\n if (capacityPx <= 0) return lagPx > 0 ? FOLLOW_REVEAL_MIN_SCALE : 1\n const ratio = Math.min(1, Math.max(0, lagPx / capacityPx))\n if (ratio >= FOLLOW_BACKPRESSURE_FULL_RATIO) return FOLLOW_REVEAL_MIN_SCALE\n const progress = Math.min(1, Math.max(0, (\n ratio - FOLLOW_BACKPRESSURE_START_RATIO\n ) / (FOLLOW_BACKPRESSURE_FULL_RATIO - FOLLOW_BACKPRESSURE_START_RATIO)))\n const eased = progress * progress * (3 - 2 * progress)\n return 1 - (1 - FOLLOW_REVEAL_MIN_SCALE) * eased\n}\n\nexport interface FollowGlideInput {\n /** How far the interpolated top trails the floor, in px. */\n readonly lag: number\n /** Observed reveal rate, retained for the public follow-step contract. */\n readonly speedEma: number\n /** Physics velocity carried from the previous frame, in px/s. */\n readonly velocityPxPerSec?: number\n}\n\nexport interface FollowGlideStep {\n /** Pixels to advance the floating content extent this frame. */\n readonly advancePx: number\n /** Applied lerp fraction, for tests. */\n readonly lerpStep: number\n /** Physics velocity to carry into the next frame, in px/s. */\n readonly velocityPxPerSec: number\n}\n\n/**\n * Semi-implicit spring integration with four substeps per <=32ms slice.\n * @param dtMs - Frame delta in ms.\n * @param input - Current visible lag and carried physics velocity.\n * @returns The position advance, its fraction, and next velocity.\n */\nexport function computeFollowStep(dtMs: number, input: FollowGlideInput): FollowGlideStep {\n if (input.lag <= 0.1 || dtMs <= 0) {\n return { advancePx: 0, lerpStep: 0, velocityPxPerSec: 0 }\n }\n let lag = input.lag\n let velocity = Math.max(0, input.velocityPxPerSec ?? 0)\n const elapsedMs = Math.min(FOLLOW_MAX_FRAME_MS, dtMs)\n const slices = Math.max(1, Math.ceil(elapsedMs / FOLLOW_SPRING_MAX_STEP_MS))\n const subDt = elapsedMs / 1000 / slices / FOLLOW_SPRING_SUBSTEPS\n\n for (let slice = 0; slice < slices; slice += 1) {\n for (let substep = 0; substep < FOLLOW_SPRING_SUBSTEPS; substep += 1) {\n const acceleration = (\n FOLLOW_SPRING_STIFFNESS * lag - FOLLOW_SPRING_DAMPING * velocity\n ) / FOLLOW_SPRING_MASS\n velocity = Math.max(0, velocity + acceleration * subDt)\n const advance = velocity * subDt\n if (advance >= lag) {\n return { advancePx: input.lag, lerpStep: 1, velocityPxPerSec: 0 }\n }\n lag -= advance\n }\n }\n\n const advancePx = input.lag - lag\n return { advancePx, lerpStep: advancePx / input.lag, velocityPxPerSec: velocity }\n}\n\n/** Element whose resize signals flow growth for the before-paint restore. */\nfunction resizeProxyOf(port: HTMLElement): HTMLElement | null {\n return port.querySelector('[data-chat-transcript]') ?? port.querySelector('[data-chat-flow]')\n}\n\n/** Outermost message surfaces; nested tool rows ride their parent. */\nfunction shiftSurfacesOf(port: HTMLElement): HTMLElement[] {\n const transcript = port.querySelector<HTMLElement>('[data-chat-transcript]')\n if (transcript !== null) return [transcript]\n return [...port.querySelectorAll<HTMLElement>('[data-chat-anchor-key]')]\n .filter(row => row.parentElement?.closest('[data-chat-anchor-key]') === null)\n}\n\nfunction currentShiftOf(element: HTMLElement): number {\n return Number(\n /translate3d\\(0(?:px)?,\\s*(-?[\\d.]+)px,\\s*0(?:px)?\\)/.exec(element.style.transform)?.[1] ?? 0,\n )\n}\n\nfunction setShift(element: HTMLElement, px: number): void {\n if (Math.abs(px) > 0.01) {\n if (\n Math.abs(currentShiftOf(element) - px) <= 0.01\n && element.style.willChange === 'transform'\n && element.style.clipPath === ''\n ) {\n return\n }\n element.style.transform = `translate3d(0, ${px}px, 0)`\n element.style.willChange = 'transform'\n } else {\n if (element.style.transform === '' && element.style.willChange === '' && element.style.clipPath === '') return\n element.style.transform = ''\n element.style.willChange = ''\n }\n // Remove paint state left by v0.3.2 and earlier experimental builds.\n element.style.clipPath = ''\n}\n\nfunction turnStatusOf(port: HTMLElement): HTMLElement | null {\n return port.querySelector<HTMLElement>(\n '[data-chat-turn-status], [data-chat-flow] > [role=\"status\"]',\n )\n}\n\n/** Height committed by one newly mounted Chat row, including its flex gap. */\nfunction entranceExtentOf(root: HTMLElement): number {\n const row = root.closest<HTMLElement>('[data-chat-flow-key]') ?? root\n const rect = row.getBoundingClientRect()\n const height = Math.max(0, rect.height, rect.bottom - rect.top, row.offsetHeight)\n let previous = row.previousElementSibling\n while (previous instanceof HTMLElement) {\n const previousRect = previous.getBoundingClientRect()\n if (previousRect.height > 0 || previousRect.bottom > previousRect.top) {\n return Math.max(height, rect.bottom - previousRect.bottom)\n }\n previous = previous.previousElementSibling\n }\n return height\n}\n\ninterface FollowRunway {\n readonly element: HTMLElement\n readonly offset: number\n readonly original: string\n readonly property: 'marginBottom' | 'marginTop'\n}\n\n/**\n * The plugin can be reinjected without replacing the conversation DOM. Keep\n * runway ownership in the page realm so a fresh bundle adopts the existing\n * margin instead of treating it as host layout and adding another 48px.\n */\nconst FOLLOW_RUNWAYS_SYMBOL = Symbol.for('dsh-smooth-stream.follow-runways')\nconst followRunwayRegistry = globalThis as typeof globalThis & {\n [key: symbol]: WeakMap<HTMLElement, FollowRunway> | undefined\n}\nconst followRunways = followRunwayRegistry[FOLLOW_RUNWAYS_SYMBOL]\n ?? new WeakMap<HTMLElement, FollowRunway>()\nfollowRunwayRegistry[FOLLOW_RUNWAYS_SYMBOL] = followRunways\n\ninterface FollowPaintLimit {\n readonly clientHeight: number\n readonly limit: number\n readonly measuredAtMs: number\n readonly composer: HTMLElement | null\n readonly status: HTMLElement | null\n readonly surface: HTMLElement | undefined\n}\n\n/**\n * A rect read can force a layout flush. At the floor the flow bottom sits on\n * the scrollport bottom, so while content streams the paint limit (chrome top\n * minus flow bottom) is constant; it only truly changes when the viewport or\n * conversation chrome changes. A measured limit therefore stays trusted for\n * this long even as contentHeight grows, so ordinary glyph frames never pay\n * a forced layout.\n */\nexport const FOLLOW_PAINT_LIMIT_TTL_MS = 250\n\nconst followPaintLimits = new WeakMap<HTMLElement, FollowPaintLimit>()\n\nfunction invalidatePaintLimit(port: HTMLElement): void {\n followPaintLimits.delete(port)\n}\n\ninterface FollowMotionState {\n readonly capacityPx: number\n readonly constrained: boolean\n readonly extent: number\n readonly lagPx: number\n readonly reservePx: number\n readonly velocityPxPerSec: number\n}\n\n/** Logical position and velocity survive a React owner handoff and finish. */\nconst followMotionStates = new WeakMap<HTMLElement, FollowMotionState>()\n\nfunction restoreRunway(port: HTMLElement): void {\n const runway = followRunways.get(port)\n if (runway === undefined) return\n runway.element.style[runway.property] = runway.original\n followRunways.delete(port)\n invalidatePaintLimit(port)\n}\n\nfunction isLegacyRunway(value: string): boolean {\n if (value === '') return false\n const terms = [...value.matchAll(/([\\d.]+)px/g)]\n if (terms.length === 0 || value.replaceAll(/calc|px|[\\d.+()\\s]/g, '') !== '') return false\n return terms.every(([, raw]) => {\n const px = Number(raw)\n return Number.isFinite(px)\n && px >= FOLLOW_STATUS_RUNWAY_PX\n && Math.abs(px % FOLLOW_STATUS_RUNWAY_PX) <= Number.EPSILON\n })\n}\n\n/** Remove unowned runway residue written by v0.3.3 and earlier bundles. */\nfunction migrateLegacyRunway(\n port: HTMLElement,\n surfaces: readonly HTMLElement[],\n status: HTMLElement | null,\n composer: HTMLElement | null,\n): void {\n if (followRunways.has(port)) return\n let migrated = false\n if (status !== null && isLegacyRunway(status.style.marginTop)) {\n // Harness TurnStatus has no inline margin; exact 48px multiples here are\n // values emitted by the old runway writer, including reload accumulation.\n status.style.marginTop = ''\n migrated = true\n }\n const last = surfaces.at(-1)\n if (\n status === null\n && composer !== null\n && last !== undefined\n && isLegacyRunway(last.style.marginBottom)\n ) {\n // Without TurnStatus the old writer used the current final message as its\n // completion runway. Limit migration to that same target topology.\n last.style.marginBottom = ''\n migrated = true\n }\n if (migrated) invalidatePaintLimit(port)\n}\n\nfunction ensureRunway(port: HTMLElement, surfaces: readonly HTMLElement[]): void {\n const status = turnStatusOf(port)\n const composer = port.querySelector<HTMLElement>('[data-composer-seat]')\n migrateLegacyRunway(port, surfaces, status, composer)\n // A runway is useful only after the natural conversation already has a\n // scroll floor for its equal message transform to ride. Before that point\n // applyVisual keeps every surface in normal flow, so adding status margin\n // would expose the whole runway as empty space below a short/early Think.\n const naturalHeight = Math.max(0, port.scrollHeight - runwayOffsetOf(port))\n if (port.clientHeight <= 0 || naturalHeight <= port.clientHeight) {\n restoreRunway(port)\n return\n }\n const target = status === null\n ? { element: composer === null ? undefined : surfaces.at(-1), property: 'marginBottom' as const }\n : { element: status, property: 'marginTop' as const }\n if (target.element === undefined) {\n restoreRunway(port)\n return\n }\n const element = target.element\n const current = followRunways.get(port)\n if (current?.element === element && current.property === target.property) return\n restoreRunway(port)\n const beforeHeight = port.scrollHeight\n const original = element.style[target.property]\n element.style[target.property] = original === ''\n ? `${FOLLOW_STATUS_RUNWAY_PX}px`\n : `calc(${original} + ${FOLLOW_STATUS_RUNWAY_PX}px)`\n const offset = Math.max(0, port.scrollHeight - beforeHeight)\n followRunways.set(port, { element, offset, property: target.property, original })\n invalidatePaintLimit(port)\n}\n\nfunction runwayOffsetOf(port: HTMLElement): number {\n return followRunways.get(port)?.offset ?? 0\n}\n\n/** Available paint room below the last message before fixed conversation chrome. */\nfunction safeShiftLimit(\n port: HTMLElement,\n surfaces: readonly HTMLElement[],\n): number {\n const last = surfaces.at(-1)\n if (last === undefined) return 0\n const status = turnStatusOf(port)\n const composer = port.querySelector<HTMLElement>('[data-composer-seat]')\n const cached = followPaintLimits.get(port)\n // Content growth alone cannot move the limit (measured at the floor, the\n // flow bottom rides the scrollport bottom), so the cache survives glyph\n // frames and only chrome/viewport changes or the TTL force a re-measure.\n if (\n cached !== undefined\n && performance.now() - cached.measuredAtMs <= FOLLOW_PAINT_LIMIT_TTL_MS\n && cached.clientHeight === port.clientHeight\n && cached.surface === last\n && cached.status === status\n && cached.composer === composer\n ) return cached.limit\n const ceiling = [status, composer]\n .filter((element): element is HTMLElement => element !== null)\n .map(element => ({ element, rect: element.getBoundingClientRect() }))\n // A detached or still-unmeasured sticky seat returns an all-zero rect.\n // It cannot constrain paint yet; a real seat at viewport top remains\n // valid because its bottom is still below its top.\n .filter(({ rect }) => Number.isFinite(rect.top) && Number.isFinite(rect.bottom) && rect.bottom > rect.top)\n .sort((first, second) => first.rect.top - second.rect.top)[0]\n if (ceiling === undefined) {\n // No conversation chrome means there is nothing to overlap. If chrome is\n // mounted but has not measured yet, permit only the runway zero-point\n // until ResizeObserver provides a real ceiling.\n return status === null && composer === null\n ? Number.POSITIVE_INFINITY\n : runwayOffsetOf(port)\n }\n const ceilingTop = ceiling.rect.top - currentShiftOf(ceiling.element)\n const naturalBottom = last.getBoundingClientRect().bottom - currentShiftOf(last)\n const limit = Math.max(0, ceilingTop - naturalBottom - FOLLOW_PAINT_GUARD_PX)\n followPaintLimits.set(port, {\n clientHeight: port.clientHeight,\n limit,\n measuredAtMs: performance.now(),\n composer,\n status,\n surface: last,\n })\n return limit\n}\n\nfunction setFollowScrollTop(port: HTMLElement, nextTop: number): void {\n if (Math.abs(port.scrollTop - nextTop) > 0.01) port.scrollTop = nextTop\n followScrollLedgers.set(port, port.scrollTop)\n const ownedTop = String(port.scrollTop)\n if (port.getAttribute(FOLLOW_OWNED_ATTR) !== ownedTop) {\n port.setAttribute(FOLLOW_OWNED_ATTR, ownedTop)\n }\n}\n\n/**\n * Last scrollTop this engine wrote or accepted, per port. Reader intent is a\n * real upward delta from this ledger; a key press or touch while pinned\n * (typing in the composer) must not release the pin, because a released pin\n * can never re-acquire while content streams away from the reader position.\n */\nconst followScrollLedgers = new WeakMap<HTMLElement, number>()\nconst followActivityAt = new WeakMap<HTMLElement, number>()\n\n/** Whether this port was owned recently enough to identify a closing tail row. */\nexport function hasRecentConversationFollow(port: HTMLElement, windowMs = 250): boolean {\n const last = followActivityAt.get(port)\n return last !== undefined && performance.now() - last <= windowMs\n}\n\nfunction readerScrolledUp(port: HTMLElement): boolean {\n return port.scrollTop < (followScrollLedgers.get(port) ?? 0) - FOLLOW_UNPIN_GESTURE_PX\n}\n\n/**\n * Paint a bounded visual lag and return the effective logical extent.\n *\n * This is the final geometry invariant, not merely an animation preference:\n * any lag beyond the real gap to status/composer chrome is caught up in the\n * same frame. Carrying that excess in `scrollTop` would move the transcript\n * toward fixed chrome and also make the host expose jump-to-bottom.\n */\nfunction applyVisual(\n port: HTMLElement,\n animatedH: number,\n reservePx: number,\n velocityPxPerSec = 0,\n): number {\n const surfaces = shiftSurfacesOf(port)\n ensureRunway(port, surfaces)\n const contentHeight = Math.max(0, port.scrollHeight)\n const runwayOffset = runwayOffsetOf(port)\n const targetHeight = Math.max(0, contentHeight - runwayOffset)\n const floor = Math.max(0, contentHeight - port.clientHeight)\n const extent = Math.min(targetHeight, Math.max(0, animatedH))\n if (port.style.overflowAnchor !== 'none') port.style.overflowAnchor = 'none'\n if (port.style.scrollBehavior !== 'auto') port.style.scrollBehavior = 'auto'\n if (floor <= 0) {\n setFollowScrollTop(port, 0)\n followMotionStates.set(port, {\n capacityPx: Number.POSITIVE_INFINITY,\n constrained: false,\n extent: targetHeight,\n lagPx: 0,\n reservePx: 0,\n velocityPxPerSec: 0,\n })\n for (const surface of surfaces) setShift(surface, 0)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n return targetHeight\n }\n // Measure paint room at the real floor. This write and the final physical\n // position land in the same animation frame, so only the latter is painted.\n setFollowScrollTop(port, floor)\n const limit = floor > 0 ? safeShiftLimit(port, surfaces) : 0\n const visibleReserve = Math.min(runwayOffset, Math.max(0, reservePx))\n const baselineShift = runwayOffset - visibleReserve\n const requestedLag = Math.max(0, targetHeight - extent)\n const shift = Math.min(baselineShift + requestedLag, Math.max(0, limit))\n const effectiveLag = Math.max(0, shift - baselineShift)\n const capacityPx = Math.max(0, limit - baselineShift)\n const effectiveExtent = targetHeight - effectiveLag\n followMotionStates.set(port, {\n capacityPx,\n constrained: requestedLag > effectiveLag + FOLLOW_SETTLE_EPSILON_PX,\n extent: effectiveExtent,\n lagPx: effectiveLag,\n reservePx: visibleReserve,\n velocityPxPerSec,\n })\n for (const surface of surfaces) setShift(surface, shift)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n return effectiveExtent\n}\n\nfunction clearMotion(port: HTMLElement): void {\n port.removeAttribute(FOLLOW_OWNED_ATTR)\n port.style.overflowAnchor = ''\n port.style.scrollBehavior = ''\n for (const surface of shiftSurfacesOf(port)) setShift(surface, 0)\n const status = turnStatusOf(port)\n if (status !== null) setShift(status, 0)\n}\n\nfunction clearVisual(port: HTMLElement): void {\n clearMotion(port)\n restoreRunway(port)\n followMotionStates.delete(port)\n invalidatePaintLimit(port)\n}\n\n/** Keep an already-promoted surface at zero until one stable final paint lands. */\nfunction holdCompositorAtRest(element: HTMLElement): void {\n element.style.transform = 'translate3d(0, 0px, 0)'\n element.style.willChange = 'transform'\n element.style.clipPath = ''\n}\n\n/** Remove equal offsets, land on the floor, then retire the compositor quietly. */\nfunction finishAtNaturalFloor(port: HTMLElement): void {\n const surfaces = shiftSurfacesOf(port)\n const status = turnStatusOf(port)\n const promoted = [...surfaces, ...(status === null ? [] : [status])]\n .filter(element => element.style.transform !== '' || element.style.willChange === 'transform')\n const promotedSet = new Set(promoted)\n restoreRunway(port)\n settleAtFloor(port)\n port.removeAttribute(FOLLOW_OWNED_ATTR)\n port.style.overflowAnchor = ''\n port.style.scrollBehavior = ''\n for (const surface of surfaces) {\n if (promotedSet.has(surface)) holdCompositorAtRest(surface)\n else setShift(surface, 0)\n }\n if (status !== null) {\n if (promotedSet.has(status)) holdCompositorAtRest(status)\n else setShift(status, 0)\n }\n followMotionStates.delete(port)\n if (promoted.length === 0) return\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (port.hasAttribute(FOLLOW_OWNED_ATTR)) return\n for (const element of promoted) {\n if (Math.abs(currentShiftOf(element)) <= 0.01) setShift(element, 0)\n }\n })\n })\n}\n\nfunction settleAtFloor(port: HTMLElement): void {\n const floor = Math.max(0, port.scrollHeight - port.clientHeight)\n setFollowScrollTop(port, floor)\n}\n\ninterface FollowLeader {\n readonly generation: number\n readonly owner: object\n}\n\n/** Only the newest active follower may write one port's shared visual state. */\nconst followLeaders = new WeakMap<HTMLElement, FollowLeader>()\nlet followGeneration = 0\n\n/**\n * Own the conversation scrollport's bottom-follow while `active` is true.\n *\n * @param rootRef - An element inside the conversation scrollport.\n * @param active - True while the reply is still revealing.\n * @param speedCpsRef - Live reveal-rate EMA from the smoother.\n * @param revealScaleRef - Optional backpressure control for text reveal.\n * @param predictive - Whether to reserve paint room ahead of growth.\n * @param entrance - Whether the first committed row height should glide in.\n * @param onEntranceSettled - Releases a one-shot entrance owner after catch-up.\n * @param predictiveRef - Optional live visibility gate for predictive runway.\n * @param entranceExtentRef - Optional measured growth delta for a generic row.\n */\nexport function useConversationFollow(\n rootRef: RefObject<HTMLElement | null>,\n active: boolean,\n speedCpsRef: { current: number },\n revealScaleRef?: { current: number },\n predictive = true,\n entrance = false,\n onEntranceSettled?: () => void,\n predictiveRef?: { current: boolean },\n entranceExtentRef?: { current: number | null },\n): void {\n const activeRef = useRef(active)\n const entranceRef = useRef(entrance)\n const onEntranceSettledRef = useRef(onEntranceSettled)\n entranceRef.current = entrance\n onEntranceSettledRef.current = onEntranceSettled\n useEffect(() => {\n activeRef.current = active\n }, [active])\n\n useLayoutEffect(() => {\n if (!active) return\n const owner = {}\n const generation = ++followGeneration\n let rafId = 0\n let last = performance.now()\n let following = true\n let primed = false\n let animatedH = 0\n let reservePx = 0\n let velocityPxPerSec = 0\n let interacting = false\n let readerGestureIntent = false\n let readerReleased = false\n let touchStartY: number | null = null\n let interactTimer: ReturnType<typeof setTimeout> | null = null\n let port: HTMLElement | null = null\n let resize: ResizeObserver | null = null\n let holding: HTMLElement | null = null\n let entrancePending = entranceRef.current\n\n const finishEntrance = (): void => {\n if (!entrancePending) return\n entrancePending = false\n onEntranceSettledRef.current?.()\n }\n\n const updateRevealScale = (next: HTMLElement, elapsedMs: number, urgent = false): void => {\n if (revealScaleRef === undefined) return\n const state = followMotionStates.get(next)\n const target = state === undefined\n ? 1\n : computeFollowRevealScale(state.lagPx, state.capacityPx, state.constrained)\n const current = Math.min(1, Math.max(FOLLOW_REVEAL_MIN_SCALE, revealScaleRef.current))\n if (target < current || urgent) {\n // Slowing affects only future glyph commits, so it can react at once\n // without producing a visual discontinuity in the current frame.\n revealScaleRef.current = Math.min(current, target)\n return\n }\n const releaseStep = 1 - Math.exp(-Math.max(0, elapsedMs) / FOLLOW_BACKPRESSURE_RELEASE_MS)\n revealScaleRef.current = current + (target - current) * releaseStep\n }\n\n const releaseRevealScale = (): void => {\n if (revealScaleRef !== undefined) revealScaleRef.current = 1\n }\n\n const isLeader = (next: HTMLElement): boolean => followLeaders.get(next)?.owner === owner\n\n const hold = (next: HTMLElement): void => {\n followActivityAt.set(next, performance.now())\n if (holding === next && isLeader(next)) return\n holding = next\n const leader = followLeaders.get(next)\n if (leader === undefined || generation > leader.generation) {\n followLeaders.set(next, { generation, owner })\n }\n }\n\n const drop = (next: HTMLElement): void => {\n if (holding === next) holding = null\n if (isLeader(next)) {\n clearMotion(next)\n followMotionStates.delete(next)\n releaseRevealScale()\n }\n }\n\n const handBackVisual = (next: HTMLElement): void => {\n const shift = currentShiftOf(shiftSurfacesOf(next).at(-1) ?? next)\n const visualTop = Math.max(0, next.scrollTop - Math.max(0, shift))\n const floor = Math.max(0, next.scrollHeight - next.clientHeight)\n // The host keeps its own bottom-follow bit while the reader remains in\n // its 25px slack band. Land one pixel beyond that band so even a light\n // wheel/trackpad/touch intent releases both owners on the same frame.\n next.scrollTop = Math.min(visualTop, Math.max(0, floor - FOLLOW_HOST_RELEASE_PX))\n followScrollLedgers.set(next, next.scrollTop)\n }\n\n const markGesture = (event: Event): void => {\n interacting = true\n if (event.type === 'wheel') {\n const deltaY = (event as WheelEvent).deltaY\n if (Number.isFinite(deltaY) && deltaY < 0) readerGestureIntent = true\n } else if (event.type === 'touchstart') {\n const touch = (event as TouchEvent).touches[0]\n touchStartY = touch?.clientY ?? null\n } else if (event.type === 'touchmove') {\n const touch = (event as TouchEvent).touches[0]\n if (touch !== undefined) {\n if (touchStartY === null) touchStartY = touch.clientY\n // A downward finger drag moves the transcript toward older content.\n if (touch.clientY - touchStartY > 1) readerGestureIntent = true\n }\n } else if (event.type === 'touchend' || event.type === 'touchcancel') {\n touchStartY = null\n }\n if (interactTimer !== null) clearTimeout(interactTimer)\n interactTimer = setTimeout(() => {\n interacting = false\n readerGestureIntent = false\n interactTimer = null\n }, FOLLOW_GESTURE_MS)\n }\n\n const restoreBeforePaint = (): void => {\n if (!following || port === null || !isLeader(port)) return\n invalidatePaintLimit(port)\n animatedH = applyVisual(port, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(port, 0, true)\n }\n\n const bindPort = (next: HTMLElement): void => {\n if (port === next) return\n if (port !== null) {\n for (const name of GESTURE_EVENTS) port.removeEventListener(name, markGesture)\n resize?.disconnect()\n }\n port = next\n invalidatePaintLimit(port)\n for (const name of GESTURE_EVENTS) {\n port.addEventListener(name, markGesture, { passive: true })\n }\n if (typeof ResizeObserver !== 'undefined') {\n resize = new ResizeObserver(restoreBeforePaint)\n resize.observe(port)\n const proxy = resizeProxyOf(port)\n if (proxy !== null) resize.observe(proxy)\n }\n }\n\n const frame = (now: number) => {\n rafId = requestAnimationFrame(frame)\n // Spring time is clamped so one paint after a stall cannot teleport the\n // transcript. Runway response uses real elapsed time, otherwise long\n // frames would open paint room more slowly precisely when it is needed.\n const elapsedMs = Math.max(0.001, now - last)\n const dt = Math.min(FOLLOW_MAX_FRAME_MS, elapsedMs)\n last = now\n const root = rootRef.current\n if (root === null) return\n const nextPort = root.closest<HTMLElement>('[data-conversation-scroll]')\n if (nextPort === null) return\n bindPort(nextPort)\n // A hidden/unmeasured port has no meaningful floor yet. Keep this owner\n // unprimed and let the already-scheduled RAF initialize it after layout.\n if (nextPort.clientHeight <= 0) return\n\n const floor = Math.max(0, nextPort.scrollHeight - nextPort.clientHeight)\n const reportedLag = floor - nextPort.scrollTop\n const extent = Math.min(\n nextPort.scrollHeight,\n Math.max(0, nextPort.scrollHeight - reportedLag),\n )\n\n if (!primed) {\n const inherited = nextPort.hasAttribute(FOLLOW_OWNED_ATTR)\n ? followMotionStates.get(nextPort)\n : undefined\n if (inherited === undefined) {\n // A new Agent row is already part of scrollHeight on its first\n // frame. Start at the pre-insert extent so that initial Context and\n // Tool chrome enters through the same spring as later height growth.\n const entranceExtent = entrancePending\n ? entranceExtentRef?.current ?? entranceExtentOf(root)\n : 0\n animatedH = Math.max(0, nextPort.scrollHeight - entranceExtent)\n reservePx = 0\n velocityPxPerSec = 0\n // The committed row/growth delta has already moved the new floor.\n // Decide ownership from the reader's position before that delta;\n // otherwise any atomic result taller than FOLLOW_SLACK_PX looks\n // indistinguishable from an intentional reader pull-up.\n const lagBeforeEntrance = Math.max(0, reportedLag - entranceExtent)\n following = lagBeforeEntrance <= FOLLOW_SLACK_PX\n } else {\n animatedH = Math.min(nextPort.scrollHeight, inherited.extent)\n reservePx = inherited.reservePx\n velocityPxPerSec = inherited.velocityPxPerSec\n following = true\n }\n if (following) {\n hold(nextPort)\n if (isLeader(nextPort)) {\n animatedH = applyVisual(nextPort, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(nextPort, elapsedMs)\n const runwayOffset = runwayOffsetOf(nextPort)\n const entranceLag = Math.max(0, nextPort.scrollHeight - animatedH - runwayOffset)\n if (entranceLag <= FOLLOW_SETTLE_EPSILON_PX) finishEntrance()\n } else {\n finishEntrance()\n }\n } else {\n finishEntrance()\n }\n primed = true\n return\n }\n\n const repinSlack = readerReleased ? FOLLOW_REPIN_PX : FOLLOW_SLACK_PX\n if (!following && !interacting && reportedLag <= repinSlack) {\n following = true\n readerReleased = false\n animatedH = extent\n reservePx = 0\n velocityPxPerSec = 0\n followScrollLedgers.set(nextPort, nextPort.scrollTop)\n hold(nextPort)\n } else if (following && interacting && (readerGestureIntent || readerScrolledUp(nextPort))) {\n // Directional wheel/touch intent is authoritative even when automatic\n // follow has already overwritten the small physical scroll delta.\n following = false\n readerGestureIntent = false\n readerReleased = true\n handBackVisual(nextPort)\n animatedH = nextPort.scrollHeight\n reservePx = 0\n velocityPxPerSec = 0\n drop(nextPort)\n finishEntrance()\n }\n\n if (!activeRef.current || !following) {\n followScrollLedgers.set(nextPort, nextPort.scrollTop)\n return\n }\n hold(nextPort)\n if (!isLeader(nextPort)) {\n finishEntrance()\n return\n }\n\n // Runway and an equal transform cancel visually. It is the zero point,\n // not residual motion: decaying below it would scroll past the final\n // resting position and rebound when runway is removed.\n const runwayOffset = runwayOffsetOf(nextPort)\n const contentHeight = nextPort.scrollHeight\n const lag = Math.max(0, contentHeight - animatedH - runwayOffset)\n const predictGrowth = predictiveRef?.current ?? predictive\n const reserveTarget = !predictGrowth\n ? 0\n : computeFollowReserve(speedCpsRef.current, runwayOffset)\n const reserveStep = 1 - Math.exp(-elapsedMs / FOLLOW_RESERVE_RESPONSE_MS)\n reservePx += (reserveTarget - reservePx) * reserveStep\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n })\n if (lag <= 0.1) {\n animatedH = contentHeight - runwayOffset\n velocityPxPerSec = 0\n } else {\n const minimumLag = predictGrowth ? 0 : Math.max(0, reservePx)\n animatedH = Math.min(\n contentHeight - runwayOffset - minimumLag,\n animatedH + step.advancePx,\n )\n velocityPxPerSec = step.velocityPxPerSec\n }\n animatedH = applyVisual(nextPort, animatedH, reservePx, velocityPxPerSec)\n updateRevealScale(nextPort, elapsedMs)\n const remainingEntranceLag = Math.max(\n 0,\n nextPort.scrollHeight - animatedH - runwayOffsetOf(nextPort),\n )\n if (remainingEntranceLag <= FOLLOW_SETTLE_EPSILON_PX) finishEntrance()\n }\n\n // Prime ownership and the final committed height in this layout phase.\n // A producer-complete text arm can mount and drain before the next RAF;\n // deferring this first pass would let it unmount unprimed after replacing\n // the previous owner, leaving a large final append at the old scrollTop.\n frame(performance.now())\n return () => {\n cancelAnimationFrame(rafId)\n if (interactTimer !== null) clearTimeout(interactTimer)\n resize?.disconnect()\n if (port !== null) {\n for (const name of GESTURE_EVENTS) port.removeEventListener(name, markGesture)\n }\n const root = rootRef.current\n const host = root?.closest<HTMLElement>('[data-conversation-scroll]') ?? port\n if (host === null) return\n holding = null\n if (!isLeader(host)) return\n const preserveReader = interacting && (readerGestureIntent || readerScrolledUp(host))\n if (!following || !primed) {\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n if (preserveReader) {\n handBackVisual(host)\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n\n // Completion can land the final Tool/command height in this same\n // commit. Preserve the logical extent and drain it after unmount instead\n // of clearing the compositor state before the first settled paint.\n ensureRunway(host, shiftSurfacesOf(host))\n const completionRunway = runwayOffsetOf(host)\n const completionMinimumLag = Math.max(0, reservePx)\n animatedH = Math.min(\n animatedH,\n host.scrollHeight - completionRunway - completionMinimumLag,\n )\n settleAtFloor(host)\n animatedH = applyVisual(host, animatedH, reservePx, velocityPxPerSec)\n const runwayOffset = runwayOffsetOf(host)\n const remainingLag = Math.max(0, host.scrollHeight - animatedH - runwayOffset)\n if (remainingLag <= FOLLOW_SETTLE_EPSILON_PX && reservePx <= FOLLOW_SETTLE_EPSILON_PX) {\n finishAtNaturalFloor(host)\n followLeaders.delete(host)\n releaseRevealScale()\n return\n }\n\n for (const name of GESTURE_EVENTS) {\n host.addEventListener(name, markGesture, { passive: true })\n }\n const stopSettleListeners = (): void => {\n for (const name of GESTURE_EVENTS) host.removeEventListener(name, markGesture)\n if (interactTimer !== null) {\n clearTimeout(interactTimer)\n interactTimer = null\n }\n }\n let settleLast = performance.now()\n const settleFrame = (now: number): void => {\n if (!isLeader(host)) {\n stopSettleListeners()\n return\n }\n if (interacting && (readerGestureIntent || readerScrolledUp(host))) {\n readerGestureIntent = false\n handBackVisual(host)\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n stopSettleListeners()\n return\n }\n const dt = Math.min(FOLLOW_MAX_FRAME_MS, Math.max(0, now - settleLast))\n settleLast = now\n const runwayOffset = runwayOffsetOf(host)\n const lag = Math.max(0, host.scrollHeight - animatedH - runwayOffset)\n const reserveStep = 1 - Math.exp(-dt / FOLLOW_RESERVE_RESPONSE_MS)\n reservePx += (0 - reservePx) * reserveStep\n if (lag <= FOLLOW_SETTLE_EPSILON_PX && reservePx <= FOLLOW_SETTLE_EPSILON_PX) {\n animatedH = host.scrollHeight - runwayOffset\n reservePx = 0\n velocityPxPerSec = 0\n finishAtNaturalFloor(host)\n followLeaders.delete(host)\n releaseRevealScale()\n stopSettleListeners()\n return\n }\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n })\n // The temporary runway is visually neutral only while an equal lag\n // remains in the transform. Do not let the spring outrun the runway's\n // closing reserve or cleanup would reveal an overshoot and rebound.\n const minimumLag = Math.max(0, reservePx)\n animatedH = Math.min(\n host.scrollHeight - runwayOffset - minimumLag,\n animatedH + step.advancePx,\n )\n velocityPxPerSec = step.velocityPxPerSec\n settleAtFloor(host)\n animatedH = applyVisual(host, animatedH, reservePx, velocityPxPerSec)\n requestAnimationFrame(settleFrame)\n }\n requestAnimationFrame(settleFrame)\n }\n }, [active, rootRef, speedCpsRef, revealScaleRef, predictive, predictiveRef])\n}\n","import { useEffect, useRef, type ReactNode } from 'react'\nimport { useConversationFollow } from './teleprompterGlide.ts'\nimport css from './TypewriterAssistantNodeView.module.css'\n\n/**\n * Document-flow host that owns conversation-port follow while `active`.\n * Shared by assistant blocks and every other Agent Chat row. `onGrowth` lets\n * generic wrapped renderers re-arm one glide when their DOM grows without\n * requiring a business-kind-specific lifecycle predicate.\n */\nexport function FollowHost({\n active,\n entrance = false,\n onEntranceSettled,\n onGrowth,\n entranceExtentRef,\n speedCpsRef,\n revealScaleRef,\n predictive = true,\n predictiveRef,\n hostRef,\n children,\n}: {\n active: boolean\n entrance?: boolean\n onEntranceSettled?: (() => void) | undefined\n onGrowth?: ((deltaPx: number) => void) | undefined\n entranceExtentRef?: { current: number | null } | undefined\n speedCpsRef: { current: number }\n revealScaleRef?: { current: number } | undefined\n predictive?: boolean\n predictiveRef?: { current: boolean } | undefined\n hostRef?: { current: HTMLDivElement | null } | undefined\n children: ReactNode\n}) {\n const localRootRef = useRef<HTMLDivElement>(null)\n const rootRef = hostRef ?? localRootRef\n useConversationFollow(\n rootRef,\n active || entrance,\n speedCpsRef,\n revealScaleRef,\n predictive,\n entrance,\n onEntranceSettled,\n predictiveRef,\n entranceExtentRef,\n )\n useEffect(() => {\n if (onGrowth === undefined || typeof ResizeObserver === 'undefined') return\n const root = rootRef.current\n if (root === null) return\n let previousHeight: number | null = null\n const observer = new ResizeObserver(entries => {\n const nextHeight = entries[0]?.contentRect.height ?? root.getBoundingClientRect().height\n if (!Number.isFinite(nextHeight)) return\n if (previousHeight !== null && nextHeight > previousHeight + 0.5) {\n onGrowth(nextHeight - previousHeight)\n }\n previousHeight = nextHeight\n })\n observer.observe(root)\n return () => { observer.disconnect() }\n }, [onGrowth])\n return <div ref={rootRef} className={css.follow}>{children}</div>\n}\n","/**\n * Shared plugin configuration contract. The Host half defines the\n * Schemastery schema over this shape (defaults live here so both halves stay\n * symmetric); the client half falls back to the same defaults when the Host\n * boot-config bridge is absent (client-only composition).\n */\n\nimport type { StreamSmoothingPreset } from './client/useSmoothStreamContent.ts'\n\n/** Legacy render-mode value retained so existing overlays remain valid. */\nexport type StreamMode = 'typewriter' | 'teleprompter'\n\n/** Plugin configuration validated by the Host schema and bridged to the browser half. */\nexport interface StreamConfig {\n /** Compatibility field; both values use the current adaptive reveal engine. */\n readonly mode: StreamMode\n /** Smoothing preset for the reveal cadence. */\n readonly preset: StreamSmoothingPreset\n /**\n * Unused at runtime; kept so existing overlays load. Live reveal tracks\n * observed arrival and ignores this seed.\n */\n readonly revealCharsPerSec: number\n /**\n * Unused at runtime; kept so existing overlays load. Follow is a\n * smooth-damp, not a cruise speed.\n */\n readonly scrollSpeedPxPerSec: number\n /** Unused at runtime; retained so existing overlays continue to load. */\n readonly maxScrollSpeedPxPerSec: number\n}\n\n/** Defaults shared by the Host schema and the client-side fallback. */\nexport const DEFAULT_STREAM_CONFIG: StreamConfig = {\n mode: 'typewriter',\n preset: 'balanced',\n revealCharsPerSec: 80,\n scrollSpeedPxPerSec: 48,\n maxScrollSpeedPxPerSec: 1000,\n}\n\n/**\n * Window global the Host writes into the served index HTML. The browser boot\n * graph carries no per-entry config, so this inline script is the only\n * Host-to-client configuration channel for a composed web plugin.\n */\nexport const STREAM_BOOT_GLOBAL = '__DSH_SMOOTH_STREAM_CONFIG__'\n","/**\n * User-owned settings for the smooth-stream plugin, exposed to the Host\n * settings service and edited from the Web Settings \"plugin configuration\"\n * page. This is the runtime-editable complement to {@link StreamConfig}: that\n * contract is composed at load and bridged once through the boot global, while\n * these preferences live in the durable user-settings document and take effect\n * live.\n */\n\n/** Settings namespace registered by the Host and served through the plugin RPC. */\nexport const STREAM_SETTINGS_NS = 'smooth-stream'\n\n/**\n * Preferences a user may set. Deliberately separate from {@link StreamConfig}\n * because the two change at different times: composition-time values go\n * through the boot global, a live UI edit goes through the protected plugin RPC.\n */\nexport interface StreamSettings {\n /**\n * Whether a reasoning (\"Think\") block auto-expands while it is the\n * streaming tail. Off keeps the block collapsed — the user can still open\n * it by hand — and stops the running state from re-owning the disclosure.\n */\n thinkAutoExpand: boolean\n}\n\n/** Defaults shared by the Host schema and the client-side fallback. */\nexport const DEFAULT_STREAM_SETTINGS: StreamSettings = {\n thinkAutoExpand: true,\n}\n","import { memo, useEffect, useLayoutEffect, useMemo, useRef, useState, type ComponentProps, type ReactNode } from 'react'\nimport { IconThinkOutline14, JsonBlock, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ImageGallery, type ImageLoader, type MessageImageLabels } from '@deepseek-ai/dsh-client-ui-attachment'\nimport type { ChatNodeViewProps, TurnTailOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { AnimatedDisclosure } from './AnimatedDisclosure.tsx'\nimport { useSmoothStreamContent, type StreamSmoothingPreset } from './useSmoothStreamContent.ts'\nimport { useFpsGuard } from './useFpsGuard.ts'\nimport { FollowHost } from './FollowHost.tsx'\nimport { DEFAULT_STREAM_CONFIG, type StreamMode } from '../config.ts'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\nimport css from './TypewriterAssistantNodeView.module.css'\n\ntype AssistantProps = ChatNodeViewProps<'assistant-step'>\ntype MarkdownProps = Pick<ComponentProps<typeof MarkdownText>, 'codeLabels' | 'fileMentions' | 'text'>\n\nfunction usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = useState(\n () => typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true,\n )\n useEffect(() => {\n if (typeof window === 'undefined' || window.matchMedia === undefined) return\n const query = window.matchMedia('(prefers-reduced-motion: reduce)')\n const onChange = () => setReduced(query.matches)\n query.addEventListener('change', onChange)\n return () => query.removeEventListener('change', onChange)\n }, [])\n return reduced\n}\n\ninterface AnimatedMarkdownTextProps extends MarkdownProps {\n streaming: boolean\n /** True on the last text block: that block owns conversation follow. */\n ownFollow: boolean\n followSpeedCpsRef?: { current: number } | undefined\n followRevealScaleRef?: { current: number } | undefined\n onPredictiveChange?: ((predictive: boolean) => void) | undefined\n preset: StreamSmoothingPreset\n shouldHoldBack: () => boolean\n}\n\n/** Conservative fallback before the streaming Markdown tail has geometry. */\nconst PREDICTIVE_WRAP_FALLBACK_CHARS = 32\nconst STREAM_ANNOUNCEMENT_INTERVAL_MS = 800\nconst STREAM_ANNOUNCEMENT_MAX_CHARS = 320\n\ninterface PendingTextGeometry {\n root: HTMLElement\n visibleText: string\n fontSize: number\n wrapThresholdWidth: number | null\n}\n\nfunction approximateInlineWidth(text: string, emPx: number): number {\n let width = 0\n for (const char of text) {\n if (/\\s/u.test(char)) width += emPx * 0.33\n else if (/^[\\x00-\\x7f]$/u.test(char)) width += emPx * 0.56\n else width += emPx\n }\n return width\n}\n\nfunction measurePendingTextGeometry(root: HTMLElement, visibleText: string): PendingTextGeometry {\n if (\n typeof document.createTreeWalker !== 'function'\n || typeof NodeFilter === 'undefined'\n ) {\n return { root, visibleText, fontSize: 14, wrapThresholdWidth: null }\n }\n const rootRect = root.getBoundingClientRect()\n const rootWidth = Math.max(0, rootRect.width, rootRect.right - rootRect.left, root.clientWidth)\n if (rootWidth <= 0) return { root, visibleText, fontSize: 14, wrapThresholdWidth: null }\n\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT)\n let tail: Text | null = null\n for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) {\n if ((node.textContent ?? '').length > 0) tail = node as Text\n }\n const parent = tail?.parentElement ?? root\n const fontSize = Number.parseFloat(getComputedStyle(parent).fontSize) || 14\n if (tail === null || typeof document.createRange !== 'function') {\n return { root, visibleText, fontSize, wrapThresholdWidth: rootWidth }\n }\n\n try {\n const length = tail.textContent?.length ?? 0\n if (length <= 0) return { root, visibleText, fontSize, wrapThresholdWidth: rootWidth }\n const range = document.createRange()\n range.setStart(tail, Math.max(0, length - 1))\n range.setEnd(tail, length)\n const tailRect = range.getBoundingClientRect()\n const contentRight = rootRect.right\n if (!Number.isFinite(tailRect.right) || tailRect.right <= rootRect.left || contentRight <= rootRect.left) {\n return { root, visibleText, fontSize, wrapThresholdWidth: rootWidth }\n }\n const remainingWidth = Math.max(0, contentRight - tailRect.right)\n return {\n root,\n visibleText,\n fontSize,\n wrapThresholdWidth: remainingWidth + fontSize * 0.35,\n }\n } catch {\n return { root, visibleText, fontSize, wrapThresholdWidth: rootWidth }\n }\n}\n\n/** Whether buffered source can reach a new visual line before it drains. */\nfunction pendingTextCanGrow(\n root: HTMLElement | null,\n visibleText: string,\n pending: string,\n geometryRef: { current: PendingTextGeometry | null },\n): boolean {\n if (pending === '') return false\n if (/[\\r\\n]/u.test(pending)) return true\n const pendingChars = [...pending]\n if (root === null) return pendingChars.length >= PREDICTIVE_WRAP_FALLBACK_CHARS\n\n let geometry = geometryRef.current\n if (geometry?.root !== root || geometry.visibleText !== visibleText) {\n geometry = measurePendingTextGeometry(root, visibleText)\n geometryRef.current = geometry\n }\n if (geometry.wrapThresholdWidth === null) {\n return pendingChars.length >= PREDICTIVE_WRAP_FALLBACK_CHARS\n }\n return approximateInlineWidth(pending, geometry.fontSize) >= geometry.wrapThresholdWidth\n}\n\nfunction announcementChunkEnd(source: string, start: number): number {\n const hardEnd = Math.min(source.length, start + STREAM_ANNOUNCEMENT_MAX_CHARS)\n if (hardEnd === source.length) return hardEnd\n const softStart = start + Math.floor(STREAM_ANNOUNCEMENT_MAX_CHARS * 0.6)\n for (let index = hardEnd - 1; index >= softStart; index -= 1) {\n if (/[\\s.,;:!?]/u.test(source[index] ?? '')) return index + 1\n }\n return hardEnd\n}\n\n/** Pace screen-reader updates independently from visual reveal frames. */\ninterface StreamAnnouncementState {\n text: string\n revision: number\n present: boolean\n}\n\n/** A commit-driven live region isolated from the visible Markdown subtree. */\nconst StreamAnnouncement = memo(function StreamAnnouncement({\n text,\n active,\n}: {\n text: string\n active: boolean\n}) {\n const [announcement, setAnnouncement] = useState<StreamAnnouncementState>({\n text: '',\n revision: 0,\n present: active,\n })\n const sourceRef = useRef(text)\n const activeRef = useRef(active)\n const announcedOffsetRef = useRef(active ? 0 : text.length)\n const drainSourceRef = useRef<string | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useEffect(() => {\n const clearTimer = (): void => {\n if (timerRef.current === null) return\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n\n const publishNext = (source: string): boolean => {\n const start = Math.min(announcedOffsetRef.current, source.length)\n const end = announcementChunkEnd(source, start)\n if (end <= start) return false\n announcedOffsetRef.current = end\n setAnnouncement(previous => ({\n text: source.slice(start, end),\n revision: previous.revision + 1,\n present: true,\n }))\n return end < source.length\n }\n\n const hideAfterLinger = (): void => {\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (activeRef.current) return\n drainSourceRef.current = null\n setAnnouncement(previous => ({ ...previous, present: false }))\n }, STREAM_ANNOUNCEMENT_INTERVAL_MS)\n }\n\n const drainNext = (): void => {\n const source = drainSourceRef.current\n if (source === null) return\n if (!publishNext(source)) {\n hideAfterLinger()\n return\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (activeRef.current) return\n drainNext()\n }, STREAM_ANNOUNCEMENT_INTERVAL_MS)\n }\n\n const scheduleLive = (): void => {\n if (timerRef.current !== null || announcedOffsetRef.current >= sourceRef.current.length) return\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (!activeRef.current) return\n const source = sourceRef.current\n if (publishNext(source)) scheduleLive()\n }, STREAM_ANNOUNCEMENT_INTERVAL_MS)\n }\n\n const wasActive = activeRef.current\n const previousSource = sourceRef.current\n const continuingDrain = !active && !wasActive && drainSourceRef.current !== null\n if (\n !continuingDrain\n && (!text.startsWith(previousSource) || announcedOffsetRef.current > text.length)\n ) {\n announcedOffsetRef.current = 0\n }\n sourceRef.current = text\n activeRef.current = active\n\n if (active) {\n if (!wasActive) {\n clearTimer()\n drainSourceRef.current = null\n setAnnouncement(previous => ({\n text: '',\n revision: previous.revision + 1,\n present: true,\n }))\n }\n scheduleLive()\n return\n }\n\n if (!wasActive) {\n if (drainSourceRef.current === null) announcedOffsetRef.current = text.length\n return\n }\n\n clearTimer()\n drainSourceRef.current = text\n drainNext()\n }, [active, text])\n\n useEffect(() => () => {\n if (timerRef.current !== null) clearTimeout(timerRef.current)\n timerRef.current = null\n }, [])\n\n if (!active && !announcement.present) return null\n const activating = active && !activeRef.current\n return (\n <span\n className={css.visuallyHidden}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <span key={announcement.revision}>{activating ? '' : announcement.text}</span>\n </span>\n )\n})\n\n/**\n * Smooth streaming text arm. While the reply runs, the accumulated source is\n * revealed through the smoother at a rate that tracks the model's arrival\n * and rendered by the Harness `MarkdownText`\n * streaming arm (incremental parse, frozen non-tail blocks), so there is no\n * raw-text tail and no text-to-markdown swap: the tree stays markdown\n * throughout. The last text block owns conversation-port follow so wraps\n * glide instead of snapping. Once the stream closes and the reveal queue\n * drains, the settled full parse (KaTeX math, fence highlighting, file\n * mentions) swaps in exactly once.\n */\nfunction AnimatedMarkdownText({\n text,\n codeLabels,\n fileMentions,\n streaming,\n ownFollow,\n followSpeedCpsRef,\n followRevealScaleRef,\n onPredictiveChange,\n preset,\n shouldHoldBack,\n}: AnimatedMarkdownTextProps) {\n const reduced = usePrefersReducedMotion()\n const [typing, setTyping] = useState(streaming)\n const localSpeedCpsRef = useRef(35)\n const followRootRef = useRef<HTMLDivElement>(null)\n const predictionSourceRef = useRef<string | null>(null)\n const predictionStateRef = useRef(false)\n const predictionGeometryRef = useRef<PendingTextGeometry | null>(null)\n const speedCpsRef = followSpeedCpsRef ?? localSpeedCpsRef\n const displayed = useSmoothStreamContent(text, {\n enabled: typing && !reduced,\n inputComplete: !streaming,\n preset,\n shouldHoldBack,\n speedCpsRef,\n revealScaleRef: followRevealScaleRef,\n })\n const shown = reduced ? text : displayed\n const live = typing && !reduced\n\n useEffect(() => {\n const root = followRootRef.current\n if (root === null || typeof ResizeObserver === 'undefined') return\n const observer = new ResizeObserver(() => {\n if (predictionGeometryRef.current?.root === root) predictionGeometryRef.current = null\n })\n observer.observe(root)\n return () => { observer.disconnect() }\n }, [])\n\n useLayoutEffect(() => {\n if (onPredictiveChange === undefined) return\n const pending = text.slice(shown.length)\n const sourceChanged = predictionSourceRef.current !== text\n const next = !live || !streaming || pending === ''\n ? false\n : sourceChanged\n ? pendingTextCanGrow(followRootRef.current, shown, pending, predictionGeometryRef)\n : predictionStateRef.current\n predictionSourceRef.current = text\n predictionStateRef.current = next\n onPredictiveChange(next)\n }, [live, onPredictiveChange, shown, streaming, text])\n\n // The stream closed: keep revealing the remaining queue, then swap to the\n // settled parse exactly once. The markdown tree stays mounted until then.\n useEffect(() => {\n if (typing && !streaming && shown.length === text.length) setTyping(false)\n }, [shown, streaming, text, typing])\n\n return (\n <FollowHost\n active={live && ownFollow}\n speedCpsRef={speedCpsRef}\n revealScaleRef={followRevealScaleRef}\n predictive={streaming}\n hostRef={followRootRef}\n >\n <MarkdownText\n text={live ? shown : text}\n streaming={live}\n codeLabels={codeLabels}\n fileMentions={live ? undefined : fileMentions}\n />\n </FollowHost>\n )\n}\n\nfunction imageLabels(t: AssistantProps['t']): MessageImageLabels {\n return {\n image: t('image.label'),\n open: t('image.openOriginal'),\n openNamed: label => t('image.openOriginalLabel', { label }),\n loading: t('image.loading'),\n loadFailed: t('image.loadFailed'),\n lightbox: {\n dialog: t('image.preview'),\n close: t('image.closePreview'),\n },\n }\n}\n\nfunction firstLine(text: string): string {\n const newline = text.indexOf('\\n')\n return newline === -1 ? text : text.slice(0, newline)\n}\n\nfunction latestLine(text: string): string {\n const visible = text.trimEnd()\n const newline = visible.lastIndexOf('\\n')\n return newline === -1 ? visible : visible.slice(newline + 1)\n}\n\n/**\n * Built-in Think disclosure with a smoothed `text` feed. Chevron and row\n * click stay on the disclosure chrome, which the plugin's AnimatedDisclosure\n * renders with a height-animated body (the harness primitive would mount and\n * unmount it, which cannot glide). The row opens only while this block is\n * the streaming tail and closes as soon as thinking ends — a later block,\n * or the assistant node settling — not when the rest of the reply is\n * still streaming.\n */\nfunction AnimatedReasoning({\n text,\n running,\n preset,\n thinkAutoExpand,\n shouldHoldBack,\n followSpeedCpsRef,\n followRevealScaleRef,\n t,\n}: {\n text: string\n running: boolean\n preset: StreamSmoothingPreset\n thinkAutoExpand: boolean\n shouldHoldBack: () => boolean\n followSpeedCpsRef?: { current: number } | undefined\n followRevealScaleRef?: { current: number } | undefined\n t: AssistantProps['t']\n}) {\n const reduced = usePrefersReducedMotion()\n const [expanded, setExpanded] = useState(running && thinkAutoExpand)\n const summaryRef = useRef<HTMLSpanElement>(null)\n const displayed = useSmoothStreamContent(text, {\n enabled: running && !reduced,\n preset,\n shouldHoldBack,\n speedCpsRef: followSpeedCpsRef,\n revealScaleRef: followRevealScaleRef,\n })\n const shown = running && !reduced ? displayed : text\n const summary = running ? latestLine(shown) : firstLine(text)\n\n useLayoutEffect(() => {\n // Only the running state owns disclosure while auto-expand is on; with it\n // off, a manual toggle is never wrestled back by the stream.\n if (thinkAutoExpand) setExpanded(running)\n }, [running, thinkAutoExpand])\n\n useEffect(() => {\n const element = summaryRef.current\n if (element === null) return\n element.scrollLeft = running ? element.scrollWidth - element.clientWidth : 0\n }, [running, summary])\n\n // Preserve FollowHost's layout wrapper without mounting a second scroll owner.\n return (\n <div className={css.follow}>\n <div className={css.think} data-variant=\"think\" data-state={running ? 'running' : 'ok'}>\n {running && <span className={css.visuallyHidden}>{t('row.running')}</span>}\n <AnimatedDisclosure\n rowClassName={css.thinkRow}\n leadingClassName={css.thinkLeading}\n titleClassName={css.thinkTitle}\n chevronClassName={css.thinkChevron}\n icon={<IconThinkOutline14 size={14} />}\n title=\"Think\"\n open={expanded}\n onToggle={() => { setExpanded(value => !value) }}\n collapsedContent={(\n <>\n <span className={css.thinkSeparator} aria-hidden />\n <span ref={summaryRef} className={css.thinkSummary} data-follow-end={running || undefined}>{summary}</span>\n </>\n )}\n >\n <div className={css.thinkBody}>{shown}</div>\n </AnimatedDisclosure>\n </div>\n </div>\n )\n}\n\n/**\n * Assistant node renderer for the typewriter overlay. Text observed while\n * streaming is revealed by the smoother through the Harness Markdown\n * renderer at a rate that tracks arrival. Reasoning blocks keep the\n * built-in Think disclosure and only receive a smoothed text feed; the\n * outer node owns conversation-port follow while streaming; the final text\n * block keeps ownership while its settled reveal queue drains. The FPS guard\n * holds offscreen reveals when the frame rate is degraded. Settled text\n * renders with the full Markdown pipeline.\n */\nexport const TypewriterAssistantNodeView = memo(function TypewriterAssistantNodeView({\n mode: _mode = DEFAULT_STREAM_CONFIG.mode,\n preset = DEFAULT_STREAM_CONFIG.preset,\n revealCharsPerSec: _revealCharsPerSec = DEFAULT_STREAM_CONFIG.revealCharsPerSec,\n scrollSpeedPxPerSec: _scrollSpeedPxPerSec = DEFAULT_STREAM_CONFIG.scrollSpeedPxPerSec,\n maxScrollSpeedPxPerSec: _maxScrollSpeedPxPerSec = DEFAULT_STREAM_CONFIG.maxScrollSpeedPxPerSec,\n thinkAutoExpand = DEFAULT_STREAM_SETTINGS.thinkAutoExpand,\n node,\n useTurnData,\n openFile,\n loadImage,\n fileMentions,\n t,\n}: AssistantProps & {\n mode?: StreamMode\n preset?: StreamSmoothingPreset\n revealCharsPerSec?: number\n scrollSpeedPxPerSec?: number\n maxScrollSpeedPxPerSec?: number\n thinkAutoExpand?: boolean\n}) {\n const data = node.data\n const streaming = data.status === 'running'\n const reduced = usePrefersReducedMotion()\n const { ref: guardRef, shouldHoldBack } = useFpsGuard(streaming)\n const rootSpeedRef = useRef(35)\n const rootRevealScaleRef = useRef(1)\n const reasoningTailIndex = streaming && data.blocks[data.blocks.length - 1]?.kind === 'reasoning'\n ? data.blocks.length - 1\n : -1\n const reasoningOwnsSpeed = reasoningTailIndex !== -1\n const rootPredictiveRef = useRef(false)\n const previousReasoningTailRef = useRef(-1)\n if (reasoningTailIndex !== previousReasoningTailRef.current) {\n // Think growth is already paced by its own text reveal. Opening additional\n // speculative runway here exposes that runway as an empty gap above the\n // fixed turn status, especially when reasoning arrives in fast bursts.\n // The follower still smooths real height growth within the measured gap\n // and catches up any unsafe remainder in the same frame.\n rootPredictiveRef.current = false\n if (!reasoningOwnsSpeed) rootSpeedRef.current = 35\n previousReasoningTailRef.current = reasoningTailIndex\n }\n const updateTextPrediction = useMemo(\n () => (predictive: boolean): void => { rootPredictiveRef.current = predictive },\n [],\n )\n const turn = node.location.kind === 'turn' || node.location.kind === 'step'\n ? node.location.turn\n : undefined\n const tail = useTurnData('turn-tail')\n const owner = useMemo<TurnTailOwnerProps | undefined>(() => {\n if (turn?.status !== 'closed' || data.finalNode === undefined) return undefined\n if (tail?.closing?.finalNode.seq !== data.finalNode.seq) return undefined\n return { turn, seq: data.finalNode.seq, openFile }\n }, [data.finalNode, openFile, tail, turn])\n const mentions = useMemo(\n () => owner === undefined ? undefined : fileMentions(owner),\n [fileMentions, owner],\n )\n const codeLabels = useMemo(() => ({ copyLabel: t('copy'), copiedLabel: t('copied') }), [t])\n const imageLoader: ImageLoader = loadImage ?? (async () => {\n throw new Error(t('image.serviceUnavailable'))\n })\n const hasVisible = streaming\n || data.status === 'interrupted'\n || data.blocks.some(block => block.kind !== 'tool-call')\n if (!hasVisible) return null\n const announcementText = data.blocks\n .filter(block => block.kind === 'text')\n .map(block => block.text)\n .join('\\n')\n\n const rendered: ReactNode[] = []\n const last = data.blocks.length - 1\n let lastFollow = -1\n for (let index = 0; index < data.blocks.length; index += 1) {\n const kind = data.blocks[index]?.kind\n if (kind === 'text' || kind === 'reasoning') lastFollow = index\n }\n for (let index = 0; index < data.blocks.length; index += 1) {\n const block = data.blocks[index]\n if (block === undefined) continue\n switch (block.kind) {\n case 'text':\n rendered.push(\n <AnimatedMarkdownText\n key={index}\n text={block.text}\n codeLabels={codeLabels}\n fileMentions={mentions}\n streaming={streaming}\n ownFollow={!streaming && index === lastFollow}\n followSpeedCpsRef={index === lastFollow ? rootSpeedRef : undefined}\n followRevealScaleRef={index === lastFollow ? rootRevealScaleRef : undefined}\n onPredictiveChange={index === lastFollow ? updateTextPrediction : undefined}\n preset={preset}\n shouldHoldBack={shouldHoldBack}\n />,\n )\n break\n case 'reasoning':\n rendered.push(\n <AnimatedReasoning\n key={index}\n text={block.text}\n running={streaming && index === last}\n preset={preset}\n thinkAutoExpand={thinkAutoExpand}\n shouldHoldBack={shouldHoldBack}\n followSpeedCpsRef={reasoningOwnsSpeed && index === last ? rootSpeedRef : undefined}\n followRevealScaleRef={reasoningOwnsSpeed && index === last ? rootRevealScaleRef : undefined}\n t={t}\n />,\n )\n break\n case 'image': {\n const start = index\n const group = [block]\n while (index + 1 < data.blocks.length) {\n const next = data.blocks[index + 1]\n if (next === undefined || next.kind !== 'image') break\n group.push(next)\n index += 1\n }\n rendered.push(\n <ImageGallery key={start} images={group} load={imageLoader} align=\"start\" labels={imageLabels(t)} />,\n )\n break\n }\n case 'tool-call':\n break\n case 'other':\n rendered.push(\n <JsonBlock\n key={index}\n label={t('message.unknownBlock')}\n payload={block.block}\n truncatedLabel={total => t('json.truncated', { total })}\n />,\n )\n break\n }\n }\n\n return (\n <div ref={guardRef} className={css.root} data-streaming={streaming || undefined}>\n <StreamAnnouncement text={announcementText} active={streaming && !reduced} />\n <FollowHost\n active={streaming && !reduced}\n speedCpsRef={rootSpeedRef}\n revealScaleRef={rootRevealScaleRef}\n predictiveRef={rootPredictiveRef}\n >\n <div className={css.body}>\n {rendered}\n {data.status === 'interrupted' && <span className={css.stopped}>{t('message.stopped')}</span>}\n </div>\n </FollowHost>\n </div>\n )\n})\n","/**\n * Progressive text reveal for opaque Agent renderers.\n *\n * Slot renderers own arbitrary React trees, so the generic integration cannot\n * clone or classify their business components. This hook leaves that tree and\n * all of its event handlers in place, and only paces visible Text node data\n * while the row belongs to the live Agent turn. No clip, mask, overlay, or\n * duplicate accessibility tree is introduced.\n */\n\nimport { useLayoutEffect, type RefObject } from 'react'\nimport { computeAdaptiveQueueStep } from './useSmoothStreamContent.ts'\n\ninterface TextRevealRecord {\n chars: readonly string[]\n full: string\n shown: number\n}\n\nconst SKIP_TEXT_SELECTOR = [\n '[aria-hidden=\"true\"]',\n '[aria-live]',\n '[contenteditable=\"true\"]',\n 'script',\n 'style',\n 'textarea',\n].join(',')\n\nfunction revealable(node: Text, root: HTMLElement): boolean {\n if (node.data.trim() === '') return false\n const parent = node.parentElement\n return parent !== null\n && root.contains(parent)\n && parent.closest(SKIP_TEXT_SELECTOR) === null\n}\n\nfunction commonPrefix(left: readonly string[], right: readonly string[]): number {\n const limit = Math.min(left.length, right.length)\n let index = 0\n while (index < limit && left[index] === right[index]) index += 1\n return index\n}\n\n/**\n * Pace text inside a renderer whose React component is intentionally opaque.\n * Initial content is revealed only for a genuinely new row; later mutations\n * stay paced until `enabled` becomes false, at which point the full renderer\n * content is restored synchronously before paint.\n */\nexport function useProgressiveDomText(\n rootRef: RefObject<HTMLElement | null>,\n enabled: boolean,\n revealInitial: boolean,\n speedCpsRef: { current: number },\n onSettled?: (() => void) | undefined,\n): void {\n useLayoutEffect(() => {\n if (!enabled) return\n const root = rootRef.current\n if (root === null || typeof document === 'undefined') return\n\n const records = new Map<Text, TextRevealRecord>()\n const pending = new Set<Text>()\n const internalWrites = new WeakMap<Text, string>()\n let rafId = 0\n let lastFrame: number | null = null\n let debt = 0\n let stopped = false\n let announcedSettled = false\n\n const announceSettled = (): void => {\n lastFrame = null\n debt = 0\n speedCpsRef.current = 35\n if (announcedSettled) return\n announcedSettled = true\n onSettled?.()\n }\n\n const write = (node: Text, value: string): void => {\n if (node.data === value) return\n internalWrites.set(node, value)\n node.data = value\n }\n\n const enqueue = (node: Text, full: string, preserve: TextRevealRecord | undefined): void => {\n if (!revealable(node, root)) return\n const chars = [...full]\n const preserved = preserve === undefined\n ? 0\n : Math.min(preserve.shown, commonPrefix(preserve.chars, chars))\n const record = { chars, full, shown: preserved }\n records.set(node, record)\n if (preserved < chars.length) {\n pending.add(node)\n announcedSettled = false\n } else {\n pending.delete(node)\n }\n write(node, chars.slice(0, preserved).join(''))\n }\n\n const visit = (from: Node, reveal: boolean): void => {\n if (from.nodeType === Node.TEXT_NODE) {\n const text = from as Text\n if (reveal) enqueue(text, text.data, records.get(text))\n return\n }\n const walker = document.createTreeWalker(from, NodeFilter.SHOW_TEXT)\n let current = walker.nextNode()\n while (current !== null) {\n const text = current as Text\n if (reveal) enqueue(text, text.data, records.get(text))\n current = walker.nextNode()\n }\n }\n\n const scheduleFrame = (): void => {\n if (stopped || pending.size === 0 || rafId !== 0) return\n rafId = requestAnimationFrame(frame)\n }\n\n const frame = (now: number): void => {\n rafId = 0\n if (stopped) return\n if (pending.size === 0) {\n announceSettled()\n return\n }\n announcedSettled = false\n if (lastFrame === null) {\n lastFrame = now\n scheduleFrame()\n return\n }\n const elapsed = Math.max(0, now - lastFrame)\n lastFrame = now\n let backlog = 0\n for (const node of pending) {\n const record = records.get(node)\n if (record !== undefined) backlog += record.chars.length - record.shown\n }\n const step = computeAdaptiveQueueStep(backlog, elapsed, debt)\n debt = step.debt\n speedCpsRef.current = step.speedCps\n let remaining = step.revealChars\n for (const node of [...pending]) {\n if (remaining <= 0) break\n const record = records.get(node)\n if (record === undefined || !node.isConnected) {\n pending.delete(node)\n continue\n }\n const amount = Math.min(remaining, record.chars.length - record.shown)\n const shown = record.shown + amount\n const next = { ...record, shown }\n records.set(node, next)\n write(node, next.chars.slice(0, shown).join(''))\n remaining -= amount\n if (shown >= next.chars.length) pending.delete(node)\n }\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n }\n\n if (revealInitial) visit(root, true)\n\n const observer = typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'characterData') {\n const node = mutation.target as Text\n const expected = internalWrites.get(node)\n if (expected === node.data) {\n internalWrites.delete(node)\n continue\n }\n enqueue(node, node.data, records.get(node))\n continue\n }\n for (const added of mutation.addedNodes) visit(added, true)\n }\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n })\n observer?.observe(root, { childList: true, characterData: true, subtree: true })\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n\n return () => {\n stopped = true\n cancelAnimationFrame(rafId)\n observer?.disconnect()\n for (const [node, record] of records) {\n const controlled = record.chars.slice(0, record.shown).join('')\n // React may have committed a terminal replacement in the same mutation\n // phase that disables this hook. Never overwrite that newer renderer\n // value with the previous controlled source during layout cleanup.\n if (node.isConnected && node.data === controlled) write(node, record.full)\n }\n pending.clear()\n speedCpsRef.current = 35\n }\n }, [enabled, onSettled, revealInitial, rootRef, speedCpsRef])\n}\n","import { createElement, useCallback, useEffect, useLayoutEffect, useRef, useState, type ComponentType } from 'react'\nimport { FollowHost } from './FollowHost.tsx'\nimport { useProgressiveDomText } from './useProgressiveDomText.ts'\nimport { hasRecentConversationFollow } from './teleprompterGlide.ts'\n\n/** Props forwarded through a follow wrap; extra kit seats pass through. */\nexport type FollowWrapProps = {\n node?: unknown\n renderSlot?: unknown\n} & Record<string, unknown>\n\nfunction openAgentLocation(node: unknown): boolean {\n if (node === null || typeof node !== 'object' || !('location' in node)) return false\n const location = (node as { location: unknown }).location\n if (location === null || typeof location !== 'object' || !('kind' in location)) return false\n const kind = (location as { kind: unknown }).kind\n if (!('turn' in location)) return false\n const turn = (location as { turn: unknown }).turn\n if (turn === null || typeof turn !== 'object' || !('status' in turn)) return false\n if (kind === 'turn') return (turn as { status: unknown }).status === 'open'\n if (kind !== 'step' || !('step' in location)) return false\n const step = (location as { step: unknown }).step\n return step !== null\n && typeof step === 'object'\n && 'status' in step\n && (step as { status: unknown }).status === 'open'\n}\n\n/**\n * True while a Chat node has an explicitly unfinished lifecycle: an\n * assistant/workflow `status: 'running'` payload, a Tool root that has not\n * settled (`kind` absent), or a model-retry whose current attempt is still\n * `scheduled`. Open-but-otherwise-unknown rows are covered by\n * `isFollowableChatNode` below.\n * @param node - The Chat node's view `node` prop.\n * @returns whether this row should own conversation follow.\n */\nexport function isGrowingChatNode(node: unknown): boolean {\n if (node === null || typeof node !== 'object' || !('data' in node)) return false\n const data = (node as { data: unknown }).data\n if (data === null || typeof data !== 'object') return false\n if ('status' in data && (data as { status: unknown }).status === 'running') return true\n if (\n 'kind' in data\n && (data as { kind: unknown }).kind === 'command'\n && 'outcome' in data\n && (data as { outcome: unknown }).outcome === null\n ) return true\n if ('command' in data) {\n const command = (data as { command: unknown }).command\n if (\n command !== null\n && typeof command === 'object'\n && 'outcome' in command\n && (command as { outcome: unknown }).outcome === null\n ) return true\n }\n if ('root' in data) {\n const root = (data as { root: unknown }).root\n if (root !== null && typeof root === 'object' && !('kind' in root)) return true\n }\n if ('current' in data) {\n const current = (data as { current: unknown }).current\n if (\n current !== null\n && typeof current === 'object'\n && 'retryState' in current\n && (current as { retryState: unknown }).retryState === 'scheduled'\n ) return true\n }\n return false\n}\n\n/**\n * True for any Agent-owned Chat row in the currently open turn/step. This is\n * the extensibility boundary: a newly registered Context, Command, Tool, or\n * workflow renderer is followed without adding another kind-specific branch.\n */\nexport function isFollowableChatNode(node: unknown): boolean {\n return isGrowingChatNode(node) || openAgentLocation(node)\n}\n\n/**\n * True when a newly mounted Agent-owned row belongs to the current open\n * Turn/Step, or is itself an unresolved growing lifecycle.\n * @param node - The Chat node's view `node` prop.\n * @returns whether its initial height should enter through conversation follow.\n */\nexport function shouldAnimateChatNodeEntrance(node: unknown): boolean {\n return isFollowableChatNode(node)\n}\n\n/** Runtime-only fallback for unknown or terminal rows at the active flow tip. */\nfunction liveAgentTailMode(root: HTMLElement): 'turn' | 'handoff' | null {\n const port = root.closest<HTMLElement>('[data-conversation-scroll]')\n if (port === null) return null\n const row = root.closest<HTMLElement>('[data-chat-flow-key]')\n if (row !== null) {\n let sibling = row.nextElementSibling\n while (sibling !== null) {\n if (sibling instanceof HTMLElement && sibling.hasAttribute('data-chat-flow-key')) return null\n sibling = sibling.nextElementSibling\n }\n }\n const flow = root.closest<HTMLElement>('[data-chat-flow]')\n const hasTurnStatus = flow !== null && [...flow.children].some(child =>\n child instanceof HTMLElement\n && child.getAttribute('role') === 'status'\n && !child.hasAttribute('data-chat-flow-key'))\n if (hasTurnStatus) return 'turn'\n return hasRecentConversationFollow(port) ? 'handoff' : null\n}\n\n/**\n * Wrap a prior Agent Chat renderer so its entrance and later growth share\n * conversation follow. Presentation stays with the wrapped component; kit\n * seats (`renderSlot`, locale, inject) pass through unchanged.\n * @param Inner - The already-registered row component.\n * @returns A follow-hosted row.\n */\nexport function wrapFollowNodeView(Inner: ComponentType<FollowWrapProps>) {\n return function TypewriterFollowNodeView(props: FollowWrapProps) {\n const speedCpsRef = useRef(35)\n const hostRef = useRef<HTMLDivElement>(null)\n const growing = isGrowingChatNode(props.node)\n const structurallyFollowable = isFollowableChatNode(props.node)\n const structuralRef = useRef(structurallyFollowable)\n const [runtimeFollowable, setRuntimeFollowable] = useState(false)\n const runtimePersistentRef = useRef(false)\n const runtimeHandledRef = useRef(false)\n const followable = structurallyFollowable || runtimeFollowable\n const revealInitialRef = useRef(true)\n const [entering, setEntering] = useState(() => shouldAnimateChatNodeEntrance(props.node))\n const [growthPulse, setGrowthPulse] = useState(false)\n const followableRef = useRef(false)\n const growingRef = useRef(growing)\n const entranceActiveRef = useRef(entering || growthPulse)\n const growthExtentRef = useRef<number | null>(null)\n const mountedRef = useRef(true)\n const pulseTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n structuralRef.current = structurallyFollowable\n followableRef.current = followable\n growingRef.current = growing\n entranceActiveRef.current = entering || growthPulse\n const finishRuntimeReveal = useCallback(() => {\n if (structuralRef.current || runtimePersistentRef.current) return\n runtimeHandledRef.current = true\n setRuntimeFollowable(false)\n }, [])\n useProgressiveDomText(\n hostRef,\n followable,\n revealInitialRef.current,\n speedCpsRef,\n runtimeFollowable ? finishRuntimeReveal : undefined,\n )\n useLayoutEffect(() => {\n if (structurallyFollowable) return\n const root = hostRef.current\n if (root === null) return\n const mode = liveAgentTailMode(root)\n if (runtimeFollowable) {\n if (runtimePersistentRef.current && mode !== 'turn') {\n runtimePersistentRef.current = false\n runtimeHandledRef.current = true\n setRuntimeFollowable(false)\n }\n return\n }\n if (runtimeHandledRef.current || mode === null) return\n runtimePersistentRef.current = mode === 'turn'\n setRuntimeFollowable(true)\n setEntering(true)\n }, [runtimeFollowable, structurallyFollowable])\n const finishEntrance = useCallback(() => {\n growthExtentRef.current = null\n if (pulseTimerRef.current !== null) {\n clearTimeout(pulseTimerRef.current)\n pulseTimerRef.current = null\n }\n setEntering(false)\n setGrowthPulse(false)\n }, [])\n const onGrowth = useCallback((deltaPx: number) => {\n // A row with an explicit streaming lifecycle keeps its original owner\n // through completion. For every other Agent row, a pure layout increase\n // is enough evidence to glide it; renderer kind and payload shape are\n // intentionally irrelevant.\n if (\n !mountedRef.current\n || !followableRef.current\n || growingRef.current\n || entranceActiveRef.current\n ) return\n growthExtentRef.current = deltaPx\n setGrowthPulse(true)\n if (pulseTimerRef.current !== null) clearTimeout(pulseTimerRef.current)\n pulseTimerRef.current = setTimeout(() => {\n pulseTimerRef.current = null\n setGrowthPulse(false)\n }, 1200)\n }, [])\n useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n if (pulseTimerRef.current !== null) clearTimeout(pulseTimerRef.current)\n }\n }, [])\n return (\n <FollowHost\n active={growing}\n entrance={entering || growthPulse}\n onEntranceSettled={finishEntrance}\n onGrowth={followable ? onGrowth : undefined}\n entranceExtentRef={growthExtentRef}\n speedCpsRef={speedCpsRef}\n // Generic Agent rows reveal and spring their measured growth, but do\n // not continuously reserve space for a future Markdown line wrap.\n // Keeping that assistant-only prediction here creates an idle gap\n // above TurnStatus and a visible return when a short Tool row settles.\n predictive={false}\n hostRef={hostRef}\n >\n {createElement(Inner, props)}\n </FollowHost>\n )\n }\n}\n","/**\n * The smooth-stream plugin configuration card, rendered inside the Web\n * Settings \"plugin configuration\" page. One toggle, staged until the user\n * saves — the same shape as the Host-shipped cards, hand-drawn because the\n * Host cards' chrome is not exported for reuse.\n */\n\nimport { useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\nimport { IconChevronDownOutline14, IconRefreshOutline14 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { SmoothStreamCardFace } from './smooth-stream-card-controller.ts'\nimport css from './SmoothStreamCard.module.css'\n\n/** Props the renderer binds for the smooth-stream card. */\nexport type SmoothStreamCardProps =\n PropsRuntime<'settings.plugin.item'>\n & PropsLocale<'settings.smoothStream'>\n & InjectFace<SmoothStreamCardFace>\n\n/** Render the smooth-stream card independently of the core settings namespace allowlist. */\nexport function SmoothStreamCard(props: SmoothStreamCardProps) {\n const { t } = props\n const [open, setOpen] = useState(false)\n const state = props.useSmoothStreamCard(snapshot => snapshot)\n const blocked = !state.dirty || state.saving || state.status !== 'ready'\n const versionLabel = state.version === undefined\n ? null\n : t(state.installation === 'development' ? 'developmentVersion' : 'version')\n .replace('{version}', state.version)\n\n return (\n <li className={open ? `${css.card} ${css.cardOpen}` : css.card}>\n <button\n type=\"button\"\n className={css.header}\n aria-expanded={open}\n onClick={() => { setOpen(!open) }}\n >\n <span className={css.headText}>\n <span className={css.name}>{t('title')}</span>\n <span className={css.description}>{t('description')}</span>\n </span>\n {versionLabel === null ? null : <span className={css.version}>{versionLabel}</span>}\n {state.dirty ? <span className={css.pending}>{t('unsaved')}</span> : null}\n <IconChevronDownOutline14 className={open ? `${css.chevron} ${css.chevronOpen}` : css.chevron} />\n </button>\n {open\n ? (\n <div className={css.body}>\n {state.status === 'loading' ? <p className={css.readOnly} role=\"status\">{t('loading')}</p> : null}\n {state.status === 'unavailable' ? (\n <div className={css.failure}>\n <p className={css.readOnly} role=\"status\">{t('unavailable')}</p>\n <button type=\"button\" className={css.discard} onClick={props.reload}>{t('retry')}</button>\n </div>\n ) : null}\n {state.status === 'ready' ? (\n <>\n {!state.writable ? <p className={css.readOnly} role=\"status\">{t('readOnly')}</p> : null}\n <label className={css.field}>\n <span className={css.fieldHead}>\n <span className={css.label}>{t('thinkAutoExpand')}</span>\n <input\n type=\"checkbox\"\n className={css.toggle}\n checked={state.thinkAutoExpand}\n disabled={!state.writable}\n onChange={(event) => { props.edit(event.target.checked) }}\n />\n </span>\n <span className={css.hint}>{t('thinkAutoExpandHint')}</span>\n </label>\n <div className={css.updateRow}>\n <span className={css.updateCopy}>\n <span className={css.label}>{t('updates')}</span>\n <span className={css.hint}>\n {state.restartRequired\n ? t('restartRequired')\n : state.installation === 'npm' ? t('updateHint')\n : state.installation === 'development' ? t('developmentBuild') : t('updateUnavailable')}\n </span>\n </span>\n <button\n type=\"button\"\n className={css.update}\n disabled={!state.canUpgrade || state.upgrading || state.restartRequired}\n title={state.canUpgrade ? undefined : t('updateUnavailable')}\n onClick={props.upgrade}\n >\n <span aria-hidden=\"true\"><IconRefreshOutline14 /></span>\n {t(state.upgrading ? 'updating' : 'update')}\n </button>\n </div>\n {state.upgradeFailed ? <p className={css.failed} role=\"status\">{t('updateFailed')}</p> : null}\n <div className={css.footer}>\n {state.failed ? <p className={css.failed} role=\"status\">{t('saveFailed')}</p> : null}\n <button\n type=\"button\"\n className={css.discard}\n disabled={!state.dirty || state.saving}\n onClick={props.discard}\n >\n {t('discard')}\n </button>\n <button\n type=\"button\"\n className={css.save}\n disabled={blocked}\n onClick={props.save}\n >\n {t(state.saving ? 'saving' : 'save')}\n </button>\n </div>\n </>\n ) : null}\n </div>\n )\n : null}\n </li>\n )\n}\n","/** Staged form state for the plugin-owned smooth-stream settings RPC. */\n\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\nimport type { StreamInstallationKind, StreamSettingsView } from '../settings-api.ts'\nimport type { SmoothStreamSettingsApi } from './smooth-stream-settings-api.ts'\n\n/** What the smooth-stream card renders. It remains visible while its Host RPC loads. */\nexport interface SmoothStreamCardState {\n status: 'loading' | 'ready' | 'unavailable'\n writable: boolean\n dirty: boolean\n saving: boolean\n failed: boolean\n thinkAutoExpand: boolean\n version: string | undefined\n installation: StreamInstallationKind\n canUpgrade: boolean\n upgrading: boolean\n upgradeFailed: boolean\n restartRequired: boolean\n}\n\n/** The registration-side face injected into the settings slot renderer. */\nexport interface SmoothStreamCardFace {\n hooks: {\n smoothStreamCard: SnapshotStore<SmoothStreamCardState>\n }\n edit: (value: boolean) => void\n save: () => void\n discard: () => void\n reload: () => void\n upgrade: () => void\n}\n\n/** Bridges the plugin's protected Host interface onto a staged settings form. */\nexport class SmoothStreamCardController {\n private readonly store = createSnapshotStore<SmoothStreamCardState>(this.projection())\n private loaded: StreamSettingsView | undefined\n private staged: boolean | undefined\n private saving = false\n private failed = false\n private upgrading = false\n private upgradeFailed = false\n private restartRequired = false\n private loadGeneration = 0\n private loadStatus: 'loading' | 'ready' | 'unavailable' = 'loading'\n\n constructor(private readonly api: SmoothStreamSettingsApi) {}\n\n /** Begin the background read after the card has been registered. */\n start(): void {\n void this.load()\n }\n\n /** Ignore a late response after the surrounding optional services unload. */\n stop(): void {\n this.loadGeneration += 1\n }\n\n /** Current card snapshot, also consumed by the streaming preference cell. */\n getSnapshot(): SmoothStreamCardState {\n return this.store.getSnapshot()\n }\n\n /** Subscribe to state changes. */\n subscribe(listener: () => void): () => void {\n return this.store.subscribe(listener)\n }\n\n /** Build the face consumed by the settings slot renderer. */\n inject(): SmoothStreamCardFace {\n return {\n hooks: { smoothStreamCard: this.store },\n edit: (value) => {\n this.staged = value\n this.failed = false\n this.publish()\n },\n save: () => { void this.save() },\n discard: () => {\n if (this.staged === undefined && !this.failed) return\n this.staged = undefined\n this.failed = false\n this.publish()\n },\n reload: () => { void this.load() },\n upgrade: () => { void this.upgrade() },\n }\n }\n\n private projection(): SmoothStreamCardState {\n return {\n status: this.loadStatus,\n writable: this.loaded?.writable ?? false,\n dirty: this.staged !== undefined,\n saving: this.saving,\n failed: this.failed,\n thinkAutoExpand: this.staged ?? this.loaded?.thinkAutoExpand ?? DEFAULT_STREAM_SETTINGS.thinkAutoExpand,\n version: this.loaded?.version,\n installation: this.loaded?.installation ?? 'unmanaged',\n canUpgrade: this.loaded?.canUpgrade ?? false,\n upgrading: this.upgrading,\n upgradeFailed: this.upgradeFailed,\n restartRequired: this.restartRequired,\n }\n }\n\n private async load(): Promise<void> {\n const generation = ++this.loadGeneration\n this.loadStatus = 'loading'\n this.loaded = undefined\n this.publish()\n try {\n const view = await this.api.read()\n if (generation !== this.loadGeneration) return\n this.loaded = view\n this.loadStatus = 'ready'\n } catch {\n if (generation !== this.loadGeneration) return\n this.loaded = undefined\n this.loadStatus = 'unavailable'\n }\n this.publish()\n }\n\n private async save(): Promise<void> {\n if (this.staged === undefined || this.saving || this.loaded?.writable !== true) return\n const value = this.staged\n this.saving = true\n this.failed = false\n this.publish()\n try {\n this.loaded = await this.api.write(value)\n this.staged = undefined\n } catch {\n this.failed = true\n }\n this.saving = false\n this.publish()\n }\n\n private async upgrade(): Promise<void> {\n if (this.loaded?.canUpgrade !== true || this.upgrading) return\n this.upgrading = true\n this.upgradeFailed = false\n this.restartRequired = false\n this.publish()\n try {\n const result = await this.api.upgrade()\n this.restartRequired = result.restartRequired\n } catch {\n this.upgradeFailed = true\n }\n this.upgrading = false\n this.publish()\n }\n\n private publish(): void {\n this.store.set(this.projection())\n }\n}\n","/** Shared wire vocabulary for the plugin-owned settings RPC channel. */\n\n/** Dedicated, loopback-only RPC channel registered by the Host half. */\nexport const STREAM_SETTINGS_RPC_CHANNEL = '/smooth-stream'\n\n/** Endpoints accepted by {@link STREAM_SETTINGS_RPC_CHANNEL}. */\nexport const STREAM_SETTINGS_RPC = {\n read: 'settings.read',\n write: 'settings.write',\n upgrade: 'plugin.upgrade',\n} as const\n\n/** How the active profile supplied this plugin. */\nexport type StreamInstallationKind = 'npm' | 'development' | 'unmanaged'\n\n/** Redacted, plugin-owned configuration state returned to the browser. */\nexport interface StreamSettingsView {\n /** Version of the package currently running in the Host process. */\n version: string\n /** Source class of this package in the active profile. */\n installation: StreamInstallationKind\n /** Whether the Host settings provider permits a write. */\n writable: boolean\n /** Current resolved preference. */\n thinkAutoExpand: boolean\n /** Whether a fixed npm update command is safe to offer. */\n canUpgrade: boolean\n}\n\n/** Successful package update acknowledgement; loading the new code needs a restart. */\nexport interface StreamUpgradeView {\n restartRequired: true\n}\n","/** Browser adapter for the Host-owned smooth-stream settings RPC. */\n\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport {\n STREAM_SETTINGS_RPC,\n STREAM_SETTINGS_RPC_CHANNEL,\n type StreamSettingsView,\n type StreamUpgradeView,\n} from '../settings-api.ts'\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? value as Record<string, unknown>\n : undefined\n}\n\nfunction settingsView(value: unknown): StreamSettingsView {\n const data = record(value)\n if (data === undefined\n || typeof data.version !== 'string'\n || !['npm', 'development', 'unmanaged'].includes(data.installation as string)\n || typeof data.writable !== 'boolean'\n || typeof data.thinkAutoExpand !== 'boolean'\n || typeof data.canUpgrade !== 'boolean') {\n throw new Error('dsh-smooth-stream: malformed settings response')\n }\n return data as unknown as StreamSettingsView\n}\n\nfunction upgradeView(value: unknown): StreamUpgradeView {\n const data = record(value)\n if (data?.restartRequired !== true) throw new Error('dsh-smooth-stream: malformed update response')\n return { restartRequired: true }\n}\n\nfunction accepted(result: Awaited<ReturnType<ConnectionHandle['rpc']['call']>>): unknown {\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n}\n\n/** Narrow client contract consumed by the staged settings-card controller. */\nexport interface SmoothStreamSettingsApi {\n read(): Promise<StreamSettingsView>\n write(thinkAutoExpand: boolean): Promise<StreamSettingsView>\n upgrade(): Promise<StreamUpgradeView>\n}\n\n/** Build the typed facade over the generic Connection RPC service. */\nexport function createSmoothStreamSettingsApi(connection: ConnectionHandle): SmoothStreamSettingsApi {\n return {\n async read(): Promise<StreamSettingsView> {\n return settingsView(accepted(await connection.rpc.call(STREAM_SETTINGS_RPC_CHANNEL, STREAM_SETTINGS_RPC.read, {})))\n },\n async write(thinkAutoExpand: boolean): Promise<StreamSettingsView> {\n return settingsView(accepted(await connection.rpc.call(\n STREAM_SETTINGS_RPC_CHANNEL,\n STREAM_SETTINGS_RPC.write,\n { thinkAutoExpand },\n )))\n },\n async upgrade(): Promise<StreamUpgradeView> {\n return upgradeView(accepted(await connection.rpc.call(STREAM_SETTINGS_RPC_CHANNEL, STREAM_SETTINGS_RPC.upgrade, {})))\n },\n }\n}\n","/** Locale bundles for the smooth-stream plugin configuration card. */\n\n/** Dictionary namespace owned by this plugin's settings card. */\nexport const NS = 'settings.smoothStream'\n\n/** Locale keys the card renders. */\nexport type SmoothStreamLocaleKey =\n | 'title' | 'description'\n | 'thinkAutoExpand' | 'thinkAutoExpandHint'\n | 'readOnly' | 'loading' | 'unavailable' | 'retry'\n | 'version' | 'developmentVersion'\n | 'updates' | 'updateHint' | 'developmentBuild' | 'updateUnavailable'\n | 'update' | 'updating' | 'restartRequired' | 'updateFailed'\n | 'save' | 'saving' | 'discard' | 'unsaved' | 'saveFailed'\n\n/** English copy. */\nexport const en: Record<SmoothStreamLocaleKey, string> = {\n title: 'Smooth stream',\n description: 'How replies are revealed while they stream.',\n thinkAutoExpand: 'Auto-expand thinking',\n thinkAutoExpandHint: 'Open the thinking block while it streams. Turn off to keep it collapsed.',\n readOnly: 'This deployment stores settings read-only.',\n loading: 'Loading plugin settings…',\n unavailable: 'Plugin settings are unavailable in this connection.',\n retry: 'Retry',\n version: 'Version {version}',\n developmentVersion: 'Development version {version}',\n updates: 'Updates',\n updateHint: 'Install the newest npm version, then restart Harness.',\n developmentBuild: 'Linked source; updates are managed in the checkout.',\n updateUnavailable: 'Updates are available only for an npm profile installation.',\n update: 'Update',\n updating: 'Updating…',\n restartRequired: 'Updated. Restart Harness to load the new version.',\n updateFailed: 'The package update failed; your current version is unchanged.',\n save: 'Save',\n saving: 'Saving…',\n discard: 'Discard',\n unsaved: 'Unsaved',\n saveFailed: 'The deployment did not accept these values; they were left for you to correct.',\n}\n\n/** Simplified Chinese copy. */\nexport const zh: Record<SmoothStreamLocaleKey, string> = {\n title: '丝滑流式',\n description: '回复在流式输出时如何逐字展现。',\n thinkAutoExpand: '自动展开思考',\n thinkAutoExpandHint: '思考块在流式时自动展开;关闭后保持折叠,可手动展开。',\n readOnly: '本部署的设置为只读。',\n loading: '正在加载插件设置…',\n unavailable: '当前连接无法访问插件设置。',\n retry: '重试',\n version: '版本 {version}',\n developmentVersion: '开发版本 {version}',\n updates: '更新',\n updateHint: '安装最新 npm 版本后重启 Harness。',\n developmentBuild: '当前为本地链接版本,请在源码目录管理更新。',\n updateUnavailable: '只有 profile 使用 npm 包时才能更新。',\n update: '更新',\n updating: '更新中…',\n restartRequired: '已更新;重启 Harness 后加载新版本。',\n updateFailed: '包更新失败,当前版本未改变。',\n save: '保存',\n saving: '保存中…',\n discard: '放弃修改',\n unsaved: '未保存',\n saveFailed: '本部署没有接受这些值,已保留供你修改。',\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'settings.smoothStream': SmoothStreamLocaleKey\n }\n}\n","import { createElement, useSyncExternalStore, type ComponentType } from 'react'\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: the connection Context merge and the plugins section's SlotMap\n// entry ('settings.plugin.item').\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-plugins/client'\nimport type { ChatNodeViewProps } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { TypewriterAssistantNodeView } from './TypewriterAssistantNodeView.tsx'\nimport { wrapFollowNodeView, type FollowWrapProps } from './TypewriterToolNodeView.tsx'\nimport { SmoothStreamCard } from './SmoothStreamCard.tsx'\nimport { SmoothStreamCardController } from './smooth-stream-card-controller.ts'\nimport { createSmoothStreamSettingsApi } from './smooth-stream-settings-api.ts'\nimport { NS as SETTINGS_NS, en, zh } from './locales.ts'\nimport { DEFAULT_STREAM_CONFIG, STREAM_BOOT_GLOBAL, type StreamConfig } from '../config.ts'\nimport { DEFAULT_STREAM_SETTINGS } from '../settings.ts'\n\n/**\n * Cordis services required by the browser half. Only `slots` is load-bearing\n * for the stream itself; locale and Connection power the configuration card\n * and are wired through `ctx.inject` below so a deployment without them still\n * streams with defaults.\n */\nexport const inject = ['slots']\n\ntype AssistantProps = ChatNodeViewProps<'assistant-step'>\n\nconst STREAM_MODES: readonly string[] = ['typewriter', 'teleprompter']\nconst STREAM_PRESETS: readonly string[] = ['realtime', 'balanced', 'silky']\n\n/**\n * The assistant renderer owns its own character queue and conversation\n * follower, so wrapping it again would create two scroll owners. Human input\n * stays immediate; every Agent-owned output renderer goes through the same\n * generic follow boundary. This is deliberately keyed by the owner that\n * provides the renderer, not by individual tool names, so new Context,\n * Command, and Tool rows are covered automatically.\n */\nconst SKIP_WRAP = new Set(['assistant-step', 'user', 'steering', 'command-input'])\n\n/** React function/class or an exotic component such as memo/forwardRef/lazy. */\nfunction isWrappableComponent(value: unknown): value is ComponentType<FollowWrapProps> {\n return typeof value === 'function'\n || (value !== null && typeof value === 'object' && '$$typeof' in value)\n}\n\n/**\n * Read the Host-bridged boot config. The inline script is produced by this\n * plugin's Host half from a schema-validated value, so only the structural\n * guarantees that could break between the two halves are re-checked: the\n * global is absent when the client runs without its Host entry (defaults\n * apply), and any present-but-malformed value fails loudly instead of\n * rendering a half-configured view.\n * @returns The resolved configuration for the assistant node view.\n */\nfunction readBootConfig(): StreamConfig {\n const raw = (globalThis as Record<string, unknown>)[STREAM_BOOT_GLOBAL]\n if (raw === undefined) {\n console.info('[dsh-smooth-stream] no host config bridge; using defaults')\n return DEFAULT_STREAM_CONFIG\n }\n if (\n typeof raw !== 'object' || raw === null\n || !STREAM_MODES.includes((raw as StreamConfig).mode)\n || !STREAM_PRESETS.includes((raw as StreamConfig).preset)\n || typeof (raw as StreamConfig).revealCharsPerSec !== 'number'\n || typeof (raw as StreamConfig).scrollSpeedPxPerSec !== 'number'\n || typeof (raw as StreamConfig).maxScrollSpeedPxPerSec !== 'number'\n ) {\n throw new Error(`[dsh-smooth-stream] malformed ${STREAM_BOOT_GLOBAL} boot global: ${JSON.stringify(raw)}`)\n }\n return raw as StreamConfig\n}\n\n/**\n * Wrap every Agent-owned keyed Chat row except the assistant renderer in\n * place. A second\n * register with the same `children` table throws because the child slot is\n * already declared, and only the winning entry receives `renderSlot`;\n * swapping `entry.component` keeps the original children, locale, and inject\n * seats. `assistant-step` is replaced below so text and Think use the\n * typewriter reveal. The wrapper owns only the shared layout-growth/follow\n * lifecycle; the Harness keeps each renderer's controls, disclosures, and\n * cards intact.\n * @param ctx - Browser context carrying the slot registry.\n * @returns Restorer that puts the original components back.\n */\nfunction wrapAgentChatRows(ctx: ClientContext): () => void {\n const restores: Array<() => void> = []\n const wrapped = new WeakSet<object>()\n\n const wrapAll = (): void => {\n for (const entry of ctx.slots.entries('conversation.chat.node')) {\n const key = entry.options.key\n if (key === undefined || SKIP_WRAP.has(key)) continue\n const current = entry.component\n if (!isWrappableComponent(current) || wrapped.has(current)) continue\n const inner = current as ComponentType<FollowWrapProps>\n const next = wrapFollowNodeView(inner)\n wrapped.add(next)\n entry.component = next\n restores.push(() => {\n if (entry.component === next) entry.component = inner\n })\n }\n }\n\n wrapAll()\n const off = ctx.on('slots/changed', (key: string) => {\n if (key === 'conversation.chat.node') wrapAll()\n })\n return () => {\n off()\n for (const restore of restores) restore()\n }\n}\n\n/**\n * A live preference cell read by `useSyncExternalStore`. It starts on the\n * shared default and, once the plugin-owned settings controller is attached,\n * tracks the resolved `thinkAutoExpand` value. A composition (or test) that\n * ships no settings surface keeps the cell on the default.\n */\nclass PreferenceCell {\n private readonly listeners = new Set<() => void>()\n private card: SmoothStreamCardController | undefined\n private value = DEFAULT_STREAM_SETTINGS.thinkAutoExpand\n\n /** Re-point the cell at the plugin-owned settings controller. */\n attach(card: SmoothStreamCardController): () => void {\n this.card = card\n this.refresh()\n const unsubscribe = card.subscribe(() => { this.refresh() })\n return () => {\n unsubscribe()\n if (this.card !== card) return\n this.card = undefined\n this.refresh()\n }\n }\n\n private read(): boolean {\n return this.card?.getSnapshot().thinkAutoExpand ?? DEFAULT_STREAM_SETTINGS.thinkAutoExpand\n }\n\n private refresh(): void {\n const next = this.read()\n if (next === this.value) return\n this.value = next\n for (const listener of this.listeners) listener()\n }\n\n readonly getSnapshot = (): boolean => this.value\n\n readonly subscribe = (listener: () => void): () => void => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n}\n\n/**\n * Register the typewriter renderer after the conversation package declares the\n * keyed Chat node seat. A lower priority shadows the built-in assistant row;\n * every other keyed renderer is wrapped in place so Context, commands, Tool\n * cards, retries, and workflow runs share one extensible follow boundary. The\n * Host-bridged configuration\n * selects the render direction, smoothing preset, and glide speed; the\n * plugin-owned settings RPC supplies the live auto-expand preference when the\n * settings surface is composed.\n * @param ctx - Browser context carrying the shared slot registry.\n */\nexport function apply(ctx: ClientContext): void {\n const config = readBootConfig()\n const preference = new PreferenceCell()\n\n // The card talks to the plugin-owned loopback RPC, so the core settings\n // namespace allowlist cannot make it disappear. The stream still applies\n // with defaults when the optional Settings UI or Connection is absent.\n ctx.inject(['slots', 'locale', 'connection'], (settingsCtx) => {\n const card = new SmoothStreamCardController(\n // The shared Context augmentation also carries the Host-side Connection\n // shape. This browser entry runs after the client provider installs its\n // handle, so narrow through unknown to its client contract here.\n createSmoothStreamSettingsApi(settingsCtx.get('connection') as unknown as ConnectionHandle),\n )\n const detachPreference = preference.attach(card)\n card.start()\n settingsCtx.effect(() => settingsCtx.locale.register(SETTINGS_NS, { zh, en }), 'dsh-smooth-stream: settings dictionaries')\n settingsCtx.slots.inject('settings.plugin.item', () => settingsCtx.slots.register({\n name: 'settings.plugin.item',\n id: 'smooth-stream',\n order: 30,\n locale: SETTINGS_NS,\n inject: () => card.inject(),\n }, SmoothStreamCard))\n return () => {\n card.stop()\n detachPreference()\n }\n })\n\n const configured = function StreamConfiguredView(props: AssistantProps) {\n const thinkAutoExpand = useSyncExternalStore(\n preference.subscribe,\n preference.getSnapshot,\n preference.getSnapshot,\n )\n return createElement(TypewriterAssistantNodeView, {\n ...props,\n mode: config.mode,\n preset: config.preset,\n revealCharsPerSec: config.revealCharsPerSec,\n scrollSpeedPxPerSec: config.scrollSpeedPxPerSec,\n maxScrollSpeedPxPerSec: config.maxScrollSpeedPxPerSec,\n thinkAutoExpand,\n })\n }\n ctx.slots.inject('conversation.chat.node', () => {\n const unwrap = wrapAgentChatRows(ctx)\n const unshadow = ctx.slots.register({\n name: 'conversation.chat.node',\n key: 'assistant-step',\n priority: -100,\n locale: 'conversation',\n registrant: 'dsh-smooth-stream',\n }, configured)\n return () => {\n unshadow()\n unwrap()\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,SAAS,GAA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