Mieksido/surfcore
About
一句话:它不是"把大模型接进 QQ"的机器人框架,而是给模型一个身份、一套会遗忘的记忆、 一份作息、两只手(QQ / B站)和一个能坐在你桌面上的分身。
Other ProjectsMeasured star growth
- in 24h
- +6
- in 7 days
- +61
- in 15 days
- +120
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.en.md
OriginalSurfCore — QQ ↔ DeepSeek Harness Bridge + QQ × Bilibili plugin
ℹ️ This English page is a condensed overview. The full, code-level documentation (architecture, every module, voice / pet / Bilibili subsystems, configuration and state files, capability boundaries) is written in Chinese under
docs/guides/— start withARCHITECTURE.md.
Connect QQ messages to DeepSeek Harness (DSH) agents: QQ friends/groups become DSH conversations, and agent replies (including questions and tool approvals) are sent back to QQ.
🧩 The merged DSH plugin lives in plugins/surfcore/ and appears in DSH settings as SurfCore (QQ settings + Bilibili browsing + two-way redacted memory + identity alignment). Since 2026-10-22 the former
QQbotand刷B站/dsh-bili-whaleworkspaces are merged into this repository.
⚠️ Current release
0.1.0(SurfCore merged edition; it carries the bridge code of qq-bridgev0.2.0-r4), verified on DSH0.2.1-rc.2(runnpm run verify:adaptationto re-check item by item against your own DSH). It uses the persistent local signing key to mint the session Cookie offline, slash RPC endpoints and the/api/remote.muxevent stream — a protocol generation introduced in DSH0.1.2-alpha.1, incompatible with the older dot-endpoint protocol. Reading the launch token out of the old guard logs has not worked since DSH 0.1.7 (the token is generated per process and never written to disk). Agent presets are@deepseek-ai/dsh-agent-presetCordis rows since DSH 0.1.7 (the~/.dsh/.agent-presets/directory mechanism is gone). On DSH0.1.1-rc.2or earlier, use tagv0.1.0; for DSH 0.1.5-rc.1 usev0.1.5; for DSH 0.1.7-rc.2 usev0.1.7.r4 highlights: sticker/animated-emoji pipeline (CDN first,
emoji_idfallback, multi-address DNS failover), web search now reuses DSH's own DeepSeek search backend (Bing only as fallback),qq_wait_for_messageslong-polling past the 300 s undici timeout, plus fixes for the mode-switch rollback, permanent "busy" turns, missing self-identity injection and a full-project audit. Details: Release v0.2.0-r4.The default branch
mainis this version — a plaingit clonegets it, no branch switching needed.
For the detailed Chinese guide, start with docs/guides/ARCHITECTURE.md (the 2026-10 code-level documentation set: architecture, every module, voice / pet / Bilibili subsystems, configuration & state files, capability boundaries). The documentation index (one line per doc, with "still current?" notes) is docs/README.md; the repository/folder and script-naming conventions are in docs/FOLDER_MAP.md.
Architecture
QQ messages ──► SnowLuma (OneBot v11 WS) ──► qq-bridge ──► DSH Web API (127.0.0.1:3080/api)
▲ │
└── agent replies / questions / approvals ┘
- QQ side:
@snowluma/sdkprovides the OneBot v11 WebSocket client. - DSH side: adapted for DSH 0.1.2+ and re-verified on 0.2.0-rc.2 — session Cookie minted from the persistent local signing key,
/api/<namespace>/<method>slash RPC, and/api/remote.mux+session/followevent stream (the pending queue is read fromvalue.projections[<id>].values.inbox, with the unarysession/projectionsRPC as the primary path). The per-session model is pinned by the bridge viasession.selectModelfromconfig.json'sdsh.model(defaultdeepseek-flash= DeepSeek-V41-Flash, multimodal). - Agent tools: three bundled MCP servers expose a restricted QQ toolset (
qq_status,qq_list_groups,qq_get_group_history,qq_send_group_message,qq_reply, etc.), a read-only host probe (snowluma_statusonly), and a read-onlyweb_search/web_fetchpair with SSRF protection. ⚠️start_snowluma/stop_snowluma(andsnowluma.allowProcessControl) were removed in v0.1.5: SnowLuma EULA §5.4 requires prior written permission to deploy its proprietary native components through automated scripts. This program only probes, never deploys — installing, starting and scanning SnowLuma is always up to you. See LICENSE and RULES.md. - Console: a local web console at
http://127.0.0.1:3100, organised into ten task-based pages (Overview, Sessions & Approvals, Persona, Social v2, Social v1, Slang, Usage & Cost, Access & Security, Operations, Tool Reference) with cross-page feature search and a light / dark theme (one-click toggle in the header; follows the OS preference until you choose), for mode switching, role management, whitelist/admin settings, slang management, memory, stickers and more. The Persona page manages roles (view/edit/rename/duplicate/delete the prompt of each persona), shows and edits both prompt layers separately — the simulation prompt built into the preset (tool/behaviour protocol; synced to DSH, restart required) and the persona prompt (roles/*.md; applied immediately) — and sets the DSH reasoning effort (maxby default,high/lowselectable). The Usage & Cost page shows real-time token consumption and its price in CNY, broken down per group/friend and per conversation turn (see docs/guides/TOKEN_USAGE_CONSOLE.md).
Features
- Bridges QQ group/private messages to DSH agent sessions.
- Social simulation mode ("simulated group friend") with idle/active/probing/exiting states.
- Space-based message splitting for more natural multi-message replies.
- Whitelist/blacklist access control, fail-closed by default.
- Sensitive text audit prevents paths/credentials from being sent to QQ.
- MCP tools for reading group history/members, sending messages, replying with quotes, and (in
reserved2) full simulated-group-friend tooling. - Slang/network-expression learning with human confirmation.
- Lightweight memory system for active topics, pending thoughts and member impressions.
- Memory cards (the character's long-term memory): two cards sharing one document family — the decayed card (
memory-card.*) is the only one loaded into prompts (owner + emotional memories stay vivid, unimportant ones fade one level per day), while the full archive (memory-card-full.*) keeps every memory permanently vivid and is never injected; it exists for on-demand search/recall via the settings page or/api/memory-card/full. Capacity alerts at 80/90/100% with one-click compression apply to the decayed card only; the full archive has a soft cap and is never auto-deleted. Rules and configuration: docs/guides/MEMORY_CARD.md. - Character personas (multi-character): each character is a directory bundle (
~/.dsh/surfcore/characters/<id>/) with its persona card, decayed/full memory cards, Bilibili behavior ledgers, and snapshots. The settings page can create/load/save/restore/delete characters; loading another character snapshots the old one, stops and restarts the QQ bridge and Bilibili scheduler with fresh sessions, and switches the current pointer with an epoch. Twelve autosave slots (before-switch + 180/90/60/30/15/10/7/5/3/2/1 days); today's actions under the old character never count toward the new one and are never replayed. See docs/guides/CHARACTER_PERSONA.md. - Sticker library integration with AI-friendly sticker usage.
- SurfCore plugin: one settings window for QQ + Bilibili, two-way redacted memory, identity alignment, and the merged "fish school" protection (see below).
- Fish-school protection: QQ groups suppress autonomous participation when the recent window is dominated by other fish bots; Bilibili comments skip new top-level comments when too many fish are present, gather into a fish thread instead, and like fish comments within a low daily cap. Both sides are configurable and can be disabled independently.
Requirements
- Node.js >= 22.13
- Running DeepSeek Harness Web (default
http://127.0.0.1:3080) - Running SnowLuma with OneBot v11 WebSocket and HTTP API enabled
Quick Start
npm install # postinstall automatically patches the @snowluma/sdk ESM packaging bug
Copy config.example.json to config.json, then edit:
cp config.example.json config.json
Key settings:
| Field | Description |
|---|---|
dsh.baseUrl |
DSH Web API URL, default http://127.0.0.1:3080 |
dsh.authToken |
DSH launch token (a process-launch credential). Normally leave this empty: with no token the bridge mints the session cookie offline from the persistent signing key in ~/.dsh/.credentials.yaml, which depends on no per-process state (since DSH 0.1.7 the launch token lives only in memory — the one in the old logs belongs to a previous process and only yields a 401). A value here is honoured first if you set one |
dsh.authHeader / dsh.authPrefix |
Legacy fields kept for compatibility; the current path uses Cookie auth and does not send this header |
snowluma.wsUrl |
SnowLuma OneBot WebSocket URL (e.g. ws://127.0.0.1:3001) |
snowluma.accessToken |
OneBot access token, leave empty if not configured |
snowluma.httpUrl |
OneBot HTTP API URL (e.g. http://127.0.0.1:3000); do not point this at the WebSocket port or you will get HTTP 426 |
ownerQQ |
Administrator QQ (highest privilege) |
allow.private / allow.groups |
Whitelist of QQ/group IDs |
deny.users |
Person blacklist (QQ IDs): messages from these users are ignored in every group and in private chat (not stored, not fed to the agent, no wake-up, pokes ignored). Beats allow.* and allowAllWhenEmpty |
deny.private / deny.groups |
Conversation blacklist (QQ/group IDs), takes precedence over the whitelist |
consolePort |
Local console port, default 3100 |
Start:
npm start
Or double-click start.bat on Windows (guard mode with auto-restart).
DSH Setup on Another Device
The bridge and console can run without extra DSH setup, but the two DSH chat presets (qq-chat and qq-chat-v2) and the MCP servers must be installed into DSH once per machine:
node scripts/setup-dsh.mjs
This installs:
- the two
@deepseek-ai/dsh-agent-presetrows (qq-chat,qq-chat-v2) plus the sharedqq-tool-restrictsafety guard, all inside thesurfcorebundle - MCP entries in
~/.dsh/profiles/web/cordis.patch.yml - only
surfcorein the profilepackage.json(bundles+link:dependency) - Default DSH mode set to
reserved2(second-generation simulation), with a localstate/mode.jsonfallback
Then restart DSH. See docs/guides/DSH_SETUP.md for details.
Security Notes
config.jsonandstate/are never committed; the repository only shipsconfig.example.json. Both are ACL-hardened to the owner / SYSTEM / Administrators (npm run harden-acl).- MCP send tools enforce whitelist checks and reject CQ-code injection.
- Local paths, credentials, tokens and other sensitive patterns are filtered by the audit layer.
- Simulation sessions get no local execution tools at all: the preset's
qq-tool-restrictrow hides them from the tool schema at registration time and a runtime allowlist rejects anything outside the QQ MCP namespaces (npm run scan:tool-namesre-checks that list against the installed DSH). - The console uses a generated token when none is configured.
Repository Layout
surfcore/
config.example.json # sanitized config template (real config.json is not in repo)
docs/
README.md # documentation index (one line per doc + "still current?" notes)
FOLDER_MAP.md # folder layout and scripts/ naming conventions
guides/ # user/operator facing + code-level docs: ARCHITECTURE, MODULE-*, SUBSYSTEM-*, DATA-AND-CONFIG, BOUNDARIES, DSH_SETUP, ...
design/ # design & planning docs
research/ # investigation notes
audits/ # review / optimisation reports
legacy/ # archived docs that were superseded
dsh/agent-presets/ # qq-chat / qq-chat-v2 DSH agent preset templates
plugins/surfcore # DSH bundle: generates the qq-chat / qq-chat-v2 preset patch rows + the shared tool guard
plugins/surfcore # merged DSH plugin: SurfCore settings window + QQ/Bilibili memory/alignment
src/ # bridge core and MCP servers
public/
console.html # local web console
roles/ # persona cards
assets/ # images (the intro video ships as a release asset, not in the repo)
scripts/ # tests and helper scripts
state/ # runtime data (not in repo)
Testing
npm run test:audit runs isolated regression tests without production credentials, DSH, or QQ messages. For what is covered and what is still red, see docs/RISK_REGISTER.md and docs/PITFALLS.md (Chinese).
After upgrading, legacy QQ session mappings without permission metadata are recreated once. Mode or preset changes also retire the old mapping and recreate the session on the next message; DSH history is retained.
npm run self-test # DSH-side link test, no QQ/SnowLuma required
npm run test-md
npm run test-wait
npm run test-vision
npm run test-forward
npm run test-slang
npm run test-stickers
Compliance
SnowLuma is an independent third-party project and is not affiliated with Tencent/QQ. This project is for learning and technical research only; please follow the relevant terms and the QQ User Agreement.
Explore related projects
Loading…