7664 Commits
Author SHA1 Message Date
Bohdan Triapitsyn 3a0dbeafb4 fix(scripts): check the OpenCode server pin @openchamber/web bundles, not the Docker CLI install
The Docker image stopped installing @opencode/cli and now runs the server bundled with @openchamber/web, so the pin check found no Docker pin and failed bun run test. It now compares the root @opencode/client with the @opencode/server pins in packages/electron and packages/web.

Tested with bun test scripts/check-opencode-pins.test.mjs and node scripts/check-opencode-pins.mjs.
2026-11-23 02:23:24 +02:00
Bohdan Triapitsyn 141f528949 fix(sessions): keep a new session draft reachable when its save fails
On a poor connection (for example over the private relay) the first save of
a new project session draft could fail. Its text stayed in the composer's
local storage under the draft's own id, but the sidebar row came only from
the server, so after leaving the screen nothing led back to it and a new
draft opened empty.

A failed save now keeps the draft as an unsynced entry with its own row,
persisted in localStorage (attachment ids without bytes, merged per entry so
windows don't overwrite each other), shown before the server's list arrives,
and sent again after each successful list read. A 413 is not resent until
the draft changes, a draft the server never had is discarded without an
error, and a failed move leaves the draft where its local text lives.

Tested in an isolated dev instance with draft writes blocked: type, leave,
reload offline, reopen the row, reconnect; plus store tests for the retry,
the stored copy and the offline discard.
2026-11-23 02:00:16 +02:00
Bohdan Triapitsyn 90e608c069 feat(layout): keep the panel window within reach from the chat window
While the context panel lived in its own window, the chat window showed no
rail at all: nothing said where the panel went, and the only way back was
from the panel window itself.

The chat window now keeps a rail with two buttons. The top one, shown as
pressed, brings the panel window to the front: the desktop shell focuses its
window, the web focuses the popup, found again by its window name after the
chat window reloads. The bottom one, in the slot of the control that detached
the panel, brings the panel back here. It asks the panel window to return as
its own button does, so the panel comes back with what that window showed; a
panel window that reloads meanwhile is asked again, and one that is not
ready or does not answer is returned from the chat window's side and closed.

Tested in a web dev instance and electron:dev over CDP: detach, show, a chat
window reload followed by show, return, return while the panel window
reloads, light and dark, Arabic. The desktop window's OS focus could not be
observed from CDP; the show button runs the same command the shell already
uses to focus an existing panel window, and it reused that window.
2026-11-22 17:09:42 +02:00
Bohdan Triapitsyn d91828bcb5 fix(layout): line up and finish the context panel window
In the panel window the center zone sat 8px below the side zones, because
its card kept the bottom zone's top gutter, and on the web every card touched
the window's top edge. The center card now starts level with the side cards,
and without the desktop header the row keeps the cards' gutter above them.

The center was hard to reach. The zone menu there now names it "Move panel to
the center" with an icon of its own, next to left and right. Drop targets were
see-through, so the zone's content showed behind each label, and with a side
zone closed the center frame ran under that side's strip. Frames are now
opaque with the zone's icon above its label, an open card is cut to its
target, and in the panel window the gutters between them are plain page.
In Arabic and Hebrew the drop labels were swapped twice: the dictionaries
already name the start zone by its side, so the extra swap is gone.

The zone header's "open in its own window" button showed only on hover but
kept its slot, leaving a gap between the buttons; it is now always shown.
A Files surface with no file open hugged the right edge of a wide center or
bottom zone; the tree now fills it, and it snaps instead of animating when an
editor opens beside it.

Tested in a web dev instance and electron:dev over CDP, light and dark,
Arabic, a 760px window, the main window's drag overlay, the zone menu move to
the center, and a unit test for the drop frames.
2026-11-22 16:59:18 +02:00
Bohdan Triapitsyn 500db23335 fix(chat): type the queue store migration as the persisted shape
The queue store now persists a narrower shape, and its migrate returned
Partial<MessageQueueStore>, which failed type-check. The migration always
returns all three persisted fields, so it is typed as that shape.

Type-check and the queue store tests pass on the committed tree.
2026-11-22 14:33:37 +02:00
Bohdan Triapitsyn 645bb7493b feat(layout): move the context panel into a window of its own
With the diff on a big monitor and the chat on the laptop, the only way was
two main windows that knew nothing about each other.

The rail and the zone header (on hover) now move the whole context panel
into a window of its own: a BrowserWindow on desktop, a same-origin popup on
the web. That window is the app page opened with ?contextWindow=<main window
id> and shows the rail and left, center and right zones; the center is the
bottom zone filling the place the chat has in the main window. The main
window keeps the chat. Every context-panel store action called there is
forwarded over a BroadcastChannel and runs in the panel window, queued until
that window is ready, so file paths, diffs, comment targets, browser links,
terminals and tool files all open there. The panel window follows its main
window's project, session and composer address, so comments made there land
in the main window's composer and annotation screenshots attach there.

The panel window keeps its zone layout and tabs in a record of its own and
never writes them to ui-store, so a drag in one window does not rearrange
the other. Closing the panel window brings the panel back with what it
showed; the desktop app reopens it after a restart when it was open at quit.
The menu's panel toggle became a store action, so it decides in the window
that holds the panel. Zone drop targets and their labels now follow the
mirrored layout in right-to-left languages.

Tested with unit tests for the layout carry-over, the panel window's storage
and the center drop targets, and in a web dev instance and electron:dev over
CDP: detaching, routed opens before and after the window is ready, drags in
each window, a file comment landing in the main composer, following a
session in another project, returning, two main windows with their own
panels, and reopening after a restart.
2026-11-22 14:32:34 +02:00
Bohdan Triapitsyn 1d6cfd8d60 fix(sessions): don't count time away from the app toward retention
Automatic session cleanup measured a session's age in wall time, so someone
with a short retention period who came back after a week had everything they
worked on before leaving archived or deleted on the first run.

Each run now credits the device with one day of use; when the next run comes
later, the stretch past that day is an absence that no longer counts toward
any older session's age, on that run and every later one. Absences live in
their own localStorage key and are read-merged-written, so a stale tab cannot
erase them or rerun inside another tab's cooldown; those behind the cutoff are
pruned. Automatic runs start at launch or on user activity after the cooldown,
not in an app left untouched for ten minutes or in a window opened hidden.
The Settings preview and Run now use the same cutoff. Turning cleanup on, or
running it while off, counts plain wall time. A device with no history at all
(new browser profile, cleared storage) only starts the clock on its first
automatic run, since it cannot tell a week away from a first launch. The
tooltips say so in every locale.

Tested with unit tests for the cutoff, stored history and the hook's activity
gate (they fail on the old code), and live in an isolated dev instance: after
a week away with a 3-day period only the 12-day-old session was archived; a
fresh profile archived nothing; an app idle for ten minutes did not run, a key
press ran it, a hidden tab waited until shown.
2026-11-22 13:54:54 +02:00
Bohdan Triapitsyn 96a260b33d fix(browser): keep annotation screenshots reachable from every window
An annotation's screenshot was an attachment in one window's memory, while
its inline-comment draft is shared by every window and survives a reload.
Another window, or the same one after a reload, got a draft saying the
screenshot is attached with no image in the message.

The screenshot is written to IndexedDB under the draft's id before the
draft is added. Each composer brings a missing screenshot back into its
attachments, keeps a locally attached one stored (which also covers a
failed send restoring its drafts), and drops a local copy whose draft or
screenshot went away in another window. A record goes when its draft
leaves the store or loses its screenshot; records without a draft are
pruned at startup after a minute. Restoring attachments no longer cancels
a file the composer is still reading.

Tested in two Electron dev windows: an annotation attached in one window
gives the other window's composer the same image, a reload brings it back,
and removing or sending the draft in either window removes it, its record
and the other window's copy. Unit tests cover the store round trip,
cleanup on send, and a restore during a paste.
2026-11-22 13:47:23 +02:00
Bohdan Triapitsyn da722de929 fix(vscode): keep other panels' queued messages when one panel saves
VS Code's editor panels share one webview origin and so one
message-queue-store key, and VS Code keeps the queue locally. Each panel
wrote the whole map from its own memory, so queuing in one panel erased
another panel's queued messages from storage; they were lost when that
panel reloaded or VS Code restarted.

The deferred JSON storage takes an optional merge hook applied at flush.
The queue store uses it to start from what storage holds and replace only
the queues this panel changed since its last flush, plus queues it cleared
or forgot even when it never held them. An unreadable stored queue falls
back to this panel's copy. Server-owned queues skip the merge. Panels do
not follow each other live, since two panels holding one queue would each
auto-send it.

Tested in two VS Code dev editor panels: both panels' queued messages stay
in storage and a clear in one removes only its own. Unit tests cover the
merge, a clear of an unseen queue and a broken stored queue.
2026-11-22 13:42:26 +02:00
Bohdan Triapitsyn 2123acc7fb fix(worktree): report a failed bootstrap by its known cause
A failed worktree bootstrap said "Worktree bootstrap completion is unknown"
whenever the failure was not a hydration result, including causes the server
knew: a stale source control binding, a changed repository or configuration, a
timeout. A hydration plan that went stale between planning and running lost
its STALE_CONFIG code on the way, because the operation ended without a
hydration payload. A Git command that failed with its own message read the
same way, though completion was known to have failed.

Bootstrap now keeps the codes it knows (binding, repository and configuration
mismatches mapped to STALE_BINDING, STALE_REPOSITORY and STALE_CONFIG, plus
REMOTE_CHANGED, TIMEOUT, CANCELLED, RUNTIME_UNSUPPORTED, OUTCOME_UNKNOWN), and
a hydration operation without a result hands its error code over. UNKNOWN now
reads "Worktree setup failed. Git's message is in the server log.": Git's own
text can carry private paths, so it stays out of the bootstrap record, and
both callers log it. A bootstrap whose end nobody saw (a restart mid-setup, an
unreadable or unwritable record) is OUTCOME_UNKNOWN and keeps the "completion
is unknown" text, the one case where that is true.

Testing: service tests for a stale binding during checkout hydration, a Git
failure in worktree add and an unreadable record; full git, sessions and
source-control server suites pass. In an isolated dev instance, a worktree
whose branch ref was locked reported the new UNKNOWN text with Git's message in
the server log, and a reviewer reproduced a HEAD change between hydration
planning and running, which now records STALE_CONFIG.
2026-11-22 13:32:14 +02:00
Bohdan Triapitsyn f181aaefa9 fix(worktree): say plainly when submodules or LFS files come from no network remote
A worktree whose repository has no network remote to fetch from (its remote is
a folder on disk, it has none, or the start branch tracks none) and that has
submodules or Git LFS content failed its bootstrap with "Worktree checkout
authentication is required". Setting up access could never help: source
control transport leaves disk remotes out by design, so hydration had no
parent remote at all.

Hydration now reports such parts as invalid with SUBMODULE_SOURCE_LOCAL or
LFS_SOURCE_LOCAL. The text says what was not fetched, why, and what unblocks
the worktree: work in the repository folder itself, or start the worktree from
a branch whose upstream is a network remote. It names no manual Git command,
because fetching the content by hand leaves the bootstrap failed. The codes are
accepted by the server's operation and bootstrap records and the UI schema,
and the bootstrap toast has the text in every locale.

Testing: network-operations tests for local-HEAD worktrees with submodules and
LFS assert the new codes and text; full git, sessions and source-control server
suites pass. In an isolated dev instance, worktrees of a disk-remote repository
with a submodule and with LFS content now report these texts through both the
New worktree dialog and the agent tool.
2026-11-22 13:28:23 +02:00
Bohdan Triapitsyn eabe7a2dd7 fix(composer): share inline comment drafts across windows
Every window of the app (desktop windows, Mini Chat, browser tabs, VS Code
webviews) persisted the whole inline-comment draft map under one storage key
without reading the others' writes. A comment made in the diff window never
showed in the chat window's composer, and the next write from either window
erased the other's comments.

Each window now adopts another window's write from its storage event: it
flushes its own pending write, reads what storage holds, and keeps arrays
of unchanged sessions. Adopted maps and no-op actions are not written back,
so two windows that wrote at once converge instead of replaying each other's
copy; unreadable values and failed reads are ignored. An untouched comment
editor follows the stored text and writes nothing on close, and finishing a
composing comment removes it only when the stored text is empty.

Shared-page chips had the same erase: a save now keeps what storage holds
for every draft this window did not change.

Tested in two Electron dev windows, Mini Chat and two Chrome tabs: add,
remove, send and edit in one window show in the other and storage keeps
both windows' drafts. Unit tests cover adoption, no write-back, no-op
actions, malformed values and the chip merge.
2026-11-22 13:13:50 +02:00
Bohdan Triapitsyn b30b853355 fix(project-actions): hide actions meant for another OS than the server's
An action limited to Windows showed in the actions menu, dialog and command
palette on a Mac, although the docs promise per-OS limits; the filter went
away in a dead-code cleanup. The OS that counts is the one where the command
runs, the server's, also for a web client on another machine. The project
config route now says which one it is, and the runner keeps only actions for
it, auto-discovery included. Settings still list every action. A server that
does not say (older server, VS Code) shows all, as before.

Testing: unit tests for the filter and the route; a live run with a client
emulating Windows against a macOS server: the Windows-only action was hidden,
the macOS-only one shown.
2026-11-22 13:09:51 +02:00
Bohdan Triapitsyn 4bff4715dd feat(agent-tools): let agents run the project's actions
A user kept a skill that told the agent how to start their app, while the
project action already held that command. The new openchamber_actions tool,
off by default (Settings > General > OpenChamber Tools > Project actions),
lists the actions for this server's platform, runs one the way the actions
menu does (session folder, or the project root for runIn: parent), reads its
output and stops it. Sessions in a project with actions get a short guidance
line while the tool is on.

A run the agent starts is a normal project-action terminal marked with the
OpenCode session that started it. Every client adopts it as that action's
run and marks it "by agent" in the header, menu and dialog. A run the user or
another session owns is never replaced: run answers whose it is, and stop
refuses it. Untrusted shared actions and isolated-space folders are refused.
Agent runs end on stop, when their session is archived or deleted, or when
the server stops; idle cleanup leaves them alone. Address templates are
filled for the checkout as the menu fills them.

To keep the oversized files from growing, the agent tool's action lists now
come from one map in openchamber-control/actions.ts, managed-plugin settings
match agent*ToolEnabled by name, the session event handling for the agent
tool moved into its runtime, and toolHelpers builds the OpenChamber tool
entries from one list (the terminal tool now reads "OpenChamber Terminal").

Testing: unit tests for the tool on the real terminal runtime (ownership,
dedupe, trust, platform, space refusal, idle sweep, session end during a
start), agent tool registration, session guidance, managed config and UI
purpose propagation; a live run with a real agent that started, read and
reused runs, left the user's run alone, and stopped on archive and delete.
2026-11-22 13:02:39 +02:00
Bohdan Triapitsyn e301f5b6e9 fix(git): keep a worktree branch's base right through agent creation and restacks
Worktrees made through the agent tool showed master as their base: the Git
view's Re-integrate commits target came from in-memory metadata only the UI
dialogs set, then fell back to the project root's branch, and offered to move
the parent branch's commits too. A branch started from HEAD (multi-run,
extensions, the agent tool without startRef) recorded no parent at all. After
a restack made outside OpenChamber (git rebase --onto in a terminal) the base
kept the stale recorded parent, so Changes counted the new parent's commits as
the branch's own. The unpublished-commits counter counted a branch made from a
feature branch against main. A startRef such as refs/heads/feat was parsed as
remote "refs" and failed the creation. Worktree creation in a repository cloned
from a local path or file:// failed its bootstrap with "Git transport remote
binding changed".

