@chen_hu_hu/pi-qq

中文文档
1.6.0发布于 2026/11/09MITES Module构建来源已验证近 30 天下载 3699

Connect pi to QQ private chats.

原始使用文档
文档目录20 节
  1. Requirements
  2. Install
  3. Login
  4. Usage
  5. Attachments
  6. Sending media back to QQ
  7. Voice messages
  8. Reply format
  9. Commands
  10. Diagnostics
  11. Settings
  12. replyType
  13. thinkingRelay
  14. deliverAs
  15. fileMaxSize
  16. language
  17. logLevel
  18. Development
  19. Notes
  20. License

pi-qq

English | 简体中文

Connect pi to a QQ private chat. Send text, voice, images, or files from QQ; pi works on your machine and sends the result back.

Requirements

  • Node.js 22.19 or newer, matching pi.
  • A QQ bot application with C2C private messaging enabled.
  • A working pi installation.

Install

pi install npm:@chen_hu_hu/pi-qq

For local development:

pi --extension /path/to/pi-qq

Login

  1. Start pi.
  2. Run /qq-login.
  3. Scan the QR code with mobile QQ.

Credentials are not written to pi-qq.json. Restarting pi requires scanning again. /qq-logout clears the credentials immediately.

Usage

Send a private message to the bot to start a task.

  • Text: normal chat message.
  • Voice: QQ's built-in ASR text is sent to pi. The audio is not downloaded or saved. If ASR returns no text, the bot asks you to resend or type it.
  • Images and files: saved under .pi/pi-qq/<sessionId>/uploads/. If the message has no instruction, pi waits for your next text or voice message.

QQ clients differ in mixed-message support. Mobile QQ usually sends one message type at a time; desktop QQ can send text with an image. When a client includes text or voice together with attachments, pi-qq processes them in the same prompt.

Attachments

An attachment-only message does not start pi. Files and images are saved, and pi waits for the next text or voice instruction.

  • Send one or more files or images, then send a text or voice message describing what to do.
  • The next instruction includes the saved attachment paths.
  • Multiple attachments uploaded before the instruction are combined into one prompt.
  • Images are read through pi's read tool, so the current model must support image input to see them.
  • /new clears attachments waiting for an instruction.
  • Uploads are scoped to the current pi session. Same filename and identical content reuse the existing file; same filename with different content becomes name-1.ext; different filenames with identical content are kept separately.

Example prompt seen by pi:

# Attachments:
- .pi/pi-qq/<sessionId>/uploads/report.pdf

# User message:
Summarize this file.

Sending media back to QQ

After QQ login, pi-qq activates the qq_send_media tool. It is registered inactive at startup and after /qq-logout; a reconnect does not disable it.

Ask pi explicitly, for example send me the screenshot or 把截图发给我. The model decides from the tool description; ambiguous requests should be clarified first. There is no keyword matching or extra confirmation step.

  • Images: .jpg, .jpeg, .png, .gif, .webp, .bmp; up to 30 MB.
  • Videos: .mp4, .mov, .avi, .mkv, .webm, .flv, .wmv; up to 100 MB.
  • Other files: up to 100 MB; audio is sent as a file.
  • Any readable regular file is allowed. Symlinks, directories, and devices are rejected.
  • Each media message consumes one passive reply; after the limit, pi-qq falls back to a proactive message.
  • The tool bubble is the same as any other tool: ## 📤 qq_send_media.

Voice messages

Voice messages use QQ's built-in ASR (asr_refer_text). The transcript is sent to pi as normal user text; pi never receives the audio file.

  • The voice attachment is not downloaded or saved as .amr / .silk.
  • No local or external speech-to-text service is used.
  • If QQ ASR returns no text, the bot replies Could not transcribe this voice message; please resend or type it. and does not start a pi run.
  • Voice and text are separate QQ messages; send them one after another when needed.
  • If a client sends files or images together with a voice message, they are processed with the transcript.

Debug logs include the raw asr_refer_text and attachment metadata when logLevel is set to debug.

Reply format

  • Thinking: its own bubble, plain text, starting with ## 💭 思考. Long thinking may continue in a new bubble with the header repeated.
  • Tools: one bubble per call: ## <icon> <name>; bash commands use a bash code block, other arguments use inline code, and results use text, markdown, python, json, etc. depending on the tool and file type.
  • Regular messages: raw text with no header.
  • Tool icons: 💻 bash, 📖 read, 📝 write, ✏️ edit, 🔎 grep, 🔍 search, 🗂️ find, 📁 ls, 📋 list, 🌐 web, 📡 fetch, 🗑️ delete, ❌ remove, ✅ todo, 🧪 test; unconfigured tools use 🔧.
  • Error recovery: after a model error, automatic retry runs within 60 seconds keep pushing to the original QQ chat. /stop waits for active tools and streams to finish before replying.

Commands

Run these in the pi terminal:

CommandDescription
/qq-loginLog in with a QR code and bind the scanning QQ user
/qq-statusShow login, connection, model, context, and bound user
/qq-logoutLog out and clear credentials
/qq-newReset the current session (used by QQ /new)

QQ-side commands:

CommandDescription
/newStart a new pi session
/stopAbort the current run
/compactCompact the current context
/statusShow session and context status
/lastPush the last completed reply as a stream, or restart the current output
/helpShow command help

Diagnostics

These terminal commands are intended for troubleshooting:

CommandDescription
/qq-test-budgetShow passive-reply budget and stream-bubble diagnostics
/qq-test-md [text]Send a Markdown test message
/qq-test-streamRun a streamed timeline diagnostic (resume for probe)

