Commit Graph
793 Commits
Author SHA1 Message Date
Chris Scott 2eba81d524 feat(sandbox): cache the guest image at startup instead of on first command
Pull the configured guest image in the background when the Manager boots and
when sandbox enforcement is switched on, so a sandboxed command no longer
pays the multi-gigabyte download. msb pull is a no-op once cached, startup is
never blocked by it, and a command racing the pull joins the same in-flight
boot.
2026-08-28 13:05:56 -04:00
Chris Scott 5beb3432d4 chore(ci): remove the Sandbox Image workflow and document the local build 2026-08-28 12:45:05 -04:00
Chris Scott 78702da2e4 fix(sandbox): make the guest toolchain and sudo usable by the exec user
Set a writable guest HOME and shared COREPACK_HOME, expose bunx, redirect
npm/pnpm global installs to a PATH dir, lift Debian's externally-managed
pip guard, and verify the toolchain as an unprivileged uid at build time.
Provision passwd/group/shadow entries for the numeric exec uid at sandbox
create, start, and Manager boot so passwordless sudo works in the guest.
2026-08-28 10:22:36 -04:00
Chris Scott c5f0964988 feat(source-control): add branch search filter 2026-08-28 13:01:47 +00:00
Chris Scott 8858974334 feat(sandbox-image): align guest toolchain with Manager image 2026-08-28 13:01:47 +00:00
Chris Scott 5446faadec chore: bump version to 0.17.1 v0.17.1 2026-08-27 09:02:01 -04:00
Chris Scott d63198ec8a fix(sandbox): guard enable path and harden UI rendering performance (#341)
* fix(sandbox): guard enable path and harden UI rendering performance

* chore(deps): allow esbuild postinstall in pnpm onlyBuiltDependencies

* fix(sandbox): align availability reporting and address PR review feedback

* fix(sandbox): block planning without process attestation
2026-08-27 08:58:23 -04:00
Chris Scott ba8e8f4b29 ci(sandbox-image): build only on manual dispatch 2026-08-25 23:56:08 -04:00
Chris Scott dc404fe339 chore: bump version to 0.17.0 v0.17.0 2026-08-25 23:52:30 -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 411fee52f3 feat(navigation): add Home to nav drawer and move sidebar collapse toggle to top 2026-08-23 20:38:28 -04:00
Chris Scott 99dbc9a9ce fix(files): root file browser at repo directory instead of display name (#339) 2026-08-20 09:28:35 -04:00
Chris Scott 1d477bdee4 chore: bump version to 0.16.2 v0.16.2 2026-08-11 00:59:33 -04:00
f7b47e6345 fix(repos): parse and preserve custom-user SSH remotes (#337)
* fix(repos): parse and preserve custom-user SSH remotes

SSH remotes with a non-git user (e.g. company@company.ghe.com:orga/repo.git)
were misparsed as GitHub shorthand and stored as
https://github.com/company@company.ghe.com:orga/repo. The scp-style matcher
hardcoded the git@ user, so custom-user remotes fell through to the
owner/repo shorthand branch.

SSH URL parsing is now unified in shared/utils/repo.ts and applied across
backend and frontend: any user@host:path remote is detected, preserved, and
deduplicated correctly. The compare key also converges the scp-with-port and
ssh:// spellings, strips embedded credentials, and fails closed on malformed
host segments.

* fix: apply CodeRabbit auto-fixes

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
2026-08-10 20:41:04 -04:00
Chris Scott cfe2031c04 fix(schedules): submit scheduled runs via prompt_async with SSE monitoring (#335)
* 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
2026-08-10 10:42:35 -04:00
Chris Scott 1666d0de8f fix(session): keep cached session agent/model stable during message refetch (#333) 2026-08-07 18:16:45 -04:00
Chris Scott 46888b9723 fix(frontend): show feedback and restrict types for prompt file uploads 2026-08-03 11:15:46 -04:00
Chris Scott 906e3c4812 fix(ci): resolve opencode version via git ls-remote instead of GitHub API v0.16.1 2026-07-31 14:08:56 -04:00
Chris Scott db927864a4 chore: bump version to 0.16.1 2026-07-31 14:06:08 -04:00
Chris Scott dde09ac85b fix(docker): drop startup /app re-chown to keep cold starts fast 2026-07-31 14:05:26 -04:00
Chris Scott 4f0da40169 chore: bump version to 0.16.0 v0.16.0 2026-07-31 13:59:08 -04:00
Chris Scott ba8994eb61 Simplify OpenCode upgrade to always restart and refresh version 2026-07-30 23:30:15 -04:00
Chris Scott adc1290836 Refactor health checks to use OpenCode liveness endpoint 2026-07-30 23:30:15 -04:00
Chris Scott 5c381ddf6c test(docker): drop orphaned installation-guide link assertion
026e8f13c removed the host-access reference from the installation guide
but kept the test asserting that link, so docker-config.test.ts failed
on main. Remove the assertion and its now-unused path constant, and
close the blank line the dropped reference left behind.
2026-07-28 19:35:26 -04:00
Alexander DrewekeandChris Scott eac09090c6 Fix question prompt not rendering for active session (#325)
* Fix question prompt not rendering for active session

currentQuestion was the first pending question globally across all
sessions. When another session had the first question in the flat list,
the QuestionPrompt would not render for the session being viewed even
though it had its own pending question.

Add getForSession() to the questions context and use it in
SessionDetail to look up questions scoped to the current session.

* test(frontend): cover session-scoped question prompt resolution

The SessionDetail useQuestions mocks did not expose getForSession, so
every page test threw on the new session-scoped lookup. Add it to each
mock and lock in the behaviour with regression coverage: the context
helper resolves questions per session while another session owns the
global current question, and SessionDetail renders the prompt for the
session being viewed.

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-07-28 19:32:45 -04:00
Chris ScottandCS 6cc50a02ed feat(ocm-cli): add file and keychain credential backends with auth commands (#327)
* feat(ocm-cli): add file and keychain credential backends with auth commands

* feat(ocm-cli): refactor credentials into async TokenStore architecture

Replace the credential-backend module with a TokenStore interface and
file/keychain implementations behind an internal facade. Convert token
get/set/delete to async, add env-token precedence warnings on login and
logout, and surface store availability in status. Add token-store tests
and helpers; remove the old credential modules and tests. Bump to 0.2.6.

* fix(ocm-cli): keep tokens out of security argv and stop masking config read errors

Route every macOS Keychain call through `security -i`, sending the quoted
command on stdin so the token is never visible in process arguments. Reject
arguments containing line breaks, which would otherwise inject additional
security commands.

Let unexpected state file read failures propagate so a broken config dir is
reported instead of being reduced to "no manager configured", and stop
consuming the install notice when reading it fails unexpectedly.

---------

Co-authored-by: CS <chris@chriswritescode.dev>
2026-07-28 16:38:12 -04:00
Chris Scott 29f154a9c3 fix(oauth,settings): forward upstream oauth error contract and persist recovered config (#331)
* fix(oauth): forward upstream error categories to clients

The route boundary collapsed every upstream OAuth failure into a single
generic message, leaving all six mappings in the frontend's mapOAuthError
unreachable. Classify the failure and forward the matched category so
clients surface specific guidance.

Hoist the category list into @opencode-manager/shared as the single source
of truth for both sides; the frontend map is now typed
Record<OAuthErrorCategory, string> so a missing message fails typecheck.

* fix(oauth): match upstream provider auth errors by type instead of substrings

The previous mapping matched invented substrings ("invalid code", "expired",
"access denied", ...) that opencode never emits, so every real failure fell
through to the generic message and left the frontend map unreachable. It also
returned 500 for what upstream reports as 400.

opencode serialises these failures as a structured contract: ProviderAuthError
({ name, data }) or InvalidRequestError ({ _tag, message }) at HTTP 400. Model
both shapes in shared, discriminate on name/_tag, and forward the exact code
plus upstream detail so clients can map errors precisely.

Pin the contract to upstream with a compile-time conformance assertion against
@opencode-ai/sdk's generated ProviderOauthAuthorizeErrors[400] and
ProviderOauthCallbackErrors[400], added as a type-only devDependency. Any
added, removed, renamed, or retyped upstream variant now fails typecheck.

Also stop discarding the structured error at the frontend boundary, where
handleApiError rewrapped FetchError in a bare Error and dropped the code that
fetchWrapper had already parsed.

Verified against a live opencode 1.18.7 server: callback without a pending
authorization returns 400 ProviderAuthOauthMissing and is now forwarded as
such. Tests are pinned to captured responses, including the multiline message
BadRequest carries.

* fix(settings): persist recovered OpenCode config and accept provider api/npm fields

Applying a default config with auto-removed fields wrote the stripped content
to disk but left the stored record holding the rejected fields, so the database
and the on-disk config disagreed until the next write. Persist the applied
content and return 409 when the config disappears mid-recovery.

Add the provider-level api, npm, whitelist, and blacklist fields so valid
opencode provider configs survive a parse round-trip instead of being stripped.
2026-07-28 12:17:24 -04:00
Chris Scott e97ef8e6e2 chore(frontend): make typecheck script actually check types (#329)
The root tsconfig.json declares "files": [] and only project references, so
tsc --noEmit resolved zero input files and always exited 0. Frontend type
errors passed typecheck unnoticed; only the build script caught them via
tsc -b.

Use tsc -b so the script follows the project references, matching how build
already invokes it.
2026-07-28 11:37:52 -04:00
Chris Scott 6c635397ba feat(docker): run container as host user with bind-mounted workspace (#328)
* feat(docker): run container as host user with bind-mounted workspace


* fix(docker): warn on workspace gid mismatch as well as uid

* fix(docker): eval snippet passed as positional arg in container-user tests

* docs(installation): drop stale host repository access reference
2026-07-28 11:30:50 -04:00
Chris Scott a73ac19bbc feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard (#326)
* feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard

* refactor: remove retry-clone flow and share destructive-confirm dialog

Backend drops POST /:id/retry-clone and the supporting retryCloneRepo service
and claimRepoForRetry query; failed clones now delete the repo row rather than
lingering in error state. Frontend extracts ConfirmDestructiveDialog shared by
Delete/Discard/UnsavedChanges dialogs, memoizes CodeEditor rows, fixes scroll
jump while typing away from the active match, and aligns the responsive
breakpoint to 768px.
2026-07-27 16:46:12 -04:00
Alexander DrewekeandChris Scott f8e361c0b8 feat(repo): add graphical folder picker for adding local repositories (#324)
* feat(repo): add graphical folder picker for adding local repositories

Previously, adding a local repository or scanning a folder in the
"Add Repository" dialog required typing an absolute filesystem path by
hand. This adds a navigable directory browser so users can select a
folder graphically instead.

Backend
- New shared Zod schemas (DirectoryEntry, BrowseDirectoryResponse,
  BrowseDirectoryRequest) exported via shared/types and shared/schemas.
- New env var REPO_BROWSE_ROOT plus getBrowseRootPath() helper. It is
  intentionally NOT defaulted to WORKSPACE_PATH: folder browsing is
  opt-in and only works when an administrator explicitly configures a
  root directory.
- New filesystem service (browseDirectory) that lists only directories
  (hidden entries filtered), flags Git repositories, and confines all
  access to the configured root:
    - 501 when REPO_BROWSE_ROOT is not configured
    - 403 on path traversal outside the root
    - 404 for missing directories, 400 when the target is a file
- New authenticated route GET /api/filesystem/browse, registered under
  the protected API group.

Frontend
- New api client browseDirectory() (uses fetchWrapper, so auth cookies
  are sent).
- New DirectoryPickerDialog: navigate into subfolders, go up a level,
  Git repos marked with an icon, and a "Select This Folder" action.
  Retries are disabled so a configuration error is not polled
  repeatedly.
- When browsing is disabled (501), the dialog shows a clear, actionable
  message telling the user to set REPO_BROWSE_ROOT and to enter the
  path manually in the meantime, instead of a generic error.
- AddRepoDialog gains a "Browse" button next to both the Local and
  Folder path inputs; the chosen path is written back into the active
  field.

Tests
- Service and route tests covering listing, Git-repo detection, hidden
  filtering, parent navigation, and the 400/403/404/501 error paths.

Security note: because there is no default root, the picker is inert
until REPO_BROWSE_ROOT is set, and it can never escape that root.

* fix(fs): reject symlink escapes in directory browse

Canonicalize root and requested path with fs.realpath() and gate on
path.relative() so symlinks inside REPO_BROWSE_ROOT pointing outside
are rejected with 403 before fs.stat/fs.readdir follow them. Handles
root '/' correctly. Adds regression test for symlink escape.

* fix(ui): make directory picker fill dialog height

Replace grid content-start packing with explicit grid-rows tracks so
the directory list grows to fill the dialog and scrolls while the
header, path, and footer stay fixed. Drops the ineffective flex-1
from the grid child on the scroll container.

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-07-26 21:12:13 -04:00
Chris Scott 8d5102dc90 fix(source-control): invalidate branches cache after fetch and pull 2026-07-24 09:17:59 -04:00
Chris Scott ff250cb1d2 chore: bump version to 0.15.0 v0.15.0 2026-07-23 23:09:44 -04:00
Chris Scott 376bd67f1b refactor(fs): use mkdirSafe recursive and align test mocks
Replace try/access/mkdir pattern with single mkdirSafe call in ssh-key-manager; drop unused mkdir mocks from stt/tts/repo tests and mock fs-safe's mkdirSafe instead; add zod peer dep extension to pnpm workspace; note EACCES-tolerant startup in troubleshooting doc.
2026-07-23 22:59:05 -04:00
Chris Scott f20d8ffb71 fix(frontend): add crypto.randomUUID fallback for non-secure contexts (#318)
Introduce a shared randomId() helper in frontend/src/lib/utils that uses
crypto.randomUUID when available and falls back to a unique id for
non-secure contexts (e.g. HTTP origins where Web Crypto is unavailable).
Replace the inline id generator in PromptInput and the direct
crypto.randomUUID call in GitSettings ensureCredentialId with this shared
helper so git credential save no longer throws in non-secure contexts.

- utils: add randomId() with crypto.randomUUID fallback
- PromptInput: replace local generateId with randomId for image attachment ids
- GitSettings: use randomId in ensureCredentialId
- Add unit tests for randomId covering both code paths
2026-07-23 22:51:41 -04:00
Chris Scott 87f3d7f230 fix(fs): tolerate EACCES on existing mkdir targets (#319)
Add mkdirSafe/mkdirSyncSafe helpers that swallow EACCES/EPERM when the
target directory already exists with execute permission, and route all
recursive mkdir call sites through them so pre-existing directories
owned by another user do not break backend startup, file ops, or repo
mirroring.
2026-07-23 22:51:17 -04:00
Chris Scott 8a8bdc18b0 fix(session): handle 404 with not-found fallbacks and add SSE-gated message polling (#316) 2026-07-23 09:40:12 -04:00
Chris Scott 632ce132bb fix(frontend): stabilize ScheduleJobDialog render loop and improve accessibility (#315)
Resolve a "Maximum update depth exceeded" render loop in ScheduleJobDialog
while prompt templates are loading, and add accessibility labels across the
frontend. Also unregister the service worker in dev to avoid stale caches.

- ScheduleJobDialog: use a stable EMPTY_TEMPLATES constant and split template
  matching into its own effect keyed on [templates, job, open] instead of
  running inside the init effect that depends on templates
- Add ScheduleJobDialog.loading.test.tsx regression test for the loading state
- serviceWorker: unregister existing registrations and clear caches in DEV so
  stale workers do not serve outdated assets locally
- App: replace shell div with semantic <main>
- SettingsDialog: add sr-only DialogTitle for screen readers
- Add aria-labels to icon-only buttons in back-button, combobox, header,
  GlobalSchedules, and Repos
- index.html: add mobile-web-app-capable meta
2026-07-22 22:09:18 -04:00
Chris Scott 59fd516b75 fix(session): unify prompt sends on prompt_async and suppress stale network banners
Remove the long-lived synchronous POST to /session/{id}/message that produced
spurious "Connection Failed" banners on transient network blips; route every
send (normal, streaming-queue follow-up, message refresh) through prompt_async,
whose failure genuinely means not-delivered. Suppress network-kind banners
while SSE is disconnected or reconnecting (the header already shows that state);
session-kind banners still appear and reconcile clears confirmed prompts after
reconnect.
2026-07-20 23:45:46 -04:00
Chris Scott 80bca441ed style: remove REMOTE label, show host in accent color with repo name 2026-07-16 20:44:01 -04:00
Chris Scott adf6bd2921 feat(ocm-cli): add session warp with progress reporting (#314)
* feat(ocm-cli): add session warp with progress reporting

Add warp functionality for moving sessions between local and remote
Managers. Includes TUI dialogs, remote replay, progress reporting
during event transfer, and comprehensive test coverage.

* feat(ocm-cli): add granular push progress with phase reporting and upload tracking

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

* docs(ocm-cli): document push progress phases in README
2026-07-16 17:36:54 -04:00
Chris Scott 4519bcd2e9 fix(ocm-cli): bundle TUI with solid plugin and declare peer deps 2026-07-14 13:10:34 -04:00
Chris Scott ed02ddabba feat(ocm-cli): add remote indicator to TUI when attached to Manager (#313)
* feat(ocm-cli): add remote indicator to TUI when attached to Manager

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

* feat(ocm-cli): show remote indicator on home screen and session prompt

* feat(ocm-cli): remove arrow icon from remote indicator

* docs: remove arrow icon from remote indicator description
2026-07-14 12:55:14 -04:00
Chris Scott 7c7e9f3c77 fix(cors): reflect origin for WebView routes using Bearer auth
Routes prefixed with /api/opencode-proxy/ and /api/internal/ authenticate
via Bearer/CF-Access headers rather than cookies. These routes are now
allowed to reflect any origin in the CORS response since they don't rely
on cookie-based trust.

Also added CF-Access-Client-Id and CF-Access-Client-Secret to the allowed
headers list.
2026-07-14 09:33:47 -04:00
Chris Scott 5d9a159c07 Add domain to README 2026-07-13 00:15:09 -04:00
Chris Scott 195182e3ae fix(schedules): use array-based permission ruleset format for OpenCode v1.16+ (#309)
Refactor SchedulePermissionRuleset from object-based to array-based format.
Updates schema, builder, and tests to match OpenCode v1.16+ expectations.
2026-07-09 20:43:50 -04:00
Chris Scott 009abaf53a chore(ocm-cli): bump package version to 0.2.2 2026-07-08 17:45:28 -04:00
Chris Scott bf54f6e7c8 fix(ocm-cli): include plugin installer in package 2026-07-08 17:44:24 -04:00
Chris Scott 61efcf9ad1 feat(ocm-cli): add session move with local history export and TUI plugin (#304)
* loop: ocm-session-move completed after 7 iterations

* feat(ocm-cli): add session move with local history export and TUI plugin

* docs(ocm-cli): update plugin config to tui-only entry and clarify session history source

* fix(ocm-cli): replace raw postinstall output with TUI toast notification
2026-07-08 17:23:53 -04:00
冯基魁andChris Scott 54323267f5 fix(mirror): reject empty commit uploads (#303)
* fix(mirror): reject empty commit uploads

* refactor(mirror): unify totalParts validation into shared predicate

Consolidate the duplicated positive-integer check and error message into
isValidTotalParts/TOTAL_PARTS_INVALID_MESSAGE, reused by the commit route
and extractPartsToStaging. Validate totalParts before the session lookup to
match the parts route, and update the delete-session test to use a valid
totalParts so it unambiguously covers the 404 path.

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-07-06 12:55:05 -04:00