Every new branch now records the branch it starts from in
branch.<name>.gh-merge-base, the primary checkout's branch for a HEAD start,
on the web server and in the VS Code service. getBranchBase reads the branch's
own reflog: when its latest rebase landed on a commit the recorded parent never
pointed at, the one branch that moved there becomes the base; backups created
at that commit, the branch's own remote copy and ambiguous candidates do not.
Re-integrate commits starts on the same base Changes and pull requests use.
Status counts an upstream-less branch from that base. Checkout hydration no
longer names a remote whose fetch or push address is on disk, which source
control transport leaves out by design.

Testing: new service tests for HEAD and full-ref starts, terminal restacks,
backups, deleted parents, the ahead counter and disk remotes, all failing on
the old code; full git service suite and the VS Code worktree tests pass. In an
isolated dev instance, an agent-created worktree from a feature branch shows
that branch in Re-integrate and Changes, a terminal restack onto master moves
the Changes base to master, and worktrees are created through both the dialog
and the agent tool for https, path and file:// clones.
2026-11-22 12:43:07 +02:00
Bohdan Triapitsyn 2e020f118e fix(chat): attach mentioned skills to queued and first messages
A $skill mention reached the model only as a text hint when the message
went through the queue: the queue captured a ready-made instruction and
the server sent just that. A skill with disable-model-invocation is not in
the model's skill list, so the model answered that the skill did not exist.
A direct send in a fresh location lost the skill the same way, because
OpenCode lists no skills until the location's plugins are active.

