@yeego/yeego-openclaw 1.0.3 → 1.3.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/QUICKSTART.md CHANGED
@@ -1,82 +1,152 @@
1
- # Quick Start Guide
1
+ # Yeego OpenClaw Plugin - Quick Start Guide
2
2
 
3
- ## 🚀 Get Started in 3 Steps
3
+ Get your Yeego personas talking to OpenClaw in 5 minutes.
4
4
 
5
- ### Step 1: Get Your Configuration
5
+ ## Prerequisites
6
6
 
7
- 1. Open Yeego mobile app
8
- 2. Go to your profile → Settings
9
- 3. Tap "Connect to OpenClaw" 🦞
10
- 4. Tap "Copy Configuration"
7
+ - OpenClaw installed
8
+ - Yeego account
9
+ - Node.js 18+
11
10
 
12
- You'll get something like:
11
+ ## Step-by-Step Installation
12
+
13
+ ### 1. Install the Plugin
13
14
 
15
+ ```bash
16
+ npm install @yeego/yeego-openclaw
14
17
  ```
15
- # Yeego OpenClaw Plugin Configuration
16
- YEEGO_TOKEN=eyJhbG...
17
- YEEGO_PROFILE_ID=abc123...
18
- YEEGO_BASE_URL=http://localhost:8091
19
- YEEGO_PLUGIN_URL=http://localhost:8092/openclaw-plugin
18
+
19
+ ### 2. Get Your Yeego Configuration
20
+
21
+ **In the Yeego mobile app:**
22
+
23
+ 1. Open **Settings**
24
+ 2. Tap **OpenClaw Integration**
25
+ 3. Tap **"Connect to OpenClaw"**
26
+ 4. Copy the configuration JSON
27
+
28
+ You'll get something like:
29
+
30
+ ```json
31
+ {
32
+ "token": "eyJhbGc...",
33
+ "profileId": "124p201f8050l93",
34
+ "baseUrl": "https://staging.yeego.app",
35
+ "sidecarUrl": "https://staging.yeego.app/_sidecar",
36
+ "connectUrl": "https://staging.yeego.app/_sidecar/public/openclaw/connect"
37
+ }
20
38
  ```
21
39
 
22
- ### Step 2: Save Configuration
40
+ ### 3. Configure OpenClaw
41
+
42
+ Edit `~/.openclaw/openclaw.json`:
23
43
 
24
44
  ```bash
25
- cd openclaw-plugin
45
+ # Open the config file
46
+ nano ~/.openclaw/openclaw.json
47
+ ```
26
48
 
27
- # Paste your config and save
28
- bun run setup "YEEGO_TOKEN=eyJhbG...
29
- YEEGO_PROFILE_ID=abc123...
30
- YEEGO_BASE_URL=http://localhost:8091"
49
+ Add this configuration (replace with your values from step 2):
50
+
51
+ ```json
52
+ {
53
+ "channels": {
54
+ "yeego": {
55
+ "enabled": true,
56
+ "config": {
57
+ "token": "your-token-here",
58
+ "profileId": "your-profile-id",
59
+ "baseUrl": "https://staging.yeego.app",
60
+ "sidecarUrl": "https://staging.yeego.app/_sidecar",
61
+ "connectUrl": "https://staging.yeego.app/_sidecar/public/openclaw/connect"
62
+ }
63
+ }
64
+ },
65
+ "plugins": {
66
+ "entries": {
67
+ "yeego": {
68
+ "enabled": true
69
+ }
70
+ }
71
+ }
72
+ }
31
73
  ```
32
74
 
33
- Configuration saved to `~/.yeego/config.json`
75
+ **Important**: Make sure to add commas if you have other channels/plugins configured!
34
76
 
35
- ### Step 3: Start Polling
77
+ ### 4. Restart OpenClaw Gateway
36
78
 
37
79
  ```bash
38
- bun run start
80
+ openclaw gateway restart
39
81
  ```
40
82
 
41
- That's it! The plugin will:
42
- - ✅ Connect to your Yeego profile
43
- - ✅ Poll for new messages every 5 seconds
44
- - ✅ Process them through OpenClaw
45
- - ✅ Send AI responses back to Yeego
46
-
47
- ## 📱 Test It
83
+ ### 5. Test It!
48
84
 
49
85
  1. Open Yeego app
