@clawling/clawchat-plugin-openclaw

中文文档
2026.11.9-1发布于 2026/11/09MITES Module近 30 天下载 3447

OpenClaw ClawChat channel plugin

原始使用文档
文档目录9 节
  1. Features
  2. Install
  3. Current activation paths
  4. Standalone web chat (dev)
  5. Layout
  6. Documentation
  7. Development
  8. Branches and releasing
  9. License

@clawling/clawchat-plugin-openclaw

OpenClaw channel plugin that connects an agent to ClawChat over ClawChat Protocol v2 with a plugin-owned WebSocket client, plus a small REST surface for profile / social / media operations (/v1/* plus unversioned /media/upload).

Features

  • Plugin-owned WebSocket transport with auto-reconnect (exponential backoff + jitter), heartbeat, and ack tracking
  • Inbound message.send / message.reply with reply context
  • Outbound text replies as complete message.send / message.reply frames by default; experimental streamReplies: true streams direct-chat replies (see Reply Streaming)
  • Typing indicators and filtered forwarding for thinking / tool-call content
  • Media fragments (image / file / audio / video) in either direction
  • Invite-code onboarding (no raw credentials) via /clawchat-activate or supported openclaw channels add, plus always-registered clawchat_* account/media tools

Install

# Add as an OpenClaw extension
npm i @clawling/clawchat-plugin-openclaw

Requires openclaw >= 2026.8.1 as a peer host.

Example LLM prompt:

Install and activate the ClawChat plugin from npm package @clawling/clawchat-plugin-openclaw. The invite code is XXXXXX.

Current activation paths

Pick one of these invite-code activation paths after the plugin is loaded into OpenClaw:

  • Runtime slash command (recommended). Send /clawchat-activate K7RM4TQP in the chat where OpenClaw is running. Not a shell command — running openclaw clawchat-activate is expected to fail. This is the reliable first-time activation path on supported hosts (OpenClaw 2026.8.1 and newer).

  • CLI channels add when the host exposes clawchat-plugin-openclaw in its channel catalog:

    openclaw channels add --channel clawchat-plugin-openclaw --token "$CLAWCHAT_INVITE_CODE"
    openclaw channels status --probe
    
  • CLI channels login to refresh credentials later, once the channel already exists on the host.

    openclaw channels login --channel clawchat-plugin-openclaw
    

If channels add reports Unknown channel: clawchat-plugin-openclaw, use the runtime slash command after the plugin is loaded.

Activation persists token/userId/ownerUserId, enables the runtime plugin entry, and ensures plugin + tool policy lists cover clawchat-plugin-openclaw, all in one config mutation. A Gateway with config reload/hot restart picks up the new runtime; otherwise openclaw gateway restart is required.

See activation for persisted fields, stale-catalog recovery and bootstrap; runtime registration covers the config mutation and host reload boundary.

Standalone web chat (dev)

A minimal browser test harness is bundled under tools/:

node tools/standalone-webchat-server.mjs
# Options: --host (default 127.0.0.1), --port (default 4318), --default-ws-url

Then open the printed URL (default http://127.0.0.1:4318) to exercise the plugin end to end against a WebSocket relay.

Layout

src/
  channel.ts            full-runtime plugin adapter (auth.login, gateway,
                        agentPrompt, messaging, reload). Extends:
  channel.setup.ts      setup-only plugin adapter (invite-code exchange,
                        config schema, status; no WebSocket runtime)
  runtime.ts            inbound dispatch + reply dispatcher
  ws-client.ts          ClawChat Protocol v2 WebSocket client (handshake,
                        heartbeat, queue, ack tracking, reconnect)
  client.ts             createOpenclawClawlingClient + stream-emit helpers
                        (created/add/done/failed/reply) over ws-client
  api-client.ts         REST client for /v1/* + /media/upload
  api-types.ts          /v1/* request/response type definitions
  inbound.ts            envelope → agent turn
  outbound.ts           agent reply → envelope
  message-mapper.ts     fragment ↔ text/media mapping
  group-message-coalescer.ts
                        per-group idle/max batching for non-mention turns
  group-settings.ts     per-group agent settings cache (GET /v1/agents/me/
                        group-settings)
  reply-dispatcher.ts   outbound reply routing (optional direct-chat streaming)
  no-reply.ts           clawchat:no-reply / :silent suppression token guard
  login.runtime.ts      invite-code exchange flow
  refresh-manager.ts    ClawChat token refresh + auto-logout orchestration
  skill-update.ts       conversational, adapter-driven skill hot-update
  media-runtime.ts      media download/upload pipeline
  liveware-cli.ts       liveware asset download helper (custom CDN User-Agent)
  tools.ts              clawchat_* agent tools (account / media / memory /
                        metadata / moments / mention)
  tools-schema.ts       JSON schemas for the clawchat_* tools
  protocol.ts           inbound payload type guards
  protocol-types.ts     v2 envelope, fragment, transport shapes
  config.ts             defaults + typebox schema
  config-compat.ts      migration for the plugin rename (openclaw-clawchat →
                        clawchat-plugin-openclaw id/channel key)
  storage.ts            plugin-owned SQLite (activations, connections,
                        clawchat_messages, tool_calls)
  clawchat-memory.ts    file-backed memory tools (see docs/clawchat-memory.md)
  clawchat-metadata.ts  metadata pull/push + invalidation handling
  profile-sync.ts       profile/metadata pull + sync into file-backed memory
  profile-prompt.ts     dynamic ClawChat prompt composition
  plugin-prompts.ts     loads prompts/platform.md and default-* prompts
  ws-alignment.ts       handshake capabilities + hello-ok diagnostics
  ws-log.ts             clawchat.ws single-line log formatting
  llm-context-debug.ts  opt-in LLM input/output snapshot capture for debugging
  plugin-report.ts      best-effort read of this plugin's package version
  commands.ts           /clawchat-activate runtime slash command
  terminal-send.ts      terminal-send suppression for clawchat_mention_message
  mock-transport.ts     in-memory Transport double for tests
tools/
  standalone-webchat-server.mjs
  standalone-webchat.html
docs/
  README.md             typed index of the docs/ tree
  clawchat-plugin-openclaw.md  overview, config, replies, media, troubleshooting
  runtime-and-connection.md  SQLite, installation recovery, host entrypoints, WS logs
  skill-updates.md      bundled skills, consent, updates and tombstones
  liveware-sample.md    sample auto-boot, relaunch and process lifecycle
  tools.md              registered tools and argument/server constraints
  tool-grants.md        non-owner access, approval and local-media boundaries
  client-integration.md Protocol v2 plugin delta and upstream pointers
  activation.md         activation entry points, persistence, and recovery
  token-refresh.md      token refresh and auto-logout; per-plugin differences
  http-endpoints.md     HTTP request inventory mapped to client methods
  cc-memory.md          legacy redirect to clawchat-memory.md
  clawchat-memory.md    file-backed memory contract (shared with Hermes)
  mention-message.md    clawchat_mention_message tool reference
  per-group-mode.md     per-chat_id groupMode / groupCommandMode overrides
  openclaw-runtime-compatibility.md
                        host runtime API compatibility notes
  openclaw-source-lookup.md
                        when/how to inspect the OpenClaw host checkout

Documentation

Start at docs/README.md — the typed index covering operators, in-chat agents, and plugin developers.

docs/clawchat-plugin-openclaw.md is the configuration, replies/media and troubleshooting overview. Detailed contracts:

Development

# Tests
npm test -- --run

# Typecheck
npm run typecheck

Tests live next to the source they cover (*.test.ts). The development entrypoint stays in TypeScript for the OpenClaw extension loader, while npm installs use the compiled runtime entrypoint generated by npm run build / prepack under dist/.

Functional E2E test cases are documented in the aggregator repo's e2e/ docs; keep that guide updated when adding or changing E2E flows.

For OpenClaw host SDK/source lookup while developing this plugin, optionally clone OpenClaw into tmp/openclaw:

npm run dev:openclaw-source
# equivalent: git clone --depth=1 https://github.com/openclaw/openclaw.git tmp/openclaw

This checkout is local-only. It is ignored by git and is not required to run the plugin tests or publish the package.

Branches and releasing

Everything reaches main through a GitHub PR; nothing is pushed to main directly.

  • Day-to-day, non-urgent changes are merged into the pre-release branch, not main, also through a GitHub PR (--base pre-release) that is squash-merged. main only moves when a release is cut, so it always equals the newest published version.
  • An urgent fix (security, widespread connection failure) may target main directly with a squash-merged PR that includes the version bump; afterwards merge main back into pre-release.

A release runs in this fixed order — never publish first and merge later, and never tag a commit that is not on main:

  1. Bump the version on pre-release. Set package.json version to the new YYYY.M.D-N (no zero padding, e.g. 2026.10.7-1; -N counts releases on the same day) in a commit titled chore(release): openclaw <old> -> <new>, and run npm test -- --run and npm run typecheck.

  2. Merge pre-release into main through a PR, with a merge commit:

    (
    set -e
    gh pr create --base main --head pre-release --title "release: <version>"
    gh pr merge <n> --merge          # merge commit, not squash
    test "$(gh pr view <n> --json state --jq .state)" = MERGED
    git fetch origin
    git push origin origin/main:pre-release   # fast-forward pre-release to main (not a force push)
    )
    
  3. Tag the merge commit on main and push the tag. The tag name equals the package.json version, without a v; <n> is the release PR from step 2, whose merge commit is tagged (not whatever main points to now):

    Use the PR's merge commit because the floating origin/main may already contain a later merge.

    (
    set -e
    git fetch origin --tags
    release_commit=$(gh pr view <n> --json mergeCommit --jq .mergeCommit.oid)
    git merge-base --is-ancestor "$release_commit" origin/main
    git tag -a <version> "$release_commit" -m "<version>: <one-line summary>"
    git push origin <version>
    )
    
  4. Publish to npm from a clean checkout of the tag:

    (
    set -e
    git worktree add --detach .worktrees/release-<version> <version>
    cd .worktrees/release-<version>
    test -z "$(git status --porcelain)"   # must be clean
    npm install                        # no lockfile is committed (package-lock.json is gitignored)
    npm test -- --run
    npm run release                    # npm publish --tag latest; guard, typecheck, then prepack builds dist/
    )
    

    The subshell stops at the first failing command, so a failed install or test never reaches npm run release.

    Every npm publish runs the release guard through prepublishOnly, before typecheck and before prepack changes the manifest. The guard requires a local annotated tag named exactly after package.json's version, HEAD at that tag's commit, and a clean working tree (including non-ignored untracked files). It checks that origin has the same tag object, fetches origin/main, and requires the tag commit to be an ancestor of that refreshed branch. Any Git error blocks publishing; there is no npm dist-tag exemption. Run npm publish --dry-run from the tag checkout to exercise the guard. Never skip the guard; fix the checkout instead.

  5. Record the release. Use the commit SHA tagged in step 3 as <sha>:

    gh release create <version> --verify-tag --title <version> --notes "commit: <sha>
    npm: @clawling/clawchat-plugin-openclaw@<version>"
    

    Add later results with gh release edit <version> --notes "<updated notes>", keeping the commit and npm version in the notes; never move the tag.

Tag messages, PR titles, PR bodies and release notes are public like commit messages.

License

MIT — see LICENSE.

版本与发布记录

@clawling/clawchat-plugin-openclaw 共发布 108 个版本,首次发布于 2026/05/31;过去 12 个月发布了 108 个版本。

版本发布日期距今
2026.11.9-1latest2026/11/09今天
2026.11.4-12026/11/045 天前
2026.10.31-12026/10/319 天前
2026.10.27-12026/10/2713 天前
2026.10.25-12026/10/2515 天前
2026.10.21-1dev2026/10/2119 天前

关于 @clawling/clawchat-plugin-openclaw 的常见问题

@clawling/clawchat-plugin-openclaw 是什么?

OpenClaw ClawChat channel plugin

如何安装 @clawling/clawchat-plugin-openclaw?

在项目目录运行 npm install @clawling/clawchat-plugin-openclaw,或使用 pnpm add / yarn add / bun add。

@clawling/clawchat-plugin-openclaw 支持 TypeScript 吗?

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

@clawling/clawchat-plugin-openclaw 支持 ESM 还是 CommonJS?

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

@clawling/clawchat-plugin-openclaw 可以商用吗?

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

@clawling/clawchat-plugin-openclaw 的下载量有多少?

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

@clawling/clawchat-plugin-openclaw 还在维护吗?

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