Commit Graph
158 Commits
Author SHA1 Message Date
Chris Scott bd7c3e3fef feat(ocm): move sessions into OpenCode worktrees instead of replacing the Manager checkout
/ocm-move previously failed when the Manager checkout was dirty, behind, or on
another branch. Choose the destination instead: replace in place only when the
checkout is on the local branch, clean, and has nothing the local branch lacks;
otherwise reuse an existing OpenCode worktree on that branch when it is equally
safe; otherwise create a new OpenCode worktree through the same service the UI
and multi-runs use, so it appears in the repo's worktree lists. The new
worktree's branch is the local branch when free, else <branch>-ocm, -ocm-2 and
so on. Server work is never discarded, the confirmation states the destination
and why the main checkout was skipped, and a detached HEAD is refused.

The mirror push endpoints (bundle upload and patch) accept a worktree
directory, rejected unless it belongs to the repo, and a new endpoint creates
the worktree. The old <repo>-<branch> path that registered a plain git worktree
as a separate Manager repo is removed.
2026-10-08 20:47:02 -04:00
Chris Scott e89b782fef feat(shortcuts): add favorite model cycle shortcut (Ctrl+R) 2026-10-08 14:26:41 -04:00
Chris Scott 994a8b82e8 feat(shortcuts): rework shortcut bindings, focus restore, and input guards
Resolve effective bindings from stored prefs plus defaults with leader/direct collision handling and default leader Ctrl+X; let direct actions pass through in terminals and suppress abort while an overlay is open. Add half-page scroll disengage, verified overlay focus restore, and consolidate prompt reset.
2026-10-08 12:40:04 -04:00
Chris Scott 7e8443f54f feat(shortcuts): add half-page message scroll shortcuts 2026-10-08 11:50:37 -04:00
Chris Scott b06de60f6b feat(ui): app-wide keyboard shortcuts with TUI keybind import 2026-10-08 10:47:52 -04:00
Chris Scott cbdaf164d9 fix(generate-text): resolve default model from global config catalog 2026-10-08 00:39:09 -04:00
Chris Scott 485ab940aa feat(ui): dock repo and session tools in a desktop side panel
Add a docked desktop tool panel with an icon rail, driven by the shared panel URL param, and keep the mobile dialogs and drawers. Extract dialog bodies into reusable content components, rename the walkthrough dialog to a sheet, and make walkthrough generation asynchronous with client polling.
2026-10-07 23:58:56 -04:00
Chris Scott c41149dc39 fix(tui): address review follow-ups for session goals and multi-runs 2026-10-07 20:26:49 -04:00
Chris Scott 1e852c935a feat(tui): add session goals, multi-runs and server switching to the ocm TUI
Expose session goals and multi-runs on the Manager internal API, add shared goal label formatters, and add the /goal, /multirun and /ocm commands with their dialogs, Manager auth and API helpers, and tests.
2026-10-07 19:01:52 -04:00
Chris Scott 02d2e89bca feat(chat): group exploration tool calls
Collapse consecutive read, search and fetch tool calls in the chat transcript into one expandable summary line, matching the OpenCode TUI. Adds a groupToolCalls preference (default on) with a Settings toggle.
2026-10-07 16:40:38 -04:00
Chris Scott ec96ac0d55 feat(multi-run): always run fusions in a new worktree 2026-10-07 13:12:25 -04:00
Chris Scott f2e06abb62 feat(multi-run): add a runs sheet with inline fusion
Replace the centered Multi-run dialog and the stacked Fusion dialog with one
right-side runs sheet, turn fusion into an inline selection mode, and
pre-approve each selected source workspace for the fusion session.

- Move MultiRunDialog into a SideDrawer with Runs / New run tabs; add
  MultiRunCard, FusionComposer and an optimistic starting fusion.
- Add buildFusionSourcePermissionRuleset (external_directory allow, edit deny)
  and thread permissions through SessionLauncher.launch.
