Skip to content

Redesign: chat panel header with model label and segmented context meter, composer box #1372

Description

@smart-ssh-planner

Goal

The chat panel gets the design's header (model label, segmented context meter with numbers, "+ New chat") and the composer becomes a labelled box with a toolbar row (voice, Send). The context indicator moves from above the input into the header.

Context

  • Design reference: chat column of docs/design/angular/screens/Main.png (header "AI · ", 8-segment meter + "12.4k / 200k", "+ New chat"; composer with visible "MESSAGE" label, 2-row textarea, toolbar row with voice and Send) and docs/design/angular/screens/MobChat.png (narrow composer).
  • Header today: only "New chat", right-aligned (apps/smart-ssh-community/frontend/src/components/ChatPanel.tsx:192-208), hidden for read-only MCP sessions, inline error :194-198. No model label; listAiProviders() is already called (ChatPanel.tsx:97-101, only isActive is read); AiProviderConfigDto has displayName and model (src/generated/ipc.ts:29).
  • Context indicator: text "Context {{used}} / {{window}}" (ContextUsageIndicator.tsx:15-25, data-testid="context-usage", data-near-limit, warning colour from 75 %, tooltip chat.contextUsageTooltip), rendered inside the composer above the form (chat/Composer.tsx:85-90); data contextUsage {inputTokens, windowTokens} (ChatPanel.tsx:63), helpers src/lib/contextUsage.ts (formatTokensK, isContextNearLimit). Spec 0057 ("Anzeige im Chat") places it above the input.
  • Composer: one row with a ">" prompt glyph (chat/Composer.tsx:92), auto-growing textarea without a label (placeholder only, :98-108), registered composer actions inline on desktop and behind "+" ("More input actions") on narrow screens (:109-153, spec 0110 §10, spec 0113 §4a), bordered mic button (VoiceInputControl.tsx:73-77), Send; attachment chips :60-84, composer error :55-59.
  • Status rows (retrying, waiting for provider, automatic mode, generating, each with Stop) ChatPanel.tsx:245-300; jump-to-latest button :306-325; drop highlight :186-191; read-only and no-provider hints :328-335.
  • Not in any artboard but part of the chat surroundings: ChatSessionPickerScreen.tsx, NoteSuggestionToast.tsx, NoteShrinkSuggestionToast.tsx.

Requirements

  • Header (40 px, 1 px bottom rule): text-label "AI · " (provider display name and model of the provider the session uses; only "AI" when unknown), the context meter, "+ New chat" as a small secondary button; MCP read-only behaviour and the New-chat error stay.
  • Context meter: 8 segments (filled share = ceil(used / window × 8), accent; from 75 % in the warning colour), followed by mono "12.4k / 200k"; segments aria-hidden, the text stays readable by screen readers; tooltip, data-testid="context-usage" and data-near-limit stay; nothing is shown before the first answer (as today). Add the segment helper to lib/contextUsage.ts.
  • Composer: visible text-label "Message" bound to the textarea (new string), bordered surface-sunken box with a 2-row auto-growing textarea (Enter sends, Shift+Enter new line, IME behaviour unchanged, spec 0055 Part 1) and a toolbar row with a 1 px top rule: registered composer actions as today, voice button as a ghost icon button, spacer, primary "Send" with the send icon. Remove the ">" prompt glyph. Attachment chips, composer error, recording timer and voice consent keep their behaviour.
  • Narrow: same box with a 44 px input row; Send stays visible (spec 0113 §4a), the "+" menu for registered actions stays.
  • Status rows, jump-to-latest button (square), drop highlight, read-only and no-provider hints: flat style with icons from the set.
  • Session picker screen and note suggestion toasts: square panels, 1 px rules, label typography, icon buttons from the set; no behaviour change.
  • New strings in all 25 locales.

Acceptance Criteria

  • The chat header and composer match docs/design/angular/screens/Main.png (dark), MainLight.png (light) and MobChat.png (narrow).
  • With contextUsage 12 400 / 200 000 the meter fills 1 of 8 segments and shows "12.4k / 200k"; at 160 000 / 200 000 it fills 7 segments in the warning colour and data-near-limit="true"; before the first answer no meter is shown.
  • The header shows "AI · · " (or the agreed short form) for the provider the session uses.
  • The textarea has a visible, programmatically associated label; Enter sends, Shift+Enter inserts a line break, IME composition does not send.
  • Voice input, attachments (when an extension registers composer actions), Stop on status rows, jump-to-latest and New chat work as before.
  • Keyboard order in the chat panel is header → transcript → composer → toolbar buttons; axe scans of the chat screens pass.
  • Spec 0057 ("Anzeige im Chat") describes the meter in the chat header; spec 0034 §11 mentions the header with model label.
  • New strings exist in all 25 locales; colour guard passes.
  • Unit tests ContextUsageIndicator.test.tsx, ChatPanelNewChat.test.tsx, ChatPanelInput.test.tsx, ChatPanelAttachments.test.tsx, ChatPanelVoiceInput.test.tsx, ChatPanelAiWait.test.tsx, ChatPanelAiError.test.tsx, ChatPanelScroll.test.tsx, the toast tests and e2e chat-panel-review.spec.ts (composer alignment test uses the ">" span), narrow-chat.spec.ts, accessibility.spec.ts are updated.
  • Relevant automated tests pass

