@decentchat/decentchat-plugin 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,170 @@
1
+ # @decentchat/decentchat-plugin
2
+
3
+ OpenClaw channel plugin for [DecentChat](https://github.com/DecentChat/DecentChat) -- peer-to-peer encrypted chat over WebRTC.
4
+
5
+ Connects your OpenClaw agent to DecentChat workspaces so it can read and reply to messages in channels, groups, DMs, and threads.
6
+
7
+ ## Install
8
+
9
+ ```
10
+ openclaw plugins install @decentchat/decentchat-plugin
11
+ ```
12
+
13
+ ## Configure
14
+
15
+ The quickest way to set up is with the interactive wizard:
16
+
17
+ ```
18
+ openclaw configure
19
+ ```
20
+
21
+ Select **DecentChat** when prompted. The wizard will:
22
+
23
+ 1. Offer to generate a new 12-word seed phrase (or let you paste an existing one)
24
+ 2. Ask for a display name
25
+ 3. Ask for an invite URL to join a workspace
26
+
27
+ You can also set the seed phrase via the `DECENTCHAT_SEED_PHRASE` environment variable instead of storing it in the config file.
28
+
29
+ ### Manual configuration
30
+
31
+ If you prefer to edit the config directly, add a `channels.decentchat` block to your OpenClaw config (`~/.openclaw/openclaw.json` or per-project):
32
+
33
+ ```yaml
34
+ channels:
35
+ decentchat:
36
+ enabled: true
37
+ seedPhrase: "your twelve word BIP39 mnemonic goes here ..."
38
+ ```
39
+
40
+ That's the minimum. The bot will join the DecentChat network using the default signaling server (`https://decentchat.app/peerjs`), respond to all messages, and call itself "DecentChat Bot".
41
+
42
+ ### Optional settings
43
+
44
+ | Key | Default | What it does |
45
+ |-----|---------|-------------|
46
+ | `signalingServer` | `https://decentchat.app/peerjs` | PeerJS signaling endpoint |
47
+ | `invites` | `[]` | DecentChat invite URIs to auto-join |
48
+ | `alias` | `"DecentChat Bot"` | Display name for the bot |
49
+ | `dataDir` | auto | Override the data directory |
50
+ | `dmPolicy` | `"open"` | DM access: `open`, `pairing`, `allowlist`, or `disabled` |
51
+ | `streamEnabled` | `true` | Stream responses token-by-token |
52
+ | `replyToMode` | `"all"` | Reply behavior: `off`, `first`, or `all` |
53
+
54
+ ### Reply mode per chat type
55
+
56
+ You can override `replyToMode` for specific chat types:
57
+
58
+ ```yaml
59
+ channels:
60
+ decentchat:
61
+ enabled: true
62
+ seedPhrase: "..."
63
+ replyToMode: all
64
+ replyToModeByChatType:
65
+ direct: "off"
66
+ group: "all"
67
+ channel: "all"
68
+ ```
69
+
70
+ ### Thread settings
71
+
72
+ ```yaml
73
+ channels:
74
+ decentchat:
75
+ thread:
76
+ historyScope: "thread" # "thread" or "channel"
77
+ inheritParent: false
78
+ initialHistoryLimit: 20
79
+ ```
80
+
81
+ - `historyScope: thread` -- the bot only sees messages in the current thread (not the full channel history)
82
+ - `inheritParent: false` -- don't prepend the parent message to thread context
83
+ - `initialHistoryLimit` -- how many prior thread messages to load for context
84
+
85
+ ### Huddle (voice) settings
86
+
87
+ ```yaml
88
+ channels:
89
+ decentchat:
90
+ huddle:
91
+ enabled: true
92
+ autoJoin: false
93
+ sttEngine: "whisper-cpp" # whisper-cpp | whisper-python | openai | groq
94
+ whisperModel: "base.en"
95
+ sttLanguage: "en"
96
+ ttsVoice: "alloy"
97
+ vadSilenceMs: 800
98
+ vadThreshold: 0.5
99
+ ```
100
+
101
+ ### Company simulation
102
+
103
+ The plugin includes a company simulation subsystem (`@decentchat/company-sim`) that lets you run multi-agent teams inside DecentChat workspaces. Configure it per-account:
104
+
105
+ ```yaml
106
+ channels:
107
+ decentchat:
108
+ companySim:
109
+ enabled: true
110
+ manifestPath: "./company-manifest.yaml"
111
+ companyId: "acme"
112
+ employeeId: "bot-1"
113
+ companySimBootstrap:
114
+ enabled: true
115
+ mode: "runtime"
116
+ ```
117
+
118
+ ### Multiple accounts
119
+
120
+ Run multiple bot identities from one OpenClaw instance:
121
+
122
+ ```yaml
123
+ channels:
124
+ decentchat:
125
+ defaultAccount: "main"
126
+ accounts:
127
+ main:
128
+ seedPhrase: "first mnemonic ..."
129
+ alias: "Bot A"
130
+ secondary:
131
+ seedPhrase: "second mnemonic ..."
132
+ alias: "Bot B"
133
+ dmPolicy: "disabled"
134
+ ```
135
+
136
+ Each account gets its own peer connection and data directory.
137
+
138
+ ## Quick safety toggles
139
+
140
+ If the bot is too chatty:
141
+
142
+ ```yaml
143
+ # Shut off all replies
144
+ replyToMode: "off"
145
+
146
+ # Keep replies but use full channel history (no per-thread split)
147
+ thread:
148
+ historyScope: "channel"
149
+
150
+ # Disable thread context prefill
151
+ thread:
152
+ initialHistoryLimit: 0
153
+ ```
154
+
155
+ ## How it works
156
+
157
+ The plugin creates a DecentChat peer (using `@decentchat/protocol` and `@decentchat/transport-webrtc`) that joins the P2P mesh. Incoming messages are routed through OpenClaw's agent pipeline. Responses are sent back to the originating chat, with thread-aware routing so replies land in the right thread.
158
+
159
+ All traffic is end-to-end encrypted (ECDH + AES-GCM-256). The bot's identity is derived from the seed phrase, same as any other DecentChat client.
160
+
161
+ ## Dependencies
162
+
163
+ - [@decentchat/protocol](https://npmjs.com/package/@decentchat/protocol) -- DecentChat SDK
164
+ - [@decentchat/transport-webrtc](https://npmjs.com/package/@decentchat/transport-webrtc) -- WebRTC transport layer
165
+ - [@decentchat/company-sim](https://npmjs.com/package/@decentchat/company-sim) -- company simulation subsystem
166
+ - [openclaw](https://openclaw.ai) -- peer dependency (the host runtime)
167
+
168
+ ## License
169
+
170
+ MIT
package/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineChannelPluginEntry } from 'openclaw/plugin-sdk/core';
2
+ import { decentChatPlugin } from './src/channel.js';
3
+ import { setDecentChatRuntime } from './src/runtime.js';
4
+
5
+ export default defineChannelPluginEntry({
6
+ id: 'decentchat',
7
+ name: 'DecentChat',
8
+ description: 'DecentChat P2P channel plugin',
9
+ plugin: decentChatPlugin,
10
+ setRuntime: setDecentChatRuntime,
11
+ });
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "decentchat",
3
+ "kind": "channel",
4
+ "name": "DecentChat",
5
+ "version": "0.1.9",
6
+ "channels": ["decentchat"],
7
+ "description": "DecentChat P2P channel plugin for OpenClaw — P2P encrypted chat",
8
+ "configSchema": {
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "enabled": { "type": "boolean", "default": true },
13
+ "seedPhrase": { "type": "string" },
14
+ "signalingServer": { "type": "string", "default": "https://decentchat.app/peerjs" },
15
+ "invites": { "type": "array", "items": { "type": "string" } },
16
+ "alias": { "type": "string", "default": "DecentChat Bot" },
17
+ "dataDir": { "type": "string" },
18
+ "dmPolicy": { "type": "string", "enum": ["open", "pairing", "allowlist", "disabled"], "default": "open" },
19
+ "channels": { "type": "object" }
20
+ }
21
+ },
22
+ "uiHints": {
23
+ "enabled": { "label": "Enabled" },
24
+ "seedPhrase": { "label": "Seed Phrase (12 words)", "sensitive": true },
25
+ "signalingServer": { "label": "Signaling Server", "placeholder": "https://decentchat.app/peerjs" },
26
+ "invites": { "label": "Invite URLs" },
27
+ "alias": { "label": "Bot Display Name", "placeholder": "DecentChat Bot" },
28
+ "dataDir": { "label": "Data Directory" },
29
+ "dmPolicy": { "label": "DM Policy" },
30
+ "channels": { "label": "Channel Rules" }
31
+ }
32
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@decentchat/decentchat-plugin",
3
+ "version": "0.1.9",
4
+ "description": "OpenClaw channel plugin for DecentChat — P2P encrypted chat",
5
+ "type": "module",
6
+ "main": "index.ts",
7
+ "openclaw": {
8
+ "extensions": [
9
+ "./index.ts"
10
+ ],
11
+ "setupEntry": "./setup-entry.ts",
12
+ "channel": {
13
+ "id": "decentchat",
14
+ "label": "DecentChat",
15
+ "selectionLabel": "DecentChat (P2P)",
16
+ "docsPath": "/channels/decentchat",
17
+ "blurb": "P2P encrypted chat via DecentChat."
18
+ },
19
+ "install": {
20
+ "npmSpec": "@decentchat/decentchat-plugin"
21
+ }
22
+ },
23
+ "files": [
24
+ "src",
25
+ "index.ts",
26
+ "setup-entry.ts",
27
+ "openclaw.plugin.json"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/DecentChat/DecentChat.git",
32
+ "directory": "decent-openclaw"
33
+ },
34
+ "license": "MIT",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "@decentchat/company-sim": "^0.1.3",
40
+ "@decentchat/protocol": "^0.1.2",
41
+ "@decentchat/transport-webrtc": "^0.1.2",
42
+ "node-datachannel": "^0.32.1",
43
+ "opusscript": "^0.1.1",
44
+ "yaml": "^2.8.2",
45
+ "zod": "^3.24.1"
46
+ },
47
+ "peerDependencies": {
48
+ "openclaw": ">=0.1.0"
49
+ },
50
+ "devDependencies": {
51
+ "playwright": "^1.58.2"
52
+ }
53
+ }
package/setup-entry.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { defineSetupPluginEntry } from 'openclaw/plugin-sdk/core';
2
+ import { decentChatPlugin } from './src/channel.js';
3
+
4
+ export default defineSetupPluginEntry(decentChatPlugin);