- Apply the default permission mode to fusion sessions after launch.
- Let ModelCombobox and BranchCombobox take a listClassName; make SideDrawer
  ignore an Escape already handled by a nested layer.
2026-10-07 11:36:36 -04:00
Chris Scott 65b72e55ae refactor: unify model selection with the TUI
Align the manager's model selection with the OpenCode TUI: one
model.json-backed preference store, one provider catalog, one ordering
and default-ownership rule, and one set of availability, ref-formatting
and variant helpers shared across chat, schedules, agents and the goal
auditor.

- Add a shared TUI-compatible model-preference module and make the
  backend model.json store match its format.
- Consolidate the frontend provider catalog, availability check, model
  ref formatter and variant persistence into single owners.
- Drive chat, schedule, agent and goal-auditor model lists from a shared
  useModelSections hook and buildModelSections, following TUI ordering.
- Extract a shared ModelCombobox with a taller list, and list models the
  TUI way in ModelQuickSelect.
- Add a shared isRecord util and model-selection comparison helpers.
2026-10-06 20:44:27 -04:00
Chris Scott 3d143568c1 fix: sanitize rendered markdown HTML
Add a shared rehype pipeline (rehype-raw -> rehype-sanitize -> rehype-highlight) to every markdown renderer so scripts, frames and event handlers are stripped from model output and repository files while safe HTML and highlighting survive.

Also delete change walkthroughs when their session is deleted (including in-flight generation), build schedule model options from default/favorite/recent state, and include 127.0.0.1 origins in the default trusted origins.
2026-10-06 19:27:49 -04:00
Chris Scott b36d412ca2 feat: add multi-run fusion and session change walkthroughs
Fuse two to five completed multi-run entries into one synthesized session,
and explain a session's diff as ordered walkthrough stops cached by diff hash.

- Multi-run fusion service, persistence, routes and FuseRunDialog
- Change walkthrough service, persistence, routes and ChangesWalkthroughDialog
- Shared unified-diff parser plus bounded text generation, json-extract,
  text-truncate and service-error helpers
2026-10-06 15:27:14 -04:00
Chris Scott 26ff08d891 feat(schedules): require worktrees and choose commit or discard on removal
Drop the repo workspace mode so every scheduled run executes in a
worktree. Clearing run history or deleting a run now asks whether to
commit pending changes and keep the run branches, or force-remove the
worktrees and delete the branches.

Sibling repo listings carry the schedule name, and the repo detail
workspace view subscribes to schedule worktree sessions only while
expanded. Also unify schedule worktree path/branch helpers, refuse a run
branch already checked out elsewhere, and clean up terminals when a
worktree is removed.
2026-10-06 11:02:29 -04:00
Chris Scott 6ec3f3bd91 feat(schedules): add workspace modes and worktree management 2026-10-06 10:16:34 -04:00
Chris Scott c9be507f4e feat(ocm): let the assistant clone repos through POST /repos 2026-10-05 17:28:18 +00:00
Chris Scott b13707b5b3 Merge forge/terminal-dev-loop into beta
feat: integrated terminal, project actions and dev server preview (OM-17, OM-18, OM-19)

Integration with #380 and #379:
- Adopt the git-config identity model: drop the branch's identity stubs
  (getShellEnv, getAssignedGitIdentityEnv, repo identity ids, duplicate
  createGitService and getMainCheckoutPath); terminals receive only the
  GitHub token env and take their commit identity from git config.
- Add RepoWorkspaceService as the single owner of OpenCode workspace
  side effects: worktree setup commands on create and terminal cleanup on
  remove, used by the workspace routes, the session launcher (ocm tool and
  multi-run) and multi-run discard, with one worktree-sibling matcher.
- Run repo-delete terminal cleanup inside the worktree branch deletion
  flow.
