close
Skip to content

Repository files navigation

OpenCode wordmark

Version License Acode

Run the OpenCode AI coding agent inside Acode Editor

FeaturesInstallationRequirementsBuildContributing

OpenCode AI is an Acode plugin that launches OpenCode — an AI coding agent — as a background HTTP server inside Acode's built-in Alpine Linux terminal, then embeds its web UI in a full-page iframe. Instead of running OpenCode on a separate machine, this plugin runs it locally on your device and talks to it over loopback, giving you a fully self-contained AI coding workflow inside Acode.

Screenshot

OpenCode running inside Acode
OpenCode prompt interface

Requirements

Node.js and npm must be available in Acode's built-in Alpine Linux terminal, and OpenCode is installed automatically on first launch. Acode must be a recent version with Terminal and Executor API support:

apk add --no-cache nodejs npm

Features

  • Local OpenCode server. Runs OpenCode as a background HTTP server inside Acode's Alpine terminal — no external machine required.
  • Automatic install. Detects whether OpenCode is present and installs it on demand (npm install -g opencode-ai).

Installation

  1. Open Settings
  2. Select Plugins
  3. Search for "OpenCode AI"
  4. Tap Install
  5. Restart

How It Works

The plugin follows a Check → Install → Serve → Render workflow:

Stage Responsibility
Check Verify OpenCode is installed and whether the server is already running
Install Install OpenCode via npm install -g opencode-ai if missing
Serve Start opencode serve --port 4096 --hostname 127.0.0.1 in the background
Render Embed the web UI in an iframe and reactively reflect the current state

Project Structure

src/
  main.ts               # plugin init/destroy, flow orchestration
  types.ts              # AppState enum, StateContext, ErrorInfo
  state.ts              # state machine (transition, onStateChange, reset)
  logger.ts             # leveled logging (createLogger, setLogEnabled, setLogLevel)
  error.ts              # extractErrorInfo() — normalizes unknown errors
  config/               # named constants, split by domain
  terminal/executor.ts  # thin wrapper over global Executor
  opencode/
    install.ts          # checkInstalled, installOpenCode
    server.ts           # isServerUp, startServer, stopServer, restartServer
    health.ts           # loopback health probe via cordova.plugin.http
  ui/
    index.ts            # render orchestrator, one render func per state
    components/         # DOM factory functions, one file per component

Contributing

Contributions are welcome! Please feel free to submit a Pull Request and leave a ⭐

Credits & Attribution

This project (the Acode OpenCode integration) is licensed under the MIT License. See the LICENSE file.

Support & Contact


Happy coding ✨

About

No description, website, or topics provided.

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages