Commit Graph

506 Commits

Author SHA1 Message Date
Haileyesus
7c1d2899fa refactor(ChatMessagesPane): use stable message key 2026-02-12 23:47:07 +03:00
Haileyesus
58002df5d9 refactor(QuickSettingsPanel): simplify state management by removing localIsOpen and using isOpen directly 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
7cabb3da9b refactor(useProjectsState): normalize refreshed session metadata to maintain provider stability; use getProjectSessions helper for session retrieval. 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
4f5212f93f refactor(dateUtils): update type annotation for formatTimeAgo function 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
d8fbea8681 refactor(ScrollArea): adjust ref placement and className order 2026-02-12 23:47:07 +03:00
Haileyesus
ae28b2d762 refactor(useSidebarController): manage project session overrides in local state 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
4d41bfd366 fix(watcher): ensure provider folders exist before creating watchers to maintain active watching 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
Haileyesus
ed44d5e437 fix: show auth url panel in shell only on mobile
- use static url: https://auth.openai.com/codex/device, for codex login.
- add an option for hiding the panel
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
fadbcc8259 fix(chat): stabilize long-history scroll-up pagination behavior
- fix top-pagination lockups by only locking when older messages are actually fetched
- make fetched older messages visible immediately by increasing `visibleMessageCount` on prepend
- prevent unintended auto-scroll-to-bottom during older-message loading and scroll restore
- replace state-based pagination offset with a ref to avoid stale offset/reload side effects
- ensure initial auto-scroll runs only after initial session load completes
- reset top-load lock/restore state and visible window when switching sessions
- loosen top-lock release near the top to avoid requiring a full down/up cycle
2026-02-12 23:47:06 +03:00
Haileyesus
fd5cced67f fix(chat): clear stuck loading state across realtime lifecycle events
The chat UI could remain in a stale "Thinking/Processing" state when session IDs
did not line up exactly between view state (`currentSessionId`), selected route
session, pending session IDs, and provider lifecycle events. This was most visible
with Codex completion/abort flows, but the same mismatch risk existed in shared
handlers.

Unify lifecycle cleanup behavior in realtime handlers and make processing tracking
key off the active viewed session identity.

Changes:
- src/hooks/chat/useChatRealtimeHandlers.ts
- src/components/ChatInterface.tsx
- src/hooks/chat/useChatSessionState.ts

What changed:
- Added shared helpers in realtime handling:
  - `collectSessionIds(...)` to normalize and dedupe candidate session IDs.
  - `clearLoadingIndicators()` to consistently clear `isLoading`, abort UI, and status.
  - `markSessionsAsCompleted(...)` to consistently notify inactive/not-processing state.
- Updated lifecycle branches to use shared cleanup logic:
  - `cursor-result`
  - `claude-complete`
  - `codex-response` (`turn_complete` and `turn_failed`)
  - `codex-complete`
  - `session-aborted`
- Expanded completion/abort cleanup to include all relevant session IDs
  (`latestMessage.sessionId`, `currentSessionId`, `selectedSession?.id`,
  `pendingSessionId`, and Codex `actualSessionId` when present).
- Switched processing-session marking in `ChatInterface` to use
  `selectedSession?.id || currentSessionId` instead of `currentSessionId` alone.
- Switched processing-session rehydration in `useChatSessionState` to use
  the same active-view session identity fallback.

Result:
- Prevents stale loading indicators after completion/abort when IDs differ.
- Keeps processing session bookkeeping aligned with the currently viewed session.
- Reduces provider-specific drift by using one lifecycle cleanup pattern.
2026-02-12 23:47:06 +03:00
Haileyesus
9524313363 fix: chat session scroll to bottom error even when scrolled up 2026-02-12 23:47:05 +03:00
Haileyesus
8bc3c17793 refactor(project-watcher): add codex and cursor file watchers 2026-02-12 23:47:05 +03:00
Haileyesus
1d081ae349 refactor(sidebar): update sessionMeta handling for session loading logic
- This fixes an issue where the sidebar was showing 6+ even when there were only 5 sessions, due to the hasMore logic not accounting for the case where there are exactly 6 sessions.
It was also showing "Show more sessions" even where there were no more sessions to load.

- This was because `hasMore` was sometimes `undefined` and the logic checked for hasMore !== false, which treated undefined as true.
Now we explicitly check for hasMore === true to determine if there are more sessions to load.
2026-02-12 23:47:05 +03:00
Haileyesus
72e1f538f7 fix(command-menu): correct slash command selection with frequent commands
When the “Frequently Used” section is visible, command clicks/hover could use a
UI-local index instead of the canonical `filteredCommands` index, causing the
wrong command to execute (e.g. clicking `/help` running `/clear`).