- Combine the CreateWorktreeDialog tests and update docs for the identity
  model and setup command coverage.
2026-10-03 23:50:10 -04:00
Chris Scott a1641bd8a9 Merge pull request #380 review fixes from feat/git-workflow-core into beta 2026-10-03 22:51:11 -04:00
Chris Scott 84e14c4600 fix(git): guard remote branch deletion and skip applied cherry-picks
- Delete a remote branch only when the upstream (read from
  branch.<name>.remote and branch.<name>.merge) has the same name;
  otherwise refuse with REMOTE_BRANCH_MISMATCH before deleting anything.
- Without force, require the branch to be merged into HEAD before
  deleting its remote branch, so pushed unmerged commits are not lost.
- Cherry-pick integration selects only commits not yet applied to the
  target and skips merge commits.
- Create worktrees from a remote-only base as origin/<branch>.
- Show the upstream name in the branch delete dialog and update the
  worktree delete option text and git docs.
2026-10-03 22:51:03 -04:00
Chris Scott 8dec410c63 Merge pull request #379 from feat/agent-orchestration into beta
feat(sessions): add permission modes, session goals, ocm session tool and multi-run

Resolve the duplicate parseJsonBody added by both #380 and #379 into one
helper: #379's result shape and allowEmpty option, with the first
validation message as the error and the issues as details. Update the
repo-git callers, affected route tests and the internal API docs.
2026-10-03 22:42:53 -04:00
Chris Scott 53238a6324 feat(git): extend source control with worktrees, stashes, conflicts and identities
- Create a worktree from a new or existing branch
- Integrate a worktree branch into a target branch by merge commit or cherry-pick, with continue/abort on conflicts
- Delete a worktree with keep, delete-local, or delete-local-and-remote branch options, using safe branch deletion for unmerged branches
- Add a stash tab (list, push, apply, pop, drop) shared across a repository and its worktrees
- Rename and delete branches, optionally deleting the remote branch and updating scheduled base branches
- Detect in-progress merge, rebase, cherry-pick and revert operations and hand conflicts to an agent session
- Generate commit messages from staged changes with the default model
- Add a default git identity and saved per-repository identities written to git config
- Unify git error mapping behind a typed error and one route helper; consolidate git mutations and cache invalidation
- Update repository docs
2026-10-03 21:59:00 -04:00
Chris Scott 96e02e9646 feat(sessions): add permission modes, session goals, ocm session tool and multi-run
Per-session permission modes: each root session runs in ask or auto.
Auto answers each permission request once from the backend, child
sessions inherit their root's mode, forks copy the source's mode, and
scheduled runs and agent-created sessions stay on ask. A lock reason
reports why a session's mode cannot change.

Session goals: arm a goal in the composer and a backend audit loop keeps
the session working until an auditor model returns done or blocked. The
loop is bounded by continuation and token limits, survives restarts, and
pushes an outcome notification. Goals cannot start on scheduled-run or
child sessions.

ocm session tool: allow-listed internal routes to list, create, follow up
on, read replies from, and fork sessions. Created and forked sessions are
pinned to ask, listing covers a repo's workspaces, and replies wait for
the session to settle with a capped response.

Multi-run: launch one prompt on up to five models, optionally each in its
own OpenCode workspace, with per-entry status and discard.

Also add the shared owners this group needed (session launcher, session
reply, workspace create/remove, multi-run storage) and update the feature
docs.
2026-10-03 21:16:05 -04:00
Chris Scott 891f5427b4 section 12: Phase 12: Multi-run backend: run groups, parallel launch and 2026-10-03 10:55:25 -04:00
Chris Scott fc623fde96 section 11: Phase 11: Internal session routes, ocm tool allow-list and 2026-10-03 10:43:49 -04:00
Chris Scott 4e9f27ab0b section 7: Phase 7: Goal recovery on restart and outcome notifications 2026-10-03 10:22:08 -04:00
Chris Scott c60a9b35f2 fix(terminal-dev-loop): address branch review findings
Security:
- Reject same-site and cross-site state-changing requests on cookie-authenticated routes unless the origin is trusted
- Drop Manager and ocm_preview Set-Cookie headers from preview responses
- Show and hash the full executable content of .ocm/project.json at trust time
- Restrict action URLs to http(s) and refuse symlinked repo config paths
- Keep the preview start redirect on the gateway origin

