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

@lalalic/channel

v1.0.6

Published

Transparent channel bridge for pi — Discord and WeChat. No LLM tools. Inbound plain passthrough, auto-forward responses to last active channel.

Downloads

734

Readme

@lalalic/channel

Transparent channel bridge for pi — Discord and WeChat. Zero LLM impact. Messages forwarded as plain user messages, responses auto-dispatched back to the last active channel.

pi install npm:@lalalic/channel
# WeChat requires wechat-bro:
npm install -g wechat-bro
# Start wechat-bro daemon:
npx wechat-bro --headed  # Show QR code first time
# Subsequent runs:
npx wechat-bro          # Headless with saved cookies

How It Works

Discord/WeChat ──→ plain user message ──→ pi session
                                            ├──→ TUI (normal)
                                            └──→ auto-forward to channel
  1. Inbound: message from channel → sent as a channel-inbound custom message — the LLM context keeps a small <channel-ctx> block (channel type, sender, DM/group, reply destination, format hints, per-channel instructions), while the TUI shows a compact type/name title plus the message body
  2. Response: LLM replies in TUI → auto-forwarded to last active channel (reply is channel-aware thanks to the context)
  3. No tools: the LLM needs no channel tools — context arrives with the message

Configuration

// .pi/settings.json
{
  "channels": [
    {
      "id": "disc-main",
      "name": "Discord Main",
      "type": "discord",
      "enabled": true,
      "channel": "123456789012345678",
      "botToken": "your-bot-token",
      "default": true
    },
    {
      "id": "wechat-me",
      "name": "My WeChat",
      "type": "wechat",
      "enabled": true,
      "channel": "filehelper"
    }
  ]
}

Channel Fields

| Field | Required | Description | |-------|----------|-------------| | id | yes | Unique id | | name | yes | Display name | | type | yes | "discord" or "wechat" | | enabled | yes | Connect on startup | | channel | yes | Platform channel ID (Discord: channel ID, WeChat: contact name) | | botToken | discord | Bot token for REST API + polling | | webhookUrl | discord | Webhook URL for outbound-only (discord only) | | forwardToolCalls | optional | true — tool calls/results included in forwarded responses | | default | optional | Initial active channel | | ownerUserId | discord | Owner user ID for multi-user asking (discord only) | | instructions | optional | Instructions for LLM |

Architecture

Current Implementation

The WeChat channel uses wechat-bro CLI commands and existing pi extensions:

pi extension
    └─ wechat.ts
        ├─ npx wechat-bro send-text (CLI commands for sending)
        └─ wechat-event-listener extension (for receiving messages)
                └─ WeChat Web (wx.qq.com)

Benefits:

  • Browser lifecycle managed by wechat-bro
  • Cookie persistence via wechat-bro (~/.wechat-bro/cookies.json)
  • Multi-agent support via wechat-bro WebSocket
  • Simplified maintenance (no direct Puppeteer access needed)

How Each Channel Works

Discord

  • Bot token + REST API (api/v10)
  • Polls every 5s for new messages
  • Auto-reacts with 👀 to acknowledge inbound
  • Responses auto-formatted via mdToDiscord (headings→bold, tables→code blocks, links→text)

WeChat (wechat-bro CLI Architecture)

  • Prerequisite: Install and start wechat-bro: npx wechat-bro --headed (first time)
  • Sending messages: Uses wechat-bro CLI commands (send-text, send-image, send-file)
  • Receiving messages: Direct WebSocket connection to wechat-bro for event streaming
  • Message filtering: Filters messages by configured contact name
  • Cookie persistence: Managed by wechat-bro (~/.wechat-bro/cookies.json)
  • Auto-reconnect: Automatically reconnects WebSocket on connection loss

Auto-reply

  • LLM responds in TUI → text captured on agent_end
  • Forwarded to lastActiveChannel (set by most recent inbound)
  • Responses ≥10 chars only

Tool Calls

When forwardToolCalls: true, the channel receives tool calls too:

[tool: read] {"path":"src/main.ts"}
→ [result: (file contents preview)]

---

Found the issue — missing import on line 42.
  • Media support: Delegates image/file upload to wechat-bro daemon
  • Multi-agent: Multiple agents can share the same wechat-bro instance
  • Multi-agent support via WebSocket
  • Event-driven message handling
  • Media upload via wechat-bro commands

Auto-reply

  • LLM responds in TUI → text captured on agent_end
  • Forwarded to lastActiveChannel (set by most recent inbound)
  • Responses ≥10 chars only

Tool Calls

When forwardToolCalls: true, the channel receives tool calls too:

[tool: read] {"path":"src/main.ts"}
→ [result: (file contents preview)]

---

Found the issue — missing import on line 42.

License

MIT