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

@everettjf/graphchat

v0.2.2

Published

A local-first, graph-native AI learning workspace.

Readme

Graph Chat 是一个本地优先、图谱原生的 AI 学习工作区。面对回答里的陌生概念,你不需要把所有追问塞进一条越来越混乱的聊天记录:从任意节点创建分支,在分支中深入理解,再引用多个分支汇聚成新的问题。每次回答都会保留它实际使用的上下文与来源。

为什么是图,而不是聊天列表

普通聊天只记录“接下来问了什么”,Graph Chat 还记录“这个问题从哪里来、引用了哪些理解、最后回到了哪条主线”。

原始问题 ──→ AI 回答 ──→ 陌生概念 A ──→ 深入解释
                  │
                  └────→ 陌生概念 B ──→ 例子与反例
                                      ╲
                    A 的解释 ·········→ 汇聚问题 ──→ 新理解
  • 实线表示沿当前上下文继续追问。
  • 虚线表示跨分支引用,适合比较、综合和迁移知识。
  • 节点记录问题、回答、模型、上下文快照与来源。
  • 图谱是长期知识结构,Pi agent loop 是每次回答的运行时。

功能

| 能力 | 当前实现 | | --- | --- | | 图谱学习 | React Flow 无限画布、分支边、跨分支引用边、拖拽与搜索 | | 多知识图 | 创建、切换、重命名、归档和恢复彼此独立的学习空间 | | 精确追问 | 从节点继续提问,也可以选中回答中的一段文字创建分支 | | 分支汇聚 | 同时引用多个节点,让模型比较、综合或寻找共同机制 | | Agent runtime | Pi agent core、流式事件、工具调用、自动重试与取消 | | ChatGPT 订阅 | Pi openai-codex 设备码 OAuth,支持自动 token refresh | | 其他模型 | OpenAI API、OpenRouter、Ollama、OpenAI-compatible endpoint | | 本地数据 | Bun/Node SQLite、WAL、JSON 导出、无需外部数据库 | | 本地检索 | SQLite FTS5 对标题、问题、摘要、正文、标签和来源地址进行排序检索 | | 八种界面语言 | 应用与文档默认英文,可持久化切换简体中文、西班牙语、法语、德语、日语、韩语与繁体中文 | | 可靠运行 | 流式事件绑定运行节点,支持显式取消与中断恢复 | | 隐私边界 | API Key 仅在进程内;OAuth 凭据只保存在本机私有文件 | | 工程质量 | TypeScript strict、Vitest、数据库测试、Pi runtime 测试、Playwright E2E |

快速开始

独立运行包

最简单的方式不需要安装 Bun、Node.js 或数据库:

  1. 从 GitHub 最新 Release 下载对应平台的压缩包。
  2. 解压。
  3. 运行 graphchat(Windows 上是 graphchat.exe)。

Graph Chat 会打开 http://127.0.0.1:4317,数据默认保存在 .graphchat/。

从源码运行

推荐 Bun 1.3+;Node.js 22.19+ 也完整支持。

git clone https://github.com/everettjf/graphchat.git
cd graphchat
bun install
bun run graphchat

graphchat 启动器会构建应用、启动本地服务并自动打开浏览器。需要热更新开发时,运行 bun run dev,再打开 http://localhost:5173。

首次运行会生成一张英文的 RAG 示例学习图。应用默认英文,可以从侧边栏切换为简体中文、西班牙语、法语、德语、日语、韩语或繁体中文;模型运行会跟随所选语言,语言偏好保存在本机。本地演示无需密钥,也不会访问外部模型。

手动生产模式:

bun run build
bun run start:bun

生产服务默认监听 http://127.0.0.1:4317。

如果更习惯 Node/npm,可改用 npm install、npm run dev、npm run build 和 npm start。Bun 与 Pi 没有架构冲突:Pi 负责 agent harness、模型与 OAuth loop;Bun/Node 负责本地 HTTP、SQLite 和前端工具链。Graph Chat 会在 Bun 下使用 bun:sqlite,在 Node 下使用 node:sqlite。