Queued items now keep the skill names. The server queue, the manual queue
send and the VS Code auto-send attach the skills OpenCode knows as
prompt.skills and name the rest in an instruction, as a direct send does.
The server lists skills and commands for the session's location
(location[directory]; the directory query param was ignored, so project
commands in the queue were never found) after GET /api/model, which waits
for plugin activation; a direct send waits on /api/model/default the same
way. On "Skill not found" the prompt goes again without the skill and with
the instruction. Instructions get ids saved to the queue file per set of
names before they are posted, so a retry never adds one twice or drops a
newly missing skill, and a staged revert is committed only right before a
synthetic message goes out, after its id is saved. Items queued by an
older build deliver as before. The skill logic moved into
message-queue/skills.ts, messageQueueMentions.ts and skill-mentions.ts.

Tested against a real OpenCode 2.3.2: the queue runtime attached a
project skill with disable-model-invocation in a cold location, and a
first direct send in a new folder attached the skill that was dropped
before. Symlinked and junction skill folders list the same on Windows.
Queue tests cover the retry, revert and cold-command cases.
2026-11-22 12:25:24 +02:00
Bohdan Triapitsyn 349c62c674 fix(ui): clarify prompt cache label in work status
The work status row previously read "Cache hit (reply)", which was unclear without context and had no hover explanation.

