Skip to content

Conversation

@shuv1337
Copy link
Collaborator

@shuv1337 shuv1337 commented Dec 31, 2025

Summary

This PR merges the shuvcode-dev branch into integration, containing upstream sync to v1.0.220, multiple UI/UX improvements, and locally-merged upstream PRs for enhanced functionality.

Changes

Upstream Sync (v1.0.220)

  • Merged upstream releases v1.0.219 and v1.0.220
  • Updated nix flake.lock and hashes
  • Updated all package versions to align with upstream

Locally Merged Upstream PRs

App UI Improvements

  • Fixed path display in status bar with click-to-copy functionality
  • Added slider-style RadioGroup for diff split/unified toggle
  • Fixed review pane resize to allow up to half screen width
  • Removed session width clamping that broke review pane resize
  • Restored Header component and fixed theme/font picker placement
  • Fixed Add Project dialog tab label overflow on small screens

New Features from Upstream

  • MCP prompts as slash commands
  • Model variants support
  • Debug agent subcommand (opencode debug agent <name>)
  • Model usage statistics with input/output token breakdown
  • Rustfmt formatter for Rust files
  • Added gemini-3-flash to fast models list
  • Bundled @ai-sdk/vercel v1.0.31 for AI SDK v5 support
  • Configurable CORS hosts
  • Configurable timeout for MCP tool calls

TUI Enhancements

  • Linux/Ghostty drag-and-drop and clipboard image paste support
  • Persist sidebar section expansion states across sessions

Fixes

  • Plugin and mode globs fix
  • OpenAI variants for codex models
  • Variants work for completely custom models
  • Display MCP tag for prompts in autocomplete only (not in prompt)
  • Desktop notification icon improvement
  • Desktop: don't expand tools by default
  • App: don't open native folder select with remote server
  • App: hide reasoning once agent is done

Tests

  • Added Ripgrep.tree() tests
  • Added permission editor tests
  • Added provider tests
  • Added transform tests

Breaking Changes

None

Testing

Existing tests cover changes. New tests added for Ripgrep optimization, permission editor, and provider functionality.

Greptile Summary

This PR successfully merges upstream v1.0.220 with three locally-merged upstream PRs and significant UI improvements.

