npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-messages

v0.1.1

Published

OpenCode plugin that bridges Messages.dev iMessage conversations into OpenCode sessions.

Readme

opencode-messages

Installable OpenCode plugin package for controlling a running OpenCode instance from your iPhone over iMessage using Messages.dev.

The package exports OpencodeMessagesPlugin and is designed so users can configure everything directly in opencode.json.

If you provide a public tunnel URL, the plugin will create or reuse the Messages.dev webhook automatically. That removes the manual webhook setup step entirely.

It:

  • receives message.received webhooks from Messages.dev
  • verifies the webhook signature
  • maps each allowed sender to an OpenCode session
  • sends prompts, slash commands, shell commands, and permission replies into OpenCode
  • sends the resulting assistant response back over iMessage

What It Supports

  • normal prompt messages
  • /new [title]
  • /use <session-id>
  • /status
  • /abort
  • /cmd </slash-command args>
  • /shell <command>
  • /approve <permission-id>
  • /deny <permission-id>

Quick Start

  1. Install the package:
npm install opencode-messages
  1. Put this in opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [["opencode-messages", {
    "apiKey": "sk_live_...",
    "line": "+15551234567",
    "publicUrl": "https://paste-your-tunnel-url-here.trycloudflare.com",
    "allowedSenders": ["+15559876543"]
  }]]
}
  1. Start OpenCode in the project.
  2. Expose the local bridge over HTTPS:
cloudflared tunnel --url http://127.0.0.1:8787
  1. Replace publicUrl in opencode.json with the tunnel URL that cloudflared printed.
  2. Restart OpenCode if it was already running.
  3. Send /help from your iPhone.

No manual Messages.dev webhook creation is needed in this mode.

Install

Published package usage in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [["opencode-messages", {
    "apiKey": "sk_live_...",
    "line": "+15551234567",
    "publicUrl": "https://your-tunnel-url.trycloudflare.com",
    "allowedSenders": ["+15559876543"]
  }]]
}

That is the lowest-friction setup path because users already need this file for the plugin entry.

Manual Setup

You can also use environment variables instead of opencode.json:

export OPENCODE_MESSAGES_API_KEY="sk_live_..."
export OPENCODE_MESSAGES_LINE="+15551234567"
export OPENCODE_MESSAGES_PUBLIC_URL="https://your-tunnel-url.trycloudflare.com"
export OPENCODE_MESSAGES_ALLOWED_SENDERS="+15559876543"

If you do not want the plugin to auto-manage the webhook, you can still configure a webhook yourself and provide a secret manually:

export OPENCODE_MESSAGES_WEBHOOK_SECRET="whsec_..."

Optional overrides:

export OPENCODE_MESSAGES_HOST="127.0.0.1"
export OPENCODE_MESSAGES_PORT="8787"
export OPENCODE_MESSAGES_WEBHOOK_PATH="/opencode-messages/webhook"
export OPENCODE_MESSAGES_STATE_FILE=".opencode/opencode-messages-state.json"
export OPENCODE_MESSAGES_MAX_CHUNK_CHARS="1800"

Package Layout

  • index.ts: source for the package plugin entrypoint
  • dist/index.js: built plugin entrypoint published to npm
  • .opencode/plugins/opencode-messages.ts: local development wrapper that re-exports the package plugin

Notes

  • The plugin reads its config from the plugin tuple options in opencode.json, and environment variables override file values when both are present.
  • The plugin accepts both the new OPENCODE_MESSAGES_* variables and the older OPENCODE_MESSAGES_DEV_* names for compatibility.
  • publicUrl is the preferred setup path. When present, the plugin creates or reuses the Messages.dev webhook automatically.
  • The plugin only accepts senders listed in allowedSenders or OPENCODE_MESSAGES_ALLOWED_SENDERS.
  • If you do not want secrets in opencode.json, use environment variables instead.
  • State is persisted in .opencode/opencode-messages-state.json so sender-to-session mappings survive restarts.
  • Permission prompts from OpenCode are sent back to iMessage, and you can reply with /approve <id> or /deny <id>.
  • Incoming webhooks must reach the machine running OpenCode. Messages.dev requires an HTTPS endpoint for webhook delivery.

Health Check

The plugin exposes a local health endpoint:

GET /health

Example:

curl http://127.0.0.1:8787/health