Commit Graph

524 Commits

Author SHA1 Message Date
Haileyesus
705ae39746 fix(shell): simplify session disconnect logic in useEffect 2026-02-24 14:32:52 +03:00
Haileyesus
12a336bf7d fix(shell): improve ANSI escape regex 2026-02-24 14:24:49 +03:00
Haileyesus
ff084ae44c refactor(tasks): localize duplicate PRD loading logic into helper function 2026-02-24 14:22:01 +03:00
Haileyesus
551d7c7fd0 fix(shell): rename selection property in terminal options 2026-02-24 14:20:36 +03:00
Haileyesus
4dbe4fa1b2 fix(settings): mask sensitive information in environment variables 2026-02-24 14:19:38 +03:00
Haileyesus
57f715fec5 fix(git-panel): add keyboard handling for Escape key for confirm action modal 2026-02-24 14:13:05 +03:00
Haileyesus
d08a5d2dcc fix(chat): remove unnecessary conditional styles from CommandMenu 2026-02-24 14:11:16 +03:00
Haileyesus
e20ee2828d fix(settings): inline MCP delete errors and stabilize save-close timer
Replace blocking alert() calls in MCP delete handlers with non-blocking deleteError state updates and setSaveStatus('error') on failure.

Thread deleteError through Settings -> Agents settings views and render inline error feedback in Claude/Codex MCP sections near delete actions.

