openclaw-overlay-plugin 0.7.50 → 0.7.51

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 (3) hide show
  1. package/dist/index.js +26 -45
  2. package/index.ts +29 -48
  3. package/package.json +1 -4
package/dist/index.js CHANGED
@@ -579,6 +579,32 @@ export default function register(api) {
579
579
  startBackgroundService(env, cliPath, api.logger);
580
580
  // Start auto-import
581
581
  startAutoImport(env, cliPath, api.logger);
582
+ // Auto-check for registration on startup
583
+ (async () => {
584
+ try {
585
+ const regPath = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
586
+ const onboardSentFile = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
587
+ if (!fs.existsSync(regPath) && !fs.existsSync(onboardSentFile)) {
588
+ const walletPath = path.join(pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet'), 'wallet-identity.json');
589
+ if (fs.existsSync(walletPath)) {
590
+ // Wallet exists but not registered.
591
+ const balResult = await execFileAsync('node', [cliPath, 'balance'], { env });
592
+ const balance = parseCliOutput(balResult.stdout);
593
+ if ((balance.data?.walletBalance || 0) >= 1000) {
594
+ // Funded but not registered. Auto-register.
595
+ const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
596
+ if (parseCliOutput(regResult.stdout).success) {
597
+ api.logger.info('[openclaw-overlay] Agent auto-registered on startup');
598
+ await autoAdvertiseServices(env, cliPath, api.logger);
599
+ }
600
+ }
601
+ }
602
+ }
603
+ }
604
+ catch (err) {
605
+ api.logger.debug(`[openclaw-overlay] Auto-setup/onboarding skipped: ${err.message}`);
606
+ }
607
+ })();
582
608
  api.logger.info("BSV overlay WebSocket relay started");
583
609
  }
584
610
  catch (error) {
@@ -590,51 +616,6 @@ export default function register(api) {
590
616
  stopBackgroundService();
591
617
  }
592
618
  });
