@zbruceli/openclaw-dchat 0.1.8 → 0.1.9

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/package.json +1 -1
  2. package/src/channel.ts +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zbruceli/openclaw-dchat",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "OpenClaw D-Chat/nMobile channel plugin — decentralized E2E encrypted messaging over the NKN relay network",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -267,14 +267,22 @@ export const dchatPlugin: ChannelPlugin<ResolvedDchatAccount> = {
267
267
  },
268
268
  },
269
269
  status: {
270
- defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
270
+ defaultRuntime: {
271
+ ...createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
272
+ connected: false,
273
+ lastConnectedAt: null,
274
+ },
271
275
  buildChannelSummary: ({ snapshot }) => ({
272
276
  ...buildBaseChannelStatusSummary(snapshot),
273
277
  nknAddress: snapshot.nknAddress ?? null,
278
+ connected: snapshot.connected ?? false,
279
+ lastConnectedAt: snapshot.lastConnectedAt ?? null,
274
280
  }),
275
281
  buildAccountSnapshot: ({ account, runtime }) => ({
276
282
  ...buildBaseAccountStatusSnapshot({ account, runtime }),
277
283
  nknAddress: account.nknAddress ?? null,
284
+ connected: (runtime as Record<string, unknown>)?.connected ?? false,
285
+ lastConnectedAt: (runtime as Record<string, unknown>)?.lastConnectedAt ?? null,
278
286
  }),
279
287
  collectStatusIssues: (accounts) => collectStatusIssuesFromLastError("dchat", accounts),
280
288
  },
@@ -307,7 +315,9 @@ export const dchatPlugin: ChannelPlugin<ResolvedDchatAccount> = {
307
315
  accountId: account.accountId,
308
316
  baseUrl: address,
309
317
  running: true,
318
+ connected: true,
310
319
  lastStartAt: Date.now(),
320
+ lastConnectedAt: Date.now(),
311
321
  });
312
322
  logger.info(`[${account.accountId}] connected as ${address}`);
313
323
 
@@ -594,6 +604,7 @@ export const dchatPlugin: ChannelPlugin<ResolvedDchatAccount> = {
594
604
  const errMsg = err instanceof Error ? err.message : String(err);
595
605
  ctx.setStatus({
596
606
  accountId: account.accountId,
607
+ connected: false,
597
608
  lastError: errMsg,
598
609
  lastStopAt: Date.now(),
599
610
  });