Skip to content

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Implements Android port for OpenCode using Expo React Native, enabling remote session management from mobile devices.

Implementation

New Package: packages/mobile-expo/

  • Expo React Native app with TypeScript (~790 LOC)
  • React Navigation stack: Home, Session, Settings screens
  • HTTP API client for OpenCode server communication
  • Dark theme UI matching desktop aesthetic

Architecture

// Type-safe API client
interface Session { id: string; title?: string; created?: string }
interface Message { id: string; role: 'user' | 'assistant' | 'system'; content: string }

class OpencodeApiClient {
  async checkHealth(): Promise<boolean>
  async listSessions(): Promise<Session[]>
  async getSession(sessionId: string): Promise<SessionDetails | null>
}

// React context for server state
<ServerProvider>
  <NavigationContainer>
    <Stack.Navigator>
      <Stack.Screen name="Home" />      {/* Server connection, session list */}
      <Stack.Screen name="Session" />   {/* Message viewer */}
      <Stack.Screen name="Settings" />  {/* Config, app info */}
    </Stack.Navigator>
  </NavigationContainer>
</ServerProvider>

Component Structure

  • ServerContext: Connection state, API methods
  • api-client.ts: Typed HTTP client with Session[], Message[] interfaces
  • Reusable components: EmptyState, LoadingSpinner

Installation

cd packages/mobile-expo
npm install --no-workspaces  # Required due to monorepo workspace catalog
npm start                     # Expo dev server
npm run android               # Launch on device/emulator

Configuration

app.json

  • Package: ai.opencode.mobile
  • Permissions: INTERNET only
  • Dark theme, edge-to-edge display

package.json

  • Isolated from workspace catalog (npm compatibility)
  • React Navigation 7.x for native stack
  • TypeScript 5.8.2 with strict mode

Documentation

  • ARCHITECTURE.md: Client-server model, API endpoints, security considerations
  • CONTRIBUTING.md: Dev setup, project structure, debugging
  • QUICKSTART.md: User guide, troubleshooting (localhost/IP/remote URLs)
  • Root README.md: Mobile app section added

Notes

  • Platform detection uses Platform.OS (Android/iOS/Web)
  • Server URL not persisted (security: no local storage)
  • WebSocket support, terminal emulation, file browser deferred to future iterations
  • iOS untested but should work (same codebase)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdp.expo.dev
    • Triggering command: /usr/local/bin/node node /home/REDACTED/.npm/_npx/956a30255ff895e3/node_modules/.bin/create-expo-app . --template blank-typescript --no-install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

stwórz port dla androida expo react native


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits January 8, 2026 07:15
- Created new packages/mobile-expo package
- Set up Expo project with TypeScript
- Implemented navigation with React Navigation
- Created three main screens: Home, Session, Settings
- Added ServerContext for API communication
- Configured Android-specific settings in app.json
- Added README with installation and usage instructions

Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
- Added OpencodeApiClient for cleaner API communication
- Created EmptyState and LoadingSpinner components
- Added ARCHITECTURE.md documentation
- Updated README.md with mobile app section
- Refactored ServerContext to use API client

Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
- Created QUICKSTART.md for end users and quick setup
- Created CONTRIBUTING.md for developers
- Updated .gitignore with proper Expo exclusions
- Added troubleshooting and FAQ sections

Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
- Replace 'any[]' with proper Session[] and Message[] types
- Add SessionsResponse interface for API type safety
- Import and use types from api-client module
- Ensure Message objects are properly typed with role union type

Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
- Add explicit null return in getSession error case
- Add type annotation for SessionDetails in getSession
- Use Platform.OS for dynamic platform detection in Settings
- Support iOS/Android/Web platform display

Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
Copilot AI changed the title [WIP] Create Android port for Expo React Native Add Android mobile client using Expo React Native Jan 8, 2026
Copilot AI requested a review from grand151 January 8, 2026 07:26
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.

2 participants