Rename the label to "Prompt cache" across all 15 locales and attach a tooltip on WorkStatusRow explaining that the percentage reflects the share of the latest reply's prompt read from cache.

Verified with packages/ui/src/lib/i18n/messages.test.ts and workspace type-check/lint for @openchamber/ui.
2026-11-22 12:25:03 +02:00
Bohdan Triapitsyn c8b2684477 feat(browser): show running apps by page title and favicon, search from the address bar
The start page listed every listening port as a raw localhost:PORT row. On
Windows discovery comes from netstat, which names no folder, so the filter
for servers outside the user's projects never applied and the list was a
wall of ports nobody could tell apart. Text typed in the address bar that
was not an address opened a blank page.

The server now probes each discovered port over HTTP (6 at a time, 10 s per
port, cached 20 s per port and pid, the panel waits at most 800 ms) and adds
a page field with the title and favicon as a data URL, or null when the
port serves no web page. HTML answers with 2xx or 5xx count as pages, so a
broken dev build stays listed; JSON APIs and Express "Cannot GET /" go
behind "show hidden ports", and a port that has not answered yet stays in
the main list. Favicons: ICO files up to 1 MB are cut down to the frame
closest to 32 px, a PNG served as .ico is read as PNG, and an oversized
linked icon falls back to /favicon.ico. The dev tunnel's allowlist is
unchanged. Rows show the favicon, the title and the port; the command
moves to the tooltip when there is a title, and the list is wider so long
titles fit.

Text that does not look like a host goes to a Google search. In the web
app the panel is an iframe and Google refuses framing, so the framed URL
carries igu=1 while the address bar shows the clean one.

Tested in an isolated web dev instance with HTML, JSON and raw TCP
fixtures plus real servers: the list showed the named apps with their
real favicons (multi-size ICO, BMP-frame ICO, SVG from Vite) and hid 33
other ports; "react hooks" loaded Google in the frame.
2026-11-22 12:22:25 +02:00
Bohdan Triapitsyn aad7db8254 feat(sidebar): hide and reorder individual pages in the Pages section
The Pages section could only be shown or hidden as a whole, so pages from
extensions a user keeps for other reasons stayed in the sidebar for good.

The Pages row in the sections manager has a pencil that opens the list of
pages, each with its own switch and a drag handle. The order and the hidden
pages are profile settings (sidebarPageOrder, sidebarHiddenPages) shared by
every surface, so an older desktop or VS Code client that saves settings
does not drop them. Ids the client does not know keep their place, and a
page missing from the stored order (a new built-in page or a newly
installed extension) appears after the page it follows by default instead
of disappearing. When every page is hidden the Pages heading goes too.
Projects stays always shown. Server-side sidebar sanitizing moved into
settings-sidebar.ts.

Tested in an isolated web dev instance with four test extensions: hiding
three removed them from the sidebar, dragged order matched the sidebar,
state came back from the server after a reload with empty localStorage,
and an extension installed after saving the order appeared at the end.
Unit tests cover ordering, unknown ids and sanitizing.
2026-11-22 12:19:51 +02:00
Bohdan Triapitsyn 0ef2903fc5 docs(web): note bundled OpenCode server in install docs and READMEs
Problem: README.md, packages/web/README.md, and the install/quickstart docs still stated that the web/CLI app requires a separate OpenCode CLI installation.

Approach: Update README.md, packages/web/README.md, and all 12 locales of install.mdx and quickstart.mdx to reflect that @openchamber/web bundles the matching OpenCode server and only requires Node.js 24.14+ (leaving standalone OpenCode CLI required only for VS Code or Alpine/musl Linux).

Testing: Verified diffs across all 26 documentation files.
2026-11-22 12:16:59 +02:00
Bohdan Triapitsyn 9051277326 chore: update OpenCode server bundle guidance 2026-11-22 12:11:22 +02:00
Bohdan Triapitsyn 3281d86afe feat(ssh,docker): use bundled OpenCode server in SSH remote startup and Docker image
Problem: Desktop SSH managed startup still required a standalone opencode CLI on the remote host even when @openchamber/web bundled OpenCode, and the Dockerfile still installed Debian Node 20 plus the global @opencode/cli binary.

Approach: Probe the remote openchamber installation in ssh-manager.mjs for a runnable bundled OpenCode server (Node 22.15+, non-musl Linux, build/opencode-server/serve.mjs and manifest) and omit OPENCODE_BINARY when present, falling back to the remote opencode CLI lookup for older installations. Update Dockerfile to copy official Node 24 from node:24-slim into the runtime image and drop the global @opencode/cli install.

