Commit Graph
7 Commits
Author SHA1 Message Date
Chris Scott 7351d5f002 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.
2026-09-24 08:38:26 -04:00
Chris Scott 68d586f183 feat(ocm-move): plan worktree mirror targets and stream move progress (#345)
* feat(ocm-move): plan worktree mirror targets and stream move progress

- Plan/ensure mirror targets per branch via new internal endpoints, creating a worktree repo when the target branch is not checked out in the source repo
- Skip branches checked out in other worktrees during bundle import and reset/clean before checkout on both server and CLI
- Rewrite workspace paths in message.updated events when replaying moved sessions
- Stream live move progress (bundle, upload, import, patch, replay) in the TUI
- Prefer branch-matched repos when moving sessions and share push-divergence descriptions

* chore(ocm-cli): bump version to 0.2.7

* fix(ocm): harden worktree mirror synchronization

* fix(ocm): protect active branch during branchless pull
2026-09-01 22:14:48 -04:00
Chris Scott 90a3c29c12 feat(sandbox): add KVM-backed agent sandboxing via microsandbox (#338)
* feat(sandbox): add KVM-backed agent sandboxing via microsandbox

* feat(sandbox): route host-shell surfaces into microVM via shell wrapper

* feat(sandbox): route host-shell surfaces into microVM via shell wrapper

* fix(sandbox): harden enforcement validation and backup handling

* fix(sandbox): bound lifecycle queue and harden install/backup paths

Bound the OpenCode supervisor lifecycle queue to one running plus one
pending operation so repeated restarts cannot stack unbounded HTTP
requests, while exempting stop() so shutdown is never dropped.

Reject enforcement backups that carry no recoverable removed sections,
matching the existing fail-closed handling of unparseable backups.

Install OpenCode through a private mktemp staging directory instead of
the predictable /tmp/opencode path.

Use named path/os imports in the files added by this branch.

* refactor(sandbox): remove OpenCode version allowlist gating under enforcement

* fix(settings): use resolved opencode binary and verify installed version

* refactor(sandbox): scope enforcement to agent bash tool only

* fix(sandbox): plan bash against factory directory and attest runtime tmpfs; align permission reply API

* fix(sandbox): pin neutral entrypoint and persist opencode upgrades across rebuilds

* fix(sandbox): align canonical spec with msb 0.6.8 runtime defaults

* feat(sandbox): show unwrapped sandboxed bash commands in message UI

* refactor(sandbox): pin shell shim to sandbox agent bash without rewriting commands

* feat(sandbox): route notifications through a host-side manager tool

* feat(sandbox): route all assistant capabilities through the ocm tool

Add an allow-listed request action to the generated ocm plugin so agents
reach settings, assistant reload, repos, git-info, workspaces, and
schedules through the tool instead of curling the internal API with a
bearer token, which is impossible under sandboxing.

Rewrite the curl-based skills to use the ocm request action and drop the
apiBaseUrl plumbing. Remove the now-unread .opencode/internal-token file
and the sandbox tmpfs mask that hid it; attestation now rejects any
tmpfs other than the runtime /tmp mount.

* fix(sidebar): wire new-session and new-schedule actions to every page

AssistantRedirect never registered a listener for the sidebar's
new-session event, so the desktop sidebar CTA on /assistant was a
no-op; the Schedules pages had the same gap for new-schedule.

Make useSidebarAction the single source of truth for action keys and
event dispatch, and warn when an action is dispatched with no mounted
handler so an unhandled CTA fails loudly instead of silently. Wire the
missing listeners to the existing per-page handlers.

* feat(sandbox): forward git credentials into the microVM and add sandbox guest image

* feat(sandbox): add git credential forwarding toggle to settings
2026-08-25 23:38:52 -04:00
Chris Scott 6a4e8734f9 feat: add repo rename capability with custom name field (#294)
* feat: add repo rename capability with custom name field

Add a custom name field to repos, allowing users to set a display name
independent of the repo URL or path. Includes a migration, PATCH endpoint,
rename dialog, and display name consolidation.

- DB migration 014 adds name column to repos table
- PATCH /api/repos/:id endpoint with Zod validation
- RenameRepoDialog component with clear/reset support
- RepoRowActions gains Rename action in both dropdown and inline modes
- getRepoDisplayName() consolidated to accept a repo object and prefer name
- All repo name display call sites updated to use the new API

* fix: add DialogTitle to RenameRepoDialog for a11y compliance

* refactor: extract getRepoDisplayName to shared utils, fix schedule cache invalidation on rename
2026-06-28 14:49:00 -04:00
Chris Scott 01e50a7019 feat: add bundle-based OCM mirror sync (#289)
* feat: add bundle-based OCM mirror sync

* feat: add OpenCode model editor and HEAD-safe bundle import

* fix: consolidate discovery-cache, batch bundle refs, remove dead code (#290)

* fix: consolidate discovery-cache, batch bundle refs, remove dead code

* refactor: consolidate discovery cache into generic discoverCached, extract spawnGit helper

* feat: extract project-id-resolver, add CLI full-fallback prompt, wire lint into root scripts

- Extract shared project-id-resolver for origin URL matching (replaces local-repo duplicates)
- Add promptYesNo / confirmFullFallback to ocm CLI before slow full mirror
- Backend: consolidate opencode-workspaces routes with project-id-resolver
- Frontend: fix schedules prompt/global page navigation
- CLI: add eslint config, lint/lint:fix scripts, fix no-fallthrough in ocm.ts
- Root: wire CLI into build, test, typecheck, lint, lint:fix chains
- Fix test lint issues (_code, const, require→import)

* fix: replace polynomial regex with linear-time string ops in gitRemoteParts

* feat: add divergence guards for push/pull, streaming bundle upload, server-side ancestry check

- Backend: GET /:repoId/mirror/head (head+branch+dirty) and GET /:repoId/mirror/contains/:sha (ancestry check)
- CLI: checkPushDivergence warns before overwriting server commits; checkPullDivergence warns before discarding local commits; both require confirm or --force
- Bundle upload now streams from disk instead of buffering entire file in memory
- Version visible in --help and default (no-arg) output
- Version bump 0.1.5 → 0.2.0

* fix: show connecting message before fetching repos in default command

* fix: update default command messages to reflect actual matching behavior
2026-06-28 11:57:38 -04:00
Chris Scott dbd6866682 feat(assistant): self-configuring assistant mode (#244)
* test(backend): replace better-sqlite3 test mock with node:sqlite

Reimplement the bun:sqlite test mock on top of node:sqlite with an
explicit BEGIN/COMMIT/ROLLBACK transaction wrapper.

* feat(assistant): self-configuring assistant mode

Add a self-editable assistant workspace and the APIs that support it:
- POST /assistant/reload disposes and re-bootstraps the assistant
  instance (directory-scoped, rate-limited) so agent.md edits apply.
- Internal settings API accepts non-secret TTS/STT patches via
  dedicated partial schemas.
- Strip the generated agent persona from opencode.json on repair so
  user-customized agents are preserved across config recovery.
- Cache the last assistant session id to avoid redundant session
  listing on launch.

* style(repo): align worktree and workspace tabs with primary/orange theme
2026-05-31 11:38:02 -04:00
Chris Scott a86e4b1238 feat(ocm-cli): workspace repo sync and manager token targeting (#233) 2026-05-23 19:49:44 -04:00