With logLevel: "debug", logs are written only while a QQ-triggered run is active after login; local runs, login, and idle periods are not logged. scope: "media" covers media-tool steps during those runs, and QQ relay logs only appear for QQ-triggered runs.

Settings

Create ~/.pi/agent/pi-qq.json to override defaults. It stores settings only; credentials are never written to it.

{
  "thinkingRelay": true,
  "replyType": "full",
  "deliverAs": "steer",
  "fileMaxSize": 52428800,
  "language": "zh-cn",
  "logLevel": "silent"
}
KeyDefaultDescription
thinkingRelaytrueRelay thinking as plain text with a localized ## 💭 header
replyType"full"How much of a run is pushed to QQ: full, simple, last
deliverAs"steer"Queue new messages while busy: steer or followUp
fileMaxSize52428800QQ attachment download limit in bytes (50MB)
language"zh-cn"UI and log language: zh-cn or en-us
logLevel"silent"Log threshold: silent, error, warn, info, or debug

Settings are read when a pi session starts; restart pi after editing the file. Unknown keys are ignored, and invalid values fall back to defaults with a warning.

replyType

How much of an agent run is pushed to QQ.

ValueQQ receives
fullThinking blocks, tool calls, tool results, and every assistant message (default)
simpleAssistant messages only, one bubble each
lastOnly the last assistant message of the run, sent when the run ends
  • full is the default and keeps the behaviour of pi-qq 1.5.x; it is the only mode where thinkingRelay applies.
  • simple streams every assistant message live, one QQ bubble per message.
  • last sends nothing while the task is running; /last during a running task replies that the task is still running.
  • Model errors are always delivered immediately as a normal message, in every mode.
  • Tool output is not relayed in simple or last, but files sent with qq_send_media are still delivered.

thinkingRelay

Whether the model's thinking is relayed to QQ as its own bubble.

  • true (default): thinking is relayed as plain text under a localized ## 💭 heading.
  • false: thinking is dropped.
  • Only applies to replyType: "full"; simple and last never relay thinking.

deliverAs

How a QQ message reaches pi while a task is already running.

  • steer (default): the message is injected into the running task at the next safe point.
  • followUp: the message is queued and processed after the running task finishes.

fileMaxSize

Maximum size of an inbound attachment, in bytes (default 52428800, 50MB). Larger files are rejected with a notice instead of being downloaded, which keeps the local disk and the download quota under control.

language

Language of the UI notifications and the log messages.

  • zh-cn (default): Simplified Chinese.
  • en-us: English.

logLevel

Log threshold. Records are written only while a QQ-triggered run is active, to <cwd>/.pi/pi-qq/logs/pi-qq-YYYY-MM-DD.log; PI_QQ_LOG_DIR overrides the directory.

  • silent (default): no log file at all.
  • error: failures only.
  • warn: failures and recoverable problems.
  • info: run metadata as well — message ids, content lengths, agent start and end.
  • debug: everything, including tool arguments and results, attachment metadata, prompts, and raw voice transcripts.

Development

npm ci
npm run lint
npm run typecheck
npm test
npm run format:check

The extension entrypoint is index.ts. Source modules are grouped by responsibility:

DirectoryResponsibility
src/qq/QQ bot lifecycle, login, inbound handling, replies
src/relay/Streamed thinking/tool/text relay
src/attachments/Attachment download, storage, and voice transcripts
src/quota/Passive reply budget
src/infra/Settings, logging, and display formatting

Notes

  • Only C2C (QQ private chat) is supported.
  • Runs triggered by inbound QQ messages are relayed to QQ. Unrelated tasks started directly in pi stay local.
  • Images are saved as files and read through pi's read tool; the current model must support image input to see them.
  • Saved attachments are workspace-local under .pi/; add .pi/ to your own project .gitignore if needed.
  • QQ limits passive replies per inbound message. Use /qq-test-budget to inspect the local budget.
  • Reading a SKILL.md is shown as a ## 🧩 Skill block with the skill name; the file content is not forwarded to QQ.

License

MIT

版本与发布记录

@chen_hu_hu/pi-qq 共发布 21 个版本,首次发布于 2026/10/29;过去 12 个月发布了 21 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.6.0latest2026/11/09今天
1.5.12026/11/063 天前
1.5.02026/11/054 天前
1.4.22026/11/054 天前
1.4.12026/11/045 天前
1.4.02026/11/045 天前

关于 @chen_hu_hu/pi-qq 的常见问题

@chen_hu_hu/pi-qq 是什么?

Connect pi to QQ private chats.

如何安装 @chen_hu_hu/pi-qq?

在项目目录运行 npm install @chen_hu_hu/pi-qq,或使用 pnpm add / yarn add / bun add。

@chen_hu_hu/pi-qq 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/chen_hu_hu__pi-qq 是否存在。

@chen_hu_hu/pi-qq 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@chen_hu_hu/pi-qq 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@chen_hu_hu/pi-qq 可以商用吗?

@chen_hu_hu/pi-qq 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chen_hu_hu/pi-qq 的下载量有多少?

根据 npm 官方下载统计,@chen_hu_hu/pi-qq 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,699 次,日均约 123 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@chen_hu_hu/pi-qq 还在维护吗?

最新版本 1.6.0 发布于 2026/11/09(今天);至今共发布 21 个版本,其中过去 12 个月发布了 21 个;首次发布于 2026/10/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。