Commit Graph
297 Commits
Author SHA1 Message Date
Chris Scott e42ce1bd56 Merge pull request #397 from chriswritescode-dev/fix/remote-terminal-proxy
fix(proxy): bridge ticketed PTY WebSockets for remote terminals
2026-10-07 21:48:18 -04:00
Chris Scott 958cf7cd53 fix(proxy): harden remote terminal WebSocket bridging
Restrict the token-free proxy socket to ticketed persistent PTY connects.
OpenCode builds per-directory services before it validates an /api/pty
ticket, so that route must not be reachable without the Manager token.

- Reject untrusted Origins and an uninitialized lifecycle before upgrading
- Open the upstream socket first and answer 403 on rejection instead of
  upgrading and closing
- Handle ticketed sockets before the repo lookup and the password read
- Cap client-to-upstream buffering at 4 MiB and add a 10 s connect deadline
- Share bridge handlers, peer wrapper, proxy prefix and WebSocket URL helpers
- Remove persistent PTYs with their directory in TerminalService.removeAll
2026-10-07 21:22:15 -04:00
Chris Scott 98668f684b fix(proxy): bridge ticketed PTY WebSockets for remote terminals 2026-10-07 20:27:33 -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 e8548b1e07 section 1: Phase 1: Expose session goals and multi-runs on the internal 2026-10-07 18:33:03 -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 30783c49ec fix(multi-run): deny defaults on fusion session permissions 2026-10-07 12:07:56 -04:00
Chris Scott 00b38552bf fix(multi-run): log fusion permission-mode failures separately
applyDefaultMode ran inside the launch try/catch, so a permission-mode
failure was swallowed by the launch-failure handler instead of being
logged, and any later post-launch step was skipped. Move it into its own
try/catch that logs with the session id, leaving the fusion started.
2026-10-07 11:53:06 -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 4cc9785948 fix(ocm): pass workspace directories through the repo proxy
Keep any directory inside the Manager workspace (repos, OpenCode and
schedule worktrees) instead of forcing the bound repo, so /projects and
worktree session lists work. Only remap a directory the client sent on the
session list, and stop adding a directory filter to lists that carry none.
2026-10-06 23:02:56 -04:00
Chris Scott f952a99b37 fix(ocm): scope the repo proxy to the requested worktree 2026-10-06 22:47:43 -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 27996ed12d feat(docker): one-line installer and release Compose file
Add scripts/install.sh, a one-line installer that checks Docker and
Compose v2, installs into ~/opencode-manager (override with OCM_DIR),
prompts for an optional OpenCode config import, a repos folder mount and
LAN sign-in, then pulls and starts the published image.

- Add docker-compose.release.yml, which runs the published image under
  the Compose project name ocm; a checkout's docker-compose.yml keeps
  building from source
- Generate AUTH_SECRET on first container start and persist it to the
  data volume when unset, so Compose installs need no .env
- Refuse to install over a source checkout or beside an existing
  install, so volumes and the auth secret are not silently replaced
- Test the installer, entrypoint secret handling, and the two Compose
  files staying in step
2026-10-05 15:07:23 -04:00
Chris Scott 5138cd6a76 docs(ocm): note cloning status in repo clone response 2026-10-05 15:00:00 -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 9b405325c0 test(backend): allow admin sign-in test time for scrypt under coverage 2026-10-05 17:08:57 +00:00
Chris Scott cead35fcab test(backend): pin MSB_PATH in vitest env so sandbox tests ignore the host value 2026-10-05 17:03:34 +00:00
Chris Scott ae4ce0e81c docs: move documentation to hosted site and refresh branding
Remove the in-repo MkDocs site, its deploy workflow, and the tests that
asserted its content. Repoint README, CONTRIBUTING, and .env.example links
to opencodemanager.app/docs, and update logos, favicon, PWA icons, manifest,
and image alt text to the OpenCode Manager branding.
2026-10-04 18:19:35 -04:00
Chris Scott 62e36eb3b2 feat(ui): preview port menu, terminal auto-start, and project actions tabs 2026-10-04 01:34:57 -04: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 206113438c section 10: Phase 10: Session launcher owner 2026-10-03 10:37:29 -04:00
Chris Scott f402e8479a section 9: Phase 9: One owner for creating and removing OpenCode worksp 2026-10-03 10:33:25 -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 40bbe5aff3 section 6: Phase 6: Goal audit loop: quiet-period audit, continuation a 2026-10-03 10:08:18 -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 f85531f2d3 section 3: Phase 3: Auto-accept engine, default stamping and notificati 2026-10-03 09:18:14 -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 a3aaba8515 section 1: Phase 1: One owner for reading a session's latest assistant 2026-10-03 09:01:38 -04:00
Chris Scott 16b91ccf02 loop: terminal-dev-loop completed after 30 iterations 2026-10-03 04:29:40 -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 13c29c635e section 3: Phase 3: Terminal WebSocket bridge 2026-10-03 01:16:24 -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 dcb50b7e0f fix: reconcile documentation guarantees and enforcement (OM-15) 2026-10-02 13:00:09 +00:00