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

@linkshell/gateway

v0.2.22

Published

LinkShell Gateway — WebSocket 消息中转服务,连接 CLI 和手机 App。

Readme

@linkshell/gateway

LinkShell Gateway — WebSocket 消息中转服务,连接 CLI 和手机 App。

Gateway 不运行任何终端进程,只负责配对、会话管理和消息路由。

部署

Docker(推荐)

docker compose up -d

直接运行

pnpm install
pnpm --filter @linkshell/gateway build
PORT=8787 node packages/gateway/dist/gateway/src/index.js

环境变量

| 变量 | 默认值 | 说明 | |------|--------|------| | PORT | 8787 | 监听端口 | | LOG_LEVEL | info | 日志级别:debug / info / warn / error |

API

| 方法 | 路径 | 说明 | |------|------|------| | GET | /healthz | 健康检查 | | POST | /pairings | 创建配对(返回 6 位 code,10 分钟有效) | | POST | /pairings/claim | 用 code 换取 sessionId | | GET | /pairings/:code/status | 查询配对状态 | | GET | /sessions | 列出活跃会话 | | GET | /sessions/:id | 会话详情 | | WS | /ws?sessionId=&role= | 实时连接(role=host 或 client) |

特性

  • 内存态会话管理(无外部依赖)
  • ACK 追踪 + 输出缓存(最近 200 条,client 重连时快速重放)
  • 单设备控制权管理(claim/grant/reject/release)
  • 心跳 ping/pong 检测死连接(20s 间隔)
  • 会话 TTL(host 断开保留 60s,空闲 30min 清理)
  • IP 限流(配对 30 req/min,WebSocket 20 conn/min)
  • CORS 支持
  • 协议版本协商
  • 优雅关闭(SIGINT/SIGTERM)

代码入口

如果要继续改 Gateway,优先从这几个文件进入:

  1. src/index.ts
  2. src/pairings.ts
  3. src/sessions.ts
  4. src/relay.ts

License

MIT