openclaw-app 1.0.0 → 1.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/README.md +6 -6
- package/index.ts +12 -10
- package/openclaw.plugin.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ OpenClaw channel plugin for the Mobile app. Routes messages through a Cloudflare
|
|
|
8
8
|
Mobile App ←WS→ [CF Worker / Durable Object] ←WS→ [OpenClaw Plugin] → Gateway Pipeline
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
1. Plugin registers an `openclaw-
|
|
11
|
+
1. Plugin registers an `openclaw-app` channel with the Gateway
|
|
12
12
|
2. Gateway manages the channel lifecycle (start, stop, health monitoring)
|
|
13
13
|
3. The plugin connects outbound to the CF Worker relay via WebSocket
|
|
14
14
|
4. User messages from the mobile app flow through the relay into the Gateway's inbound pipeline
|
|
@@ -67,7 +67,7 @@ Add to `~/.openclaw/openclaw.json`:
|
|
|
67
67
|
```json
|
|
68
68
|
{
|
|
69
69
|
"channels": {
|
|
70
|
-
"openclaw-
|
|
70
|
+
"openclaw-app": {
|
|
71
71
|
"accounts": {
|
|
72
72
|
"default": {
|
|
73
73
|
"enabled": true,
|
|
@@ -99,12 +99,12 @@ Open the Control UI at http://127.0.0.1:18789/ and navigate to the **OpenClaw Mo
|
|
|
99
99
|
You can also check logs:
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
|
-
tail -f ~/.openclaw/logs/gateway.log | grep openclaw-
|
|
102
|
+
tail -f ~/.openclaw/logs/gateway.log | grep openclaw-app
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
## Configuration
|
|
106
106
|
|
|
107
|
-
All config lives under `channels.openclaw-
|
|
107
|
+
All config lives under `channels.openclaw-app.accounts.<accountId>` in `~/.openclaw/openclaw.json`.
|
|
108
108
|
|
|
109
109
|
| Field | Type | Required | Default | Description |
|
|
110
110
|
|-------|------|----------|---------|-------------|
|
|
@@ -171,7 +171,7 @@ The plugin echoes back the exact `sessionKey` it received from the app, so the F
|
|
|
171
171
|
| Running: No | `startAccount` returned early (old plugin version) | Update the plugin and restart Gateway |
|
|
172
172
|
| Connected: No | Relay URL wrong or Worker not deployed | Check `relayUrl` in config; verify Worker is live with `curl https://your-relay.workers.dev/health` |
|
|
173
173
|
| Relay keeps disconnecting | Ping keepalive not working or network issue | Check logs for "WebSocket error"; ensure relay Worker is deployed with Durable Objects enabled |
|
|
174
|
-
| "relayUrl not configured" in logs | Missing `relayUrl` in account config | Add `relayUrl` under `channels.openclaw-
|
|
174
|
+
| "relayUrl not configured" in logs | Missing `relayUrl` in account config | Add `relayUrl` under `channels.openclaw-app.accounts.default` |
|
|
175
175
|
| Enable toggle in UI doesn't match JSON | Missing `setAccountEnabled` adapter (old plugin version) | Update the plugin and restart Gateway |
|
|
176
176
|
| `relayToken` mismatch | Token in config doesn't match Worker secret | Ensure `relayToken` matches the `RELAY_TOKEN` secret set on the Worker |
|
|
177
177
|
| App stuck loading, no reply shown | sessionKey mismatch between app and plugin | Ensure app sends `sessionKey` in message payload and plugin version ≥ current |
|
|
@@ -186,7 +186,7 @@ openclaw plugins list
|
|
|
186
186
|
openclaw channels status --probe
|
|
187
187
|
|
|
188
188
|
# Live logs
|
|
189
|
-
tail -f ~/.openclaw/logs/gateway.log | grep openclaw-
|
|
189
|
+
tail -f ~/.openclaw/logs/gateway.log | grep openclaw-app
|
|
190
190
|
|
|
191
191
|
# Verify relay is reachable
|
|
192
192
|
curl https://openclaw-relay.your-name.workers.dev/health
|
package/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenClaw Mobile Channel Plugin
|
|
3
3
|
*
|
|
4
|
-
* Registers "openclaw-
|
|
4
|
+
* Registers "openclaw-app" channel that bridges Gateway <-> CF Worker relay <-> Mobile App.
|
|
5
5
|
* Plugin runs inside the Gateway process, connects outbound to the relay.
|
|
6
6
|
* No external dependencies — uses Node.js built-in WebSocket.
|
|
7
7
|
*
|
|
8
8
|
* Config (in ~/.openclaw/openclaw.json):
|
|
9
9
|
* {
|
|
10
10
|
* "channels": {
|
|
11
|
-
* "openclaw-
|
|
11
|
+
* "openclaw-app": {
|
|
12
12
|
* "accounts": {
|
|
13
13
|
* "default": {
|
|
14
14
|
* "enabled": true,
|
|
@@ -171,7 +171,7 @@ const relayStates = new Map<string, RelayState>();
|
|
|
171
171
|
const RECONNECT_DELAY = 5000;
|
|
172
172
|
const PING_INTERVAL = 30_000; // 30s keepalive — prevents DO hibernation
|
|
173
173
|
const DEFAULT_ACCOUNT_ID = "default";
|
|
174
|
-
const CHANNEL_ID = "openclaw-
|
|
174
|
+
const CHANNEL_ID = "openclaw-app";
|
|
175
175
|
|
|
176
176
|
function getRelayState(accountId: string): RelayState {
|
|
177
177
|
let state = relayStates.get(accountId);
|
|
@@ -184,7 +184,7 @@ function getRelayState(accountId: string): RelayState {
|
|
|
184
184
|
|
|
185
185
|
// ── Account resolution ───────────────────────────────────────────────────────
|
|
186
186
|
|
|
187
|
-
/** Default relay deployed at https://github.com/openclaw/openclaw-
|
|
187
|
+
/** Default relay deployed at https://github.com/openclaw/openclaw-app */
|
|
188
188
|
const DEFAULT_RELAY_URL = "wss://openclaw-relay.eldermoo8718.workers.dev";
|
|
189
189
|
const DEFAULT_ROOM_ID = "default";
|
|
190
190
|
|
|
@@ -575,10 +575,12 @@ async function handleRelayMessage(ctx: any, accountId: string, state: RelayState
|
|
|
575
575
|
ctx.log?.warn?.(`[${CHANNEL_ID}] [${accountId}] [E2E] peer_joined missing sessionKey, ignoring`);
|
|
576
576
|
return;
|
|
577
577
|
}
|
|
578
|
-
//
|
|
578
|
+
// Always restart E2E when peer_joined arrives — the app may have
|
|
579
|
+
// reconnected with a fresh _e2eReadyCompleter and is waiting for a
|
|
580
|
+
// new handshake even if we still hold an old session state.
|
|
579
581
|
if (state.e2eSessions.has(sessionKey)) {
|
|
580
|
-
ctx.log?.info?.(`[${CHANNEL_ID}] [${accountId}] [E2E] Session ${sessionKey}
|
|
581
|
-
|
|
582
|
+
ctx.log?.info?.(`[${CHANNEL_ID}] [${accountId}] [E2E] Session ${sessionKey} reconnected, resetting E2E state`);
|
|
583
|
+
state.e2eSessions.delete(sessionKey);
|
|
582
584
|
}
|
|
583
585
|
ctx.log?.info?.(`[${CHANNEL_ID}] [${accountId}] [E2E] App session joined (${sessionKey}), sending handshake`);
|
|
584
586
|
const sessionE2E = makeE2EState();
|
|
@@ -856,11 +858,11 @@ export default function register(api: any) {
|
|
|
856
858
|
};
|
|
857
859
|
|
|
858
860
|
await runtime.config.writeConfigFile(patched);
|
|
859
|
-
api.logger?.info?.(`[openclaw-
|
|
861
|
+
api.logger?.info?.(`[openclaw-app] Wrote default account config (relayUrl=${DEFAULT_RELAY_URL}, roomId=${DEFAULT_ROOM_ID})`);
|
|
860
862
|
} catch (err) {
|
|
861
|
-
api.logger?.warn?.(`[openclaw-
|
|
863
|
+
api.logger?.warn?.(`[openclaw-app] Could not write default config: ${err}`);
|
|
862
864
|
}
|
|
863
865
|
});
|
|
864
866
|
|
|
865
|
-
api.logger?.info?.("[openclaw-
|
|
867
|
+
api.logger?.info?.("[openclaw-app] Plugin registered");
|
|
866
868
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "openclaw-app",
|
|
3
3
|
"name": "OpenClaw App",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "Mobile app channel for OpenClaw — chat via the OpenClaw Mobile app through a Cloudflare Worker relay.",
|
|
6
6
|
"channels": [
|
|
7
|
-
"openclaw-
|
|
7
|
+
"openclaw-app"
|
|
8
8
|
],
|
|
9
9
|
"configSchema": {
|
|
10
10
|
"type": "object",
|