50
- 2. Send a message to your AI persona
51
- 3. Watch the poller process it
52
- 4. See the AI response appear in the app
86
+ 2. Go to your persona's chat
87
+ 3. Send a message: "Hello!"
88
+ 4. Wait a few seconds for the AI response
53
89
 
54
- ## 🔧 Troubleshooting
90
+ ## Verification
55
91
 
56
- **No messages being processed?**
57
- - Make sure you sent a message in the Yeego app
58
- - Check the profile_id matches your actual profile
92
+ Check if everything is working:
59
93
 
60
- **Connection errors?**
61
- - Verify backend is running (`http://localhost:8091`)
62
- - Check your token hasn't expired (30 days validity)
63
-
64
- **Want to reset?**
65
94
  ```bash
66
- rm -rf ~/.yeego
67
- # Then run setup again
95
+ # Check gateway logs
96
+ tail -f ~/.openclaw/logs/gateway.log | grep yeego
97
+
98
+ # You should see:
99
+ # [yeego] Starting polling channel for account: default
100
+ # [yeego] Starting message monitor...
68
101
  ```
69
102
 
70
- ## 📦 Production Deployment
103
+ ## Common Issues
71
104
 
72
- When ready to deploy:
105
+ ### "No channel config found"
73
106
 
74
- ```bash
75
- # Build standalone executable
76
- bun run build
107
+ **Problem**: Configuration not found in openclaw.json
77
108
 
78
- # Run it anywhere
79
- ./yeego-poller start
80
- ```
109
+ **Solution**:
110
+ 1. Verify the JSON structure matches the example above
111
+ 2. Ensure `channels.yeego.config` exists
112
+ 3. Run `openclaw doctor --fix`
113
+
114
+ ### "Messages not reaching OpenClaw"
115
+
116
+ **Problem**: Plugin not enabled or token expired
117
+
118
+ **Solution**:
119
+ 1. Check `plugins.entries.yeego.enabled: true`
120
+ 2. Get a fresh token from Yeego app
121
+ 3. Restart gateway: `openclaw gateway restart`
122
+
123
+ ### "Token expired" errors
124
+
125
+ **Problem**: Yeego token has expired
126
+
127
+ **Solution**:
128
+ 1. Go to Yeego app → Settings → OpenClaw
129
+ 2. Tap "Refresh Token"
130
+ 3. Update the token in openclaw.json
131
+ 4. Restart gateway
132
+
133
+ ## Next Steps
81
134
 
