Commit Graph

39 Commits

Author SHA1 Message Date
simosmik
2d3d924272 fix: pass diff information to code editor 2026-02-12 22:38:32 +00:00
Haileyesus
9fece98612 fix(chat): sync quick settings state and stabilize thinking toggle
Synchronize useUiPreferences instances via custom sync events and storage listeners so Quick Settings updates apply across UI consumers immediately.

Also hide standalone thinking messages when showThinking is disabled, while preserving hook order to avoid Rendered fewer hooks runtime errors.
2026-02-12 23:47:08 +03:00
Haileyesus
a4e55984ea fix(chat): stabilize provider/message handling and complete chat i18n coverage
Unify provider typing, harden realtime message effects, normalize tool input
serialization, and finish i18n/a11y updates across chat UI components.

- tighten provider contracts from `Provider | string` to `SessionProvider` in:
  - `useChatProviderState`
  - `useChatComposerState`
  - `useChatRealtimeHandlers`
  - `ChatMessagesPane`
  - `ProviderSelectionEmptyState`
- refactor `AssistantThinkingIndicator` to accept `selectedProvider` via props
  instead of reading provider from local storage during render
- fix stale-closure risk in `useChatRealtimeHandlers` by:
  - adding missing effect dependencies
  - introducing `lastProcessedMessageRef` to prevent duplicate processing when
    dependencies change without a new message object

- standardize `toolInput` shape in `messageTransforms`:
  - add `normalizeToolInput(...)`
  - ensure all conversion paths produce consistent string output
  - remove mixed `null`/raw/stringified variants across cursor/session branches

- harden tool display fallback in `CollapsibleDisplay`:
  - default border class now falls back safely for unknown categories

- improve chat i18n consistency:
  - localize hardcoded strings in `MessageComponent`
    (`permissions.*`, `interactive.*`, `thinking.emoji`, `json.response`,
    `messageTypes.error`)
  - localize button titles in `ChatInputControls`
    (`input.clearInput`, `input.scrollToBottom`)
  - localize provider-specific empty-project prompt in `ChatInterface`
    (`projectSelection.startChatWithProvider`)
  - localize repeated “Start the next task” prompt in
    `ProviderSelectionEmptyState` (`tasks.nextTaskPrompt`)

- add missing translation keys in all supported chat locales:
  - `src/i18n/locales/en/chat.json`
  - `src/i18n/locales/ko/chat.json`
  - `src/i18n/locales/zh-CN/chat.json`
  - new keys:
    - `input.clearInput`
    - `input.scrollToBottom`
    - `projectSelection.startChatWithProvider`
    - `tasks.nextTaskPrompt`

- improve attachment remove-button accessibility in `ImageAttachment`:
  - add `type="button"` and `aria-label`
  - make control visible on touch/small screens and focusable states
  - preserve hover behavior on larger screens

