8 Commits

Author SHA1 Message Date
Thomas Marchand
6389dccfc3 Add persistent settings storage for library_remote
Replace env-var-only LIBRARY_REMOTE configuration with disk-persisted
settings. The setting can now be edited in the dashboard Settings page,
with LIBRARY_REMOTE env var serving as initial default when no settings
file exists.

Changes:
- Add src/settings.rs for settings storage with JSON persistence
- Add src/api/settings.rs for settings API endpoints
- Update dashboard Settings page with editable library remote field
- Update library-unavailable component to link to Settings page
- Update documentation to recommend Settings page method
2026-01-17 18:01:23 +00:00
Thomas Marchand
cb36560526 Rename host MCP to workspace MCP for clarity
- Rename binary from host-mcp to workspace-mcp
- Rename src/bin/host_mcp.rs to src/bin/workspace_mcp.rs
- Update tool prefix from host_* to workspace_*
- Update MCP registration name from "host" to "workspace"
- Add "Builtin" tag to UI for workspace and desktop MCPs
- Update documentation (CLAUDE.md, INSTALL.md, docs-site)

The "workspace MCP" name better reflects that it runs in the
workspace's execution context - inside containers for container
workspaces, on host for host workspaces.
2026-01-17 08:56:09 +00:00
Thomas Marchand
58e10a5a95 Add library item rename with cascading reference updates
- Add POST /api/library/rename/:item_type/:name endpoint supporting
  skills, commands, rules, agents, tools, and workspace templates