Prevent orphaned save-close timers by clearing and nulling closeTimerRef before scheduling a new timeout, and by nulling the ref during unmount cleanup.
2026-02-24 14:05:30 +03:00
Haileyesus
f59f40d0f9 fix(git=panel): escape now works for closing new branch modal 2026-02-24 14:02:40 +03:00
Haileyesus
af283e7dfd fix(git-panel): add role and aria attributes for accessibility 2026-02-24 13:57:12 +03:00
Haileyesus
b398bc908f fix(git-panel): simplify project name checks and improve error handling in initial commit 2026-02-24 13:52:09 +03:00
Haileyesus
f417fc05c7 fix(code-editor): handle missing project identifier in useCodeEditorDocument 2026-02-24 13:48:59 +03:00
Haileyesus
cc0dba435e fix(code-editor): escape HTML in toolbar labels for security 2026-02-24 13:47:01 +03:00
Haileyesus
a04eec409c fix(chat): ensure onSelect is called only for valid command indices 2026-02-24 13:45:24 +03:00
Haileyesus
fa8eeabc30 fix(settings): add role and aria attributes for accessibility 2026-02-24 13:32:50 +03:00
simosmik
e5192dd153 Merge main into refactor/settings: add install mode detection (#418)
Resolves merge conflict in VersionUpgradeModal.tsx — combines PR #402's
file relocation and copyTextToClipboard utility with the installMode
feature from main that detects git vs npm installs and shows the
correct upgrade command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 22:33:55 +00:00
simosmik
4f6ff9260d Release 1.20.1 v1.20.1 2026-02-23 22:23:33 +00:00
viper151
49061bc7a3 Update DEFAULT model version to gpt-5.3-codex (#426) 2026-02-23 23:13:50 +01:00
simosmik
50e097d4ac feat: migrate legacy database to new location and improve last login update handling 2026-02-23 22:12:00 +00:00
simosmik
f986004319 feat: implement install mode detection and update commands in version upgrade process 2026-02-23 21:55:53 +00:00
simosmik
f488a346ef Release 1.19.1 v1.19.1 2026-02-23 21:29:06 +00:00
simosmik
82efac4704 fix: add prepublishOnly script to build before publishing 2026-02-23 21:27:45 +00:00
viper151
81697d0e73 Update DEFAULT model version to gpt-5.3-codex (#417) 2026-02-23 16:51:29 +01:00
simosmik
27bf09b0c1 Release 1.19.0 v1.19.0 2026-02-23 11:56:33 +00:00
Haileyesus
052c770395 fix(shell): resize and copy fixes 2026-02-23 11:56:56 +03:00
Haileyesus
3ce0086761 fix(shell): remove unnecessary attributes from window.open for auth URL 2026-02-23 11:53:11 +03:00
Haileyesus
ffafb6fee6 fix(shell): use socket directly 2026-02-23 11:51:07 +03:00
Haileyesus
63dc3ce019 fix(git-panel): add error handling for commit diff fetch 2026-02-23 11:47:29 +03:00
Haileyesus
e2951b66fa fix(git-panel): improve commit expansion logic and fetch diff condition 2026-02-23 11:46:04 +03:00
Haileyesus
3a8741b32d fix(git-panel): add error handling for branch switch and fetch operations 2026-02-23 11:44:29 +03:00
Haileyesus
28950a5b24 fix(api-settings): add aria-label for token visibility toggle button 2026-02-23 11:42:41 +03:00
Haileyesus
cc9ad433f2 chore: remove unused imports 2026-02-23 11:38:42 +03:00
Haileyesus
7685144b0c fix(markdown-preview): disable raw HTML rendering in preview
Issue
- Markdown preview used rehype-raw, which interprets raw HTML from document content.
- For untrusted markdown (user files, copied LLM output), this could allow script-capable HTML payloads to execute in preview.

Change
- Removed rehypeRaw from MarkdownPreview.
- Kept rehype-katex enabled so math rendering still works.
- Result: raw HTML is no longer interpreted as DOM; it is treated as markdown text.

Reproduction (before fix)
1. Open/create any .md file in the code editor.
2. Add: <iframe srcdoc="<script>parent.alert('xss')</script>"></iframe>
3. Toggle Markdown Preview.
4. Observe script execution (alert) in vulnerable behavior.

Expected after fix
- The same payload does not execute; raw HTML is not rendered as active DOM.

Validation
- npm run typecheck (passes).
2026-02-23 11:17:02 +03:00
Haileyesus
2ec1a72485 fix: close editor on Escape key press 2026-02-23 11:08:27 +03:00
Haileyesus
711a2c7cf7 fix(shell): prevent duplicate websocket connects with synchronous lock
The shell connection hook relied on React state (isConnecting/isConnected) as the only guard for connect attempts. Because state updates are asynchronous, rapid connect triggers could race before isConnecting became true and create duplicate WebSocket instances.

This change adds a synchronous ref lock (connectingRef) that is checked immediately in connectToShell and connectWebSocket. connectToShell now sets connectingRef.current = true before invoking connectWebSocket so concurrent calls cannot pass between state updates.

connectWebSocket now:
- returns early when a connection is already locked
- sets connectingRef.current = true when creating a socket
- clears connectingRef.current alongside setIsConnecting(false) in onopen, onclose, onerror, and catch
- clears connectingRef.current when no WebSocket URL is available

disconnectFromShell also resets connectingRef to keep lock/state behavior consistent across manual disconnect flows.
2026-02-23 10:58:37 +03:00
Haileyesus
c025f27036 fix(settings): make MCP edits create-first to avoid data loss
The previous edit flow deleted the existing MCP server before attempting to add the replacement entry. If add failed (CLI error, validation, transport, duplicate handling), the original entry was already gone, causing destructive data loss from an edit action.

This change makes both save flows non-destructive:
- saveMcpServer now posts /api/mcp/cli/add first.
- saveCodexMcpServer now posts /api/codex/mcp/cli/add first.
- Old entry deletion only happens after successful create.
- Old-entry deletion runs only when identity actually changed (name and for Claude scope).
- Cleanup delete failures are caught and logged (console.warn) instead of failing the save.

Result: editing is atomic from caller perspective with respect to create failures, and resilient to cleanup failures.
2026-02-23 10:51:15 +03:00
Haileyesus
1bdee2c1fc fix(settings): add role and aria attributes for accessibility in SettingsMainTabs 2026-02-23 10:48:09 +03:00
Haileyesus
2ed5348cf5 fix(git-panel): show fetch button when remote is diverged 2026-02-23 10:45:16 +03:00
Haileyesus
dad3ed6d86 fix(git-panel): handle promise rejection in branch creation and return success status 2026-02-23 10:37:28 +03:00
Haileyesus
f1fd9b2f87 fix: convert div to button for better accessibility in commit history item 2026-02-23 10:35:43 +03:00
Haileyesus
dc58cc9d5c refactor(git-panel): centralize commit flow in handleCommit 2026-02-23 10:19:16 +03:00
Haileyesus
dd11345e09 fix: reset copy state after copying in MarkdownCodeBlock component
There were 2 issues.

The copy state was not being reset after copying, which caused the
"Copied!" message to persist indefinitely.

The return value from the copy function was not being used to determine
if the copy was successful. Even on false(i.e. copy unsuccessful), the user would see a success message.
2026-02-23 10:16:03 +03:00
Haileyesus
30c5da8984 fix(git-panel): prevent stale project-switch updates and remove blocking initial-commit alerts
Problem
Git panel status/diff requests could resolve after the user switched projects and still write into state (`gitStatus`, `gitDiff`, `currentBranch`), causing cross-project UI corruption. Also, `createInitialCommit` used `window.alert` on failure, which blocks the UI and prevents centralized error handling.

Root cause
`fetchGitStatus` and `fetchFileDiff` captured `selectedProject` in async callbacks without request cancellation or project-identity guards. The project-change reset effect did not abort in-flight status/diff fetches. `createInitialCommit` handled failures with alerts instead of thrown errors.

Changes
- Added a per-session `AbortController` in the project-reset `useEffect`, and abort on cleanup.
- Passed `AbortSignal` through status/diff flow:
  - `fetchGitStatus(signal)` -> `fetchWithAuth(..., { signal })` + `readJson(..., signal)`
  - `fetchFileDiff(filePath, signal)` -> `fetchWithAuth(..., { signal })` + `readJson(..., signal)`
- Captured `projectName` at the start of each async function and skipped state setters when:
  - `signal.aborted`, or
  - current selected project name differs from captured project name.
- Added abort-aware JSON parsing helper and ignored `AbortError` noise in catch paths.
- Removed `alert(...)` from `createInitialCommit`.
- On API failure now throws:
  - `new Error(data.error || 'Failed to create initial commit')`
- In catch now rethrows normalized error:
  - `new Error(error?.message || 'Failed to create initial commit')`
- Kept existing success refresh behavior (`fetchGitStatus`, `fetchRemoteStatus`) and `setIsCreatingInitialCommit(false)` in `finally`.

Result
- Stale status/diff responses from prior projects are ignored and do not corrupt current project UI.
- Initial commit failures no longer block the UI; callers can surface errors via toast/notification.
2026-02-23 10:11:55 +03:00
Haileyesus
a08601df60 fix(file-tree): clear loading when selected project is removed mid-fetch
Problem

The file tree hook returned early when selectedProject?.name became falsy, but only cleared files. If a fetch had already set loading=true and was then aborted by cleanup, that early return path could leave loading stuck true.

Root cause

The !projectName branch in useFileTreeData exited before setting loading=false, while the in-flight request's finally block was guarded by isActive and therefore skipped after cleanup marked isActive=false.

Change

- Updated the early-return path to call setLoading(false) immediately before returning.

- Kept existing abortController cleanup behavior unchanged.

- Kept existing isActive guards in try/catch/finally unchanged.

Result

Clearing the selected project now deterministically resets loading state, preventing stale loading UI after project deletion/clear during an in-flight file-tree fetch.
2026-02-23 10:02:53 +03:00
Haileyesus
7dae488926 fix: convert fontSize type from String to Number 2026-02-23 09:52:39 +03:00
Haileyesus
f1eca2f14d fix(code-editor): clamp diff nav index after chunk recompute
`editorToolbarPanel` keeps `currentIndex` as local state while diff chunks are
recomputed from `getChunks(view.state)` on each `updatePanel()` call.

When the diff shrank (for example after resolving edits), `currentIndex` could
remain greater than `chunkCount - 1`. That caused two user-facing issues:
- The counter could render impossible values like `4/2 changes`.
- Prev/next handlers could read `chunks[currentIndex]` as `undefined`, so
  navigation would fail to scroll to a valid chunk.

Repro in UI:
1. Open a file with multiple diff chunks.
2. Navigate to a high chunk index using Next.
3. Edit content so the number of chunks decreases.
4. Observe stale index in the counter and broken nav behavior.

Fix:
- After recomputing chunks, clamp the index immediately:
  `currentIndex = Math.max(0, Math.min(currentIndex, Math.max(0, chunkCount - 1)))`
- Keep all downstream uses (counter rendering and prev/next logic) based on the
  clamped index.

Result:
- Counter always stays within valid bounds.
- Navigation never references an out-of-range chunk.
- Zero-chunk behavior remains intact (counter and disabled buttons).

File:
- src/components/code-editor/utils/editorToolbarPanel.ts
2026-02-23 09:48:15 +03:00
Haileyesus
4178ccdd5e fix(code-editor): stabilize document loading deps and replace blocking save alerts
The code editor document hook was reloading more often than necessary because
`useEffect` depended on the full `file` object (and `projectPath`, which was not
used in the effect body). Save flow also emitted verbose production debug logs
and used a blocking `alert()` for errors.

Changes:
- Refactored `useCodeEditorDocument` to derive stable file primitives:
  `fileProjectName`, `filePath`, `fileName`, `fileDiffNewString`,
  `fileDiffOldString`.
- Updated `loadFileContent` to use those stable fields while preserving existing
  diff-first loading logic (`file.diffInfo`, `new_string`, `old_string`).
- Replaced the effect dependency array with only stable primitive values used by
  the effect and removed `projectPath` from dependencies.
- Removed debug `console.log` calls in `handleSave`:
  - "Saving file:"
  - "Save response:"
  - "Save successful:"
- Kept error logging via `console.error` for failure diagnostics.
- Replaced blocking `alert()` on save failure with non-blocking UI feedback:
  - Added local `saveError` state in the hook.
  - Set `saveError` from `getErrorMessage(error)` in the save catch path.
  - Exposed `saveError` to `CodeEditor` and rendered an inline error banner.
- Preserved save lifecycle behavior:
  - `setSaving(false)` still runs in `finally`.
  - `setSaveSuccess(true)` and 2s timeout reset behavior remain unchanged.
2026-02-23 09:35:59 +03:00
Haileyesus
c6f752a096 fix: reset copy state after copying in Markdown component
There were 2 issues.
1. The copy state was not being reset after copying, which caused the
"Copied!" message to persist indefinitely.

2. The return value from the copy function was not being used to determine
if the copy was successful. Even on `false`(i.e. copy unsuccessful), the user would see
a success message.
2026-02-23 09:24:32 +03:00
Haileyesus
8617db24b6 fix: remove <style> block from CommandMenu component and use tailwind classes instead
- @media (prefers-color-scheme: dark) only responds to the user's system
preference for dark mode, so it will apply the dark mode styles when the
user has enabled dark mode on their device and Not when the user toggles
the dark mode in the app. So, it's better to use tailwind's dark mode
classes instead.
2026-02-23 09:18:53 +03:00
Haileyesus
d486ff91a2 Fix session processing state leaking across session switches
Root cause:
- Processing ownership was derived from UI view state in ChatInterface.
- While switching sessions, an in-flight isLoading=true could stamp the newly selected session as processing, even if a different session was actually running.
- session-status handling only promoted isProcessing=true and did not clear stale processing state on isProcessing=false, which could leave sessions blocked.
Changes:
- ChatInterface: removed implicit processing propagation effect that called onSessionProcessing(selectedSession?.id || currentSessionId) when isLoading was true.
  This decouples processing ownership from transient view/session transitions.
- useChatComposerState: added onSessionProcessing callback usage and explicitly marks processing at submit time for the concrete effectiveSessionId (non-temporary IDs only).
  This ties processing to the session that actually started work.
- useChatRealtimeHandlers: expanded session-status handling to support both states.
  - isProcessing=true: mark session as processing; set loading/abort only when it is the currently viewed session.
  - isProcessing=false: clear active+processing markers and clear loading indicators for the current session view.
Behavioral outcome:
- Running session A no longer blocks session B after navigation.
- Users can work in multiple sessions concurrently, and processing badges/loading state stay session-scoped.
Verification:
- npm run typecheck
- npm run build
2026-02-23 09:14:01 +03:00