dsh-smooth-stream 0.3.4 → 0.4.0
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 +14 -4
- package/README.md +14 -4
- package/lib/client.js +2111 -140
- package/lib/client.js.map +1 -1
- package/lib/index.js +123 -6
- package/package.json +9 -9
- package/src/client/DebugPanel.module.css +370 -0
- package/src/client/DebugPanel.tsx +248 -0
- package/src/client/SmoothStreamCard.module.css +8 -0
- package/src/client/SmoothStreamCard.tsx +42 -3
- package/src/client/auto-collapse-controller.ts +977 -0
- package/src/client/debugRuntime.ts +355 -0
- package/src/client/index.ts +121 -30
- package/src/client/locales.ts +122 -0
- package/src/client/smooth-stream-card-controller.ts +97 -14
- package/src/client/smooth-stream-settings-api.ts +53 -3
- package/src/client/teleprompterGlide.ts +97 -31
- package/src/client/useFpsGuard.ts +7 -0
- package/src/client/useProgressiveDomText.ts +99 -17
- package/src/client/useSmoothStreamContent.ts +20 -4
- package/src/plugin.ts +137 -7
- package/src/settings-api.ts +12 -0
- package/src/settings.ts +55 -0
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","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,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,kBAAA,IAAA,CAAC,QAAD;OAAM,WAAW,GAAGA,+CAAI,mBAAmB,gBAAgB;OACxD,UAAA,OACG,iBAAA,GAAA,kBAAA,IAAA,CAACC,sCAAAA,0BAAD,EAA0B,WAAW,iBAAmB,CAAA,IAExD,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;QAAM,WAAWD,+CAAI;QAAqB,UAAA;OAAW,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAACC,sCAAAA,0BAAD,EAA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IAAI,OAAO;IAAC;IAAS;IAAU;GAAY,IAAI,gBAAgB;IAC7D,MAAM,OAAO,IAAI,2BAIf,8BAA8B,YAAY,IAAI,YAAY,CAAgC,CAC5F;IACA,MAAM,mBAAmB,WAAW,OAAO,IAAI;IAC/C,KAAK,MAAM;IACX,YAAY,aAAa,YAAY,OAAO,SAASC,IAAa;KAAE;KAAI;IAAG,CAAC,GAAG,0CAA0C;IACzH,YAAY,MAAM,OAAO,8BAA8B,YAAY,MAAM,SAAS;KAChF,MAAM;KACN,IAAI;KACJ,OAAO;KACP,QAAQA;KACR,cAAc,KAAK,OAAO;IAC5B,GAAG,gBAAgB,CAAC;IACpB,aAAa;KACX,KAAK,KAAK;KACV,iBAAiB;IACnB;GACF,CAAC;GAED,MAAM,aAAa,SAAS,qBAAqB,OAAuB;IACtE,MAAM,mBAAA,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","createSnapshotStore","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","css","Tooltip","IconQuestionOutline14","useState","writeClipboard","IconCopyOutline16","IconCloseOutline16","IconRefreshOutline16","IconCodeOutline16","createPortal","SETTINGS_NS","useSyncExternalStore","createElement"],"sources":["../src/client/AnimatedDisclosure.tsx","../src/settings.ts","../src/client/debugRuntime.ts","../src/client/useSmoothStreamContent.ts","../src/client/useFpsGuard.ts","../src/client/auto-collapse-controller.ts","../src/client/teleprompterGlide.ts","../src/client/FollowHost.tsx","../src/config.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/DebugPanel.tsx","../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 * 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/** Runtime knobs exposed only while the diagnostics switch is enabled. */\nexport interface StreamDebugTuning {\n /** Multiplier applied to the reveal cadence (1 = preset default). */\n revealScale: number\n /** Multiplier for backlog pressure in the adaptive reveal queue. */\n queuePressure: number\n /** Upper bound for reveal cadence, in characters per second. */\n maxRevealCps: number\n /** Spring stiffness used by the conversation follower. */\n springStiffness: number\n /** Spring damping used by the conversation follower. */\n springDamping: number\n /** Spring mass used by the conversation follower. */\n springMass: number\n /** Predictive runway before the fixed conversation chrome, in pixels. */\n runwayPx: number\n /** Response time for opening/closing the predictive runway, in ms. */\n reserveResponseMs: number\n /** Lowest reveal multiplier when visual lag fills the safe paint room. */\n backpressureMinScale: number\n}\n\n/** Defaults preserve the production engine exactly. */\nexport const DEFAULT_STREAM_DEBUG_TUNING: StreamDebugTuning = {\n revealScale: 1,\n queuePressure: 0.85,\n maxRevealCps: 600,\n springStiffness: 130,\n springDamping: 24,\n springMass: 1,\n runwayPx: 48,\n reserveResponseMs: 180,\n backpressureMinScale: 0.55,\n}\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 this plugin replaces and wraps Harness conversation renderers.\n * Off returns all rendering ownership to the built-in UI.\n */\n enabled: boolean\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 * Whether a finished turn folds its work process (thinking, tool calls,\n * context injection, intermediate replies) behind one \"已处理\" summary row,\n * leaving only the final answer visible. The summary row can always be\n * toggled by hand, and turns still expand live while they stream.\n */\n autoCollapse: boolean\n /** Whether the live renderer diagnostics panel is enabled. */\n debugEnabled: boolean\n /** Values edited by the diagnostics panel. */\n debugTuning: StreamDebugTuning\n}\n\n/** Defaults shared by the Host schema and the client-side fallback. */\nexport const DEFAULT_STREAM_SETTINGS: StreamSettings = {\n enabled: true,\n thinkAutoExpand: true,\n autoCollapse: true,\n debugEnabled: false,\n debugTuning: DEFAULT_STREAM_DEBUG_TUNING,\n}\n","/**\n * Shared browser-side diagnostics state.\n *\n * The settings card owns persistence. This module is the live bridge used by\n * the renderer and the chat-side panel: renderer loops publish measurements,\n * while panel edits are staged through the settings-card controller.\n */\n\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client'\nimport {\n DEFAULT_STREAM_DEBUG_TUNING,\n type StreamDebugTuning,\n type StreamSettings,\n} from '../settings.ts'\n\nexport interface DebugMetrics {\n fps: number | null\n frameMs: number | null\n fpsDegraded: boolean\n streamActive: boolean\n streamBacklog: number\n streamSpeedCps: number\n streamTargetChars: number\n streamDisplayedChars: number\n followActive: boolean\n followLagPx: number\n followVelocityPxPerSec: number\n followReservePx: number\n followCapacityPx: number\n followRevealScale: number\n followFollowing: boolean\n followConstrained: boolean\n scrollTop: number | null\n scrollHeight: number | null\n clientHeight: number | null\n lastUpdatedMs: number | null\n}\n\nexport interface DebugRuntimeState {\n available: boolean\n enabled: boolean\n writable: boolean\n dirty: boolean\n status: 'loading' | 'ready' | 'unavailable'\n tuning: StreamDebugTuning\n metrics: DebugMetrics\n}\n\nexport type DebugSettingsPatch = Partial<Pick<StreamSettings, 'debugEnabled' | 'debugTuning'>>\n\nexport interface DebugPanelFace {\n hooks: {\n debugRuntime: SnapshotStore<DebugRuntimeState>\n }\n edit: (patch: DebugSettingsPatch) => void\n save: () => void\n discard: () => void\n reset: () => void\n}\n\ninterface DebugSettingsActions {\n edit: (patch: DebugSettingsPatch) => void\n save: () => void\n discard: () => void\n}\n\ninterface StreamMetric {\n backlog: number\n speedCps: number\n targetChars: number\n displayedChars: number\n active: boolean\n updatedAt: number\n}\n\ninterface FollowMetric {\n lagPx: number\n velocityPxPerSec: number\n reservePx: number\n capacityPx: number\n revealScale: number\n following: boolean\n constrained: boolean\n scrollTop: number\n scrollHeight: number\n clientHeight: number\n active: boolean\n updatedAt: number\n}\n\nconst EMPTY_METRICS: DebugMetrics = {\n fps: null,\n frameMs: null,\n fpsDegraded: false,\n streamActive: false,\n streamBacklog: 0,\n streamSpeedCps: 0,\n streamTargetChars: 0,\n streamDisplayedChars: 0,\n followActive: false,\n followLagPx: 0,\n followVelocityPxPerSec: 0,\n followReservePx: 0,\n followCapacityPx: 0,\n followRevealScale: 1,\n followFollowing: false,\n followConstrained: false,\n scrollTop: null,\n scrollHeight: null,\n clientHeight: null,\n lastUpdatedMs: null,\n}\n\nconst INITIAL_STATE: DebugRuntimeState = {\n available: false,\n enabled: false,\n writable: false,\n dirty: false,\n status: 'loading',\n tuning: { ...DEFAULT_STREAM_DEBUG_TUNING },\n metrics: EMPTY_METRICS,\n}\n\nconst store = createSnapshotStore<DebugRuntimeState>(INITIAL_STATE)\nconst streamMetrics = new Map<string, StreamMetric>()\nconst followMetrics = new Map<HTMLElement, FollowMetric>()\nlet actions: DebugSettingsActions | undefined\nlet lastMetricPublish = 0\n\nfunction resetMetrics(): void {\n streamMetrics.clear()\n followMetrics.clear()\n lastMetricPublish = 0\n}\n\nfunction resetRuntime(): void {\n actions = undefined\n resetMetrics()\n store.set({ ...INITIAL_STATE, metrics: EMPTY_METRICS })\n}\n\nfunction now(): number {\n return typeof performance === 'undefined' ? Date.now() : performance.now()\n}\n\nfunction sameTuning(left: StreamDebugTuning, right: StreamDebugTuning): boolean {\n return left.revealScale === right.revealScale\n && left.queuePressure === right.queuePressure\n && left.maxRevealCps === right.maxRevealCps\n && left.springStiffness === right.springStiffness\n && left.springDamping === right.springDamping\n && left.springMass === right.springMass\n && left.runwayPx === right.runwayPx\n && left.reserveResponseMs === right.reserveResponseMs\n && left.backpressureMinScale === right.backpressureMinScale\n}\n\nfunction currentMetrics(timestamp: number): DebugMetrics {\n let stream: StreamMetric | undefined\n for (const candidate of streamMetrics.values()) {\n if (stream === undefined || candidate.updatedAt > stream.updatedAt) stream = candidate\n }\n let follow: FollowMetric | undefined\n for (const candidate of followMetrics.values()) {\n if (follow === undefined || candidate.updatedAt > follow.updatedAt) follow = candidate\n }\n return {\n fps: store.getSnapshot().metrics.fps,\n frameMs: store.getSnapshot().metrics.frameMs,\n fpsDegraded: store.getSnapshot().metrics.fpsDegraded,\n streamActive: stream?.active ?? false,\n streamBacklog: stream?.backlog ?? 0,\n streamSpeedCps: stream?.speedCps ?? 0,\n streamTargetChars: stream?.targetChars ?? 0,\n streamDisplayedChars: stream?.displayedChars ?? 0,\n followActive: follow?.active ?? false,\n followLagPx: follow?.lagPx ?? 0,\n followVelocityPxPerSec: follow?.velocityPxPerSec ?? 0,\n followReservePx: follow?.reservePx ?? 0,\n followCapacityPx: follow?.capacityPx ?? 0,\n followRevealScale: follow?.revealScale ?? 1,\n followFollowing: follow?.following ?? false,\n followConstrained: follow?.constrained ?? false,\n scrollTop: follow?.scrollTop ?? null,\n scrollHeight: follow?.scrollHeight ?? null,\n clientHeight: follow?.clientHeight ?? null,\n lastUpdatedMs: timestamp,\n }\n}\n\nfunction publishMetrics(force = false): void {\n const timestamp = now()\n if (!force && timestamp - lastMetricPublish < 80) return\n lastMetricPublish = timestamp\n store.set({ ...store.getSnapshot(), metrics: currentMetrics(timestamp) })\n}\n\nexport const debugRuntime = {\n store,\n\n getSnapshot(): DebugRuntimeState {\n return store.getSnapshot()\n },\n\n subscribe(listener: () => void): () => void {\n return store.subscribe(listener)\n },\n\n /** Whether hot-path instrumentation should do any work. */\n isEnabled(): boolean {\n return store.getSnapshot().enabled\n },\n\n tuning(): StreamDebugTuning {\n return store.getSnapshot().tuning\n },\n\n /** Production values remain untouched until the user explicitly enables diagnostics. */\n activeTuning(): StreamDebugTuning {\n return store.getSnapshot().enabled ? store.getSnapshot().tuning : DEFAULT_STREAM_DEBUG_TUNING\n },\n\n bindSettings(nextActions: DebugSettingsActions | undefined): () => void {\n actions = nextActions\n return () => {\n if (actions !== nextActions) return\n resetRuntime()\n }\n },\n\n syncSettings(input: {\n available?: boolean\n enabled: boolean\n writable: boolean\n dirty: boolean\n status: DebugRuntimeState['status']\n tuning?: StreamDebugTuning\n }): void {\n const current = store.getSnapshot()\n // Callers predating the Host capability flag are local diagnostics tests\n // and renderer probes; preserve their enabled behavior unless the wiring\n // explicitly reports that the RPC is unavailable.\n const available = input.available ?? true\n const enabled = available && input.enabled\n const availabilityChanged = current.available !== available\n const enabledChanged = current.enabled !== enabled\n if (availabilityChanged || enabledChanged) resetMetrics()\n const tuning = input.tuning === undefined\n ? current.tuning\n : { ...DEFAULT_STREAM_DEBUG_TUNING, ...input.tuning }\n if (\n current.available === available\n && current.enabled === enabled\n && current.writable === input.writable\n && current.dirty === input.dirty\n && current.status === input.status\n && sameTuning(current.tuning, tuning)\n ) return\n store.set({\n ...current,\n available,\n enabled,\n writable: input.writable,\n dirty: input.dirty,\n status: input.status,\n tuning,\n metrics: availabilityChanged || enabledChanged || !enabled ? EMPTY_METRICS : current.metrics,\n })\n },\n\n edit(patch: DebugSettingsPatch): void {\n const current = store.getSnapshot()\n const enabled = patch.debugEnabled ?? current.enabled\n const enabledChanged = current.enabled !== enabled\n if (enabledChanged) resetMetrics()\n const tuning = patch.debugTuning === undefined\n ? current.tuning\n : { ...current.tuning, ...patch.debugTuning }\n store.set({\n ...current,\n enabled,\n dirty: true,\n tuning,\n metrics: enabledChanged || !enabled ? EMPTY_METRICS : current.metrics,\n })\n actions?.edit({\n ...(patch.debugEnabled === undefined ? {} : { debugEnabled: patch.debugEnabled }),\n ...(patch.debugTuning === undefined ? {} : { debugTuning: tuning }),\n })\n },\n\n save(): void {\n actions?.save()\n },\n\n discard(): void {\n actions?.discard()\n },\n\n reset(): void {\n this.edit({ debugTuning: { ...DEFAULT_STREAM_DEBUG_TUNING } })\n },\n\n reportStream(id: string, metric: Omit<StreamMetric, 'updatedAt'> | null): void {\n if (!this.isEnabled()) return\n if (metric === null) streamMetrics.delete(id)\n else streamMetrics.set(id, { ...metric, updatedAt: now() })\n publishMetrics(metric === null)\n },\n\n reportFollow(port: HTMLElement, metric: Omit<FollowMetric, 'updatedAt'> | null): void {\n if (!this.isEnabled()) return\n if (metric === null) followMetrics.delete(port)\n else followMetrics.set(port, { ...metric, updatedAt: now() })\n publishMetrics(metric === null)\n },\n\n reportFps(fps: number, frameMs: number, degraded: boolean): void {\n if (!this.isEnabled()) return\n const current = store.getSnapshot()\n store.set({\n ...current,\n metrics: { ...current.metrics, fps, frameMs, fpsDegraded: degraded, lastUpdatedMs: now() },\n })\n },\n\n clearFps(): void {\n if (!this.isEnabled()) return\n const current = store.getSnapshot()\n store.set({\n ...current,\n metrics: {\n ...current.metrics,\n fps: null,\n frameMs: null,\n fpsDegraded: false,\n lastUpdatedMs: now(),\n },\n })\n },\n\n panelFace(): DebugPanelFace {\n return {\n hooks: { debugRuntime: store },\n edit: patch => { this.edit(patch) },\n save: () => { this.save() },\n discard: () => { this.discard() },\n reset: () => { this.reset() },\n }\n },\n\n resetRuntime(): void {\n resetRuntime()\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'\nimport { DEFAULT_STREAM_DEBUG_TUNING, type StreamDebugTuning } from '../settings.ts'\nimport { debugRuntime } from './debugRuntime.ts'\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 tuning: StreamDebugTuning = DEFAULT_STREAM_DEBUG_TUNING,\n): AdaptiveQueueStep {\n if (backlog <= 0 || dtMs <= 0) return { revealChars: 0, debt: 0, speedCps: 0 }\n const speedCps = Math.min(\n tuning.maxRevealCps,\n QUEUE_BASE_SPEED_CPS + Math.pow(backlog, QUEUE_ACCEL_EXPONENT) * tuning.queuePressure,\n )\n const effectiveScale = clamp(revealScale * tuning.revealScale, 0.05, 2)\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 const streamIdRef = useRef(`stream-${Math.random().toString(36).slice(2)}`)\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 debugRuntime.reportStream(streamIdRef.current, null)\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 debugTuning = debugRuntime.activeTuning()\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(Math.round(step.revealChars * debugTuning.revealScale), 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 debugTuning,\n )\n revealChars = step.revealChars\n revealSpeedCps = step.speedCps\n nextQueueDebt = step.debt\n }\n\n debugRuntime.reportStream(streamIdRef.current, {\n backlog,\n speedCps: revealSpeedCps,\n targetChars: targetCount,\n displayedChars: displayedCount,\n active: !producerComplete,\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 debugRuntime.reportStream(streamIdRef.current, null)\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'\nimport { debugRuntime } from './debugRuntime.ts'\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 let lastDebugReport = 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 if (now - lastDebugReport >= 100) {\n debugRuntime.reportFps(currentFps, fps.emaMs, fps.degraded)\n lastDebugReport = now\n }\n }\n rafId = requestAnimationFrame(frame)\n return () => {\n cancelAnimationFrame(rafId)\n fpsRef.current = { emaMs: 0, lastMs: 0, healthyRun: 0, degraded: false }\n debugRuntime.clearFps()\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 * Auto-collapse coordinator: folds the work process of finished turns behind\n * one summary row so only the model's final answer stays visible.\n *\n * The Harness ChatView lays a conversation out as a flat list of flow items\n * (`[data-chat-flow] > [data-chat-flow-kind=…]`). This controller watches that\n * list, splits it into turn segments at `user`/`steering` boundaries closed by\n * `turn-tail`, and — once a segment has settled — hides its thinking rows,\n * tool/command/context seats and intermediate replies, leaving one clickable\n * `已处理 {时长}` row plus the final answer. Clicking the row expands the full\n * process again; the choice survives later renders because it lives in the\n * controller, not the DOM.\n *\n * Adapted from the standalone `dsh-auto-collapse` plugin (level-1 folding\n * only): no second-level chips, no merged thinking rows, no status-text\n * rewrite, no transition animation — the collapse decision itself stays\n * instantaneous and reversible.\n *\n * React coexistence follows the upstream design: injected rows are plain\n * siblings/prepend children the vdom diff never claims, native rows are only\n * ever touched through an inline-`display` ledger that records the precise\n * original value and restores it on stop, session switch, or foreign takeover\n * (a written-value comparison plus an ownership sentinel catches another\n * script rewriting styles behind our back). A MutationObserver batches real\n * structure changes into rAF passes; a low-frequency self-rearming audit pass\n * reconciles unobservable style writes; a setTimeout fallback keeps passes\n * flowing when background tabs suspend rAF.\n */\n\nconst STYLE_ID = 'dshss-auto-collapse-style'\n/** Class of the injected per-turn summary row; also consumed by the follow\n * engine so the row rides the same lag transform as native message rows. */\nexport const PROCESSED_CLASS = 'dshss-processed'\n/** Inline custom property marking elements whose display this plugin owns. */\nconst DISPLAY_OWNED_PROP = '--dshss-display-owned'\n/** Unobservable external style writes are reconciled by this audit cadence. */\nconst AUDIT_TICK_MS = 1000\n/** Background-tab fallback that flushes a scheduled pass when rAF is frozen. */\nconst PASS_FALLBACK_MS = 60\n/**\n * Fold motion, deliberately minimal: layout changes land synchronously (the\n * display toggle happens in the same tick as the decision) and nothing\n * animates geometry at all — the earlier container-height squeeze was removed\n * because real sessions showed residual drift after the pin released (other\n * layout participants keep settling around the fold). What remains is one\n * paint-only flourish: the summary row fades its opacity in. A fold is\n * therefore a single reflow followed by a fade — the most stable shape\n * possible.\n */\nconst FOLD_ROW_FADE_MS = 160\nconst FOLD_EASE_OUT = 'cubic-bezier(0.22, 0.61, 0.36, 1)'\n\n/** User-visible copy; DSH web ships Chinese-first, other locales get English. */\ninterface FoldCopy {\n processedLabel: string\n expandTitle: string\n collapseTitle: string\n formatDuration: (ms: number) => string\n}\n\nconst ZH_COPY: FoldCopy = {\n processedLabel: '已处理',\n expandTitle: '展开工作过程',\n collapseTitle: '收起工作过程',\n formatDuration: formatZhDuration,\n}\n\nconst EN_COPY: FoldCopy = {\n processedLabel: 'Processed',\n expandTitle: 'Show the work process',\n collapseTitle: 'Hide the work process',\n formatDuration: formatEnDuration,\n}\n\nfunction resolveFoldCopy(): FoldCopy {\n let lang = ''\n try {\n lang = document.documentElement.lang || navigator.language || ''\n } catch {\n lang = ''\n }\n return lang.toLowerCase().startsWith('zh') ? ZH_COPY : EN_COPY\n}\n\nconst FOLD_CSS = `\n.${PROCESSED_CLASS} {\n box-sizing: border-box;\n display: inline-flex;\n align-self: flex-start;\n width: fit-content;\n max-width: 100%;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n border: none;\n background: none;\n font: 400 14px/24px system-ui, -apple-system, \"Segoe UI\", sans-serif;\n color: var(--dsw-alias-label-tertiary, rgba(127, 127, 127, 0.9));\n cursor: pointer;\n user-select: none;\n border-radius: 4px;\n transition: color 0.15s ease;\n}\n.${PROCESSED_CLASS}:hover {\n color: var(--dsw-alias-label-primary, inherit);\n background: transparent;\n}\n.${PROCESSED_CLASS}:focus-visible {\n outline: 2px solid var(--dsw-alias-state-focus-ring, rgba(77, 107, 254, 0.8));\n outline-offset: 2px;\n}\n.${PROCESSED_CLASS}-chevron {\n display: inline-flex;\n flex: none;\n width: 14px;\n height: 14px;\n opacity: 0.55;\n transform: rotate(-90deg);\n transition: transform 0.12s ease, opacity 0.1s ease;\n}\n.${PROCESSED_CLASS}:hover .${PROCESSED_CLASS}-chevron {\n opacity: 0.9;\n}\n.${PROCESSED_CLASS}[aria-expanded=\"true\"] .${PROCESSED_CLASS}-chevron {\n transform: rotate(0deg);\n}\n@media (prefers-reduced-motion: reduce) {\n .${PROCESSED_CLASS},\n .${PROCESSED_CLASS}-chevron {\n transition: none;\n }\n}\n`\n\n/** One settled-or-open stretch of the flow between boundaries. */\ninterface SegmentSnapshot {\n /** Stable across React re-renders; derived from the opening marker. */\n key: string\n /** Closing element: turn-tail, or the user/steering row that ended it. */\n boundary: HTMLElement | null\n /** Opening user/steering element; null for history before the first one. */\n startMarker: HTMLElement | null\n /** Whole flow items hidden while collapsed (work seats + middle replies). */\n hideSeats: ReadonlySet<HTMLElement>\n /** Reply-bearing steps that are not the segment's final answer. */\n middleSteps: ReadonlySet<HTMLElement>\n /** Last reply-bearing step; always visible, its thinking rows may hide. */\n finalStep: HTMLElement | null\n /** Thinking rows inside {@link finalStep}, hidden while collapsed. */\n finalThinkRows: readonly HTMLElement[]\n /** Summary row anchor: first hidden seat, else the final answer. */\n firstWork: HTMLElement | null\n closed: boolean\n running: boolean\n hasWork: boolean\n}\n\ninterface SegmentState {\n key: string\n row: HTMLButtonElement | null\n /** User gesture state; a newly settled segment starts collapsed. */\n expanded: boolean\n snapshot: SegmentSnapshot\n /** Frozen display duration in ms; official host value wins once known. */\n duration?: number\n}\n\n\nexport class AutoCollapseController {\n private observer: MutationObserver | null = null\n private raf = 0\n private timer: ReturnType<typeof setTimeout> | 0 = 0\n private auditTimer: ReturnType<typeof setTimeout> | 0 = 0\n /** True between start() and stop(); the preference toggle re-enters both. */\n private running = false\n private lastPassError = ''\n\n private flow: HTMLElement | null = null\n /** Stable segment key → summary row + gesture state. */\n private segmentStates = new Map<string, SegmentState>()\n /** First sighting of a running segment, for turns without a host duration. */\n private runningSince = new Map<string, number>()\n /** Segments that settled once: a resumed run restarts local timing. */\n private completedOnce = new Set<string>()\n /** Precise pre-plugin display values, restored on stop/switch/takeover. */\n private originalDisplay = new WeakMap<HTMLElement, string>()\n private writtenDisplay = new WeakMap<HTMLElement, string>()\n private controlledDisplay = new Set<HTMLElement>()\n /** Reply-presence verdicts cached per message until a mutation hits it. */\n private bodyTextCache = new WeakMap<HTMLElement, boolean>()\n private dirtyMessages = new Set<HTMLElement>()\n\n private readonly onVisibilityChange = (): void => {\n if (typeof document === 'undefined' || document.hidden !== true) this.schedule()\n }\n\n /** Re-run a pass immediately (settings changes, diagnostics, tests).\n * Reply-presence verdicts are dropped wholesale: manual refreshes are rare,\n * and a conservative rebuild beats a stale classification. */\n refresh(): void {\n this.bodyTextCache = new WeakMap()\n this.dirtyMessages.clear()\n this.schedule()\n }\n\n start(): void {\n if (this.running) return\n this.running = true\n injectStyle()\n try {\n this.observer = new MutationObserver(records => {\n if (this.shouldSchedule(records)) {\n this.markDirty(records)\n this.schedule()\n }\n })\n this.observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n // Tool/think completion flips data-state without touching structure;\n // characterData drives late reply text into the classifier.\n attributeFilter: ['data-state'],\n characterData: true,\n })\n this.armAuditLoop()\n this.schedule()\n } catch (error) {\n this.reportError(error)\n throw error\n }\n }\n\n stop(): void {\n this.running = false\n if (this.raf !== 0) cancelAnimationFrame(this.raf)\n this.raf = 0\n if (this.timer !== 0) clearTimeout(this.timer)\n this.timer = 0\n if (this.auditTimer !== 0) clearTimeout(this.auditTimer)\n this.auditTimer = 0\n if (typeof document !== 'undefined' && typeof document.removeEventListener === 'function') {\n document.removeEventListener('visibilitychange', this.onVisibilityChange)\n }\n this.observer?.disconnect()\n this.observer = null\n this.switchFlow(null)\n removeStyle()\n }\n\n /** Low-frequency reconciliation for style writes no observer can see. */\n private armAuditLoop(): void {\n if (typeof document !== 'undefined' && typeof document.addEventListener === 'function') {\n document.addEventListener('visibilitychange', this.onVisibilityChange)\n }\n this.rearmAudit()\n }\n\n private rearmAudit(): void {\n if (!this.running || this.auditTimer !== 0) return\n this.auditTimer = setTimeout(() => {\n this.auditTimer = 0\n if (!this.running) return\n if (typeof document !== 'undefined' && document.hidden === true) {\n this.rearmAudit()\n return\n }\n this.schedule()\n this.rearmAudit()\n }, AUDIT_TICK_MS)\n }\n\n /** Body-level observations only need to wake us up near the active flow. */\n private shouldSchedule(records: MutationRecord[]): boolean {\n if (records.length === 0 || this.flow === null || !this.flow.isConnected) return true\n return records.some(record => (\n nodeWithin(record.target, this.flow as HTMLElement)\n || nodeWithin(this.flow as HTMLElement, record.target)\n ))\n }\n\n /** Walk each record to its flow child so reply-cache invalidation stays\n * targeted; anything unattributable invalidates conservatively. */\n private markDirty(records: MutationRecord[]): void {\n const flow = this.flow\n if (flow === null || !flow.isConnected) return\n if (records.length === 0) {\n this.bodyTextCache = new WeakMap()\n this.dirtyMessages.clear()\n return\n }\n for (const record of records) {\n let current: Node | null = record.target\n while (current !== null && current.parentNode !== flow) current = current.parentNode\n if (!(current instanceof HTMLElement)) {\n this.bodyTextCache = new WeakMap()\n this.dirtyMessages.clear()\n return\n }\n this.dirtyMessages.add(current)\n }\n }\n\n private schedule(): void {\n if (!this.running || this.raf !== 0) return\n this.raf = requestAnimationFrame(() => {\n this.raf = 0\n if (this.timer !== 0) {\n clearTimeout(this.timer)\n this.timer = 0\n }\n this.runPass()\n })\n // Background tabs freeze rAF; the timeout guarantees the pass still runs.\n if (this.timer !== 0) clearTimeout(this.timer)\n this.timer = setTimeout(() => {\n this.timer = 0\n if (this.raf !== 0) {\n cancelAnimationFrame(this.raf)\n this.raf = 0\n this.runPass()\n }\n }, PASS_FALLBACK_MS)\n }\n\n private runPass(): void {\n try {\n this.pass()\n this.lastPassError = ''\n } catch (error) {\n this.reportError(error)\n }\n }\n\n private reportError(error: unknown): void {\n const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error)\n // An async observer crash must not kill coordination silently; keep one\n // non-spammy diagnostic and let later mutations retry.\n if (message === this.lastPassError) return\n this.lastPassError = message\n console.error('[dsh-smooth-stream] auto-collapse pass failed', error)\n }\n\n private pass(): void {\n if (!this.running) return\n\n const nextFlow = findFlow()\n if (nextFlow !== this.flow) this.switchFlow(nextFlow)\n const flow = this.flow\n if (flow === null) return\n\n for (const el of this.dirtyMessages) this.bodyTextCache.delete(el)\n this.dirtyMessages.clear()\n const segments = buildSegments(flow, el => this.hasBodyCached(el))\n const liveSegmentKeys = new Set(segments.map(segment => segment.key))\n\n for (const segment of segments) {\n if (!segment.running) continue\n // Re-settled after completing once: restart local timing so the frozen\n // duration cannot swallow the idle gap in between.\n if (this.completedOnce.has(segment.key)) {\n this.completedOnce.delete(segment.key)\n this.runningSince.delete(segment.key)\n }\n if (!this.runningSince.has(segment.key)) this.runningSince.set(segment.key, Date.now())\n }\n\n const completedKeys = new Set<string>()\n for (const segment of segments) {\n if (!segment.closed || segment.running || !segment.hasWork) continue\n completedKeys.add(segment.key)\n this.completedOnce.add(segment.key)\n let state = this.segmentStates.get(segment.key)\n if (state === undefined) {\n state = { key: segment.key, row: null, expanded: false, snapshot: segment }\n this.segmentStates.set(segment.key, state)\n } else {\n state.snapshot = segment\n }\n const started = this.runningSince.get(segment.key)\n const parsed = segment.boundary === null ? undefined : parseTurnDuration(segment.boundary)\n // The host's own duration always wins so live completions and reloaded\n // history agree. Without one (typically a stopped turn) fall back to the\n // locally observed running window, frozen at first settlement so the\n // label stops ticking; a late official value may still override it.\n if (parsed !== undefined) state.duration = parsed\n else if (state.duration === undefined && started !== undefined) state.duration = Date.now() - started\n if (state.row === null || !state.row.isConnected) state.row = this.createProcessedRow(state)\n this.syncProcessedRow(state)\n }\n\n // Every layout-affecting decision below lands synchronously: one pass,\n // one reflow, no deferred or animated geometry.\n for (const [key, state] of [...this.segmentStates]) {\n if (completedKeys.has(key)) continue\n state.row?.remove()\n this.segmentStates.delete(key)\n }\n\n const desiredHidden = new Set<HTMLElement>()\n for (const segment of segments) {\n const state = this.segmentStates.get(segment.key)\n const collapse = state !== undefined && !state.expanded\n if (collapse) {\n for (const seat of segment.hideSeats) this.hideElement(seat, desiredHidden)\n for (const row of segment.finalThinkRows) this.hideElement(row, desiredHidden)\n // The final answer itself always shows; its thinking rows were hidden\n // above, everything else about it is restored defensively.\n if (segment.finalStep !== null) this.restoreElement(segment.finalStep)\n } else {\n for (const seat of segment.hideSeats) this.restoreElement(seat)\n for (const row of segment.finalThinkRows) this.restoreElement(row)\n if (segment.finalStep !== null) this.restoreElement(segment.finalStep)\n }\n }\n\n // Segments whose work is already invisible (hidden by the host or another\n // extension) withdraw their summary row instead of pointing at nothing,\n // but keep owning whatever they still hold so the sweep below leaves it.\n for (const segment of segments) {\n if (!hasVisibleSegmentWork(segment)) {\n const state = this.segmentStates.get(segment.key)\n if (state !== undefined && state.row !== null) {\n state.row.remove()\n state.row = null\n }\n }\n for (const seat of segment.hideSeats) this.retainDisplayControl(seat, desiredHidden)\n for (const row of segment.finalThinkRows) this.retainDisplayControl(row, desiredHidden)\n if (segment.finalStep !== null) this.retainDisplayControl(segment.finalStep, desiredHidden)\n }\n\n this.restoreUnusedDisplays(desiredHidden)\n for (const state of this.segmentStates.values()) this.placeProcessedRow(flow, state)\n\n for (const key of [...this.runningSince.keys()]) {\n if (!liveSegmentKeys.has(key)) this.runningSince.delete(key)\n }\n for (const key of [...this.completedOnce]) {\n if (!liveSegmentKeys.has(key)) this.completedOnce.delete(key)\n }\n }\n\n /** Flow swap means a session switch: fully restore the old tree, rebuild. */\n private switchFlow(next: HTMLElement | null): void {\n if (next === this.flow) return\n for (const state of this.segmentStates.values()) state.row?.remove()\n this.segmentStates.clear()\n this.runningSince.clear()\n this.completedOnce.clear()\n this.bodyTextCache = new WeakMap()\n this.dirtyMessages.clear()\n this.restoreAllDisplays()\n this.flow = next\n }\n\n /** Keep already-controlled elements in the desired-hidden set so the sweep\n * does not flip them back mid-flight of an external change. */\n private retainDisplayControl(el: HTMLElement, desiredHidden: Set<HTMLElement>): void {\n if (this.controlledDisplay.has(el)) desiredHidden.add(el)\n }\n\n /** Restore every element the ledger controls that this pass no longer wants\n * hidden; elements absent from `desired` come back to their true display. */\n private restoreUnusedDisplays(desired: ReadonlySet<HTMLElement>): void {\n for (const el of [...this.controlledDisplay]) {\n if (!desired.has(el)) this.restoreElement(el)\n }\n }\n\n /** Restore every element still under the display ledger, then retire the\n * ledger itself (stop / session switch). */\n private restoreAllDisplays(): void {\n for (const el of [...this.controlledDisplay]) this.restoreElement(el)\n this.controlledDisplay.clear()\n this.originalDisplay = new WeakMap<HTMLElement, string>()\n this.writtenDisplay = new WeakMap<HTMLElement, string>()\n }\n\n private createProcessedRow(state: SegmentState): HTMLButtonElement {\n const row = createProcessedRowElement(state.duration)\n row.addEventListener('click', () => {\n state.expanded = !state.expanded\n this.syncProcessedRow(state)\n this.schedule()\n })\n return row\n }\n\n private syncProcessedRow(state: SegmentState): void {\n const row = state.row\n if (row === null) return\n const copy = resolveFoldCopy()\n const text = row.firstElementChild\n const label = state.duration === undefined\n ? copy.processedLabel\n : `${copy.processedLabel} ${copy.formatDuration(state.duration)}`\n if (text !== null && text.textContent !== label) text.textContent = label\n const expanded = String(state.expanded)\n if (row.getAttribute('aria-expanded') !== expanded) row.setAttribute('aria-expanded', expanded)\n const title = state.expanded ? copy.collapseTitle : copy.expandTitle\n if (row.title !== title) row.title = title\n }\n\n private placeProcessedRow(flow: HTMLElement, state: SegmentState): void {\n const row = state.row\n if (row === null) return\n if (!state.snapshot.hasWork || !hasVisibleSegmentWork(state.snapshot)) {\n row.remove()\n state.row = null\n return\n }\n let target = state.snapshot.firstWork ?? state.snapshot.finalStep ?? state.snapshot.boundary\n // Snapshot targets are always flow children; if that invariant somehow\n // breaks, drop the row and let the next pass rebuild it rather than\n // stacking disconnected rows with duplicate click handlers.\n if (target === null || target.parentElement !== flow) {\n row.remove()\n state.row = null\n return\n }\n if (row.parentElement !== flow || row.nextElementSibling !== target) {\n target.before(row)\n this.revealVisualOnce(row)\n }\n }\n\n private hasBodyCached(el: HTMLElement): boolean {\n const cached = this.bodyTextCache.get(el)\n if (cached !== undefined) return cached\n const value = hasBodyContent(el)\n this.bodyTextCache.set(el, value)\n return value\n }\n\n /** True when the recorded display was changed (or the ownership sentinel\n * wiped) behind the ledger's back; callers hand control back to reality. */\n private displayForeign(el: HTMLElement): boolean {\n const written = this.writtenDisplay.get(el)\n if (written === undefined) return false\n return el.style.getPropertyValue(DISPLAY_OWNED_PROP) === '' || el.style.display !== written\n }\n\n private releaseDisplayLedger(el: HTMLElement): void {\n this.originalDisplay.delete(el)\n this.writtenDisplay.delete(el)\n this.controlledDisplay.delete(el)\n el.style.removeProperty(DISPLAY_OWNED_PROP)\n }\n\n private hideElement(el: HTMLElement, desired: Set<HTMLElement>): void {\n desired.add(el)\n if (!this.originalDisplay.has(el) && !isDisplayed(el)) return\n // First takeover records the exact original; a foreign full rewrite (sentinel\n // gone) or value swap re-records from current truth so restoration hands\n // back what the outsider wrote over, never a stale snapshot.\n if (!this.originalDisplay.has(el) || this.displayForeign(el)) {\n this.originalDisplay.set(el, el.style.display)\n this.writtenDisplay.set(el, el.style.display)\n el.style.setProperty(DISPLAY_OWNED_PROP, '1')\n }\n this.controlledDisplay.add(el)\n if (el.style.display === 'none') return\n // Synchronous by contract: deferring the layout change to an animation end\n // leaves the true geometry unmeasured and reintroduces the post-collapse\n // snap. Folds are one reflow plus a paint-only row fade.\n el.style.display = 'none'\n this.writtenDisplay.set(el, 'none')\n }\n\n private restoreElement(el: HTMLElement): void {\n if (!this.originalDisplay.has(el)) return\n // Respect an outside takeover: never resurrect something another script\n // (or the user) deliberately hid after we did.\n if (this.displayForeign(el)) {\n this.releaseDisplayLedger(el)\n return\n }\n const original = this.originalDisplay.get(el) as string\n if (el.style.display !== original) el.style.display = original\n this.releaseDisplayLedger(el)\n }\n\n /** Whether WAAPI exists and the user has not asked for reduced motion. */\n private canAnimate(el: HTMLElement): boolean {\n if (typeof el.animate !== 'function') return false\n try {\n if (typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches) return false\n } catch {\n return false\n }\n return true\n }\n\n /** First-appearance flourish for the plugin-owned summary row: a pure\n * opacity fade. Paint-only, so it cannot shift anyone's layout. */\n private revealVisualOnce(row: HTMLButtonElement): void {\n if (row.dataset.dshssShown === '1') return\n row.dataset.dshssShown = '1'\n if (!this.canAnimate(row)) return\n row.animate(\n [{ opacity: '0' }, { opacity: '1' }],\n { duration: FOLD_ROW_FADE_MS, easing: FOLD_EASE_OUT },\n )\n }\n}\n\n/** Visible chat flow container, falling back to the first one rendered. */\nfunction findFlow(): HTMLElement | null {\n const flows = document.querySelectorAll<HTMLElement>('[data-chat-flow]')\n for (const flow of flows) {\n if (flow.offsetParent !== null || flow.getBoundingClientRect().width > 0) return flow\n }\n return flows[0] ?? null\n}\n\n/** parentNode walk that also accepts Text mutation targets. */\nfunction nodeWithin(node: Node, ancestor: Node): boolean {\n for (let current: Node | null = node; current !== null; current = current.parentNode) {\n if (current === ancestor) return true\n }\n return false\n}\n\n/** Top-level message order, excluding this plugin's own summary rows. */\nfunction flowItems(flow: HTMLElement): HTMLElement[] {\n return [...flow.children].filter((el): el is HTMLElement => (\n el instanceof HTMLElement && !el.classList.contains(PROCESSED_CLASS)\n ))\n}\n\nfunction isDisplayed(el: HTMLElement): boolean {\n if (typeof getComputedStyle === 'function') return getComputedStyle(el).display !== 'none'\n return el.style.display !== 'none'\n}\n\nfunction stableElementKey(el: HTMLElement, fallbackIndex: number): string {\n const kind = el.getAttribute('data-chat-flow-kind') ?? 'node'\n const key = el.getAttribute('data-chat-flow-key')\n ?? el.getAttribute('data-chat-anchor-key')\n ?? `${kind}:${fallbackIndex}`\n return `${kind}:${key}`\n}\n\n/** Kinds that can open a history stretch lacking an explicit user marker. */\nfunction opensTurnWork(el: HTMLElement): boolean {\n const kind = el.getAttribute('data-chat-flow-kind')\n return kind === 'assistant-step'\n || kind === 'assistant'\n || kind === 'tool-call'\n || kind === 'command'\n || kind === 'manual-compaction'\n}\n\n/**\n * Split the flow into turn segments. `user`/`steering` rows close the previous\n * segment and open the next; `turn-tail` closes and resets the opener. Leading\n * context before the first user row joins that user's segment, matching how\n * the host presents context injection.\n */\nfunction buildSegments(flow: HTMLElement, hasBody: (el: HTMLElement) => boolean): SegmentSnapshot[] {\n const items = flowItems(flow)\n const itemIndex = new Map(items.map((el, index) => [el, index]))\n const snapshots: SegmentSnapshot[] = []\n let contentStart = 0\n let startMarker: HTMLElement | null = null\n\n const append = (end: number, boundary: HTMLElement | null, closed: boolean): void => {\n if (end < contentStart) return\n const range = items.slice(contentStart, end)\n const hideSeats = new Set<HTMLElement>()\n const bodySteps: HTMLElement[] = []\n let running = false\n for (const el of range) {\n const classified = classifyItem(el, hasBody)\n if (classified.fold === 'body') bodySteps.push(el)\n else if (classified.fold === 'seat') hideSeats.add(el)\n if (classified.running) running = true\n }\n const finalStep = bodySteps.at(-1) ?? null\n const middleSteps = new Set(bodySteps.slice(0, -1))\n for (const step of middleSteps) hideSeats.add(step)\n const finalThinkRows = finalStep === null ? [] : thinkRowsIn(finalStep)\n const firstWork: HTMLElement | null = range.find(el => hideSeats.has(el)) ?? finalStep\n const identity = startMarker\n ?? range.find(el => opensTurnWork(el))\n ?? boundary\n const identityIndex = identity === null ? contentStart : (itemIndex.get(identity) ?? contentStart)\n const prefix = startMarker === null ? 'leading' : 'segment'\n const key = `${prefix}:${identity === null ? `open:${contentStart}` : stableElementKey(identity, identityIndex)}`\n snapshots.push({\n key,\n boundary,\n startMarker,\n hideSeats,\n middleSteps,\n finalStep,\n finalThinkRows,\n firstWork,\n closed,\n running,\n hasWork: hideSeats.size > 0 || finalThinkRows.length > 0,\n })\n }\n\n items.forEach((el, index) => {\n const kind = el.getAttribute('data-chat-flow-kind')\n if (kind === 'user' || kind === 'steering') {\n if (startMarker !== null) {\n append(index, el, true)\n contentStart = index + 1\n } else {\n const leading = items.slice(contentStart, index)\n if (leading.some(el => opensTurnWork(el))) {\n append(index, el, true)\n contentStart = index + 1\n }\n // Only leading context so far: keep accumulating into the next user's\n // segment, mirroring the host's presentation of context injection.\n }\n startMarker = el\n return\n }\n if (kind === 'turn-tail') {\n append(index, el, true)\n contentStart = index + 1\n startMarker = null\n }\n })\n if (contentStart < items.length) append(items.length, null, false)\n return snapshots\n}\n\ninterface ItemClass {\n fold: 'body' | 'seat' | 'skip'\n running: boolean\n}\n\n/**\n * Classify one top-level flow item against the Harness's own node vocabulary.\n * Reply-bearing assistant messages become `body` candidates (last one per\n * segment wins as the final answer); core work process — tool-call seats,\n * command/compaction cards, context injection, thinking-only messages —\n * becomes a hideable `seat`. Everything else is skipped untouched: boundaries,\n * empty decorations, and crucially any kind this module does not own, so rows\n * contributed by other plugins' slots are never folded or hidden.\n */\nfunction classifyItem(el: HTMLElement, hasBody: (el: HTMLElement) => boolean): ItemClass {\n const kind = el.getAttribute('data-chat-flow-kind')\n if (kind === 'user' || kind === 'steering' || kind === 'turn-tail') return { fold: 'skip', running: false }\n if (kind === 'assistant-step' || kind === 'assistant') {\n if (hasBody(el)) return { fold: 'body', running: subtreeRunning(el) }\n // Thinking-only message: folded whole, like any other work seat.\n if (thinkRowsIn(el).length > 0) return { fold: 'seat', running: subtreeRunning(el) }\n return { fold: 'skip', running: false }\n }\n if (kind === 'tool-call') {\n // Native tool cards come in two families — ToolRow compositions\n // (read/write/search/todo/… plus the GenericToolCard fallback, stamped\n // data-tool + data-variant + data-state) and hand-rolled chrome that\n // still follows the convention (Bash: data-variant=\"bash\" +\n // data-state). Fully custom toolviews — an embedded piano, a game board\n // — carry neither attribute; they belong to other plugins' surfaces and\n // are never folded.\n const rows = topCallRowsIn(el)\n if (rows.length === 0 || !rows.every(row => hasNativeCardChrome(row))) {\n return { fold: 'skip', running: subtreeRunning(el) }\n }\n return { fold: 'seat', running: subtreeRunning(el) }\n }\n if (kind === 'context' || kind === 'command' || kind === 'manual-compaction') {\n return { fold: 'seat', running: subtreeRunning(el) }\n }\n return { fold: 'skip', running: false }\n}\n\n/** Native work-card shape: every core card family stamps `data-variant`\n * together with `data-state`, whether composed through ToolRow or hand-rolled\n * (Bash). Custom toolviews use their own namespaced attributes instead. */\nfunction hasNativeCardChrome(row: HTMLElement): boolean {\n return row.querySelector('[data-variant][data-state]') !== null\n}\n\n/** Whether anything inside the item reports a running lifecycle. Deliberately\n * broad: staying \"running\" too long only delays a collapse, collapsing early\n * would cut off live output. Native cards stamp `data-state` next to\n * `data-tool`/`data-variant`; custom views use their own vocabulary and are\n * intentionally invisible here. */\nfunction subtreeRunning(el: HTMLElement): boolean {\n if (el.getAttribute('data-state') === 'running') return true\n for (const root of el.querySelectorAll<HTMLElement>('[data-tool][data-state], [data-variant][data-state]')) {\n if (root.getAttribute('data-state') === 'running') return true\n }\n return false\n}\n\nfunction hasVisibleSegmentWork(segment: SegmentSnapshot): boolean {\n const candidates = [\n ...segment.hideSeats,\n ...segment.middleSteps,\n ]\n if (segment.startMarker !== null) candidates.push(segment.startMarker)\n if (segment.finalStep !== null) candidates.push(segment.finalStep)\n return candidates.some(isDisplayed)\n}\n\n/** Top-level tool card rows of a seat (excluding sub-dispatch nests). */\nfunction topCallRowsIn(el: HTMLElement): HTMLElement[] {\n const rows: HTMLElement[] = []\n for (const row of el.querySelectorAll<HTMLElement>('[data-chat-call-id]')) {\n if (row.closest('[data-subcalls]') !== null) continue\n if (row.closest('[data-chat-call-id]') !== row) continue\n rows.push(row)\n }\n return rows\n}\n\n/** Reasoning rows of a message: native think variants outside tool cards. */\nfunction thinkRowsIn(el: HTMLElement): HTMLElement[] {\n const rows: HTMLElement[] = []\n for (const row of el.querySelectorAll<HTMLElement>('[data-variant=\"think\"]:not([data-tool])')) {\n if (row.closest('[data-chat-call-id]') !== null) continue\n if (row.closest('[data-subcalls]') !== null) continue\n rows.push(row)\n }\n return rows\n}\n\n/**\n * Reply detection beyond reasoning rows and tool cards: any non-empty text or\n * media counts, because Markdown paragraphs necessarily carry text nodes.\n * Rendered markdown class names are build-time hashes, so structure-based\n * detection is the only stable contract.\n */\nfunction hasBodyContent(el: HTMLElement): boolean {\n // Command and compaction cards are work visualization, never replies.\n const kind = el.getAttribute('data-chat-flow-kind')\n if (kind === 'command' || kind === 'manual-compaction') return false\n if (hasBodyText(el)) return true\n const excluded = '[data-variant=\"think\"], [data-chat-call-id]'\n for (const media of el.querySelectorAll<HTMLElement>('img, video, audio, canvas')) {\n if (media.closest(excluded) === null) return true\n }\n return false\n}\n\nfunction hasBodyText(el: HTMLElement): boolean {\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT)\n let node: Text | null\n while ((node = walker.nextNode() as Text | null) !== null) {\n if (node.data.trim() === '') continue\n const parent = node.parentElement\n if (parent !== null && parent.closest('[data-variant=\"think\"], [data-chat-call-id], [data-variant=\"others\"][data-state]') !== null) continue\n return true\n }\n return false\n}\n\n/**\n * Official turn duration from the closing element: localized tails read\n * `用时 33秒` / `用时 2分05秒` or `Ran for 33s` / `Ran for 2m 05s`; newer\n * tails only carry an end timestamp, which is diffed against the opening user\n * row's timestamp.\n */\nfunction parseTurnDuration(boundary: HTMLElement): number | undefined {\n const text = boundary.textContent ?? ''\n const zh = text.match(/用时\\s*(\\d+)分(\\d+)秒|用时\\s*(\\d+)秒/)\n if (zh !== null) {\n if (zh[1] !== undefined && zh[2] !== undefined) return Number(zh[1]) * 60000 + Number(zh[2]) * 1000\n if (zh[3] !== undefined) return Number(zh[3]) * 1000\n return undefined\n }\n const en = text.match(/Ran for\\s*(?:(\\d+)m\\s*)?(\\d+)s/)\n if (en !== null) {\n const minutes = en[1] === undefined ? 0 : Number(en[1])\n return (minutes * 60 + Number(en[2])) * 1000\n }\n const end = parseTimeText(text)\n const start = findTurnStart(boundary)\n if (end !== undefined && start !== undefined && end > start) return end - start\n return undefined\n}\n\n/** DSH timestamp text (`8月14日 21:56` / `2026年8月14日 22:11`) → epoch ms. */\nfunction parseTimeText(text: string): number | undefined {\n const m = text.match(/(?:(\\d{4})年)?(\\d{1,2})月(\\d{1,2})日\\s*(\\d{1,2}):(\\d{2})/)\n if (m === null) return undefined\n const year = m[1] !== undefined ? Number(m[1]) : new Date().getFullYear()\n const t = new Date(year, Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5])).getTime()\n return Number.isNaN(t) ? undefined : t\n}\n\n/** Latest turn-opening timestamp at or before the boundary element. */\nfunction findTurnStart(boundary: HTMLElement): number | undefined {\n const flow = boundary.parentElement\n if (flow === null) return undefined\n let best: HTMLElement | null = null\n for (const s of flow.querySelectorAll<HTMLElement>('[class*=\"timeStart\"]')) {\n // Timestamps live deep inside user rows; order them against the boundary\n // instead of trusting querySelector document order alone.\n const pos = s.compareDocumentPosition(boundary)\n if ((pos & Node.DOCUMENT_POSITION_FOLLOWING) !== 0 || (pos & Node.DOCUMENT_POSITION_CONTAINED_BY) !== 0 || s === boundary) best = s\n else break\n }\n if (best === null) return undefined\n return parseTimeText(best.textContent ?? '')\n}\n\n/** Compact duration pieces shared by both locales: seconds under a minute,\n * whole minutes drop the seconds, hours drop to minute granularity. */\nfunction durationParts(ms: number): { h: number; m: number; s: number } {\n const s = Math.round(ms / 1000)\n return { h: Math.floor(s / 3600), m: Math.floor((s % 3600) / 60), s: s % 60 }\n}\n\n/** 毫秒 → 中文紧凑时长(14秒 / 2分05秒 / 15分 / 3小时2分)。 */\nexport function formatZhDuration(ms: number): string {\n const { h, m, s } = durationParts(ms)\n if (h > 0) return m > 0 ? `${h}小时${m}分` : `${h}小时`\n if (s < 60 && m === 0 && h === 0) return `${s}秒`\n if (s === 0) return `${m}分`\n return `${m}分${String(s).padStart(2, '0')}秒`\n}\n\n/** Milliseconds → compact English duration (14s / 2m05s / 15m / 3h2m). */\nexport function formatEnDuration(ms: number): string {\n const { h, m, s } = durationParts(ms)\n if (h > 0) return m > 0 ? `${h}h${m}m` : `${h}h`\n if (m === 0 && h === 0) return `${s}s`\n if (s === 0) return `${m}m`\n return `${m}m${String(s).padStart(2, '0')}s`\n}\n\n/** Native disclosure chevron (IconChevronDownOutline14, 14x14). */\nconst CHEVRON_PATH = 'M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z'\n\nfunction createChevronIcon(className: string): SVGSVGElement {\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\n svg.setAttribute('width', '14')\n svg.setAttribute('height', '14')\n svg.setAttribute('class', className)\n svg.setAttribute('viewBox', '0 0 14 14')\n svg.setAttribute('fill', 'none')\n svg.setAttribute('aria-hidden', 'true')\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', CHEVRON_PATH)\n path.setAttribute('fill', 'currentColor')\n svg.appendChild(path)\n return svg\n}\n\nfunction createProcessedRowElement(duration?: number): HTMLButtonElement {\n const copy = resolveFoldCopy()\n const btn = document.createElement('button')\n btn.type = 'button'\n btn.className = PROCESSED_CLASS\n btn.setAttribute('aria-expanded', 'false')\n const text = document.createElement('span')\n text.textContent = duration === undefined\n ? copy.processedLabel\n : `${copy.processedLabel} ${copy.formatDuration(duration)}`\n btn.append(text, createChevronIcon(`${PROCESSED_CLASS}-chevron`))\n btn.title = copy.expandTitle\n return btn\n}\n\nfunction injectStyle(): void {\n if (document.getElementById(STYLE_ID) !== null) return\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = FOLD_CSS\n document.head.appendChild(style)\n}\n\nfunction removeStyle(): void {\n document.getElementById(STYLE_ID)?.remove()\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'\nimport { DEFAULT_STREAM_DEBUG_TUNING, type StreamDebugTuning } from '../settings.ts'\nimport { debugRuntime } from './debugRuntime.ts'\nimport { PROCESSED_CLASS } from './auto-collapse-controller.ts'\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(\n speedCps: number,\n runwayPx = FOLLOW_STATUS_RUNWAY_PX,\n): 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 tuning: StreamDebugTuning = DEFAULT_STREAM_DEBUG_TUNING,\n): number {\n if (constrained) return tuning.backpressureMinScale\n if (!Number.isFinite(capacityPx)) return 1\n if (capacityPx <= 0) return lagPx > 0 ? tuning.backpressureMinScale : 1\n const ratio = Math.min(1, Math.max(0, lagPx / capacityPx))\n if (ratio >= FOLLOW_BACKPRESSURE_FULL_RATIO) return tuning.backpressureMinScale\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 - tuning.backpressureMinScale) * 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(\n dtMs: number,\n input: FollowGlideInput,\n tuning: StreamDebugTuning = DEFAULT_STREAM_DEBUG_TUNING,\n): 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 tuning.springStiffness * lag - tuning.springDamping * velocity\n ) / tuning.springMass\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. */\n/** @internal Test seam: the equal-lag transform set for one scrollport. */\nexport function shiftSurfacesOf(port: HTMLElement): HTMLElement[] {\n const transcript = port.querySelector<HTMLElement>('[data-chat-transcript]')\n if (transcript !== null) return [transcript]\n // Fold summary rows are plugin-injected flow children without an anchor\n // key; they must ride the same lag transform as native rows, otherwise\n // they visibly detach from their neighbours on every follow frame.\n return [...port.querySelectorAll<HTMLElement>(`[data-chat-anchor-key], .${PROCESSED_CLASS}`)]\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 readonly requestedPx: number\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(\n port: HTMLElement,\n surfaces: readonly HTMLElement[],\n runwayPx = FOLLOW_STATUS_RUNWAY_PX,\n): 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 (runwayPx <= 0 || 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\n && current.property === target.property\n && current.requestedPx === runwayPx) return\n restoreRunway(port)\n const beforeHeight = port.scrollHeight\n const original = element.style[target.property]\n element.style[target.property] = original === ''\n ? `${runwayPx}px`\n : `calc(${original} + ${runwayPx}px)`\n const offset = Math.max(0, port.scrollHeight - beforeHeight)\n followRunways.set(port, { element, offset, property: target.property, original, requestedPx: runwayPx })\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 runwayPx = FOLLOW_STATUS_RUNWAY_PX,\n): number {\n const surfaces = shiftSurfacesOf(port)\n ensureRunway(port, surfaces, runwayPx)\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 tuning = debugRuntime.activeTuning()\n const state = followMotionStates.get(next)\n const target = state === undefined\n ? 1\n : computeFollowRevealScale(state.lagPx, state.capacityPx, state.constrained, tuning)\n const current = Math.min(1, Math.max(tuning.backpressureMinScale, 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 reportFollow = (next: HTMLElement, isActive: boolean): void => {\n const state = followMotionStates.get(next)\n debugRuntime.reportFollow(next, {\n lagPx: state?.lagPx ?? Math.max(0, next.scrollHeight - next.clientHeight - next.scrollTop),\n velocityPxPerSec: state?.velocityPxPerSec ?? 0,\n reservePx: state?.reservePx ?? 0,\n capacityPx: state?.capacityPx ?? 0,\n revealScale: revealScaleRef?.current ?? 1,\n following,\n constrained: state?.constrained ?? false,\n scrollTop: next.scrollTop,\n scrollHeight: next.scrollHeight,\n clientHeight: next.clientHeight,\n active: isActive,\n })\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 debugRuntime.reportFollow(next, null)\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 // The predictive runway only has meaning while this follower owns the\n // floor. Remove it before choosing the reader's landing point; keeping\n // it through the release paints a transient natural gap + 48px blank\n // block until the next follow frame restores an equal transform.\n clearMotion(next)\n restoreRunway(next)\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 const tuning = debugRuntime.activeTuning()\n animatedH = applyVisual(port, animatedH, reservePx, velocityPxPerSec, tuning.runwayPx)\n updateRevealScale(port, 0, true)\n reportFollow(port, activeRef.current)\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 const tuning = debugRuntime.activeTuning()\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, tuning.runwayPx)\n updateRevealScale(nextPort, elapsedMs)\n reportFollow(nextPort, activeRef.current)\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 const returnedToFloor = readerReleased\n && !readerGestureIntent\n && reportedLag <= FOLLOW_REPIN_PX\n if (!following && (!interacting || returnedToFloor) && 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 reportFollow(nextPort, activeRef.current)\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, tuning.runwayPx)\n const reserveStep = 1 - Math.exp(-elapsedMs / tuning.reserveResponseMs)\n reservePx += (reserveTarget - reservePx) * reserveStep\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n }, tuning)\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, tuning.runwayPx)\n updateRevealScale(nextPort, elapsedMs)\n reportFollow(nextPort, true)\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 debugRuntime.reportFollow(host, null)\n return\n }\n if (preserveReader) {\n handBackVisual(host)\n clearVisual(host)\n followLeaders.delete(host)\n releaseRevealScale()\n debugRuntime.reportFollow(host, null)\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 const completionTuning = debugRuntime.activeTuning()\n ensureRunway(host, shiftSurfacesOf(host), completionTuning.runwayPx)\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, completionTuning.runwayPx)\n reportFollow(host, false)\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 debugRuntime.reportFollow(host, null)\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 debugRuntime.reportFollow(host, null)\n stopSettleListeners()\n return\n }\n const dt = Math.min(FOLLOW_MAX_FRAME_MS, Math.max(0, now - settleLast))\n const tuning = debugRuntime.activeTuning()\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 / tuning.reserveResponseMs)\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 debugRuntime.reportFollow(host, null)\n stopSettleListeners()\n return\n }\n const step = computeFollowStep(dt, {\n lag,\n speedEma: speedCpsRef.current,\n velocityPxPerSec,\n }, tuning)\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, tuning.runwayPx)\n reportFollow(host, false)\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","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'\nimport { debugRuntime } from './debugRuntime.ts'\n\ninterface TextRevealRecord {\n chars: readonly string[]\n full: string\n shown: number\n}\n\n/** Last presented text per root, retained across follow lifecycle flips. */\nconst ledgerByRoot = new WeakMap<HTMLElement, Map<Text, TextRevealRecord>>()\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 const root = rootRef.current\n if (root === null || typeof document === 'undefined') return\n\n let records = ledgerByRoot.get(root)\n if (!enabled && records === undefined) return\n if (records === undefined) {\n records = new Map<Text, TextRevealRecord>()\n ledgerByRoot.set(root, records)\n }\n\n const forEachText = (from: Node, callback: (text: Text) => void): void => {\n if (from.nodeType === Node.TEXT_NODE) {\n callback(from as Text)\n return\n }\n const walker = document.createTreeWalker(from, NodeFilter.SHOW_TEXT)\n let current = walker.nextNode()\n while (current !== null) {\n callback(current as Text)\n current = walker.nextNode()\n }\n }\n\n const settle = (text: Text): void => {\n if (!revealable(text, root)) return\n const chars = [...text.data]\n records.set(text, { chars, full: text.data, shown: chars.length })\n }\n\n const snapshotVisible = (): void => {\n const current = new Set<Text>()\n forEachText(root, (text) => {\n if (!revealable(text, root)) return\n current.add(text)\n settle(text)\n })\n for (const text of records.keys()) {\n if (!current.has(text)) records.delete(text)\n }\n }\n\n if (!enabled) {\n snapshotVisible()\n const observer = typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver(snapshotVisible)\n observer?.observe(root, { childList: true, characterData: true, subtree: true })\n return () => {\n observer?.disconnect()\n }\n }\n\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 const streamId = `dom-${Math.random().toString(36).slice(2)}`\n\n const announceSettled = (): void => {\n lastFrame = null\n debt = 0\n speedCpsRef.current = 35\n debugRuntime.reportStream(streamId, null)\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 forEachText(from, (text) => {\n if (!revealable(text, root)) return\n if (reveal) {\n enqueue(text, text.data, records.get(text))\n return\n }\n settle(text)\n })\n }\n\n const forget = (from: Node): void => {\n forEachText(from, (text) => {\n if (root.contains(text)) return\n records.delete(text)\n pending.delete(text)\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, 1, debugRuntime.activeTuning())\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 records.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 let targetChars = 0\n let displayedChars = 0\n let nextBacklog = 0\n for (const [node, record] of records) {\n if (!node.isConnected) {\n records.delete(node)\n pending.delete(node)\n continue\n }\n targetChars += record.chars.length\n displayedChars += record.shown\n if (pending.has(node)) nextBacklog += record.chars.length - record.shown\n }\n debugRuntime.reportStream(streamId, {\n backlog: nextBacklog,\n speedCps: step.speedCps,\n targetChars,\n displayedChars,\n active: pending.size > 0,\n })\n if (pending.size === 0) announceSettled()\n else scheduleFrame()\n }\n\n visit(root, revealInitial)\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 removed of mutation.removedNodes) forget(removed)\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) {\n write(node, record.full)\n }\n }\n pending.clear()\n speedCpsRef.current = 35\n debugRuntime.reportStream(streamId, null)\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. Preferences are 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('enabled')}</span>\n <input\n type=\"checkbox\"\n className={css.toggle}\n checked={state.enabled}\n disabled={!state.writable || state.saving}\n onChange={(event) => { props.edit({ enabled: event.target.checked }) }}\n />\n </span>\n <span className={css.hint}>{t('enabledHint')}</span>\n </label>\n <label className={state.enabled ? css.field : `${css.field} ${css.fieldDisabled}`}>\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 || state.saving || !state.enabled}\n onChange={(event) => { props.edit({ thinkAutoExpand: event.target.checked }) }}\n />\n </span>\n <span className={css.hint}>{t('thinkAutoExpandHint')}</span>\n </label>\n <label className={css.field}>\n <span className={css.fieldHead}>\n <span className={css.label}>{t('autoCollapse')}</span>\n <input\n type=\"checkbox\"\n className={css.toggle}\n checked={state.autoCollapse}\n disabled={!state.writable || state.saving}\n onChange={(event) => { props.edit({ autoCollapse: event.target.checked }) }}\n />\n </span>\n <span className={css.hint}>{t('autoCollapseHint')}</span>\n </label>\n <label className={state.debugAvailable ? css.field : `${css.field} ${css.fieldDisabled}`}>\n <span className={css.fieldHead}>\n <span className={css.label}>{t('debugEnabled')}</span>\n <input\n type=\"checkbox\"\n className={css.toggle}\n checked={state.debugEnabled}\n disabled={!state.debugAvailable || !state.writable || state.saving}\n onChange={(event) => { props.edit({ debugEnabled: event.target.checked }) }}\n />\n </span>\n <span className={css.hint}>{state.debugAvailable ? t('debugEnabledHint') : t('debugUnavailable')}</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 {\n DEFAULT_STREAM_DEBUG_TUNING,\n DEFAULT_STREAM_SETTINGS,\n type StreamDebugTuning,\n type StreamSettings,\n} from '../settings.ts'\nimport type {\n StreamDebugSettingsView,\n StreamInstallationKind,\n StreamSettingsView,\n} 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 enabled: boolean\n thinkAutoExpand: boolean\n autoCollapse: boolean\n debugEnabled: boolean\n debugTuning: StreamDebugTuning\n debugAvailable: 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: (patch: Partial<StreamSettings>) => 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 loadedDebug: StreamDebugSettingsView | undefined\n private stagedBase: Pick<StreamSettings, 'enabled' | 'thinkAutoExpand' | 'autoCollapse'> | undefined\n private stagedDebug: Pick<StreamSettings, 'debugEnabled' | 'debugTuning'> | 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: (patch) => {\n if (this.saving) return\n if (patch.enabled !== undefined || patch.thinkAutoExpand !== undefined || patch.autoCollapse !== undefined) {\n this.stagedBase = {\n ...this.baseValues(),\n ...(patch.enabled === undefined ? {} : { enabled: patch.enabled }),\n ...(patch.thinkAutoExpand === undefined ? {} : { thinkAutoExpand: patch.thinkAutoExpand }),\n ...(patch.autoCollapse === undefined ? {} : { autoCollapse: patch.autoCollapse }),\n }\n }\n if (this.loadedDebug !== undefined && (patch.debugEnabled !== undefined || patch.debugTuning !== undefined)) {\n this.stagedDebug = {\n ...this.debugValues(),\n ...(patch.debugEnabled === undefined ? {} : { debugEnabled: patch.debugEnabled }),\n ...(patch.debugTuning === undefined ? {} : { debugTuning: { ...this.debugValues().debugTuning, ...patch.debugTuning } }),\n }\n }\n this.failed = false\n this.publish()\n },\n save: () => { void this.save() },\n discard: () => {\n if (this.stagedBase === undefined && this.stagedDebug === undefined && !this.failed) return\n this.stagedBase = undefined\n this.stagedDebug = 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.stagedBase !== undefined || this.stagedDebug !== undefined,\n saving: this.saving,\n failed: this.failed,\n ...this.baseValues(),\n ...this.debugValues(),\n debugAvailable: this.loadedDebug !== undefined,\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 baseValues(): Pick<StreamSettings, 'enabled' | 'thinkAutoExpand' | 'autoCollapse'> {\n return this.stagedBase ?? {\n enabled: this.loaded?.enabled ?? DEFAULT_STREAM_SETTINGS.enabled,\n thinkAutoExpand: this.loaded?.thinkAutoExpand ?? DEFAULT_STREAM_SETTINGS.thinkAutoExpand,\n autoCollapse: this.loaded?.autoCollapse ?? DEFAULT_STREAM_SETTINGS.autoCollapse,\n }\n }\n\n private debugValues(): Pick<StreamSettings, 'debugEnabled' | 'debugTuning'> {\n return this.stagedDebug ?? {\n debugEnabled: this.loadedDebug?.debugEnabled ?? DEFAULT_STREAM_SETTINGS.debugEnabled,\n debugTuning: this.loadedDebug?.tuning ?? DEFAULT_STREAM_DEBUG_TUNING,\n }\n }\n\n /** Complete settings projection consumed by the live SettingsCell bridge. */\n values(): StreamSettings {\n return { ...this.baseValues(), ...this.debugValues() }\n }\n\n private async load(): Promise<void> {\n const generation = ++this.loadGeneration\n this.loadStatus = 'loading'\n this.loaded = undefined\n this.loadedDebug = 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 this.publish()\n try {\n const debug = await this.api.readDebug()\n if (generation !== this.loadGeneration) return\n this.loadedDebug = debug\n } catch {\n if (generation !== this.loadGeneration) return\n // Older hosts expose the original settings endpoints only. Keep the\n // card usable and hide debug-only controls until the host is upgraded.\n this.loadedDebug = undefined\n }\n } catch {\n if (generation !== this.loadGeneration) return\n this.loaded = undefined\n this.loadedDebug = undefined\n this.loadStatus = 'unavailable'\n }\n this.publish()\n }\n\n private async save(): Promise<void> {\n if ((this.stagedBase === undefined && this.stagedDebug === undefined)\n || this.saving || this.loaded?.writable !== true) return\n const base = this.stagedBase\n const debug = this.stagedDebug\n this.saving = true\n this.failed = false\n this.publish()\n try {\n if (base !== undefined) {\n const combined = debug !== undefined && this.loadedDebug !== undefined\n this.loaded = await this.api.write(combined ? { ...base, ...debug } : base)\n this.stagedBase = undefined\n if (combined) {\n this.loadedDebug = {\n debugEnabled: debug.debugEnabled,\n tuning: { ...debug.debugTuning },\n }\n this.stagedDebug = undefined\n }\n }\n if (debug !== undefined && this.loadedDebug !== undefined && this.stagedDebug !== undefined) {\n this.loadedDebug = await this.api.writeDebug(debug)\n this.stagedDebug = undefined\n }\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 debugRead: 'debug.read',\n debugWrite: 'debug.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 /** Whether smooth-stream currently owns conversation rendering. */\n enabled: boolean\n /** Current resolved preference. */\n thinkAutoExpand: boolean\n /** Whether finished turns fold their work process behind a summary row. */\n autoCollapse: boolean\n /** Whether a fixed npm update command is safe to offer. */\n canUpgrade: boolean\n}\n\n/** Debug-only settings returned by the diagnostics RPC. */\nexport interface StreamDebugSettingsView {\n debugEnabled: boolean\n tuning: import('./settings.ts').StreamDebugTuning\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 type { StreamDebugTuning, StreamSettings } from '../settings.ts'\nimport {\n STREAM_SETTINGS_RPC,\n STREAM_SETTINGS_RPC_CHANNEL,\n type StreamDebugSettingsView,\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.enabled !== 'boolean'\n || typeof data.thinkAutoExpand !== 'boolean'\n || typeof data.autoCollapse !== '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 debugSettingsView(value: unknown): StreamDebugSettingsView {\n const data = record(value)\n const tuning = record(data?.tuning)\n if (data === undefined\n || typeof data.debugEnabled !== 'boolean'\n || tuning === undefined\n || typeof tuning.revealScale !== 'number'\n || typeof tuning.queuePressure !== 'number'\n || typeof tuning.maxRevealCps !== 'number'\n || typeof tuning.springStiffness !== 'number'\n || typeof tuning.springDamping !== 'number'\n || typeof tuning.springMass !== 'number'\n || typeof tuning.runwayPx !== 'number'\n || typeof tuning.reserveResponseMs !== 'number'\n || typeof tuning.backpressureMinScale !== 'number') {\n throw new Error('dsh-smooth-stream: malformed debug settings response')\n }\n return {\n debugEnabled: data.debugEnabled,\n tuning: tuning as unknown as StreamDebugTuning,\n }\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(settings: Pick<StreamSettings, 'enabled' | 'thinkAutoExpand' | 'autoCollapse'> & Partial<Pick<StreamSettings, 'debugEnabled' | 'debugTuning'>>): Promise<StreamSettingsView>\n readDebug(): Promise<StreamDebugSettingsView>\n writeDebug(settings: Pick<StreamSettings, 'debugEnabled' | 'debugTuning'>): Promise<StreamDebugSettingsView>\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(settings: Pick<StreamSettings, 'enabled' | 'thinkAutoExpand' | 'autoCollapse'> & Partial<Pick<StreamSettings, 'debugEnabled' | 'debugTuning'>>): Promise<StreamSettingsView> {\n return settingsView(accepted(await connection.rpc.call(\n STREAM_SETTINGS_RPC_CHANNEL,\n STREAM_SETTINGS_RPC.write,\n {\n enabled: settings.enabled,\n thinkAutoExpand: settings.thinkAutoExpand,\n autoCollapse: settings.autoCollapse,\n ...(settings.debugEnabled === undefined || settings.debugTuning === undefined\n ? {}\n : { debugEnabled: settings.debugEnabled, debugTuning: settings.debugTuning }),\n },\n )))\n },\n async readDebug(): Promise<StreamDebugSettingsView> {\n return debugSettingsView(accepted(await connection.rpc.call(\n STREAM_SETTINGS_RPC_CHANNEL,\n STREAM_SETTINGS_RPC.debugRead,\n {},\n )))\n },\n async writeDebug(settings: Pick<StreamSettings, 'debugEnabled' | 'debugTuning'>): Promise<StreamDebugSettingsView> {\n return debugSettingsView(accepted(await connection.rpc.call(\n STREAM_SETTINGS_RPC_CHANNEL,\n STREAM_SETTINGS_RPC.debugWrite,\n { debugEnabled: settings.debugEnabled, tuning: settings.debugTuning },\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","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport {\n IconCloseOutline16,\n IconCodeOutline16,\n IconCopyOutline16,\n IconQuestionOutline14,\n IconRefreshOutline16,\n Tooltip,\n writeClipboard,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { StreamDebugTuning } from '../settings.ts'\nimport type { DebugPanelFace, DebugRuntimeState } from './debugRuntime.ts'\nimport type { NS } from './locales.ts'\nimport css from './DebugPanel.module.css'\n\nexport type DebugPanelProps =\n PropsRuntime<'conversation.session.header.utilities'>\n & PropsLocale<typeof NS>\n & InjectFace<DebugPanelFace>\n\ntype TuningKey = keyof StreamDebugTuning\n\ninterface TuningControl {\n key: TuningKey\n label: Parameters<DebugPanelProps['t']>[0]\n tip: Parameters<DebugPanelProps['t']>[0]\n min: number\n max: number\n step: number\n unit: string\n}\n\nconst REVEAL_CONTROLS: readonly TuningControl[] = [\n { key: 'revealScale', label: 'debugRevealMultiplier', tip: 'debugTipRevealMultiplier', min: 0.25, max: 2, step: 0.05, unit: 'x' },\n { key: 'queuePressure', label: 'debugQueuePressure', tip: 'debugTipQueuePressure', min: 0, max: 2, step: 0.05, unit: 'x' },\n { key: 'maxRevealCps', label: 'debugMaxReveal', tip: 'debugTipMaxReveal', min: 120, max: 1000, step: 10, unit: 'cps' },\n]\n\nconst FOLLOW_CONTROLS: readonly TuningControl[] = [\n { key: 'springStiffness', label: 'debugSpringStiffness', tip: 'debugTipSpringStiffness', min: 40, max: 320, step: 5, unit: '' },\n { key: 'springDamping', label: 'debugSpringDamping', tip: 'debugTipSpringDamping', min: 8, max: 80, step: 1, unit: '' },\n { key: 'springMass', label: 'debugSpringMass', tip: 'debugTipSpringMass', min: 0.5, max: 3, step: 0.05, unit: '' },\n { key: 'runwayPx', label: 'debugRunway', tip: 'debugTipRunway', min: 0, max: 120, step: 2, unit: 'px' },\n { key: 'reserveResponseMs', label: 'debugReserveResponse', tip: 'debugTipReserveResponse', min: 60, max: 600, step: 10, unit: 'ms' },\n { key: 'backpressureMinScale', label: 'debugBackpressureMin', tip: 'debugTipBackpressureMin', min: 0.25, max: 1, step: 0.05, unit: 'x' },\n]\n\nfunction fixed(value: number | null, digits = 1): string {\n return value === null || !Number.isFinite(value) ? '-' : value.toFixed(digits)\n}\n\nfunction Metric({ label, value, tone }: { label: string; value: string; tone?: 'good' | 'warn' | undefined }) {\n return (\n <div className={css.metric}>\n <dt>{label}</dt>\n <dd data-tone={tone}>{value}</dd>\n </div>\n )\n}\n\nfunction TuningField({\n control,\n state,\n edit,\n label,\n t,\n}: {\n control: TuningControl\n state: DebugRuntimeState\n edit: DebugPanelFace['edit']\n label: string\n t: DebugPanelProps['t']\n}) {\n const value = state.tuning[control.key]\n const labelId = `smooth-stream-debug-${control.key}`\n const update = (next: number) => {\n if (!Number.isFinite(next)) return\n const clamped = Math.min(control.max, Math.max(control.min, next))\n edit({ debugTuning: { ...state.tuning, [control.key]: clamped } })\n }\n return (\n <div className={css.control}>\n <span className={css.controlHead}>\n <span className={css.controlLabel}>\n <span id={labelId}>{label}</span>\n <Tooltip label={t(control.tip)} side=\"right\" maxWidth={300}>\n <button\n className={css.infoButton}\n type=\"button\"\n aria-label={label}\n title={t(control.tip)}\n >\n <IconQuestionOutline14 />\n </button>\n </Tooltip>\n </span>\n <span className={css.numberWrap}>\n <input\n className={css.number}\n type=\"number\"\n aria-labelledby={labelId}\n min={control.min}\n max={control.max}\n step={control.step}\n value={value}\n disabled={!state.writable}\n onChange={event => { update(event.currentTarget.valueAsNumber) }}\n />\n {control.unit === '' ? null : <span className={css.unit}>{control.unit}</span>}\n </span>\n </span>\n <input\n className={css.range}\n type=\"range\"\n aria-labelledby={labelId}\n min={control.min}\n max={control.max}\n step={control.step}\n value={value}\n disabled={!state.writable}\n onChange={event => { update(event.currentTarget.valueAsNumber) }}\n />\n </div>\n )\n}\n\nexport function DebugPanel(props: DebugPanelProps) {\n const { t } = props\n const state = props.useDebugRuntime(snapshot => snapshot)\n const [open, setOpen] = useState(true)\n const [copied, setCopied] = useState(false)\n\n useEffect(() => {\n if (!copied) return\n const timer = setTimeout(() => { setCopied(false) }, 1400)\n return () => { clearTimeout(timer) }\n }, [copied])\n\n useEffect(() => {\n if (state.enabled) setOpen(true)\n }, [state.enabled])\n\n if (!state.available || !state.enabled || !open) return null\n const metrics = state.metrics\n const live = metrics.streamActive || metrics.followActive\n const progress = metrics.streamTargetChars <= 0\n ? '-'\n : `${String(metrics.streamDisplayedChars)} / ${String(metrics.streamTargetChars)}`\n const copyDiagnostics = async () => {\n const accepted = await writeClipboard(JSON.stringify({\n tuning: state.tuning,\n metrics: state.metrics,\n }, null, 2))\n if (accepted) setCopied(true)\n }\n\n const panel = !state.enabled || !open ? null : (\n <aside className={css.panel} role=\"complementary\" aria-label={t('debugPanelTitle')}>\n <header className={css.panelHeader}>\n <span className={live ? `${css.statusDot} ${css.statusLive}` : css.statusDot} aria-hidden />\n <span className={css.title}>{t('debugPanelTitle')}</span>\n <span className={css.state}>{t(live ? 'debugLive' : 'debugIdle')}</span>\n {state.dirty ? <span className={css.unsaved}>{t('debugUnsaved')}</span> : null}\n <button className={css.iconButton} type=\"button\" title={t('debugCopy')} aria-label={t('debugCopy')} onClick={() => { void copyDiagnostics() }}>\n <IconCopyOutline16 />\n </button>\n <button\n className={css.iconButton}\n type=\"button\"\n title={t('debugPanelClose')}\n aria-label={t('debugPanelClose')}\n disabled={!state.writable}\n onClick={() => {\n setOpen(false)\n props.edit({ debugEnabled: false })\n props.save()\n }}\n >\n <IconCloseOutline16 />\n </button>\n <span className={css.visuallyHidden} aria-live=\"polite\">{copied ? t('debugCopied') : ''}</span>\n </header>\n\n <div className={css.scrollArea}>\n <p className={css.guide}>{t('debugGuide')}</p>\n <section className={css.section} aria-labelledby=\"smooth-stream-live-heading\">\n <h2 id=\"smooth-stream-live-heading\">{t('debugSectionLive')}</h2>\n <dl className={css.metrics}>\n <Metric label={t('debugFps')} value={fixed(metrics.fps, 0)} tone={(metrics.fps ?? 60) < 45 ? 'warn' : 'good'} />\n <Metric label={t('debugFrameTime')} value={`${fixed(metrics.frameMs)} ms`} />\n <Metric label={t('debugBacklog')} value={String(metrics.streamBacklog)} tone={metrics.streamBacklog > 32 ? 'warn' : undefined} />\n <Metric label={t('debugRevealSpeed')} value={`${fixed(metrics.streamSpeedCps, 0)} cps`} />\n <Metric label={t('debugProgress')} value={progress} />\n <Metric label={t('debugFollowState')} value={t(metrics.followFollowing ? 'debugFollowing' : 'debugReleased')} />\n <Metric label={t('debugLag')} value={`${fixed(metrics.followLagPx)} px`} tone={metrics.followConstrained ? 'warn' : undefined} />\n <Metric label={t('debugVelocity')} value={`${fixed(metrics.followVelocityPxPerSec, 0)} px/s`} />\n <Metric label={t('debugReserve')} value={`${fixed(metrics.followReservePx)} px`} />\n <Metric label={t('debugCapacity')} value={`${fixed(metrics.followCapacityPx)} px`} />\n <Metric label={t('debugAppliedScale')} value={`${fixed(metrics.followRevealScale, 2)}x`} />\n </dl>\n </section>\n\n <section className={css.section} aria-labelledby=\"smooth-stream-reveal-heading\">\n <h2 id=\"smooth-stream-reveal-heading\">{t('debugSectionReveal')}</h2>\n {REVEAL_CONTROLS.map(control => (\n <TuningField key={control.key} control={control} state={state} edit={props.edit} label={t(control.label)} t={t} />\n ))}\n </section>\n\n <section className={css.section} aria-labelledby=\"smooth-stream-follow-heading\">\n <h2 id=\"smooth-stream-follow-heading\">{t('debugSectionFollow')}</h2>\n {FOLLOW_CONTROLS.map(control => (\n <TuningField key={control.key} control={control} state={state} edit={props.edit} label={t(control.label)} t={t} />\n ))}\n </section>\n </div>\n\n <footer className={css.footer}>\n <button className={css.secondaryButton} type=\"button\" disabled={!state.writable} onClick={props.reset}>\n <IconRefreshOutline16 />\n {t('debugReset')}\n </button>\n <span className={css.footerSpacer} />\n <button className={css.secondaryButton} type=\"button\" disabled={!state.writable || !state.dirty} onClick={props.discard}>{t('debugDiscard')}</button>\n <button className={css.primaryButton} type=\"button\" disabled={!state.writable || !state.dirty} onClick={props.save}>{t('debugSave')}</button>\n </footer>\n </aside>\n )\n\n return (\n <>\n <button\n type=\"button\"\n className={state.enabled && open ? `${css.trigger} ${css.triggerActive}` : css.trigger}\n aria-expanded={state.enabled && open}\n aria-label={t('debugPanelToggle')}\n title={t('debugPanelToggle')}\n onClick={() => { setOpen(current => !current) }}\n >\n <IconCodeOutline16 />\n </button>\n {typeof document === 'undefined' || panel === null ? null : createPortal(panel, document.body)}\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 | 'enabled' | 'enabledHint'\n | 'thinkAutoExpand' | 'thinkAutoExpandHint'\n | 'autoCollapse' | 'autoCollapseHint'\n | 'debugEnabled' | 'debugEnabledHint' | 'debugUnavailable'\n | 'debugPanelTitle' | 'debugPanelToggle' | 'debugPanelClose' | 'debugGuide'\n | 'debugLive' | 'debugIdle' | 'debugUnsaved'\n | 'debugSave' | 'debugDiscard' | 'debugReset' | 'debugCopy' | 'debugCopied'\n | 'debugSectionLive' | 'debugSectionReveal' | 'debugSectionFollow'\n | 'debugFps' | 'debugFrameTime' | 'debugBacklog' | 'debugRevealSpeed' | 'debugProgress'\n | 'debugFollowState' | 'debugFollowing' | 'debugReleased'\n | 'debugLag' | 'debugVelocity' | 'debugReserve' | 'debugCapacity' | 'debugAppliedScale'\n | 'debugRevealMultiplier' | 'debugQueuePressure' | 'debugMaxReveal'\n | 'debugSpringStiffness' | 'debugSpringDamping' | 'debugSpringMass'\n | 'debugRunway' | 'debugReserveResponse' | 'debugBackpressureMin'\n | 'debugTipRevealMultiplier' | 'debugTipQueuePressure' | 'debugTipMaxReveal'\n | 'debugTipSpringStiffness' | 'debugTipSpringDamping' | 'debugTipSpringMass'\n | 'debugTipRunway' | 'debugTipReserveResponse' | 'debugTipBackpressureMin'\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 enabled: 'Enable smooth streaming',\n enabledHint: 'Let this plugin render and follow streaming replies. Turn off to use the built-in Harness renderer.',\n thinkAutoExpand: 'Auto-expand thinking',\n thinkAutoExpandHint: 'Open the thinking block while it streams. Turn off to keep it collapsed.',\n autoCollapse: 'Collapse finished work',\n autoCollapseHint: 'When a reply finishes, fold its thinking, tools, and intermediate output behind one “Processed” summary so only the final answer shows. Click the summary to expand again; works with streaming on or off.',\n debugEnabled: 'Show render diagnostics',\n debugEnabledHint: 'Show live streaming and scroll metrics on the right side of the chat. Tune values there, then save them here.',\n debugUnavailable: 'Live diagnostics require a newer plugin Host.',\n debugPanelTitle: 'Render diagnostics',\n debugPanelToggle: 'Toggle render diagnostics',\n debugPanelClose: 'Hide diagnostics panel',\n debugGuide: 'Tune one value at a time while a reply streams. Keep FPS stable and backlog near zero. If text lags, raise the reveal multiplier, queue pressure, or maximum reveal; if a blank gap appears, reduce Predictive runway. Increase damping when the scroll feels springy. Save only after the behavior is stable; Reset restores the production defaults.',\n debugLive: 'Streaming',\n debugIdle: 'Idle',\n debugUnsaved: 'Unsaved tuning',\n debugSave: 'Save tuning',\n debugDiscard: 'Discard changes',\n debugReset: 'Reset tuning',\n debugCopy: 'Copy diagnostics',\n debugCopied: 'Copied',\n debugSectionLive: 'Live renderer',\n debugSectionReveal: 'Reveal tuning',\n debugSectionFollow: 'Scroll tuning',\n debugFps: 'FPS',\n debugFrameTime: 'Frame',\n debugBacklog: 'Backlog',\n debugRevealSpeed: 'Reveal',\n debugProgress: 'Progress',\n debugFollowState: 'Follow',\n debugFollowing: 'Pinned',\n debugReleased: 'Released',\n debugLag: 'Visual lag',\n debugVelocity: 'Velocity',\n debugReserve: 'Reserve',\n debugCapacity: 'Capacity',\n debugAppliedScale: 'Applied scale',\n debugRevealMultiplier: 'Reveal multiplier',\n debugQueuePressure: 'Queue pressure',\n debugMaxReveal: 'Maximum reveal',\n debugSpringStiffness: 'Spring stiffness',\n debugSpringDamping: 'Spring damping',\n debugSpringMass: 'Spring mass',\n debugRunway: 'Predictive runway',\n debugReserveResponse: 'Runway response',\n debugBackpressureMin: 'Minimum backpressure',\n debugTipRevealMultiplier: 'Overall reveal speed multiplier. Higher reveals text faster and clears backlog sooner, but can feel jumpy. Lower is smoother but takes longer to finish.',\n debugTipQueuePressure: 'Backlog acceleration strength. Higher catches up to a growing queue more aggressively; lower keeps speed steadier but may leave backlog.',\n debugTipMaxReveal: 'Hard cap for reveal speed in characters per second. Higher allows faster catch-up; lower limits bursts and keeps motion calmer.',\n debugTipSpringStiffness: 'Scroll spring strength. Higher closes visual lag faster but can feel sharp; lower feels softer but follows more slowly.',\n debugTipSpringDamping: 'Scroll energy damping. Higher suppresses overshoot and jitter but feels heavier; lower feels livelier but may oscillate.',\n debugTipSpringMass: 'Scroll inertia. Higher makes movement slower and heavier; lower makes it react faster but can feel abrupt.',\n debugTipRunway: 'Predictive blank space reserved while content grows. Higher absorbs growth and protects the bottom follow, but can create a larger visible gap; lower reduces blank space but leaves less room to absorb lag.',\n debugTipReserveResponse: 'How quickly the reserved runway opens or closes. Higher changes more gradually; lower reacts faster but can look abrupt.',\n debugTipBackpressureMin: 'Slowest reveal multiplier under scroll pressure. Higher keeps text moving but may increase visual lag; lower slows text more to protect smooth following.',\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 enabled: '启用丝滑流式渲染',\n enabledHint: '由本插件渲染并跟随流式回复;关闭后使用 Harness 内置渲染。',\n thinkAutoExpand: '自动展开思考',\n thinkAutoExpandHint: '思考块在流式时自动展开;关闭后保持折叠,可手动展开。',\n autoCollapse: '完成后自动折叠',\n autoCollapseHint: '回复处理完成后,把思考、工具与过程输出折叠为一行“已处理”摘要,只展示最终回复;点击摘要可再次展开。开启或关闭流式渲染均可用,默认开启。',\n debugEnabled: '显示渲染调试面板',\n debugEnabledHint: '在聊天右侧显示流式渲染和滚动的实时参数,可在面板中调节并在这里保存。',\n debugUnavailable: '当前 Host 版本不支持实时调试,请先更新插件 Host。',\n debugPanelTitle: '渲染诊断',\n debugPanelToggle: '显示或隐藏渲染诊断',\n debugPanelClose: '收起诊断面板',\n debugGuide: '流式输出时一次只调一个参数,观察帧率、积压和视觉滞后。优先保持帧率稳定、积压接近 0;如果文字滞后,提高揭示倍率、队列压力或最大揭示速度;如果底部出现空白,降低“预测预留空间”。滚动有回弹或抖动时提高阻尼。确认表现稳定后再保存;“恢复默认参数”会回到生产默认值。',\n debugLive: '正在流式输出',\n debugIdle: '空闲',\n debugUnsaved: '参数尚未保存',\n debugSave: '保存参数',\n debugDiscard: '放弃修改',\n debugReset: '恢复默认参数',\n debugCopy: '复制诊断数据',\n debugCopied: '已复制',\n debugSectionLive: '实时渲染',\n debugSectionReveal: '流式参数',\n debugSectionFollow: '滚动参数',\n debugFps: '帧率',\n debugFrameTime: '帧耗时',\n debugBacklog: '积压字符',\n debugRevealSpeed: '揭示速度',\n debugProgress: '渲染进度',\n debugFollowState: '跟随状态',\n debugFollowing: '跟随底部',\n debugReleased: '用户已释放',\n debugLag: '视觉滞后',\n debugVelocity: '滚动速度',\n debugReserve: '预留空间',\n debugCapacity: '安全容量',\n debugAppliedScale: '实际倍率',\n debugRevealMultiplier: '揭示倍率',\n debugQueuePressure: '队列压力',\n debugMaxReveal: '最大揭示速度',\n debugSpringStiffness: '弹簧刚度',\n debugSpringDamping: '弹簧阻尼',\n debugSpringMass: '弹簧质量',\n debugRunway: '预测预留空间',\n debugReserveResponse: '预留响应时间',\n debugBackpressureMin: '最小背压倍率',\n debugTipRevealMultiplier: '整体文字揭示速度倍率。调大能更快清空积压,但可能显得跳;调小更平滑,但完成回复需要更久。',\n debugTipQueuePressure: '积压对加速的影响强度。调大能更积极追赶增长中的队列;调小速度更稳定,但积压可能持续。',\n debugTipMaxReveal: '每秒揭示字符数上限。调大允许更快追赶;调小限制突发速度,让动作更平稳。',\n debugTipSpringStiffness: '滚动弹簧刚度。调大更快收拢视觉滞后,但感觉更硬;调小更柔和,但跟随更慢。',\n debugTipSpringDamping: '滚动能量阻尼。调大能抑制过冲和抖动,但感觉更沉;调小更灵活,但可能回弹。',\n debugTipSpringMass: '滚动惯性。调大移动更慢更沉;调小反应更快,但可能显得突兀。',\n debugTipRunway: '内容增长时预留的预测空白。调大更能吸收增长、保护底部跟随,但可能产生更大的可见空区;调小能减少空白,但可吸收滞后的空间也更少。',\n debugTipReserveResponse: '预留空间打开或关闭的响应时间。调大变化更渐进;调小反应更快,但可能显得突变。',\n debugTipBackpressureMin: '滚动压力下允许的最低揭示倍率。调大文字仍会较快前进,但视觉滞后可能增加;调小会更积极减速,以保护跟随平滑。',\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 { AutoCollapseController } from './auto-collapse-controller.ts'\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 { DebugPanel } from './DebugPanel.tsx'\nimport { debugRuntime } from './debugRuntime.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, STREAM_SETTINGS_NS, type StreamSettings } 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 settings cell shared by the renderer lifecycle and React views. It\n * starts on the shared defaults and follows the plugin-owned controller once\n * the optional settings services arrive.\n */\nclass SettingsCell {\n private readonly listeners = new Set<() => void>()\n private card: SmoothStreamCardController | undefined\n private value: StreamSettings = DEFAULT_STREAM_SETTINGS\n private pending = false\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(): StreamSettings {\n const snapshot = this.card?.getSnapshot()\n if (snapshot === undefined || snapshot.status !== 'ready') return this.value\n return this.card?.values() ?? this.value\n }\n\n private refresh(): void {\n const next = this.read()\n const pending = this.card?.getSnapshot().status === 'loading'\n if (\n pending === this.pending\n && next.enabled === this.value.enabled\n && next.thinkAutoExpand === this.value.thinkAutoExpand\n && next.autoCollapse === this.value.autoCollapse\n && next.debugEnabled === this.value.debugEnabled\n && next.debugTuning === this.value.debugTuning\n ) return\n this.pending = pending\n this.value = next\n for (const listener of this.listeners) listener()\n }\n\n /** False while an available settings service is resolving its authority. */\n takeoverEnabled(): boolean {\n return !this.pending && this.value.enabled\n }\n\n /** Whether finished turns should fold behind a summary row right now. */\n autoCollapseActive(): boolean {\n return !this.pending && this.value.autoCollapse\n }\n\n readonly getSnapshot = (): StreamSettings => 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 settings = new SettingsCell()\n\n // Auto-collapse works at the DOM level and is independent of the renderer\n // takeover: it also folds finished turns when the built-in Harness renderer\n // owns the conversation. The lifecycle rides the guaranteed `slots` service\n // (this entry's own inject list) and follows the same live settings cell, so\n // flipping the preference restores every folded row immediately.\n ctx.inject(['slots'], () => {\n const autoCollapse = new AutoCollapseController()\n const syncAutoCollapse = (): void => {\n if (settings.autoCollapseActive()) autoCollapse.start()\n else autoCollapse.stop()\n }\n const unsubscribe = settings.subscribe(syncAutoCollapse)\n syncAutoCollapse()\n return () => {\n unsubscribe()\n autoCollapse.stop()\n }\n })\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 detachSettings = settings.attach(card)\n const syncDebug = (): void => {\n const snapshot = card.getSnapshot()\n debugRuntime.syncSettings({\n available: snapshot.debugAvailable,\n enabled: snapshot.debugEnabled,\n writable: snapshot.writable && !snapshot.saving,\n dirty: snapshot.dirty,\n status: snapshot.status,\n tuning: snapshot.debugTuning,\n })\n }\n const detachBinding = debugRuntime.bindSettings({\n edit: patch => { card.inject().edit(patch) },\n save: () => { card.inject().save() },\n discard: () => { card.inject().discard() },\n })\n const detachDebug = card.subscribe(syncDebug)\n syncDebug()\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 key: STREAM_SETTINGS_NS,\n order: 30,\n locale: SETTINGS_NS,\n inject: () => card.inject(),\n // Older Harness declares this slot as a list (`id`); newer Harness uses a\n // keyed slot filtered by the Host settings namespace (`key`).\n } as never, SmoothStreamCard))\n settingsCtx.slots.inject('conversation.session.header.utilities', () => settingsCtx.slots.register({\n name: 'conversation.session.header.utilities',\n id: 'smooth-stream-debug',\n order: 40,\n locale: SETTINGS_NS,\n inject: () => debugRuntime.panelFace(),\n }, DebugPanel))\n return () => {\n card.stop()\n detachDebug()\n detachSettings()\n detachBinding()\n }\n })\n\n const configured = function StreamConfiguredView(props: AssistantProps) {\n const preferences = useSyncExternalStore(\n settings.subscribe,\n settings.getSnapshot,\n settings.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: preferences.thinkAutoExpand,\n })\n }\n ctx.slots.inject('conversation.chat.node', () => {\n let releaseTakeover: (() => void) | undefined\n\n const syncTakeover = (): void => {\n if (!settings.takeoverEnabled()) {\n releaseTakeover?.()\n releaseTakeover = undefined\n return\n }\n if (releaseTakeover !== undefined) return\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 releaseTakeover = () => {\n // Stop observing slot changes before the shadow entry is removed.\n unwrap()\n unshadow()\n }\n }\n\n const unsubscribe = settings.subscribe(syncTakeover)\n syncTakeover()\n return () => {\n unsubscribe()\n releaseTakeover?.()\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,SAAS,GAAG,GAAG,OAA0C;GACvD,OAAO,MAAM,QAAO,SA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