- Implement dry_run mode to preview changes before applying
- Auto-update all cross-references in related configs and workspaces
- Add RenameDialog component with preview and apply workflow
- Integrate rename action into Skills, Commands, and Rules config pages
- Fix settings page to sync config before restarting OpenCode
- Clarify INSTALL.md dashboard deployment options (Vercel vs local)
- Add docs-site scaffolding (Nextra-based documentation)
2026-01-16 16:48:52 +00:00
Thomas Marchand
724803d2f1 docs: Document git clone requirement for one-click updates
The update system in Settings relies on git to fetch tags and checkout
releases. Updated INSTALL.md to clarify:
- Repository must be git clone'd (not rsync'd) at /opt/open_agent/vaduz-v1
- How to create releases with version tags for update detection
- Dashboard one-click update flow vs manual CLI updates
2026-01-16 15:01:39 +00:00
Thomas Marchand
670c456136 docs: Add SSH key setup guide and link to INSTALL.md
- Add detailed SSH key generation and setup instructions
- Include troubleshooting tips for common connection issues
- Add README link to INSTALL.md for easy discovery
2026-01-16 14:14:34 +00:00
Thomas Marchand
b519f02b62 Th0rgal/ios compat review (#37)
* Add hardcoded Google/Gemini OAuth credentials

Use the same client credentials as Gemini CLI for seamless OAuth flow.
This removes the need for GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET env vars.

* Add iOS Settings view and first-launch setup flow

- Add SetupSheet for configuring server URL on first launch
- Add SettingsView for managing server URL and appearance
- Add isConfigured flag to APIService to detect unconfigured state
- Show setup sheet automatically when no server URL is configured

* Add iOS global workspace state management

- Add WorkspaceState singleton for shared workspace selection
- Refactor ControlView to use global workspace state
- Refactor FilesView with workspace picker in toolbar
- Refactor HistoryView with workspace picker in toolbar
- Refactor TerminalView with workspace picker and improved UI
- Update Xcode project with new files

* Add reusable EnvVarsEditor component and fix page scrolling

- Extract EnvVarsEditor as reusable component with password masking
- Refactor workspaces page to use EnvVarsEditor component
- Refactor workspace-templates page to use EnvVarsEditor component
- Fix workspace-templates page to use h-screen with overflow-hidden
- Add min-h-0 to flex containers to enable proper internal scrolling
- Environment and Init Script tabs now scroll internally

* Improve workspace creation UX and build log auto-scroll

- Auto-scroll build log to bottom when new content arrives
- Fix chroot workspace creation to show correct building status immediately
- Prevent status flicker by triggering build before closing dialog

* Improve iOS control view empty state and input styling

- Show workspace name in empty state subtitle
- Distinguish between host and isolated workspaces
- Refine input field alignment and padding

* Add production security and self-hosting documentation

- Add Section 10: TLS + Reverse Proxy setup (Caddy and Nginx examples)
- Add Section 11: Authentication modes documentation (disabled, single tenant, multi-user)
- Add Section 12: Dashboard configuration (web and iOS)
- Add Section 13: OAuth provider setup information
- Add Production Deployment Checklist

* fix: wip

* wip

* Improve settings sync UX and fix failed mission display

Settings page:
- Add out-of-sync warning when Library and System settings differ
- Add post-save modal prompting to restart OpenCode
- Load both Library and System settings for comparison

Control client:
- Fix missionHistoryToItems to show "Failed" status for failed missions
- Last assistant message now inherits mission's failed status
- Show resume button for failed resumable missions

* Fix: restore original URL on connection failure in SetupSheet

Previously, SetupSheet.connectToServer() persisted the URL before validation.
If the health check failed, the invalid URL remained in UserDefaults, causing
the app to skip the setup flow on next launch and attempt to connect to an
unreachable server. Now the original URL is restored on failure, matching
the behavior in SettingsView.testConnection().

* Fix: restore queueLength on failed removal in ControlView

The removeFromQueue function now properly saves and restores both
queuedItems and queueLength on API error, matching the behavior of
clearQueue. Previously only queuedItems was refreshed via loadQueueItems()
while queueLength remained incorrectly decremented until the next SSE event.

* Add selective encryption for template environment variables

- Add lock/unlock icon to each env var row for encryption toggle
- When locking, automatically hide value and show eye icon
- Auto-enable encryption when key matches sensitive patterns
- Backend selectively encrypts only keys in encrypted_keys array
- Backwards compatible: detects encrypted values in legacy templates
- Refactor workspaces page to use SWR for data fetching

Frontend:
- env-vars-editor.tsx: Add encrypted field, lock toggle, getEncryptedKeys()
- api.ts: Add encrypted_keys to WorkspaceTemplate types
- workspaces/page.tsx: Use SWR, pass encrypted_keys on save
- workspace-templates/page.tsx: Load/save encrypted_keys

Backend:
- library/types.rs: Add encrypted_keys field to WorkspaceTemplate
- library/mod.rs: Selective encryption logic + legacy detection
- api/library.rs: Accept encrypted_keys in save request

* Fix: Settings Cancel restores URL and queue ops refresh on error

SettingsView:
- Store original URL at view init and restore it on Cancel
- Ensures Cancel properly discards unsaved changes including tested URLs

ControlView:
- Queue operations now refresh from server on error instead of restoring
  captured state, avoiding race conditions with concurrent operations

* Fix: preserve undefined for encrypted_keys to enable auto-detection

Passing `template.encrypted_keys || []` converted undefined to an empty
array, which broke the auto-detection logic in toEnvRows. The nullish
coalescing in `encryptedKeys?.includes(key) ?? secret` only falls back
to `secret` when encryptedKeys is undefined, not when it's an empty array.

* Add Queue button and fix SSE/desktop session handling

- Dashboard: Show Queue button when agent is busy to allow message queuing
- OpenCode: Fix SSE inactivity timeout to only reset on meaningful events,
  not heartbeats, preventing false timeout resets
- Desktop: Deduplicate sessions by display to prevent showing duplicate entries
- Docs: Add dashboard password to installation prerequisites

* Fix race conditions in default agent selection and workspace creation

- Fix default agent config being ignored: wait for config to finish loading
  before setting defaults to prevent race between agents and config SWR fetches
- Fix workspace list not refreshing after build failure: move mutateWorkspaces
  call to immediately after createWorkspace, add try/catch around getWorkspace

* Fix encryption lock icon and add skill content encryption

- Fix lock icon showing unlocked for sensitive keys when encrypted_keys is
  empty: now falls back to auto-detection based on key name patterns
- Add showEncryptionToggle prop to EnvVarsEditor to conditionally show
  encryption toggle (only for workspace templates)
- Add skill content encryption with <encrypted>...</encrypted> tags
- Update config pages with consistent styling and encryption support
2026-01-16 01:41:11 -08:00
Thomas Marchand
c32f98f57f Clean up stuck tool detection and improve mission completion UX (#33)
* Ralph iteration 1: work in progress

* Fix mission events pagination and add update_skill MCP tool

- Increase default events limit from 1000 to 50000 to fix truncation issue
  where assistant messages at the end of long missions were being cut off
- Add update_skill MCP tool to host-mcp for agents to update skill content
  in the library, with automatic workspace syncing via backend API

* Clean up stuck tool detection and improve mission completion UX

- Remove aggressive stuck tool detection that was hijacking missions
  - Deleted TOOL_STUCK_TIMEOUT and recovery mechanism from opencode.rs
  - Frontend already shows "Agent may be stuck" warning after 60s
  - Let users control cancellation instead of auto-intervention

- Fix tool calls showing "Running" after mission completes
  - When mission status changes to non-active, mark pending tools as cancelled
  - Display cancelled tools with amber color and clear status
  - Prevents confusing "Running for X..." state when mission ends

- Improve mission completion message clarity
  - Replace truncated output with meaningful terminal_reason summary
  - Show specific reason: "Reached iteration limit", "No progress detected", etc.
  - Normal completions show no extra explanation

* Fix stuck detection and pending tool UI issues

- When mission fails (success=false), mark all pending tool calls as failed
  so subagent headers show "Failed" instead of staying "Running for X"

- Increase stall warning thresholds when tools are actively running:
  - Normal: 60s warning, 120s severe
  - With pending tools: 180s warning, 300s severe
  This prevents false "stuck" warnings during long desktop operations

* Fix queued status response for user messages

- Add respond channel to UserMessage command for accurate queue status
- Return actual queued state based on whether runner was already processing
- Fallback to status check if channel fails

* Add automatic OpenCode session cleanup to prevent memory pressure

- Add list_sessions() and delete_session() methods to OpenCode client
- Add cleanup_old_sessions() method that deletes sessions older than 1 hour
- Add background task that runs every 30 minutes to clean up old sessions
- Prevents session accumulation from causing OpenCode server memory pressure

* Fix review findings: remove test artifacts, fix blob URL leak, align failure detection

- Remove accidentally committed test files (ralph.txt, changes.txt, report.txt)
- Add LRU-style cache with URL.revokeObjectURL() cleanup for blob URLs to prevent
  memory leaks in long-running sessions
- Align streaming handler with eventsToItems by using strict equality (=== false)
  for failure detection, so undefined success doesn't incorrectly mark tools as failed

* Fix memory leak from concurrent image fetches

Revoke incoming duplicate blob URL when path is already cached
to prevent leaks during race conditions.
2026-01-14 23:23:08 -08:00
Thomas Marchand
3d0b4d19b7 Th0rgal/update branding (#32)
* feat: chroots

* wip

* Update workspace templates and Playwright tests

* Fix thinking panel close button not working during active thinking

The auto-show useEffect was including showThinkingPanel in its dependency
array, causing the panel to immediately reopen when closed since the state
change would trigger the effect while hasActiveThinking was still true.

Changed to use a ref to track previous state and only auto-show on
transition from inactive to active thinking.

* wip

* wip

* wip

* Cleanup web search tool and remove hardcoded OAuth credentials

* Ralph iteration 1: work in progress

* Ralph iteration 2: work in progress

* Ralph iteration 3: work in progress

* Ralph iteration 4: work in progress

* Ralph iteration 5: work in progress

* Ralph iteration 6: work in progress

* Ralph iteration 1: work in progress

* Ralph iteration 2: work in progress

* Ralph iteration 3: work in progress

* Ralph iteration 4: work in progress

* Ralph iteration 5: work in progress

* Ralph iteration 6: work in progress

* Ralph iteration 7: work in progress

* Ralph iteration 1: work in progress

* Ralph iteration 2: work in progress

* improve readme

* fix: remove unused file

* feat: hero screenshot

* Update README with cleaner vision and hero screenshot

Simplified the vision section with "what if" framing, removed
architecture diagram, added hero screenshot showing mission view.
2026-01-12 14:45:05 -08:00