Commit Graph
100 Commits
Author SHA1 Message Date
Bohdan Triapitsyn 71172181ef chore: add unreleased changelog entries for recent fixes and perf improvements 2026-06-17 01:08:54 +03:00
Bohdan Triapitsyn a99eba1ca6 fix(markdown): currency-safe math delimiters
Single-dollar $...$ inline math collided with currency text ($50,
US$ 680, "$50M to $72M"), parsing money as math and corrupting it.
Drop single-dollar inline math; keep $$...$$ display math and add
\(...\) inline and \[...\] display via marked tokenizers (caught at
lex time so they survive backslash escaping and stay code-safe).

Also gate renderMathExpressions on a cheap $-presence check so the
split + regex passes are skipped for the non-math majority of blocks.
2026-06-17 00:33:39 +03:00
Bohdan Triapitsyn b6f7f3a478 docs: update security contact 2026-06-16 23:40:00 +03:00
Bohdan Triapitsyn 0fef61e25f fix: sync context panel iframe themes
Keeps embedded sessions aligned with parent theme
Prevents iframe reloads on theme changes
Supports theme hotkeys from focused iframes
2026-06-16 23:33:29 +03:00
Bohdan Triapitsyn 91e8e94961 fix: route Electron dev auth through Vite proxy
Fixes password-protected Electron dev startup
Avoids exposing desktop tokens to the HMR UI
2026-06-16 23:33:15 +03:00
Bohdan Triapitsyn ab020886e2 fix: sync embedded chat theme with parent panel
Keeps iframe sessions aligned with the parent theme
Prevents system theme detection from forcing dark mode
2026-06-16 19:35:15 +03:00
Bohdan Triapitsyn a2a1cedf8d perf: streamline provider and agent startup loading #185
Avoids loading the full provider catalog on startup
Prewarms project config in the background
Prevents duplicate worktree-scoped config requests
2026-06-16 19:23:38 +03:00
Bohdan Triapitsyn fe99c455ae fix: prevent session folder rerender loop #1461
Avoids redundant folder store updates
Prevents startup crashes with many sessions
Keeps invalid folder moves from mutating state
2026-06-16 15:55:35 +03:00
Bohdan Triapitsyn 9f266a351c fix: preload commands and skills when draft session opens so pinned starters appear immediately
Draft starters from commands and skills now resolve on mount without needing to open the add dialog
Uses existing TTL-cached and deduped loaders, so no extra cost if already loaded
2026-06-16 15:33:33 +03:00
Bohdan Triapitsyn 91de51d1a5 fix: deduplicate desktop notifications and tighten notification text extraction
Desktop notifications no longer duplicate when native delivery succeeds
Reasoning chain-of-thought is excluded from notification body text
Untyped message parts are ignored in notification text extraction
2026-06-16 15:21:27 +03:00
Bohdan Triapitsyn 6ea8fb357d chore: add unreleased changelog entries 2026-06-16 14:56:40 +03:00
Bohdan Triapitsyn 69e534c457 refactor: fixed mobile session button for android
Replaces custom pointer-capture touch logic with touch-action: manipulation
Aligns with the pattern used across other mobile surfaces
2026-06-16 14:46:55 +03:00
Bohdan Triapitsyn f3aff42b8a feat: show context usage as circular progress
Replaces static context icons with live circular progress indicators
Applies consistent context progress in desktop, mobile, VS Code, and mini-chat headers
Keeps usage coloring tied to existing status thresholds
2026-06-16 14:34:02 +03:00
Bohdan Triapitsyn 3ba93c111e fix: show clear toast when agent definition is missing
Surface missing agent definitions during delete
Avoid hiding delete errors behind generic failures
Add localized toast copy
2026-06-16 14:33:08 +03:00
Bohdan Triapitsyn 8f1da2f728 fix: stabilize session diagnostics and Windows session loading
Fix duplicated health probe URL in diagnostics
Share session list proxy handling across platforms
Avoid repeated hanging session requests on Windows
2026-06-16 14:05:44 +03:00
Bohdan Triapitsyn e982bd9388 fix: prevent agent deletion from disabling built-ins
Stop delete from creating disable overrides
Delete only the selected agent scope
Keep web and VS Code behavior aligned
2026-06-16 13:38:24 +03:00
Bohdan Triapitsyn e904abda04 feat(editor): Shiki highlighting for code files in PlanView and SkillsPage
Reuse the file-editor Shiki extension for the PlanView and SkillsPage editors,
gated to non-markdown files. Markdown sources keep the lezer highlighter (its
markdown-aware styling is better for editing and there's no Shiki view to match).

- PlanView: code files opened through it get Shiki colors; plan .md stays lezer.
- SkillsPage: code supporting files get Shiki colors; SKILL.md stays lezer.
2026-06-16 01:08:54 +03:00
Bohdan Triapitsyn 782982cdd3 feat(editor): Shiki syntax highlighting in the file editor (CodeMirror)
Bring the CodeMirror file editor up to the same rich highlighting as the Shiki
file view, so toggling edit <-> view is visually consistent. lezer collapses far
more tokens than TextMate (import/from/const are all "keyword"), so a theme
remap can't reach parity — instead, project real Shiki tokens onto decorations.

- Worker: add highlightTokens — tokenize with an arbitrary registered TextMate
  theme and return per-line styled runs with offsets. The theme object ships to
  the worker once per name; later calls send only the name.
- New shikiHighlight CodeMirror extension: a StateField of mark decorations
  built from worker tokens. Re-tokenizes on a short idle (off the keystroke
  path) and maps decorations through edits so colors persist while typing.
- flexokiTheme: add { syntaxColors: false } to keep only the editor UI theme,
  so the lezer highlighter doesn't compete with the Shiki decorations.
- FilesView: enable Shiki highlighting (same language resolver as the file view
  → identical language) and drop lezer token colors when it's active. lezer
  language stays on for indentation/folding/brackets.
2026-06-16 01:08:54 +03:00
Bohdan Triapitsyn c22e1cbb15 refactor(chat): remove dead syntaxTheme plumbing
The Prism syntaxTheme prop is no longer read after code highlighting moved to
the Shiki worker. Remove the now-dead prop threading and its source.

- Drop syntaxTheme from interfaces, destructures, prop passes, and React.memo
  comparators across ChatMessage, MessageBody, ProgressiveGroup, ToolPart,
  TurnActivity, ToolOutputDialog, and ChatInput.
- Drop the unused _syntaxTheme param from renderWebSearchOutput.
- Remove the dead generateSyntaxTheme usages (ChatMessage memo, PlanView
  unassigned memo) and delete the now-unimported syntaxThemeGenerator module.
2026-06-16 01:07:43 +03:00
Bohdan Triapitsyn e41e5bac91 perf(code): replace react-syntax-highlighter and prismjs with the Shiki worker
Route all non-markdown code highlighting through the off-main-thread Shiki
worker, removing react-syntax-highlighter and prismjs entirely.

- Extend the worker with highlightLines: tokenize a whole block once and return
  per-line inner HTML, so per-line layouts (diffs, gutters, virtualization) make
  one worker call instead of one highlighter per line.
- Add shared WorkerHighlightedCode (whole-block) and useWorkerHighlightedLines
  (per-line) primitives. Colors resolve via the --md-syntax-* CSS variables, so
  theme changes never re-highlight.
- Migrate all 12 react-syntax-highlighter call sites: PermissionCard,
  ToolPart, ContextSidebarTab, ToolOutputDialog (whole block) and
  DiffPreview/WritePreview (per line).
- Migrate VirtualizedCodeBlock off prismjs to the worker, keeping virtua
  virtualization; whole-block tokenization also restores cross-line syntax
  context that per-line highlighting lost.
- Drop react-syntax-highlighter (+types) from ui and web, prismjs (+types) from
  ui, and the orphaned create-element type shim.
2026-06-16 01:07:43 +03:00
Bohdan Triapitsyn 464c4ac0ca perf(markdown): move code highlighting off the main thread into a Shiki worker
Tokenize closed code blocks in a dedicated Shiki Web Worker instead of calling
the shared highlighter synchronously on the UI thread. This removes the
one-shot main-thread highlight stall when a code fence closes on a large block.

Streaming behavior is unchanged: the open (streaming) fence still renders as
plain text and is highlighted once on close. On any worker failure the block
keeps its escaped plain code — highlighting never falls back onto the main
thread.

- Add markdownShikiThemeDefinition (dependency-free CSS-variable theme) so the
  worker can use the theme without pulling in @pierre/diffs / React.
- Add markdown-worker-protocol, markdown-shiki.worker, and the main-thread
  markdown-worker client.
- Route highlightCodeBlocks through the worker; keep the size/VSCode line guard
  and mermaid skip on the main thread.
- Add shiki as a direct dependency (was transitive via @pierre/diffs).
2026-06-16 01:07:43 +03:00
Bohdan Triapitsyn 9ea557d23e feat(markdown): open mermaid fullscreen preview on diagram click in chat
Thread onShowPopup from MessageBody through AssistantTextPart into the
markdown renderer so clicking a rendered mermaid diagram in assistant
messages opens the existing pan/zoom fullscreen preview dialog.
2026-06-15 18:23:59 +03:00
Bohdan Triapitsyn 4d506fba4e perf(markdown): rewrite rendering on marked + Shiki + morphdom
Replace the react-markdown/Prism component tree with an HTML-string
pipeline (marked -> KaTeX -> Shiki -> DOMPurify -> DOM decorators) patched
into the DOM via morphdom, with per-block reconciliation and a paced
streaming reveal. Cuts streaming CPU versus the previous renderer while
preserving file-reference links, mermaid diagrams, table export, and
agent/skill/favicon link handling. Public MarkdownRenderer/
SimpleMarkdownRenderer props are unchanged (drop-in).
2026-06-15 18:17:47 +03:00
Bohdan Triapitsyn 7290c4aa51 ci: pin Windows release runner to 2022 2026-06-15 15:51:37 +03:00
Bohdan Triapitsyn 4927a3164f release v1.13.0 2026-06-15 15:35:11 +03:00
Bohdan Triapitsyn 7a0abfe6c4 fix: keep context panel resize handle above content
Prevents changed file rows from visually overlapping the resize border
Preserves existing spacing in the changes list
2026-06-15 15:29:19 +03:00
Bohdan Triapitsyn ba0a755040 fix: sync pending changes with active directory
Uses the effective directory for composer git status
Prevents stale pending changes after commit or push
Keeps the dropdown aligned with the git panel
2026-06-15 15:26:08 +03:00
Bohdan Triapitsyn 41160ed5b2 fix: refresh pending changes from chat input
Keeps pending changes state fresh even when the bar is hidden
Updates the composer when workspace changes appear or disappear
Removes duplicate refresh handling from the pending changes bar
2026-06-15 15:10:12 +03:00
Bohdan Triapitsyn 313f04e916 fix: keep Windows header menu aligned
Moved the Windows app menu into the fixed titlebar controls
Kept sidebar controls stable when opening and closing the sidebar
Documented longer validation timeouts for workspace checks
2026-06-15 14:52:43 +03:00
Bohdan Triapitsyn a73090f396 Deduplicate desktop notifications 2026-06-15 14:02:16 +03:00
Bohdan Triapitsyn f321562abd chore: bump @opencode-ai/sdk to ^1.17.7 and update changelogs
Upgraded @opencode-ai/sdk dependency from ^1.17.0 to ^1.17.7 across all packages
Added unreleased changelog entries for VSCode startup parity, mobile tool card fix, and files workspace directory fix
Refined VSCode changelog to remove inaccurate project-level actions note
2026-06-15 13:24:39 +03:00
Bohdan Triapitsyn c73ab9cbd5 feat(vscode): startup parity + workspace-grouped session list (#1658)
* perf(vscode): gate API readiness and coalesce duplicate startup reads

Bring the VS Code bridge runtime to parity with the web startup
optimizations (PR #1650), which were web/desktop-only.

waitForApiUrl now hands out the OpenCode API URL only once the manager
reports 'connected', instead of as soon as getApiUrl() exposes
server.url. The URL is available the moment the process is spawned —
before waitForReady confirms it can serve and during a workspace-switch
restart (stale port) — so URL-presence alone let the bridge forward to a
not-yet-ready OpenCode and surface 502s. Gating on connected status
mirrors the web proxy's isOpenCodeReady hold. Also fail fast on 'error'
status so a missing CLI doesn't burn the full 30s timeout.

Coalesce concurrent identical GET reads (config/path/agents/agent/
project/command) at the bridge proxy so the single OpenCode process
serves them once. On cold start the webview's sync bootstrap and config
store fire these reads in parallel with no shared dedup; this is the
extension-host analog of the runtimeFetch coalescer. Shared reads carry
no AbortController so one caller's abort can't strand the others, and the
entry clears as soon as it settles (never serves stale).

* perf(vscode): fade the startup splash once mounted + connected, not on live fetch

The webview's initial-loading overlay held until a successful live
/api/config/providers AND /api/agent fetch completed. After the cache
hydration work those live reads are the slowest cold-start tail — the UI
underneath already paints pickers and the sidebar from cache and refreshes
in the background — so gating the splash on them kept it spinning long
after the app was usable.

Fade the overlay as soon as the UI is mounted and OpenCode is connected.
Per-widget loaders convey any remaining background refresh, matching how
web/desktop (which have no such splash) already behave. Removes the now
-obsolete bootstrapProvidersReady/AgentsReady/Failed tracking and
recordBootstrapFetch. Connection error/disconnected splash messages are
unchanged.

* fix(vscode): include captured OpenCode output in spawn-timeout error

When the managed OpenCode server fails to emit its 'listening' line within
the start timeout, the error discarded everything the process printed to
stdout/stderr — so the status report showed a bare 'Timeout waiting for
server to start' with no clue whether the process hung, crashed silently,
or printed a config/auth error. The exit path already includes the output;
the timeout path now does too (or notes that nothing was printed).

* feat(vscode): workspace-grouped session list with working folders, pinning, and archived toggle

Replace the flat multi-workspace session list with the grouped project view,
using each open VS Code workspace folder as a header (no per-worktree
subgroups). This restores native folder and pin support, which the flat list
silently dropped, and fixes the clipped left padding on session rows.

- Group sessions strictly by open workspace; funnel all non-archived sessions
  into the workspace's group so they no longer fall into the archived bucket.
- Keep the project/group/folder + buttons but make them open a draft in the
  correct workspace and navigate to chat; hide the project actions (...) menu,
  which isn't relevant in VS Code.
- Force the minimal single-line row layout (the second metadata row is
  redundant under workspace headers) and drop the per-row tooltip.
- Add a show/hide archived toggle next to the archive-all control, since the
  VS Code header has no display-mode menu.
- Size the hover action reveal so the timestamp clears the row buttons.
2026-06-15 13:02:26 +03:00
Bohdan Triapitsyn 8919d33636 fix: prevent descender clipping and show tool icon when collapsed on mobile
- Bump mobile line-height on tool/reasoning rows from leading-4 to leading-5
  so descenders (g, y, p) are no longer clipped by truncate overflow
- Show the tool icon (not the chevron) for collapsed expandable tools on
  mobile, matching reasoning rows; chevron now appears only when expanded
2026-06-15 12:54:47 +03:00
Bohdan Triapitsyn e276dc8a5d fix: resolve runtime URLs from injected desktop API base
Uses the injected desktop API base URL at call time
Fixes packaged desktop WebSocket URL generation
Adds regression coverage for injected runtime URLs
2026-06-15 11:45:31 +03:00
Bohdan Triapitsyn 5773297ecf chore: updated unreleased changelog 2026-06-15 10:45:18 +03:00
Bohdan Triapitsyn a45376d585 perf: migrate chat rendering to virtua (#1651)
* refactor: migrate chat history virtualization to virtua

* refactor: render loaded chat history directly

* refactor: finish virtua migration

* perf: defer tool body rendering

* perf: queue deferred tool body mounts

* perf: quiet and defer markdown file probes

* perf: defer markdown code highlighting

* perf: stabilize markdown plugin lists

* perf: defer mermaid markdown rendering

* perf: delay markdown file reference annotation

* perf: attach markdown table listeners on demand

* perf: trim markdown render overhead
2026-06-15 03:29:40 +03:00
Bohdan Triapitsyn e372c8d8cb perf: instant startup via cache hydration + decoupled readiness (#1650)
* perf(startup): hydrate providers/agents from cache (stale-while-revalidate)

Persist last-known provider/agent snapshots instead of stripping them, so the
model/agent pickers paint instantly on cold start. Freshness is preserved by the
background refresh in initializeApp() and activateDirectory() (which overwrite on
success) and by the existing provider/agent config-change subscriptions, so the
prior stale-provider regression stays fixed without blanking the UI during fetch.

* perf(startup): cache directory session list for instant sidebar

Persist a capped slice of each directory's session list and seed the child store
from it on creation, so the sidebar paints chats immediately on cold start.
Bootstrap phase-3 loadSessions overwrites with the fresh list; its empty-list
race guard preserves the seeded sessions during OpenCode warmup.

* perf(startup): hold API requests through OpenCode warmup instead of 503

The readiness gate returned 503 the instant OpenCode wasn't ready, pushing the
client into an exponential-backoff retry loop (500ms -> 1s -> ...) that wasted
seconds of cold-start time and could fail bootstrap outright. Now hold the
request and poll readiness up to a bounded window so the first call succeeds as
soon as OpenCode is up (typically sub-second); still 503 fast past the window so
a genuinely-down server doesn't hang. Adds coverage for both paths.

* perf(startup): surface cached providers/agents in pickers (optimistic readiness)

The model/agent pickers gated purely on isInitialized, so they showed
"Loading…" for the entire init round-trip even when provider/agent data was
already hydrated from cache — making the persisted-cache work invisible. Treat
the pickers as ready as soon as cached providers are present (stale-while-
revalidate), so they paint last-known models/agents instantly and refresh in the
background. First-ever launch (no cache) still shows Loading until init.

* perf(startup): don't abort directory bootstrap on transient phase-1 failure

A failed initial path.get OR session.status aborted the whole directory
bootstrap, stranding it in loading and skipping phase 2/3 (session load).
session.status is live data the event pipeline keeps current, and path.get is
tolerable once a project is resolved from global state. Now only a total
failure (or path.get failing with no resolved project) aborts, so the sidebar
and chat keep advancing and loading sessions through warmup hiccups.

* perf(startup): don't bootstrap directories from archived sidebar rows

Each sidebar session row called useDirectoryStore(dir), which defaulted to
bootstrap:true and triggered a full directory bootstrap. Archived sessions point
at dozens of (often deleted) worktrees, so on startup this fired a session-list
fetch + 6x2s empty-retry storm per dead directory (the logs the user saw). The
store ref there is only read on-demand via getState() in export handlers, never
subscribed, so archived rows don't need it bootstrapped. Add a { bootstrap }
option to useDirectoryStore and skip bootstrap for archived rows; active rows
still bootstrap so live cross-directory session/status keeps aggregating.

* perf(startup): stop empty-session bootstrap retry storm on web/desktop

The post-bootstrap retry re-ran the full directory bootstrap 6x2s whenever the
session list came back empty, on the theory that empty meant OpenCode wasn't
ready. But loadSessions already retries transient failures twice over
(listGlobalSessionPages throws on 5xx and retries internally), so on web/desktop
an empty result is authoritative — the directory genuinely has no sessions (e.g.
deleted worktrees referenced only by archived sessions). That produced the
dozens of '[bootstrap] sessions empty ... 6 attempts; giving up' log storms.
Gate the retry to VS Code, where the bridge can return an empty 200 during
warmup that the inner retries can't catch.

* perf(startup): scope provider/agent config to project (worktrees inherit)

Providers/agents/defaults are project-level, but were keyed per directory, so a
worktree fetched and cached its own snapshot — duplicating the parent project's
load (the trace showed initializeApp loading the worktree and activateDirectory
loading the project concurrently, ~8s of redundant background work).

- resolveConfigDirectory() maps a worktree to its owning project; loadProviders
  /loadAgents/activateDirectory now key by it, so a worktree reuses one shared
  project snapshot. activateDirectory resolves up-front so activeDirectoryKey and
  the snapshot key always match (picker stays consistent); the OpenCode working
  directory is unaffected.
- Add a 30s runtime freshness guard so the stale-while-revalidate background
  refresh skips re-fetching config that was just loaded (initializeApp then
  activateDirectory for the same project), and to avoid churn on rapid project
  switches. Config-change invalidation clears the snapshot, which bypasses the
  guard, so freshness never masks a needed refresh.

* fix(sidebar): default archived sessions to hidden to avoid startup flash

useSessionDisplayStore defaulted showArchivedSessions to true, so on startup
archived sessions rendered by default and then vanished once the persisted
preference rehydrated to hidden — a visible flash. Default to hidden so the
pre-hydration state is the quiet one; users who opted into showing archived keep
their persisted true (default change doesn't override persisted state).

* perf(startup): persist worktree->project mapping to kill cold double-load

The worktree->project map (availableWorktreesByProject) is populated by async git
discovery, so it isn't ready when initializeApp runs — a worktree's first config
load couldn't resolve to its project and duplicated the project's provider/agent
load, saturating OpenCode during cold start (the source of the slow first
createSession/send the user observed). Cache resolved worktree->project mappings
to localStorage so resolveConfigDirectory resolves synchronously at init on
subsequent launches; the project is loaded once and activateDirectory hits the
freshness guard. worktree->project is immutable so a cached entry is safe; live
resolution still populates/corrects the cache.

* perf(startup): persist worktree map for instant sidebar + first-launch keying

Worktree discovery is async (git), so availableWorktreesByProject was empty at
startup: the sidebar worktree list appeared late, and useConfigStore couldn't
resolve a worktree to its project on the first launch (causing the cold
worktree+project double-load). Persist the discovered worktree map to
localStorage and seed it synchronously on store init (stale-while-revalidate:
discovery refreshes in the background via the existing setState, which now
write-through persists). The sidebar paints worktrees instantly and
resolveConfigDirectory resolves the project from the very first launch.

* perf(startup): coalesce concurrent duplicate OpenCode reads in runtimeFetch

On cold start the sync bootstrap and the config store independently fire the same
idempotent reads (providers, config, path, agents, project) concurrently with no
shared dedup, saturating the single OpenCode process and delaying work queued
behind it (e.g. createSession). Coalesce genuinely-concurrent identical GETs to
those read endpoints at the transport layer so OpenCode does the work once; each
caller receives an independent response clone. Tightly scoped: GET only,
allowlisted read paths, never event streams, never a signal-bearing request (so
one caller's abort can't cancel the shared fetch). Entries clear on settle, so it
only shares overlapping in-flight requests — never a stale response.

* perf(startup): cache git branches so the draft branch selector paints instantly

The branch selector above the composer was the slowest-loading element: it's
gated behind a cold 'git branch' fetch (useGitStore, not persisted). Cache the
per-directory branch list to localStorage and seed the store on init (with
isGitRepo:true so the selector's gate passes), and write the cache on every
successful fetchBranches. The ChatInput draft-branch effect now refreshes on
staleness (>30s) rather than mere absence, so seeded branches show immediately
and still refresh in the background without a spinner — no stale-forever
regression. Only the branch list is cached; status/log/diff are untouched.
2026-06-15 03:16:34 +03:00
Bohdan Triapitsyn 928b7ff1d6 revert: restore stable chat history scrolling 2026-06-14 23:06:03 +03:00
Bohdan Triapitsyn 296177357b perf: speed up model/agent readiness on the initial draft
Load startup config under the owning project's directory key (resolving from a
worktree directory when needed) so the auto-opened draft, which activates the
project, finds a ready providers/agents snapshot instead of triggering a second
load. Also dedupe app.agents: listAgents now takes the directory directly and
shares an in-flight request, so the config store and agents store no longer
issue duplicate agent fetches at startup.
2026-06-14 22:04:32 +03:00
Bohdan Triapitsyn 9111611bdc fix: start draft sessions from default model/agent and honor OpenCode default_agent
A new draft session inherited the previous session's model/agent instead of
resetting to defaults, because opening a draft restored the directory snapshot
without re-applying the startup default cascade. When the prior session ran in
a worktree, defaults were resolved against the worktree directory's provider
list, which omits project/global-scoped providers, so the default agent's model
fell back to opencode/big-pickle.

Resolve the default agent/model via a shared cascade (settings default ->
OpenCode default_agent -> build -> first), resolve the model from the agent's
pinned model/variant or OpenCode's config model, and activate the project's
config (not the worktree's) when opening a draft.
2026-06-14 21:36:05 +03:00
Bohdan Triapitsyn 9f06224151 fix: authenticate event-stream WebSocket before connecting
The global event-stream WebSocket opened before a valid oc_url_token was
minted, so the upgrade failed auth ("no valid credentials available") in
packaged builds with a UI password. The resulting reconnect storm churned
the sync store and made session status flicker busy<->idle. Await the URL
auth token before connecting (a WS upgrade can't send a bearer header like
SSE does) and drop a rejected token on pre-ready close so the next attempt
re-mints a fresh one.

Also harden /session/status reconciliation: the watchdog poll is now
monotonic (only confirms/raises active status, never blindly lowers a
busy/retry session to idle on a transient or misscoped snapshot). Idle is
applied only by the authoritative reconnect/escalation resync, which trusts
the live server snapshot as the source of truth. Add a Help -> Toggle
Developer Tools menu item so production builds can open the console.
2026-06-14 19:48:07 +03:00
Bohdan Triapitsyn 94ca3fda04 Add diff review flow dialog 2026-06-14 16:55:58 +03:00
Bohdan Triapitsyn 1762c1a289 Polish diff file actions 2026-06-14 16:17:30 +03:00
Bohdan Triapitsyn 7748a75eba Merge remote-tracking branch 'origin/main' 2026-06-14 14:52:37 +03:00
Bohdan Triapitsyn c92b540e7f Polish changes panel toolbar state 2026-06-14 14:48:24 +03:00
Bohdan Triapitsyn f645d57c93 Stage, unstage, and discard individual diff hunks
Add per-hunk staging, unstaging, and discarding to the Changes diff
view, so a single change region inside a file can be acted on in
isolation instead of forcing whole-file stage/revert. The change is
wired end-to-end across the web server, the shared UI runtime API
contract, and the VS Code extension, with Electron inheriting the web
path unchanged (it boots the server in-process).

Server
------
- New `applyHunk(directory, filePath, { patch, action })` in
  packages/web/server/lib/git/service.js. It resolves the repository
  context and validates the file path with the same helpers used by
  stageFiles/unstageFiles (resolveGitFileContext +
  validateRepositoryFilePaths), then writes the single-hunk patch to a
  temporary file in the OS temp dir (never inside the repo, so it
  cannot show up as an untracked file) and runs `git apply` with flags
  chosen per action:
    stage   -> git apply --cached          (working tree -> index)
    unstage -> git apply --cached --reverse (index -> working tree)
    discard -> git apply --reverse          (revert in working tree)
  A `git apply --check` runs first with the same flags, so a stale
  hunk that no longer applies fails with a clear "Hunk no longer
  applies - refresh and try again" message instead of leaving a
  partial mutation. The patch's target path is parsed and must match
  the requested file (with /dev/null tolerated for new/deleted files),
  preventing a patch from silently targeting a different path. The
  whole operation runs inside withGitIndexMutationQueue to avoid
  racing with concurrent stage/unstage. The temp file is removed in a
  finally block.
- New `POST /api/git/apply-hunk` route in routes.js, registered
  alongside stage/unstage. Validates directory, path, non-empty patch,
  and action before delegating.
- DOCUMENTATION.md updated with the new service entry.

Patch extraction
----------------
- packages/ui/src/lib/diff/patchFileDiff.ts gains
  splitPatchIntoHunks(patch) and extractHunkPatch(patch, hunkIndex).
  They keep the original file header (diff --git / index / --- / +++)
  and emit exactly one @@ hunk per standalone patch, which is what
  `git apply` expects. Each emitted patch is guaranteed to end with a
  trailing newline (without it git apply reports "corrupt patch").

Runtime API contract
--------------------
- GitAPI (packages/ui/src/lib/api/types.ts) gains optional
  stageGitHunk / unstageGitHunk / revertGitHunk, matching the
  stageGitFiles? / unstageGitFiles? precedent so runtimes that do not
  support it degrade gracefully.
- gitApi.ts delegates to the registered runtime git API, falling back
  to gitApiHttp, exactly like the existing whole-file helpers.
- gitApiHttp.ts posts to /api/git/apply-hunk.
- Web runtime composes the three methods in packages/web/src/api/git.ts.

VS Code parity
--------------
- packages/vscode/src/gitService.ts adds applyGitHunk(), implemented
  natively with the existing execGit helper + a temp patch file +
  `git apply` (--cached / --cached --reverse / --reverse), mirroring
  the server's --check-first safety and temp-file cleanup.
- bridge-git-runtime.ts handles the new api:git/apply-hunk bridge
  message; webview/api/git.ts sends it. VS Code users get identical
  stage/unstage/discard-hunk behavior.

UI
--
- New DiffHunkActions component renders a compact per-hunk strip
  above each expanded file diff in the Changes view. Each hunk chip
  shows its +additions / -deletions counts and offers:
    working scope -> Stage + Discard
    staged scope  -> Unstage
  Clicking extracts that hunk's standalone patch via
  extractHunkPatch(patch, hunkIndex) and calls the runtime git API.
  Because the chip index comes directly from fileDiff.hunks[] and the
  patch is sliced in the same order, the hunk the user sees is always
  the hunk that gets applied. While any action is in flight all buttons
  disable to prevent conflicting concurrent mutations; the per-hunk
  spinner reflects in-flight state.
- DiffView wires DiffHunkActions into InlineDiffViewer (text diffs
  only; binary/image and full-file-content modes are excluded since
  they have no patch). MultiFileDiffEntry passes directory/staged
  through and handles onHunkApplied by bumping the diff reload nonce
  (so the file's diff re-fetches and the affected hunk disappears)
  and refreshing git status (so file counts and the staged/changed
  scope update). Hunk actions are therefore available wherever the
  default patch-context diff is shown.

i18n
----
- 10 new keys (diffView.hunk.*) added to all 9 locales (en, es, fr,
  ko, pl, pt-BR, uk, zh-CN, zh-TW), including stage/unstage/discard
  labels, tooltips with the hunk index, a stale-hunk error message,
  and an unsupported-runtime fallback.

Tests
-----
- packages/ui/src/lib/diff/patchFileDiff.test.ts covers
  splitHunks/extractHunkPatch: multi-hunk split, header preservation,
  single-hunk and empty patches, out-of-range indices.
- service.test.js adds an applyHunk suite that builds real temp repos
  with two separate hunks and verifies: staging one hunk leaves the
  other unstaged, discarding reverts only the targeted hunk in the
  working tree, unstaging removes only one hunk from the index, and a
  retargeted patch (different file path) is rejected. Also covers
  invalid-action / missing-hunk-header validation.
- packages/web/src/api/git.test.ts mock completed with the new methods
  (and previously-missing exports that prevented the test from
  loading) and asserts the three hunk methods are exposed.
- routes.test.js continues to pass under bun.

CHANGELOG updated under [Unreleased].
2026-06-14 10:58:23 +03:00
Bohdan Triapitsyn 1c281df3b7 Move changes toggle before mini chat 2026-06-14 01:48:59 +03:00
Bohdan Triapitsyn 93bc5b2858 Move changes toggle before mini chat 2026-06-14 01:45:29 +03:00
Bohdan Triapitsyn 8174ede976 Improve Changes diff experience 2026-06-14 01:39:49 +03:00
Bohdan Triapitsyn 2538a08370 Fix git worktree root normalization 2026-06-14 01:07:11 +03:00
Bohdan Triapitsyn fa128afdb5 Refine changes panel controls 2026-06-14 00:51:12 +03:00
Bohdan Triapitsyn 8b318d2776 Polish diff view hunk controls 2026-06-14 00:03:02 +03:00
Bohdan Triapitsyn 876738229f Improve diff rendering pipeline 2026-06-13 23:55:50 +03:00
Bohdan Triapitsyn cf8eac966e Refine stacked diff view 2026-06-13 22:30:03 +03:00
Bohdan Triapitsyn 676f0b3898 Add message role counts to memory debug panel 2026-06-13 16:40:29 +03:00
Bohdan Triapitsyn b8dc25c7c8 fix: show about settings only on mobile
Hides About from desktop settings navigation and command palette
Keeps About available in mobile settings
2026-06-13 01:59:33 +03:00
Bohdan Triapitsyn ca87428216 fix: harden file previews and downloads 2026-06-13 01:44:03 +03:00
Bohdan Triapitsyn 823cefd4b5 fix: preserve inline comment drafts on focus changes
Keeps typed or pasted comment text when the editor remounts
Prevents focus changes from dismissing active inline comments
Allows cancelling by pressing the selected line number again
2026-06-13 00:48:42 +03:00
Bohdan Triapitsyn 1235e4db71 fix: restore ArrowUp caret movement and clean up virtual list lints
ArrowUp in chat input now moves caret instead of recalling history when the field has text
Removed manual cache-busting workaround and eslint-disable in favor of idiomatic onChange state sync
2026-06-12 23:40:08 +03:00
Bohdan Triapitsyn 563a4cf9b7 fix: preserve code block file reference locations 2026-06-12 23:20:43 +03:00
Bohdan Triapitsyn 201c7014d7 chore: updated macOS app icon with new glass effect
Updated generated macOS icon asset catalog
Includes latest AppIcon source metadata
2026-06-12 20:34:48 +03:00
Bohdan Triapitsyn 1a623f9b1c Add inline PDF file preview 2026-06-12 20:08:19 +03:00
Bohdan Triapitsyn 33522a0d58 fix: clamp collapsed markdown user messages
Keep markdown user messages limited to two lines when collapsed
Preserve full markdown rendering after expanding
2026-06-12 19:45:16 +03:00
Bohdan Triapitsyn 5272b95be7 fix: extend session row selection highlight to cover gutter area
Selection highlight now visually wraps status indicators and chevrons
Active session gets a subtle primary background tint
Multi-select rows use the interactive-selection token
2026-06-12 19:32:40 +03:00
Bohdan Triapitsyn 6cc3a93547 chore: update unreleased changelog 2026-06-12 18:54:35 +03:00
Bohdan Triapitsyn 782bc92b15 Forget unmanaged orphan worktrees safely 2026-06-12 18:36:06 +03:00
Bohdan Triapitsyn ea3bb103eb Restrict orphan worktree cleanup 2026-06-12 18:33:22 +03:00
Bohdan Triapitsyn 106b31a407 Harden remote API security boundaries 2026-06-12 18:24:07 +03:00
Bohdan Triapitsyn c281937406 refactor(recent): replace active-now tracking with recent session window
Replace persisted 'active now' tracking with 48-hour recency window
Remove Zustand ActiveNowStore and localStorage persistence
Simplify session sidebar data flow
2026-06-12 14:34:33 +03:00
Bohdan Triapitsyn 28aeb4950b refactor: simplify session list display
Makes minimal session rows the default
Removes session diff stat badges from navigation surfaces
Keeps expanded session rows in VS Code
2026-06-12 12:38:31 +03:00
Bohdan Triapitsyn c703db2745 fix: stop forwarding client auth to OpenCode and harden home/session state
Packaged desktop showed no sessions in 1.12.4. Root cause: the sanitized
session-list proxy path added in #1538 forwarded the renderer's
"authorization" header (the OpenChamber UI client token) to the managed
OpenCode upstream alongside the managed "Authorization" credential.
OpenCode does not recognize UI client tokens, so every session-list
request answered 401 — only in the packaged app, because only its
renderer (openchamber-ui:// origin) attaches a bearer token; dev web and
dev Electron run same-origin without one. The legacy http-proxy path
overwrote the header correctly, which is why everything except session
lists kept working.

Proxy fix:
- proxy-headers: filter the client "authorization" header out of
  forwarded request headers; the OpenCode upstream must only ever see
  its own managed credentials. Covered by tests.

Desktop cwd:
- electron: launch the managed OpenCode CLI from the user home instead
  of app userData, matching upstream desktop behavior. userData-as-cwd
  made OpenCode treat the app-data folder as a separate empty workspace.

Home directory poisoning loop:
- directoryPersistence: stop replaying localStorage homeDirectory
  through synchronizeHomeDirectory on boot/auth resync. The persisted
  value is only a boot-time cache; replaying it re-wrote stale values
  (e.g. a project path) into desktop settings on every start, overriding
  the authoritative /api/fs/home resolution.
- persistence: never overwrite an injected window.__OPENCHAMBER_HOME__
  with a persisted value.
- useDirectoryStore: host switches happen in place (no reload), so
  re-resolve home from the new runtime's /api/fs/home on endpoint
  change instead of keeping the previous host's value.
- opencode client: only short-circuit to the injected desktop home when
  the active runtime is local; remote runtimes ask /api/fs/home.

Settings hygiene:
- persistSettings: log field names only — change payloads can carry
  credentials (UI password, client tokens, tunnel tokens) that must not
  reach the log file; drop step-by-step log chatter.
- validateProjectEntries: only stat project paths when the incoming
  update actually touches the projects list, not on every settings save.
- remove the write-only approvedDirectories setting everywhere and add
  a migration that strips the stale key from persisted settings.

Tests:
- usePluginsStore.test: register an own runtime-fetch module mock so the
  suite is independent of process-global mock.module leakage from other
  files, and restore globalThis.fetch after the suite.
- persistence.test: clean up the window global created for the suite.
2026-06-12 01:53:38 +03:00
Bohdan Triapitsyn f26950fa4e fix: treat gh CLI token as GitHub account 2026-06-11 19:30:19 +03:00
Bohdan Triapitsyn 465732858f fix: clarify GitHub token settings 2026-06-11 18:59:58 +03:00
Bohdan Triapitsyn 6ca99a3d5e fix: add French gh CLI settings translations 2026-06-11 18:46:31 +03:00
Bohdan Triapitsyn 6386b4a404 fix: avoid home cwd for VS Code OpenCode startup 2026-06-11 16:44:45 +03:00
Bohdan Triapitsyn a01b7a982f fix: align VS Code subsession chevrons in metadata row
Moves VS Code subsession chevrons into the metadata row
Centers the chevron with session metadata
Keeps web and desktop sidebar layout unchanged
2026-06-11 13:19:14 +03:00
Bohdan Triapitsyn 3e7d3f85c7 fix: show Cursor plan limit progress
Calculates plan limit usage from remaining balance
Restores the Cursor plan limit progress bar
2026-06-11 02:01:53 +03:00
Bohdan Triapitsyn 72d814110a ci: fix bot help command responses 2026-06-11 01:51:04 +03:00
Bohdan Triapitsyn 75014e0317 release v1.12.4 2026-06-11 01:42:41 +03:00
Bohdan Triapitsyn 2362d43036 fix: use correct thinking variant when sending review flow messages 2026-06-11 01:37:03 +03:00
Bohdan Triapitsyn e36085d898 feat: add collapsible user message setting 2026-06-11 01:26:50 +03:00
Bohdan Triapitsyn a6571aa8b7 fix: avoid unnecessary macOS folder prompts on desktop startup
Start managed OpenCode from the app data directory instead of the home folder
Prevent unnecessary Desktop, Documents, Downloads, and Music access prompts
Add coverage for configured OpenCode working directory
2026-06-11 01:06:25 +03:00
Bohdan Triapitsyn d29a0c5697 fix: style agent mentions with primary color in markdown messages
Agent @mentions in markdown use the primary accent instead of generic link color
Mentions render without external URL favicons
Markdown mode now matches plain text mention styling
2026-06-11 00:46:34 +03:00
Bohdan Triapitsyn b46153801b feat: add Cursor usage quota tracking
Adds Cursor as a supported quota provider
Reads Cursor auth from env, token files, or local app data
Improves Cursor usage labels in the UI
2026-06-11 00:16:48 +03:00
Bohdan Triapitsyn a486e76233 chore: update runtime requirements
Require Node 22 or newer
Update project package manager to Bun 1.3.14
2026-06-10 17:37:19 +03:00
Bohdan Triapitsyn e3f3da4cb4 fix: restore dependency update compatibility
Fix VS Code webview type-check with TypeScript 5.9
Align ghostty-web to 0.4.0 across the workspace
Refresh ghostty-web patch for the updated package
2026-06-10 17:05:10 +03:00
Bohdan Triapitsyn 82d5bab81d chore: add renovate dependency updates
Add Renovate configuration with release age delay
Document lighter validation for docs and config changes
2026-06-10 16:03:19 +03:00
Bohdan Triapitsyn cc97710f9e fix: show update overlay in mobile layout
Shows the animated logo while OpenCode reloads on mobile
Keeps mobile update behavior aligned with desktop and web
2026-06-10 15:55:54 +03:00
Bohdan Triapitsyn 0c25c4aecb docs: update unreleased changelog entries 2026-06-10 15:39:14 +03:00
Bohdan Triapitsyn 2c0749ef1d fix: align archive all action in VS Code header
Moves the archive all sessions action to the right side of the header
Keeps the sessions title focused on text only
2026-06-10 15:28:24 +03:00
Bohdan Triapitsyn 12c8cbf544 feat: add right-click menus across sidebar rows
Open row actions at the pointer position
Keep three-dot menus working separately
Reuse shared menu styling for consistent visuals
2026-06-10 15:12:10 +03:00
Bohdan Triapitsyn 7a18e79bdb fix: improve Settings search results
Adds Window transparency to Settings search
Keeps Settings search group headers in normal case
2026-06-10 14:11:13 +03:00
Bohdan Triapitsyn c7a43bb8ec ci: add openchamber bot mention commands 2026-06-10 14:01:10 +03:00
Bohdan Triapitsyn fac4167499 test(sync): update stale tests to current pipeline contracts
Four sync tests had been failing for a while (CI doesn't run them, so
nobody noticed). All four asserted behavior that was deliberately
changed by earlier refactors — the production code is correct:

- Three event-pipeline tests still expected message.part.updated events
  to coalesce in the queue. That coalescing was removed in #1167 to
  preserve part update ordering (the new contract is covered by
  event-pipeline.test.ts). Updated the delta-ordering and no-coalescing
  expectations, and switched the routes-before-queueing test to
  session.status, which is still a coalescible type, so it keeps
  proving that coalescing happens on the resolved directory.
- One session-ui-store test expected shell sends to run inside an
  opencodeClient.withDirectory scope. Since #1228 the session directory
  travels as an explicit request param on shellSession; the test now
  asserts that contract directly.

All 165 sync tests pass.
2026-06-10 14:01:10 +03:00
Bohdan Triapitsyn 89aa389e6c fix(tray): show live activity for every session, not just one
The tray showed the busy indicator for at most one session at a time.
Several gaps in how per-session status was sourced stacked up to that:

- Status was derived by iterating each sync child store's session list,
  so a busy session missing from the list (created moments earlier from
  another window, the tray, or the API while session.created raced or
  the list got trimmed) was invisible even though the store's
  session_status map already held its busy entry.
- The upstream /session/status endpoint is directory-scoped — querying
  it without a directory only covers the server's own cwd, so there was
  no authoritative cross-project snapshot to fall back on.
- Status events for directories without a child store were dropped by
  the sync dispatcher, so sessions in unopened projects always rendered
  idle.

Fix, layer by layer:

- Add a cross-project session-status store (sync/global-session-status)
  fed two ways: the sync dispatcher now records status-bearing events
  (session.status / session.idle / session.error) for ALL directories,
  and the tray polls /session/status per visible-session directory to
  seed initial state and reconcile missed events. Snapshots clear stale
  entries both by directory key and by session id, so canonicalized
  (realpath) directory mismatches can't strand a busy entry.
- Read live status straight from each child store's session_status map
  instead of via its session list, and never let one store's idle entry
  clobber another store's busy/retry for the same session.
- Resolve a session as active when either source (child stores or the
  cross-project map) reports busy/retry, instead of letting the synced
  store's idle shadow the fallback.

Verified end-to-end in the dev shell: two sessions running concurrently
in different projects — including a brand-new session in the open
project root, the exact case that failed — now both show busy in the
tray, and both return to idle when they finish.
2026-06-10 14:01:10 +03:00
Bohdan Triapitsyn 079e3a9bd6 feat(settings): add item search (#1592)
Adds item-level search inside Settings so users can find concrete settings like provider auth, agent mode, terminal font size, tunnel options, notification events, and similar controls instead of only filtering top-level pages.
Groups search results by Settings page and shows localized labels plus optional descriptions where useful.
Supports keyboard navigation with Arrow Up/Down, Enter, and Escape, matching the existing autocomplete interaction style.
Opens the correct Settings page or split-page draft state before scrolling to the matching control.
Highlights the matched setting with a subtle token-based background so users can see where they landed without an aggressive outline.
Adds explicit data-settings-item anchors across Settings pages and a centralized search registry with runtime/mobile availability guards.
Updates Settings UI skill guidance so future Settings changes keep search registry entries, anchors, localization, and availability guards in sync.
2026-06-10 12:15:15 +03:00
Bohdan Triapitsyn eff6f46ad9 feat: improve mobile UX (#1591)
Added a mobile MCP overlay so MCP tools can be opened and managed from the mobile UI without relying on desktop-only dropdown behavior.
Improved mobile session panel touch handling so tapping the status/session area opens the right panel reliably on phones and tablets.
Cleaned up mobile usage provider metadata by removing duplicate rows, hiding unset providers, and showing provider logos consistently.
Added eager loading for provider logos used in mobile usage views to avoid delayed or missing icons when the panel opens.
Refined the mobile update and about flows in OpenChamber settings so release/update information is easier to read on small screens.
Adjusted related layout, header, VS Code layout, command palette, and settings text/localization details needed for the mobile polish.
2026-06-10 12:00:10 +03:00
Bohdan Triapitsyn 0153f8787d ci: prevent review bot probe comments 2026-06-10 11:56:53 +03:00
Bohdan Triapitsyn ba786f3b89 ci: fix manual review reaction cleanup 2026-06-10 11:46:26 +03:00
Bohdan Triapitsyn 3dad22433b ci: clarify repeat PR review chronology 2026-06-10 11:40:43 +03:00