Commit Graph

195 Commits

Author SHA1 Message Date
Haileyesus
b09ce9dc60 refactor: add mcp and skills to llmService
- Deleted the llmSkillsService implementation and its associated methods
for listing provider skills.
- Updated tests to use llmService instead of llmMcpService and
llmSkillsService for handling MCP and skills functionalities.
- Adjusted test cases to reflect the new service structure while
maintaining existing functionality.
2026-04-07 13:24:01 +03:00
Haileyesus
cb3304b60c refactor: add abort signal support to conversation search and update API endpoint 2026-04-07 13:23:00 +03:00
Haileyesus
995a8cadb7 refactor: move assets to its own service 2026-04-07 13:01:26 +03:00
Haileyesus
ed0a895d75 refactor: remove session model and thinking mode management from providers and related services 2026-04-07 11:56:28 +03:00
Haileyesus
5a1bcb4931 refactor: simplify provider type casting in session message normalization 2026-04-07 11:52:49 +03:00
Haileyesus
5b69af528a refactor: update session status only if not stopped by user after stream completion 2026-04-06 23:17:22 +03:00
Haileyesus
db9ab26c3c refactor: remove waitForSession functionality from providers and related services 2026-04-06 23:14:19 +03:00
Haileyesus
7cd429697b refactor: optimize CodexProvider to use a shared SDK client instance 2026-04-06 22:58:10 +03:00
Haileyesus
f576b8e6d2 fix: on file update, no directory rescan is needed 2026-04-06 22:18:08 +03:00
Haileyesus
28aa5a3902 refactor: move services and tests to their own folders 2026-04-06 20:28:32 +03:00
Haileyesus
28a523b7a3 feat: add chat unifier setup 2026-04-06 20:12:07 +03:00
Haileyesus
8354cb65fd feat(backend): setup mcp, image upload, and skills 2026-04-06 19:36:28 +03:00
Haileyesus
6d00c17137 feat: setup unified classes for LLM providers and session processing, add tests for LLM unifier helper functions 2026-04-06 17:37:58 +03:00
Haileyesus
753c58fc1a feat: add jsonlPath to session data and database schema 2026-04-06 11:47:45 +03:00
Haileyesus
49de006313 feat: update Gemini session processing to support new file structure and formats 2026-03-30 16:38:15 +03:00
Haileyesus
dfe9c75cfd refactor: setup sidebar workspace and session list 2026-03-30 15:48:20 +03:00
Haileyesus
e165d2ca24 feat: setup delete session by id 2026-03-28 11:30:36 +03:00
Haileyesus
ce0dfad638 refactor: remove sessions names db 2026-03-28 11:06:37 +03:00
Haileyesus
6cfe617711 refactor: setup project wizards with only three steps 2026-03-27 22:16:56 +03:00
Haileyesus
ec70bfe7c7 fix: load env variables correctly 2026-03-27 21:04:40 +03:00
Haileyesus
fa05683861 feat: use cross-spawn 2026-03-27 20:55:30 +03:00
Haileyesus
ab72270ada feat(backend): use cross-spawn fir projects.routes.ts 2026-03-27 20:52:17 +03:00
Haileyesus
90d234d9f3 refactor(backend): move db repos to typescript and update imports 2026-03-27 20:10:01 +03:00
Haileyesus
33cea381c4 refactor(backend): move remaining routes declared in index.js to thier own module 2026-03-27 18:53:30 +03:00
Haileyesus
f77301e844 refactor(backend): move every route to its own module 2026-03-27 18:26:30 +03:00
Haileyesus
9a8178e9ca refactor(backend): move user routes to a module; add packages for cross-spawn types 2026-03-26 14:12:04 +03:00
Haileyesus
1abdb95207 chore: remove a console log 2026-03-26 13:51:17 +03:00
Haileyesus
45bc53c68f refactor(backend): move auth routes to a module 2026-03-26 13:51:01 +03:00
Haileyesus
24abcef110 feat(db): add custom workspace name 2026-03-26 13:19:51 +03:00
Haileyesus
85364e0234 refactor: added express middlewares 2026-03-25 21:34:09 +03:00
Haileyesus
63c4bbd2b8 refactor: migrate express middlewares 2026-03-25 17:33:23 +03:00
Haileyesus
57d6ae59de refactor: rename session parser functions; move sessionData to a shared type 2026-03-25 11:22:56 +03:00
Haileyesus
3b7a9d35c2 refactor: move session parsing and file watcher logic to specific folders 2026-03-25 11:22:55 +03:00
Haileyesus
3e268e201a feat: implement basic file watcher and session updater 2026-03-25 11:22:54 +03:00
Haileyesus
f187e22976 fix: correct path to .env file in load-env-vars configuration 2026-03-25 11:22:53 +03:00
Haileyesus
bbb461f7c2 refactor(backend): add refactored runner for new backend architecture 2026-03-25 11:22:53 +03:00
Haileyesus
7df21556dd refactor: add cross-platform utility functions 2026-03-25 11:22:52 +03:00
Haileyesus
23c39a42b1 fix: update legacy runtime path
- Changed the legacy runtime path from 'legacy-runtime.js' to 'index.js'
in runtime configuration.
- Added a new start script (start.js) to check for the existence of the
built TypeScript server entrypoint and import it.
2026-03-25 11:22:51 +03:00
Haileyesus
695da128f3 refactor: restructure db logic and add import alias using tsc-alias
Note: the legacy githubTokensDb migration is not included in this commit.
It's used only in `agents.js` and will be removed in a future commit. We
will directly use credentials repository instead of github tokens repository.
2026-03-25 11:22:50 +03:00
Haileyesus
e67738c9fc refactor: bare structure for new backend architecture and runtime; no behavior changes yet 2026-03-25 11:22:49 +03:00
Simos Mikelatos
a4632dc4ce feat: unified message architecture with provider adapters and session store (#558)
- Add provider adapter layer (server/providers/) with registry pattern
    - Claude, Cursor, Codex, Gemini adapters normalize native formats to NormalizedMessage
    - Shared types.js defines ProviderAdapter interface and message kinds
    - Registry enables polymorphic provider lookup

  - Add unified REST endpoint: GET /api/sessions/:id/messages?provider=...
    - Replaces four provider-specific message endpoints with one
    - Delegates to provider adapters via registry

  - Add frontend session-keyed store (useSessionStore)
    - Per-session Map with serverMessages/realtimeMessages/merged
    - Dedup by ID, stale threshold for re-fetch, background session accumulation
    - No localStorage for messages — backend JSONL is source of truth

  - Add normalizedToChatMessages converter (useChatMessages)
    - Converts NormalizedMessage[] to existing ChatMessage[] UI format

  - Wire unified store into ChatInterface, useChatSessionState, useChatRealtimeHandlers
    - Session switch uses store cache for instant render
    - Background WebSocket messages routed to correct session slot
2026-03-19 16:45:06 +03:00
Simos Mikelatos
612390db53 feat(refactor): move plugins to typescript (#557)
* feat(refactor): move plugins to typescript

* chore: add timeout to plugin build function
2026-03-18 16:44:07 +03:00
Simos Mikelatos
88c60b70b0 feat: add WebSocket proxy for plugin backends (#553)
* feat: add WebSocket proxy for plugin backends

Adds /plugin-ws/:name route that proxies authenticated WebSocket
connections to plugin server subprocesses, enabling real-time
bidirectional communication for plugins like web-terminal.

* chore: update README with the plugin
2026-03-18 16:43:25 +03:00
Haile
d6133ba2ad Improve dev host handling and clarify backend port configuration (#532)
* fix: remove --host from npm run server command

Running `vite --host` exposes the dev server on all interfaces. However,
we should expose it on all interfaces only when `HOST` is set to `0.0.0.0`.
Otherwise, we should assume the user wants to bind to a host of their choice
and not expose the server on the network.

* fix: use src hostname for redirecting to Vite in development

Previously, the server redirected to Vite using `localhost` as the hostname.
Even if the user was using HOST="0.0.0.0", if they connected to server from
another device on the same network using `http://<host_ip>:3001`, the
server would redirect them to `http://localhost:5173`, which would not
work since `localhost` would resolve to the client's machine instead of the server.

* fix: use shared network hosts configuration for better proxy setup

- Normalize all localhost variants to 'localhost' for consistent proxy
configuration in Vite and server setup.
- use one source of truth for network hosts functions by moving them to
a shared
- log production and development urls

* refactor: rename PORT to SERVER_PORT for clarity

* chore: add comments explaining host normalization

* fix: add legacy PORT env fallback for server port configuration

* fix: add fallback for SERVER_PORT using PORT environment variable

---------

Co-authored-by: Haileyesus <something@gmail.com>
Co-authored-by: Simos Mikelatos <simosmik@gmail.com>
2026-03-16 12:40:01 +01:00
Luc Peng
95bcee0ec4 fix: detect Claude auth from settings env (#527)
- detect Claude auth from ~/.claude/settings.json env values
- treat ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN from settings as authenticated
- keep existing .credentials.json OAuth detection unchanged
2026-03-13 20:22:09 +03:00
Simos Mikelatos
45e71a0e73 feat: introduce notification system and claude notifications (#450)
* feat: introduce notification system and claude notifications

* fix(sw): prevent caching of API requests and WebSocket upgrades

* default to false for webpush notifications and translations for the button

* fix: notifications orchestrator and add a notification when  first enabled

* fix: remove unused state update and dependency in settings controller hook

* fix: show notifications settings tab

* fix: add notifications for response completion for all providers

* feat: show session name in notification and don't reload tab on clicking
--- the notification

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Haileyesus <something@gmail.com>
2026-03-13 18:59:09 +03:00
Simos Mikelatos
adb3a06d7e feat: git panel redesign (#535)
* feat(git-panel): add Branches tab, Fetch always visible, inline error banners

- Add dedicated Branches tab (local/remote sections, switch with confirmation, delete branch, create branch)
- Rename History tab to Commits; add change-count badge on Changes tab
- Fetch button always visible when remote exists (not only when both ahead & behind)
- Inline error banner below header for failed push/pull/fetch, with dismiss button
- Server: /api/git/branches now returns localBranches + remoteBranches separately
- Server: add /api/git/delete-branch endpoint (prevents deleting current branch)
- Controller: expose operationError, clearOperationError, deleteBranch, localBranches, remoteBranches
- Constants: add deleteBranch to all ConfirmActionType record maps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: git log datetime

* feat(git-panel): add staged/unstaged sections and enhanced commit details

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Haile <118998054+blackmammoth@users.noreply.github.com>
2026-03-13 17:38:53 +03:00
simosmik
b9c902b016 fix(security): disable executable gray-matter frontmatter in commands 2026-03-11 22:04:38 +00:00
Haile
a77f213dd5 fix: numerous bugs (#528)
* fix(shell): copy terminal selections from xterm buffer

The shell was delegating Cmd/Ctrl+C to document.execCommand('copy'),
which copied the rendered DOM selection instead of xterm's logical
buffer text. Wrapped values like login URLs could pick up row
whitespace or line breaks and break when pasted.

Route keyboard copy through terminal.getSelection() and the shared
clipboard helper. Also intercept native copy events on the terminal
container so mouse selection and browser copy actions use the same
normalized terminal text.

Remove the copy listener during teardown to avoid leaking handlers
across terminal reinitialization.

* fix(shell): restore terminal focus when switching to the shell tab

Pass shell activity state from MainContent through StandaloneShell and use it
inside Shell to explicitly focus the xterm instance once the terminal is both
initialized and connected.

Previously, switching to the Shell tab left focus on the tab button because
isActive was being ignored and the terminal never called focus() after the tab
activation lifecycle completed. As a result, users had to click inside the
terminal before keyboard input would be accepted.

This change wires isActive through the shell stack, removes the unused prop
handling in Shell, and adds a focus effect that runs when the shell becomes
active and ready. The effect uses both requestAnimationFrame and a zero-delay
timeout so focus is applied reliably after rendering and connection state
updates settle.

This restores immediate typing when opening the shell tab and also improves the
reconnect path by re-focusing the terminal after the shell connection is ready.

* fix(shell): remove fallback command for codex and claude session resumes

The `|| claude` and `|| codex` fallback commands were causing errors as they are not valid commands.

* fix: use fallback while resuming codex and claude sessions for linux and windows

* feat(git): add revert latest local commit action in git panel

Add a complete revert-local-commit flow so users can undo the most recent
local commit directly from the Git header, placed before the refresh icon.

Backend
- add POST /api/git/revert-local-commit endpoint in server/routes/git.js
- validate project input and repository state before executing git operations
- revert latest commit with `git reset --soft HEAD~1` to keep changes staged
- handle initial-commit edge case by deleting HEAD ref when no parent exists
- return clear success and error responses for UI consumption

Frontend
- add useRevertLocalCommit hook to encapsulate API call and loading state
- wire hook into GitPanel and refresh git data after successful revert
- add new toolbar action in GitPanelHeader before refresh icon
- route action through existing confirmation modal flow
- disable action while request is in flight and show activity indicator

Shared UI and typing updates
- extend ConfirmActionType with `revertLocalCommit`
- add confirmation title, label, and style mappings for new action
- render RotateCcw icon for revert action in ConfirmActionModal

Result
- users can safely undo the latest local commit from the UI
- reverted commit changes remain staged for immediate recommit/edit workflows

* fix: run cursor with --trust if workspace trust prompt is detected, and retry once

* fix(git): handle repositories without commits across status and remote flows

Improve git route behavior for repositories initialized with `git init` but with
no commits yet. Previously, several routes called `git rev-parse --abbrev-ref HEAD`,
which fails before the first commit and caused noisy console errors plus a broken
Git panel state.

What changed
- add `getGitErrorDetails` helper to normalize git process failure text
- add `isMissingHeadRevisionError` helper to detect no-HEAD/no-revision cases
- add `getCurrentBranchName` helper:
  - uses `git symbolic-ref --short HEAD` first (works before first commit)
  - falls back to `git rev-parse --abbrev-ref HEAD` for detached HEAD and edge cases
- add `repositoryHasCommits` helper using `git rev-parse --verify HEAD`

Status route improvements
- replace inline branch/HEAD error handling with shared helpers
- keep returning valid branch + `hasCommits: false` for fresh repositories

Remote status improvements
- avoid hard failure when repository has no commits
- return a safe, non-error payload with:
  - `hasUpstream: false`
  - `ahead: 0`, `behind: 0`
  - detected remote name when remotes exist
  - message: "Repository has no commits yet"
- preserve existing upstream detection behavior for repositories with commits

Consistency updates
- switch fetch/pull/push/publish branch lookup to shared `getCurrentBranchName`
  to ensure the same branch-resolution behavior everywhere

Result
- `git init` repositories no longer trigger `rev-parse HEAD` ambiguity failures
- Git panel remains usable before the first commit
- backend branch detection is centralized and consistent across git operations

* fix(git): resolve file paths against repo root for paths with spaces

Fix path resolution for git file operations when project directories include spaces
or when API calls are issued from subdirectories inside a repository.

Problem
- operations like commit/discard/diff could receive file paths that were valid from
  repo root but were executed from a nested cwd
- this produced pathspec errors like:
  - warning: could not open directory '4/4/'
  - fatal: pathspec '4/hello_world.ts' did not match any files

Root cause
- file arguments were passed directly to git commands using the project cwd
- inconsistent path forms (repo-root-relative vs cwd-relative) were not normalized

Changes
- remove unsafe fallback decode in `getActualProjectPath`; fail explicitly when the
  real project path cannot be resolved
- add repository/file-path helpers:
  - `getRepositoryRootPath`
  - `normalizeRepositoryRelativeFilePath`
  - `parseStatusFilePaths`
  - `buildFilePathCandidates`
  - `resolveRepositoryFilePath`
- update file-based git endpoints to resolve paths before executing commands:
  - GET `/diff`
  - GET `/file-with-diff`
  - POST `/commit`
  - POST `/generate-commit-message`
  - POST `/discard`
  - POST `/delete-untracked`
- stage/restore/reset operations now use `--` before pathspecs for safer argument
  separation

Behavioral impact
- git operations now work reliably for repositories under directories containing spaces
- file operations are consistent even when project cwd is a subdirectory of repo root
- endpoint responses continue to preserve existing payload shapes

Verification
- syntax check: `node --check server/routes/git.js`
- typecheck: `npm run typecheck`
- reproduced failing scenario in a temp path with spaces; confirmed root-resolved
  path staging succeeds where subdir-cwd pathspec previously failed

* fix(git-ui): prevent large commit diffs from freezing the history tab

Harden commit diff loading/rendering so opening a very large commit no longer hangs
the browser tab.

Problem
- commit history diff viewer rendered every diff line as a React node
- very large commits could create thousands of nodes and lock the UI thread
- backend always returned full commit patch payloads, amplifying frontend pressure

Backend safeguards
- add `COMMIT_DIFF_CHARACTER_LIMIT` (500,000 chars) in git routes
- update GET `/api/git/commit-diff` to truncate oversized diff payloads
- include `isTruncated` flag in response for observability/future UI handling
- append truncation marker text when server-side limit is applied

Frontend safeguards
- update `GitDiffViewer` to use bounded preview rendering:
  - character cap: 200,000
  - line cap: 1,500
- move diff preprocessing into `useMemo` for stable, one-pass preview computation
- show a clear "Large diff preview" notice when truncation is active

Impact
- commit diff expansion remains responsive even for high-change commits
- UI still shows useful diff content while avoiding tab lockups
- changes apply to shared diff viewer usage and improve resilience broadly

Validation
- `node --check server/routes/git.js`
- `npm run typecheck`
- `npx eslint src/components/git-panel/view/shared/GitDiffViewer.tsx`

* fix(cursor-chat): stabilize first-run UX and clean cursor message rendering

Fix three Cursor chat regressions observed on first message runs:

1. Full-screen UI refresh/flicker after first response.
2. Internal wrapper tags rendered in user messages.
3. Duplicate assistant message on response finalization.

Root causes
- Project refresh from chat completion used the global loading path,
  toggling app-level loading UI.
- Cursor history conversion rendered raw internal wrapper payloads
  as user-visible message text.
- Cursor response handling could finalize through overlapping stream/
  result paths, and stdout chunk parsing could split JSON lines.

Changes
- Added non-blocking project refresh plumbing for chat/session flows.
- Introduced fetch options in useProjectsState (showLoadingState flag).
- Added refreshProjectsSilently() to update metadata without global loading UI.
- Wired window.refreshProjects to refreshProjectsSilently in AppContent.

- Added Cursor user-message sanitization during history conversion.
- Added extractCursorUserQuery() to keep only <user_query> payload.
- Added sanitizeCursorUserMessageText() to strip internal wrappers:
  <user_info>, <agent_skills>, <available_skills>,
  <environment_context>, <environment_info>.
- Applied sanitization only for role === 'user' in
  convertCursorSessionMessages().

- Hardened Cursor backend stream parsing and finalization.
- Added line-buffered stdout parser for chunk-split JSON payloads.
- Flushed trailing unterminated stdout line on process close.
- Removed redundant content_block_stop emission on Cursor result.

- Added frontend duplicate guard in cursor-result handling.
- Skips a second assistant bubble when final result text equals
  already-rendered streamed content.

Code comments
- Added focused comments describing silent refresh behavior,
  tag stripping rationale, duplicate guard behavior, and line buffering.

Validation
- ESLint passes for touched files.
- Production build succeeds.

Files
- server/cursor-cli.js
- src/components/app/AppContent.tsx
- src/components/chat/hooks/useChatRealtimeHandlers.ts
- src/components/chat/utils/messageTransforms.ts
- src/hooks/useProjectsState.ts

---------

Co-authored-by: Haileyesus <something@gmail.com>
Co-authored-by: Simos Mikelatos <simosmik@gmail.com>
2026-03-11 00:16:11 +01:00
simosmik
aaa14b9fc0 fix: codeql user value provided path validation 2026-03-10 21:16:24 +00:00