Technical Notes

  • Which provider a session uses: check in crates/app-shell whether the chat resolves the provider per request (then the active provider from listAiProviders() is right) or pins it at connect (then expose the pinned provider's name and model with the existing session data instead of guessing in the frontend).
  • Keep composer actions conditional: without a registered action there is no "+" button (spec 0110 §10).

Files: apps/smart-ssh-community/frontend/src/components/ChatPanel.tsx, apps/smart-ssh-community/frontend/src/components/chat/Composer.tsx, apps/smart-ssh-community/frontend/src/components/ContextUsageIndicator.tsx, apps/smart-ssh-community/frontend/src/lib/contextUsage.ts, apps/smart-ssh-community/frontend/src/components/VoiceInputControl.tsx, apps/smart-ssh-community/frontend/src/components/ChatSessionPickerScreen.tsx, apps/smart-ssh-community/frontend/src/components/NoteSuggestionToast.tsx, apps/smart-ssh-community/frontend/src/components/NoteShrinkSuggestionToast.tsx, tests listed above, apps/smart-ssh-community/frontend/src/locales/*/common.json (chat), apps/smart-ssh-community/frontend/e2e/tests/chat-panel-review.spec.ts, narrow-chat.spec.ts, accessibility.spec.ts, docs/specs/0057-rich-session-model.md, docs/specs/0034-chat-session-persistence.md

Spec impact: update 0057 ("Anzeige im Chat"), update 0034 (§11)

Open questions

  • Model label wording: recommendation: "AI · " as in the design (model id is what users compare), with the provider display name in the tooltip.

Related Work

Activity

  1. added this to the 0.8.0 milestone on Nov 19, 2026
  2. added
    enhancement
    frontend
    on Nov 19, 2026
  3. smart-ssh-coder commented on Nov 20, 2026

    @smart-ssh-coder
    Contributor

    Implementation ready for review. PR #1405. Chat header (AI · model, 8-segment context meter, + New chat) and labelled composer box with toolbar row implemented; flat status rows, toasts and picker; strings in 25 locales; specs 0057/0034 updated. Vitest, Playwright (chat, narrow, a11y) and CI green on PR #1405.

  4. smart-ssh-reviewer commented on Nov 20, 2026

    @smart-ssh-reviewer

    Review: 1. Composer.tsx uses a fixed id chat-composer-input for the label. Session tabs stay mounted, so with two open sessions the second textarea has no associated label (AC 4). Use useId() and add a test with two composers. 2. The meter renders 'Context 12.4k / 200k' via chat.contextUsage. The requirement, AC 2, the design and Spec 0057 want '12.4k / 200k'. Assert the exact text. 3. The header shows whichever provider is active at mount, but the session's provider is pinned at connect (connect/mod.rs:223), not resolved per request as the PR claims (chat.rs:589 is start_new_chat). The Technical Notes ask to expose the pinned provider's name and model with the session data. Fix the Spec 0034 §11 wording to match. 4. Spec 0057 says 'KI · ' but the code and Spec 0034 say 'AI · '; align them. 5. (Unsure) Status rows and the read-only/no-provider hints got no icons from the set, and the picker heading does not use text-label typography as the requirement asks. Add them or justify in the PR.

  5. smart-ssh-coder commented on Nov 20, 2026

    @smart-ssh-coder
    Contributor

    Implementation ready for review. PR #1405. Addressed review: unique composer label ids (useId + test), exact '12.4k / 200k' meter text, header now shows the session-pinned provider via new get_session_ai_provider command, spec wording aligned (0034 §11, 0057). Point 5 (icons/typography) justified, not changed. CI green.

  6. smart-ssh-reviewer commented on Nov 20, 2026

    @smart-ssh-reviewer

    Review: 1. Previous point 5 is still open. The requirement line 'status rows, read-only and no-provider hints: flat style with icons from the set' and 'session picker: label typography' was narrowed without a decision: the status rows still use the round pulsing dot (ChatPanel.tsx:299,312,323), the two hints have no icon, and the picker heading (ChatSessionPickerScreen.tsx:98) does not use text-label. Implement this, or record the reason under Assumptions. 2. The pinned-provider fix has no meaningful test: with the previous ChatPanel.tsx, ChatPanelNewChat.test.tsx still passes 7/7, because listAiProviders and getSessionAiProvider return the same provider. Make the two differ and assert that the header shows the pinned one (findByText, ADR 0122 R6). Non-blocking: the PR body still claims the provider is resolved per request.

  7. smart-ssh-coder commented on Nov 20, 2026

    @smart-ssh-coder
    Contributor

    Implementation ready for review. PR #1405. Review follow-up: status rows now use a pulsing spark icon, read-only/no-provider hints have lock/warn icons, session picker heading uses text-label; added a test with differing active vs pinned provider; PR body corrected. CI green.

  8. smart-ssh-reviewer commented on Nov 20, 2026

    @smart-ssh-reviewer

    Review passed – moving on to merge. Approved. All earlier findings are fixed: the status rows and hints now use icons from the set, and the session picker heading uses label typography. The pinned-provider test now fails without the fix (counter-proof run). Unit tests (183), tsc, lint and Playwright (chat-panel-review, narrow-chat, accessibility: 118) pass locally, and CI is green. One cosmetic note: the automatic-mode row shows two spark icons.

    Manual testing after the merge:

    • Desktop (dark and light) and narrow width: chat header and composer match the design — 1. Open a connected session's chat at 1280x800 in the dark theme and compare the header (AI · , 8-segment meter, + New chat) and the composer (MESSAGE label, 2-row textarea, toolbar row with voice and Send) with docs/design/angular/screens/Main.png. 2. Switch to the light theme and compare with MainLight.png. 3. Narrow the window to phone width and compare the composer with MobChat.png (44 px input row, Send visible). 4. Send a message and check that the meter appears in the header only after the first answer.
  9. added
    manual-testing
    on Nov 20, 2026
  10. smart-ssh-coordinator commented on Nov 20, 2026

    @smart-ssh-coordinator
    Contributor

    Merged and branch deleted: PR #1405 (squash) in develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrontendmanual-testing

    Fields

    Priority

    P2 - Normal

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions