@decentchat/decentclaw 0.1.5 → 0.1.6

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/index.ts CHANGED
@@ -1,17 +1,11 @@
1
- import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
2
- import { emptyPluginConfigSchema } from 'openclaw/plugin-sdk';
1
+ import { defineChannelPluginEntry } from 'openclaw/plugin-sdk/core';
3
2
  import { decentChatPlugin } from './src/channel.js';
4
3
  import { setDecentChatRuntime } from './src/runtime.js';
5
4
 
6
- const plugin = {
5
+ export default defineChannelPluginEntry({
7
6
  id: 'decentclaw',
8
7
  name: 'DecentChat',
9
8
  description: 'DecentChat P2P channel plugin',
10
- configSchema: emptyPluginConfigSchema(),
11
- register(api: OpenClawPluginApi) {
12
- setDecentChatRuntime(api.runtime);
13
- api.registerChannel({ plugin: decentChatPlugin });
14
- },
15
- };
16
-
17
- export default plugin;
9
+ plugin: decentChatPlugin,
10
+ setRuntime: setDecentChatRuntime,
11
+ });
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "id": "decentclaw",
3
+ "kind": "channel",
3
4
  "name": "DecentChat",
4
- "version": "0.1.1",
5
+ "version": "0.1.6",
5
6
  "channels": ["decentchat"],
6
7
  "description": "DecentChat P2P channel plugin for OpenClaw — P2P encrypted chat",
7
8
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentchat/decentclaw",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "OpenClaw channel plugin for DecentChat — P2P encrypted chat",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -8,17 +8,22 @@
8
8
  "extensions": [
9
9
  "./index.ts"
10
10
  ],
11
+ "setupEntry": "./setup-entry.ts",
11
12
  "channel": {
12
13
  "id": "decentchat",
13
14
  "label": "DecentChat",
14
15
  "selectionLabel": "DecentChat (P2P)",
15
16
  "docsPath": "/channels/decentchat",
16
17
  "blurb": "P2P encrypted chat via DecentChat."
18
+ },
19
+ "install": {
20
+ "npmSpec": "@decentchat/decentclaw"
17
21
  }
18
22
  },
19
23
  "files": [
20
24
  "src",
21
25
  "index.ts",
26
+ "setup-entry.ts",
22
27
  "openclaw.plugin.json"
23
28
  ],
24
29
  "repository": {
package/setup-entry.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { defineSetupPluginEntry } from 'openclaw/plugin-sdk/core';
2
+ import { decentChatPlugin } from './src/channel.js';
3
+
4
+ export default defineSetupPluginEntry(decentChatPlugin);
package/src/channel.ts CHANGED
@@ -539,10 +539,15 @@ export async function bootstrapDecentChatCompanySimForStartup(params: {
539
539
  // ---------------------------------------------------------------------------
540
540
 
541
541
  const CHANNEL = "decentchat";
542
- const seedPhraseManager = new SeedPhraseManager();
542
+
543
+ let _seedPhraseManager: InstanceType<typeof SeedPhraseManager> | undefined;
544
+ function getSeedPhraseManager() {
545
+ if (!_seedPhraseManager) _seedPhraseManager = new SeedPhraseManager();
546
+ return _seedPhraseManager;
547
+ }
543
548
 
544
549
  function validateSeedPhrase(mnemonic: string): string | undefined {
545
- const result = seedPhraseManager.validate(mnemonic);
550
+ const result = getSeedPhraseManager().validate(mnemonic);
546
551
  if (!result.valid) return result.error ?? "Invalid seed phrase";
547
552
  return undefined;
548
553
  }
@@ -593,7 +598,7 @@ const decentChatSetupWizard: ChannelSetupWizard = {
593
598
  });
594
599
 
595
600
  if (generateNew) {
596
- const { mnemonic } = seedPhraseManager.generate();
601
+ const { mnemonic } = getSeedPhraseManager().generate();
597
602
  await prompter.note(
598
603
  [
599
604
  `Your new seed phrase:`,