593
- // Register a skill-style wake handler
594
- api.registerHook({
595
- id: "openclaw-overlay-wake",
596
- event: "gateway:start",
597
- handler: async (ctx) => {
598
- // Auto-check for registration on startup
599
- (async () => {
600
- try {
601
- const env = buildEnvironment(pluginConfig);
602
- const cliPath = getCliPath();
603
- const regPath = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
604
- const onboardSentFile = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
605
- if (!fs.existsSync(regPath) && !fs.existsSync(onboardSentFile)) {
606
- // Check if wallet exists
607
- const walletPath = path.join(pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet'), 'wallet-identity.json');
608
- if (!fs.existsSync(walletPath)) {
609
- // No wallet, no registration — first run ever.
610
- // We'll let startAutoImport create the wallet via 'address' command,
611
- // then it will wake the agent when funded.
612
- }
613
- else {
614
- // Wallet exists but not registered.
615
- const balResult = await execFileAsync('node', [cliPath, 'balance'], { env });
616
- const balance = parseCliOutput(balResult.stdout);
617
- if ((balance.data?.walletBalance || 0) < 1000) {
618
- // Funded less than 1000, need more funds to register.
619
- // We don't wake up here, we wait for auto-import to detect new funds.
620
- }
621
- else {
622
- // Funded but not registered. Auto-register.
623
- const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
624
- if (parseCliOutput(regResult.stdout).success) {
625
- ctx.logger.info('[openclaw-overlay] Agent auto-registered on startup');
626
- await autoAdvertiseServices(env, cliPath, ctx.logger);
627
- }
628
- }
629
- }
630
- }
631
- }
632
- catch (err) {
633
- api.log?.debug?.('[openclaw-overlay] Auto-setup/onboarding skipped:', err.message);
634
- }
635
- })();
636
- }
637
- });
638
619
  // Register CLI extensions
639
620
  api.registerCli(({ program }) => {
640
621
  const overlay = program.command("overlay").description("BSV Overlay Network management");
package/index.ts CHANGED
@@ -629,6 +629,35 @@ export default function register(api: any) {
629
629
  // Start auto-import
630
630
  startAutoImport(env, cliPath, api.logger);
631
631
 
632
+ // Auto-check for registration on startup
633
+ (async () => {
634
+ try {
635
+ const regPath = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
636
+ const onboardSentFile = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
637
+
638
+ if (!fs.existsSync(regPath) && !fs.existsSync(onboardSentFile)) {
639
+ const walletPath = path.join(pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet'), 'wallet-identity.json');
640
+
641
+ if (fs.existsSync(walletPath)) {
642
+ // Wallet exists but not registered.
643
+ const balResult = await execFileAsync('node', [cliPath, 'balance'], { env });
644
+ const balance = parseCliOutput(balResult.stdout);
645
+
646
+ if ((balance.data?.walletBalance || 0) >= 1000) {
647
+ // Funded but not registered. Auto-register.
648
+ const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
649
+ if (parseCliOutput(regResult.stdout).success) {
650
+ api.logger.info('[openclaw-overlay] Agent auto-registered on startup');
651
+ await autoAdvertiseServices(env, cliPath, api.logger);
652
+ }
653
+ }
654
+ }
655
+ }
656
+ } catch (err: any) {
657
+ api.logger.debug(`[openclaw-overlay] Auto-setup/onboarding skipped: ${err.message}`);
658
+ }
659
+ })();
660
+
632
661
  api.logger.info("BSV overlay WebSocket relay started");
633
662
  } catch (error: any) {
634
663
  api.logger.error(`Failed to start BSV overlay relay: ${error.message}`);
@@ -640,54 +669,6 @@ export default function register(api: any) {
640
669
  }
641
670
  });
642
671
 
643
- // Register a skill-style wake handler
644
- api.registerHook({
645
- id: "openclaw-overlay-wake",
646
- event: "gateway:start",
647
- handler: async (ctx: any) => {
648
- // Auto-check for registration on startup
649
- (async () => {
650
- try {
651
- const env = buildEnvironment(pluginConfig);
652
- const cliPath = getCliPath();
653
-
654
- const regPath = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'registration.json');
655
- const onboardSentFile = path.join(process.env.HOME || '', '.openclaw', 'openclaw-overlay', 'onboarding-sent.flag');
656
-
657
- if (!fs.existsSync(regPath) && !fs.existsSync(onboardSentFile)) {
658
- // Check if wallet exists
659
- const walletPath = path.join(pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet'), 'wallet-identity.json');
660
-
661
- if (!fs.existsSync(walletPath)) {
662
- // No wallet, no registration — first run ever.
663
- // We'll let startAutoImport create the wallet via 'address' command,
664
- // then it will wake the agent when funded.
665
- } else {
666
- // Wallet exists but not registered.
667
- const balResult = await execFileAsync('node', [cliPath, 'balance'], { env });
668
- const balance = parseCliOutput(balResult.stdout);
669
-
670
- if ((balance.data?.walletBalance || 0) < 1000) {
671
- // Funded less than 1000, need more funds to register.
672
- // We don't wake up here, we wait for auto-import to detect new funds.
673
- } else {
674
- // Funded but not registered. Auto-register.
675
- const regResult = await execFileAsync('node', [cliPath, 'register'], { env, timeout: 60000 });
676
- if (parseCliOutput(regResult.stdout).success) {
677
- ctx.logger.info('[openclaw-overlay] Agent auto-registered on startup');
678
- await autoAdvertiseServices(env, cliPath, ctx.logger);
679
- }
680
- }
681
- }
682
- }
683
-
684
- } catch (err: any) {
685
- api.log?.debug?.('[openclaw-overlay] Auto-setup/onboarding skipped:', err.message);
686
- }
687
- })();
688
- }
689
- });
690
-
691
672
  // Register CLI extensions
692
673
  api.registerCli(({ program }: any) => {
693
674
  const overlay = program.command("overlay").description("BSV Overlay Network management");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-overlay-plugin",
3
- "version": "0.7.50",
3
+ "version": "0.7.51",
4
4
  "description": "Openclaw BSV Overlay — agent discovery, service marketplace, and micropayments on the BSV blockchain",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,9 +70,6 @@
70
70
  "extensions": [
71
71
  "./dist/index.js"
72
72
  ],
73
- "hooks": [
74
- "./dist/index.js"
75
- ],
76
73
  "compat": {
77
74
  "pluginApi": "1",
78
75
  "minGatewayVersion": "2026.3.1"