Commit Graph

57 Commits

Author SHA1 Message Date
Nicolas Varrot
17ff52aaaf feat: display agent name badge in header next to session label
Shows the agentId (e.g. 'main') with a bot icon in the header subtitle,
making it clear which agent is handling the current conversation.
Useful for multi-agent setups.
2026-02-12 17:45:38 +00:00
Nicolas Varrot
52a1a7f270 feat: human-friendly session titles in header and sidebar
Replace raw session keys/UUIDs with readable names derived from
session metadata (label, kind, channel). Priority: label > kind-based
name (Main, Cron, Task) with channel suffix > cleaned key fallback.

New utility: src/lib/sessionName.ts used by both Header and Sidebar.
2026-02-12 17:35:53 +00:00
Nicolas Varrot
4c8faf07e3 fix: prevent autoFormatText from wrapping markdown prose in code fences
The looksLikeCode/isCodeLine heuristics were too aggressive:
- Pattern /^\s*(\/\/|#|\/\*|\*)/ matched markdown bold (**text**) and
  headings (# title) as code comments, causing entire sections to be
  wrapped in code fences and rendered as raw text
- Pattern /^\s*(\/\/|#)/ in isCodeLine caught markdown headers
- Added early bail-out when text contains markdown indicators (**bold**,
  headings, bullet lists) to prevent false positives
- Narrowed comment detection to actual code comments only

Fixes: raw **bold** shown in long assistant messages (reported by Josh)
2026-02-12 17:26:32 +00:00
Nicolas Varrot
03eb9e6de2 feat: per-session input drafts preserved on session switch 2026-02-12 17:15:26 +00:00
Nicolas Varrot
e94325b38a feat: delete session from sidebar with confirmation dialog 2026-02-12 16:57:18 +00:00
Nicolas Varrot
581675d00c feat: distinguish system events from user messages
System events (heartbeats, cron triggers, webhooks, channel events)
now render as subtle inline notifications instead of full user bubbles.
Detection based on content patterns ([EVENT], [cron:], [HEARTBEAT], etc.).
2026-02-12 16:49:16 +00:00
Nicolas Varrot
fa9b10ac97 feat: resizable sidebar with drag handle and persisted width 2026-02-12 15:46:39 +00:00
Nicolas Varrot
8ef1b428a3 fix: mobile viewport overflow — prevent horizontal clipping on iPhone
- Add overflow-x: hidden on html/body and max-width: 100vw
- Add overflow-x: hidden on root app container
- Add overflow-x: hidden on chat scroll container
- Make markdown tables scrollable with display: block + overflow-x: auto
- Add overflow-hidden + min-w-0 on expanded tool call content
- Fix tool result summary max-width from max-w-md to max-w-full

Fixes #26
2026-02-12 12:42:20 +00:00
Nicolas Varrot
1465ae1887 style: move model badge from header to token progress bar area 2026-02-12 12:25:17 +00:00
Nicolas Varrot
e24378aa75 feat: add session pinning to sidebar
- Pin icon appears on hover for each session, filled when pinned
- Pinned sessions sort to top of list (preserved across page reloads via localStorage)
- Subtle divider separates pinned from unpinned sessions
- i18n support for pin/unpin labels (EN + FR)
2026-02-12 12:19:18 +00:00
Nicolas Varrot
96f28836cd feat: display model name badge in header for active session
Shows the model (e.g. claude-opus-4-6) as a subtle chip next to the
session label in the header. Hovering reveals agent ID if available.
Model and agentId are now extracted from sessions.list response.
2026-02-12 12:06:12 +00:00
Nicolas Varrot
c0d27a7754 feat: add unread message indicators on sidebar sessions
Show a cyan dot on sessions that received new messages while
viewing a different session. The dot clears when switching to
that session.
2026-02-12 11:36:31 +00:00
Nicolas Varrot
6734b54389 fix: resolve CI lint errors in Sidebar, TypingIndicator, and useGateway
- Sidebar: replace useEffect setState with callback pattern for filter reset
- TypingIndicator: initialize useRef with 0 instead of impure Date.now()
- TypingIndicator: remove redundant setElapsed(0) from mount effect
- useGateway: remove unused eslint-disable directive
2026-02-12 11:27:42 +00:00
Nicolas Varrot
908dbb4a60 feat: add copy buttons to expanded tool call parameters and results 2026-02-12 11:16:34 +00:00
Nicolas Varrot
ae3f6839bc feat: show language label on fenced code blocks
Display a header bar above code blocks with the detected language
name (e.g. TypeScript, Python, Shell). Pretty-prints common language
identifiers. The copy button remains in the top-right corner.
2026-02-12 10:46:18 +00:00
Nicolas Varrot
0c95150635 feat: add elapsed time counter to thinking indicator
Shows how long the agent has been thinking (e.g. '5s', '1m 23s').
Timer appears after 2 seconds to avoid flicker on fast responses.
Helps users gauge if a request is still processing or stuck.
2026-02-12 10:37:07 +00:00
Nicolas Varrot
f2038a2022 feat: auto-focus chat input on session switch and connection 2026-02-12 10:17:05 +00:00
Nicolas Varrot
f55a24cb06 feat: add keyboard navigation for session list in sidebar
Arrow Up/Down to navigate sessions, Enter to select, Escape to close.
Sessions use role='option' with aria-selected for screen reader support.
Mouse hover syncs with keyboard focus index for smooth interaction.
2026-02-12 09:56:13 +00:00
Nicolas Varrot
3c5fcdfc73 fix: inject app version from package.json instead of hardcoded 1.0.0
- Add Vite define for __APP_VERSION__ from package.json
- Use dynamic version in gateway connect handshake and userAgent
- Show version number in sidebar footer
- Add globals.d.ts type declaration
2026-02-12 09:37:28 +00:00
Nicolas Varrot
e53ef36715 feat: show active session name in browser tab title
Updates document.title dynamically to show the current session label
(e.g. 'main — PinchChat'). Integrates with the existing notification
system so unread badges still work correctly (e.g. '(3) main — PinchChat').
Resets to plain 'PinchChat' when no session is selected.
2026-02-12 09:17:15 +00:00
Nicolas Varrot
b5eafdeed8 perf: lazy-load Chat component to reduce initial bundle size
The Chat component (and its heavy markdown dependencies ~476KB) are now
loaded via React.lazy() + Suspense. Users see the login screen faster
since only ~245KB is needed initially instead of ~750KB.
2026-02-12 09:05:51 +00:00
Nicolas Varrot
8301cba339 fix: guard Notification API for unsupported browsers
Check typeof Notification before accessing .permission or
requestPermission(). Fixes crash on browsers/contexts where
the Notification API is unavailable (e.g. some WebViews).
2026-02-12 07:58:23 +00:00
Nicolas Varrot
dc49734819 feat: validate WebSocket URL on login screen
Show inline hint when the gateway URL doesn't start with ws:// or wss://
and disable the connect button until it's valid. Prevents confusing
connection errors from malformed URLs.
2026-02-12 06:55:19 +00:00
Nicolas Varrot
cb882f5ead feat: add loading indicator when switching sessions
Show a spinner with 'Loading messages…' text while chat history
is being fetched during session switches, instead of briefly
flashing the empty welcome screen. Includes EN/FR i18n.
2026-02-12 05:52:06 +00:00
Nicolas Varrot
73d9e5f6f2 feat: add channel/type icons to session list in sidebar
Show Discord, Telegram, WhatsApp, Signal, Slack brand icons,
clock icon for cron sessions, bot icon for sub-agents, and
globe icon for webchat sessions. Falls back to message bubble
for unknown channels.

Closes feedback #23
2026-02-12 02:45:33 +00:00
Nicolas Varrot
29482e377a fix: resolve ESLint errors for React compiler rules
- Chat.tsx: replace mutable variable in render IIFE with useMemo+reduce
  to satisfy react-hooks/immutability rule
- ConnectionBanner.tsx: move setState calls into a useCallback to avoid
  synchronous setState in effect body (react-hooks/set-state-in-effect)
- useGateway.ts: suppress set-state-in-effect for legitimate mount init
2026-02-12 01:42:40 +00:00
Nicolas Varrot
375bd102d4 feat: add date separators between messages from different days
Shows a subtle horizontal line with the date label (Today, Yesterday, or
full date) when messages span multiple days. Helps orient users when
scrolling through long conversation histories.

Includes i18n support (EN/FR) for the date labels.
2026-02-12 00:40:03 +00:00
Nicolas Varrot
916910f5ce fix: resolve all ESLint errors and add lint step to CI
- Extract credential helpers to src/lib/credentials.ts (fixes react-refresh/only-export-components)
- Extract buildImageSrc to src/lib/image.ts (fixes react-refresh/only-export-components)
- Reorder useCallback declarations in useGateway to fix react-hooks/immutability
- Sync refs via useEffect instead of during render (fixes react-hooks/refs)
- Replace useState initializer effect with lazy initializer functions in LoginScreen
- Add comments to empty catch blocks (fixes no-empty)
- Remove unused variable (fixes @typescript-eslint/no-unused-vars)
- Downgrade react-hooks/set-state-in-effect to warning (valid init/status patterns)
- Add lint step to CI workflow (runs before type-check and build)
2026-02-11 23:37:37 +00:00
Nicolas Varrot
f8be728842 fix: use exponential backoff with jitter for WebSocket reconnection
Replace fixed 3s reconnect delay with exponential backoff (1s → 30s cap)
plus 30% jitter to prevent thundering herd. Resets on successful
connection or manual disconnect.
2026-02-11 22:33:02 +00:00
Nicolas Varrot
5b2f3a340d feat: add retry/resend button on user messages
Hover over any user message to reveal a retry button (↻) that resends
the message text. Disabled while a response is generating.
Includes EN/FR i18n strings.
2026-02-11 21:56:48 +00:00
Nicolas Varrot
473d23c140 feat: add browser notifications and tab title badge for unread messages
When the tab is not focused:
- Tab title shows unread count: (3) PinchChat
- Browser notification with message preview (if permitted)
- Notifications collapse into one via tag
- Click notification to focus tab
- All clears when tab regains focus
- Permission requested on first user interaction
2026-02-11 21:45:59 +00:00
Nicolas Varrot
fd66fed96f fix(a11y): add prefers-reduced-motion support for all animations
Disables animations and reduces transition durations to near-zero
when the user has enabled reduced-motion in their OS settings.
Also replaces README screenshot placeholder with link to live demo.
2026-02-11 21:26:08 +00:00
Nicolas Varrot
693229c14e refactor: replace any types with proper TypeScript types across gateway client, hooks, and components
- Add GatewayMessage and JsonPayload interfaces to gateway.ts
- Type WebSocket message parsing with GatewayMessage instead of any
- Use ReturnType<typeof setTimeout> for timer refs
- Type chat event payload destructuring explicitly
- Add ChatPayloadMessage interface for extractText()
- Replace any casts in loadSessions/loadHistory with typed assertions
- Add str() helper in ToolCall.tsx for safe unknown→string extraction
- Use Extract<MessageBlock, ...> type guards instead of `as any` casts
- Type CodeBlock children prop properly
2026-02-11 21:17:44 +00:00
Nicolas Varrot
b61a232948 feat: add ErrorBoundary for graceful crash recovery
- Catches render errors and shows a styled recovery UI instead of blank white screen
- Try Again button re-renders, Reload button refreshes the page
- Error details shown in a collapsible pre block
- Full i18n support (EN/FR)
- Wraps the entire app in main.tsx
2026-02-11 20:53:16 +00:00
Nicolas Varrot
78f82fd551 fix(a11y): add ARIA attributes to interactive elements
- ImageBlock: wrap clickable image in <button> with aria-label, add
  role=dialog and aria-modal to lightbox overlay
- KeyboardShortcuts: add role=dialog and aria-modal to modal overlay
- CodeBlock: add aria-label to copy button
- LanguageSelector: add aria-label with current language
2026-02-11 20:36:35 +00:00
Nicolas Varrot
72f7d76cc4 feat: add emoji icons to tool call badges
Replace Lucide icons with emojis on tool call badges for better visual
identification:  exec, 🔍 web_search, 📖 read, ✏️ write/edit,
🧠 memory,  cron, 🚀 sessions_spawn, and more.

Also reduces bundle by removing unused Lucide icon imports from ToolCall.

Closes feedback item #15.
2026-02-11 20:25:31 +00:00
Nicolas Varrot
59104b4217 feat: support line breaks in messages (remark-breaks plugin) 2026-02-11 20:22:17 +00:00
Nicolas Varrot
84c8e24457 style: unify token progress bars with subtle cyan opacity ramp
Replace the disparate gradient/orange/red color scheme with a single
soft sky-blue (rgb 56,189,248) that subtly intensifies as usage grows.
Opacity ramps from 0.35 at low usage to 1.0 at full context.
Applies to both sidebar session bars and header token bar.
2026-02-11 20:15:31 +00:00
Nicolas Varrot
ae83545377 feat: add keyboard shortcuts help modal (press ? to open) 2026-02-11 19:56:18 +00:00
Nicolas Varrot
177970988a feat(sidebar): add session search filter with Ctrl+K shortcut
- Search input appears when 4+ sessions exist
- Filters sessions by label/key in real-time
- Ctrl+K / Cmd+K keyboard shortcut to focus search
- Clear button and 'no results' state
- i18n support (EN + FR)
2026-02-11 19:46:28 +00:00
Nicolas Varrot
dd5b56e02c feat: add copy-to-clipboard button on assistant messages
Appears on hover over assistant message bubbles. Shows a check icon
with 'Copied!' feedback for 2s after clicking. i18n support (EN/FR).
Does not show on streaming messages or empty messages.
2026-02-11 19:26:06 +00:00
Nicolas Varrot
195ad621f7 fix(i18n): use i18n key for 'Parameters' label in tool call expansion
The 'Paramètres' label in ToolCall.tsx was hardcoded in French instead of
using the i18n system. Added tool.parameters key to both EN and FR locales.
2026-02-11 18:56:11 +00:00
Nicolas Varrot
91c22a10af fix: close sidebar overlay on Escape key + aria-hidden for screen readers 2026-02-11 18:46:01 +00:00
Nicolas Varrot
32a2166fd3 feat: connection lost/reconnected banner with i18n
Adds a slim animated banner below the header that:
- Shows 'Connection lost — reconnecting…' with spinner when WS drops
- Flashes 'Reconnected!' with auto-dismiss after 3s on recovery
- Only appears after initial connection (not on first load)
- Supports EN/FR via i18n system
- Uses aria role=alert for accessibility
2026-02-11 18:36:51 +00:00
Nicolas Varrot
b56c80a454 feat: add scroll-to-bottom button when scrolled up in chat
Floating button appears when user scrolls away from the bottom of the
conversation, making it easy to jump back to the latest messages.
Includes i18n labels (EN/FR) and smooth scroll animation.
2026-02-11 17:56:09 +00:00
Nicolas Varrot
762a5f2026 feat: inline image display with lightbox
- Add image block type for base64 and URL images
- Parse image/image_url blocks from gateway history
- Render images inline in chat messages (rounded, dark-themed)
- Click-to-zoom lightbox with Escape to close
- Markdown images also use the lightbox component
- Detect base64 images in tool results (e.g. Read tool on image files)
- Support png, jpg, gif, webp formats
2026-02-11 17:18:10 +00:00
Nicolas Varrot
97c16be399 feat: integrate PinchChat logo throughout the app
- Use logo.png as favicon (replaces emoji SVG)
- Show logo in header next to title
- Show larger logo on login screen
- Add OG image meta tag
- Add centered logo in README
- Closes feedback item #8
2026-02-11 16:47:02 +00:00
Nicolas Varrot
9b3aed4adc feat: add runtime language selector in header (EN/FR toggle)
- Add LanguageSelector component with globe icon + cycle button
- Refactor i18n to support reactive locale switching via useSyncExternalStore
- Locale priority: localStorage > VITE_LOCALE > navigator.language > 'en'
- All components now use useT() hook for reactive re-rendering on locale change
- Persists choice to localStorage (key: pinchchat-locale)
- No page reload needed — instant switch
2026-02-11 16:18:22 +00:00
Nicolas Varrot
b6a989bb51 feat: add copy button on code blocks
Hover over any fenced code block to reveal a floating copy-to-clipboard
button (top-right corner). Provides visual feedback (checkmark) on success.
Uses a custom ReactMarkdown <pre> component wrapper.
2026-02-11 15:46:49 +00:00
Nicolas Varrot
3e7a5969e0 fix: smart auto-scroll — only scroll to bottom when user is near bottom
Previously, every message update forced a scroll to bottom, which was
disruptive when reading older messages in the history. Now the chat only
auto-scrolls if the user is within 150px of the bottom, or if they just
sent a message. This preserves scroll position when browsing history
while still following new streaming content.
2026-02-11 14:47:11 +00:00