Context
Split from the review of #4655 (P3, deferred). The side-chat panel needed the main chat's rising-edge running-status timing — useDelayedFlag + the 200ms delay — but the workbar feature layer cannot import the renderer-legacyuse-delayed-flag.ts / model-wait-state.ts (the renderer-architecture gate walls feature code off from legacy). So #4655 added a feature-local copy of useDelayedFlag and a const RUNNING_STATUS_DELAY_MS = 200 to quote-companion-panel.tsx.
That leaves:
- Two authorities for one delay/timing — the panel's copy will drift from the main chat's
useDelayedFlag. - A duplicated literal (
200) with no single source of truth. - No unit-test coverage for the timing on the side-chat path (and, in fact,
createDelayedFlag has no fake-timer tests anywhere today).
Proposal
Lift the shared pieces into @maka/ui so both sides import one implementation:
- Move the pure
createDelayedFlag (+ DelayedFlag, DelayedFlagScheduler) out of apps/desktop/src/renderer/model-wait-state.ts and the useDelayedFlag React binding out of apps/desktop/src/renderer/use-delayed-flag.ts into a new @maka/ui module; export a shared RUNNING_STATUS_DELAY_MS. - Update the main chat (
use-shell-live-turn.ts) and the side chat (quote-companion-panel.tsx) to import from @maka/ui; delete the feature-local copy + literal. - Re-export from the legacy modules where needed for back-compat / minimal churn.
- Add fake-timer unit tests for
createDelayedFlag in @maka/ui (rising-edge delay, no-flash on a fast drop, immediate fall).
Benefits
- One authority for the running-status timing and delay constant.
- Removes the feature→renderer-legacy walled-off duplication — should take the
use-delayed-flag.ts / model-wait-state.ts closure entries off the renderer-architecture ledger. - Establishes the timing unit-test coverage that's missing today.
Origin: #4655 review by @Astro-Han.
Context
Split from the review of #4655 (P3, deferred). The side-chat panel needed the main chat's rising-edge running-status timing —
useDelayedFlag+ the 200ms delay — but the workbar feature layer cannot import the renderer-legacyuse-delayed-flag.ts/model-wait-state.ts(the renderer-architecture gate walls feature code off from legacy). So #4655 added a feature-local copy ofuseDelayedFlagand aconst RUNNING_STATUS_DELAY_MS = 200toquote-companion-panel.tsx.That leaves:
useDelayedFlag.200) with no single source of truth.createDelayedFlaghas no fake-timer tests anywhere today).Proposal
Lift the shared pieces into
@maka/uiso both sides import one implementation:createDelayedFlag(+DelayedFlag,DelayedFlagScheduler) out ofapps/desktop/src/renderer/model-wait-state.tsand theuseDelayedFlagReact binding out ofapps/desktop/src/renderer/use-delayed-flag.tsinto a new@maka/uimodule; export a sharedRUNNING_STATUS_DELAY_MS.use-shell-live-turn.ts) and the side chat (quote-companion-panel.tsx) to import from@maka/ui; delete the feature-local copy + literal.createDelayedFlagin@maka/ui(rising-edge delay, no-flash on a fast drop, immediate fall).Benefits
use-delayed-flag.ts/model-wait-state.tsclosure entries off the renderer-architecture ledger.Origin: #4655 review by @Astro-Han.