Validation:
- `npm run typecheck`
2026-02-12 23:47:07 +03:00
Haileyesus
0306f8d59b refactor(ToolConfigs): use optional chaining for content retrieval 2026-02-12 23:47:07 +03:00
Haileyesus
c193137aa5 refactor(ChatMessagesPane): extract message key generation logic to a utility function 2026-02-12 23:47:07 +03:00
Haileyesus
450ce93ee4 refactor:: move AssistantThinkingIndicator component to its own file 2026-02-12 23:47:07 +03:00
Haileyesus
7c1d2899fa refactor(ChatMessagesPane): use stable message key 2026-02-12 23:47:07 +03:00
Haileyesus
a82a225d23 refactor(OneLineDisplay): improve clipboard functionality with fallback for unsupported environments 2026-02-12 23:47:07 +03:00
Haileyesus
be94e53a1a refactor(useChatRealtimeHandlers): normalize interactive prompt content to string for consistent ChatMessage shape 2026-02-12 23:47:07 +03:00
Haileyesus
c79c022ff8 refactor(useChatComposerState): improve input handling and command execution flow 2026-02-12 23:47:07 +03:00
Haileyesus
deec5f2f1b refactor(ToolRenderer): ensure stable hook order 2026-02-12 23:47:07 +03:00
Haileyesus
b76f53c4bf refactor(ChatInputControls): update import statement for ThinkingModeSelector 2026-02-12 23:47:07 +03:00
Haileyesus
474d324ea3 fix: type annotations 2026-02-12 23:47:07 +03:00
Haileyesus
b8f06c8aa4 refactor(createCachedDiffCalculator): use both newStr and oldStr as cache keys 2026-02-12 23:47:07 +03:00
Haileyesus
f6ed3cbd6d refactor(calculateDiff): optimize LCS algorithm for improved diff calculation 2026-02-12 23:47:07 +03:00
Haileyesus
60a9f3dc32 refactor(MessageComponent): add types 2026-02-12 23:47:07 +03:00
Haileyesus
d30d64ce93 refactor(useFileMentions): implement abort controller for fetch requests 2026-02-12 23:47:07 +03:00
Haileyesus
022ac21369 refactor(chat): exclude currentSessionId from dependency array to prevent unnecessary reloading of messages 2026-02-12 23:47:06 +03:00
Haileyesus
3c6f353716 refactor(chat): improve message handling by cloning state updates and improving structured message parsing 2026-02-12 23:47:06 +03:00
Haileyesus
553c534f35 refactor(todo): update TodoListContentProps to include optional id and priority fields that are used in TodoList.jsx 2026-02-12 23:47:06 +03:00
Haileyesus
e435e70a6b fix(chat): handle potential null content in message before splitting lines 2026-02-12 23:47:06 +03:00
Haileyesus
0b6b33c3cc refactor(chat): replace localStorage provider retrieval with prop usage in MessageComponent 2026-02-12 23:47:06 +03:00
Haileyesus
844602a4fe fix(chat): handle JSON parsing errors for saved chat messages 2026-02-12 23:47:06 +03:00
Haileyesus
fc1ad17ba8 fix(chat): escape command name in regex to prevent unintended matches 2026-02-12 23:47:06 +03:00
simosmik
d99c581179 refactor(tools): improve Task tool display formatting
Update Task tool config to show cleaner subagent information in the UI.
Simplifies the input display by showing only the prompt when no
optional fields are present, reducing visual clutter. Updates title
format to "Subagent / {type}" for better categorization. Enhances
result display to better handle complex agent response structures with
array content types, extracting text blocks for cleaner presentation.
2026-02-12 23:47:06 +03:00
simosmik
b8d80fdab7 refactor(tools): add agent category for Task tool
Add visual distinction for the Task tool (subagent invocation) by
introducing a new 'agent' category with purple border styling. This
separates subagent tasks from regular task management tools
(TaskCreate, TaskUpdate, etc.) for clearer user feedback.

Also refactor terminal command layout in OneLineDisplay to properly
nest flex containers, fixing copy button alignment issues.
2026-02-12 23:47:06 +03:00
Haileyesus
720a771b2a feat(chat): move thinking modes, token usage pie, and related logic into chat folder 2026-02-12 23:47:06 +03:00
Haileyesus
189b1533b2 refactor: reorganize chat view components and types 2026-02-12 23:47:06 +03:00
Haileyesus
7f45540dbe refactor: Restructure files and folders to better mimic feature-based architecture 2026-02-12 23:47:06 +03:00
Haileyesus
79d7934a4b refactor: replace individual provider logos with a unified SessionProviderLogo component 2026-02-12 23:47:05 +03:00
simosmik
d8e7a9e944 refactor: update readme and remove unusedfiles. 2026-02-12 23:47:05 +03:00
simosmik
5f0676bdb3 refactor(improvement):add memo on diffviewer, cleanup messsagecomponent 2026-02-12 23:47:05 +03:00
simosmik
905ae38bf5 refactor(design): change the design of tools and introduce todo list and task list. 2026-02-12 23:47:05 +03:00
simosmik
56a132d34e refactor(design): fix bash design and config 2026-02-12 23:47:05 +03:00
simosmik
060405c8d6 refactor(design): change the design of bash 2026-02-12 23:47:05 +03:00
simosmik
cbe4bd9adf fix: remove one-line logic from messagecomponent 2026-02-12 23:47:05 +03:00
simosmik
f9bd56c20f refactor: tool components 2026-02-12 23:47:05 +03:00
simosmik
c95aa04c85 refactor: tool components 2026-02-12 23:47:05 +03:00
Haileyesus
1d8b70f614 refactor(chat): split monolithic chat interface into typed modules and hooks
Replace the legacy monolithic ChatInterface.jsx implementation with a modular TypeScript architecture centered around a small orchestration component (ChatInterface.tsx).