Lifecycle:
- Stop terminals in OpenCode workspace siblings when a repo is deleted
- Report preview as unavailable instead of crashing when the gateway port cannot be bound

Performance:
- Skip branch lookups when validating terminal and project-config directories
- Stop the /proc scan once all listening sockets are mapped and pause port polling while a preview is open
- Close slow WebSocket clients with 1013 so they reconnect with replay
- Lazy-load the xterm terminal view and skip unchanged resize requests
- Request uncompressed responses from preview targets

Cleanup:
- Share one repo directory resolver, trusted-origins parser, cookie prefix, WebSocket frame forwarder, header filter, icon map and dialog-param helper
- Remove unused props, options and exports

Docs: update terminal, preview, project actions, sandboxing, internal API and environment pages
2026-10-03 10:00:33 -04:00
Chris Scott 74b00e37f0 section 5: Phase 5: Session goal storage and lifecycle API 2026-10-03 09:32:49 -04:00
Chris Scott 66e6c20f8e section 2: Phase 2: Session permission mode storage, resolution and API 2026-10-03 09:08:12 -04:00
Chris Scott a383e57bc5 section 16: Phase 16: Documentation, container ports and full repository checks 2026-10-03 04:07:44 -04:00
Chris Scott d6aeafeae9 section 8: Phase 8: Run and stop project actions with URL templates 2026-10-03 02:09:54 -04:00
Chris Scott 852797a897 section 7: Phase 7: Committed repo file, trust and move between personal and repo 2026-10-03 02:00:46 -04:00
Chris Scott e83b979730 section 6: Phase 6: Project configuration schemas and personal action storage 2026-10-03 01:47:04 -04:00
Chris Scott beab2646e7 section 2: Phase 2: Terminal service, REST routes and cleanup 2026-10-03 01:05:02 -04:00
Chris Scott b494ee9f4a section 1: Phase 1: Shell environment owner and repo working-directory 2026-10-03 00:56:39 -04:00
Chris Scott 5a8a81419c feat(schedules): add unread run report notifications and run search 2026-10-01 23:35:10 -04:00
Chris Scott 7e9afc3da4 feat(opencode): surface server startup and recovery failures in-app 2026-10-01 16:13:11 -04:00
Chris Scott 8e32507f21 feat(schedules): attach MCP servers to scheduled runs 2026-09-29 19:43:02 -04:00
Chris Scott 6396e8c22c feat(themes): drive code block syntax highlighting from active theme 2026-09-29 16:26:51 -04:00
Chris Scott 3d8c2f5b5e fix(schedules): open report links in place and route schedule notifications to the run report 2026-09-29 00:33:31 -04:00
Chris Scott 304f636516 fix: stabilize scheduled runs and background task tracking (#365)
* fix: stabilize scheduled runs and background task tracking

* fix: complete scheduled runs and harden background task status

- Route directory-less OpenCode session events (session.execution.*,
  session.usage.updated) to backend listeners by remembering each
  session's directory in the SSE aggregator, so scheduled runs finish
  and failure push notifications fire; browser delivery is unchanged.
- Resolve background shell status from the transcript completion notice
  when OpenCode no longer lists the shell, keep the first terminal
  status so a kill is not reported as completed, and share one status
  icon and colour mapping between the transcript and background bar.
- Reconcile child sessions only while unknown or running, trigger it
  from the EventProvider alone, refresh children that drop to unknown
  after a poll, and forget deleted sessions.
- Fetch the model list and default concurrently while waiting for the
  schedule model, share configured-model selection, and consolidate
  schedule startup cancellation cleanup.
- Reduce background work re-renders, prune shell exit records, remove
  dead exports, and document background work in the chat guide.

* fix: hide finished background tasks and clip long dialog titles
2026-09-28 23:55:01 -04:00
Chris Scott e80016cc22 fix(navigation): show Assistant sessions in the sidebar and repo switcher (#368) 2026-09-28 23:52:45 -04:00
Chris Scott a1b7f58aae feat(opencode-config): redact secrets and add MCP listing to the internal config API (#366) 2026-09-28 23:52:41 -04:00
Chris Scott 5bd688de4b feat(themes): apply OpenCode color themes app-wide with a settings picker (#364)
- Vendor the 36 OpenCode theme palettes into the shared package, synced
  from the pinned OpenCode release tag via pnpm themes:sync.
- Add a colorTheme user preference across the settings schema, defaults,
  and the assistant internal API.
- Extend palettes with success, warning, info, and diff colors, and add a
  resolver that maps palettes to CSS tokens and applies them to the DOM.
- Apply the theme app-wide through a ThemeProvider context, adopting the
  tokens in message, repo, session, and settings components, agent
  colors, git status styles, and diff viewers.
- Add a theme picker to General settings and make model quick-select
  follow the active theme (fixes #355).
2026-09-28 00:19:32 -04:00
Chris Scott dacde879d6 feat(opencode): migrate OpenCode Manager to OpenCode 2 (#359)
* feat(opencode): migrate OpenCode Manager to OpenCode 2

Port the backend lifecycle, generated plugins, event aggregation,
schedules, worktrees, provider credentials, MCP, config handling, the
frontend chat model, and the ocm CLI to OpenCode 2.

Adopt @opencode/client 2.0.15 as the single typed V2 API contract,
require OpenCode 2.0.0 or newer (pinned 2.0.15), and delete every
V1-only code path.

* refactor(opencode): reload config in place and drop v1 compatibility shims

Route config/skill/AGENTS.md changes through the OpenCode location reload
API instead of a full server restart, stop auto-resuming interrupted
sessions, remove the restart coordinator and v1 MCP/version shims, and pin
support to OpenCode >=2.0.15 <3.0.0. Adds integration-ready retries,
service-mode launch, ocm-cli repo proxy, and new frontend form/MCP helpers.

* refactor(opencode): consolidate v2 migration helpers and harden install, proxy, and session flows

- extract shared semver and model-ref utilities, reuse across version checks
- share the OpenCode release download script across Docker, entrypoint, dev setup
- unify install/upgrade failure recovery and guard externally managed OPENCODE_BIN
- scope the repo proxy location rewrite and surface ocm proxy errors
- rework frontend session projection, permission lookup, and cache invalidation

* fix(schedules): reject unavailable agents before creating a session

* feat(opencode): add ocm install, schedule agent fallback, and session move guards
2026-09-26 13:16:45 -04:00
Chris Scott b5dd900efb feat(config): support layered OpenCode config sources with revision-guarded saves (#358)
* feat(config): support layered OpenCode config sources with revision-guarded saves

* refactor(config): harden multi-source OpenCode config handling

- extract shared config-source helpers and default source name
- reject shadowed removals with 409 and require sources/revision
- restart the server on reload with session resume
- mirror multiple host config files on import and warn on removals
- skip restart for mcp-only saves
- drop removedFields and CONFIG_PATCH_TIMEOUT_MS

* fix(config): return null when archiving broken OpenCode config fails
2026-09-20 15:51:40 -04:00
Chris Scott 65f5bd0e6a build(docker): bake chromium runtime libs and refresh pinned tools (#357)
* build(docker): bake chromium runtime libs and refresh pinned tools

Install the Chromium runtime libraries in the runner image from Playwright's
own resolver instead of a hand-maintained package list, so a Playwright e2e
suite runs in the Manager container without root or sudo. PLAYWRIGHT_VERSION
is shared with the sandbox guest image and the docker-build workflow.

Refresh the remaining pins: node 24.21.0, pnpm 10.28.1, OpenCode 1.18.31,
microsandbox 0.7.2 and @opencode-ai/sdk 1.18.31. CI moves to Node 24 to match
the image and the documented requirement.

uv stays at 0.12.7. The runner previously fetched the unversioned installer
URL, so UV_VERSION and the workflow build argument had no effect; it now
installs from the versioned URL and asserts the installed version, and the
workflow pins the release instead of resolving the newest tag. The pin cannot
move past 0.12.7 yet because 0.12.8 and later segfault under qemu-user x86_64
emulation, which is how an arm64 host builds the amd64 platform.

* chore(docker): bump the sandbox image digest to the 1.63 build

The guest image was rebuilt and republished for Playwright 1.63.0, uv 0.12.7
and pnpm 10.28.1. Moving the digest is what makes deployments adopt it:
attestation compares the reference string, so a rebuilt image behind the old
digest would never be pulled or recreated.

* build(sandbox): align toolchain pins and verify on native runners

* feat(sandbox): run Docker with persistent guest storage

* chore(docker): pin the Docker-enabled sandbox image
2026-09-19 22:30:29 -04:00
Chris Scott 295d24ced7 refactor(config): make on-disk opencode.json the single source of truth (#354)
* refactor(config): make on-disk opencode.json the single source of truth

Make <workspace>/.config/opencode/opencode.json the only store for the active OpenCode configuration. One owner (opencode-config-file.ts) reads, validates, writes, archives, and seeds the file; one owner (opencode-config-apply.ts) decides how an edit is applied: restart pending, or a live patch with recovery. Settings routes, the internal assistant API, the health-watch supervisor, boot, and host import all go through them, so an edit that lands on the file without going through the database is visible immediately instead of at the next Manager boot.

Remove the named-config profiles. Migration 019 archives every opencode_configs row to .config/opencode-configs-archive/<name>.json, restores the default row to opencode.json when no file exists, then drops the table, its indexes, and repos.opencode_config_name. The /opencode-configs* and config/switch routes and the CreateConfigDialog/SwitchConfigDialog dialogs are gone, and the ocm tool gains GET/PUT /opencode-config backed by the same apply owner.

Harden the write path: serialize and atomically write config updates while preserving the file mode, keep withFileLock usable after a rejection, route reloadConfig's cleaned-config write through the file owner, stop boot from rewriting an existing valid config when importing state, prune the health-watch directory to its newest 20 entries, resolve archive paths with realpath, and share one frontend config query across dialogs.

* fix(mirror): canonicalize worktree paths before branch ownership check

* refactor(config): unify opencode config apply and rollback paths

- share one config route factory between public and internal mounts
- capture last-known-good before every config write and restore via one helper
- stop auto-restarting on save; flag restart-required fields and live-patch the rest
- add CONFIG_PATCH_TIMEOUT_MS for config patch requests
- extract canonicalPath helpers, health-watch artifact writer, and useProvidersWithModels hook

* refactor(model-state): use OpenCode state file as model state source of truth
2026-09-19 00:28:34 -04:00
Chris Scott 47d57df628 fix(sandbox): open up corepack cache to exec user, pin uv, bump guest image
corepack prepare runs as root and leaves COREPACK_HOME/v1 and
lastKnownGood.json root-owned under the sticky dir, so a project
packageManager pin failed with 'Failed to create cache directory' for
the exec uid; open up the whole corepack tree after prewarming and
verify a pinned download as an unknown uid. Pin uv (0.12.9 segfaults
under qemu-user amd64 emulation) and bump the guest image digest.
2026-09-04 11:54:26 -04:00