Key Changes

  • Ripgrep Optimization (PR fix: optimize Ripgrep.tree() for large repositories (109x faster) anomalyco/opencode#6507): Complete rewrite of Ripgrep.tree() using BFS traversal with round-robin selection and O(1) Map lookups, achieving 109x performance improvement for large repositories (40k+ files)

  • Editable Suggested Changes (PR feat: allow users to edit suggested changes before applying anomalyco/opencode#6476): Users can now modify AI-suggested code edits before applying them. The system tracks user modifications and notifies the agent to prevent rollback attempts. Includes new PermissionEditor module and comprehensive test coverage

  • Parallel Subtasks & Model Inheritance (PR add command.execute.before hook + allow parallel subtasks + fix model inheritance anomalyco/opencode#6478): Task tool now executes multiple subtasks concurrently and implements proper model inheritance chain (extra → agent → message → default)

  • UI/UX Improvements:

    • Status bar path display with click-to-copy functionality
    • Review pane slider toggle for unified/split diff views with persistence
    • Fixed review pane resize constraints (up to 50% screen width)
    • Empty state for review pane when no files present
    • Fixed tab label overflow in Add Project dialog
  • Provider Enhancements: Model variants now support config-based enabling/disabling with proper merging. Added @ai-sdk/vercel provider and gemini-3-flash to fast models list

  • MCP Integration: MCP prompts now available as slash commands with async template support and argument substitution

  • CORS Configuration: New dedicated CORS module allowing *.shuv.ai (fork's hosted domain) alongside *.opencode.ai, with proper HTTPS enforcement

  • Test Coverage: Added comprehensive test suites for ripgrep optimization, permission editor, provider transforms, and CORS validation

Confidence Score: 5/5

  • This PR is safe to merge with high confidence - well-tested changes with comprehensive test coverage
  • All three locally-merged PRs include proper test coverage and demonstrate significant improvements. The ripgrep optimization has 8 comprehensive tests covering edge cases. The edit permission feature includes 12 tests validating all scenarios. UI changes follow established patterns and don't introduce breaking changes. The upstream sync is straightforward version alignment. No security issues, logical errors, or breaking changes detected
  • No files require special attention

Important Files Changed

Filename Overview
packages/opencode/src/file/ripgrep.ts Complete rewrite of tree() function with BFS traversal, round-robin selection, and O(1) lookups for 109x performance improvement
packages/opencode/src/tool/edit.ts Added user editing capability for suggested changes with modified content tracking and notification system
packages/opencode/src/permission/editor.ts New module for permission editing capabilities with metadata validation, diff computation, and content comparison utilities
packages/opencode/src/tool/task.ts Enhanced model inheritance with priority chain (extra > agent > message > default) and parallel subtask execution
packages/app/src/pages/session.tsx Integrated diffStyle persistence, improved review pane max width calculation, and added empty state for review content
packages/opencode/src/provider/provider.ts Enhanced model variants support with disabled filtering, config merging, and added @ai-sdk/vercel provider and gemini-3-flash
packages/opencode/src/session/prompt.ts Refactored to support parallel subtask execution with filtering logic for concurrent agent spawning
packages/opencode/src/command/index.ts Added MCP prompts as slash commands with async template support, hints extraction, and command.execute.before hook
packages/opencode/src/server/cors.ts New CORS configuration module allowing localhost, Tauri, *.opencode.ai, and *.shuv.ai origins with proper HTTPS enforcement

Sequence Diagram

sequenceDiagram
    participant User
    participant Agent
    participant EditTool
    participant Permission
    participant PermissionEditor
    participant IDE
    participant File

    Note over User,File: PR #6476: Edit Suggested Changes Before Applying
    
    User->>Agent: Request code change
    Agent->>EditTool: execute(old_string, new_string)
    EditTool->>File: Read current content
    File-->>EditTool: contentOld
    EditTool->>EditTool: Calculate contentNew
    
    alt permission == "ask"
        EditTool->>Permission: ask(type="edit", metadata)
        Note right of EditTool: metadata: {filePath, originalContent, suggestedContent}
        Permission->>PermissionEditor: canEdit(permission)
        PermissionEditor-->>Permission: true
        Permission->>IDE: openDiff(filePath, contentNew)
        IDE-->>Permission: response
        Permission->>User: Show diff with editor
        User->>User: Edit suggested content
        User->>Permission: Approve with modifications
        Permission-->>EditTool: result.modified.content
        EditTool->>EditTool: contentNew = user's content
        EditTool->>EditTool: userModified = true
    end
    
    EditTool->>File: write(contentNew)
    EditTool->>EditTool: Compute final diff
    
    alt userModified
        EditTool->>Agent: Return with note about user modifications
    else
        EditTool->>Agent: Return with original suggestion applied
    end

    Note over User,File: PR #6507: Ripgrep.tree() Optimization (109x faster)
    
    User->>Agent: Request file tree
    Agent->>Ripgrep: tree(cwd, limit)
    Ripgrep->>Ripgrep: List all files
    Ripgrep->>Ripgrep: Build tree with O(1) Map lookups
    Ripgrep->>Ripgrep: BFS traversal with round-robin selection
    Ripgrep->>Ripgrep: Select up to limit nodes
    Ripgrep->>Ripgrep: Render selected nodes
    Ripgrep-->>Agent: Formatted tree string
    Agent-->>User: Display file structure

    Note over User,File: PR #6478: Parallel Subtasks & Model Inheritance
    
    User->>Agent: Execute task with subtasks
    Agent->>SessionPrompt: process()
    SessionPrompt->>SessionPrompt: Filter subtasks from tasks
    
    par Execute subtasks in parallel
        SessionPrompt->>TaskTool: execute(subtask1)
        TaskTool->>TaskTool: Resolve model (extra > agent > msg > default)
        TaskTool->>SubAgent1: Run with inherited model
        and
        SessionPrompt->>TaskTool: execute(subtask2)
        TaskTool->>TaskTool: Resolve model (extra > agent > msg > default)
        TaskTool->>SubAgent2: Run with inherited model
    end
    
    SubAgent1-->>SessionPrompt: result1
    SubAgent2-->>SessionPrompt: result2
    SessionPrompt-->>User: Combined results
Loading

adamdotdevin and others added 30 commits December 30, 2025 14:31
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Aiden Cline <[email protected]>
The variant field was accidentally removed during a cherry-pick that fixed
plugin commands. This restores variant support in PromptInput, CommandInput,
and the corresponding message/command handlers.
Move CORS origin validation to cors.ts for better testability and add
support for *.shuv.ai domain alongside *.opencode.ai.
…nvironments

- Persist active server selection across sessions (server.v4 storage)
- Add WelcomeScreen for hosted environments when server connection fails
- Add connection state machine (connecting/ready/needs_config/error)
- Add hosted environment detection utilities
Replace O(n²) tree building with O(n) using FileNode class:
- Map lookup for O(1) child access during construction
- Lazy sorting: only sort nodes visited during BFS
- Parent references for bottom-up selection propagation
- Comprehensive TSDoc comments explaining BFS and round-robin

Performance on 42k file repo: 8,625ms → 79ms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
shuv1337 and others added 29 commits December 31, 2025 06:38
…support

- Add ctrl+shift+v keybind for Linux clipboard paste
- Create parseUriList() helper to handle file:// URIs and text/uri-list format
- Update onPaste handler to detect and process file:// URIs as images
- Support Wayland and X11 display servers

Closes #230
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Merged from sst/opencode v1.0.220.

Notable upstream changes:
- Desktop: Status bar removed, new elements in header
- Desktop: Unified diff toggle in review pane
- Core: Configurable CORS hosts
- Core: MCP tool call timeout
- Core: Model variants support
- CLI: New debug agent <name> subcommand
- MCP: Prompts as slash commands
- Format: rustfmt formatter for Rust files

Resolved conflicts:
- README.md: Keep fork install instructions
- bun.lock: Accept upstream
- header.tsx: Keep ours (fork has custom inline header)
- status-bar.tsx: Keep ours (fork uses StatusBar component)
- layout.tsx (context): Merge both fork review pane + upstream diffStyle
- home.tsx: Keep DialogCreateProject (fork feature)
- layout.tsx (pages): Keep fork header, remove chooseProject
- session.tsx: Keep ours (fork has mobile PWA features)
- command/index.ts: Merge fork plugin features + upstream mcp/hints
- config.ts: Keep fork validation + add upstream unique()
- server.ts: Keep fork CORS via isOriginAllowed
- types.gen.ts: Merge both fork aliases + upstream hints
- Re-add Header import and usage in layout.tsx (lost during merge)
- Move ThemePicker/FontPicker to only show in mobile sidebar
- Desktop now shows header with all buttons (terminal, review, share, theme, font)
- Mobile PWA keeps theme/font pickers in sidebar menu
Change MAX_WIDTH_RATIO from 0.33 to 0.5 to allow the review pane
to expand to 50% of the screen. Default width remains at 450px.
The previous clamping logic was preventing the session pane from being
resized smaller, which blocked the review pane from being made larger.
The ResizeHandle component already enforces min/max constraints, so
the additional clamping was unnecessary and counterproductive.

Removed:
- getMinSessionWidth() helper function
- clampSessionWidth() function
- Window resize listener for clamping
- Clamping in session.resize() function
…reens

- Use smaller text (text-12-medium) on mobile, normal (text-14-medium) on sm+
- Add truncate and min-w-0 to allow text to shrink
- Reduce horizontal padding on mobile (px-2 vs px-3)
- Wrap text in span with truncate for proper ellipsis
- Add shrink-0 to icons so they don't compress
Replace the Button toggle with the built-in RadioGroup in SessionReview:
- Remove local diffSplit state from session store
- Use layout.review.diffStyle() and setDiffStyle() for persistence
- The toggle now uses the slider-style RadioGroup component like upstream
On small screens (< sm breakpoint):
- 'Add Existing' -> 'Existing'
- 'Create New' -> 'New'
- 'Git Clone' -> 'Clone'

Icons remain visible at all sizes.
- Use <bdi> element to isolate text from RTL direction, fixing the ~
  appearing at the wrong position
- Add click-to-copy functionality with tooltip feedback
- Show checkmark icon briefly after copying
- Full path is copied (not the shortened ~ version)
@shuv1337 shuv1337 merged commit fc158ca into integration Dec 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.