Testing: Verified with bun test packages/electron/ssh-manager.test.mjs (42 passed, including the new bundled-server case) and node --check packages/electron/ssh-manager.mjs.
2026-11-22 12:02:08 +02:00
Bohdan Triapitsyn b14ca90868 fix(spaces): start and send, name the space in the header, quieter setup and settings
Problem: after "Start" on the stopped-space toast the message stayed in the
composer and had to be sent again; the session header named the project's
branch, so work in a space looked like work on the host; "Run setup again"
showed in projects with no setup commands; and Settings for isolated
spaces, turned off, was a lone checkbox with no word on what it does.

Approach: the toast action is "Start and send". It starts the space and
holds one send for the composer it was pressed in, which an effect sends
once the host lists the space running and the composer has a model: a
stopped space's session shows the default model and a draft's model list
comes from OpenCode inside the space, so a send right after the start was
refused. A refused model is first replaced by the session's own model,
then by a granted one; another draft on screen or a failed start drops the
send and keeps the text. The header, the mini chat and the status panel
name the space with its icon. The space menu reads the project's setup
on each opening and offers the action only with commands, hidden until
the read answers so Delete never moves under the cursor. Settings shows
the explanation under the checkbox while the feature is off.

Testing: live on a dev instance with Colima, turns on
opencode-go/deepseek-v4.1-flash: session with a refused model shown,
draft in a stopped space, switching away before the start ends; setup
item with and without commands; header and status panel; settings off
and on. Unit tests for the pending send steps; bun run check:changed
clean for these files.
2026-11-22 11:59:21 +02:00
Bohdan Triapitsyn 8b01b73164 feat(web): bundle OpenCode server in @openchamber/web
Problem: Installing and running @openchamber/web required a separate global opencode CLI installation, creating setup friction and version skew with OpenChamber's pinned OpenCode client and plugins.