Core architecture changes:
- Remove src/components/ChatInterface.jsx and add src/components/ChatInterface.tsx as a thin coordinator that wires provider state, session state, realtime WebSocket handlers, and composer behavior via dedicated hooks.
- Update src/components/MainContent.tsx to use typed ChatInterface directly (remove AnyChatInterface cast).

State ownership and hook extraction:
- Add src/hooks/chat/useChatProviderState.ts to centralize provider/model/permission-mode state, provider/session synchronization, cursor model bootstrap from backend config, and pending permission request scoping.
- Add src/hooks/chat/useChatSessionState.ts to own chat/session lifecycle state: session loading, cursor/claude/codex history loading, pagination, scroll restoration, visible-window slicing, token budget loading, persisted chat hydration, and processing-state restoration.
- Add src/hooks/chat/useChatRealtimeHandlers.ts to isolate WebSocket event processing for Claude/Cursor/Codex, including session filtering, streaming chunk buffering, session-created/pending-session transitions, permission request queueing/cancellation, completion/error handling, and session status updates.
- Add src/hooks/chat/useChatComposerState.ts to own composer-local state and interactions: input/draft persistence, textarea sizing and keyboard behavior, slash command execution, file mentions, image attachment/drop/paste workflow, submit/abort flows, permission decision responses, and transcript insertion.

UI modularization under src/components/chat:
- Add view/ChatMessagesPane.tsx for message list rendering, loading/empty states, pagination affordances, and thinking indicator.
- Add view/ChatComposer.tsx for composer shell layout and input area composition.
- Add view/ChatInputControls.tsx for mode toggles, token display, command launcher, clear-input, and scroll-to-bottom controls.
- Add view/PermissionRequestsBanner.tsx for explicit tool-permission review actions (allow once / allow & remember / deny).
- Add view/ProviderSelectionEmptyState.tsx for provider and model selection UX plus task starter integration.
- Add messages/MessageComponent.tsx and markdown/Markdown.tsx to isolate message rendering concerns, markdown/code rendering, and rich tool-output presentation.
- Add input/ImageAttachment.tsx for attachment previews/removal/progress/error overlay rendering.

Shared chat typing and utilities:
- Add src/components/chat/types.ts with shared types for providers, permission mode, message/tool payloads, pending permission requests, and ChatInterfaceProps.
- Add src/components/chat/utils/chatFormatting.ts for html decoding, code fence normalization, regex escaping, math-safe unescaping, and usage-limit text formatting.
- Add src/components/chat/utils/chatPermissions.ts for permission rule derivation, suggestion generation, and grant flow.
- Add src/components/chat/utils/chatStorage.ts for resilient localStorage access, quota handling, and normalized Claude settings retrieval.
- Add src/components/chat/utils/messageTransforms.ts for session message normalization (Claude/Codex/Cursor) and cached diff computation utilities.

Command/file input ergonomics:
- Add src/hooks/chat/useSlashCommands.ts for slash command fetching, usage-based ranking, fuzzy filtering, keyboard navigation, and command history persistence.
- Add src/hooks/chat/useFileMentions.tsx for project file flattening, @mention suggestions, mention highlighting, and keyboard/file insertion behavior.

TypeScript support additions:
- Add src/types/react-syntax-highlighter.d.ts module declarations to type-check markdown code highlighting imports.

Behavioral intent:
- Preserve existing chat behavior and provider flows while improving readability, separation of concerns, and future refactorability.
- Move state closer to the components/hooks that own it, reducing cross-cutting concerns in the top-level chat component.
2026-02-12 23:45:45 +03:00