Commit Graph
53 Commits
Author SHA1 Message Date
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 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 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 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 a383e57bc5 section 16: Phase 16: Documentation, container ports and full repository checks 2026-10-03 04:07:44 -04:00
Chris Scott 13c29c635e section 3: Phase 3: Terminal WebSocket bridge 2026-10-03 01:16:24 -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 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 94e3e1917d feat(settings): add manager logs viewer (#344)
* feat(settings): add manager logs viewer with backend log capture

* style(settings): polish logs viewer layout for mobile and full-height output
2026-08-29 16:45:54 -04:00
Chris Scott 4862d9c5cb fix(sandbox): wait for guest agent, verify exec user provisioning, pin rebuilt image (#343)
* fix(sandbox): wait for the guest agent before provisioning the exec user

A freshly created microVM does not accept msb exec until its guest agent is
up, so provisioning raced the boot and died on three 15s timeouts, which then
failed the whole enforcement-enable path. Gate provisioning on msb ping
bounded by SANDBOX_START_TIMEOUT_MS, give the exec a 30s budget, and downgrade
a provisioning failure to a warning so a missing sudo entry never blocks
sandboxed commands.

* fix(sandbox): align canonical shell spec with msb and pin the rebuilt guest image

- pass --shell /bin/sh explicitly at create and derive the canonical
  spec from the create args so msb 0.6.15 recordings match attestation
- bump the SANDBOX_IMAGE pin to the rebuilt guest image digest
- verify the provisioned exec user inside the guest and give the
  provisioning exec the full start timeout, bounded by a deadline

* docs(sandbox): sync the image digest pin into the docker and environment docs

* fix(sandbox): verify the guest image as an unknown uid and pin the rebuild

The build verification ran as uid 1000, which is the base image's node user,
so it exercised the known-user path and would have passed even if the numeric
exec uid the runtime actually uses were broken. Verify the toolchain as uid
4242 instead and keep the sudo check on the known user, since sudo refuses
unknown uids by design. Also only write the shadow entry when the passwd entry
is created, so a uid that already exists leaves no orphan record.

* fix(sandbox): close spawned command stdin so msb exec completes

msb exec reads its stdin during session setup and waits for EOF, so
every child spawned through executeCommand with an open stdin pipe hung
until its timeout while identical CLI execs finished instantly. Spawn
children with stdin ignored.

Also verify the provisioned exec user from a fresh guest exec after
each provisioning attempt and move failed provisioning to a logged
background retry bounded by five attempts so a slow guest no longer
blocks enforcement or leaves sudo silently missing.

* test(sandbox): derive expected inspect spec from canonical builders

* fix(sandbox): cancel provisioning retries on stop and serialize attempts

Advance the provisioning retry generation and drop the pending retry at the
start of every managed-sandbox stop, so a retry scheduled before a toggle-off
no longer pings and provisions a stopped sandbox. Clearing the promise as well
keeps later retries schedulable, since the generation guard would otherwise
strand it and short-circuit scheduling.

Route every provisioning caller through a single in-flight promise so the
boot-path attempt and the background retry cannot run the check-then-append
passwd and shadow script concurrently and append duplicate account entries.
2026-08-28 19:23:40 -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
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 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 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 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 55af93062a refactor: extract CredentialProvider service and consolidate git-auth utilities (#283)
* refactor: extract CredentialProvider service and consolidate git-auth utilities

* refactor: add git-credentials route and gh env plugin, pass internal token to OpenCode

* refactor: update credential provider integration and git route

* refactor: integrate credential provider across git auth, routes, and IPC
2026-06-20 21:52:18 -04:00
Chris Scott 6e80cdfb8c feat: add skill installer (#279)
* feat: add skill installer with install/uninstall and settings UI

* feat: refactor skill installer with extracted SkillLibraryList component

* feat: simplify SkillsEditor, extract SkillLibraryList

* feat: refactor skill installer components and add github utility
2026-06-17 23:11:29 -04:00
Chris Scott 10275442ec refactor(sse): add sse-frame utility and refine SSE hardening 2026-06-06 11:11:10 -04:00
Chris Scott 74cdeb3926 fix: update settings and skills handling with assistant redirect (#220)
* fix: enable swipe-back suspension on more drawer and remove unused variable

* refactor(frontend): improve dialog component and settings navigation

* fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation

* fix(frontend): enable swipe-back suspension on more drawer route

* refactor(frontend): improve mobile navigation drawer and tab bar

* feat: add schedules service and workspace hook with navigation updates

* chore: add workspace hook, schedules library, and tests

* fix: prevent MoreDrawer sentinel from undoing navigation

* feat: per-agent model selection and UI refinements (#217)

* feat: per-agent model selection and UI refinements

- Add agentModels store with setAgentModel/getAgentModel
- PromptInput uses session model priority and stores agent model on change
- useContextUsage derives model from assistant message instead of global
- Migrate sub-agent/subtask badges from purple to blue with refined styling
- Fix MoreDrawer sentinel to skip history-back on navigation

* refactor: improve per-agent model selection and task tool call status indicators

* feat: add repo management skill and internal repos API

* fix: improve assistant session launcher and UI components

* fix: update atomic-json test assertions

* refactor: split Assistant Mode instructions between AGENTS.md and assistant.md

* loop: todo-header-mobile completed after 3 iterations (#218)

* loop: stt-perf-1 completed after 5 iterations

* fix: load audio worklet per recording context

* fix: canonicalize assistant navigation routes

* fix: adjust scroll-up threshold for header visibility

* fix: update settings and skills handling with assistant redirect

* refactor: simplify context usage indicator and extract token sum helper

* feat: add currently selected model row to popover and fix responsive truncate
2026-05-07 18:36:03 -04:00
Chris Scott c3d6549f01 feat: add assistant mode, SSE streaming, and OpenCode server integration (#214) 2026-05-02 21:51:37 -04:00
Chris Scott 549e0ac7b2 feat: add model state persistence and improve model selection sync (#209)
* feat: add persistent model state storage with database backend

- Create opencode_model_state table for storing user model preferences
- Implement database-backed model state management (recent, favorite, variant)
- Add atomic JSON file utilities with file locking for concurrent safety
- Migrate providers routes from file-based to database storage
- Add backfill migration to preserve existing model.json data
- Include comprehensive tests for model-state and atomic-json modules
- Refactor useSessionAgent hook to simplify agent/model resolution logic
- Update getFileApiUrl to use consistent query parameter approach

* fix: include workspace dependencies in Docker image

* fix: overlay workspace node_modules after source to prevent layer overwrite

* fix: ensure model state table exists for existing databases

* feat: add model state persistence and improve model selection sync

- Add setActiveModel to modelStore and useModelSelection for direct model updates
- Sync session agent model/variant to store when messages load
- Include model, agent, and variant in optimistic user messages
- Fix useSessionAgent to check isFetching during message loading
- Update env.ts to use getter for BASE_PATH for dynamic resolution
- Fix test environment variable from OPENCODE_WORKSPACE_PATH to WORKSPACE_PATH
2026-04-29 21:44:47 -04:00
Chris ScottandChris Scott 389120559f fix(frontend): remove permission immediately after responding (#205)
* fix(backend): normalize git credential extraheaders

* fix(frontend): remove permission immediately after responding

Call removePermission synchronously after a successful API response,
matching the existing pattern used by replyToQuestion and rejectQuestion.
This ensures the UI updates promptly even if the SSE permission.replied
event is delayed or missed.

---------

Co-authored-by: Chris Scott <>
2026-04-28 16:14:25 -04:00
Chris Scott 29b9d028c7 feat(frontend): improve mobile voice controls and TTS playback 2026-04-18 08:25:47 -04:00
Chris Scott 55ec3440f8 Fix SSH credential host matching and Bitbucket test detection (#174, #175) (#178) 2026-04-05 18:12:06 -04:00
Chris Scott 9975be955e Refactor routes to use shared route-helpers utility
Extracts parseId and handleServiceError into reusable helpers
for consistent error handling and ID parsing across all routes.
2026-03-24 11:39:11 -04:00
Chris Scott 47524876aa Refactor schedule service and add cron support 2026-03-22 11:14:30 -04:00
Chris ScottandNiu Shuai 5746033fde Test fix branch (#157)
* fix(lsp): Fixes pyright LSP initialization timeout

* test(lsp): Add unit tests for bin directory initialization

- Add reinitializeBinDirectory() public method for testing
- Add 7 comprehensive test cases
- Cover success scenarios, error handling, and edge cases
- Achieve 100% code and branch coverage

* Refactor OpenCode server for testability and fix bin directory tests

* Standardize test ENV mocks and modernize imports

---------

Co-authored-by: Niu Shuai <guisu2010@gmail.com>
2026-03-08 21:40:37 -04:00
Chris Scott 3461f86556 Add memory plugin with semantic search and session planning (#145)
* Add memory plugin with semantic search and session planning

* Clarify Memory Plugin is optional in docs
2026-02-23 15:08:56 -05:00
Chris Scott 5de419ee28 fix issues (#136)
* fix: prevent delete button click when card is not swiped open

* refactor: improve CreateRepoInput type safety

* security: require AUTH_SECRET and use secure random generation

* fix: SSH key path validation, async passphrase stripping, and port handling

* fix: use correct console methods for logger levels

* Add error handling to DB update functions and improve migration logging

* Add error handling for session lookup in auth middleware

* Add structured git error handling with user-friendly messages

- Parse git errors with specific error codes (AUTH_FAILED, REPO_NOT_FOUND,
  PUSH_REJECTED, MERGE_CONFLICT, etc.) and appropriate HTTP status codes
- Return structured error responses with summary and detail from backend
- Add GitErrorBanner component for better error display in UI
- Add optional onError callback to useGit hook for external error handling

* Make IPC server initialization/disposal async and fix SSH host key handler

* add try-catch error handling in frontend lib utilities

* remove unresolved promise handlers in speech synthesizer callbacks

* Extract error types to shared package

* Import GitErrorCode from shared package

* Refactor API layer to use shared FetchError and fetchWrapper

* Update prompt parser and source control components

* Extract MCP server list to separate component with improved badge menu UX

* merge useSettingsDialogUrl into useSettingsDialog and extract getRepoDisplayName utility

* add separate loading state for passkey sign in

* refactor hooks: use fetchWrapper, improve error handling, add proper types

* replace browser confirm() with DeleteDialog component in settings

* fix: add missing variables parameter in React Query onError callbacks

* Refactor message parts to use separate Zustand store

* Update QuestionPrompt styling for light/dark mode
2026-02-15 19:48:03 -05:00
Chris Scott 7341dce1ef Add skip SSH host key verification and fix self-hosted server support (#121)
* Add SSH host key verification with automatic trust and SCP-style URL support

* Fix TypeScript errors for SSH host key schema and test mocks
2026-02-11 22:58:13 -05:00
Chris Scott 414f39b809 feat: SSH Authentication Keys v2 (#113)
* feat: add SSH authentication keys v2 for Git operations

Add comprehensive SSH key authentication support for Git operations including:
- SSH host key verification with user approval flow
- Encrypted SSH key storage with passphrase support
- SSH connection testing endpoint
- Real-time host key change warnings

Backend changes:
- New SSHHostKeyHandler for managing host key verification via IPC
- Add passphrase handler for locked SSH keys
- Add SSH key manager utilities (key writing, validation, cleanup)
- Add crypto utilities for secure key/secret encryption
- Add SSH validation utilities for key format checking
- Add SSH routes for host key response handling
- Enhance GitAuthService with SSH setup and environment methods
- Update GitService to handle SSH authentication for push/fetch/pull
- Update OpenCode server to support SSH keys with SSH config generation
- Add database migration for trusted_ssh_hosts table
- Add settings endpoint for SSH connection testing

Frontend changes:
- Add SSHHostKeyDialog for host key verification UI
- Add PassphraseModal for SSH key passphrase input
- Update GitCredentialDialog with SSH key type and testing
- Update GitSettings to manage SSH keys
- Add SSH API client and hooks (useSSH, usePassphraseHandler)

Shared changes:
- Add SSH schemas and types

Test coverage:
- Integration tests for SSH flow
- IPC handler tests for host key and passphrase
- SSH route tests
- SSH utility validation tests
- Updated existing tests for SSH-aware changes
2026-02-08 00:06:44 -05:00
Chris Scott 059b9a172c chore (#103)
* Fix TypeScript error in git-errors.ts

* Remove code review documentation
2026-02-01 11:05:22 -05:00
theepicsaxguy c32819fc1c feat: auto-create remote branches on push (#91) 2026-01-31 12:06:07 -05:00
Chris Scott eccd49e877 Enhance download options and improve git error handling (#100)
* Fix download dialog to show gitignored paths with opt-in selection

- Add getIgnoredPathsList API to detect gitignored files from git root
- Fix git check-ignore to run from proper git root directory
- Add ignored paths checkboxes in download dialog for opt-in inclusion
- Support includeGit and includePaths options in download endpoints
- Fix dialog button event handling to prevent page reload

* Add clone timeout and improve git error handling

* Refactor path extraction in download-zip endpoint
2026-01-31 09:39:45 -05:00
Chris Scott 3661f0a271 Fix file routes path handling and improve error utilities (#96) 2026-01-29 21:57:31 -05:00
theepicsaxguyandChris Scott e91c54ba20 Git Source Control Integration (#74)
* feat(source-control): add commits and file management components

- Introduced `CommitsTab` for displaying commit history with relative time formatting.
- Added `GitFlatFileItem` and `GitFlatFileList` for managing file statuses in the source control panel.
- Implemented `SourceControlPanel` to encapsulate source control functionalities including changes, commits, and branches.
- Enhanced `useGit` hook to manage git operations such as fetch, pull, push, commit, stage, and unstage files with appropriate error handling and toast notifications.
- Updated `RepoDetail` to integrate the new source control panel and provide a user interface for source control actions.
- Defined `GitCommit` type for better type safety in commit-related operations.

* refactor: streamline error handling in Git operations and update error imports

* feat: enhance Git services and ESLint configuration for improved functionality

* refactor: update method signatures for consistency and clarity in Git services

* feat: refactor git services and improve error handling

- Remove unused imports and clean up code in repos.ts and git-operations.ts.
- Simplify error handling in repo.ts by enforcing message property in ErrorWithMessage interface.
- Update GitPushService to remove unnecessary database parameter in methods.
- Enhance executeCommand function to better handle command execution results.
- Update tests to use mocked functions for better isolation and clarity.
- Add specific ESLint rules for test files to accommodate common testing patterns.
- Introduce tsconfig.test.json for better TypeScript configuration in tests.
- Update vitest.config.ts to use the new test TypeScript configuration.

* refactor: remove esbuild configuration from Vitest setup

* feat: enhance Source Control Panel with branch management and integrate into RepoDetail and SessionDetail pages

* feat: implement Git authentication service and refactor related services

- Add GitAuthService to handle Git environment setup with credentials.
- Refactor GitBranchService, GitCommitService, GitFetchPullService, GitPushService, GitStatusService, and GitLogService to utilize the new GitAuthService.
- Remove GitCommandUtils and related error handling for Git operations.
- Delete git-operations.ts and associated tests as functionality is now integrated into other services.
- Update TypeScript configuration to enable composite projects for better build management.

* feat: refactor Git services to improve structure and update imports

* refactor: simplify error utility functions and update test cases for Git services

* feat: refactor GitAuthService and update related tests for improved credential handling

* feat: implement GitDiffService and related endpoints for file diff functionality

* feat: add emitDeclarationOnly option to TypeScript configuration files

* feat: enhance GitLogService to fetch remote branches and improve error handling in repo commands

* feat: update Git command execution to remove fallback and enhance environment variable handling

* feat: add repository authentication tracking

- Add `requires_auth` column to repos table
- Implement auth check in GitAuthService
- Update cloneRepo to detect public/private repos
- Add test coverage for auth-related functionality
- Improve UI styling for auth-related indicators

* feat(git): implement interactive Git authentication with askpass

- Add GitAskpassService to handle credential requests from Git
- Implement askpass script that communicates with backend
- Update GitAuthService to use askpass instead of direct credential
  injection
- Add new endpoint for branch listing and status
- Improve branch name handling in GitBranchService
- Enhance error handling in GitDiffService for untracked files
- Add upstream branch checking and setup in GitFetchPullService
- Update UI components for better visual consistency
- Fix various minor UI styling issues

* feat(git): enhance Git authentication with improved askpass support

- Update askpass endpoint to handle hostname parameter and return full
  credential object
- Replace `createNoPromptGitEnv` with `createSilentGitEnv` for better
  VSCode compatibility
- Add compiled Node.js askpass script for broader compatibility
- Enhance GitBranchService to return detailed branch information with
  upstream tracking
- Improve branch listing UI with better sorting and display
- Update GitAuthService to use askpass for all operations with proper
  credential handling
- Fix various UI styling issues in diff view and source control panel
- Update test mocks to use new silent environment function
- Add proper error handling and credential caching in GitAskpassService

* feat(git-auth): implement IPC-based Git authentication system

- Add new IPC server infrastructure for handling Git credential requests
- Implement AskpassHandler to manage Git authentication through IPC
- Replace previous HTTP-based askpass system with local IPC
  communication
- Remove deprecated GitAskpassService and related HTTP endpoints
- Update GitAuthService to use IPC-based authentication flow
- Add new shell scripts for Git askpass integration (askpass.sh,
  askpass-main.js)
- Remove database column 'requires_auth' as it's no longer needed
- Update all Git service classes to use new authentication approach
- Improve error handling and credential caching
- Add proper cleanup for IPC server on shutdown

* fix(frontend): correct GitBranch type usage in BranchesTab and BranchSwitcher

* fix(ipc): handle empty responses and add logging for askpass handler

- Handle empty response bodies in askpass-main.ts to prevent JSON parse errors
- Add logging to IPC server for debugging request/response issues
- Add logging to AskpassHandler for credential lookup visibility

* fix(ipc): return empty credentials for silent fetches instead of failing

Silent fetch operations (used when fetching commit history on repo open)
should return empty credentials gracefully rather than failing, allowing
git to proceed without credentials for public repos or cached credentials.

* chore(ipc): add detailed logging for debugging askpass requests

- Log handler registration and lookup paths
- Log incoming request details
- Log handler response results

* chore(askpass): add comprehensive debugging to trace IPC communication

- Add detailed stderr logging to askpass-main.ts for all steps
- Log environment variables and paths at initialization
- Log IPC connection attempts and responses
- Log JSON parsing results

This will help trace where the IPC communication fails.

* chore(debug): add comprehensive logging to trace git environment and IPC requests

- Log GIT_ASKPASS, VSCODE_GIT_IPC_HANDLE, GIT_TERMINAL_PROMPT env vars when executing git
- Log all incoming IPC requests with URL and body
- Log handler registration status

* Integrate GitAuthService throughout repo operations

- Add GitAuthService parameter to all repo service functions
- Replace direct git env creation with GitAuthService.getGitEnvironment()
- Update route handlers to pass GitAuthService to service calls
- Remove createSilentGitEnv utility in favor of centralized auth
- Ensure consistent git authentication across all operations

* refactor: consolidate git services and remove duplicate fetch service

- Remove GitFetchService and consolidate into GitFetchPullService
- Clean up duplicate git authentication logic across services
- Simplify repo service by removing redundant environment handling
- Update tests to reflect consolidated service structure
- Remove unused imports and streamline API endpoints
- Reduce codebase complexity by eliminating service duplication

* refactor: clean up unnecessary config changes and improve git API types

* feat(git): add GitCommit interface and fix push mutation

* feat(git): fix source control panel issues

- Fix unstaged file diff showing all changes instead of working directory only
- Remove auto-refresh (10s) to reduce git command spam
- Add reset/revert mutation for unpushed local commits
- Fix branch creation/switching to update database
- Add unpushed commit detection and visual indicator in commits tab
- Handle no-upstream branch status gracefully

* fix(git): improve branch listing and remove regex parsing issue

- Fix branch name parsing to use full name instead of regex capturing only first word
- Add refresh button for branches
- Show remote branches with Globe icon and make them non-clickable
- Add 'local' label for branches without upstream tracking
- Handle remotes/ prefix properly in branch detection

* fix(git): remove duplicate refresh button

* fix(git): properly extract branch name from git output

- Extract branch name before whitespace/bracket in git branch -vv -a output
- When clicking remote branch, checkout local tracking branch instead of remote reference

* fix(git): remove duplicate refresh button from branches tab

* fix: improve source control panel mobile layout

- Set full height on mobile for better screen utilization
- Add larger centered close button on mobile
- Hide default close button when custom one is shown on mobile

* Remove git credential test feature

The test credential button in settings was broken because it tried to test
authentication against just the host URL (e.g., https://github.com/) instead
of a repository path. Since git credentials are already handled correctly
through the askpass mechanism when cloning repositories, the test button
was redundant and has been removed.

Changes:
- Remove /test-credential endpoint from settings routes
- Remove testGitCredential API from frontend
- Remove TestCredentialRequest/Response types
- Remove test button and related state from GitSettings component

* fix: resolve Copilot review issues

- Remove duplicate GitCommit interface definition
- Fix CSS typos: bg-linear-to-br -> bg-gradient-to-br
- Fix typo: /sessflex-shrink-0 -> flex-shrink-0
- Add *.test.js to .gitignore and remove compiled test files
- Fix missing closing brace in useGit.test.tsx
- Remove unused maskToken function

* fix(git): correct ahead/behind count order and add renamed file path parsing

- Fix git rev-list output parsing: ahead comes first, behind second
- Add oldPath extraction for renamed (R) and copied (C) files in status
- Refactor git service tests to use consistent mocking patterns
- Add missing Database and SettingsService mocks to prevent test failures

---------

Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
2026-01-19 22:03:42 -05:00
Chris Scott 8166044d6e Fix eslint (#46)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line

* Add ESLint no-console rules and fix lint errors

- Add eslint configuration for backend with no-console rule
- Add reusable error type guard utility
- Replace all error: any with error: unknown and type guards across backend
- Update logger to use console.warn/console.error only
- Remove unused variables and dead code functions
- Fix regex escape characters
- Update AGENTS.md with lint commands and requirements
2026-01-03 15:19:28 -05:00
Chris Scott c9bf962ac0 Fix mobile paste (#45)
* Fix mobile image upload and paste with improved file type handling

* Replace older sessions header with separator line
2026-01-03 11:44:39 -05:00
Chris Scott b7e5390ab7 Replace global git config with environment-based identity management 2026-01-02 21:50:52 -05:00
Chris Scott a736e98880 Add multiple git credentials support with migration 2025-12-31 10:47:55 -05:00
Chris Scott 5c0ba50e02 Fix browser runtime error by excluding Node.js env module from shared package exports 2025-12-15 15:04:53 -05:00
Fran Boon a684682510 Fix GitHub Token 2025-12-14 17:12:33 +00:00
Chris Scott 8d0d961e50 Rename project from opencode-webui to opencode-manager
- Update package names from opencode-webui to opencode-manager
- Update all backend import statements to use @opencode-manager/shared
- Update Docker configuration and container name
- Update README.md with new repository URLs and project title
- Update frontend assets and titles
- Update version to 0.4.0
- Update docker entrypoint script comments

This change maintains all functionality while better reflecting the
project's purpose as a comprehensive management interface for OpenCode.
2025-12-12 13:58:08 -05:00
Chris Scott af0dcac7c8 Add GitHub token environment variable support and improve git operations 2025-11-30 21:05:30 -05:00
Chris Scott ae929a7c96 Fix intermittent mobile scroll lock and suppress expected git errors on empty repos 2025-11-29 00:02:10 -05:00