@unicitylabs/openclaw-unicity 0.5.8 → 0.5.10
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/package.json +3 -3
- package/src/channel.ts +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unicitylabs/openclaw-unicity",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Unicity wallet identity and encrypted DMs for OpenClaw agents — powered by Sphere SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@clack/prompts": "^0.10.0",
|
|
46
46
|
"@sinclair/typebox": "^0.34.48",
|
|
47
|
-
"@unicitylabs/sphere-sdk": "0.6.8
|
|
47
|
+
"@unicitylabs/sphere-sdk": "^0.6.8"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"openclaw": "*"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"openclaw": "^2026.3.
|
|
53
|
+
"openclaw": "^2026.3.13",
|
|
54
54
|
"oxlint": "^1.43.0",
|
|
55
55
|
"vitest": "^4.0.18"
|
|
56
56
|
},
|
package/src/channel.ts
CHANGED
|
@@ -243,6 +243,7 @@ export const unicityChannelPlugin = {
|
|
|
243
243
|
publicKey: sphere.identity?.chainPubkey,
|
|
244
244
|
nametag: sphere.identity?.nametag,
|
|
245
245
|
running: true,
|
|
246
|
+
connected: true,
|
|
246
247
|
lastStartAt: Date.now(),
|
|
247
248
|
});
|
|
248
249
|
|
|
@@ -287,6 +288,7 @@ export const unicityChannelPlugin = {
|
|
|
287
288
|
|
|
288
289
|
function dispatchDm(msg: DmMsg): void {
|
|
289
290
|
sendersInFlight.add(msg.senderPubkey);
|
|
291
|
+
ctx.setStatus({ lastEventAt: Date.now() });
|
|
290
292
|
|
|
291
293
|
// Immediately signal that we're composing a reply
|
|
292
294
|
sphere.communications.sendComposingIndicator(msg.senderPubkey)
|
|
@@ -412,6 +414,7 @@ export const unicityChannelPlugin = {
|
|
|
412
414
|
|
|
413
415
|
// Subscribe to incoming token transfers
|
|
414
416
|
const unsubTransfer = sphere.on("transfer:incoming", (transfer) => {
|
|
417
|
+
ctx.setStatus({ lastEventAt: Date.now() });
|
|
415
418
|
// Full address for DM replies; short form for display/logging only
|
|
416
419
|
const replyTo = transfer.senderNametag ? `@${transfer.senderNametag}` : transfer.senderPubkey;
|
|
417
420
|
const displayName = transfer.senderNametag ? `@${transfer.senderNametag}` : transfer.senderPubkey.slice(0, 12) + "…";
|
|
@@ -474,6 +477,7 @@ export const unicityChannelPlugin = {
|
|
|
474
477
|
|
|
475
478
|
// Subscribe to incoming payment requests
|
|
476
479
|
const unsubPaymentRequest = sphere.on("payment_request:incoming", (request) => {
|
|
480
|
+
ctx.setStatus({ lastEventAt: Date.now() });
|
|
477
481
|
const replyTo = request.senderNametag ? `@${request.senderNametag}` : request.senderPubkey;
|
|
478
482
|
const displayName = request.senderNametag ? `@${request.senderNametag}` : request.senderPubkey.slice(0, 12) + "…";
|
|
479
483
|
const decimals = getCoinDecimals(request.coinId) ?? 0;
|
|
@@ -628,6 +632,7 @@ export const unicityChannelPlugin = {
|
|
|
628
632
|
|
|
629
633
|
// Subscribe to incoming group messages
|
|
630
634
|
const unsubGroupMessage = sphere.groupChat?.onMessage?.((msg: GroupMsg) => {
|
|
635
|
+
ctx.setStatus({ lastEventAt: Date.now() });
|
|
631
636
|
// Skip messages from self (echoed back by the relay).
|
|
632
637
|
// Compare against the Nostr x-only pubkey, not chainPubkey.
|
|
633
638
|
if (myNostrPubkey && msg.senderPubkey === myNostrPubkey) return;
|
|
@@ -716,18 +721,17 @@ export const unicityChannelPlugin = {
|
|
|
716
721
|
// Store cleanup so auto-restart can tear down stale handlers
|
|
717
722
|
previousGatewayCleanup = cleanupSubscriptions;
|
|
718
723
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
return {
|
|
725
|
-
stop: () => {
|
|
724
|
+
// The gateway expects startAccount to return a Promise that stays pending
|
|
725
|
+
// while the channel is running. Resolving immediately triggers a restart loop.
|
|
726
|
+
return new Promise<void>((resolve) => {
|
|
727
|
+
ctx.abortSignal.addEventListener("abort", () => {
|
|
726
728
|
cleanupSubscriptions();
|
|
727
729
|
previousGatewayCleanup = null;
|
|
730
|
+
ctx.setStatus({ connected: false, running: false });
|
|
728
731
|
ctx.log?.info(`[${ctx.account.accountId}] Unicity channel stopped`);
|
|
729
|
-
|
|
730
|
-
|
|
732
|
+
resolve();
|
|
733
|
+
}, { once: true });
|
|
734
|
+
});
|
|
731
735
|
},
|
|
732
736
|
},
|
|
733
737
|
|