82
- No dependencies needed - it's a single binary! 🎉
135
+ - 📖 Read the [full documentation](README.md)
136
+ - 🛠️ Explore [available tools](README.md#available-tools)
137
+ - 💬 Join our [community](https://discord.gg/yeego)
138
+
139
+ ## Getting Help
140
+
141
+ If you're stuck:
142
+
143
+ 1. Check logs: `tail -f ~/.openclaw/logs/gateway.log`
144
+ 2. Run diagnostics: `openclaw doctor`
145
+ 3. [Open an issue](https://github.com/yeego/yeego-openclaw/issues)
146
+
147
+ ---
148
+
149
+ **Pro Tip**: Enable debug logging for more details:
150
+ ```bash
151
+ DEBUG=yeego:* openclaw gateway restart
152
+ ```
package/README.md CHANGED
@@ -1,274 +1,128 @@
1
1
  # Yeego OpenClaw Plugin
2
2
 
3
- OpenClaw channel plugin for integrating Yeego with OpenClaw AI agent.
3
+ Connect your OpenClaw AI agent to [Yeego](https://yeego.app) messaging platform for seamless AI-powered conversations.
4
4
 
5
- ## Overview
5
+ ## Features
6
6
 
7
- This plugin enables bidirectional communication between Yeego and OpenClaw:
8
-
9
- - **Inbound**: Listens to Yeego user messages via PocketBase realtime subscriptions
10
- - **Outbound**: Sends OpenClaw AI responses back to Yeego conversations
11
- - **Proactive**: Allows OpenClaw to initiate messages through cron jobs and tools
12
-
13
- ## Architecture
14
-
15
- ### Components
16
-
17
- 1. **Channel Plugin** (`src/channel.ts`)
18
- - Registers Yeego as an OpenClaw channel
19
- - Handles outbound message sending via PocketBase
20
- - Manages poller subprocess lifecycle
21
- - Implements target resolution for conversation IDs
22
-
23
- 2. **Realtime Listener** (`poller.ts`)
24
- - Subscribes to PocketBase message events
25
- - Processes incoming user messages
26
- - Calls OpenClaw agent CLI
27
- - Stores AI responses back to PocketBase
28
- - Sets messageChannel metadata (workaround for CLI limitation)
29
-
30
- 3. **Session Mapping** (`src/sessionMapping.ts`)
31
- - Maintains persistent session ↔ conversation mapping
32
- - File-based storage for cross-process sharing
33
- - Enables proactive message targeting
34
-
35
- 4. **Tools** (`src/tools/`)
36
- - Profile management tools (create, list, get profiles)
37
- - Target ID lookup for Yeego conversations
38
-
39
- ## Key Implementation Details
40
-
41
- ### Message Flow
42
-
43
- #### Inbound (User → OpenClaw)
44
- ```
45
- User Message (Yeego App)
46
-
47
- PocketBase Realtime Event
48
-
49
- Poller (poller.ts)
50
-
51
- OpenClaw Agent CLI (--reply-channel yeego)
52
-
53
- AI Response → PocketBase
54
-
55
- Yeego App displays response
56
- ```
57
-
58
- #### Outbound (OpenClaw → User)
59
- ```
60
- OpenClaw wants to send message
61
-
62
- Resolves target via messaging.targetResolver.looksLikeId
63
-
64
- Calls outbound.sendText
65
-
66
- Creates message in PocketBase
67
-
68
- Yeego App displays message
69
- ```
70
-
71
- ### Critical Workarounds
72
-
73
- #### 1. messageChannel Metadata
74
- **Problem**: OpenClaw CLI's `--reply-channel` flag doesn't set the session's `messageChannel` property.
75
-
76
- **Solution**: `setSessionMessageChannel()` in `poller.ts` directly modifies the session JSONL file after creation to inject `messageChannel: "yeego"`.
77
-
78
- ```typescript
79
- // Wait for session file creation, then patch it
80
- setTimeout(() => {
81
- this.setSessionMessageChannel(conversation.id, 'yeego');
82
- }, 1000);
83
- ```
84
-
85
- #### 2. Target Recognition
86
- **Problem**: OpenClaw's target resolver tries to look up conversation IDs in a directory, causing "Unknown target" errors.
87
-
88
- **Solution**: Implement `messaging.targetResolver.looksLikeId` to tell OpenClaw that our alphanumeric conversation IDs are valid IDs:
89
-
90
- ```typescript
91
- messaging: {
92
- targetResolver: {
93
- looksLikeId: (_raw, normalized) => /^[a-z0-9]+$/i.test(normalized),
94
- },
95
- }
96
- ```
97
-
98
- This bypasses directory lookup entirely.
99
-
100
- #### 3. Cron Job Delivery
101
-
102
- **Important**: When using cron jobs or other isolated sessions to send messages to Yeego, you must specify both `channel` and `to` parameters in the payload:
103
-
104
- ```javascript
105
- {
106
- "deliver": true,
107
- "channel": "yeego",
108
- "to": "conversation_id_here"
109
- }
110
- ```
111
-
112
- Unlike normal conversations where OpenClaw knows the origin context, cron jobs run in isolated sessions. The `channel` and `to` parameters tell OpenClaw where to deliver the message.
113
-
114
- **Example cron job configuration**:
115
- ```json
116
- {
117
- "id": "daily_reminder",
118
- "enabled": true,
119
- "schedule": "0 9 * * *",
120
- "payload": {
121
- "deliver": true,
122
- "channel": "yeego",
123
- "to": "lq45hgra9wpado5",
124
- "message": "Good morning! Don't forget your daily tasks."
125
- }
126
- }
127
- ```
128
-
129
- Without these parameters, you'll get an error: "Cron delivery requires a recipient (--to)".
7
+ - 🔄 **Bidirectional messaging** - Receive messages from Yeego users and send AI responses back
8
+ - 🔌 **Native integration** - Built specifically for OpenClaw's plugin architecture
9
+ - 📦 **PocketBase powered** - Uses Yeego's PocketBase backend for reliable message delivery
10
+ - 🛠️ **Rich tools** - Access Yeego profile data and conversation management from your AI
11
+ - 🎯 **Session persistence** - Maintains conversation context across interactions
130
12
 
131
13
  ## Installation
132
14
 
133
- ### Quick Start (Recommended)
134
-
135
- 1. Install the plugin:
136
15
  ```bash
137
- openclaw plugins install @yeego/yeego-openclaw
16
+ npm install @yeego/yeego-openclaw
138
17
  ```
139
18
 
140
- 2. Get your configuration from Yeego app:
141
- - Open Yeego mobile app
142
- - Go to Profile → Settings
143
- - Tap "Connect to OpenClaw" 🦞
144
- - Copy the configuration
19
+ ## Quick Start
20
+
21
+ ### 1. Get Yeego Credentials
145
22
 
146
- 3. Add configuration to `~/.openclaw/openclaw.json`:
23
+ In the Yeego app:
24
+ 1. Go to **Settings** → **OpenClaw Integration**
25
+ 2. Click **"Connect to OpenClaw"**
26
+ 3. Copy the configuration
147
27
 
148
- **IMPORTANT:** Configuration must be placed under `channels.yeego.config`, NOT under `plugins.entries`.
28
+ ### 2. Configure OpenClaw
29
+
30
+ Add to `~/.openclaw/openclaw.json`:
149
31
 
150
32
  ```json
151
33
  {
152
34
  "channels": {
153
35
  "yeego": {
36
+ "enabled": true,
154
37
  "config": {
155
- "token": "your-token-here",
38
+ "token": "your-yeego-token",
156
39
  "profileId": "your-profile-id",
157
- "baseUrl": "https://yeego.app",
158
- "sidecarUrl": "https://yeego.app/_sidecar",
159
- "connectUrl": "https://yeego.app/_sidecar/public/openclaw/connect"
40
+ "baseUrl": "https://staging.yeego.app",
41
+ "sidecarUrl": "https://staging.yeego.app/_sidecar",
42
+ "connectUrl": "https://staging.yeego.app/_sidecar/public/openclaw/connect"
43
+ }
44
+ }
45
+ },
46
+ "plugins": {
47
+ "entries": {
48
+ "yeego": {
49
+ "enabled": true
160
50
  }
161
51
  }
162
52
  }
163
53
  }
164
54
  ```
165
55
 
166
- 4. Restart OpenClaw gateway:
56
+ ### 3. Restart OpenClaw
57
+
167
58
  ```bash
168
59
  openclaw gateway restart
169
60
  ```
170
61
 
171
- The plugin will automatically:
172
- - ✅ Enable the Yeego channel
173
- - ✅ Start the message poller process
174
- - ✅ Connect to your Yeego profile
175
-
176
- ### Manual Installation (Development)
177
-
178
- For local development, contact the Yeego team for access to the plugin source code.
179
-
180
- ### Configuration Files
62
+ That's it! Send a message in Yeego to test.
181
63
 
182
- The plugin creates and manages these files automatically:
183
- - `~/.yeego/config.json` - Yeego credentials (auto-generated from OpenClaw config)
184
- - `~/.openclaw/yeego-sessions/session-mappings.json` - Session mappings
185
- - `~/.yeego/processed.json` - Processed message IDs (deduplication)
186
-
187
- ## Development
188
-
189
- ### File Structure
64
+ ## How It Works
190
65
 
191
66
  ```
192
- openclaw-plugin/
193
- ├── index.ts # Plugin entry point
194
- ├── poller.ts # Realtime listener (subprocess)
195
- ├── src/
196
- │ ├── channel.ts # Channel plugin implementation
197
- │ ├── sessionMapping.ts # Session storage
198
- │ └── tools/
199
- │ ├── index.ts # Tool factory
200
- │ ├── profileTools.ts # Profile management
201
- │ └── pocketbase.ts # PocketBase client wrapper
202
- ├── package.json
203
- └── README.md
67
+ Yeego App → PocketBase → Monitor → OpenClaw Agent
68
+ ↑ ↓
69
+ └────────────────────────────────────┘
70
+ Response delivered back
204
71
  ```
205
72
 
206
- ### Type Safety
73
+ The plugin polls PocketBase every 5 seconds for new messages, routes them to your OpenClaw agent, and delivers responses back to Yeego.
207
74
 
208
- All code uses TypeScript with strict typing:
209
- - PocketBase record types
210
- - OpenClaw plugin SDK types
211
- - Explicit return types for all functions
212
- - No `any` types (except for globalThis polyfill)
75
+ ## Available Tools
213
76
 
214
- ### Code Style
77
+ Your agent can use these Yeego-specific tools:
215
78
 
216
- - Clear section separators with `// ===` comments
217
- - Descriptive function and variable names
218
- - JSDoc comments for public APIs
219
- - Grouped related functions
220
- - Constants at top of file
79
+ - `get_yeego_target_id` - Resolve conversation IDs
80
+ - `view_user_profile_data` - Access profile information
81
+ - `view_full_profile` - View complete profile
82
+ - `update_profile_field` - Modify profile fields
221
83
 
222
- ## Testing
84
+ ## Troubleshooting
223
85
 
224
- Send a message in Yeego app to test the integration. Check logs:
86
+ ### Messages not reaching OpenClaw
225
87
 
226
- ```bash
227
- tail -f ~/.openclaw/logs/gateway.log | grep Yeego
228
- ```
229
-
230
- Expected flow:
231
- 1. `[Yeego] New message detected`
232
- 2. `[Yeego] Processing message`
233
- 3. `[Yeego] ✓ Set messageChannel="yeego"`
234
- 4. `[Yeego] Message delivered`
88
+ 1. Verify configuration in `~/.openclaw/openclaw.json`
89
+ 2. Check `plugins.entries.yeego.enabled: true`
90
+ 3. Restart gateway: `openclaw gateway restart`
91
+ 4. Check logs: `tail -f ~/.openclaw/logs/gateway.log | grep yeego`
235
92
 
236
- ## Troubleshooting
93
+ ### Agent not responding
237
94
 
238
- ### "Unknown target" errors
239
- - Check that `messaging.targetResolver.looksLikeId` is implemented
240
- - Verify conversation ID format is alphanumeric
95
+ 1. Check for errors: `tail -f /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep yeego`
96
+ 2. Verify PocketBase connection (check baseUrl)
97
+ 3. Ensure token is valid and not expired
241
98
 
242
- ### "Failed to connect to PocketBase"
243
- - Use `127.0.0.1` instead of `localhost` in config
244
- - Verify PocketBase is running: `curl http://127.0.0.1:8091/api/health`
99
+ ## Development
245
100
 
246
- ### Messages go to wrong channel
247
- - Check `~/.openclaw/agents/main/sessions/{sessionId}.jsonl`
248
- - First line should contain `"messageChannel": "yeego"`
249
- - If missing, poller's `setSessionMessageChannel()` may have failed
101
+ ```bash
102
+ # Clone repository
103
+ git clone https://github.com/yeego/yeego-openclaw
104
+ cd yeego-openclaw
250
105
 
251
- ### Poller not starting
252
- - Check gateway logs: `tail ~/.openclaw/logs/gateway.log`
253
- - Verify tsx is available: `which tsx`
254
- - Check poller config: `cat ~/.yeego/config.json`
106
+ # Install dependencies
107
+ npm install
255
108
 
256
- ### "Cron delivery requires a recipient (--to)"
257
- This error occurs when a cron job or isolated session tries to send messages without specifying the delivery target.
109
+ # Link for local development
110
+ npm link
258
111
 
259
- **Solution**: Add `channel` and `to` parameters to your cron job payload:
260
- ```json
261
- {
262
- "payload": {
263
- "deliver": true,
264
- "channel": "yeego",
265
- "to": "conversation_id"
266
- }
267
- }
112
+ # Install in OpenClaw
113
+ openclaw plugin install @yeego/yeego-openclaw
268
114
  ```
269
115
 
270
- See the "Cron Job Delivery" section under "Key Implementation Details" for more information.
116
+ ## Support
117
+
118
+ - **Documentation**: [https://docs.yeego.app](https://docs.yeego.app)
119
+ - **Issues**: [GitHub Issues](https://github.com/yeego/yeego-openclaw/issues)
120
+ - **Yeego App**: [https://yeego.app](https://yeego.app)
271
121
 
272
122
  ## License
273
123
 
274
- Part of the Yeego application.
124
+ MIT License - see [LICENSE](LICENSE) file
125
+
126
+ ---
127
+
128
+ Made with ❤️ by the Yeego Team