Skip to content

fix(computer-use): add /System/Applications to installed app scan dirs#185

Closed
Icarus603 wants to merge 23 commits intoclaude-code-best:mainfrom
Icarus603:fix/computer-use-system-apps-scan
Closed

fix(computer-use): add /System/Applications to installed app scan dirs#185
Icarus603 wants to merge 23 commits intoclaude-code-best:mainfrom
Icarus603:fix/computer-use-system-apps-scan

Conversation

@Icarus603
Copy link
Copy Markdown

@Icarus603 Icarus603 commented Apr 7, 2026

Summary

  • Adds /System/Applications to the listInstalled() search directories in darwin.ts
  • Ensures Apple system apps (Safari, Notes, Maps, Calendar, etc.) are included in the installed app list
  • macOS 10.15+ (Catalina) moved bundled Apple apps from /Applications to /System/Applications

Test plan

  • Run list_granted_applications or trigger listInstalled() and verify system apps like Safari appear
  • Confirm no regressions for apps in /Applications and ~/Applications

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Buddy companion now displays character stats and supports new commands: /buddy rehatch (re-roll companion), /buddy mute, and /buddy unmute
    • Additional feature flags enabled for clipboard image support and advanced capabilities
  • Improvements

    • Enhanced multi-monitor support with improved coordinate tracking
    • Better app window management and visibility on macOS
    • Royal Gold Dark theme now default for dark mode
    • Improved image capture with optimized processing and JPEG conversion
    • Refined color palette and diff visualization across themes

Icarus603 and others added 23 commits April 5, 2026 21:45
This PR introduces comprehensive TUI customizations with a cohesive
brand color palette, an enhanced /buddy companion system, and proper
keyboard shortcut hints in the ThemePicker.

### Theme Colors
- Replace Claude orange brand color with blue (rgb(88,190,255))
- Add BRAND_COLOR, BRAND_COLOR_LIGHT, BRAND_RED, BRAND_GREEN constants
- Update all 6 theme variants (light, dark, ansi, daltonized) with consistent palette
- Change permission/suggestion/remember to cyan-blue (rgb(131,210,238))
- Set dark theme userMessageBackground to darker rgb(15,15,15)
- Update diff colors to burgundy red and forest green

