@decentchat/decentclaw 0.1.0
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 +88 -0
- package/index.ts +17 -0
- package/openclaw.plugin.json +31 -0
- package/package.json +48 -0
- package/src/channel.ts +789 -0
- package/src/huddle/AudioPipeline.ts +174 -0
- package/src/huddle/BotHuddleManager.ts +882 -0
- package/src/huddle/SpeechToText.ts +223 -0
- package/src/huddle/TextToSpeech.ts +260 -0
- package/src/huddle/index.ts +8 -0
- package/src/monitor.ts +1266 -0
- package/src/peer/DecentChatNodePeer.ts +4570 -0
- package/src/peer/FileStore.ts +59 -0
- package/src/peer/NodeMessageProtocol.ts +1057 -0
- package/src/peer/SyncProtocol.ts +701 -0
- package/src/peer/polyfill.ts +43 -0
- package/src/peer-registry.ts +32 -0
- package/src/runtime.ts +63 -0
- package/src/types.ts +136 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# decent-openclaw
|
|
2
|
+
|
|
3
|
+
OpenClaw channel plugin for DecentChat.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Add this plugin path to your OpenClaw config under `plugins.load.paths`.
|
|
8
|
+
2. Configure channel settings under `channels.decentchat`:
|
|
9
|
+
- `enabled`
|
|
10
|
+
- `seedPhrase` (required; BIP39 mnemonic)
|
|
11
|
+
- `signalingServer` (optional; default `https://decentchat.app/peerjs`)
|
|
12
|
+
- `invites` (optional DecentChat invite URIs)
|
|
13
|
+
3. Enable OpenClaw in the DecentChat settings panel.
|
|
14
|
+
4. Use `/activation` in any channel if you want responses to all messages.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
- Thread-aware routing is supported (including `replyToId` fallback).
|
|
20
|
+
- Per-chat-type reply mode overrides are supported via `replyToModeByChatType`.
|
|
21
|
+
- Active implementation plan: `docs/plans/2026-02-28-decent-openclaw-parity-threading.md`.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Config migration (threading parity)
|
|
25
|
+
|
|
26
|
+
If you are upgrading from pre-parity config, migrate from global-only reply mode to explicit chat-type/thread settings.
|
|
27
|
+
|
|
28
|
+
Before:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
channels:
|
|
32
|
+
decentchat:
|
|
33
|
+
enabled: true
|
|
34
|
+
replyToMode: all
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
After:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
channels:
|
|
41
|
+
decentchat:
|
|
42
|
+
enabled: true
|
|
43
|
+
replyToMode: all
|
|
44
|
+
replyToModeByChatType:
|
|
45
|
+
direct: off
|
|
46
|
+
group: all
|
|
47
|
+
channel: all
|
|
48
|
+
thread:
|
|
49
|
+
historyScope: thread
|
|
50
|
+
inheritParent: false
|
|
51
|
+
initialHistoryLimit: 10
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Feature flags and safe defaults
|
|
55
|
+
|
|
56
|
+
Recommended safe defaults:
|
|
57
|
+
|
|
58
|
+
- `replyToMode: all`
|
|
59
|
+
- `replyToModeByChatType.direct: off`
|
|
60
|
+
- `thread.historyScope: thread`
|
|
61
|
+
- `thread.initialHistoryLimit: 10`
|
|
62
|
+
|
|
63
|
+
Fast safety toggles if behavior is noisy:
|
|
64
|
+
|
|
65
|
+
- Disable thread splitting entirely:
|
|
66
|
+
- `replyToMode: off`
|
|
67
|
+
- Keep channel-wide session history (no per-thread split):
|
|
68
|
+
- `thread.historyScope: channel`
|
|
69
|
+
- Disable bootstrap thread-context prefill:
|
|
70
|
+
- `thread.initialHistoryLimit: 0`
|
|
71
|
+
|
|
72
|
+
## Rollback checklist
|
|
73
|
+
|
|
74
|
+
1. Revert to previous known-good commit.
|
|
75
|
+
2. Set conservative config:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
channels:
|
|
79
|
+
decentchat:
|
|
80
|
+
replyToMode: off
|
|
81
|
+
thread:
|
|
82
|
+
historyScope: channel
|
|
83
|
+
initialHistoryLimit: 0
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
3. Restart OpenClaw runtime.
|
|
87
|
+
4. Validate route logs and one direct + one group reply path.
|
|
88
|
+
5. Re-enable features gradually (`replyToMode`, then `historyScope`, then `initialHistoryLimit`).
|
package/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
|
|
2
|
+
import { emptyPluginConfigSchema } from 'openclaw/plugin-sdk';
|
|
3
|
+
import { decentChatPlugin } from './src/channel.js';
|
|
4
|
+
import { setDecentChatRuntime } from './src/runtime.js';
|
|
5
|
+
|
|
6
|
+
const plugin = {
|
|
7
|
+
id: 'decentchat',
|
|
8
|
+
name: 'DecentChat',
|
|
9
|
+
description: 'DecentChat P2P channel plugin',
|
|
10
|
+
configSchema: emptyPluginConfigSchema(),
|
|
11
|
+
register(api: OpenClawPluginApi) {
|
|
12
|
+
setDecentChatRuntime(api.runtime);
|
|
13
|
+
api.registerChannel({ plugin: decentChatPlugin });
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default plugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "decentchat",
|
|
3
|
+
"name": "DecentChat",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"channels": ["decentchat"],
|
|
6
|
+
"description": "DecentChat P2P channel plugin for OpenClaw — P2P encrypted chat",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"enabled": { "type": "boolean", "default": true },
|
|
12
|
+
"seedPhrase": { "type": "string" },
|
|
13
|
+
"signalingServer": { "type": "string", "default": "https://decentchat.app/peerjs" },
|
|
14
|
+
"invites": { "type": "array", "items": { "type": "string" } },
|
|
15
|
+
"alias": { "type": "string", "default": "DecentChat Bot" },
|
|
16
|
+
"dataDir": { "type": "string" },
|
|
17
|
+
"dmPolicy": { "type": "string", "enum": ["open", "pairing", "allowlist", "disabled"], "default": "open" },
|
|
18
|
+
"channels": { "type": "object" }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"uiHints": {
|
|
22
|
+
"enabled": { "label": "Enabled" },
|
|
23
|
+
"seedPhrase": { "label": "Seed Phrase (12 words)", "sensitive": true },
|
|
24
|
+
"signalingServer": { "label": "Signaling Server", "placeholder": "https://decentchat.app/peerjs" },
|
|
25
|
+
"invites": { "label": "Invite URLs" },
|
|
26
|
+
"alias": { "label": "Bot Display Name", "placeholder": "DecentChat Bot" },
|
|
27
|
+
"dataDir": { "label": "Data Directory" },
|
|
28
|
+
"dmPolicy": { "label": "DM Policy" },
|
|
29
|
+
"channels": { "label": "Channel Rules" }
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@decentchat/decentclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"channel": {
|
|
12
|
+
"id": "decentchat",
|
|
13
|
+
"label": "DecentChat",
|
|
14
|
+
"selectionLabel": "DecentChat (P2P)",
|
|
15
|
+
"docsPath": "/channels/decentchat",
|
|
16
|
+
"blurb": "P2P encrypted chat via DecentChat."
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"index.ts",
|
|
22
|
+
"openclaw.plugin.json"
|
|
23
|
+
],
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/Alino/DecentChat.git",
|
|
27
|
+
"directory": "decent-openclaw"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@decentchat/company-sim": "^0.1.0",
|
|
35
|
+
"decent-protocol": "^0.1.0",
|
|
36
|
+
"decent-transport-webrtc": "^0.1.0",
|
|
37
|
+
"node-datachannel": "^0.32.1",
|
|
38
|
+
"opusscript": "^0.1.1",
|
|
39
|
+
"yaml": "^2.8.2",
|
|
40
|
+
"zod": "^3.24.1"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"openclaw": ">=0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"playwright": "^1.58.2"
|
|
47
|
+
}
|
|
48
|
+
}
|