Approach: Move the shared opencode-server entry and bundler into packages/web (reused by Electron's prepare-opencode-server), bundle serve.mjs into packages/web/build/opencode-server during build:server, add the four native wrapper packages to packages/web dependencies so npm/Bun installs host platform binaries, and resolve them from node_modules in assets.mjs. Prefer the bundled server ahead of PATH in env-runtime, cli-runtime, and cli-startup while skipping it on unsupported runtimes (Node < 22.15, Bun without a compatible Node, or Linux musl where @lydell/node-pty lacks musl binaries), exclude the web bundle and native wrappers from Electron's asar, and skip offline bundling in Nix.

Testing: Verified live startup without opencode on PATH on macOS arm64 (Node and Bun with NODE_BINARY) and Linux x64 via bun install of packed tarballs on Node 22.23.3 (health, /api/project, /api/agent, and POST /api/pty all 200). Passed 245 web Vitest tests, 7 opencode-server node:test cases, Electron staging verification, type-check:server, and lint:server.
2026-11-22 11:57:12 +02:00
Bohdan Triapitsyn 30c70496a5 release v2.8.0 v2.8.0 2026-11-22 02:19:13 +02:00
Bohdan Triapitsyn 2cc8d7ce6e feat(lead): switch a new-session draft between Session and Lead
A draft became a lead only through the project "+" menu or a shortcut,
so most users never found leads. The draft's target row now ends with a
text switch, Session / Lead, styled like the composer's model / effort
label: the active kind in the foreground, the other muted. Its tooltip
says what a lead does and shows the new_lead shortcut, and the Lead
button carries the same text as its description for screen readers.
VS Code, which cannot start leads, does not show it.

A saved draft dropped its kind, so a Lead draft reopened from Drafts
sent an ordinary session. The kind now travels with the draft through
the drafts API and is restored when the draft opens; switching only the
kind saves too.

On a phone the drafts count shrinks to an icon and chevron and the
project keeps its width, so the switch stays on screen next to a long
branch.

Tested live in an isolated dev instance on desktop and at 390 px in
English and French: the switch sets the kind and heading, a Lead draft
saves with lead: true and reopens as a lead. Behavior net on the changed
scenarios is green.
2026-11-22 02:08:18 +02:00
Bohdan Triapitsyn cb45f2f8e8 fix(settings): name the OpenCode section OpenCode Server and drop the duplicate plugin banner
The section configures which OpenCode server OpenChamber runs or connects
to, so it is called OpenCode Server in every locale. The OpenChamber
Tools section showed the same external plugin banner as the OpenCode
section on the same page; it now shows once. Docs point at the renamed
section and describe updating the shared service.
2026-11-21 23:33:09 +02:00
Bohdan Triapitsyn 3b44da9aa3 fix(opencode): replace a shared service older than the installed CLI
With the shared service setting on, OpenChamber reused whatever
`opencode serve --service` was registered. After `opencode update` the
daemon kept running the old version, so About and the update toast kept
asking for a restart that changed nothing.

Connecting now reads the installed CLI version and passes Service.ensure a
predicate that replaces an older release service and keeps an equal or
newer one. Previews, an unreadable version, enterprise mode and the
rollback after a failed switch reuse the running service. The version probe
and the service command both go through the managed launch resolver, so a
Windows .cmd shim launches the native executable.

The update toast now offers Update in shared mode: it runs
`opencode upgrade` with the service's CLI, and Reload reconnects, which
replaces the daemon and refreshes the UI. The health snapshot reports
shared-service or external as the binary source instead of the managed
binary it would have launched.

Tested with unit tests and live in an isolated dev instance: a 2.2.7
shared service showed the Update toast, and after the CLI became 2.3.2 a
config reload replaced the daemon; a second reload left it alone.
2026-11-21 23:33:09 +02:00
Bohdan Triapitsyn 7605cb472c fix(desktop): replace the retired opencode-claude plugin with Claude Agent
The deprecated @openchamber/opencode-claude plugin calls Bun.serve when
it loads. The desktop's bundled OpenCode runs on Node, so with the plugin
listed every Claude turn failed with "Bun is not defined".

Before each managed OpenCode start the server now removes the plugin from
the global opencode.json/jsonc, keeping the rest of the file. Once OpenCode
answers, it connects the built-in Claude Agent provider through the Claude
Code login unless Claude Agent already has a connection, and the UI shows
a toast saying which of the two happened. Saved claude-code model picks
are not carried over; the toast asks the user to pick them again. Folder
configs and an external OpenCode are left alone.

Tested in an isolated dev instance on the bundled Node server with a fake
claude CLI: the plugin reproduced the Bun error before the change; after
it the plugin was removed, Claude Agent connected with its models listed,
the toast appeared, and a second start did not add another connection.
2026-11-21 22:48:15 +02:00
Bohdan Triapitsyn 379892f150 fix(chat): name a shell row Shell
The row read Shell Command, which pushed the command it ran further into
the ellipsis, most of all at a phone width. The tool's own name says what
it is and leaves room for what it ran.

The chat scenarios now look for the new copy.

Verified with bun run verify -- chat.history.agent-turn chat.tool-rows
chat.tool-running chat.activity.toggle chat.notices: 19 passed, 0 failed.
2026-11-21 22:26:35 +02:00
Bohdan Triapitsyn a16bfa5269 fix(dispatch): report every answer of a session the parent runs
A dispatched result was one entry per prompt: the first turn that ended after
the send was delivered and the entry went. A child that started background
subagents answered "started, waiting", and its real answer, in a later turn
their reports started, reached nobody.

A session the parent runs (created with ownWork, or handed to a lead) now
reports every turn it ends, whatever started it. Each tick reads the session's
operator-child link; while it names the parent and the session is not
archived, one follower per parent and session keeps a cursor and delivers
every turn after it, turns read together in one message with a body each.
The minted message id is persisted with the idle record it covers, so a retry
after a crash resends exactly that range and newer turns go under a new id.
Taking the session over or archiving it stops the reports; a parent that is
gone drops the follower; an unreadable record retries. A hand-over registers
the session whether or not it is running. Sessions the parent only sent a
prompt to keep the single answer. At the 200-entry limit one-answer entries go
first, and a registration that cannot be kept is refused.

Tested live in an isolated instance with DeepSeek V4.1 Flash: an ownWork child
reported its first answer, then a turn started without the parent, and nothing
after it was archived. Unit tests cover following, quick turns, a failed turn
in a batch, the crash retry, a takeover before the first turn, a record that
does not parse, duplicate entries, legacy entries, the limit and hand-over.
2026-11-21 21:28:20 +02:00
Bohdan Triapitsyn 270e8310d2 fix(sessions): clear what a subagent copies from its parent
OpenCode copies a parent's metadata into every child it creates without
metadata of its own, so each subagent of a lead carried the lead mark and
digest and showed as a lead in the sidebar, along with the parent's work
state, linked issues, an active goal and pins.

When a session with an OpenCode parent appears, the server now removes every
key of its openchamber namespace that still equals the parent's, and lists
lose the parent's entries while keeping the child's own. The lead mark always
goes, since a lead has no parent and the parent may rewrite its digest first.
Children linked only by metadata (workflow agents, operator children) and
children created with metadata of their own are left alone. The UI no longer
counts a session with a parent as a lead, which also hides the mark on
children that copied it before this change.

Tested in an isolated dev instance: a subagent-style child ended with an empty
namespace and kept unrelated keys, a child with its own metadata kept it, the
parent was untouched. Unit tests cover the patch, the event gate and the UI.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn d8d3c5d93e docs(skills): record PR triage landing rules from the 2026-11-21 round
finish.sh tells a branch GitHub refuses to write to (exit 4, an organization fork) apart from an author push. The triage skill adds the end-of-round cleanup, keeping the what-changed file current, the lease after our own push to an author's branch, and the maintainer's standing decisions on attachments, Share and Changes.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn da49b69193 feat(workflows): port conflicting PRs onto the refactored main
Adds the pr-port workflow, which carries a PR that conflicts after the TypeScript server refactor onto current main as one commit authored by the PR's author, reviews the port and sorts findings into port fixes, defects and scope. pr-triage-finish takes fromPort to start from that commit instead of preparing the PR again.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn cb0544979b feat(lead): mark leads with an agent branching to its sessions
The summit-with-pennant lead icon read as a coat hanger at 14px in the sidebar. The new custom glyph draws an agent's head with its work branching to three sessions, in the same 2px lines as Remixicon. The sprite name changes from lead-flag to lead, since there is no flag left.

Sprite regenerated; bun run check:changed passes.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn fab4bee2fd fix(lead): ask the user by general rules and keep the work moving
The lead rules said to ask the user only where the answer changes how the
app behaves, which fits product code and not a lead that triages PRs,
researches or writes. They now say what a lead cannot settle alone: a
preference or fact only the user has, a choice between options the user
would judge differently, or a step that is hard to undo or reaches people
outside the work, unless the user already gave that call; never to check it
understood. A new rule has the lead look at what a finished strand leaves
around it, take what belongs to its outcome and offer the rest as digest
suggestions. Code-only wording (uncommitted, repository) became general.

Tested with the session-lead unit tests; the text is prompt only.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn d65e996028 fix(control): return what the user attached in session.messages
The UI sends quotes, code comments, lead digest replies and answers to reply
blocks and pages as synthetic messages before the user's message, and the
user's own words to a quote live only there. session.messages returned only
user and assistant records, so an agent rereading a session after a
compaction saw nothing for those turns.

Those synthetic messages now come back as user messages marked attached:
true; notices and subagent reports stay out. Messages of the same
millisecond keep OpenCode's id order, so last: true still returns the prompt,
and an extension's Retry resends the last prompt the user typed, skipping
attachments. The text projection moved to session-text-messages.ts because
service.ts is over the size limit.

Tested with service and service-host unit tests: the projection with each
kind, a quote sharing its prompt's millisecond, and Retry after a quote.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn eda8292cec feat(lead): answer the digest in one reply and show lead calls as cards
The digest popover sent each answer the moment a button was clicked, pushed
suggestions into the composer, and its first suggestion showed its buttons on
open because the popup focused them. Answering felt like prompt suggestions,
and an accepted suggestion read to the lead as an order to drop current work.

The popover is now a form: each question offers the lead's options as chips
plus a field for the user's own answer, and each suggestion has Accept and
Decline. Choices stay local to the digest they were made on and go out as one
synthetic input when a click settles the last open item, or on Send / Enter
for a partial reply. The text tells the lead accepted suggestions join its
queue behind the work in progress; declined ones also land in lead.dismissed.
Sent items stay closed until their message arrives, so they cannot go twice.
The transcript notice lists a batched reply; older single-answer messages
still parse. Sections read Needs you, Suggestions, News, Now.

lead.brief and lead.digest calls get their own transcript cards (row verbs,
the brief edit or text with its size, the digest by section) and an Open the
brief action that shows the brief file in the Files viewer; lead.brief
answers carry the file path once the brief exists.

The lead rules now say what strand state belongs in the brief and how to
reread history after a compaction (start from the last turns, filter inside
the script for all of it); the sleep note names the session id that
session.messages needs.

Tested in isolated dev instances with DeepSeek V4.1 Flash on made-up data:
partial and automatic sends, Enter, a failed send, double Send, the declined
item in lead.dismissed, the notice, all three cards and Open the brief.
Unit tests cover the reply schema and text, notices, view schemas and verbs,
and the lead actions.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn ad1e4ded1f feat(terminal): list terminal tabs in a sheet on portrait phones
On a portrait phone the terminal tab strip shared its row with the
new-tab button and four actions, leaving room for about one squeezed tab
whose always-visible close button sat where a tap to switch lands. With
three tabs, switching became hard and closing a tab by accident easy.

Below 640px on a phone, outside the tablet layout, the header now shows
one trigger with the active tab's icon, name, a tab count and a chevron.
It opens a bottom sheet listing every tab with its full name, rename and
close, plus a row for a new tab. Landscape phones and tablets keep the
strip. The strip, new-tab button and sheet moved into TerminalTabsBar.

Tested in an isolated dev instance at 390x844 with touch emulation:
creating, closing, selecting and renaming tabs, a long name, rotation to
844x390 and a 600x960 tablet keeping the strip, Arabic and light theme.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn 4f2b563a63 feat(opencode): add shared OpenCode service mode, skills/commands bridge, and global plugin switches
Problem: Connecting OpenChamber to a shared local opencode serve --service daemon required manual env vars, and external local servers lacked extension skills, the new-extension command, and Settings -> Plugins enable/disable toggles.

Approach: Add useGlobalOpenCodeService setting and Settings -> General -> OpenCode CLI toggle backed by @opencode/client/service (discover/ensure) with safe live switching, rollback on failure, enterprise launch guard, and sanitized child env. Extend external-plugin-bridge to register extension skills and commands via ctx.skill.transform and ctx.command.transform, add global-config-backed plugin switches for external local servers, and update English and 11 localized docs pages.

Testing: Verified with server tests (shared-service, lifecycle, external-plugin-bridge, global-plugin-switches, settings-helpers), UI/registry/i18n tests, live opencode serve --service discovery, and bun run check:changed.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn 29ee70c3fc feat(opencode): add external local OpenCode plugin bridge
Problem: When OpenChamber connects to an externally managed local OpenCode server, it cannot inject OPENCODE_CONFIG or callback env vars, so OpenChamber tools, limit failover, and session title prompts are unavailable.

Approach: Materialize a single stable plugin folder under <dataDir>/plugins/openchamber that reads <dataDir>/runtime-bridge.json (mode 0600) with pid liveness checks and fs.watch reloads. While OpenChamber is running, the plugin registers enabled OpenChamber tools, dynamically removes replaced built-in OpenCode tools, and runs failover/title hooks; when OpenChamber closes or when OPENCHAMBER_AGENT_TOOL_URL is set (managed mode), the plugin stays dormant and restores built-in tools. Expose authenticated GET/POST/DELETE /api/config/external-opencode-plugin routes and an opt-in banner in Settings with Add/Remove and copyable plugin path.

Testing: Verified with 221 server tests, 15 UI/i18n tests, live OpenCode 2.3.2 catalog and agent reload checks, and bun run check:changed.
2026-11-21 21:15:16 +02:00
Bohdan Triapitsyn 2e569fb96e style(chat): open the lead digest with a smaller, shorter motion
The digest panel used the menu motion, scaling from 95% over 251 ms. On a panel as wide as the chat that sweeps about 40 px on each side, which pulled the eye every time it opened. It now scales from 98%, as dialogs and the Settings window do, and opens in 150 ms; closing keeps the menu's 110 ms. Checked that the merged class list drops the menu's scale-95.
2026-11-21 21:15:15 +02:00
Bohdan Triapitsyn 5f3156745e fix(sessions): keep a lead's brief ahead of its digest
A lead marked late in a long session wrote its digest twice and never its
brief. Sleep compaction then replaced the conversation with a note built
from the digest alone, and the note claimed the brief was still in context.

lead.digest now refuses with 409 until the lead's brief file exists, so the
model writes the brief first. A lead with no brief, or whose brief cannot be
read, still sleeps but gets the model's summary instead of our note, and the
compaction hook drops the note when the brief entry could not be refreshed.
The staged-undo and busy checks now run last before the compact request, so
an undo staged while the runtime was reading is not committed by it.

Tested with the session-lead runtime tests: digest refused without a brief,
sleep without a brief or with a failing read falls back to the model.
2026-11-21 21:15:15 +02:00
Bohdan Triapitsyn 72dcbe546e feat(ui): return to previous context panel on close
Problem:
When jumping from one context panel to another in the same workspace zone
(for example Git -> Changes -> File, or opening a file from chat while a
panel is already open), closing the opened panel closed the entire zone
instead of returning to the previous panel.

Approach:
- Track an in-memory per-directory, per-zone return stack in useUIStore
  (`contextZoneReturnStack`), pushed on programmatic tab opens
  (`openContextPanelTab`, `openTrackerItem`) and cleared on explicit rail
  switches (`openContextSurface`), zone closes, and destination zone moves.
- Update the panel header close button via `useContextZoneCloseAction` to
  unwind the return stack (`closeContextZone(..., { returnToPrevious: true })`)
  and display a localized "Back to {panel}" tooltip/aria-label while a
  return target is available.
- Route local walkthrough jumps from DiffView and PullRequestSection through
  `openContextPanelTab` so they preserve the return path.

Testing:
- Added unit tests in `useUIStore.contextPanel.test.ts` covering stack
  unwinding, rail switches, same-surface tab switches, cycle prevention,
  cross-zone moves, eligible tab filtering, and directory eviction pruning.
- Ran `bun test packages/ui/src/stores/useUIStore.contextPanel.test.ts packages/ui/src/lib/i18n/messages.test.ts` (107 pass) and `bun run check:changed` (all pass).
- Verified Git -> Changes -> Back to Git -> Close panel in a live dev instance.
2026-11-21 21:15:15 +02:00
Bohdan Triapitsyn 7199f005cc fix(chat): keep Show notes text drawn, quotable and restorable
Four defects in the Show notes Activity mode (activityRenderMode 'text').
Collapsed and Expanded render as before.

- A kept note streamed by its part's end time alone, so a finished step's
  short note without a trailing blank line drew nothing under a closed
  fold. It now takes the phase ChatMessage gives the message that wrote
  it (ShownPartStreamPhaseContext from TurnRow); the part's end time still
  finishes it early.
- Quotes on kept notes were captured against the notes joined together,
  which no longer matches once Activity opens and puts the tool rows back
  between them, and the answer's stream counted the notes nested in it.
  A quote root's stream now leaves out nested quote roots; kept roots are
  pieces of their message's stream, so context is read and compared only
  inside a piece, the in-context match nearest the taken position wins,
  and a selection across two pieces takes no anchor.
- An answered form kept after a note became a page boundary, so a turn
  that stopped without an answer drew later steps below the closed fold.
  The boundary now comes from what Collapsed would show.
- A long kept note filling the viewport with no message mounted saved no
  scroll anchor. Kept text is now the anchor when no message is in view,
  named by its row (data-row-key) and part; restore finds the part where
  it is drawn now, never opens the fold, and stops once the saved row is
  mounted without it.

Tests: one case per defect that fails without its fix (LiveTurnActivity,
chatQuoteAnchor, messageViewportAnchor); full packages/ui suite and
check:changed pass.
2026-11-21 21:12:17 +02:00
Bohdan Triapitsyn 54f3acf565 test(verify): follow held office attachments and the workflow approval choice
composer.attach.document-ask and document-save expected an office document
attached as is to be saved where OpenCode runs and linked by path in the
composer. Since attachments are held in the draft and written only at Send,
the document shows as an ordinary attachment chip, no path chip appears before
Send, and the sent prompt carries it. Both scenarios now send the prompt and
check the document reaches the bubble.

workflows.approval clicked the old "Start runs without my approval" checkbox,
which became a No / For leads / Always choice. asks-first picks No and checks
both auto-approve flags saved false; starts-without-approval picks Always.

Testing: bun run verify for the four scenarios, then the composer and
workflows zones (41 passed); check:changed passes.
2026-11-21 20:56:57 +02:00
Bohdan Triapitsyn 322209095d fix(chat): call the Activity mode that keeps the agent's text Show notes
"With text" didn't say what it shows. The mode keeps the agent's notes between steps in view while the tool rows fold, so the Settings chip now reads "Show notes" in every locale. The stored value stays 'text'.
2026-11-21 20:50:10 +02:00
𝖎𝖚𝖑𝖎𝖎𝖆 e63daac3b8 feat(chat): keep what the agent wrote between steps in view under Activity (#7344)
Adds a third Activity mode, With text, that folds tool rows like Collapsed and keeps the agent's text between steps in view.
2026-11-21 20:47:51 +02:00
Tobias Conrad 3bef79a981 fix(dictation): keep a dictation alive across a dropped connection (#6865)
Closes #6726
2026-11-21 19:55:17 +02:00
Bohdan Triapitsyn 9a946316c2 fix(chat): hold attachments in the draft and write them only at Send
Three intake paths still wrote files where OpenCode runs while the user was
composing: a HEIC the decoder cannot read, an Office document attached "as
is" from the composer, and images pasted with "Save pasted images as files".
A file the user then removed, or a draft moved to another server, left a copy
on whichever machine was open, and the path went into the text as a link.

All three now hold the bytes in the draft through addAttachedFile's new
saveOnSend option. 'reference' keeps the original and is swapped for its path
note at Send (unreadable HEIC, Office as is, images for a model without image
input, images too large to inline). 'copy' keeps the image and adds a path note
to a copy saved at Send, under the same name so one citation sends both.
saveAttachmentsHeldForSend writes only the files the outgoing message cites,
bound to the runtime the send started on, shares one in-flight save per draft,
and now also runs before a parallel launch. Queue Edit gets the held original
back (copy: the image plus the note to its copy). addAttachmentSavedOnSend from
the Android share path folds into the same option; a shared unreadable HEIC is
now held instead of refused.

A path note restored from a sent message by Edit or fork comes back from
OpenCode as plain text/plain without the path-note marker; addRestoredAttachment
recognizes it by the note's opening and restores the marker, so a resend to a
model without text input does not write it again. writeTempFiles replaces
characters a Windows filesystem cannot hold in a name.

Tests: input-store, desktopPath, composer intake and temp-files cases for each
path (no write before Send, one write at Send, Edit after Queue), each failing
on origin/main; packages/ui suite 1486/1486; check:changed passes.
2026-11-21 19:29:56 +02:00