### Syntax Highlighting
- Add new Royal Gold Dark theme (gold/blue palette, lower saturation)
- Replace Monokai Extended as default dark syntax theme
- Support syntaxHighlightingDisabled setting in HighlightedCode
- Keep Ctrl+T toggle in ThemePicker with visible shortcut hint
- Fix hex colors to rgb format for themeColorToAnsi compatibility
- Use src/* aliases and semicolons in SpinnerGlyph imports

### UI Behavior
- Remove spinner stalled-to-red warning animation
- Remove top padding from FullscreenLayout (cleaner layout)
- Remove unused padCollapsed variable
- Set inline code color to amber gold (#FEC84A) in dark themes

### Buddy System
- Add /buddy pet, rehatch, mute, unmute commands
- Add 20-character stat bars (████████░░) for companion stats
- Display sprite, rarity, eye, hat, personality in text format
- Auto-hatch on first /buddy call (no explicit hatch needed)
- Enable BUDDY feature in production builds by default

### Files Changed
- build.ts
- packages/color-diff-napi/src/index.ts
- src/utils/theme.ts, src/utils/markdown.ts
- src/components/Spinner/*.tsx
- src/components/FullscreenLayout.tsx, HighlightedCode.tsx, ThemePicker.tsx
- src/commands/buddy/buddy.ts, index.ts
- src/keybindings/defaultBindings.ts, schema.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add NATIVE_CLIPBOARD_IMAGE to default features in both dev and build
configurations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upstream changes:
- Add Gemini API provider support
- Add /provider command for model provider switching
- Add interview and teach-me skills
- Fix OpenAI adapter tool calling compatibility
- Enable Computer Use on Windows and Linux
- Add contributors auto-update workflow

Local changes preserved:
- BUDDY and NATIVE_CLIPBOARD_IMAGE feature flags
- Blue brand color theme (rgb(88,190,255))
- Enhanced buddy system with pet/rehatch/mute/unmute
- Ctrl+T shortcut hint in ThemePicker
- Spinner animation simplifications

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add new features to DEFAULT_BUILD_FEATURES and DEFAULT_FEATURES:
- BRIDGE_MODE, MCP_SKILLS, TEMPLATES, COORDINATOR_MODE
- TRANSCRIPT_CLASSIFIER, MCP_RICH_OUTPUT, MESSAGE_ACTIONS
- HISTORY_PICKER, QUICK_SEARCH, CACHED_MICROCOMPACT
- REACTIVE_COMPACT, FILE_PERSISTENCE, DUMP_SYSTEM_PROMPT
- BREAK_CACHE_COMMAND

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- hostAdapter: replace cu.tcc subprocess calls with Bun FFI in-process
  AXIsProcessTrusted() + CGPreflightScreenCaptureAccess() so macOS checks
  the terminal's own TCC permissions, not osascript's

- darwin backend: fix listInstalled() to use NSBundle JXA ObjC bridge
  instead of AppleScript "every file" (which misses .app bundles since
  they are directories, not files)

- darwin backend: replace captureScreenToBase64 with captureAndResizeToBase64
  using sips to resize+JPEG-convert screenshots, fixing "image/jpeg" media
  type mismatch and oversized image 400 errors from the API

- escHotkey: use optional chaining on hotkey.registerEscape/unregister/
  notifyExpectedEscape to prevent crashes when the hotkey namespace is
  absent (e.g. when Accessibility permission is not yet granted)

- image-processor-napi: convert readClipboardImage from Bun.spawnSync
  to async Bun.spawn + await proc.exited, preventing the event loop from
  blocking and freezing the "Pasting text…" Ink UI indicator

- usePasteHandler: add per-path .catch(() => null) in Promise.all so
  ImageResizeError from one path doesn't reject the whole chain and leave
  isPasting stuck at true; add .catch safety net on the outer chain

- FileReadTool: instead of re-throwing ImageResizeError when sharp fails
  on oversized images, fall back to sips (macOS built-in) at 1920px JPEG
  quality 75; add a second sips fallback at 800px as last resort when
  compressImageBufferWithTokenLimit also fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Upstream changes:
- feat: enable GrowthBook local gate defaults (AGENT_TRIGGERS, ULTRATHINK,
  BUILTIN_EXPLORE_PLAN_AGENTS, LODESTONE, EXTRACT_MEMORIES,
  VERIFICATION_AGENT, KAIROS_BRIEF, AWAY_SUMMARY, ULTRAPLAN)
- feat: /ultraplan and UltraPlan dialogs (REPL.tsx refactor)
- feat: @ant/ink package — ink components extracted to workspace package
  (import path: @anthropic/ink)
- fix: revert fullscreen mode
- docs: README emoji, contributors

Conflict resolutions:
- build.ts / scripts/dev.ts: merged both sides' feature flag lists
- HighlightedCode.tsx / SpinnerGlyph.tsx: adopted @anthropic/ink import path
- contributors.svg: took upstream version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After upstream PR claude-code-best#158 moved ink components to packages/@ant/ink,
components that imported Box/Text/useTheme from @anthropic/ink started
reading @ant/ink's built-in theme (Claude orange) instead of our
customized theme (blue palette) in src/utils/theme.ts.

Add BRAND_COLOR/BRAND_COLOR_LIGHT/BRAND_RED/BRAND_GREEN constants to
packages/@ant/ink/src/theme/theme-types.ts and apply them across all
6 theme variants (light, dark, light/dark daltonized, light/dark ansi
unchanged since they use ansi: tokens).

Synced changes:
- claude / claudeShimmer: orange → BRAND_COLOR blue
- clawd_body / briefLabelClaude: orange → BRAND_COLOR blue
- permission / permissionShimmer (dark): purple → cyan-blue
- suggestion / remember (dark): purple → cyan-blue
- success / error: upstream green/red → BRAND_GREEN/BRAND_RED
- diffAdded/diffRemoved (light): green → blue palette
- diffAdded/diffRemoved (dark): green → burgundy-green palette
- userMessageBackground (dark): rgb(55,55,55) → rgb(15,15,15)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… box

Three-part fix for garbage text (">|iTerm2 3.6.9?64;...c") appearing
pre-filled in the REPL input on every startup:

1. Export `setAppCallbacks` from @anthropic/ink so the business layer
   can wire in callbacks (was defined but never reachable externally).

2. Call `setAppCallbacks({ stopCapturingEarlyInput, ... })` in main.tsx
   before `createRoot()`. App.tsx calls this when Ink first enables raw
   mode — without the wiring it was a no-op, leaving both the earlyInput
   and Ink readable handlers active on stdin simultaneously.

3. Fix `processChunk()` escape-sequence skipping in earlyInput.ts. The
   old code treated the byte after ESC as the terminator if it was in
   0x40–0x7E, so `\x1bP` consumed only the `P` (DCS introducer) and let
   `>|iTerm2 3.6.9` fall through as printable text; `\x1b[` similarly
   left `?64;1;2;4;6;17;18;21;22;52c` as text. New code handles DCS/OSC
   string sequences (skip until BEL or ESC+\) and CSI sequences (skip
   params+final-byte) separately from simple two-char escapes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ixes

- Add originX/originY to display geometry for multi-monitor coordinate mapping
- Implement prepareDisplay() to hide non-allowlisted apps and activate target
- Implement previewHideSet() to preview which apps will be hidden
- Fix displayWidth/displayHeight propagation - prevents clicks landing at (0,0)
- Use clipboard paste for all text on macOS to avoid IME composition issues

Previously clicks could land at the Apple menu because scaleCoord()
received NaN when display dimensions weren't propagated. Now coordinate
scaling works correctly across all displays.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upstream changes:
- feat: add Grok (xAI) API adapter with custom model mapping (claude-code-best#152)
- feat: restore daemon supervisor and remoteControlServer command (claude-code-best#170)
- fix: prevent iTerm2 terminal response sequences from leaking into REPL input (claude-code-best#172)
- Revert ink component abstraction (claude-code-best#158claude-code-best#175)
- Various fixes and cleanups

Conflict resolutions:
- contributors.svg: kept ours
- packages/@ant/ink/*: deleted (upstream reverted ink refactor)
- src/utils/earlyInput.ts: kept ours (superior APC sequence handling)
- src/main.tsx: accepted upstream (setAppCallbacks now built into App.tsx)
- Theme: preserved our brand color customizations (BRAND_COLOR rgb(88,190,255))

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ude-code-best#168) (claude-code-best#177)

Fixes claude-code-best#168
OpenAI requires that an assistant message with tool_calls be immediately
followed by tool messages. Previously, convertInternalUserMessage
output user content before tool results, causing 400 errors.
Now tool messages are pushed first.
Include Apple's system apps (Safari, Notes, Maps, etc.) in listInstalled()
by scanning /System/Applications in addition to /Applications and ~/Applications.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dfdc2cab-13ee-48cb-b70e-08927f33271f

📥 Commits

Reviewing files that changed from the base of the PR and between cf26c73 and 775afe4.

⛔ Files ignored due to path filters (1)
  • contributors.svg is excluded by !**/*.svg
