@eclaw/openclaw-channel 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/dist/gateway.js +11 -10
  2. package/package.json +1 -1
package/dist/gateway.js CHANGED
@@ -80,16 +80,17 @@ export async function startAccount(ctx) {
80
80
  // Register callback with E-Claw backend
81
81
  const regData = await client.registerCallback(callbackUrl, callbackToken);
82
82
  console.log(`[E-Claw] Registered with E-Claw. Device: ${regData.deviceId}, Entities: ${regData.entities.length}`);
83
- // Auto-bind entity if not already bound
84
- const entity = regData.entities.find(e => e.entityId === account.entityId);
85
- if (!entity?.isBound) {
86
- console.log(`[E-Claw] Entity ${account.entityId} not bound, binding...`);
87
- const bindData = await client.bindEntity(account.entityId, account.botName);
88
- console.log(`[E-Claw] Bound entity ${account.entityId}, publicCode: ${bindData.publicCode}`);
89
- }
90
- else {
91
- console.log(`[E-Claw] Entity ${account.entityId} already bound, skipping bind`);
92
- }
83
+ // Bind entity via channel API.
84
+ // /api/channel/bind is idempotent for the same channel account:
85
+ // - Not bound → binds fresh, returns new botSecret
86
+ // - Already bound via this channel account returns existing botSecret
87
+ // - Bound via different method → throws error (user must unbind first)
88
+ const entityInfo = regData.entities.find(e => e.entityId === account.entityId);
89
+ const alreadyBound = entityInfo?.isBound ?? false;
90
+ const bindData = await client.bindEntity(account.entityId, account.botName);
91
+ console.log(alreadyBound
92
+ ? `[E-Claw] Entity ${account.entityId} reconnected (existing channel binding), publicCode: ${bindData.publicCode}`
93
+ : `[E-Claw] Entity ${account.entityId} bound, publicCode: ${bindData.publicCode}`);
93
94
  console.log(`[E-Claw] Account ${accountId} ready!`);
94
95
  }
95
96
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclaw/openclaw-channel",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "E-Claw channel plugin for OpenClaw — AI chat platform for live wallpaper entities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",