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.
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
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.
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.
* 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
* 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
* fix(schedules): submit scheduled runs via prompt_async with SSE monitoring
* fix(session): use session directory for SSE and queries when it differs from repo path
Executes recommendations from a comprehensive test suite audit.
Removes dead, redundant, and trivial tests; rewrites SessionDetail
polling test to exercise real gating; trims duplicated assertions;
adds missing assertion in assistant-loading tests.
13 files changed, 233 insertions(+), 462 deletions(-)
* feat: add schedule permission config and workspace tracking
Adds permission configuration for scheduled jobs (migration 016) and
workspace ID tracking on schedule runs (migration 017). Includes
service logic, UI controls, schema updates, and full test coverage.
* refactor: convert permission ruleset to object format, exclude active schedule worktrees from sibling repos
* refine: reduce destructive bash patterns to host-level commands only
* feat: add schedule worktree isolation for running jobs in isolated worktrees
* feat: schedule worktree isolation for running jobs in isolated worktrees
* feat: show worktree/branch artifact counts in clear history confirmation
* feat: validate and select base branches for schedule worktrees
* fix(schedules): clean up orphaned schedule records and add schedule URL state management
* refactor(schedules): consolidate schedule tab state into useScheduleUrlState
* fix(schedules): cascade delete schedule runs/jobs and preserve assistant schedules in orphan cleanup
* refactor(schedules): replace deleteJobsByRepo with prepareRepoDelete, add lightweight ID query, remove dead mock
* refactor(schedules): consolidate PromptTemplateDialog form state into single object
* feat(schedules): support scheduling jobs for the Assistant workspace
* refactor(schedules): extract assistant repo constants, rename workspace to schedule-target
* feat(navigation): add schedules link to session drawer menu
* fix(schedules): document Assistant repoId=0 in generated schedule-management skill
* feat: discover local repos and reconnect OpenCode sessions
Replace one-by-one local repo setup with parent-folder discovery and path-aware repo linking so first-time installs can recover existing OpenCode chats. Add first-run import support and onboarding docs for standalone OpenCode users, including Docker path-matching guidance.
* fix: address session discovery review feedback
* fix: improve delete/unlink messaging for local vs cloned repos
* feat: discover local repos and reconnect OpenCode sessions (#158)
---------
Co-authored-by: itz4blitz <justinscroggins@outlook.com>
Co-authored-by: itz4blitz <60281870+itz4blitz@users.noreply.github.com>