- map rendered menu items back to canonical command indices using a stable key
  (`name + namespace/type + path`)
- use canonical index for hover/click selection callbacks
- deduplicate frequent commands from other grouped sections to avoid duplicate
  rows and selection ambiguity
- keep and restore original inline comments, with clarifications where needed
2026-02-12 23:47:05 +03:00
Haileyesus
fa09eba829 fix(commands): restore /cost slash command and improve command execution errors
The /cost command was listed as built-in but had no handler, causing execution to
fall through to custom command logic and return 400 ("command path is required").

- Add a built-in /cost handler in server/routes/commands.js
- Return the expected payload shape for the chat UI (`action: "cost"`, token usage,
  estimated cost, model)
- Normalize token usage inputs and compute usage percentage
- Add provider-based default pricing for cost estimation
- Fix model selection in command execution context so codex uses `codexModel`
  instead of `claudeModel`
- Improve frontend command error handling by parsing backend error responses and
  showing meaningful error messages instead of a generic failure
2026-02-12 23:47:05 +03:00
Haileyesus
79d7934a4b refactor: replace individual provider logos with a unified SessionProviderLogo component 2026-02-12 23:47:05 +03:00
Haileyesus
8e411187f3 refactor(sidebar): move VersionUpgradeModal into SidebarModals 2026-02-12 23:47:05 +03:00
Haileyesus
a0bc4a8c72 refactor(sidebar): remove duplicate loading message in SidebarProjectsState 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
4d55945c5d fix(chat): make Stop and Esc reliably abort active sessions
Problem

Stop requests were unreliable because aborting depended on currentSessionId being set, Esc had no actual global abort binding, stale pending session ids could be reused, and abort failures were surfaced as successful interruptions. Codex sessions also used a soft abort flag without wiring SDK cancellation.

Changes

- Add global Escape key handler in chat while a run is loading/cancellable to trigger the same abort path as the Stop button.

- Harden abort session target selection in composer by resolving from multiple active session id sources (current, pending view, pending storage, cursor storage, selected session) and ignoring temporary new-session-* ids.

- Clear stale pendingSessionId when launching a brand-new session to prevent aborting an old run.

- Update realtime abort handling to respect backend success=false responses: keep loading state when abort fails and emit an explicit failure message instead of pretending interruption succeeded.

- Improve websocket send reliability by checking socket.readyState === WebSocket.OPEN directly before send.

- Implement real Codex cancellation via AbortController + runStreamed(..., { signal }), propagate aborted status, and suppress expected abort-error noise.

Impact

This makes both UI Stop and Esc-to-stop materially more reliable across Claude/Cursor/Codex flows, especially during early-session windows before currentSessionId is finalized, and prevents false-positive interrupted states when backend cancellation fails.

Validation

- npm run -s typecheck

- npm run -s build

- node --check server/openai-codex.js
2026-02-12 23:45:45 +03:00
Haileyesus
89334cda4e perf(project-loading): eliminate repeated Codex session rescans and duplicate cursor fetches
The staged changes remove the main source of project-load latency by avoiding repeated full scans of ~/.codex/sessions for every project and by removing redundant client-side cursor session refetches.

Server changes (server/projects.js):\n- Add a per-request Codex index reference in getProjects so Codex metadata is built once and reused across all projects, including manually added ones.\n- Introduce normalizeComparablePath() to canonicalize project paths (including Windows long-path prefixes and case-insensitive matching on Windows).\n- Introduce findCodexJsonlFiles() + buildCodexSessionsIndex() to perform a single recursive Codex scan and group sessions by normalized cwd.\n- Update getCodexSessions() to accept indexRef and read from the prebuilt index, with fallback index construction when no ref is provided.\n- Preserve existing session limiting behavior (limit=5 default, limit=0 returns all).

Client changes (src/hooks/useProjectsState.ts):\n- Remove loadCursorSessionsForProjects(), which previously triggered one extra /api/cursor/sessions request per project after /api/projects.\n- Use /api/projects response directly during initial load and refresh.\n- Expand projectsHaveChanges() to treat both cursorSessions and codexSessions as external session deltas.\n- Keep refresh comparison aligned with external session updates by using includeExternalSessions=true in sidebar refresh path.

Impact:\n- Reduces backend work from roughly O(projects * codex_session_files) to O(codex_session_files + projects) for Codex discovery during a project load cycle.\n- Removes an additional client-side O(projects) network fan-out for Cursor session fetches.\n- Improves perceived and actual sidebar project-loading time, especially in large session datasets.
2026-02-12 23:45:45 +03:00