@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.
- package/dist/gateway.js +11 -10
- 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
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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) {
|