adp-openclaw 0.0.2
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/DESIGN.md +733 -0
- package/README.md +70 -0
- package/USAGE.md +910 -0
- package/WEBSOCKET_PROTOCOL.md +506 -0
- package/index.ts +17 -0
- package/openclaw.plugin.json +22 -0
- package/package.json +26 -0
- package/server/.claude/settings.local.json +16 -0
- package/server/go.mod +5 -0
- package/server/main.go +786 -0
- package/src/channel.ts +245 -0
- package/src/config-schema.ts +8 -0
- package/src/monitor.ts +325 -0
- package/src/runtime.ts +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Simple Go Channel Plugin
|
|
2
|
+
|
|
3
|
+
A minimal OpenClaw channel plugin demonstrating Go backend integration.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────┐ HTTP ┌─────────────┐
|
|
9
|
+
│ OpenClaw │ ◄─────────────► │ Go Server │
|
|
10
|
+
│ Plugin │ poll/send │ (port 9876)│
|
|
11
|
+
└─────────────┘ └─────────────┘
|
|
12
|
+
│
|
|
13
|
+
▼
|
|
14
|
+
┌─────────────┐
|
|
15
|
+
│ OpenClaw │
|
|
16
|
+
│ Runtime │
|
|
17
|
+
└─────────────┘
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### 1. Start the Go server
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd server
|
|
26
|
+
go run main.go
|
|
27
|
+
# Server listens on http://localhost:9876
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Configure OpenClaw
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
openclaw config set channels.simplego.enabled true
|
|
34
|
+
openclaw config set channels.simplego.serverUrl "http://localhost:9876"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Start OpenClaw gateway
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
openclaw gateway run
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 4. Test by sending a message
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Simulate a user sending a message
|
|
47
|
+
curl -X POST http://localhost:9876/inbound \
|
|
48
|
+
-H "Content-Type: application/json" \
|
|
49
|
+
-d '{"from": "user123", "text": "Hello!"}'
|
|
50
|
+
|
|
51
|
+
# View bot responses
|
|
52
|
+
curl http://localhost:9876/outbox
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## API Endpoints
|
|
56
|
+
|
|
57
|
+
| Endpoint | Method | Description |
|
|
58
|
+
|----------|--------|-------------|
|
|
59
|
+
| `/health` | GET | Health check |
|
|
60
|
+
| `/poll` | GET | OpenClaw polls for new messages |
|
|
61
|
+
| `/send` | POST | OpenClaw sends a message |
|
|
62
|
+
| `/inbound` | POST | Simulate user sending a message |
|
|
63
|
+
| `/outbox` | GET | View sent messages (debug) |
|
|
64
|
+
|
|
65
|
+
## Files
|
|
66
|
+
|
|
67
|
+
- `server/main.go` - Go HTTP server
|
|
68
|
+
- `src/channel.ts` - ChannelPlugin implementation
|
|
69
|
+
- `src/monitor.ts` - Poll loop that forwards messages to runtime
|
|
70
|
+
- `index.ts` - Plugin entry point
|