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

cgptmail

v0.1.0

Published

Protocol-level SDK for mail.chatgpt.org.uk — no API key, no browser.

Downloads

176

Readme

cgptmail

npm

mail.chatgpt.org.uk 的非官方 TypeScript / Node.js SDK —— 无需 API key,无需浏览器,纯 HTTP 协议级实现。

该站点本身只在浏览器里运行;本 SDK 复刻了它的鉴权协议(gm_sid Cookie + X-Inbox-Token),把同样的能力暴露成 Node API + CLI。

安装

npm install cgptmail
# 或
bun add cgptmail

要求 Node ≥ 18(依赖内置 fetch)。

30 秒上手

import { MailClient } from "cgptmail";

const cli = new MailClient();
const mb = await cli.createMailbox();
console.log(mb.address); // 例如 [email protected]

const msg = await mb.waitForEmail({
  timeoutSec: 180,
  match: (m) => /verify|code|otp/i.test(m.subject),
});
console.log(msg.subject, msg.text);

CLI

npx cgptmail stats
npx cgptmail new
npx cgptmail inbox <address>
npx cgptmail get <id> --address <address>
npx cgptmail wait <address> --timeout 180 --match "code|verify"
npx cgptmail clear <address>

协议要点

| 步骤 | 调用 | 作用 | |---|---|---| | 1 | GET / | Set-Cookie: gm_sid + HTML 中嵌入 __BROWSER_AUTH.token | | 2 | POST /api/inbox-token | 用 gm_sid 续 token,并滑动 gm_sid 30 分钟有效期 | | 3 | /api/* | 同时携带 Cookie: gm_sidX-Inbox-Token;某些响应里 piggyback 新 auth |

MailClient 自动处理:

  • bootstrap、提前 120 s 续约、piggyback 续约
  • 401/403 自愈:先续一次 token;token 也续不动就重 bootstrap 整条会话
  • 并发安全的 token 刷新
  • 429 抛 RateLimitErrorwaitForEmail 内置退避

API

import {
  MailClient,
  Mailbox,
  Email,
  EmailSummary,
  Stats,
  RateLimitError,
  AuthError,
  BootstrapError,
  ApiError,
} from "cgptmail";

const cli = new MailClient({ baseUrl?, userAgent?, onRequest? });

await cli.stats();                       // Stats
const mb = await cli.createMailbox();    // Mailbox
const mb2 = cli.mailbox("[email protected]");  // 用已有地址构造 (不调用服务端)

await mb.list();                                 // EmailSummary[]
await mb.get(id);                                // Email
await mb.delete(id);
await mb.clear();
await mb.waitForEmail({ timeoutSec, intervalSec, match, since, signal });

协议层细节

  • gm_sidHttpOnly; Max-Age=1800 的 Cookie;每次 token 续约都会重新下发 → 滑动续期。
  • __BROWSER_AUTH.token 是服务端 HMAC 签的 {sid, exp},sid 与 Cookie 同值。
  • token 寿命约 600 s;SDK 提前 120 s 主动续,与官方 JS 保持一致。
  • 若长时间断网或 sid 死亡,下一次业务调用会自动重 bootstrap。

许可

MIT