📒 Files selected for processing (26)
  • build.ts
  • packages/@ant/computer-use-swift/src/backends/darwin.ts
  • packages/color-diff-napi/src/index.ts
  • packages/image-processor-napi/src/index.ts
  • scripts/dev.ts
  • src/commands/buddy/buddy.ts
  • src/commands/buddy/index.ts
  • src/components/FullscreenLayout.tsx
  • src/components/HighlightedCode.tsx
  • src/components/LogoV2/ExperimentEnrollmentNotice.tsx
  • src/components/LogoV2/GateOverridesWarning.tsx
  • src/components/LogoV2/LogoV2.tsx
  • src/components/Spinner/GlimmerMessage.tsx
  • src/components/Spinner/SpinnerAnimationRow.tsx
  • src/components/Spinner/SpinnerGlyph.tsx
  • src/components/ThemePicker.tsx
  • src/hooks/usePasteHandler.ts
  • src/services/api/openai/convertMessages.ts
  • src/tools/FileReadTool/FileReadTool.ts
  • src/utils/computerUse/escHotkey.ts
  • src/utils/computerUse/executor.ts
  • src/utils/computerUse/hostAdapter.ts
  • src/utils/earlyInput.ts
  • src/utils/imagePaste.ts
  • src/utils/markdown.ts
  • src/utils/theme.ts

📝 Walkthrough

Walkthrough

This PR adds numerous feature flags to build configuration, significantly refactors macOS computer-use backends with improved display geometry and app enumeration, introduces brand color constants across theming, converts clipboard image reading to async, redesigns the buddy companion command (removing JSX, adding mute/unmute/rehatch), and removes stalled-intensity visual feedback from spinner components.

Changes