使用 ChatGPT 订阅

Graph Chat 通过 Pi 内置的 openai-codex Provider 使用 ChatGPT 订阅,不需要复制 API Key。

  1. 打开左下角的「模型与设置」。
  2. 选择「ChatGPT」。
  3. 点击「使用 ChatGPT 登录」。
  4. 在 OpenAI 页面输入一次性设备码。
  5. 返回 Graph Chat,连接状态会自动更新;选择模型并保存。

登录流程由 Pi 发起。Graph Chat 不接触你的密码;OAuth access/refresh credential 保存到 .graphchat/auth.json,不会出现在网页 API、日志或数据导出中。登出会删除该凭据。ChatGPT/Codex 的可用额度和模型取决于你的账户、方案与 OpenAI 当前政策。

OpenAI 官方说明:Codex 可使用符合条件的 ChatGPT 方案登录,使用限制因方案而异。详见 Using Codex with your ChatGPT plan。

其他 Provider

复制 .env.example 为 .env,或直接在设置中配置:

| Provider | 认证方式 | 默认配置 | | --- | --- | --- | | OpenAI | OPENAI_API_KEY 或当前进程内输入 | Pi OpenAI Provider | | OpenRouter | OPENROUTER_API_KEY 或当前进程内输入 | Pi OpenRouter Provider | | Ollama | 无需密钥 | http://127.0.0.1:11434/v1 | | 自定义 | 可选进程内 API Key | 任意 OpenAI-compatible endpoint |

架构

flowchart LR
    UI["React 19 + shadcn-style UI<br/>React Flow"] --> API["Fastify API<br/>NDJSON streaming"]
    API --> CTX["Context compiler<br/>主线 · 引用 · 选中文字"]
    CTX --> AGENT["Pi Agent Core<br/>model · tools · retry loop"]
    AGENT --> MODELS["ChatGPT OAuth · OpenAI<br/>OpenRouter · Ollama"]
    API --> DB[("Bun / Node SQLite<br/>graphs · nodes · edges")]
    API --> AUTH[("Local auth.json<br/>OAuth only")]

Graph Chat 不把整张图无差别发送给模型。上下文编译器会按当前父节点、显式引用和选中文字构建一个有上限、可追溯的快照,再交给 Pi 运行。Pi 可以使用只读图谱工具继续搜索或读取节点,但不能自行修改知识图。

核心代码:

数据与安全

  • 默认数据目录:.graphchat/
  • 知识图数据库:.graphchat/graphchat.sqlite
  • ChatGPT OAuth:.graphchat/auth.json
  • API Key:仅存当前 Node.js 进程,不写入 SQLite 或 auth.json
  • 导出:只包含图谱、节点和边,不包含任何凭据
  • 默认监听:127.0.0.1,不会自动暴露到局域网

如需更改数据位置,设置 GRAPHCHAT_DATA_DIR。OAuth 文件在支持 POSIX 权限的平台上使用 0600;请像保护其他本地登录凭据一样保护数据目录。

开发与验证

bun run typecheck  # TypeScript client + server
bun run test       # 单元、数据库、凭据与 Pi runtime
bun run build      # 生产构建
bun run test:e2e   # Playwright 端到端
bun run test:all   # 完整验证

路线图

  • 在本地 SQLite FTS 之上增加可选的向量排序与混合检索
  • 安全网页抓取、OCR 与来源增量刷新
  • 端到端加密的可选同步服务
  • 协作分享与只读知识图发布

参与贡献

Issue、讨论和 Pull Request 都很欢迎。请先阅读 CONTRIBUTING.md;提交前运行 bun run test:all(或 npm run test:all),并确保新增行为包含相应测试。安全问题请按 SECURITY.md 私下报告。

License

MIT © Everett