Cohort / File(s) Summary
Build & Feature Configuration
build.ts, scripts/dev.ts
Added 16 new feature flags (BUDDY, NATIVE_CLIPBOARD_IMAGE, BRIDGE_MODE, MCP_SKILLS, etc.) and updated inline comments to mark P0/P1 entries as "(upstream)".
macOS Computer Use Backend
packages/@ant/computer-use-swift/src/backends/darwin.ts
Display geometry now includes per-display origin coordinates; app preparation/visibility logic substantially refactored to enumerate foreground apps via JXA, hide/activate allowlisted apps; app enumeration switched to JXA/NSBundle approach; screenshot capture refactored to resize/convert to JPEG via sips command and parse dimensions from JPEG headers.
Computer Use Executor & Permissions
src/utils/computerUse/executor.ts, src/utils/computerUse/hostAdapter.ts, src/utils/computerUse/escHotkey.ts
Executor now augments screenshot/display results with missing coordinate/origin fields and broadens clipboard-mode typing on macOS for non-ASCII text; hostAdapter replaced native Swift permission checks with Bun FFI calls to system frameworks; escHotkey calls made null-safe via optional chaining.
Image & Clipboard Processing
packages/image-processor-napi/src/index.ts, src/utils/imagePaste.ts, src/tools/FileReadTool/FileReadTool.ts, src/hooks/usePasteHandler.ts
readClipboardImage converted from synchronous to async; macOS image resize fallback added using sips pipeline; paste handler error handling improved with per-path .catch and safety-net .catch block.
Buddy Companion Command
src/commands/buddy/buddy.ts, src/commands/buddy/index.ts
Removed React/JSX rendering, replaced with text output; added /buddy mute//buddy unmute (replacing on/off) and new /buddy rehatch subcommand; introduced renderStats() helper for formatted stat display; updated command metadata.
Color, Theme & Markdown
packages/color-diff-napi/src/index.ts, src/utils/theme.ts, src/utils/markdown.ts
Introduced brand color constants (BRAND_COLOR, BRAND_RED, BRAND_GREEN) replacing hardcoded RGB values; dark theme default syntax highlighting changed to "Royal Gold Dark"; inline code coloring now theme-dependent.
Spinner & Stalled Visual Feedback
src/components/Spinner/GlimmerMessage.tsx, src/components/Spinner/SpinnerAnimationRow.tsx, src/components/Spinner/SpinnerGlyph.tsx
Removed all stalledIntensity-based color interpolation and stalled visual feedback logic across spinner components.
UI Components & Layout
src/components/FullscreenLayout.tsx, src/components/HighlightedCode.tsx, src/components/ThemePicker.tsx, src/components/LogoV2/*
FullscreenLayout simplified sticky-header model; HighlightedCode added duplicate import and changed fallback coloring behavior; ThemePicker now reads settings via hook; added stub ExperimentEnrollmentNotice and GateOverridesWarning components.
Escape Sequence & Message Handling
src/utils/earlyInput.ts, src/services/api/openai/convertMessages.ts
Escape sequence skipping refactored to handle CSI/DCS/OSC/APC/PM/SOS sequences per ECMA-48 standard; tool result messages now ordered before corresponding user messages in OpenAI conversion.

Sequence Diagram(s)

sequenceDiagram
    participant caller as Command Handler
    participant darwin as darwin.ts<br/>(prepareDisplay)
    participant jxa as JXA Script
    participant sysev as System Events
    participant fs as Filesystem
    
    caller->>darwin: prepareDisplay(allowlistBundleIds)
    darwin->>jxa: enumerate visible foreground apps
    jxa-->>darwin: app list with bundle IDs
    
    loop For each visible app
        alt app in allowlist or is Finder
            darwin->>darwin: skip (keep visible)
        else
            darwin->>sysev: hide application
            sysev-->>darwin: hidden
        end
    end
    
    darwin->>jxa: activate first allowlisted running app
    jxa-->>darwin: activated
    darwin->>darwin: Bun.sleep(150)
    darwin-->>caller: { activated, hidden }
Loading
sequenceDiagram
    participant user as User
    participant buddy as buddy command
    participant config as Global Config
    participant display as Display
    
    user->>buddy: /buddy rehatch
    buddy->>buddy: generate new seed
    buddy->>buddy: re-roll companion
    buddy->>config: persist as StoredCompanion
    config-->>buddy: confirmed
    buddy->>buddy: renderStats(stats)
    buddy->>display: output sprite + name + traits + rendered stats
    display-->>user: "Companion replaced!"
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • KonghaYao

🐰 A buddy's reborn with a fresh roll of dice,
Colors now branded—theme shades looking nice!
Screens stretching wide with their origins bright,
Escape sequences tamed in their ECMA flight,
Async clipboards blur the sync/async line—
hop, hop, hop! ✨ The refactor's divine!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix/computer-use-system-apps-scan

Comment @coderabbitai help to get the list of available commands and usage tips.

@Icarus603 Icarus603 closed this Apr 7, 2026
@Icarus603 Icarus603 deleted the fix/computer-use-system-apps-scan branch April 7, 2026 15:04
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.

3 participants